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.
- package/README.md +34 -2
- package/THIRD-PARTY-NOTICES.md +27604 -0
- package/bin/superfactory.js +57 -0
- package/cli/agent-rf446fr1.js +2 -0
- package/cli/agent-state-wv62c1td.js +2 -0
- package/cli/bin-0cvfmkhh.js +33 -0
- package/cli/bin-0t68hf99.js +3 -0
- package/cli/bin-19vpzq7g.js +4 -0
- package/cli/bin-37w316c6.js +3 -0
- package/cli/bin-3dsqxzbz.js +3 -0
- package/cli/bin-4j0jjd8g.js +3 -0
- package/cli/bin-4tdqjbbd.js +229 -0
- package/cli/bin-4zvje4sn.js +502 -0
- package/cli/bin-674kd343.js +7 -0
- package/cli/bin-8jdkg4ke.js +3 -0
- package/cli/bin-d99yte0j.js +5 -0
- package/cli/bin-fgvkq9cq.js +867 -0
- package/cli/bin-fkp3j5f3.js +3 -0
- package/cli/bin-fypan1f6.js +951 -0
- package/cli/bin-gg19acwr.js +4 -0
- package/cli/bin-ghp5x0x5.js +139 -0
- package/cli/bin-gk00mnmn.js +5 -0
- package/cli/bin-gne2w036.js +29 -0
- package/cli/bin-grxzwpe8.js +3 -0
- package/cli/bin-h57gajkz.js +8 -0
- package/cli/bin-mbpvzx2b.js +8 -0
- package/cli/bin-nnq8kd9z.js +4 -0
- package/cli/bin-ven2efjq.js +3 -0
- package/cli/bin-yqb1d1mw.js +22 -0
- package/cli/bin-z5b3tt05.js +20 -0
- package/cli/bin-za1by1n5.js +3 -0
- package/cli/bin-zpfe0pxz.js +1 -0
- package/cli/bin.js +3 -0
- package/cli/child-agent-qgeqvs03.js +4 -0
- package/cli/connect-chn8pxyf.js +2 -0
- package/cli/container-j6zr9gww.js +4 -0
- package/cli/dev-gsaehf19.js +7 -0
- package/cli/health-nqzge5kh.js +2 -0
- package/cli/home-lock-5seng0k3.js +2 -0
- package/cli/host-7dfjhf0z.js +1507 -0
- package/cli/index-1wseh1tm.js +2 -0
- package/cli/index-axfe8zef.js +2 -0
- package/cli/index-s9pw90xe.js +2 -0
- package/cli/install-17r8t45e.js +2 -0
- package/cli/join-551zg7yr.js +31 -0
- package/cli/local-server-2smsafvg.js +2 -0
- package/cli/machine-zfjmpw7h.js +2 -0
- package/cli/main-0mxhd968.js +33 -0
- package/cli/main-53qmhxmd.js +303 -0
- package/cli/move-to-xrr2b135.js +2 -0
- package/cli/npm-package.json +1 -0
- package/cli/pair-phone-070c9ztt.js +5 -0
- package/cli/prompt-psc4drtd.js +2 -0
- package/cli/reached-vwzx2cdg.js +2 -0
- package/cli/sessions-bm4mk37y.js +3 -0
- package/cli/sf-cli-s42gkp0b.js +2 -0
- package/cli/sf-db-r8f1a20b.js +23 -0
- package/cli/sf-deploy-wqaa4fdm.js +21 -0
- package/cli/sf-pr-rg3q3tn6.js +13 -0
- package/cli/sf-test-pff158qc.js +10 -0
- package/cli/tart-isolation-wr3xwfmw.js +3 -0
- package/cli/tray-4rr0y1dv.png +0 -0
- package/cli/tray-mac-offline-89dva0gs.png +0 -0
- package/cli/tray-mac-paused-hq3a1cxv.png +0 -0
- package/cli/tray-mac-tvtavf0g.png +0 -0
- package/cli/tray-offline-xj6b5ta4.png +0 -0
- package/cli/tray-paused-6pzdv5ze.png +0 -0
- package/cli/vm-keeper-p0ggcw3z.js +3 -0
- package/package.json +50 -4
- package/plugins/sf-video-review/.claude-plugin/plugin.json +17 -0
- package/plugins/sf-video-review/.mcp.json +9 -0
- package/plugins/sf-video-review/dist/video-review.mjs +135 -0
- package/plugins/sf-video-review/skills/video-review/SKILL.md +65 -0
- package/plugins/sf-video-studio/.claude-plugin/plugin.json +17 -0
- package/plugins/sf-video-studio/.mcp.json +19 -0
- package/plugins/sf-video-studio/dist/demo-video.mjs +139 -0
- package/plugins/sf-video-studio/dist/narration-voice.mjs +134 -0
- package/plugins/sf-video-studio/dist/video-generation.mjs +131 -0
- package/plugins/sf-video-studio/fonts/DejaVuSansMono-Bold.ttf +0 -0
- package/plugins/sf-video-studio/fonts/DejaVuSansMono.ttf +0 -0
- package/plugins/sf-video-studio/fonts/LICENSE-DejaVu +187 -0
- package/plugins/sf-video-studio/hooks/hooks.json +17 -0
- package/plugins/sf-video-studio/hooks/no-robot-voice.sh +77 -0
- package/plugins/sf-video-studio/kokoro/package-lock.json +1137 -0
- package/plugins/sf-video-studio/kokoro/package.json +11 -0
- package/plugins/sf-video-studio/skills/demo-video/SKILL.md +101 -0
- package/plugins/sf-video-studio/skills/narration-voice/SKILL.md +49 -0
- package/plugins/sf-video-studio/skills/video-generation/SKILL.md +30 -0
- package/server/dist/account.js +3 -0
- package/server/dist/backup-process.js +2 -0
- package/server/dist/backup.js +3 -0
- package/server/dist/chunk-0tbq288f.js +3055 -0
- package/server/dist/chunk-18n7tr66.js +3 -0
- package/server/dist/chunk-1kgfrgmv.js +3 -0
- package/server/dist/chunk-1rnmxaav.js +209 -0
- package/server/dist/chunk-26zhqbyn.js +25 -0
- package/server/dist/chunk-34mn2zj2.js +2 -0
- package/server/dist/chunk-3psgsw9t.js +2 -0
- package/server/dist/chunk-8zbwppny.js +391 -0
- package/server/dist/chunk-9pn7q001.js +3 -0
- package/server/dist/chunk-9y7a9gkf.js +2 -0
- package/server/dist/chunk-bhm6jzch.js +8 -0
- package/server/dist/chunk-dbzjsqvb.js +17 -0
- package/server/dist/chunk-fxn504n0.js +2 -0
- package/server/dist/chunk-g6pwaap3.js +2 -0
- package/server/dist/chunk-gefgv8rg.js +7 -0
- package/server/dist/chunk-jg8b833v.js +2 -0
- package/server/dist/chunk-jy148bhn.js +3 -0
- package/server/dist/chunk-ky4nz39j.js +7 -0
- package/server/dist/chunk-mbd1y9qk.js +2 -0
- package/server/dist/chunk-neyhk32g.js +13 -0
- package/server/dist/chunk-nrz953bx.js +2 -0
- package/server/dist/chunk-padvv31s.js +2 -0
- package/server/dist/chunk-q1s2ez77.js +3 -0
- package/server/dist/chunk-q403h2bh.js +10 -0
- package/server/dist/chunk-t64r6enn.js +4 -0
- package/server/dist/chunk-vccappg7.js +59 -0
- package/server/dist/chunk-vj60fbhw.js +2 -0
- package/server/dist/chunk-xj26rwda.js +3 -0
- package/server/dist/chunk-xyw98jst.js +5 -0
- package/server/dist/main.js +43 -0
- package/server/dist/move.js +3 -0
- package/server/drizzle/pg/0000_baseline.sql +632 -0
- package/server/drizzle/pg/0001_transcripts_packed.sql +2 -0
- package/server/drizzle/pg/0002_vm_server_origin.sql +1 -0
- package/server/drizzle/pg/0003_reached_machines.sql +1 -0
- package/server/drizzle/pg/0004_link_records.sql +2 -0
- package/server/drizzle/pg/0005_task_columns.sql +7 -0
- package/server/drizzle/pg/0006_task_bundle.sql +3 -0
- package/server/drizzle/pg/0007_server_log.sql +9 -0
- package/server/drizzle/pg/0008_notification_pauses.sql +6 -0
- package/server/drizzle/pg/0009_vm_replaces.sql +1 -0
- package/server/drizzle/pg/0010_question_told_once.sql +10 -0
- package/server/drizzle/pg/0011_node_next_key.sql +3 -0
- package/server/drizzle/pg/0012_task_work.sql +8 -0
- package/server/drizzle/pg/0013_task_secret_grants.sql +9 -0
- package/server/drizzle/pg/0014_node_paused.sql +2 -0
- package/server/drizzle/pg/0015_ssh_machines.sql +19 -0
- package/server/drizzle/pg/0016_node_wake.sql +1 -0
- package/server/drizzle/pg/0017_node_uninstall_key.sql +1 -0
- package/server/drizzle/pg/0018_release_starts.sql +6 -0
- package/server/drizzle/pg/0019_session_memory.sql +7 -0
- package/server/drizzle/pg/meta/_journal.json +146 -0
- package/server/drizzle/sqlite/0000_pre_drizzle_schema.sql +351 -0
- package/server/drizzle/sqlite/0001_cluster.sql +36 -0
- package/server/drizzle/sqlite/0002_task_records.sql +22 -0
- package/server/drizzle/sqlite/0003_indexes.sql +12 -0
- package/server/drizzle/sqlite/0004_project_machines.sql +19 -0
- package/server/drizzle/sqlite/0005_session_events.sql +7 -0
- package/server/drizzle/sqlite/0006_task_platforms.sql +8 -0
- package/server/drizzle/sqlite/0007_session_event_tags.sql +7 -0
- package/server/drizzle/sqlite/0008_sprints.sql +7 -0
- package/server/drizzle/sqlite/0009_project_vms.sql +19 -0
- package/server/drizzle/sqlite/0010_server_repairs.sql +4 -0
- package/server/drizzle/sqlite/0011_drop_todos.sql +2 -0
- package/server/drizzle/sqlite/0012_hypervisors.sql +14 -0
- package/server/drizzle/sqlite/0013_manager_leads.sql +2 -0
- package/server/drizzle/sqlite/0014_session_text.sql +35 -0
- package/server/drizzle/sqlite/0015_vm_resize_machine_instructions_access.sql +22 -0
- package/server/drizzle/sqlite/0016_tunnel.sql +23 -0
- package/server/drizzle/sqlite/0017_session_secret_grants.sql +7 -0
- package/server/drizzle/sqlite/0018_https.sql +18 -0
- package/server/drizzle/sqlite/0019_secret_grant_runs.sql +1 -0
- package/server/drizzle/sqlite/0020_session_transcripts.sql +16 -0
- package/server/drizzle/sqlite/0021_claude_signed_out.sql +2 -0
- package/server/drizzle/sqlite/0022_machine_disabled.sql +1 -0
- package/server/drizzle/sqlite/0023_machine_access_granted_by.sql +1 -0
- package/server/drizzle/sqlite/0024_machine_vms.sql +27 -0
- package/server/drizzle/sqlite/0025_machine_tunnel_fallback.sql +1 -0
- package/server/drizzle/sqlite/0026_tunnel_peer_linked.sql +3 -0
- package/server/drizzle/sqlite/0027_tunnel_upgrade_grace.sql +2 -0
- package/server/drizzle/sqlite/0028_dialed_machines.sql +2 -0
- package/server/drizzle/sqlite/0029_node_link.sql +3 -0
- package/server/drizzle/sqlite/0030_sprint_calendar.sql +1 -0
- package/server/drizzle/sqlite/0031_transcripts_packed.sql +2 -0
- package/server/drizzle/sqlite/0032_vm_server_origin.sql +1 -0
- package/server/drizzle/sqlite/meta/_journal.json +237 -0
- package/server/src/account.ts +2 -0
- package/server/src/backup.ts +2 -0
- package/server/src/features/backups/backup-process.ts +2 -0
- package/server/src/main.ts +2 -0
- package/server/src/move.ts +2 -0
- package/ui/dist/_expo/static/css/global-d378e211074d97e633bc15418ccf57d4.css +2 -0
- package/ui/dist/_expo/static/css/xterm-8a7c4e0dca731c11dbe6bdff98fb667c.css +1 -0
- package/ui/dist/_expo/static/js/web/Network-f300a5960620f5029c91c06cae29dba5.js +3 -0
- package/ui/dist/_expo/static/js/web/[...rest]-9e454d985f211f5c983f42bec15b6ad9.js +1 -0
- package/ui/dist/_expo/static/js/web/[managerId]-2580b90e8d862ad66197eecb1dc04a12.js +1 -0
- package/ui/dist/_expo/static/js/web/[managerId]-39308153b42eed025c0abb9242ae6c71.js +1 -0
- package/ui/dist/_expo/static/js/web/[managerId]-8b7a94ec818e50a371b6b2750b73df6a.js +1 -0
- package/ui/dist/_expo/static/js/web/[managerId]-ac3a14c7607e4576d7e6c39c1014bcaf.js +1 -0
- package/ui/dist/_expo/static/js/web/[managerId]-e8549b2313a119437c373e30207518c0.js +1 -0
- package/ui/dist/_expo/static/js/web/[ref]-9b46f1ec4348f980e9838b68d47c34bf.js +2 -0
- package/ui/dist/_expo/static/js/web/[sessionId]-09e376674fb8b3edc4ae8aa9b3a189d7.js +1 -0
- package/ui/dist/_expo/static/js/web/[sessionId]-0e5fdba25c9f78220cea4cb66227743d.js +1 -0
- package/ui/dist/_expo/static/js/web/[sessionId]-104af3c3885009e6a8d204b6fd6e2c3a.js +1 -0
- package/ui/dist/_expo/static/js/web/[sessionId]-863a34ca3835b469134ddbc4ebc6fafc.js +1 -0
- package/ui/dist/_expo/static/js/web/[taskId]-1218e1dd3ecf175ffb7701fc886d62c9.js +1 -0
- package/ui/dist/_expo/static/js/web/[taskId]-31a48c7017dbd096f8ece9dc102a9762.js +1 -0
- package/ui/dist/_expo/static/js/web/[taskId]-a56cf85bcfd14f2d6b5d4180ea17e8d7.js +1 -0
- package/ui/dist/_expo/static/js/web/[taskId]-f2a157b3cb676b3c5d04c8eadfe90cdd.js +1 -0
- package/ui/dist/_expo/static/js/web/__common-1ad58e53e08528a67b99f53a1690b669.js +2078 -0
- package/ui/dist/_expo/static/js/web/__expo-metro-runtime-1f8f5d3ca6b7f58204d51e14506d73fb.js +5 -0
- package/ui/dist/_expo/static/js/web/_layout-057457e97e0af20433ed41b39cb5e809.js +1 -0
- package/ui/dist/_expo/static/js/web/_layout-2a7d73d5356823e1f7d2dab23e440d09.js +7 -0
- package/ui/dist/_expo/static/js/web/_layout-42e6a6b7855655d456015ce41aefdd39.js +1 -0
- package/ui/dist/_expo/static/js/web/_layout-a5e5a5b2fb3bfbfcc2914131976679e7.js +1 -0
- package/ui/dist/_expo/static/js/web/_layout-b2cbba92506f66815a5d744fd7cd5d8c.js +1 -0
- package/ui/dist/_expo/static/js/web/_layout-b4d13dc52bbcb65b18b4e52813d53883.js +198 -0
- package/ui/dist/_expo/static/js/web/_layout-fb0f75b354800de2e1582dc963f5c148.js +1 -0
- package/ui/dist/_expo/static/js/web/index-41299a961569cc8e5410ec53ba2b87c4.js +4 -0
- package/ui/dist/_expo/static/js/web/index-6c2bb0d3b6d00c5c007a663e9f4ce108.js +1 -0
- package/ui/dist/_expo/static/js/web/index-70484f7d2769d9ae01dac1fdb22aef1d.js +14 -0
- package/ui/dist/_expo/static/js/web/index-7d764cb7cefe0a217728c24d44990057.js +14 -0
- package/ui/dist/_expo/static/js/web/index-a5eb3d0c6aa4c483674beb5de428634c.js +12 -0
- package/ui/dist/_expo/static/js/web/index-b1c2543003cba86eeb3abfa4d21fd8da.js +14 -0
- package/ui/dist/_expo/static/js/web/index-d200aded5448966e5e05d9ccb77b56a4.js +5 -0
- package/ui/dist/_expo/static/js/web/index-ea43f51ceec4a981c942fc6dce9cedc4.js +2378 -0
- package/ui/dist/_expo/static/js/web/index-efa68d817a7febbf8c0163303bf4cd49.js +29 -0
- package/ui/dist/_expo/static/js/web/licenses-30f8c0555f7f4d434a68ee4706fa433d.js +1 -0
- package/ui/dist/_expo/static/js/web/pair-3f6f72208023894f43f4f07db5116cca.js +1 -0
- package/ui/dist/_expo/static/js/web/rich-markdown-editor-dea9c0f7c0306da4146e54ee44cce173.js +228 -0
- package/ui/dist/_expo/static/js/web/sign-in-67d2a0c00232e0e6f40efade1a83dc4b.js +4 -0
- package/ui/dist/_expo/static/js/web/terminal-view-32db8e6f8a21dd073f6a310862d36db8.js +90 -0
- package/ui/dist/apple-touch-icon.png +0 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/ui/dist/favicon.ico +0 -0
- package/ui/dist/favicon.svg +10 -0
- package/ui/dist/icon-192.png +0 -0
- package/ui/dist/icon-512.png +0 -0
- package/ui/dist/index.html +45 -0
- package/ui/dist/legal/privacy-policy.md +174 -0
- package/ui/dist/legal/terms-of-use.md +76 -0
- package/ui/dist/load-again.js +42 -0
- package/ui/dist/manifest.webmanifest +12 -0
- package/ui/dist/metadata.json +1 -0
- package/ui/dist/sounds/bell.wav +0 -0
- package/ui/dist/sounds/chime.wav +0 -0
- package/ui/dist/sounds/knock.wav +0 -0
- package/ui/dist/sounds/pop.wav +0 -0
- package/ui/dist/sw.js +121 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import{createRequire as ow}from"node:module";import{statSync as kf,createReadStream as Mw,promises as $w}from"node:fs";import{basename as Dw}from"node:path";import no,{PassThrough as xf}from"node:stream";import{types as Lf,deprecate as mc,promisify as Uw}from"node:util";import{Buffer as kr}from"node:buffer";import{types as Gf}from"node:util";import da from"node:http";import{isIP as Hw}from"node:net";import{format as Jw}from"node:url";import{deprecate as Kw}from"node:util";import Zw from"node:http";import Qw from"node:https";import di from"node:zlib";import zf,{PassThrough as jf,pipeline as fi}from"node:stream";import{Buffer as fa}from"node:buffer";import Vp from"node:process";import{createWriteStream as jD}from"fs";import*as Ll from"fs/promises";import{writeFile as WD}from"fs/promises";import{Readable as JD}from"node:stream";import{finished as KD}from"node:stream/promises";import*as QS from"path";import{readFile as zV}from"node:fs/promises";import{resolve as jV}from"node:path";import{existsSync as WV,readFileSync as JV}from"node:fs";import{mkdir as KV}from"node:fs/promises";import{delimiter as ug,dirname as XV,extname as YV,join as ZV,resolve as QV}from"node:path";var si=ow(import.meta.url),{create:iw,defineProperty:lu,getOwnPropertyDescriptor:sw,getOwnPropertyNames:cu,getPrototypeOf:aw}=Object,lw=Object.prototype.hasOwnProperty,Te=((e)=>typeof si<"u"?si:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof si<"u"?si:t)[r]}):e)(function(e){if(typeof si<"u")return si.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Wt=(e,t,r)=>function n(){if(r)throw r[0];try{return e&&(t=(0,e[cu(e)[0]])(e=0)),t}catch(o){throw r=[o],o}},ye=(e,t)=>function r(){try{return t||(0,e[cu(e)[0]])((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Ms=(e,t)=>{for(var r in t)lu(e,r,{get:t[r],enumerable:!0})},cw=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let o of cu(t))if(!lw.call(e,o)&&o!==r)lu(e,o,{get:()=>t[o],enumerable:!(n=sw(t,o))||n.enumerable})}return e},wr=(e,t,r)=>(r=e!=null?iw(aw(e)):{},cw(t||!e||!e.__esModule?lu(r,"default",{value:e,enumerable:!0}):r,e)),uw=ye({"../node_modules/.bun/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(e,t){function r(n,o){if(typeof o==="boolean")o={forever:o};if(this._originalTimeouts=JSON.parse(JSON.stringify(n)),this._timeouts=n,this._options=o||{},this._maxRetryTime=o&&o.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(n){if(this._timeout)clearTimeout(this._timeout);if(!n)return!1;var o=new Date().getTime();if(n&&o-this._operationStart>=this._maxRetryTime)return this._errors.push(n),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(n);var i=this._timeouts.shift();if(i===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),i=this._cachedTimeouts.slice(-1);else return!1;var s=this;if(this._timer=setTimeout(function(){if(s._attempts++,s._operationTimeoutCb){if(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref)s._timeout.unref()}s._fn(s._attempts)},i),this._options.unref)this._timer.unref();return!0},r.prototype.attempt=function(n,o){if(this._fn=n,o){if(o.timeout)this._operationTimeout=o.timeout;if(o.cb)this._operationTimeoutCb=o.cb}var i=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){i._operationTimeoutCb()},i._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(n){console.log("Using RetryOperation.try() is deprecated"),this.attempt(n)},r.prototype.start=function(n){console.log("Using RetryOperation.start() is deprecated"),this.attempt(n)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;var n={},o=null,i=0;for(var s=0;s<this._errors.length;s++){var l=this._errors[s],a=l.message,c=(n[a]||0)+1;if(n[a]=c,c>=i)o=l,i=c}return o}}}),dw=ye({"../node_modules/.bun/retry@0.13.1/node_modules/retry/lib/retry.js"(e){var t=uw();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}}}}),fw=ye({"../node_modules/.bun/retry@0.13.1/node_modules/retry/index.js"(e,t){t.exports=dw()}}),pw=ye({"../node_modules/.bun/p-retry@4.6.2/node_modules/p-retry/index.js"(e,t){var r=fw(),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}}),mg=ye({"../node_modules/.bun/extend@3.0.2/node_modules/extend/index.js"(e,t){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,{defineProperty:o,getOwnPropertyDescriptor:i}=Object,s=function u(f){if(typeof Array.isArray==="function")return Array.isArray(f);return n.call(f)==="[object Array]"},l=function u(f){if(!f||n.call(f)!=="[object Object]")return!1;var h=r.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&r.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!g)return!1;var p;for(p in f);return typeof p>"u"||r.call(f,p)},a=function u(f,h){if(o&&h.name==="__proto__")o(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0});else f[h.name]=h.newValue},c=function u(f,h){if(h==="__proto__"){if(!r.call(f,h))return;else if(i)return i(f,h).value}return f[h]};t.exports=function u(){var f,h,g,p,_,y,S=arguments[0],E=1,b=arguments.length,R=!1;if(typeof S==="boolean")R=S,S=arguments[1]||{},E=2;if(S==null||typeof S!=="object"&&typeof S!=="function")S={};for(;E<b;++E)if(f=arguments[E],f!=null){for(h in f)if(g=c(S,h),p=c(f,h),S!==p){if(R&&p&&(l(p)||(_=s(p)))){if(_)_=!1,y=g&&s(g)?g:[];else y=g&&l(g)?g:{};a(S,{name:h,newValue:u(R,y,p)})}else if(typeof p<"u")a(S,{name:h,newValue:p})}}return S}}}),hw=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/package.json"(e,t){t.exports={name:"gaxios",version:"7.3.1",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"core/packages/gaxios",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.0",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"21.0.3","stream-browserify":"^3.0.0",tmp:"0.2.7","ts-loader":"^9.5.2",typescript:"5.8.3","undici-types":"^7.24.1",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/gaxios"}}}),mw=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/util.cjs"(e,t){var r=hw();t.exports={pkg:r}}}),gg=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/common.js"(e){var t=e&&e.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosError=e.GAXIOS_ERROR_SYMBOL=void 0,e.defaultErrorRedactor=l;var r=t(mg()),n=t(mw()),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}}}),gw=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/retry.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRetryConfig=t;async function t(i){let s=n(i);if(!i||!i.config||!s&&!i.config.retry)return{shouldRetry:!1};s=s||{},s.currentRetryAttempt=s.currentRetryAttempt||0,s.retry=s.retry===void 0||s.retry===null?3:s.retry,s.httpMethodsToRetry=s.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],s.noResponseRetries=s.noResponseRetries===void 0||s.noResponseRetries===null?2:s.noResponseRetries,s.retryDelayMultiplier=s.retryDelayMultiplier?s.retryDelayMultiplier:2,s.timeOfFirstRequest=s.timeOfFirstRequest?s.timeOfFirstRequest:Date.now(),s.totalTimeout=s.totalTimeout?s.totalTimeout:Number.MAX_SAFE_INTEGER,s.maxRetryDelay=s.maxRetryDelay?s.maxRetryDelay:Number.MAX_SAFE_INTEGER;let l=[[100,199],[408,408],[429,429],[500,599]];if(s.statusCodesToRetry=s.statusCodesToRetry||l,i.config.retryConfig=s,!await(s.shouldRetry||r)(i))return{shouldRetry:!1,config:i.config};let c=o(s);i.config.retryConfig.currentRetryAttempt+=1;let u=s.retryBackoff?s.retryBackoff(i,c):new Promise((f)=>{setTimeout(f,c)});if(s.onRetryAttempt)await s.onRetryAttempt(i);return await u,{shouldRetry:!0,config:i.config}}function r(i){let s=n(i);if(i.config.signal?.aborted&&i.code!=="TimeoutError"||i.code==="AbortError")return!1;if(!s||s.retry===0)return!1;if(!i.response&&(s.currentRetryAttempt||0)>=s.noResponseRetries)return!1;if(!s.httpMethodsToRetry||!s.httpMethodsToRetry.includes(i.config.method?.toUpperCase()||"GET"))return!1;if(i.response&&i.response.status){let l=!1;for(let[a,c]of s.statusCodesToRetry){let u=i.response.status;if(u>=a&&u<=c){l=!0;break}}if(!l)return!1}if(s.currentRetryAttempt=s.currentRetryAttempt||0,s.currentRetryAttempt>=s.retry)return!1;return!0}function n(i){if(i&&i.config&&i.config.retryConfig)return i.config.retryConfig;return}function o(i){let l=(i.currentRetryAttempt?0:i.retryDelay??100)+(Math.pow(i.retryDelayMultiplier,i.currentRetryAttempt)-1)/2*1000,a=i.totalTimeout-(Date.now()-i.timeOfFirstRequest);return Math.min(l,a,i.maxRetryDelay)}}}),vg=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/interceptor.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosInterceptorManager=void 0;var t=class extends Set{};e.GaxiosInterceptorManager=t}}),vw=ye({"../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js"(e,t){var r=1000,n=r*60,o=n*60,i=o*24,s=i*7,l=i*365.25;t.exports=function(h,g){g=g||{};var p=typeof h;if(p==="string"&&h.length>0)return a(h);else if(p==="number"&&isFinite(h))return g.long?u(h):c(h);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function a(h){if(h=String(h),h.length>100)return;var g=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(!g)return;var p=parseFloat(g[1]),_=(g[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return p*l;case"weeks":case"week":case"w":return p*s;case"days":case"day":case"d":return p*i;case"hours":case"hour":case"hrs":case"hr":case"h":return p*o;case"minutes":case"minute":case"mins":case"min":case"m":return p*n;case"seconds":case"second":case"secs":case"sec":case"s":return p*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}function c(h){var g=Math.abs(h);if(g>=i)return Math.round(h/i)+"d";if(g>=o)return Math.round(h/o)+"h";if(g>=n)return Math.round(h/n)+"m";if(g>=r)return Math.round(h/r)+"s";return h+"ms"}function u(h){var g=Math.abs(h);if(g>=i)return f(h,g,i,"day");if(g>=o)return f(h,g,o,"hour");if(g>=n)return f(h,g,n,"minute");if(g>=r)return f(h,g,r,"second");return h+" ms"}function f(h,g,p,_){var y=g>=p*1.5;return Math.round(h/p)+" "+_+(y?"s":"")}}}),_g=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/common.js"(e,t){function r(n){i.debug=i,i.default=i,i.coerce=f,i.disable=c,i.enable=l,i.enabled=u,i.humanize=vw(),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,T=Number(new Date),w=T-(p||T);if(R.diff=w,R.prev=p,R.curr=T,p=T,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}}),_w=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/browser.js"(e,t){e.formatArgs=n,e.save=o,e.load=i,e.useColors=r,e.storage=s(),e.destroy=(()=>{let a=!1;return()=>{if(!a)a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let a;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(a=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(a[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let c="color: "+this.color;a.splice(1,0,c,"color: inherit");let u=0,f=0;a[0].replace(/%[a-zA-Z%]/g,(h)=>{if(h==="%%")return;if(u++,h==="%c")f=u}),a.splice(f,0,c)}e.log=console.debug||console.log||(()=>{});function o(a){try{if(a)e.storage.setItem("debug",a);else e.storage.removeItem("debug")}catch(c){}}function i(){let a;try{a=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(c){}if(!a&&typeof process<"u"&&"env"in process)a=process.env.DEBUG;return a}function s(){try{return localStorage}catch(a){}}t.exports=_g()(e);var{formatters:l}=t.exports;l.j=function(a){try{return JSON.stringify(a)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}}),yw=ye({"../node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js"(e,t){t.exports=(r,n=process.argv)=>{let o=r.startsWith("-")?"":r.length===1?"-":"--",i=n.indexOf(o+r),s=n.indexOf("--");return i!==-1&&(s===-1||i<s)}}}),Sw=ye({"../node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js"(e,t){var r=Te("os"),n=Te("tty"),o=yw(),{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)))}}}),Ew=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/node.js"(e,t){var r=Te("tty"),n=Te("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=Sw();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=_g()(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)}}}),yg=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/index.js"(e,t){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)t.exports=_w();else t.exports=Ew()}}),bw=ye({"../node_modules/.bun/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(e){var t=e&&e.__createBinding||(Object.create?function(c,u,f,h){if(h===void 0)h=f;var g=Object.getOwnPropertyDescriptor(u,f);if(!g||("get"in g?!u.__esModule:g.writable||g.configurable))g={enumerable:!0,get:function(){return u[f]}};Object.defineProperty(c,h,g)}:function(c,u,f,h){if(h===void 0)h=f;c[h]=u[f]}),r=e&&e.__setModuleDefault||(Object.create?function(c,u){Object.defineProperty(c,"default",{enumerable:!0,value:u})}:function(c,u){c.default=u}),n=e&&e.__importStar||function(c){if(c&&c.__esModule)return c;var u={};if(c!=null){for(var f in c)if(f!=="default"&&Object.prototype.hasOwnProperty.call(c,f))t(u,c,f)}return r(u,c),u};Object.defineProperty(e,"__esModule",{value:!0}),e.req=e.json=e.toBuffer=void 0;var o=n(Te("http")),i=n(Te("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}}),Tw=ye({"../node_modules/.bun/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(u,f,h,g){if(g===void 0)g=h;var p=Object.getOwnPropertyDescriptor(f,h);if(!p||("get"in p?!f.__esModule:p.writable||p.configurable))p={enumerable:!0,get:function(){return f[h]}};Object.defineProperty(u,g,p)}:function(u,f,h,g){if(g===void 0)g=h;u[g]=f[h]}),r=e&&e.__setModuleDefault||(Object.create?function(u,f){Object.defineProperty(u,"default",{enumerable:!0,value:f})}:function(u,f){u.default=f}),n=e&&e.__importStar||function(u){if(u&&u.__esModule)return u;var f={};if(u!=null){for(var h in u)if(h!=="default"&&Object.prototype.hasOwnProperty.call(u,h))t(f,u,h)}return r(f,u),f},o=e&&e.__exportStar||function(u,f){for(var h in u)if(h!=="default"&&!Object.prototype.hasOwnProperty.call(f,h))t(f,u,h)};Object.defineProperty(e,"__esModule",{value:!0}),e.Agent=void 0;var i=n(Te("net")),s=n(Te("http")),l=Te("https");o(bw(),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}}),ww=ye({"../node_modules/.bun/https-proxy-agent@7.0.6+759ce506b1ed1a42/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(e){var t=e&&e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0}),e.parseProxyResponse=void 0;var r=t(yg()),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(" "),T=+R[1],w=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:T,statusText:w,headers:C},buffered:y})}i.on("error",g),i.on("end",h),u()})}e.parseProxyResponse=o}}),Cw=ye({"../node_modules/.bun/https-proxy-agent@7.0.6+759ce506b1ed1a42/node_modules/https-proxy-agent/dist/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(S,E,b,R){if(R===void 0)R=b;var T=Object.getOwnPropertyDescriptor(E,b);if(!T||("get"in T?!E.__esModule:T.writable||T.configurable))T={enumerable:!0,get:function(){return E[b]}};Object.defineProperty(S,R,T)}: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(Te("net")),s=n(Te("tls")),l=o(Te("assert")),a=o(yg()),c=Tw(),u=Te("url"),f=ww(),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 T=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},w=i.isIPv6(E.host)?`[${E.host}]`:E.host,C=`CONNECT ${w}:${E.port} HTTP/1.1\r
|
|
11
|
+
`;if(b.username||b.password){let F=`${decodeURIComponent(b.username)}:${decodeURIComponent(b.password)}`;T["Proxy-Authorization"]=`Basic ${Buffer.from(F).toString("base64")}`}if(T.Host=`${w}:${E.port}`,!T["Proxy-Connection"])T["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let F of Object.keys(T))C+=`${F}: ${T[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 Rw(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 Sg,Aw=Wt({"../node_modules/.bun/data-uri-to-buffer@4.0.1/node_modules/data-uri-to-buffer/dist/index.js"(){Sg=Rw}}),Iw=ye({"../node_modules/.bun/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(e,t){(function(r,n){typeof e==="object"&&typeof t<"u"?n(e):typeof define==="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.WebStreamsPolyfill={}))})(e,function(r){function n(){return}function o(v){return typeof v==="object"&&v!==null||typeof v==="function"}let i=n;function s(v,I){try{Object.defineProperty(v,"name",{value:I,configurable:!0})}catch(M){}}let l=Promise,a=Promise.prototype.then,c=Promise.reject.bind(l);function u(v){return new l(v)}function f(v){return u((I)=>I(v))}function h(v){return c(v)}function g(v,I,M){return a.call(v,I,M)}function p(v,I,M){g(g(v,I,M),void 0,i)}function _(v,I){p(v,I)}function y(v,I){p(v,void 0,I)}function S(v,I,M){return g(v,I,M)}function E(v){g(v,void 0,i)}let b=(v)=>{if(typeof queueMicrotask==="function")b=queueMicrotask;else{let I=f(void 0);b=(M)=>g(I,M)}return b(v)};function R(v,I,M){if(typeof v!=="function")throw TypeError("Argument is not a function");return Function.prototype.apply.call(v,I,M)}function T(v,I,M){try{return f(R(v,I,M))}catch(V){return h(V)}}let w=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===w-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===w)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")se(v);else if(I._state==="closed")me(v);else ve(v,I._storedError)}function B(v,I){let M=v._ownerReadableStream;return Gr(M,I)}function Q(v){let I=v._ownerReadableStream;if(I._state==="readable")j(v,TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));else ne(v,TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));I._readableStreamController[F](),I._reader=void 0,v._ownerReadableStream=void 0}function pe(v){return TypeError("Cannot "+v+" a stream using a released reader")}function se(v){v._closedPromise=u((I,M)=>{v._closedPromise_resolve=I,v._closedPromise_reject=M})}function ve(v,I){se(v),j(v,I)}function me(v){se(v),he(v)}function j(v,I){if(v._closedPromise_reject===void 0)return;E(v._closedPromise),v._closedPromise_reject(I),v._closedPromise_resolve=void 0,v._closedPromise_reject=void 0}function ne(v,I){ve(v,I)}function he(v){if(v._closedPromise_resolve===void 0)return;v._closedPromise_resolve(void 0),v._closedPromise_resolve=void 0,v._closedPromise_reject=void 0}let L=Number.isFinite||function(v){return typeof v==="number"&&isFinite(v)},K=Math.trunc||function(v){return v<0?Math.ceil(v):Math.floor(v)};function W(v){return typeof v==="object"||typeof v==="function"}function be(v,I){if(v!==void 0&&!W(v))throw TypeError(`${I} is not an object.`)}function Ce(v,I){if(typeof v!=="function")throw TypeError(`${I} is not a function.`)}function 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 je(v,I,M){if(v===void 0)throw TypeError(`Parameter ${I} is required in '${M}'.`)}function U(v,I,M){if(v===void 0)throw TypeError(`${I} is required in '${M}'.`)}function O(v){return Number(v)}function q(v){return v===0?0:v}function H(v){return q(K(v))}function J(v,I){let V=Number.MAX_SAFE_INTEGER,re=Number(v);if(re=q(re),!L(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(!L(re)||re===0)return 0;return re}function Y(v,I){if(!Zn(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 x(v){let I=v._reader;if(I===void 0)return!1;if(!ce(I))return!1;return!0}class z{constructor(v){if(je(v,1,"ReadableStreamDefaultReader"),Y(v,"First parameter"),Qn(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(!Kt(this))return h(Dt("next"));return this._asyncIteratorImpl.next()},return(v){if(!Kt(this))return h(Dt("return"));return this._asyncIteratorImpl.return(v)}};Object.setPrototypeOf(St,He);function Jt(v,I){let M=ee(v),V=new Je(M,I),re=Object.create(St);return re._asyncIteratorImpl=V,re}function Kt(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 Dt(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 nr(v,I,M,V,re){new Uint8Array(v).set(new Uint8Array(M,V,re),I)}let qt=(v)=>{if(typeof v.transfer==="function")qt=(I)=>I.transfer();else if(typeof structuredClone==="function")qt=(I)=>structuredClone(I,{transfer:[I]});else qt=(I)=>I;return qt(v)},Mt=(v)=>{if(typeof v.detached==="boolean")Mt=(I)=>I.detached;else Mt=(I)=>I.byteLength===0;return Mt(v)};function or(v,I,M){if(v.slice)return v.slice(I,M);let V=M-I,re=new ArrayBuffer(V);return nr(re,0,v,I,V),re}function ir(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 Cr(v){let I={[Symbol.iterator]:()=>v.iterator},M=async function*(){return yield*I}(),V=M.next;return{iterator:M,nextMethod:V,done:!1}}let yr=(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 Sr(v,I="sync",M){if(M===void 0)if(I==="async"){if(M=ir(v,yr),M===void 0){let le=ir(v,Symbol.iterator),_e=Sr(v,"sync",le);return Cr(_e)}}else M=ir(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 xt(v){let I=R(v.nextMethod,v.iterator,[]);if(!o(I))throw TypeError("The iterator.next() method must return an object");return I}function po(v){return Boolean(v.done)}function Vo(v){return v.value}function xn(v){if(typeof v!=="number")return!1;if(It(v))return!1;if(v<0)return!1;return!0}function Ln(v){let I=or(v.buffer,v.byteOffset,v.byteOffset+v.byteLength);return new Uint8Array(I)}function dn(v){let I=v._queue.shift();if(v._queueTotalSize-=I.size,v._queueTotalSize<0)v._queueTotalSize=0;return I.value}function fn(v,I,M){if(!xn(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 ho(v){return v._queue.peek().value}function dr(v){v._queue=new C,v._queueTotalSize=0}function Un(v){return v===DataView}function mo(v){return Un(v.constructor)}function zo(v){if(Un(v))return 1;return v.BYTES_PER_ELEMENT}class fr{constructor(){throw TypeError("Illegal constructor")}get view(){if(!pn(this))throw Xn("view");return this._view}respond(v){if(!pn(this))throw Xn("respond");if(je(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");vn(this._associatedReadableByteStreamController,v)}respondWithNewView(v){if(!pn(this))throw Xn("respondWithNewView");if(je(v,1,"respondWithNewView"),!ArrayBuffer.isView(v))throw TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw TypeError("This BYOB request has been invalidated");if(Mt(v.buffer))throw TypeError("The given view's buffer has been detached and so cannot be used as a response");_n(this._associatedReadableByteStreamController,v)}}if(Object.defineProperties(fr.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),s(fr.prototype.respond,"respond"),s(fr.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(fr.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Gt{constructor(){throw TypeError("Illegal constructor")}get byobRequest(){if(!Er(this))throw Ur("byobRequest");return Jn(this)}get desiredSize(){if(!Er(this))throw Ur("desiredSize");return Kn(this)}close(){if(!Er(this))throw Ur("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`);Xr(this)}enqueue(v){if(!Er(this))throw Ur("enqueue");if(je(v,1,"enqueue"),!ArrayBuffer.isView(v))throw TypeError("chunk must be an array buffer view");if(v.byteLength===0)throw TypeError("chunk must have non-zero byteLength");if(v.buffer.byteLength===0)throw TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw TypeError("stream is closed or draining");let I=this._controlledReadableByteStream._state;if(I!=="readable")throw TypeError(`The stream (in ${I} state) is not in the readable state and cannot be enqueued to`);gn(this,v)}error(v=void 0){if(!Er(this))throw Ur("error");Xt(this,v)}[D](v){Fn(this),dr(this);let I=this._cancelAlgorithm(v);return mn(this),I}[N](v){let I=this._controlledReadableByteStream;if(this._queueTotalSize>0){go(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),br(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(Gt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),s(Gt.prototype.close,"close"),s(Gt.prototype.enqueue,"enqueue"),s(Gt.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Gt.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Er(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledReadableByteStream"))return!1;return v instanceof Gt}function pn(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_associatedReadableByteStreamController"))return!1;return v instanceof fr}function br(v){if(!Jo(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,br(v);return null},(V)=>(Xt(v,V),null))}function Fn(v){xr(v),v._pendingPullIntos=new C}function hn(v,I){let M=!1;if(v._state==="closed")M=!0;let V=Gn(I);if(I.readerType==="default")te(v,V,M);else Yn(v,V,M)}function Gn(v){let{bytesFilled:I,elementSize:M}=v;return new v.viewConstructor(v.buffer,v.byteOffset,I/M)}function Kr(v,I,M,V){v._queue.push({buffer:I,byteOffset:M,byteLength:V}),v._queueTotalSize+=V}function Bn(v,I,M,V){let re;try{re=or(I,M,M+V)}catch(le){throw Xt(v,le),le}Kr(v,re,0,V)}function Hn(v,I){if(I.bytesFilled>0)Bn(v,I.buffer,I.byteOffset,I.bytesFilled);Ht(v)}function Vn(v,I){let M=Math.min(v._queueTotalSize,I.byteLength-I.bytesFilled),V=I.bytesFilled+M,re=M,le=!1,_e=V%I.elementSize,Me=V-_e;if(Me>=I.minimumFill)re=Me-I.bytesFilled,le=!0;let Le=v._queue;while(re>0){let Ke=Le.peek(),Ze=Math.min(re,Ke.byteLength),lt=I.byteOffset+I.bytesFilled;if(nr(I.buffer,lt,Ke.buffer,Ke.byteOffset,Ze),Ke.byteLength===Ze)Le.shift();else Ke.byteOffset+=Ze,Ke.byteLength-=Ze;v._queueTotalSize-=Ze,zn(v,Ze,I),re-=Ze}return le}function zn(v,I,M){M.bytesFilled+=I}function jn(v){if(v._queueTotalSize===0&&v._closeRequested)mn(v),ns(v._controlledReadableByteStream);else br(v)}function xr(v){if(v._byobRequest===null)return;v._byobRequest._associatedReadableByteStreamController=void 0,v._byobRequest._view=null,v._byobRequest=null}function Lr(v){while(v._pendingPullIntos.length>0){if(v._queueTotalSize===0)return;let I=v._pendingPullIntos.peek();if(Vn(v,I))Ht(v),hn(v._controlledReadableByteStream,I)}}function jo(v){let I=v._controlledReadableByteStream._reader;while(I._readRequests.length>0){if(v._queueTotalSize===0)return;let M=I._readRequests.shift();go(v,M)}}function Wo(v,I,M,V){let re=v._controlledReadableByteStream,le=I.constructor,_e=zo(le),{byteOffset:Me,byteLength:Le}=I,Ke=M*_e,Ze;try{Ze=qt(I.buffer)}catch(wt){V._errorSteps(wt);return}let lt={buffer:Ze,bufferByteLength:Ze.byteLength,byteOffset:Me,byteLength:Le,bytesFilled:0,minimumFill:Ke,elementSize:_e,viewConstructor:le,readerType:"byob"};if(v._pendingPullIntos.length>0){v._pendingPullIntos.push(lt),Sn(re,V);return}if(re._state==="closed"){let wt=new le(lt.buffer,lt.byteOffset,0);V._closeSteps(wt);return}if(v._queueTotalSize>0){if(Vn(v,lt)){let wt=Gn(lt);jn(v),V._chunkSteps(wt);return}if(v._closeRequested){let wt=TypeError("Insufficient bytes to fill elements in the given buffer");Xt(v,wt),V._errorSteps(wt);return}}v._pendingPullIntos.push(lt),Sn(re,V),br(v)}function sr(v,I){if(I.readerType==="none")Ht(v);let M=v._controlledReadableByteStream;if(_o(M))while(En(M)>0){let V=Ht(v);hn(M,V)}}function ar(v,I,M){if(zn(v,I,M),M.readerType==="none"){Hn(v,M),Lr(v);return}if(M.bytesFilled<M.minimumFill)return;Ht(v);let V=M.bytesFilled%M.elementSize;if(V>0){let re=M.byteOffset+M.bytesFilled;Bn(v,M.buffer,re-V,V)}M.bytesFilled-=V,hn(v._controlledReadableByteStream,M),Lr(v)}function Wn(v,I){let M=v._pendingPullIntos.peek();if(xr(v),v._controlledReadableByteStream._state==="closed")sr(v,M);else ar(v,I,M);br(v)}function Ht(v){return v._pendingPullIntos.shift()}function Jo(v){let I=v._controlledReadableByteStream;if(I._state!=="readable")return!1;if(v._closeRequested)return!1;if(!v._started)return!1;if(x(I)&&oe(I)>0)return!0;if(_o(I)&&En(I)>0)return!0;if(Kn(v)>0)return!0;return!1}function mn(v){v._pullAlgorithm=void 0,v._cancelAlgorithm=void 0}function Xr(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 Xt(v,V),V}}mn(v),ns(I)}function gn(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=qt(V);if(v._pendingPullIntos.length>0){let Me=v._pendingPullIntos.peek();if(Mt(Me.buffer))throw TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");if(xr(v),Me.buffer=qt(Me.buffer),Me.readerType==="none")Hn(v,Me)}if(x(M))if(jo(v),oe(M)===0)Kr(v,_e,re,le);else{if(v._pendingPullIntos.length>0)Ht(v);let Me=new Uint8Array(_e,re,le);te(M,Me,!1)}else if(_o(M))Kr(v,_e,re,le),Lr(v);else Kr(v,_e,re,le);br(v)}function Xt(v,I){let M=v._controlledReadableByteStream;if(M._state!=="readable")return;Fn(v),dr(v),mn(v),uf(M,I)}function go(v,I){let M=v._queue.shift();v._queueTotalSize-=M.byteLength,jn(v);let V=new Uint8Array(M.buffer,M.byteOffset,M.byteLength);I._chunkSteps(V)}function Jn(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(fr.prototype);Ko(V,v,M),v._byobRequest=V}return v._byobRequest}function Kn(v){let I=v._controlledReadableByteStream._state;if(I==="errored")return null;if(I==="closed")return 0;return v._strategyHWM-v._queueTotalSize}function vn(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=qt(M.buffer),Wn(v,I)}function _n(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=qt(I.buffer),Wn(v,re)}function yn(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,dr(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 Me=M();p(f(Me),()=>(I._started=!0,br(I),null),(Le)=>(Xt(I,Le),null))}function vo(v,I,M){let V=Object.create(Gt.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=(Le)=>I.cancel(Le);else _e=()=>f(void 0);let Me=I.autoAllocateChunkSize;if(Me===0)throw TypeError("autoAllocateChunkSize must be greater than 0");yn(v,V,re,le,_e,M,Me)}function Ko(v,I,M){v._associatedReadableByteStreamController=I,v._view=M}function Xn(v){return TypeError(`ReadableStreamBYOBRequest.prototype.${v} can only be used on a ReadableStreamBYOBRequest`)}function Ur(v){return TypeError(`ReadableByteStreamController.prototype.${v} can only be used on a ReadableByteStreamController`)}function Yr(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.mode;return{mode:M===void 0?void 0:er(M,`${I} has member 'mode' that`)}}function er(v,I){if(v=`${v}`,v!=="byob")throw TypeError(`${I} '${v}' is not a valid enumeration value for ReadableStreamReaderMode`);return v}function Xo(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 Zr(v){return new Pt(v)}function Sn(v,I){v._reader._readIntoRequests.push(I)}function Yn(v,I,M){let re=v._reader._readIntoRequests.shift();if(M)re._closeSteps(I);else re._chunkSteps(I)}function En(v){return v._reader._readIntoRequests.length}function _o(v){let I=v._reader;if(I===void 0)return!1;if(!Et(I))return!1;return!0}class Pt{constructor(v){if(je(v,1,"ReadableStreamBYOBReader"),Y(v,"First parameter"),Qn(v))throw TypeError("This stream has already been locked for exclusive reading by another reader");if(!Er(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(yo("closed"));return this._closedPromise}cancel(v=void 0){if(!Et(this))return h(yo("cancel"));if(this._ownerReadableStream===void 0)return h(pe("cancel"));return B(this,v)}read(v,I={}){if(!Et(this))return h(yo("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=Xo(I,"options")}catch(Le){return h(Le)}let V=M.min;if(V===0)return h(TypeError("options.min must be greater than 0"));if(!mo(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((Le,Ke)=>{re=Le,le=Ke});return Qr(this,v,V,{_chunkSteps:(Le)=>re({value:Le,done:!1}),_closeSteps:(Le)=>re({value:Le,done:!0}),_errorSteps:(Le)=>le(Le)}),_e}releaseLock(){if(!Et(this))throw yo("releaseLock");if(this._ownerReadableStream===void 0)return;Vt(this)}}if(Object.defineProperties(Pt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(Pt.prototype.cancel,"cancel"),s(Pt.prototype.read,"read"),s(Pt.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Pt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Et(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_readIntoRequests"))return!1;return v instanceof Pt}function Qr(v,I,M,V){let re=v._ownerReadableStream;if(re._disturbed=!0,re._state==="errored")V._errorSteps(re._storedError);else Wo(re._readableStreamController,I,M,V)}function Vt(v){Q(v);let I=TypeError("Reader was released");js(v,I)}function js(v,I){let M=v._readIntoRequests;v._readIntoRequests=new C,M.forEach((V)=>{V._errorSteps(I)})}function yo(v){return TypeError(`ReadableStreamBYOBReader.prototype.${v} can only be used on a ReadableStreamBYOBReader`)}function Zi(v,I){let{highWaterMark:M}=v;if(M===void 0)return I;if(It(M)||M<0)throw RangeError("Invalid highWaterMark");return M}function Ws(v){let{size:I}=v;if(!I)return()=>1;return I}function Js(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:Hb(V,`${I} has member 'size' that`)}}function Hb(v,I){return Ce(v,I),(M)=>O(v(M))}function Vb(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:zb(M,v,`${I} has member 'abort' that`),close:V===void 0?void 0:jb(V,v,`${I} has member 'close' that`),start:re===void 0?void 0:Wb(re,v,`${I} has member 'start' that`),write:_e===void 0?void 0:Jb(_e,v,`${I} has member 'write' that`),type:le}}function zb(v,I,M){return Ce(v,M),(V)=>T(v,I,[V])}function jb(v,I,M){return Ce(v,M),()=>T(v,I,[])}function Wb(v,I,M){return Ce(v,M),(V)=>R(v,I,[V])}function Jb(v,I,M){return Ce(v,M),(V,re)=>T(v,I,[V,re])}function Bd(v,I){if(!Yo(v))throw TypeError(`${I} is not a WritableStream.`)}function Kb(v){if(typeof v!=="object"||v===null)return!1;try{return typeof v.aborted==="boolean"}catch(I){return!1}}let Xb=typeof AbortController==="function";function Yb(){if(Xb)return new AbortController;return}class bn{constructor(v={},I={}){if(v===void 0)v=null;else Ie(v,"First parameter");let M=Js(I,"Second parameter"),V=Vb(v,"First parameter");if(Vd(this),V.type!==void 0)throw RangeError("Invalid type is specified");let le=Ws(M),_e=Zi(M,1);dT(this,V,_e,le)}get locked(){if(!Yo(this))throw Qs("locked");return Zo(this)}abort(v=void 0){if(!Yo(this))return h(Qs("abort"));if(Zo(this))return h(TypeError("Cannot abort a stream that already has a writer"));return Ks(this,v)}close(){if(!Yo(this))return h(Qs("close"));if(Zo(this))return h(TypeError("Cannot close a stream that already has a writer"));if(en(this))return h(TypeError("Cannot close an already-closing stream"));return zd(this)}getWriter(){if(!Yo(this))throw Qs("getWriter");return Hd(this)}}if(Object.defineProperties(bn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),s(bn.prototype.abort,"abort"),s(bn.prototype.close,"close"),s(bn.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(bn.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function Hd(v){return new tn(v)}function Zb(v,I,M,V,re=1,le=()=>1){let _e=Object.create(bn.prototype);Vd(_e);let Me=Object.create(Eo.prototype);return Yd(_e,Me,v,I,M,V,re,le),_e}function Vd(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 Yo(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_writableStreamController"))return!1;return v instanceof bn}function Zo(v){if(v._writer===void 0)return!1;return!0}function Ks(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,Me)=>{v._pendingAbortRequest={_promise:void 0,_resolve:_e,_reject:Me,_reason:I,_wasAlreadyErroring:re}});if(v._pendingAbortRequest._promise=le,!re)jl(v,I);return le}function zd(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")ec(V);return fT(v._writableStreamController),M}function Qb(v){return u((M,V)=>{let re={_resolve:M,_reject:V};v._writeRequests.push(re)})}function zl(v,I){if(v._state==="writable"){jl(v,I);return}Wl(v)}function jl(v,I){let M=v._writableStreamController;v._state="erroring",v._storedError=I;let V=v._writer;if(V!==void 0)Wd(V,I);if(!oT(v)&&M._started)Wl(v)}function Wl(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){Xs(v);return}let M=v._pendingAbortRequest;if(v._pendingAbortRequest=void 0,M._wasAlreadyErroring){M._reject(I),Xs(v);return}let V=v._writableStreamController[A](M._reason);p(V,()=>(M._resolve(),Xs(v),null),(re)=>(M._reject(re),Xs(v),null))}function eT(v){v._inFlightWriteRequest._resolve(void 0),v._inFlightWriteRequest=void 0}function tT(v,I){v._inFlightWriteRequest._reject(I),v._inFlightWriteRequest=void 0,zl(v,I)}function rT(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 nT(v,I){if(v._inFlightCloseRequest._reject(I),v._inFlightCloseRequest=void 0,v._pendingAbortRequest!==void 0)v._pendingAbortRequest._reject(I),v._pendingAbortRequest=void 0;zl(v,I)}function en(v){if(v._closeRequest===void 0&&v._inFlightCloseRequest===void 0)return!1;return!0}function oT(v){if(v._inFlightWriteRequest===void 0&&v._inFlightCloseRequest===void 0)return!1;return!0}function iT(v){v._inFlightCloseRequest=v._closeRequest,v._closeRequest=void 0}function sT(v){v._inFlightWriteRequest=v._writeRequests.shift()}function Xs(v){if(v._closeRequest!==void 0)v._closeRequest._reject(v._storedError),v._closeRequest=void 0;let I=v._writer;if(I!==void 0)Zl(I,v._storedError)}function Jl(v,I){let M=v._writer;if(M!==void 0&&I!==v._backpressure)if(I)yT(M);else ec(M);v._backpressure=I}class tn{constructor(v){if(je(v,1,"WritableStreamDefaultWriter"),Bd(v,"First parameter"),Zo(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(!en(v)&&v._backpressure)ta(this);else rf(this);ea(this)}else if(I==="erroring")Ql(this,v._storedError),ea(this);else if(I==="closed")rf(this),vT(this);else{let M=v._storedError;Ql(this,M),ef(this,M)}}get closed(){if(!So(this))return h(bo("closed"));return this._closedPromise}get desiredSize(){if(!So(this))throw bo("desiredSize");if(this._ownerWritableStream===void 0)throw es("desiredSize");return uT(this)}get ready(){if(!So(this))return h(bo("ready"));return this._readyPromise}abort(v=void 0){if(!So(this))return h(bo("abort"));if(this._ownerWritableStream===void 0)return h(es("abort"));return aT(this,v)}close(){if(!So(this))return h(bo("close"));let v=this._ownerWritableStream;if(v===void 0)return h(es("close"));if(en(v))return h(TypeError("Cannot close an already-closing stream"));return jd(this)}releaseLock(){if(!So(this))throw bo("releaseLock");if(this._ownerWritableStream===void 0)return;Jd(this)}write(v=void 0){if(!So(this))return h(bo("write"));if(this._ownerWritableStream===void 0)return h(es("write to"));return Kd(this,v)}}if(Object.defineProperties(tn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),s(tn.prototype.abort,"abort"),s(tn.prototype.close,"close"),s(tn.prototype.releaseLock,"releaseLock"),s(tn.prototype.write,"write"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(tn.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function So(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_ownerWritableStream"))return!1;return v instanceof tn}function aT(v,I){let M=v._ownerWritableStream;return Ks(M,I)}function jd(v){let I=v._ownerWritableStream;return zd(I)}function lT(v){let I=v._ownerWritableStream,M=I._state;if(en(I)||M==="closed")return f(void 0);if(M==="errored")return h(I._storedError);return jd(v)}function cT(v,I){if(v._closedPromiseState==="pending")Zl(v,I);else _T(v,I)}function Wd(v,I){if(v._readyPromiseState==="pending")nf(v,I);else ST(v,I)}function uT(v){let I=v._ownerWritableStream,M=I._state;if(M==="errored"||M==="erroring")return null;if(M==="closed")return 0;return Zd(I._writableStreamController)}function Jd(v){let I=v._ownerWritableStream,M=TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Wd(v,M),cT(v,M),I._writer=void 0,v._ownerWritableStream=void 0}function Kd(v,I){let M=v._ownerWritableStream,V=M._writableStreamController,re=pT(V,I);if(M!==v._ownerWritableStream)return h(es("write to"));let le=M._state;if(le==="errored")return h(M._storedError);if(en(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=Qb(M);return hT(V,I,re),_e}let Xd={};class Eo{constructor(){throw TypeError("Illegal constructor")}get abortReason(){if(!Kl(this))throw Yl("abortReason");return this._abortReason}get signal(){if(!Kl(this))throw Yl("signal");if(this._abortController===void 0)throw TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(v=void 0){if(!Kl(this))throw Yl("error");if(this._controlledWritableStream._state!=="writable")return;Qd(this,v)}[A](v){let I=this._abortAlgorithm(v);return Ys(this),I}[P](){dr(this)}}if(Object.defineProperties(Eo.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Eo.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Kl(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledWritableStream"))return!1;return v instanceof Eo}function Yd(v,I,M,V,re,le,_e,Me){I._controlledWritableStream=v,v._writableStreamController=I,I._queue=void 0,I._queueTotalSize=void 0,dr(I),I._abortReason=void 0,I._abortController=Yb(),I._started=!1,I._strategySizeAlgorithm=Me,I._strategyHWM=_e,I._writeAlgorithm=V,I._closeAlgorithm=re,I._abortAlgorithm=le;let Le=Xl(I);Jl(v,Le);let Ke=M(),Ze=f(Ke);p(Ze,()=>(I._started=!0,Zs(I),null),(lt)=>(I._started=!0,zl(v,lt),null))}function dT(v,I,M,V){let re=Object.create(Eo.prototype),le,_e,Me,Le;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)Me=()=>I.close();else Me=()=>f(void 0);if(I.abort!==void 0)Le=(Ke)=>I.abort(Ke);else Le=()=>f(void 0);Yd(v,re,le,_e,Me,Le,M,V)}function Ys(v){v._writeAlgorithm=void 0,v._closeAlgorithm=void 0,v._abortAlgorithm=void 0,v._strategySizeAlgorithm=void 0}function fT(v){fn(v,Xd,0),Zs(v)}function pT(v,I){try{return v._strategySizeAlgorithm(I)}catch(M){return Qi(v,M),1}}function Zd(v){return v._strategyHWM-v._queueTotalSize}function hT(v,I,M){try{fn(v,I,M)}catch(re){Qi(v,re);return}let V=v._controlledWritableStream;if(!en(V)&&V._state==="writable"){let re=Xl(v);Jl(V,re)}Zs(v)}function Zs(v){let I=v._controlledWritableStream;if(!v._started)return;if(I._inFlightWriteRequest!==void 0)return;if(I._state==="erroring"){Wl(I);return}if(v._queue.length===0)return;let V=ho(v);if(V===Xd)mT(v);else gT(v,V)}function Qi(v,I){if(v._controlledWritableStream._state==="writable")Qd(v,I)}function mT(v){let I=v._controlledWritableStream;iT(I),dn(v);let M=v._closeAlgorithm();Ys(v),p(M,()=>(rT(I),null),(V)=>(nT(I,V),null))}function gT(v,I){let M=v._controlledWritableStream;sT(M);let V=v._writeAlgorithm(I);p(V,()=>{eT(M);let re=M._state;if(dn(v),!en(M)&&re==="writable"){let le=Xl(v);Jl(M,le)}return Zs(v),null},(re)=>{if(M._state==="writable")Ys(v);return tT(M,re),null})}function Xl(v){return Zd(v)<=0}function Qd(v,I){let M=v._controlledWritableStream;Ys(v),jl(M,I)}function Qs(v){return TypeError(`WritableStream.prototype.${v} can only be used on a WritableStream`)}function Yl(v){return TypeError(`WritableStreamDefaultController.prototype.${v} can only be used on a WritableStreamDefaultController`)}function bo(v){return TypeError(`WritableStreamDefaultWriter.prototype.${v} can only be used on a WritableStreamDefaultWriter`)}function es(v){return TypeError("Cannot "+v+" a stream using a released writer")}function ea(v){v._closedPromise=u((I,M)=>{v._closedPromise_resolve=I,v._closedPromise_reject=M,v._closedPromiseState="pending"})}function ef(v,I){ea(v),Zl(v,I)}function vT(v){ea(v),tf(v)}function Zl(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 _T(v,I){ef(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 ta(v){v._readyPromise=u((I,M)=>{v._readyPromise_resolve=I,v._readyPromise_reject=M}),v._readyPromiseState="pending"}function Ql(v,I){ta(v),nf(v,I)}function rf(v){ta(v),ec(v)}function nf(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 yT(v){ta(v)}function ST(v,I){Ql(v,I)}function ec(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 ET(){if(typeof globalThis<"u")return globalThis;else if(typeof self<"u")return self;else if(typeof global<"u")return global;return}let tc=ET();function bT(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 TT(){let v=tc===null||tc===void 0?void 0:tc.DOMException;return bT(v)?v:void 0}function wT(){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 CT=TT()||wT();function of(v,I,M,V,re,le){let _e=ee(v),Me=Hd(I);v._disturbed=!0;let Le=!1,Ke=f(void 0);return u((Ze,lt)=>{let wt;if(le!==void 0){if(wt=()=>{let Be=le.reason!==void 0?le.reason:new CT("Aborted","AbortError"),mt=[];if(!V)mt.push(()=>{if(I._state==="writable")return Ks(I,Be);return f(void 0)});if(!re)mt.push(()=>{if(v._state==="readable")return Gr(v,Be);return f(void 0)});pr(()=>Promise.all(mt.map((Rt)=>Rt())),!0,Be)},le.aborted){wt();return}le.addEventListener("abort",wt)}function wn(){return u((Be,mt)=>{function Rt(Tr){if(Tr)Be();else g(ri(),Rt,mt)}Rt(!1)})}function ri(){if(Le)return f(!0);return g(Me._readyPromise,()=>u((Be,mt)=>{ue(_e,{_chunkSteps:(Rt)=>{Ke=g(Kd(Me,Rt),void 0,n),Be(!1)},_closeSteps:()=>Be(!0),_errorSteps:mt})}))}if(Cn(v,_e._closedPromise,(Be)=>{if(!V)pr(()=>Ks(I,Be),!0,Be);else Rr(!0,Be);return null}),Cn(I,Me._closedPromise,(Be)=>{if(!re)pr(()=>Gr(v,Be),!0,Be);else Rr(!0,Be);return null}),lr(v,_e._closedPromise,()=>{if(!M)pr(()=>lT(Me));else Rr();return null}),en(I)||I._state==="closed"){let Be=TypeError("the destination writable stream closed before all data could be piped to it");if(!re)pr(()=>Gr(v,Be),!0,Be);else Rr(!0,Be)}E(wn());function eo(){let Be=Ke;return g(Ke,()=>Be!==Ke?eo():void 0)}function Cn(Be,mt,Rt){if(Be._state==="errored")Rt(Be._storedError);else y(mt,Rt)}function lr(Be,mt,Rt){if(Be._state==="closed")Rt();else _(mt,Rt)}function pr(Be,mt,Rt){if(Le)return;if(Le=!0,I._state==="writable"&&!en(I))_(eo(),Tr);else Tr();function Tr(){return p(Be(),()=>Rn(mt,Rt),(ni)=>Rn(!0,ni)),null}}function Rr(Be,mt){if(Le)return;if(Le=!0,I._state==="writable"&&!en(I))_(eo(),()=>Rn(Be,mt));else Rn(Be,mt)}function Rn(Be,mt){if(Jd(Me),Q(_e),le!==void 0)le.removeEventListener("abort",wt);if(Be)lt(mt);else Ze(void 0);return null}})}class rn{constructor(){throw TypeError("Illegal constructor")}get desiredSize(){if(!ra(this))throw oa("desiredSize");return rc(this)}close(){if(!ra(this))throw oa("close");if(!ei(this))throw TypeError("The stream is not in a state that permits close");To(this)}enqueue(v=void 0){if(!ra(this))throw oa("enqueue");if(!ei(this))throw TypeError("The stream is not in a state that permits enqueue");return Qo(this,v)}error(v=void 0){if(!ra(this))throw oa("error");Fr(this,v)}[D](v){dr(this);let I=this._cancelAlgorithm(v);return na(this),I}[N](v){let I=this._controlledReadableStream;if(this._queue.length>0){let M=dn(this);if(this._closeRequested&&this._queue.length===0)na(this),ns(I);else ts(this);v._chunkSteps(M)}else Z(I,v),ts(this)}[F](){}}if(Object.defineProperties(rn.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),s(rn.prototype.close,"close"),s(rn.prototype.enqueue,"enqueue"),s(rn.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function ra(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledReadableStream"))return!1;return v instanceof rn}function ts(v){if(!sf(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,ts(v);return null},(V)=>(Fr(v,V),null))}function sf(v){let I=v._controlledReadableStream;if(!ei(v))return!1;if(!v._started)return!1;if(Qn(I)&&oe(I)>0)return!0;if(rc(v)>0)return!0;return!1}function na(v){v._pullAlgorithm=void 0,v._cancelAlgorithm=void 0,v._strategySizeAlgorithm=void 0}function To(v){if(!ei(v))return;let I=v._controlledReadableStream;if(v._closeRequested=!0,v._queue.length===0)na(v),ns(I)}function Qo(v,I){if(!ei(v))return;let M=v._controlledReadableStream;if(Qn(M)&&oe(M)>0)te(M,I,!1);else{let V;try{V=v._strategySizeAlgorithm(I)}catch(re){throw Fr(v,re),re}try{fn(v,I,V)}catch(re){throw Fr(v,re),re}}ts(v)}function Fr(v,I){let M=v._controlledReadableStream;if(M._state!=="readable")return;dr(v),na(v),uf(M,I)}function rc(v){let I=v._controlledReadableStream._state;if(I==="errored")return null;if(I==="closed")return 0;return v._strategyHWM-v._queueTotalSize}function RT(v){if(sf(v))return!1;return!0}function ei(v){let I=v._controlledReadableStream._state;if(!v._closeRequested&&I==="readable")return!0;return!1}function af(v,I,M,V,re,le,_e){I._controlledReadableStream=v,I._queue=void 0,I._queueTotalSize=void 0,dr(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 Me=M();p(f(Me),()=>(I._started=!0,ts(I),null),(Le)=>(Fr(I,Le),null))}function AT(v,I,M,V){let re=Object.create(rn.prototype),le,_e,Me;if(I.start!==void 0)le=()=>I.start(re);else le=()=>{return};if(I.pull!==void 0)_e=()=>I.pull(re);else _e=()=>f(void 0);if(I.cancel!==void 0)Me=(Le)=>I.cancel(Le);else Me=()=>f(void 0);af(v,re,le,_e,Me,M,V)}function oa(v){return TypeError(`ReadableStreamDefaultController.prototype.${v} can only be used on a ReadableStreamDefaultController`)}function IT(v,I){if(Er(v._readableStreamController))return kT(v);return PT(v)}function PT(v,I){let M=ee(v),V=!1,re=!1,le=!1,_e=!1,Me,Le,Ke,Ze,lt,wt=u((lr)=>{lt=lr});function wn(){if(V)return re=!0,f(void 0);return V=!0,ue(M,{_chunkSteps:(pr)=>{b(()=>{re=!1;let Rr=pr,Rn=pr;if(!le)Qo(Ke._readableStreamController,Rr);if(!_e)Qo(Ze._readableStreamController,Rn);if(V=!1,re)wn()})},_closeSteps:()=>{if(V=!1,!le)To(Ke._readableStreamController);if(!_e)To(Ze._readableStreamController);if(!le||!_e)lt(void 0)},_errorSteps:()=>{V=!1}}),f(void 0)}function ri(lr){if(le=!0,Me=lr,_e){let pr=Qe([Me,Le]),Rr=Gr(v,pr);lt(Rr)}return wt}function eo(lr){if(_e=!0,Le=lr,le){let pr=Qe([Me,Le]),Rr=Gr(v,pr);lt(Rr)}return wt}function Cn(){}return Ke=rs(Cn,wn,ri),Ze=rs(Cn,wn,eo),y(M._closedPromise,(lr)=>{if(Fr(Ke._readableStreamController,lr),Fr(Ze._readableStreamController,lr),!le||!_e)lt(void 0);return null}),[Ke,Ze]}function kT(v){let I=ee(v),M=!1,V=!1,re=!1,le=!1,_e=!1,Me,Le,Ke,Ze,lt,wt=u((Be)=>{lt=Be});function wn(Be){y(Be._closedPromise,(mt)=>{if(Be!==I)return null;if(Xt(Ke._readableStreamController,mt),Xt(Ze._readableStreamController,mt),!le||!_e)lt(void 0);return null})}function ri(){if(Et(I))Q(I),I=ee(v),wn(I);ue(I,{_chunkSteps:(mt)=>{b(()=>{V=!1,re=!1;let Rt=mt,Tr=mt;if(!le&&!_e)try{Tr=Ln(mt)}catch(ni){Xt(Ke._readableStreamController,ni),Xt(Ze._readableStreamController,ni),lt(Gr(v,ni));return}if(!le)gn(Ke._readableStreamController,Rt);if(!_e)gn(Ze._readableStreamController,Tr);if(M=!1,V)Cn();else if(re)lr()})},_closeSteps:()=>{if(M=!1,!le)Xr(Ke._readableStreamController);if(!_e)Xr(Ze._readableStreamController);if(Ke._readableStreamController._pendingPullIntos.length>0)vn(Ke._readableStreamController,0);if(Ze._readableStreamController._pendingPullIntos.length>0)vn(Ze._readableStreamController,0);if(!le||!_e)lt(void 0)},_errorSteps:()=>{M=!1}})}function eo(Be,mt){if(ce(I))Q(I),I=Zr(v),wn(I);let Rt=mt?Ze:Ke,Tr=mt?Ke:Ze;Qr(I,Be,1,{_chunkSteps:(oi)=>{b(()=>{V=!1,re=!1;let ii=mt?_e:le;if(!(mt?le:_e)){let Tf;try{Tf=Ln(oi)}catch(ac){Xt(Rt._readableStreamController,ac),Xt(Tr._readableStreamController,ac),lt(Gr(v,ac));return}if(!ii)_n(Rt._readableStreamController,oi);gn(Tr._readableStreamController,Tf)}else if(!ii)_n(Rt._readableStreamController,oi);if(M=!1,V)Cn();else if(re)lr()})},_closeSteps:(oi)=>{M=!1;let ii=mt?_e:le,ca=mt?le:_e;if(!ii)Xr(Rt._readableStreamController);if(!ca)Xr(Tr._readableStreamController);if(oi!==void 0){if(!ii)_n(Rt._readableStreamController,oi);if(!ca&&Tr._readableStreamController._pendingPullIntos.length>0)vn(Tr._readableStreamController,0)}if(!ii||!ca)lt(void 0)},_errorSteps:()=>{M=!1}})}function Cn(){if(M)return V=!0,f(void 0);M=!0;let Be=Jn(Ke._readableStreamController);if(Be===null)ri();else eo(Be._view,!1);return f(void 0)}function lr(){if(M)return re=!0,f(void 0);M=!0;let Be=Jn(Ze._readableStreamController);if(Be===null)ri();else eo(Be._view,!0);return f(void 0)}function pr(Be){if(le=!0,Me=Be,_e){let mt=Qe([Me,Le]),Rt=Gr(v,mt);lt(Rt)}return wt}function Rr(Be){if(_e=!0,Le=Be,le){let mt=Qe([Me,Le]),Rt=Gr(v,mt);lt(Rt)}return wt}function Rn(){return}return Ke=cf(Rn,Cn,pr),Ze=cf(Rn,lr,Rr),wn(I),[Ke,Ze]}function NT(v){return o(v)&&typeof v.getReader<"u"}function OT(v){if(NT(v))return $T(v.getReader());return MT(v)}function MT(v){let I,M=Sr(v,"async"),V=n;function re(){let _e;try{_e=xt(M)}catch(Le){return h(Le)}let Me=f(_e);return S(Me,(Le)=>{if(!o(Le))throw TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(po(Le))To(I._readableStreamController);else{let Ze=Vo(Le);Qo(I._readableStreamController,Ze)}})}function le(_e){let Me=M.iterator,Le;try{Le=ir(Me,"return")}catch(lt){return h(lt)}if(Le===void 0)return f(void 0);let Ke;try{Ke=R(Le,Me,[_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=rs(V,re,le,0),I}function $T(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)To(I._readableStreamController);else{let Me=_e.value;Qo(I._readableStreamController,Me)}})}function re(le){try{return f(v.cancel(le))}catch(_e){return h(_e)}}return I=rs(M,V,re,0),I}function DT(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,Me=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:qT(re,M,`${I} has member 'cancel' that`),pull:le===void 0?void 0:xT(le,M,`${I} has member 'pull' that`),start:_e===void 0?void 0:LT(_e,M,`${I} has member 'start' that`),type:Me===void 0?void 0:UT(Me,`${I} has member 'type' that`)}}function qT(v,I,M){return Ce(v,M),(V)=>T(v,I,[V])}function xT(v,I,M){return Ce(v,M),(V)=>T(v,I,[V])}function LT(v,I,M){return Ce(v,M),(V)=>R(v,I,[V])}function UT(v,I){if(v=`${v}`,v!=="bytes")throw TypeError(`${I} '${v}' is not a valid enumeration value for ReadableStreamType`);return v}function FT(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.preventCancel;return{preventCancel:Boolean(M)}}function lf(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)GT(le,`${I} has member 'signal' that`);return{preventAbort:Boolean(M),preventCancel:Boolean(V),preventClose:Boolean(re),signal:le}}function GT(v,I){if(!Kb(v))throw TypeError(`${I} is not an AbortSignal.`)}function BT(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"),Bd(V,`${I} has member 'writable' that`),{readable:M,writable:V}}class Yt{constructor(v={},I={}){if(v===void 0)v=null;else Ie(v,"First parameter");let M=Js(I,"Second parameter"),V=DT(v,"First parameter");if(nc(this),V.type==="bytes"){if(M.size!==void 0)throw RangeError("The strategy for a byte stream cannot have a size function");let re=Zi(M,0);vo(this,V,re)}else{let re=Ws(M),le=Zi(M,1);AT(this,V,le,re)}}get locked(){if(!Zn(this))throw wo("locked");return Qn(this)}cancel(v=void 0){if(!Zn(this))return h(wo("cancel"));if(Qn(this))return h(TypeError("Cannot cancel a stream that already has a reader"));return Gr(this,v)}getReader(v=void 0){if(!Zn(this))throw wo("getReader");if(Yr(v,"First parameter").mode===void 0)return ee(this);return Zr(this)}pipeThrough(v,I={}){if(!Zn(this))throw wo("pipeThrough");je(v,1,"pipeThrough");let M=BT(v,"First parameter"),V=lf(I,"Second parameter");if(Qn(this))throw TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Zo(M.writable))throw TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let re=of(this,M.writable,V.preventClose,V.preventAbort,V.preventCancel,V.signal);return E(re),M.readable}pipeTo(v,I={}){if(!Zn(this))return h(wo("pipeTo"));if(v===void 0)return h("Parameter 1 is required in 'pipeTo'.");if(!Yo(v))return h(TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let M;try{M=lf(I,"Second parameter")}catch(V){return h(V)}if(Qn(this))return h(TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(Zo(v))return h(TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));return of(this,v,M.preventClose,M.preventAbort,M.preventCancel,M.signal)}tee(){if(!Zn(this))throw wo("tee");let v=IT(this);return Qe(v)}values(v=void 0){if(!Zn(this))throw wo("values");let I=FT(v,"First parameter");return Jt(this,I.preventCancel)}[yr](v){return this.values(v)}static from(v){return OT(v)}}if(Object.defineProperties(Yt,{from:{enumerable:!0}}),Object.defineProperties(Yt.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),s(Yt.from,"from"),s(Yt.prototype.cancel,"cancel"),s(Yt.prototype.getReader,"getReader"),s(Yt.prototype.pipeThrough,"pipeThrough"),s(Yt.prototype.pipeTo,"pipeTo"),s(Yt.prototype.tee,"tee"),s(Yt.prototype.values,"values"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Yt.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0});Object.defineProperty(Yt.prototype,yr,{value:Yt.prototype.values,writable:!0,configurable:!0});function rs(v,I,M,V=1,re=()=>1){let le=Object.create(Yt.prototype);nc(le);let _e=Object.create(rn.prototype);return af(le,_e,v,I,M,V,re),le}function cf(v,I,M){let V=Object.create(Yt.prototype);nc(V);let re=Object.create(Gt.prototype);return yn(V,re,v,I,M,0,void 0),V}function nc(v){v._state="readable",v._reader=void 0,v._storedError=void 0,v._disturbed=!1}function Zn(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_readableStreamController"))return!1;return v instanceof Yt}function Qn(v){if(v._reader===void 0)return!1;return!0}function Gr(v,I){if(v._disturbed=!0,v._state==="closed")return f(void 0);if(v._state==="errored")return h(v._storedError);ns(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 ns(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 uf(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 js(M,I)}function wo(v){return TypeError(`ReadableStream.prototype.${v} can only be used on a ReadableStream`)}function df(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 ff=(v)=>v.byteLength;s(ff,"size");class os{constructor(v){je(v,1,"ByteLengthQueuingStrategy"),v=df(v,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=v.highWaterMark}get highWaterMark(){if(!hf(this))throw pf("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!hf(this))throw pf("size");return ff}}if(Object.defineProperties(os.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(os.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function pf(v){return TypeError(`ByteLengthQueuingStrategy.prototype.${v} can only be used on a ByteLengthQueuingStrategy`)}function hf(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_byteLengthQueuingStrategyHighWaterMark"))return!1;return v instanceof os}let mf=()=>1;s(mf,"size");class is{constructor(v){je(v,1,"CountQueuingStrategy"),v=df(v,"First parameter"),this._countQueuingStrategyHighWaterMark=v.highWaterMark}get highWaterMark(){if(!vf(this))throw gf("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!vf(this))throw gf("size");return mf}}if(Object.defineProperties(is.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(is.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function gf(v){return TypeError(`CountQueuingStrategy.prototype.${v} can only be used on a CountQueuingStrategy`)}function vf(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_countQueuingStrategyHighWaterMark"))return!1;return v instanceof is}function HT(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,Me=v===null||v===void 0?void 0:v.writableType;return{cancel:M===void 0?void 0:WT(M,v,`${I} has member 'cancel' that`),flush:V===void 0?void 0:VT(V,v,`${I} has member 'flush' that`),readableType:re,start:le===void 0?void 0:zT(le,v,`${I} has member 'start' that`),transform:_e===void 0?void 0:jT(_e,v,`${I} has member 'transform' that`),writableType:Me}}function VT(v,I,M){return Ce(v,M),(V)=>T(v,I,[V])}function zT(v,I,M){return Ce(v,M),(V)=>R(v,I,[V])}function jT(v,I,M){return Ce(v,M),(V,re)=>T(v,I,[V,re])}function WT(v,I,M){return Ce(v,M),(V)=>T(v,I,[V])}class ss{constructor(v={},I={},M={}){if(v===void 0)v=null;let V=Js(I,"Second parameter"),re=Js(M,"Third parameter"),le=HT(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=Zi(re,0),Me=Ws(re),Le=Zi(V,1),Ke=Ws(V),Ze,lt=u((wt)=>{Ze=wt});if(JT(this,lt,Le,Ke,_e,Me),XT(this,le),le.start!==void 0)Ze(le.start(this._transformStreamController));else Ze(void 0)}get readable(){if(!_f(this))throw bf("readable");return this._readable}get writable(){if(!_f(this))throw bf("writable");return this._writable}}if(Object.defineProperties(ss.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(ss.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function JT(v,I,M,V,re,le){function _e(){return I}function Me(wt){return QT(v,wt)}function Le(wt){return ew(v,wt)}function Ke(){return tw(v)}v._writable=Zb(_e,Me,Ke,Le,M,V);function Ze(){return rw(v)}function lt(wt){return nw(v,wt)}v._readable=rs(_e,Ze,lt,re,le),v._backpressure=void 0,v._backpressureChangePromise=void 0,v._backpressureChangePromise_resolve=void 0,ia(v,!0),v._transformStreamController=void 0}function _f(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_transformStreamController"))return!1;return v instanceof ss}function yf(v,I){Fr(v._readable._readableStreamController,I),oc(v,I)}function oc(v,I){aa(v._transformStreamController),Qi(v._writable._writableStreamController,I),ic(v)}function ic(v){if(v._backpressure)ia(v,!1)}function ia(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(!sa(this))throw la("desiredSize");let v=this._controlledTransformStream._readable._readableStreamController;return rc(v)}enqueue(v=void 0){if(!sa(this))throw la("enqueue");Sf(this,v)}error(v=void 0){if(!sa(this))throw la("error");YT(this,v)}terminate(){if(!sa(this))throw la("terminate");ZT(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 sa(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledTransformStream"))return!1;return v instanceof Tn}function KT(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 XT(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 Sf(M,_e),f(void 0)}catch(Me){return h(Me)}};if(I.flush!==void 0)re=()=>I.flush(M);else re=()=>f(void 0);if(I.cancel!==void 0)le=(_e)=>I.cancel(_e);else le=()=>f(void 0);KT(v,M,V,re,le)}function aa(v){v._transformAlgorithm=void 0,v._flushAlgorithm=void 0,v._cancelAlgorithm=void 0}function Sf(v,I){let M=v._controlledTransformStream,V=M._readable._readableStreamController;if(!ei(V))throw TypeError("Readable side is not in a state that permits enqueue");try{Qo(V,I)}catch(le){throw oc(M,le),M._readable._storedError}if(RT(V)!==M._backpressure)ia(M,!0)}function YT(v,I){yf(v._controlledTransformStream,I)}function Ef(v,I){let M=v._transformAlgorithm(I);return S(M,void 0,(V)=>{throw yf(v._controlledTransformStream,V),V})}function ZT(v){let I=v._controlledTransformStream,M=I._readable._readableStreamController;To(M);let V=TypeError("TransformStream terminated");oc(I,V)}function QT(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 Ef(M,I)})}return Ef(M,I)}function ew(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 aa(M),p(re,()=>{if(V._state==="errored")ti(M,V._storedError);else Fr(V._readableStreamController,I),sc(M);return null},(le)=>(Fr(V._readableStreamController,le),ti(M,le),null)),M._finishPromise}function tw(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 aa(I),p(V,()=>{if(M._state==="errored")ti(I,M._storedError);else To(M._readableStreamController),sc(I);return null},(re)=>(Fr(M._readableStreamController,re),ti(I,re),null)),I._finishPromise}function rw(v){return ia(v,!1),v._backpressureChangePromise}function nw(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 aa(M),p(re,()=>{if(V._state==="errored")ti(M,V._storedError);else Qi(V._writableStreamController,I),ic(v),sc(M);return null},(le)=>(Qi(V._writableStreamController,le),ic(v),ti(M,le),null)),M._finishPromise}function la(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 ti(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 bf(v){return TypeError(`TransformStream.prototype.${v} can only be used on a TransformStream`)}r.ByteLengthQueuingStrategy=os,r.CountQueuingStrategy=is,r.ReadableByteStreamController=Gt,r.ReadableStream=Yt,r.ReadableStreamBYOBReader=Pt,r.ReadableStreamBYOBRequest=fr,r.ReadableStreamDefaultController=rn,r.ReadableStreamDefaultReader=z,r.TransformStream=ss,r.TransformStreamDefaultController=Tn,r.WritableStream=bn,r.WritableStreamDefaultController=Eo,r.WritableStreamDefaultWriter=tn})}}),Pw=ye({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/streams.cjs"(){var e=65536;if(!globalThis.ReadableStream)try{let t=Te("node:process"),{emitWarning:r}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,Te("node:stream/web")),t.emitWarning=r}catch(n){throw t.emitWarning=r,n}}catch(t){Object.assign(globalThis,Iw())}try{let{Blob:t}=Te("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*lc(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,Nc),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+Nc)).arrayBuffer();n+=s.byteLength,yield new Uint8Array(s)}}}var kw,Nc,cc,wf,No,sl=Wt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/index.js"(){kw=wr(Pw(),1),Nc=65536,cc=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 lc(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 lc(this.#e,!1))t.set(n,r),r+=n.length;return t.buffer}stream(){let t=lc(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(cc.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),wf=cc,No=wf}}),Cf,Rf,$s,Eg=Wt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/file.js"(){sl(),Cf=class e extends No{#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 No&&/^(File)$/.test(t[Symbol.toStringTag])}},Rf=Cf,$s=Rf}});function Nw(e,t=No){var r=`${Oc()}${Oc()}`.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+Pa(s)+`"\r
|
|
15
|
+
\r
|
|
16
|
+
${i.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
|
|
17
|
+
`)}\r
|
|
18
|
+
`):n.push(o+Pa(s)+`"; filename="${Pa(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 ai,Af,If,Oc,Pf,uc,Pa,to,yi,uu=Wt({"../node_modules/.bun/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js"(){sl(),Eg(),{toStringTag:ai,iterator:Af,hasInstance:If}=Symbol,Oc=Math.random,Pf="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),uc=(e,t,r)=>(e+="",/^(Blob|File)$/.test(t&&t[ai])?[(r=r!==void 0?r+"":t[ai]=="File"?t.name:"blob",e),t.name!==r||t[ai]=="blob"?new $s([t],r,t):t]:[e,t+""]),Pa=(e,t)=>(t?e:e.replace(/\r?\n|\r/g,`\r
|
|
23
|
+
`)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),to=(e,t,r)=>{if(t.length<r)throw TypeError(`Failed to execute '${e}' on 'FormData': ${r} arguments required, but only ${t.length} present.`)},yi=class e{#e=[];constructor(...t){if(t.length)throw TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[ai](){return"FormData"}[Af](){return this.entries()}static[If](t){return t&&typeof t==="object"&&t[ai]==="FormData"&&!Pf.some((r)=>typeof t[r]!="function")}append(...t){to("append",arguments,2),this.#e.push(uc(...t))}delete(t){to("delete",arguments,1),t+="",this.#e=this.#e.filter(([r])=>r!==t)}get(t){to("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 to("getAll",arguments,1),r=[],t+="",this.#e.forEach((n)=>n[0]===t&&r.push(n[1])),r}has(t){return to("has",arguments,1),t+="",this.#e.some((r)=>r[0]===t)}forEach(t,r){to("forEach",arguments,1);for(var[n,o]of this)t.call(r,o,n,this)}set(...t){to("set",arguments,2);var r=[],n=!0;t=uc(...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}}}}),Ds,du=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/base.js"(){Ds=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}}}}),Nr,bg=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/fetch-error.js"(){du(),Nr=class extends Ds{constructor(e,t,r){super(e,t);if(r)this.code=this.errno=r.code,this.erroredSysCall=r.syscall}}}}),as,Mc,gs,Tg,wg,Cg,fu=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is.js"(){as=Symbol.toStringTag,Mc=(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[as]==="URLSearchParams",gs=(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[as]),Tg=(e)=>typeof e==="object"&&(e[as]==="AbortSignal"||e[as]==="EventTarget"),wg=(e,t)=>{let r=new URL(t).hostname,n=new URL(e).hostname;return r===n||r.endsWith(`.${n}`)},Cg=(e,t)=>{let r=new URL(t).protocol,n=new URL(e).protocol;return r===n}}}),Ow=ye({"../node_modules/.bun/node-domexception@1.0.0/node_modules/node-domexception/index.js"(e,t){if(!globalThis.DOMException)try{let{MessageChannel:r}=Te("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}}),Nf,ua,Rg,Ag,Ig,Pg,dc,fc,pc,kg=Wt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js"(){Nf=wr(Ow(),1),Eg(),sl(),{stat:ua}=$w,Rg=(e,t)=>dc(kf(e),e,t),Ag=(e,t)=>ua(e).then((r)=>dc(r,e,t)),Ig=(e,t)=>ua(e).then((r)=>fc(r,e,t)),Pg=(e,t)=>fc(kf(e),e,t),dc=(e,t,r="")=>new No([new pc({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],{type:r}),fc=(e,t,r="")=>new $s([new pc({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],Dw(t),{type:r,lastModified:e.mtimeMs}),pc=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 ua(this.#e);if(t>this.lastModified)throw new Nf.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*Mw(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}}}),Ng={};Ms(Ng,{toFormData:()=>xw});function qw(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 xw(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 Og(r[1]||r[2]),o,i,s,l,a,c,u=[],f=new yi,h=(S)=>{s+=y.decode(S,{stream:!0})},g=(S)=>{u.push(S)},p=()=>{let S=new $s(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=qw(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 Br,Ct,hc,An,ls,cs,Of,li,Mf,$f,Df,qf,ro,Og,Lw=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js"(){kg(),uu(),Br=0,Ct={START_BOUNDARY:Br++,HEADER_FIELD_START:Br++,HEADER_FIELD:Br++,HEADER_VALUE_START:Br++,HEADER_VALUE:Br++,HEADER_VALUE_ALMOST_DONE:Br++,HEADERS_ALMOST_DONE:Br++,PART_DATA_START:Br++,PART_DATA:Br++,END:Br++},hc=1,An={PART_BOUNDARY:hc,LAST_BOUNDARY:hc*=2},ls=10,cs=13,Of=32,li=45,Mf=58,$f=97,Df=122,qf=(e)=>e|32,ro=()=>{},Og=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=ro,this.onHeaderField=ro,this.onHeadersEnd=ro,this.onHeaderValue=ro,this.onPartBegin=ro,this.onPartData=ro,this.onPartEnd=ro,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,T,w)=>{if(R===void 0||R!==T)this[b](w&&w.subarray(R,T))},E=(b,R)=>{let T=b+"Mark";if(!(T in this))return;if(R)S(b,this[T],t,e),delete this[T];else S(b,this[T],e.length,e),this[T]=0};for(t=0;t<r;t++)switch(g=e[t],a){case Ct.START_BOUNDARY:if(l===i.length-2){if(g===li)c|=An.LAST_BOUNDARY;else if(g!==cs)return;l++;break}else if(l-1===i.length-2){if(c&An.LAST_BOUNDARY&&g===li)a=Ct.END,c=0;else if(!(c&An.LAST_BOUNDARY)&&g===ls)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===cs){y("onHeaderField"),a=Ct.HEADERS_ALMOST_DONE;break}if(l++,g===li)break;if(g===Mf){if(l===1)return;E("onHeaderField",!0),a=Ct.HEADER_VALUE_START;break}if(p=qf(g),p<$f||p>Df)return;break;case Ct.HEADER_VALUE_START:if(g===Of)break;_("onHeaderValue"),a=Ct.HEADER_VALUE;case Ct.HEADER_VALUE:if(g===cs)E("onHeaderValue",!0),S("onHeaderEnd"),a=Ct.HEADER_VALUE_ALMOST_DONE;break;case Ct.HEADER_VALUE_ALMOST_DONE:if(g!==ls)return;a=Ct.HEADER_FIELD_START;break;case Ct.HEADERS_ALMOST_DONE:if(g!==ls)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===cs)c|=An.PART_BOUNDARY;else if(g===li)c|=An.LAST_BOUNDARY;else l=0;else if(l-1===i.length)if(c&An.PART_BOUNDARY){if(l=0,g===ls){c&=~An.PART_BOUNDARY,S("onPartEnd"),S("onPartBegin"),a=Ct.HEADER_FIELD_START;break}}else if(c&An.LAST_BOUNDARY)if(g===li)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 gc(e){if(e[ur].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[ur].disturbed=!0,e[ur].error)throw e[ur].error;let{body:t}=e;if(t===null)return kr.alloc(0);if(!(t instanceof no))return kr.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 Nr(`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 Ds?o:new Nr(`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 kr.from(r.join(""));return kr.concat(r,n)}catch(o){throw new Nr(`Could not create Buffer from response body for ${e.url}: ${o.message}`,"system",o)}else throw new Nr(`Premature close of server response while trying to fetch ${e.url}`)}var Uf,ur,gi,al,Ff,pu,Mg,$g,hu=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/body.js"(){sl(),uu(),bg(),du(),fu(),Uf=Uw(no.pipeline),ur=Symbol("Body internals"),gi=class{constructor(e,{size:t=0}={}){let r=null;if(e===null)e=null;else if(Mc(e))e=kr.from(e.toString());else if(gs(e));else if(kr.isBuffer(e));else if(Lf.isAnyArrayBuffer(e))e=kr.from(e);else if(ArrayBuffer.isView(e))e=kr.from(e.buffer,e.byteOffset,e.byteLength);else if(e instanceof no);else if(e instanceof yi)e=Nw(e),r=e.type.split("=")[1];else e=kr.from(String(e));let n=e;if(kr.isBuffer(e))n=no.Readable.from(e);else if(gs(e))n=no.Readable.from(e.stream());if(this[ur]={body:e,stream:n,boundary:r,disturbed:!1,error:null},this.size=t,e instanceof no)e.on("error",(o)=>{let i=o instanceof Ds?o:new Nr(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[ur].error=i})}get body(){return this[ur].stream}get bodyUsed(){return this[ur].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:r}=await gc(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 yi,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(()=>(Lw(),Ng));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[ur].body&&this[ur].body.type||"",t=await this.arrayBuffer();return new No([t],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await gc(this);return new TextDecoder().decode(e)}buffer(){return gc(this)}},gi.prototype.buffer=mc(gi.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer"),Object.defineProperties(gi.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:mc(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}}),al=(e,t)=>{let r,n,{body:o}=e[ur];if(e.bodyUsed)throw Error("cannot clone body after it is used");if(o instanceof no&&typeof o.getBoundary!=="function")r=new xf({highWaterMark:t}),n=new xf({highWaterMark:t}),o.pipe(r),o.pipe(n),e[ur].stream=r,o=n;return o},Ff=mc((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"),pu=(e,t)=>{if(e===null)return null;if(typeof e==="string")return"text/plain;charset=UTF-8";if(Mc(e))return"application/x-www-form-urlencoded;charset=UTF-8";if(gs(e))return e.type||null;if(kr.isBuffer(e)||Lf.isAnyArrayBuffer(e)||ArrayBuffer.isView(e))return null;if(e instanceof yi)return`multipart/form-data; boundary=${t[ur].boundary}`;if(e&&typeof e.getBoundary==="function")return`multipart/form-data;boundary=${Ff(e)}`;if(e instanceof no)return null;return"text/plain;charset=UTF-8"},Mg=(e)=>{let{body:t}=e[ur];if(t===null)return 0;if(gs(t))return t.size;if(kr.isBuffer(t))return t.length;if(t&&typeof t.getLengthSync==="function")return t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null;return null},$g=async(e,{body:t})=>{if(t===null)e.end();else await Uf(t,e)}}});function Fw(e=[]){return new Pn(e.reduce((t,r,n,o)=>{if(n%2===0)t.push(o.slice(n,n+2));return t},[]).filter(([t,r])=>{try{return vs(t),ka(t,String(r)),!0}catch{return!1}}))}var vs,ka,Pn,mu=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/headers.js"(){vs=typeof da.validateHeaderName==="function"?da.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}},ka=typeof da.validateHeaderValue==="function"?da.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}},Pn=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"&&!Gf.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"||Gf.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])=>(vs(n),ka(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)=>(vs(s),ka(s,String(l)),URLSearchParams.prototype[o].call(n,String(s).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return(s)=>(vs(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(Pn.prototype,["get","entries","forEach","values"].reduce((e,t)=>(e[t]={enumerable:!0},e),{}))}}),Bf,ll,Dg=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is-redirect.js"(){Bf=new Set([301,302,303,307,308]),ll=(e)=>Bf.has(e)}}),Ar,on,Gw=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/response.js"(){mu(),hu(),Dg(),Ar=Symbol("Response internals"),on=class e extends gi{constructor(t=null,r={}){super(t,r);let n=r.status!=null?r.status:200,o=new Pn(r.headers);if(t!==null&&!o.has("Content-Type")){let i=pu(t,this);if(i)o.append("Content-Type",i)}this[Ar]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Ar].type}get url(){return this[Ar].url||""}get status(){return this[Ar].status}get ok(){return this[Ar].status>=200&&this[Ar].status<300}get redirected(){return this[Ar].counter>0}get statusText(){return this[Ar].statusText}get headers(){return this[Ar].headers}get highWaterMark(){return this[Ar].highWaterMark}clone(){return new e(al(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(!ll(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[Ar].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 Pn(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(on.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}})}}),qg,Bw=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/get-search.js"(){qg=(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 Hf(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 Vw(e){if(!gu.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function zw(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,""),r=Hw(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 ci(e){if(/^about:(blank|srcdoc)$/.test(e))return!0;if(e.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test(e.protocol))return!0;return zw(e)}function jw(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=Hf(o),s=Hf(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(ci(i)&&!ci(l))return"no-referrer";return s.toString();case"strict-origin-when-cross-origin":if(i.origin===l.origin)return i;if(ci(i)&&!ci(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(ci(i)&&!ci(l))return"no-referrer";return i;default:throw TypeError(`Invalid referrerPolicy: ${n}`)}}function Ww(e){let t=(e.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of t)if(n&&gu.has(n))r=n;return r}var gu,xg,Lg=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/referrer.js"(){gu=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),xg="strict-origin-when-cross-origin"}}),Bt,ui,Vf,Cs,Ug,Xw=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/request.js"(){mu(),hu(),fu(),Bw(),Lg(),Bt=Symbol("Request internals"),ui=(e)=>typeof e==="object"&&typeof e[Bt]==="object",Vf=Kw(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Cs=class e extends gi{constructor(t,r={}){let n;if(ui(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(!ui(r)&&"data"in r)Vf();if((r.body!=null||ui(t)&&t.body!==null)&&(o==="GET"||o==="HEAD"))throw TypeError("Request with GET/HEAD method cannot have body");let i=r.body?r.body:ui(t)&&t.body!==null?al(t):null;super(i,{size:r.size||t.size||0});let s=new Pn(r.headers||t.headers||{});if(i!==null&&!s.has("Content-Type")){let c=pu(i,this);if(c)s.set("Content-Type",c)}let l=ui(t)?t.signal:null;if("signal"in r)l=r.signal;if(l!=null&&!Tg(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[Bt]={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[Bt].method}get url(){return Jw(this[Bt].parsedURL)}get headers(){return this[Bt].headers}get redirect(){return this[Bt].redirect}get signal(){return this[Bt].signal}get referrer(){if(this[Bt].referrer==="no-referrer")return"";if(this[Bt].referrer==="client")return"about:client";if(this[Bt].referrer)return this[Bt].referrer.toString();return}get referrerPolicy(){return this[Bt].referrerPolicy}set referrerPolicy(t){this[Bt].referrerPolicy=Vw(t)}clone(){return new e(this)}get[Symbol.toStringTag](){return"Request"}},Object.defineProperties(Cs.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}}),Ug=(e)=>{let{parsedURL:t}=e[Bt],r=new Pn(e[Bt].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=Mg(e);if(typeof l==="number"&&!Number.isNaN(l))n=String(l)}if(n)r.set("Content-Length",n);if(e.referrerPolicy==="")e.referrerPolicy=xg;if(e.referrer&&e.referrer!=="no-referrer")e[Bt].referrer=jw(e);else e[Bt].referrer="no-referrer";if(e[Bt].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=qg(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}}}}),vu,Yw=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/abort-error.js"(){du(),vu=class extends Ds{constructor(e,t="aborted"){super(e,t)}}}}),Fg={};Ms(Fg,{AbortError:()=>vu,Blob:()=>No,FetchError:()=>Nr,File:()=>$s,FormData:()=>yi,Headers:()=>Pn,Request:()=>Cs,Response:()=>on,blobFrom:()=>Ag,blobFromSync:()=>Rg,default:()=>Gg,fileFrom:()=>Ig,fileFromSync:()=>Pg,isRedirect:()=>ll});async function Gg(e,t){return new Promise((r,n)=>{let o=new Cs(e,t),{parsedURL:i,options:s}=Ug(o);if(!Bg.has(i.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${i.protocol.replace(/:$/,"")}" is not supported.`);if(i.protocol==="data:"){let p=Sg(o.url),_=new on(p,{headers:{"Content-Type":p.typeFull}});r(_);return}let l=(i.protocol==="https:"?Qw:Zw).request,{signal:a}=o,c=null,u=()=>{let p=new vu("The operation was aborted.");if(n(p),o.body&&o.body instanceof zf.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 Nr(`request to ${o.url} failed, reason: ${p.message}`,"system",p)),g()}),eC(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 _=Fw(p.rawHeaders);if(ll(p.statusCode)){let R=_.get("Location"),T=null;try{T=R===null?null:new URL(R,o.url)}catch{if(o.redirect!=="manual"){n(new Nr(`uri requested responds with an invalid redirect URL: ${R}`,"invalid-redirect")),g();return}}switch(o.redirect){case"error":n(new Nr(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),g();return;case"manual":break;case"follow":{if(T===null)break;if(o.counter>=o.follow){n(new Nr(`maximum redirect reached at: ${o.url}`,"max-redirect")),g();return}let w={headers:new Pn(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:al(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!wg(o.url,T)||!Cg(o.url,T))for(let A of["authorization","www-authenticate","cookie","cookie2"])w.headers.delete(A);if(p.statusCode!==303&&o.body&&t.body instanceof zf.Readable){n(new Nr("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")w.method="GET",w.body=void 0,w.headers.delete("content-length");let C=Ww(_);if(C)w.referrerPolicy=C;r(Gg(new Cs(T,w))),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=fi(p,new jf,(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 on(y,S),r(c);return}let b={flush:di.Z_SYNC_FLUSH,finishFlush:di.Z_SYNC_FLUSH};if(E==="gzip"||E==="x-gzip"){y=fi(y,di.createGunzip(b),(R)=>{if(R)n(R)}),c=new on(y,S),r(c);return}if(E==="deflate"||E==="x-deflate"){let R=fi(p,new jf,(T)=>{if(T)n(T)});R.once("data",(T)=>{if((T[0]&15)===8)y=fi(y,di.createInflate(),(w)=>{if(w)n(w)});else y=fi(y,di.createInflateRaw(),(w)=>{if(w)n(w)});c=new on(y,S),r(c)}),R.once("end",()=>{if(!c)c=new on(y,S),r(c)});return}if(E==="br"){y=fi(y,di.createBrotliDecompress(),(R)=>{if(R)n(R)}),c=new on(y,S),r(c);return}c=new on(y,S),r(c)}),$g(h,o).catch(n)})}function eC(e,t){let r=fa.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=fa.compare(c.slice(-5),r)===0,!o&&i)o=fa.compare(i.slice(-3),r.slice(0,3))===0&&fa.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 Bg,tC=Wt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/index.js"(){Aw(),hu(),Gw(),mu(),Xw(),bg(),Yw(),Dg(),uu(),fu(),Lg(),kg(),Bg=new Set(["data:","http:","https:"])}}),rC=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/gaxios.js"(e){var t=e&&e.__importDefault||function(h){return h&&h.__esModule?h:{default:h}},r;Object.defineProperty(e,"__esModule",{value:!0}),e.Gaxios=void 0;var n=t(mg()),o=Te("https"),i=gg(),s=gw(),l=Te("stream"),a=vg(),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(()=>wr(Cw()))).HttpsProxyAgent,this.#i}static async#l(){let h=typeof window<"u"&&!!window;return this.#s||=h?window.fetch:(await Promise.resolve().then(()=>(tC(),Fg))).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}}),tr=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(s,l,a,c){if(c===void 0)c=a;var u=Object.getOwnPropertyDescriptor(l,a);if(!u||("get"in u?!l.__esModule:u.writable||u.configurable))u={enumerable:!0,get:function(){return l[a]}};Object.defineProperty(s,c,u)}:function(s,l,a,c){if(c===void 0)c=a;s[c]=l[a]}),r=e&&e.__exportStar||function(s,l){for(var a in s)if(a!=="default"&&!Object.prototype.hasOwnProperty.call(l,a))t(l,s,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.instance=e.Gaxios=e.GaxiosError=void 0,e.request=i;var n=rC();Object.defineProperty(e,"Gaxios",{enumerable:!0,get:function(){return n.Gaxios}});var o=gg();Object.defineProperty(e,"GaxiosError",{enumerable:!0,get:function(){return o.GaxiosError}}),r(vg(),e),e.instance=new n.Gaxios;async function i(s){return e.instance.request(s)}}}),Hg=ye({"../node_modules/.bun/bignumber.js@9.3.1/node_modules/bignumber.js/bignumber.js"(e,t){(function(r){var n,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,{ceil:i,floor:s}=Math,l="[BigNumber Error] ",a=l+"Number primitive has more than 15 significant digits: ",c=100000000000000,u=14,f=9007199254740991,h=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],g=1e7,p=1e9;function _(C){var A,P,D,N=W.prototype={constructor:W,toString:null,valueOf:null},F=new W(1),G=20,B=4,Q=-7,pe=21,se=-1e7,ve=1e7,me=!1,j=1,ne=0,he={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},L="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function W(U,O){var q,H,J,Y,ee,Z,te,oe,x=this;if(!(x instanceof W))return new W(U,O);if(O==null){if(U&&U._isBigNumber===!0){if(x.s=U.s,!U.c||U.e>ve)x.c=x.e=null;else if(U.e<se)x.c=[x.e=0];else x.e=U.e,x.c=U.c.slice();return}if((Z=typeof U=="number")&&U*0==0){if(x.s=1/U<0?(U=-U,-1):1,U===~~U){for(Y=0,ee=U;ee>=10;ee/=10,Y++);if(Y>ve)x.c=x.e=null;else x.e=Y,x.c=[U];return}oe=String(U)}else{if(!o.test(oe=String(U)))return D(x,oe,Z);x.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,L.length,"Base"),O==10&&K)return x=new W(U),Ie(x,G+x.e+1,B);if(oe=String(U),Z=typeof U=="number"){if(U*0!=0)return D(x,oe,Z,O);if(x.s=1/U<0?(oe=oe.slice(1),-1):1,W.DEBUG&&oe.replace(/^0\.0*|\./,"").length>15)throw Error(a+U)}else x.s=oe.charCodeAt(0)===45?(oe=oe.slice(1),-1):1;q=L.slice(0,O),Y=ee=0;for(te=oe.length;ee<te;ee++)if(q.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(x,String(U),Z,O)}if(Z=!1,oe=P(oe,O,10,x.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+x.s*U);if((Y=Y-ee-1)>ve)x.c=x.e=null;else if(Y<se)x.c=[x.e=0];else{if(x.e=Y,x.c=[],ee=(Y+1)%u,Y<0)ee+=u;if(ee<te){if(ee)x.c.push(+oe.slice(0,ee));for(te-=u;ee<te;)x.c.push(+oe.slice(ee,ee+=u));ee=u-(oe=oe.slice(ee)).length}else ee-=te;for(;ee--;oe+="0");x.c.push(+oe)}}else x.c=[x.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,q;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(O="DECIMAL_PLACES"))q=U[O],b(q,0,p,O),G=q;if(U.hasOwnProperty(O="ROUNDING_MODE"))q=U[O],b(q,0,8,O),B=q;if(U.hasOwnProperty(O="EXPONENTIAL_AT"))if(q=U[O],q&&q.pop)b(q[0],-p,0,O),b(q[1],0,p,O),Q=q[0],pe=q[1];else b(q,-p,p,O),Q=-(pe=q<0?-q:q);if(U.hasOwnProperty(O="RANGE"))if(q=U[O],q&&q.pop)b(q[0],-p,-1,O),b(q[1],1,p,O),se=q[0],ve=q[1];else if(b(q,-p,p,O),q)se=-(ve=q<0?-q:q);else throw Error(l+O+" cannot be zero: "+q);if(U.hasOwnProperty(O="CRYPTO"))if(q=U[O],q===!!q)if(q)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))me=q;else throw me=!q,Error(l+"crypto unavailable");else me=q;else throw Error(l+O+" not true or false: "+q);if(U.hasOwnProperty(O="MODULO_MODE"))q=U[O],b(q,0,9,O),j=q;if(U.hasOwnProperty(O="POW_PRECISION"))q=U[O],b(q,0,p,O),ne=q;if(U.hasOwnProperty(O="FORMAT"))if(q=U[O],typeof q=="object")he=q;else throw Error(l+O+" not an object: "+q);if(U.hasOwnProperty(O="ALPHABET"))if(q=U[O],typeof q=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(q))K=q.slice(0,10)=="0123456789",L=q;else throw Error(l+O+" invalid: "+q)}else throw Error(l+"Object expected: "+U);return{DECIMAL_PLACES:G,ROUNDING_MODE:B,EXPONENTIAL_AT:[Q,pe],RANGE:[se,ve],CRYPTO:me,MODULO_MODE:j,POW_PRECISION:ne,FORMAT:he,ALPHABET:L}},W.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!W.DEBUG)return!0;var O,q,{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(q=H[O],q<0||q>=c||q!==s(q))break e;if(q!==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(q){var H,J,Y,ee,Z,te=0,oe=[],x=new W(F);if(q==null)q=G;else b(q,0,p);if(ee=i(q/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],q%=u,ee&&q)Z=h[u-q],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 x.e=Y,x.c=oe,x}}(),W.sum=function(){var U=1,O=arguments,q=new W(O[0]);for(;U<O.length;)q=q.plus(O[U++]);return q},P=function(){var U="0123456789";function O(q,H,J,Y){var ee,Z=[0],te,oe=0,x=q.length;for(;oe<x;){for(te=Z.length;te--;Z[te]*=H);Z[0]+=Y.indexOf(q.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(q,H,J,Y,ee){var Z,te,oe,x,z,ce,ue,ge,Ne=q.indexOf("."),et=G,He=B;if(Ne>=0)x=ne,ne=0,q=q.replace(".",""),ge=new W(H),ce=ge.pow(q.length-Ne),ne=x,ge.c=O(w(S(ce.c),ce.e,"0"),10,J,U),ge.e=ge.c.length;ue=O(q,H,J,ee?(Z=L,U):(Z=U,L)),oe=x=ue.length;for(;ue[--x]==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],x=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>x||Ne==x&&(He==4||z||He==6&&ue[te-1]&1||He==(ce.s<0?8:7)),te<1||!ue[0])q=z?w(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(x=ue.length;!ue[--x];);for(Ne=0,q="";Ne<=x;q+=Z.charAt(ue[Ne++]));q=w(q,oe,Z.charAt(0))}return q}}(),A=function(){function U(H,J,Y){var ee,Z,te,oe,x=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+x,x=(Z/Y|0)+(ee/g|0)+ue*oe,H[z]=Z%Y;if(x)H=[x].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 q(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,x,z,ce,ue,ge,Ne,et,He,Je,St,Jt,Kt,Dt,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(x=0;Qe[x]==(ze[x]||0);x++);if(Qe[x]>(ze[x]||0))oe--;if(Ue<0)et.push(1),z=!0;else{if(Kt=ze.length,It=Qe.length,x=0,Ue+=2,ce=s(Z/(Qe[0]+1)),ce>1)Qe=U(Qe,ce,Z),ze=U(ze,ce,Z),It=Qe.length,Kt=ze.length;Jt=It,He=ze.slice(0,It),Je=He.length;for(;Je<It;He[Je++]=0);if(at=Qe.slice(),at=[0].concat(at),Dt=Qe[0],Qe[1]>=Z/2)Dt++;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/Dt),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--,q(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(q(He,ue,Je,Z),Je=He.length,te==-1)while(O(Qe,He,It,Je)<1)ce++,q(He,It<Je?at:Qe,Je,Z),Je=He.length}else if(te===0)ce++,He=[0];if(et[x++]=ce,He[0])He[Je++]=ze[Jt]||0;else He=[ze[Jt]],Je=1}while((Jt++<Kt||He[0]!=null)&&Ue--);if(z=He[0]!=null,!et[0])et.splice(0,1)}if(Z==c){for(x=1,Ue=et[0];Ue>=10;Ue/=10,x++);Ie(Ne,Y+(Ne.e=x+oe*u-1)+1,ee,z)}else Ne.e=oe,Ne.r=+z;return Ne}}();function be(U,O,q,H){var J,Y,ee,Z,te;if(q==null)q=B;else b(q,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)?T(te,ee):w(te,ee,"0");else if(U=Ie(new W(U),O,q),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=T(te,Y)}else if(O-=ee+(H===2&&Y>ee),te=w(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 q,H,J=1,Y=new W(U[0]);for(;J<U.length;J++)if(H=new W(U[J]),!H.s||(q=E(Y,H))===O||q===0&&Y.s===O)Y=H;return Y}function Ve(U,O,q){var H=1,J=O.length;for(;!O[--J];O.pop());for(J=O[0];J>=10;J/=10,H++);if((q=H+q*u-1)>ve)U.c=U.e=null;else if(q<se)U.c=[U.e=0];else U.e=q,U.c=O;return U}D=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,O=/^([^.]+)\.$/,q=/^\.([^.]+)$/,H=/^-?(Infinity|NaN)$/,J=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(Y,ee,Z,te){var oe,x=Z?ee:ee.replace(J,"");if(H.test(x))Y.s=isNaN(x)?null:x<0?-1:1;else{if(!Z){if(x=x.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,x=x.replace(O,"$1").replace(q,"0.$1");if(ee!=x)return new W(x,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,q,H){var J,Y,ee,Z,te,oe,x,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],x=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=x=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,x=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=q<4?(x||H)&&(q==0||q==(U.s<0?3:2)):x>5||x==5&&(q==4||H||q==6&&(Y>0?ee>0?te/ce[J-ee]:0:z[oe-1])%10&1||q==(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<se)U.c=[U.e=0]}return U}function je(U){var O,q=U.e;if(q===null)return U.toString();return O=S(U.c),O=q<=Q||q>=pe?T(O,q):w(O,q,"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 q,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(!(q=Y.c))return null;if(H=((J=q.length-1)-y(this.e/u))*u,J=q[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 q,H,J,Y,ee,Z,te,oe,x,z=this;if(U=new W(U),U.c&&!U.isInteger())throw Error(l+"Exponent not an integer: "+je(U));if(O!=null)O=new W(O);if(Z=U.e>14,!z.c||!z.c[0]||z.c[0]==1&&!z.e&&z.c.length==1||!U.c||!U.c[0])return x=new W(Math.pow(+je(z),Z?U.s*(2-R(U)):+je(U))),O?x.mod(O):x;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(q=new W(0.5),te)U.s=1;oe=R(U)}else J=Math.abs(+je(U)),oe=J%2;x=new W(F);for(;;){if(oe){if(x=x.times(z),!x.c)break;if(Y){if(x.c.length>Y)x.c.length=Y}else if(H)x=x.mod(O)}if(J){if(J=s(J/2),J===0)break;oe=J%2}else if(U=U.times(q),Ie(U,U.e+1,1),U.e>14)oe=R(U);else{if(J=+je(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 x;if(te)x=F.div(x);return O?x.mod(O):Y?Ie(x,ne,B,ee):x},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 q,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,x=ee.c,z=U.c;if(!te||!oe){if(!x||!z)return x?(U.s=-O,U):new W(z?ee:NaN);if(!x[0]||!z[0])return z[0]?(U.s=-O,U):new W(x[0]?ee:B==3?-0:0)}if(te=y(te),oe=y(oe),x=x.slice(),Z=te-oe){if(Y=Z<0)Z=-Z,J=x;else oe=te,J=z;J.reverse();for(O=Z;O--;J.push(0));J.reverse()}else{H=(Y=(Z=x.length)<(O=z.length))?Z:O;for(Z=O=0;O<H;O++)if(x[O]!=z[O]){Y=x[O]<z[O];break}}if(Y)J=x,x=z,z=J,U.s=-U.s;if(O=(H=z.length)-(q=x.length),O>0)for(;O--;x[q++]=0);O=c-1;for(;H>Z;){if(x[--H]<z[H]){for(q=H;q&&!x[--q];x[q]=O);--x[q],x[H]+=c}x[H]-=z[H]}for(;x[0]==0;x.splice(0,1),--oe);if(!x[0])return U.s=B==3?-1:1,U.c=[U.e=0],U;return Ve(U,x,oe)},N.modulo=N.mod=function(U,O){var q,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,q=A(J,U,0,3),U.s=H,q.s*=H;else q=A(J,U,0,j);if(U=J.minus(q.times(U)),!U.c[0]&&j==1)U.s=J.s;return U},N.multipliedBy=N.times=function(U,O){var q,H,J,Y,ee,Z,te,oe,x,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;){q=0,ce=St[J]%et,ue=St[J]/et|0;for(ee=te,Y=J+ee;Y>J;)oe=Je[--ee]%et,x=Je[ee]/et|0,Z=ue*oe+x*ce,oe=ce*oe+Z%et*et+ge[Y]+q,q=(oe/Ne|0)+(Z/et|0)+ue*x,ge[Y--]=oe%Ne;ge[Y]=q}if(q)++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 q,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,q=te;else J=-J,q=Z;q.reverse();for(;J--;q.push(0));q.reverse()}if(J=Z.length,O=te.length,J-O<0)q=te,te=Z,Z=q,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 q,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(!(q=Y.c))return null;if(J=q.length-1,H=J*u+1,J=q[J]){for(;J%10==0;J/=10,H--);for(J=q[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,q,H,J,Y=this,{c:ee,s:Z,e:te}=Y,oe=G+4,x=new W("0.5");if(Z!==1||!ee||!ee[0])return new W(!Z||Z<0&&(!ee||ee[0])?NaN:ee?Y:1/0);if(Z=Math.sqrt(+je(Y)),Z==0||Z==1/0){if(O=S(ee),(O.length+te)%2==0)O+="0";if(Z=Math.sqrt(+O),te=y((te+1)/2)-(te<0||te%2),Z==1/0)O="5e"+te;else O=Z.toExponential(),O=O.slice(0,O.indexOf("e")+1)+te;q=new W(O)}else q=new W(Z+"");if(q.c[0]){if(te=q.e,Z=te+oe,Z<3)Z=0;for(;;)if(J=q,q=x.times(J.plus(A(Y,J,oe,1))),S(J.c).slice(0,Z)===(O=S(q.c)).slice(0,Z)){if(q.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)){q=J;break}}oe+=4,Z+=4,H=1}else{if(!+O||!+O.slice(1)&&O.charAt(0)=="5")Ie(q,q.e+G+2,1),U=!q.times(q).eq(Y);break}}}return Ie(q,q.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,q){var H,J=this;if(q==null)if(U!=null&&O&&typeof O=="object")q=O,O=null;else if(U&&typeof U=="object")q=U,U=O=null;else q=he;else if(typeof q!="object")throw Error(l+"Argument not an object: "+q);if(H=J.toFixed(U,O),J.c){var Y,ee=H.split("."),Z=+q.groupSize,te=+q.secondaryGroupSize,oe=q.groupSeparator||"",x=ee[0],z=ee[1],ce=J.s<0,ue=ce?x.slice(1):x,ge=ue.length;if(te)Y=Z,Z=te,te=Y,ge-=Y;if(Z>0&&ge>0){Y=ge%Z||Z,x=ue.substr(0,Y);for(;Y<ge;Y+=Z)x+=oe+ue.substr(Y,Z);if(te>0)x+=oe+ue.slice(Y);if(ce)x="-"+x}H=z?x+(q.decimalSeparator||"")+((te=+q.fractionGroupSize)?z.replace(new RegExp("\\d{"+te+"}\\B","g"),"$&"+(q.fractionGroupSeparator||"")):z):x}return(q.prefix||"")+H+(q.suffix||"")},N.toFraction=function(U){var O,q,H,J,Y,ee,Z,te,oe,x,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: ")+je(Z))}if(!ge)return new W(ue);O=new W(F),oe=q=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(x=A(Z,O,0,1),J=q.plus(x.times(H)),J.comparedTo(U)==1)break;q=H,H=J,oe=te.plus(x.times(J=oe)),te=J,O=Z.minus(x.times(J=O)),Z=J}return J=A(U.minus(q),H,0,1),te=te.plus(J.times(oe)),q=q.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,q,Y,B).minus(ue).abs())<1?[oe,H]:[te,q],ve=ee,z},N.toNumber=function(){return+je(this)},N.toPrecision=function(U,O){if(U!=null)b(U,1,p);return be(this,U,O,2)},N.toString=function(U){var O,q=this,H=q.s,J=q.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?T(S(q.c),J):w(S(q.c),J,"0");else if(U===10&&K)q=Ie(new W(q),G+J+1,B),O=w(S(q.c),q.e,"0");else b(U,2,L.length,"Base"),O=P(w(S(q.c),J,"0"),10,U,H,!0);if(H<0&&q.c[0])O="-"+O}return O},N.valueOf=N.toJSON=function(){return je(this)},N._isBigNumber=!0,C!=null)W.set(C);return W}function y(C){var A=C|0;return C>0||C===A?A:A-1}function S(C){var A,P,D=1,N=C.length,F=C[0]+"";for(;D<N;){A=C[D++]+"",P=u-A.length;for(;P--;A="0"+A);F+=A}for(N=F.length;F.charCodeAt(--N)===48;);return F.slice(0,N+1||1)}function E(C,A){var P,D,N=C.c,F=A.c,G=C.s,B=A.s,Q=C.e,pe=A.e;if(!G||!B)return null;if(P=N&&!N[0],D=F&&!F[0],P||D)return P?D?0:-B:G;if(G!=B)return G;if(P=G<0,D=Q==pe,!N||!F)return D?0:!N^P?1:-1;if(!D)return Q>pe^P?1:-1;B=(Q=N.length)<(pe=F.length)?Q:pe;for(G=0;G<B;G++)if(N[G]!=F[G])return N[G]>F[G]^P?1:-1;return Q==pe?0:Q>pe^P?1:-1}function b(C,A,P,D){if(C<A||C>P||C!==s(C))throw Error(l+(D||"Argument")+(typeof C=="number"?C<A||C>P?" out of range: ":" not an integer: ":" not a primitive number: ")+String(C))}function R(C){var A=C.c.length-1;return y(C.e/u)==A&&C.c[A]%2!=0}function T(C,A){return(C.length>1?C.charAt(0)+"."+C.slice(1):C)+(A<0?"e":"e+")+A}function w(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)}}),nC=ye({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/lib/stringify.js"(e,t){var r=Hg(),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,T=p[g],w=T!=null&&(T instanceof r||r.isBigNumber(T));if(T&&typeof T==="object"&&typeof T.toJSON==="function")T=T.toJSON(g);if(typeof u==="function")T=u.call(p,g,T);switch(typeof T){case"string":if(w)return T;else return f(T);case"number":return isFinite(T)?String(T):"null";case"boolean":case"null":case"bigint":return String(T);case"object":if(!T)return"null";if(l+=a,R=[],Object.prototype.toString.apply(T)==="[object Array]"){E=T.length;for(_=0;_<E;_+=1)R[_]=h(_,T)||"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,T),S)R.push(f(y)+(l?": ":":")+S)}}else Object.keys(T).forEach(function(C){var A=h(C,T);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})}})()}}),oC=ye({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/lib/parse.js"(e,t){var r=null,n=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,o=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,i=function(s){var l={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(s!==void 0&&s!==null){if(s.strict===!0)l.strict=!0;if(s.storeAsString===!0)l.storeAsString=!0;if(l.alwaysParseAsBig=s.alwaysParseAsBig===!0?s.alwaysParseAsBig:!1,l.useNativeBigInt=s.useNativeBigInt===!0?s.useNativeBigInt:!1,typeof s.constructorAction<"u")if(s.constructorAction==="error"||s.constructorAction==="ignore"||s.constructorAction==="preserve")l.constructorAction=s.constructorAction;else throw Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${s.constructorAction}`);if(typeof s.protoAction<"u")if(s.protoAction==="error"||s.protoAction==="ignore"||s.protoAction==="preserve")l.protoAction=s.protoAction;else throw Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${s.protoAction}`)}var a,c,u={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
37
|
+
`,r:"\r",t:"\t"},f,h=function(T){throw{name:"SyntaxError",message:T,at:a,text:f}},g=function(T){if(T&&T!==c)h("Expected '"+T+"' instead of '"+c+"'");return c=f.charAt(a),a+=1,c},p=function(){var T,w="";if(c==="-")w="-",g("-");while(c>="0"&&c<="9")w+=c,g();if(c==="."){w+=".";while(g()&&c>="0"&&c<="9")w+=c}if(c==="e"||c==="E"){if(w+=c,g(),c==="-"||c==="+")w+=c,g();while(c>="0"&&c<="9")w+=c,g()}if(T=+w,!isFinite(T))h("Bad number");else{if(r==null)r=Hg();if(w.length>15)return l.storeAsString?w:l.useNativeBigInt?BigInt(w):new r(w);else return!l.alwaysParseAsBig?T:l.useNativeBigInt?BigInt(T):new r(T)}},_=function(){var T,w,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(w=0;w<4;w+=1){if(T=parseInt(g(),16),!isFinite(T))break;A=A*16+T}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 T=[];if(c==="["){if(g("["),y(),c==="]")return g("]"),T;while(c){if(T.push(E()),y(),c==="]")return g("]"),T;g(","),y()}}h("Bad array")},R=function(){var T,w=Object.create(null);if(c==="{"){if(g("{"),y(),c==="}")return g("}"),w;while(c){if(T=_(),y(),g(":"),l.strict===!0&&Object.hasOwnProperty.call(w,T))h('Duplicate key "'+T+'"');if(n.test(T)===!0)if(l.protoAction==="error")h("Object contains forbidden prototype property");else if(l.protoAction==="ignore")E();else w[T]=E();else if(o.test(T)===!0)if(l.constructorAction==="error")h("Object contains forbidden constructor property");else if(l.constructorAction==="ignore")E();else w[T]=E();else w[T]=E();if(y(),c==="}")return g("}"),w;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(T,w){var C;if(f=T+"",a=0,c=" ",C=E(),y(),c)h("Syntax error");return typeof w==="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 w.call(P,D,G)}({"":C},""):C}};t.exports=i}}),iC=ye({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/index.js"(e,t){var r=nC().stringify,n=oC();t.exports=function(o){return{parse:n(o),stringify:r}},t.exports.parse=n(),t.exports.stringify=r}}),Wf=ye({"../node_modules/.bun/gcp-metadata@8.1.2+759ce506b1ed1a42/node_modules/gcp-metadata/build/src/gcp-residency.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GCE_LINUX_BIOS_PATHS=void 0,e.isGoogleCloudServerless=o,e.isGoogleComputeEngineLinux=i,e.isGoogleComputeEngineMACAddress=s,e.isGoogleComputeEngine=l,e.detectGCPResidency=a;var t=Te("fs"),r=Te("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()}}}),sC=ye({"../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/colours.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Colours=void 0;var t=class r{static isEnabled(n){return n&&n.isTTY&&(typeof n.getColorDepth==="function"?n.getColorDepth()>2:!0)}static refresh(){if(r.enabled=r.isEnabled(process===null||process===void 0?void 0:process.stderr),!this.enabled)r.reset="",r.bright="",r.dim="",r.red="",r.green="",r.yellow="",r.blue="",r.magenta="",r.cyan="",r.white="",r.grey="";else r.reset="\x1B[0m",r.bright="\x1B[1m",r.dim="\x1B[2m",r.red="\x1B[31m",r.green="\x1B[32m",r.yellow="\x1B[33m",r.blue="\x1B[34m",r.magenta="\x1B[35m",r.cyan="\x1B[36m",r.white="\x1B[37m",r.grey="\x1B[90m"}};e.Colours=t,t.enabled=!1,t.reset="",t.bright="",t.dim="",t.red="",t.green="",t.yellow="",t.blue="",t.magenta="",t.cyan="",t.white="",t.grey="",t.refresh()}}),aC=ye({"../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/logging-utils.js"(e){var t=e&&e.__createBinding||(Object.create?function(T,w,C,A){if(A===void 0)A=C;var P=Object.getOwnPropertyDescriptor(w,C);if(!P||("get"in P?!w.__esModule:P.writable||P.configurable))P={enumerable:!0,get:function(){return w[C]}};Object.defineProperty(T,A,P)}:function(T,w,C,A){if(A===void 0)A=C;T[A]=w[C]}),r=e&&e.__setModuleDefault||(Object.create?function(T,w){Object.defineProperty(T,"default",{enumerable:!0,value:w})}:function(T,w){T.default=w}),n=e&&e.__importStar||function(){var T=function(w){return T=Object.getOwnPropertyNames||function(C){var A=[];for(var P in C)if(Object.prototype.hasOwnProperty.call(C,P))A[A.length]=P;return A},T(w)};return function(w){if(w&&w.__esModule)return w;var C={};if(w!=null){for(var A=T(w),P=0;P<A.length;P++)if(A[P]!=="default")t(C,w,A[P])}return r(C,w),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=Te("events"),i=n(Te("process")),s=n(Te("util")),l=sC(),a;(function(T){T.DEFAULT="DEFAULT",T.DEBUG="DEBUG",T.INFO="INFO",T.WARNING="WARNING",T.ERROR="ERROR"})(a||(e.LogSeverity=a={}));var c=class extends o.EventEmitter{constructor(T,w){super();this.namespace=T,this.upstream=w,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(T,...w){if(this.upstream)try{this.upstream(T,...w)}catch(C){}try{this.emit("log",T,w)}catch(C){}}invokeSeverity(T,...w){this.invoke({severity:T},...w)}};e.AdhocDebugLogger=c,e.placeholder=new c("",()=>{}).func;var u=class{constructor(){var T;this.cached=new Map,this.filters=[],this.filtersSet=!1;let w=(T=i.env[e.env.nodeEnables])!==null&&T!==void 0?T:"*";if(w==="all")w="*";this.filters=w.split(",")}log(T,w,...C){try{if(!this.filtersSet)this.setFilters(),this.filtersSet=!0;let A=this.cached.get(T);if(!A)A=this.makeLogger(T),this.cached.set(T,A);A(w,...C)}catch(A){console.error(A)}}};e.DebugLogBackendBase=u;var f=class extends u{constructor(){super(...arguments);this.enabledRegexp=/.*/g}isEnabled(T){return this.enabledRegexp.test(T)}makeLogger(T){if(!this.enabledRegexp.test(T))return()=>{};return(w,...C)=>{var A;let P=`${l.Colours.green}${T}${l.Colours.reset}`,D=`${l.Colours.yellow}${i.pid}${l.Colours.reset}`,N;switch(w.severity){case a.ERROR:N=`${l.Colours.red}${w.severity}${l.Colours.reset}`;break;case a.INFO:N=`${l.Colours.magenta}${w.severity}${l.Colours.reset}`;break;case a.WARNING:N=`${l.Colours.yellow}${w.severity}${l.Colours.reset}`;break;default:N=(A=w.severity)!==null&&A!==void 0?A:a.DEFAULT;break}let F=s.formatWithOptions({colors:l.Colours.enabled},...C),G=Object.assign({},w);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 w=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${w}$`,"i")}};function h(){return new f}var g=class extends u{constructor(T){super();this.debugPkg=T}makeLogger(T){let w=this.debugPkg(T);return(C,...A)=>{w(A[0],...A.slice(1))}}setFilters(){var T;let w=(T=i.env.NODE_DEBUG)!==null&&T!==void 0?T:"";i.env.NODE_DEBUG=`${w}${w?",":""}${this.filters.join(",")}`}};function p(T){return new g(T)}var _=class extends u{constructor(T){var w;super();this.upstream=(w=T)!==null&&w!==void 0?w:void 0}makeLogger(T){var w;let C=(w=this.upstream)===null||w===void 0?void 0:w.makeLogger(T);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 T;(T=this.upstream)===null||T===void 0||T.setFilters()}};function y(T){return new _(T)}e.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var S=new Map,E=void 0;function b(T){E=T,S.clear()}function R(T,w){if(!E){if(!i.env[e.env.nodeEnables])return e.placeholder}if(!T)return e.placeholder;if(w)T=`${w.instance.namespace}:${T}`;let C=S.get(T);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(T,(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(T,N,...F)})})();return S.set(T,A),A.func}}}),Vg=ye({"../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(n,o,i,s){if(s===void 0)s=i;var l=Object.getOwnPropertyDescriptor(o,i);if(!l||("get"in l?!o.__esModule:l.writable||l.configurable))l={enumerable:!0,get:function(){return o[i]}};Object.defineProperty(n,s,l)}:function(n,o,i,s){if(s===void 0)s=i;n[s]=o[i]}),r=e&&e.__exportStar||function(n,o){for(var i in n)if(i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i))t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(aC(),e)}}),cl=ye({"../node_modules/.bun/gcp-metadata@8.1.2+759ce506b1ed1a42/node_modules/gcp-metadata/build/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(P,D,N,F){if(F===void 0)F=N;var G=Object.getOwnPropertyDescriptor(D,N);if(!G||("get"in G?!D.__esModule:G.writable||G.configurable))G={enumerable:!0,get:function(){return D[N]}};Object.defineProperty(P,F,G)}:function(P,D,N,F){if(F===void 0)F=N;P[F]=D[N]}),r=e&&e.__setModuleDefault||(Object.create?function(P,D){Object.defineProperty(P,"default",{enumerable:!0,value:D})}:function(P,D){P.default=D}),n=e&&e.__importStar||function(){var P=function(D){return P=Object.getOwnPropertyNames||function(N){var F=[];for(var G in N)if(Object.prototype.hasOwnProperty.call(N,G))F[F.length]=G;return F},P(D)};return function(D){if(D&&D.__esModule)return D;var N={};if(D!=null){for(var F=P(D),G=0;G<F.length;G++)if(F[G]!=="default")t(N,D,F[G])}return r(N,D),N}}(),o=e&&e.__exportStar||function(P,D){for(var N in P)if(N!=="default"&&!Object.prototype.hasOwnProperty.call(D,N))t(D,P,N)};Object.defineProperty(e,"__esModule",{value:!0}),e.gcpResidencyCache=e.METADATA_SERVER_DETECTION=e.HEADERS=e.HEADER_VALUE=e.HEADER_NAME=e.SECONDARY_HOST_ADDRESS=e.HOST_ADDRESS=e.BASE_PATH=void 0,e.instance=p,e.project=_,e.universe=y,e.bulk=S,e.isAvailable=R,e.resetIsAvailableCache=T,e.getGCPResidency=w,e.setGCPResidency=C,e.requestTimeout=A;var i=tr(),s=iC(),l=Wf(),a=n(Vg());e.BASE_PATH="/computeMetadata/v1",e.HOST_ADDRESS="http://169.254.169.254",e.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.",e.HEADER_NAME="Metadata-Flavor",e.HEADER_VALUE="Google",e.HEADERS=Object.freeze({[e.HEADER_NAME]:e.HEADER_VALUE});var c=a.log("gcp-metadata");e.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function u(P){if(!P)P=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||e.HOST_ADDRESS;if(!/^https?:\/\//.test(P))P=`http://${P}`;return new URL(e.BASE_PATH,P).href}function f(P){Object.keys(P).forEach((D)=>{switch(D){case"params":case"property":case"headers":break;case"qs":throw Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw Error(`'${D}' is not a valid configuration option.`)}})}async function h(P,D={},N=3,F=!1){let G=new Headers(e.HEADERS),B="",Q={};if(typeof P==="object"){let j=P;new Headers(j.headers).forEach((ne,he)=>G.set(he,ne)),B=j.metadataKey,Q=j.params||Q,N=j.noResponseRetries||N,F=j.fastFail||F}else B=P;if(typeof D==="string")B+=`/${D}`;else{if(f(D),D.property)B+=`/${D.property}`;new Headers(D.headers).forEach((j,ne)=>G.set(ne,j)),Q=D.params||Q}let pe=F?g:i.request,se={url:`${u()}/${B}`,headers:G,retryConfig:{noResponseRetries:N},params:Q,responseType:"text",timeout:A()};c.info("instance request %j",se);let ve=await pe(se);c.info("instance metadata is %s",ve.data);let me=ve.headers.get(e.HEADER_NAME);if(me!==e.HEADER_VALUE)throw RangeError(`Invalid response from metadata service: incorrect ${e.HEADER_NAME} header. Expected '${e.HEADER_VALUE}', got ${me?`'${me}'`:"no header"}`);if(typeof ve.data==="string")try{return s.parse(ve.data)}catch{}return ve.data}async function g(P){let D={...P,url:P.url?.toString().replace(u(),u(e.SECONDARY_HOST_ADDRESS))},N=(0,i.request)(P),F=(0,i.request)(D);return Promise.any([N,F])}function p(P){return h("instance",P)}function _(P){return h("project",P)}function y(P){return h("universe",P)}async function S(P){let D={};return await Promise.all(P.map((N)=>(async()=>{let F=await h(N),G=N.metadataKey;D[G]=F})())),D}function E(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}var b;async function R(){if(process.env.METADATA_SERVER_DETECTION){let P=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(P in e.METADATA_SERVER_DETECTION))throw RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${P}\`, but it should be \`${Object.keys(e.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(P){case"assume-present":return!0;case"none":return!1;case"bios-only":return w();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 T(){b=void 0}e.gcpResidencyCache=null;function w(){if(e.gcpResidencyCache===null)C();return e.gcpResidencyCache}function C(P=null){e.gcpResidencyCache=P!==null?P:(0,l.detectGCPResidency)()}function A(){return w()?0:3000}o(Wf(),e)}}),lC=ye({"../node_modules/.bun/base64-js@1.5.1/node_modules/base64-js/index.js"(e){e.byteLength=a,e.toByteArray=u,e.fromByteArray=g;var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(i=0,s=o.length;i<s;++i)t[i]=o[i],r[o.charCodeAt(i)]=i;var i,s;r[45]=62,r[95]=63;function l(p){var _=p.length;if(_%4>0)throw Error("Invalid string. Length must be a multiple of 4");var y=p.indexOf("=");if(y===-1)y=_;var S=y===_?0:4-y%4;return[y,S]}function a(p){var _=l(p),y=_[0],S=_[1];return(y+S)*3/4-S}function c(p,_,y){return(_+y)*3/4-y}function u(p){var _,y=l(p),S=y[0],E=y[1],b=new n(c(p,S,E)),R=0,T=E>0?S-4:S,w;for(w=0;w<T;w+=4)_=r[p.charCodeAt(w)]<<18|r[p.charCodeAt(w+1)]<<12|r[p.charCodeAt(w+2)]<<6|r[p.charCodeAt(w+3)],b[R++]=_>>16&255,b[R++]=_>>8&255,b[R++]=_&255;if(E===2)_=r[p.charCodeAt(w)]<<2|r[p.charCodeAt(w+1)]>>4,b[R++]=_&255;if(E===1)_=r[p.charCodeAt(w)]<<10|r[p.charCodeAt(w+1)]<<4|r[p.charCodeAt(w+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,T=y-S;R<T;R+=b)E.push(h(p,R,R+b>T?T: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("")}}}),zg=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/shared.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fromArrayBufferToHex=t;function t(r){return Array.from(new Uint8Array(r)).map((o)=>o.toString(16).padStart(2,"0")).join("")}}}),cC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/browser/crypto.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserCrypto=void 0;var t=lC(),r=zg(),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}}),uC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/node/crypto.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NodeCrypto=void 0;var t=Te("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)}}}),ul=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/crypto.js"(e){var t=e&&e.__createBinding||(Object.create?function(l,a,c,u){if(u===void 0)u=c;var f=Object.getOwnPropertyDescriptor(a,c);if(!f||("get"in f?!a.__esModule:f.writable||f.configurable))f={enumerable:!0,get:function(){return a[c]}};Object.defineProperty(l,u,f)}:function(l,a,c,u){if(u===void 0)u=c;l[u]=a[c]}),r=e&&e.__exportStar||function(l,a){for(var c in l)if(c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c))t(a,l,c)};Object.defineProperty(e,"__esModule",{value:!0}),e.createCrypto=i,e.hasBrowserCrypto=s;var n=cC(),o=uC();r(zg(),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"}}}),qs=ye({"../node_modules/.bun/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(e,t){var r=Te("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)}}}),dC=ye({"../node_modules/.bun/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js"(e,t){function r(i){var s=(i/8|0)+(i%8===0?0:1);return s}var n={ES256:r(256),ES384:r(384),ES512:r(521)};function o(i){var s=n[i];if(s)return s;throw Error('Unknown algorithm "'+i+'"')}t.exports=o}}),jg=ye({"../node_modules/.bun/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js"(e,t){var r=qs().Buffer,n=dC(),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,T=0;if(y[T++]!==c)throw Error('Could not find expected "seq"');var w=y[T++];if(w===(o|1))w=y[T++];if(R-T<w)throw Error('"seq" specified length of "'+w+'", only "'+(R-T)+'" remaining');if(y[T++]!==u)throw Error('Could not find expected "int" for "r"');var C=y[T++];if(R-T-2<C)throw Error('"r" specified length of "'+C+'", only "'+(R-T-2)+'" available');if(b<C)throw Error('"r" specified length of "'+C+'", max of "'+b+'" is acceptable');var A=T;if(T+=C,y[T++]!==u)throw Error('Could not find expected "int" for "s"');var P=y[T++];if(R-T!==P)throw Error('"s" specified length of "'+P+'", expected "'+(R-T)+'"');if(b<P)throw Error('"s" specified length of "'+P+'", max of "'+b+'" is acceptable');var D=T;if(T+=P,T!==R)throw Error('Expected to consume entire buffer, but "'+(R-T)+'" bytes remain');var N=E-C,F=E-P,G=r.allocUnsafe(N+C+F+P);for(T=0;T<N;++T)G[T]=0;y.copy(G,T,A+Math.max(-N,0),A+C),T=E;for(var B=T;T<B+F;++T)G[T]=0;return y.copy(G,T,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),T=p(y,E,y.length),w=E-R,C=E-T,A=2+w+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++]=w,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,T<0)D[N++]=0,y.copy(D,N,E);else y.copy(D,N,E+T);return D}t.exports={derToJose:g,joseToDer:_}}}),ln=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/util.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0,e.snakeToCamel=s,e.originalOrCamelOptions=l,e.removeUndefinedValuesInObject=c,e.isValidFile=u,e.getWellKnownCertificateConfigFileLocation=f;var t=Te("fs"),r=Te("os"),n=Te("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")}}}),fC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/package.json"(e,t){t.exports={name:"google-auth-library",version:"10.9.1",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:{type:"git",directory:"core/packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0",c8:"^10.1.3",codecov:"^3.8.3",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1",puppeteer:"^24.0.0",sinon:"21.0.3","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}}}),Wg=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/shared.cjs"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.USER_AGENT=e.PRODUCT_NAME=e.pkg=void 0;var t=fC();e.pkg=t;var r="google-api-nodejs-client";e.PRODUCT_NAME=r;var n=`${r}/${t.version}`;e.USER_AGENT=n}}),Or=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/authclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AuthClient=e.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=e.DEFAULT_UNIVERSE=void 0;var t=Te("events"),r=tr(),n=ln(),o=Vg(),i=Wg();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}}),Jg=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/loginticket.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LoginTicket=void 0;var t=class{envelope;payload;constructor(r,n){this.envelope=r,this.payload=n}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let r=this.getPayload();if(r&&r.sub)return r.sub;return null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}};e.LoginTicket=t}}),Uo=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/oauth2client.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OAuth2Client=e.ClientAuthentication=e.CertificateFormat=e.CodeChallengeMethod=void 0;var t=tr(),r=Te("querystring"),n=Te("stream"),o=jg(),i=ln(),s=ul(),l=Or(),a=Jg(),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 T=Buffer.from(`${this._clientId}:${this._clientSecret}`);y.set("authorization",`Basic ${T.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 T=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(T)}}}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 T=R;if(T.response&&(T.response.status===403||T.response.status===404))T.message=`Could not refresh access token: ${T.message}`;throw T}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,T=S.config.data instanceof n.Readable,w=E===401||E===403;if(!_&&w&&!T&&b)return await this.refreshAccessTokenAsync(),this.requestAsync(p,!0);else if(!_&&w&&!T&&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 w={...g.RETRY_CONFIG,url:S};l.AuthClient.setMethodName(w,"getFederatedSignonCertsAsync"),y=await this.transporter.request(w)}catch(w){if(w instanceof Error)w.message=`Failed to retrieve verification certificates: ${w.message}`;throw w}let E=y?.headers.get("cache-control"),b=-1;if(E){let w=/max-age=(?<maxAge>[0-9]+)/.exec(E)?.groups?.maxAge;if(w)b=Number(w)*1000}let R={};switch(_){case u.PEM:R=y.data;break;case u.JWK:for(let w of y.data.keys)R[w.kid]=w;break;default:throw Error(`Unsupported certificate format ${_}`)}let T=new Date;return this.certificateExpiry=b===-1?null:new Date(T.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 T=R[0]+"."+R[1],w=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")w=o.joseToDer(w,"ES256").toString("base64");if(!await b.verify(P,T,w))throw Error("Invalid token signature: "+p);if(!A.iat)throw Error("No issue time in token: "+JSON.stringify(A));if(!A.exp)throw Error("No expiration time in token: "+JSON.stringify(A));let N=Number(A.iat);if(isNaN(N))throw Error("iat field using invalid format");let F=Number(A.exp);if(isNaN(F))throw Error("exp field using invalid format");let G=new Date().getTime()/1000;if(F>=G+E)throw Error("Expiration time too far in future: "+JSON.stringify(A));let B=N-g.CLOCK_SKEW_SECS_,Q=F+g.CLOCK_SKEW_SECS_;if(G<B)throw Error("Token used too early, "+G+" < "+B+": "+JSON.stringify(A));if(G>Q)throw Error("Token used too late, "+G+" > "+Q+": "+JSON.stringify(A));if(S&&S.indexOf(A.iss)<0)throw Error("Invalid issuer, expected one of ["+S+"], but got "+A.iss);if(typeof y<"u"&&y!==null){let pe=A.aud,se=!1;if(y.constructor===Array)se=y.indexOf(pe)>-1;else se=pe===y;if(!se)throw Error("Wrong recipient, payload audience != requiredAudience")}return new a.LoginTicket(C,A)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let p=await this.refreshHandler();if(!p.access_token)throw Error("No access token is returned by the refreshHandler callback.");return p}return}isTokenExpiring(){let p=this.credentials.expiry_date;return p?p<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};e.OAuth2Client=h}}),Kg=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/computeclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Compute=void 0;var t=tr(),r=cl(),n=Uo(),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}}),Xg=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/idtokenclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdTokenClient=void 0;var t=Uo(),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}}),Yg=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/envDetect.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GCPEnv=void 0,e.clear=o,e.getEnv=i;var t=cl(),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()}}}),Zg=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/data-stream.js"(e,t){var r=qs().Buffer,n=Te("stream"),o=Te("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}}),pC=ye({"../node_modules/.bun/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js"(e,t){var r=Te("buffer").Buffer,n=Te("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}}}),Qg=ye({"../node_modules/.bun/jwa@2.0.1/node_modules/jwa/index.js"(e,t){var r=qs().Buffer,n=Te("crypto"),o=jg(),i=Te("util"),s=`"%s" is not a valid algorithm.
|
|
38
|
+
Supported algorithms are:
|
|
39
|
+
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,l="secret must be a string or buffer",a="key must be a string or a buffer",c="key must be a string, a buffer or an object",u=typeof n.createPublicKey==="function";if(u)a+=" or a KeyObject",l+="or a KeyObject";function f(Q){if(r.isBuffer(Q))return;if(typeof Q==="string")return;if(!u)throw y(a);if(typeof Q!=="object")throw y(a);if(typeof Q.type!=="string")throw y(a);if(typeof Q.asymmetricKeyType!=="string")throw y(a);if(typeof Q.export!=="function")throw y(a)}function h(Q){if(r.isBuffer(Q))return;if(typeof Q==="string")return;if(typeof Q==="object")return;throw y(c)}function g(Q){if(r.isBuffer(Q))return;if(typeof Q==="string")return Q;if(!u)throw y(l);if(typeof Q!=="object")throw y(l);if(Q.type!=="secret")throw y(l);if(typeof Q.export!=="function")throw y(l)}function p(Q){return Q.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function _(Q){Q=Q.toString();var pe=4-Q.length%4;if(pe!==4)for(var se=0;se<pe;++se)Q+="=";return Q.replace(/\-/g,"+").replace(/_/g,"/")}function y(Q){var pe=[].slice.call(arguments,1),se=i.format.bind(i,Q).apply(null,pe);return TypeError(se)}function S(Q){return r.isBuffer(Q)||typeof Q==="string"}function E(Q){if(!S(Q))Q=JSON.stringify(Q);return Q}function b(Q){return function pe(se,ve){g(ve),se=E(se);var me=n.createHmac("sha"+Q,ve),j=(me.update(se),me.digest("base64"));return p(j)}}var R,T="timingSafeEqual"in n?function Q(pe,se){if(pe.byteLength!==se.byteLength)return!1;return n.timingSafeEqual(pe,se)}:function Q(pe,se){if(!R)R=pC();return R(pe,se)};function w(Q){return function pe(se,ve,me){var j=b(Q)(se,me);return T(r.from(ve),r.from(j))}}function C(Q){return function pe(se,ve){h(ve),se=E(se);var me=n.createSign("RSA-SHA"+Q),j=(me.update(se),me.sign(ve,"base64"));return p(j)}}function A(Q){return function pe(se,ve,me){f(me),se=E(se),ve=_(ve);var j=n.createVerify("RSA-SHA"+Q);return j.update(se),j.verify(me,ve,"base64")}}function P(Q){return function pe(se,ve){h(ve),se=E(se);var me=n.createSign("RSA-SHA"+Q),j=(me.update(se),me.sign({key:ve,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return p(j)}}function D(Q){return function pe(se,ve,me){f(me),se=E(se),ve=_(ve);var j=n.createVerify("RSA-SHA"+Q);return j.update(se),j.verify({key:me,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},ve,"base64")}}function N(Q){var pe=C(Q);return function se(){var ve=pe.apply(null,arguments);return ve=o.derToJose(ve,"ES"+Q),ve}}function F(Q){var pe=A(Q);return function se(ve,me,j){me=o.joseToDer(me,"ES"+Q).toString("base64");var ne=pe(ve,me,j);return ne}}function G(){return function Q(){return""}}function B(){return function Q(pe,se){return se===""}}t.exports=function Q(pe){var se={hs:b,rs:C,ps:P,es:N,none:G},ve={hs:w,rs:A,ps:D,es:F,none:B},me=pe.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!me)throw y(s,pe);var j=(me[1]||me[3]).toLowerCase(),ne=me[2];return{sign:se[j](ne),verify:ve[j](ne)}}}}),ev=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/tostring.js"(e,t){var r=Te("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)}}}),hC=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/sign-stream.js"(e,t){var r=qs().Buffer,n=Zg(),o=Qg(),i=Te("stream"),s=ev(),l=Te("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}}),mC=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/verify-stream.js"(e,t){var r=qs().Buffer,n=Zg(),o=Qg(),i=Te("stream"),s=ev(),l=Te("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 T=b.split(".")[1];return r.from(T,"base64").toString(R)}function _(b){return a.test(b)&&!!f(b)}function y(b,R,T){if(!R){var w=Error("Missing algorithm parameter for jws.verify");throw w.code="MISSING_ALGORITHM",w}b=s(b);var C=g(b),A=h(b),P=o(R);return P.verify(A,C,T)}function S(b,R){if(R=R||{},b=s(b),!_(b))return null;var T=f(b);if(!T)return null;var w=p(b);if(T.typ==="JWT"||R.json)w=JSON.parse(w,R.encoding);return{header:T,payload:w,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 T=new n(R);this.readable=!0,this.algorithm=b.algorithm,this.encoding=b.encoding,this.secret=this.publicKey=this.key=T,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),T=S(this.signature.buffer,this.encoding);return this.emit("done",R,T),this.emit("data",R),this.emit("end"),this.readable=!1,R}catch(w){this.readable=!1,this.emit("error",w),this.emit("close")}},E.decode=S,E.isValid=_,E.verify=y,t.exports=E}}),tv=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/index.js"(e){var t=hC(),r=mC(),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)}}}),gC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/jwsSign.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.buildPayloadForJwsSign=o,e.getJwsSign=i;var t=tv(),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})}}}),vC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/getToken.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getToken=i;var t=gC(),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}}}}),_C=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/errorWithCode.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorWithCode=void 0;var t=class extends Error{code;constructor(r,n){super(r);this.code=n}};e.ErrorWithCode=t}}),rv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/getCredentials.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getCredentials=f;var t=Te("path"),r=Te("fs"),n=Te("util"),o=_C(),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()}}}),yC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/tokenHandler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenHandler=void 0;var t=vC(),r=rv(),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}}),SC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/revokeToken.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.revokeToken=n;var t="https://oauth2.googleapis.com/revoke?token=",r=!0;async function n(o,i){let s=t+o;return await i.request({url:s,retry:r})}}}),nv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/googleToken.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleToken=void 0;var t=tr(),r=yC(),n=SC(),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}}),ov=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/jwtaccess.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.JWTAccess=void 0;var t=tv(),r=ln(),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}}),iv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/jwtclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.JWT=void 0;var t=nv(),r=rv(),n=ov(),o=Uo(),i=Or(),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}}),sv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/refreshclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UserRefreshClient=e.USER_REFRESH_ACCOUNT_TYPE=void 0;var t=Uo(),r=Or();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}}),av=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/impersonated.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Impersonated=e.IMPERSONATED_ACCOUNT_TYPE=void 0;var t=Uo(),r=tr(),n=ln();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}}),lv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/oauth2common.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthClientAuthHandler=void 0,e.getErrorFromOAuthErrorResponse=i;var t=tr(),r=ul(),n=["PUT","POST","PATCH"],o=class{#e=(0,r.createCrypto)();#t;transporter;constructor(s){if(s&&"clientId"in s)this.#t=s,this.transporter=new t.Gaxios;else this.#t=s?.clientAuthentication,this.transporter=s?.transporter||new t.Gaxios}applyClientAuthenticationOptions(s,l){if(s.headers=t.Gaxios.mergeHeaders(s.headers),this.injectAuthenticatedHeaders(s,l),!l)this.injectAuthenticatedRequestBody(s)}injectAuthenticatedHeaders(s,l){if(l)s.headers=t.Gaxios.mergeHeaders(s.headers,{authorization:`Bearer ${l}`});else if(this.#t?.confidentialClientType==="basic"){s.headers=t.Gaxios.mergeHeaders(s.headers);let a=this.#t.clientId,c=this.#t.clientSecret||"",u=this.#e.encodeBase64StringUtf8(`${a}:${c}`);t.Gaxios.mergeHeaders(s.headers,{authorization:`Basic ${u}`})}}injectAuthenticatedRequestBody(s){if(this.#t?.confidentialClientType==="request-body"){let l=(s.method||"GET").toUpperCase();if(!n.includes(l))throw Error(`${l} HTTP method does not support ${this.#t.confidentialClientType} client authentication`);let c=new Headers(s.headers).get("content-type");if(c?.startsWith("application/x-www-form-urlencoded")||s.data instanceof URLSearchParams){let u=new URLSearchParams(s.data??"");u.append("client_id",this.#t.clientId),u.append("client_secret",this.#t.clientSecret||""),s.data=u}else if(c?.startsWith("application/json"))s.data=s.data||{},Object.assign(s.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""});else throw Error(`${c} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};e.OAuthClientAuthHandler=o;function i(s,l){let{error:a,error_description:c,error_uri:u}=s,f=`Error code ${a}`;if(typeof c<"u")f+=`: ${c}`;if(typeof u<"u")f+=` - ${u}`;let h=Error(f);if(l){let g=Object.keys(l);if(l.stack)g.push("stack");g.forEach((p)=>{if(p!=="message")Object.defineProperty(h,p,{value:l[p],writable:!1,enumerable:!0})})}return h}}}),_u=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/stscredentials.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StsCredentials=void 0;var t=tr(),r=Or(),n=lv(),o=ln(),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}}),Fo=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/baseexternalclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BaseExternalAccountClient=e.CLOUD_RESOURCE_MANAGER=e.EXTERNAL_ACCOUNT_TYPE=e.EXPIRATION_TIME_OFFSET=void 0;var t=tr(),r=Te("stream"),n=Or(),o=_u(),i=ln(),s=Wg(),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"),T=y.get("workforce_pool_user_project"),w=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=T;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=w,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,T=b.config.data instanceof r.Readable;if(!y&&(R===401||R===403)&&!T&&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}}),EC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FileSubjectTokenSupplier=void 0;var t=Te("util"),r=Te("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}}),bC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UrlSubjectTokenSupplier=void 0;var t=Or(),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}}),TC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CertificateSubjectTokenSupplier=e.InvalidConfigurationError=e.CertificateSourceUnavailableError=e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var t=ln(),r=Te("fs"),n=Te("crypto"),o=Te("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}}),cv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/identitypoolclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdentityPoolClient=void 0;var t=Fo(),r=ln(),n=EC(),o=bC(),i=TC(),s=_u(),l=tr(),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"),T=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:T,additionalGaxiosOptions:c.RETRY_CONFIG});else if(R){this.credentialSourceType="certificate";let w=new i.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:R.use_default_certificate_config,certificateConfigLocation:R.certificate_config_location,trustChainPath:R.trust_chain_path});this.subjectTokenSupplier=w}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}}),uv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AwsRequestSigner=void 0;var t=tr(),r=ul(),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),T=`${c.method.toUpperCase()}
|
|
41
|
+
${c.canonicalUri}
|
|
42
|
+
${c.canonicalQuerystring}
|
|
43
|
+
${S}
|
|
44
|
+
${b}
|
|
45
|
+
${R}`,w=`${_}/${c.region}/${h}/${o}`,C=`${n}
|
|
46
|
+
${p}
|
|
47
|
+
${w}
|
|
48
|
+
`+await c.crypto.sha256DigestHex(T),A=await l(c.crypto,c.securityCredentials.secretAccessKey,_,c.region,h),P=await s(c.crypto,A,C),D=`${n} Credential=${c.securityCredentials.accessKeyId}/${w}, SignedHeaders=${b}, Signature=${(0,r.fromArrayBufferToHex)(P)}`;return{amzDate:u.has("date")?void 0:p,authorizationHeader:D,canonicalQuerystring:c.canonicalQuerystring}}}}),wC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultAwsSecurityCredentialsSupplier=void 0;var t=Or(),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}}),dv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/awsclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AwsClient=void 0;var t=uv(),r=Fo(),n=wC(),o=ln(),i=tr(),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}}),fv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/executable-response.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidSubjectTokenError=e.InvalidMessageFieldError=e.InvalidCodeFieldError=e.InvalidTokenTypeFieldError=e.InvalidExpirationTimeFieldError=e.InvalidSuccessFieldError=e.InvalidVersionFieldError=e.ExecutableResponseError=e.ExecutableResponse=void 0;var t="urn:ietf:params:oauth:token-type:saml2",r="urn:ietf:params:oauth:token-type:id_token",n="urn:ietf:params:oauth:token-type:jwt",o=class{version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(g){if(!g.version)throw new s("Executable response must contain a 'version' field.");if(g.success===void 0)throw new l("Executable response must contain a 'success' field.");if(this.version=g.version,this.success=g.success,this.success){if(this.expirationTime=g.expiration_time,this.tokenType=g.token_type,this.tokenType!==t&&this.tokenType!==r&&this.tokenType!==n)throw new c(`Executable response must contain a 'token_type' field when successful and it must be one of ${r}, ${n}, or ${t}.`);if(this.tokenType===t){if(!g.saml_response)throw new h(`Executable response must contain a 'saml_response' field when token_type=${t}.`);this.subjectToken=g.saml_response}else{if(!g.id_token)throw new h(`Executable response must contain a 'id_token' field when token_type=${r} or ${n}.`);this.subjectToken=g.id_token}}else{if(!g.code)throw new u("Executable response must contain a 'code' field when unsuccessful.");if(!g.message)throw new f("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=g.code,this.errorMessage=g.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1000)}};e.ExecutableResponse=o;var i=class extends Error{constructor(g){super(g);Object.setPrototypeOf(this,new.target.prototype)}};e.ExecutableResponseError=i;var s=class extends i{};e.InvalidVersionFieldError=s;var l=class extends i{};e.InvalidSuccessFieldError=l;var a=class extends i{};e.InvalidExpirationTimeFieldError=a;var c=class extends i{};e.InvalidTokenTypeFieldError=c;var u=class extends i{};e.InvalidCodeFieldError=u;var f=class extends i{};e.InvalidMessageFieldError=f;var h=class extends i{};e.InvalidSubjectTokenError=h}}),Jf=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PluggableAuthHandler=e.ExecutableError=void 0;var t=fv(),r=Te("child_process"),n=Te("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}}),pv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PluggableAuthClient=e.ExecutableError=void 0;var t=Fo(),r=fv(),n=Jf(),o=Jf();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}}),hv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/externalclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAccountClient=void 0;var t=Fo(),r=cv(),n=dv(),o=pv(),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}}),mv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAccountAuthorizedUserClient=e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var t=Or(),r=lv(),n=tr(),o=Te("stream"),i=Fo();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}}),gv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/gdchclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GdchClient=e.GDCH_SERVICE_ACCOUNT_TYPE=void 0;var t=Te("crypto"),r=Te("fs"),n=Te("https"),o=Uo(),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}}),CC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/googleauth.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleAuth=e.GoogleAuthExceptionMessages=void 0;var t=Te("child_process"),r=Te("fs"),n=tr(),o=cl(),i=Te("os"),s=Te("path"),l=ul(),a=Kg(),c=Xg(),u=Yg(),f=iv(),h=sv(),g=av(),p=hv(),_=Fo(),y=Or(),S=mv(),E=gv(),b=ln();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(T={}){if(this._cachedProjectId=T.projectId||null,this.cachedCredential=T.authClient||null,this.keyFilename=T.keyFilename||T.keyFile,this.scopes=T.scopes,this.clientOptions=T.clientOptions||{},this.jsonContent=T.credentials||null,this.apiKey=T.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw RangeError(e.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);if(T.universeDomain)this.clientOptions.universeDomain=T.universeDomain}setGapicJWTValues(T){T.defaultServicePath=this.defaultServicePath,T.useJWTAccessWithScope=this.useJWTAccessWithScope,T.defaultScopes=this.defaultScopes}getProjectId(T){if(T)this.getProjectIdAsync().then((w)=>T(null,w),T);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(T){if(T instanceof Error&&T.message===e.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;else throw T}}async findAndCacheProjectId(){let T=null;if(T||=await this.getProductionProjectId(),T||=await this.getFileProjectId(),T||=await this.getDefaultServiceProjectId(),T||=await this.getGCEProjectId(),T||=await this.getExternalAccountClientProjectId(),T)return this._cachedProjectId=T,T;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 T;try{T=await o.universe("universe-domain"),T||=y.DEFAULT_UNIVERSE}catch(w){if(w&&w?.response?.status===404)T=y.DEFAULT_UNIVERSE;else throw w}return T}async getUniverseDomain(){let T=(0,b.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{T??=(await this.getClient()).universeDomain}catch{T??=y.DEFAULT_UNIVERSE}return T}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(T={},w){let C;if(typeof T==="function")w=T;else C=T;if(w)this.getApplicationDefaultAsync(C).then((A)=>w(null,A.credential,A.projectId),w);else return this.getApplicationDefaultAsync(C)}async getApplicationDefaultAsync(T={}){if(this.cachedCredential)return await this.#t(this.cachedCredential,null);let w;if(w=await this._tryGetApplicationCredentialsFromEnvironmentVariable(T),w){if(w instanceof f.JWT)w.scopes=this.scopes;else if(w instanceof _.BaseExternalAccountClient)w.scopes=this.getAnyScopes();return await this.#t(w)}if(w=await this._tryGetApplicationCredentialsFromWellKnownFile(T),w){if(w instanceof f.JWT)w.scopes=this.scopes;else if(w instanceof _.BaseExternalAccountClient)w.scopes=this.getAnyScopes();return await this.#t(w)}if(await this._checkIsGCE())return T.scopes=this.getAnyScopes(),await this.#t(new a.Compute(T));throw Error(e.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#t(T,w=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let C=await this.getProjectIdOptional();if(w)T.quotaProjectId=w;return this.cachedCredential=T,{credential:T,projectId:C}}async _checkIsGCE(){if(this.checkIsGCE===void 0)this.checkIsGCE=o.getGCPResidency()||await o.isAvailable();return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(T){let w=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!w||w.length===0)return null;try{return await this._getApplicationCredentialsFromFilePath(w,T)}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(T){let w=process.env.CLOUDSDK_CONFIG;if(!w)if(this._isWindows()){if(process.env.APPDATA)w=s.join(process.env.APPDATA,"gcloud")}else{let P=process.env.HOME;if(P)w=s.join(P,".config","gcloud")}if(!w)return null;let C=s.join(w,"application_default_credentials.json");if(!r.existsSync(C))return null;return await this._getApplicationCredentialsFromFilePath(C,T)}async _getApplicationCredentialsFromFilePath(T,w={}){if(!T||T.length===0)throw Error("The file path is invalid.");try{if(T=r.realpathSync(T),!r.lstatSync(T).isFile())throw Error()}catch(A){if(A instanceof Error)A.message=`The file at ${T} does not exist, or it is not a file. ${A.message}`;throw A}let C=r.createReadStream(T);return this.fromStream(C,w)}fromImpersonatedJSON(T){if(!T)throw Error("Must pass in a JSON object containing an impersonated refresh token");if(T.type!==g.IMPERSONATED_ACCOUNT_TYPE)throw Error(`The incoming JSON object does not have the "${g.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!T.source_credentials)throw Error("The incoming JSON object does not contain a source_credentials field");if(!T.service_account_impersonation_url)throw Error("The incoming JSON object does not contain a service_account_impersonation_url field");let w=this.fromJSON(T.source_credentials);if(T.service_account_impersonation_url?.length>256)throw RangeError(`Target principal is too long: ${T.service_account_impersonation_url}`);let C=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(T.service_account_impersonation_url)?.groups?.target;if(!C)throw RangeError(`Cannot extract target principal from ${T.service_account_impersonation_url}`);let A=(this.scopes||T.scopes||this.defaultScopes)??[];return new g.Impersonated({...T,sourceClient:w,targetPrincipal:C,targetScopes:Array.isArray(A)?A:[A]})}fromJSON(T,w={}){let C,A=(0,b.originalOrCamelOptions)(w).get("universe_domain");if(T.type===h.USER_REFRESH_ACCOUNT_TYPE)C=new h.UserRefreshClient(w),C.fromJSON(T);else if(T.type===g.IMPERSONATED_ACCOUNT_TYPE)C=this.fromImpersonatedJSON(T);else if(T.type===_.EXTERNAL_ACCOUNT_TYPE)C=p.ExternalAccountClient.fromJSON({...T,...w}),C.scopes=this.getAnyScopes();else if(T.type===S.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE)C=new S.ExternalAccountAuthorizedUserClient({...T,...w});else if(T.type===E.GDCH_SERVICE_ACCOUNT_TYPE)C=new E.GdchClient(w),C.fromJSON(T);else w.scopes=this.scopes,C=new f.JWT(w),this.setGapicJWTValues(C),C.fromJSON(T);if(A)C.universeDomain=A;return C}_cacheClientFromJSON(T,w){let C=this.fromJSON(T,w);return this.jsonContent=T,this.cachedCredential=C,C}fromStream(T,w={},C){let A={};if(typeof w==="function")C=w;else A=w;if(C)this.fromStreamAsync(T,A).then((P)=>C(null,P),C);else return this.fromStreamAsync(T,A)}fromStreamAsync(T,w){return new Promise((C,A)=>{if(!T)throw Error("Must pass in a stream containing the Google auth settings.");let P=[];T.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,w);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(T,w={}){return new f.JWT({...w,apiKey:T})}_isWindows(){let T=i.platform();if(T&&T.length>=3){if(T.substring(0,3).toLowerCase()==="win")return!0}return!1}async getDefaultServiceProjectId(){return new Promise((T)=>{(0,t.exec)("gcloud config config-helper --format json",(w,C)=>{if(!w&&C)try{let A=JSON.parse(C).configuration.properties.core.project;T(A);return}catch(A){}T(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 w=await this.getClient();if(w&&w.projectId)return w.projectId}let T=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(T)return T.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(T){return null}}getCredentials(T){if(T)this.getCredentialsAsync().then((w)=>T(null,w),T);else return this.getCredentialsAsync()}async getCredentialsAsync(){let T=await this.getClient();if(T instanceof g.Impersonated)return{client_email:T.getTargetPrincipal()};if(T instanceof _.BaseExternalAccountClient){let w=T.getServiceAccountEmail();if(w)return{client_email:w,universe_domain:T.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[w,C]=await Promise.all([o.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:w,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 T=await this.#e;if(T instanceof E.GdchClient&&!T.apiAudience){let w=this.clientOptions,C=w.apiEndpoint||w.servicePath;if(C){let P=`${C.startsWith("http")?"":"https://"}${C}`.replace(/\/+$/,""),D=T.createWithGdchAudience(P);return this.cachedCredential=D,D}}return T}finally{this.#e=null}}async#r(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);else if(this.keyFilename){let T=s.resolve(this.keyFilename),w=r.createReadStream(T);return await this.fromStreamAsync(w,this.clientOptions)}else if(this.apiKey){let T=await this.fromAPIKey(this.apiKey,this.clientOptions);T.scopes=this.scopes;let{credential:w}=await this.#t(T);return w}else{let{credential:T}=await this.getApplicationDefaultAsync(this.clientOptions);return T}}async getIdTokenClient(T){let w=await this.getClient();if(!("fetchIdToken"in w))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:T,idTokenProvider:w})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(T){return(await this.getClient()).getRequestHeaders(T)}async authorizeRequest(T={}){let w=T.url,A=await(await this.getClient()).getRequestHeaders(w);return T.headers=n.Gaxios.mergeHeaders(T.headers,A),T}async fetch(...T){return(await this.getClient()).fetch(...T)}async request(T){return(await this.getClient()).request(T)}getEnv(){return(0,u.getEnv)()}async sign(T,w){let C=await this.getClient(),A=await this.getUniverseDomain();if(w=w||`https://iamcredentials.${A}/v1/projects/-/serviceAccounts/`,C instanceof g.Impersonated)return(await C.sign(T)).signedBlob;let P=(0,l.createCrypto)();if(C instanceof f.JWT&&C.key)return await P.sign(C.key,T);let D=await this.getCredentials();if(!D.client_email)throw Error("Cannot sign data without `client_email`.");return this.signBlob(P,D.client_email,T,w)}async signBlob(T,w,C,A){let P=new URL(A+`${w}:signBlob`);return(await this.request({method:"POST",url:P.href,data:{payload:T.encodeBase64StringUtf8(C)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};e.GoogleAuth=R}}),RC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/iam.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IAMAuth=void 0;var t=class{selector;token;constructor(r,n){this.selector=r,this.token=n,this.selector=r,this.token=n}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};e.IAMAuth=t}}),AC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/downscopedclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DownscopedClient=e.EXPIRATION_TIME_OFFSET=e.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var t=tr(),r=Te("stream"),n=Or(),o=_u(),i="urn:ietf:params:oauth:grant-type:token-exchange",s="urn:ietf:params:oauth:token-type:access_token",l="urn:ietf:params:oauth:token-type:access_token";e.MAX_ACCESS_BOUNDARY_RULES_COUNT=10,e.EXPIRATION_TIME_OFFSET=300000;var a=class extends n.AuthClient{authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(c,u={accessBoundary:{accessBoundaryRules:[]}}){super(c instanceof n.AuthClient?{}:c);if(c instanceof n.AuthClient)this.authClient=c,this.credentialAccessBoundary=u;else this.authClient=c.authClient,this.credentialAccessBoundary=c.credentialAccessBoundary;if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw Error("At least one access boundary rule needs to be defined.");else if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>e.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw Error(`The provided access boundary has more than ${e.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let f of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(f.availablePermissions.length===0)throw Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new o.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(c){if(!c.expiry_date)throw Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(c),this.cachedDownscopedAccessToken=c}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let c=await this.getAccessToken(),u=new Headers({authorization:`Bearer ${c.token}`});return this.addSharedMetadataHeaders(u)}request(c,u){if(u)this.requestAsync(c).then((f)=>u(null,f),(f)=>u(f,f.response));else return this.requestAsync(c)}async requestAsync(c,u=!1){let f;try{let h=await this.getRequestHeaders();c.headers=t.Gaxios.mergeHeaders(c.headers),this.addUserProjectAndAuthHeaders(c.headers,h),f=await this.transporter.request(c)}catch(h){let g=h.response;if(g){let p=g.status,_=g.config.data instanceof r.Readable;if(!u&&(p===401||p===403)&&!_&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(c,!0)}throw h}return f}async refreshAccessTokenAsync(){let c=(await this.authClient.getAccessToken()).token,u={grantType:i,requestedTokenType:s,subjectToken:c,subjectTokenType:l},f=await this.stsCredential.exchangeToken(u,void 0,this.credentialAccessBoundary),h=this.authClient.credentials?.expiry_date||null,g=f.expires_in?new Date().getTime()+f.expires_in*1000:h;return this.cachedDownscopedAccessToken={access_token:f.access_token,expiry_date:g,res:f.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(c){let u=new Date().getTime();return c.expiry_date?u>=c.expiry_date-this.eagerRefreshThresholdMillis:!1}};e.DownscopedClient=a}}),IC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/passthrough.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PassThroughClient=void 0;var t=Or(),r=class extends t.AuthClient{async request(n){return this.transporter.request(n)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};e.PassThroughClient=r}}),PC=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(D,N,F,G){if(G===void 0)G=F;var B=Object.getOwnPropertyDescriptor(N,F);if(!B||("get"in B?!N.__esModule:B.writable||B.configurable))B={enumerable:!0,get:function(){return N[F]}};Object.defineProperty(D,G,B)}:function(D,N,F,G){if(G===void 0)G=F;D[G]=N[F]}),r=e&&e.__exportStar||function(D,N){for(var F in D)if(F!=="default"&&!Object.prototype.hasOwnProperty.call(N,F))t(N,D,F)};Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleAuth=e.auth=e.GDCH_SERVICE_ACCOUNT_TYPE=e.GdchClient=e.PassThroughClient=e.ExternalAccountAuthorizedUserClient=e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=e.ExecutableError=e.PluggableAuthClient=e.DownscopedClient=e.BaseExternalAccountClient=e.ExternalAccountClient=e.IdentityPoolClient=e.AwsRequestSigner=e.AwsClient=e.UserRefreshClient=e.LoginTicket=e.ClientAuthentication=e.OAuth2Client=e.CodeChallengeMethod=e.Impersonated=e.JWT=e.JWTAccess=e.IdTokenClient=e.IAMAuth=e.GCPEnv=e.Compute=e.DEFAULT_UNIVERSE=e.AuthClient=e.gaxios=e.gcpMetadata=void 0;var n=CC();Object.defineProperty(e,"GoogleAuth",{enumerable:!0,get:function(){return n.GoogleAuth}}),e.gcpMetadata=cl(),e.gaxios=tr();var o=Or();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=Kg();Object.defineProperty(e,"Compute",{enumerable:!0,get:function(){return i.Compute}});var s=Yg();Object.defineProperty(e,"GCPEnv",{enumerable:!0,get:function(){return s.GCPEnv}});var l=RC();Object.defineProperty(e,"IAMAuth",{enumerable:!0,get:function(){return l.IAMAuth}});var a=Xg();Object.defineProperty(e,"IdTokenClient",{enumerable:!0,get:function(){return a.IdTokenClient}});var c=ov();Object.defineProperty(e,"JWTAccess",{enumerable:!0,get:function(){return c.JWTAccess}});var u=iv();Object.defineProperty(e,"JWT",{enumerable:!0,get:function(){return u.JWT}});var f=av();Object.defineProperty(e,"Impersonated",{enumerable:!0,get:function(){return f.Impersonated}});var h=Uo();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=Jg();Object.defineProperty(e,"LoginTicket",{enumerable:!0,get:function(){return g.LoginTicket}});var p=sv();Object.defineProperty(e,"UserRefreshClient",{enumerable:!0,get:function(){return p.UserRefreshClient}});var _=dv();Object.defineProperty(e,"AwsClient",{enumerable:!0,get:function(){return _.AwsClient}});var y=uv();Object.defineProperty(e,"AwsRequestSigner",{enumerable:!0,get:function(){return y.AwsRequestSigner}});var S=cv();Object.defineProperty(e,"IdentityPoolClient",{enumerable:!0,get:function(){return S.IdentityPoolClient}});var E=hv();Object.defineProperty(e,"ExternalAccountClient",{enumerable:!0,get:function(){return E.ExternalAccountClient}});var b=Fo();Object.defineProperty(e,"BaseExternalAccountClient",{enumerable:!0,get:function(){return b.BaseExternalAccountClient}});var R=AC();Object.defineProperty(e,"DownscopedClient",{enumerable:!0,get:function(){return R.DownscopedClient}});var T=pv();Object.defineProperty(e,"PluggableAuthClient",{enumerable:!0,get:function(){return T.PluggableAuthClient}}),Object.defineProperty(e,"ExecutableError",{enumerable:!0,get:function(){return T.ExecutableError}});var w=mv();Object.defineProperty(e,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:function(){return w.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE}}),Object.defineProperty(e,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:function(){return w.ExternalAccountAuthorizedUserClient}});var C=IC();Object.defineProperty(e,"PassThroughClient",{enumerable:!0,get:function(){return C.PassThroughClient}});var A=gv();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(nv(),e);var P=new n.GoogleAuth;e.auth=P}}),fo=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/constants.js"(e,t){var r=["nodebuffer","arraybuffer","fragments"],n=typeof Blob<"u";if(n)r.push("blob");t.exports={BINARY_TYPES:r,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:n,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}}}),dl=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/buffer-util.js"(e,t){var{websocketMask:r,websocketUnmask:n}=Te("http"),{EMPTY_BUFFER:o}=fo(),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=Te("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){}}}),kC=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/limiter.js"(e,t){var r=Symbol("kDone"),n=Symbol("kRun"),o=class{constructor(i){this[r]=()=>{this.pending--,this[n]()},this.concurrency=i||1/0,this.jobs=[],this.pending=0}add(i){this.jobs.push(i),this[n]()}[n](){if(this.pending===this.concurrency)return;if(this.jobs.length){let i=this.jobs.shift();this.pending++,i(this[r])}}};t.exports=o}}),xs=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/permessage-deflate.js"(e,t){var r=Te("zlib"),n=dl(),o=kC(),{kStatusCode:i}=fo(),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((T)=>{if(b.serverNoContextTakeover===!1&&T.server_no_context_takeover||T.server_max_window_bits&&(b.serverMaxWindowBits===!1||typeof b.serverMaxWindowBits==="number"&&b.serverMaxWindowBits>T.server_max_window_bits)||typeof b.clientMaxWindowBits==="number"&&(typeof T.client_max_window_bits==="number"?b.clientMaxWindowBits>T.client_max_window_bits:!T.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 T=b[R];if(T.length>1)throw Error(`Parameter "${R}" must have only a single value`);if(T=T[0],R==="client_max_window_bits"){if(T!==!0){let w=+T;if(!Number.isInteger(w)||w<8||w>15)throw TypeError(`Invalid value for parameter "${R}": ${T}`);T=w}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${R}": ${T}`)}else if(R==="server_max_window_bits"){let w=+T;if(!Number.isInteger(w)||w<8||w>15)throw TypeError(`Invalid value for parameter "${R}": ${T}`);T=w}else if(R==="client_no_context_takeover"||R==="server_no_context_takeover"){if(T!==!0)throw TypeError(`Invalid value for parameter "${R}": ${T}`)}else throw Error(`Unknown parameter "${R}"`);b[R]=T})}),E}decompress(E,b,R){g.add((T)=>{this._decompress(E,b,(w,C)=>{T(),R(w,C)})})}compress(E,b,R){g.add((T)=>{this._compress(E,b,(w,C)=>{T(),R(w,C)})})}_decompress(E,b,R){let T=this._isServer?"client":"server";if(!this._inflate){let w=`${T}_max_window_bits`,C=typeof this.params[w]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[w];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 w=this._inflate[h];if(w){this._inflate.close(),this._inflate=null,R(w);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[`${T}_no_context_takeover`])this._inflate.reset();R(null,C)})}_compress(E,b,R){let T=this._isServer?"server":"client";if(!this._deflate){let w=`${T}_max_window_bits`,C=typeof this.params[w]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[w];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 w=n.concat(this._deflate[f],this._deflate[c]);if(b)w=new s(w.buffer,w.byteOffset,w.length-4);if(this._deflate[u]=null,this._deflate[c]=0,this._deflate[f]=[],b&&this.params[`${T}_no_context_takeover`])this._deflate.reset();R(null,w)})}};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)}}}),Ls=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/validation.js"(e,t){var{isUtf8:r}=Te("buffer"),{hasBlob:n}=fo(),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=Te("utf-8-validate");t.exports.isValidUTF8=function(c){return c.length<32?s(c):a(c)}}catch(a){}}}),vv=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/receiver.js"(e,t){var{Writable:r}=Te("stream"),n=xs(),{BINARY_TYPES:o,EMPTY_BUFFER:i,kStatusCode:s,kWebSocket:l}=fo(),{concat:a,toArrayBuffer:c,unmask:u}=dl(),{isValidStatusCode:f,isValidUTF8:h}=Ls(),g=Buffer[Symbol.species],p=0,_=1,y=2,S=3,E=4,b=5,R=6,T=class extends r{constructor(w={}){super();this._allowSynchronousEvents=w.allowSynchronousEvents!==void 0?w.allowSynchronousEvents:!0,this._binaryType=w.binaryType||o[0],this._extensions=w.extensions||{},this._isServer=!!w.isServer,this._maxBufferedChunks=w.maxBufferedChunks|0,this._maxFragments=w.maxFragments|0,this._maxPayload=w.maxPayload|0,this._skipUTF8Validation=!!w.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(w,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+=w.length,this._buffers.push(w),this.startLoop(A)}consume(w){if(this._bufferedBytes-=w,w===this._buffers[0].length)return this._buffers.shift();if(w<this._buffers[0].length){let A=this._buffers[0];return this._buffers[0]=new g(A.buffer,A.byteOffset+w,A.length-w),new g(A.buffer,A.byteOffset,w)}let C=Buffer.allocUnsafe(w);do{let A=this._buffers[0],P=C.length-w;if(w>=A.length)C.set(this._buffers.shift(),P);else C.set(new Uint8Array(A.buffer,A.byteOffset,w),P),this._buffers[0]=new g(A.buffer,A.byteOffset+w,A.length-w);w-=A.length}while(w>0);return C}startLoop(w){this._loop=!0;do switch(this._state){case p:this.getInfo(w);break;case _:this.getPayloadLength16(w);break;case y:this.getPayloadLength64(w);break;case S:this.getMask();break;case E:this.getData(w);break;case b:case R:this._loop=!1;return}while(this._loop);if(!this._errored)w()}getInfo(w){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");w(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");w(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");w(P);return}if(!this._fragmented){let P=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");w(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");w(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");w(P);return}if(A){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");w(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");w(P);return}}else{let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");w(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");w(P);return}}else if(this._masked){let P=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");w(P);return}if(this._payloadLength===126)this._state=_;else if(this._payloadLength===127)this._state=y;else this.haveLength(w)}getPayloadLength16(w){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(w)}getPayloadLength64(w){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");w(P);return}this._payloadLength=A*Math.pow(2,32)+C.readUInt32BE(4),this.haveLength(w)}haveLength(w){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");w(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(w){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,w);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");w(A);return}if(this._compressed){this._state=b,this.decompress(C,w);return}if(C.length)this._messageLength=this._totalPayloadLength,this._fragments.push(C);this.dataMessage(w)}decompress(w,C){this._extensions[n.extensionName].decompress(w,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(w){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(w)})}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");w(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(w)})}}controlMessage(w,C){if(this._opcode===8){if(w.length===0)this._loop=!1,this.emit("conclude",1005,i),this.end();else{let A=w.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(w.buffer,w.byteOffset+2,w.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",w),this._state=p;else this._state=R,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",w),this._state=p,this.startLoop(C)})}createError(w,C,A,P,D){this._loop=!1,this._errored=!0;let N=new w(A?`Invalid WebSocket frame: ${C}`:C);return Error.captureStackTrace(N,this.createError),N.code=D,N[s]=P,N}};t.exports=T}}),_v=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/sender.js"(e,t){var{Duplex:r}=Te("stream"),{randomFillSync:n}=Te("crypto"),{types:{isUint8Array:o}}=Te("util"),i=xs(),{EMPTY_BUFFER:s,kWebSocket:l,NOOP:a}=fo(),{isBlob:c,isValidStatusCode:u}=Ls(),{mask:f,toBuffer:h}=dl(),g=Symbol("kByteLength"),p=Buffer.alloc(4),_=8192,y,S=_,E=0,b=1,R=2,T=class A{constructor(P,D,N){if(this._extensions=D||{},N)this._generateMask=N,this._maskBuffer=Buffer.alloc(4);this._socket=P,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=E,this.onerror=a,this[l]=void 0}static frame(P,D){let N,F=!1,G=2,B=!1;if(D.mask){if(N=D.maskBuffer||p,D.generateMask)D.generateMask(N);else{if(S===_){if(y===void 0)y=Buffer.alloc(_);n(y,0,_),S=0}N[0]=y[S++],N[1]=y[S++],N[2]=y[S++],N[3]=y[S++]}B=(N[0]|N[1]|N[2]|N[3])===0,G=6}let Q;if(typeof P==="string")if((!D.mask||B)&&D[g]!==void 0)Q=D[g];else P=Buffer.from(P),Q=P.length;else Q=P.length,F=D.mask&&D.readOnly&&!B;let pe=Q;if(Q>=65536)G+=8,pe=127;else if(Q>125)G+=2,pe=126;let se=Buffer.allocUnsafe(F?Q+G:G);if(se[0]=D.fin?D.opcode|128:D.opcode,D.rsv1)se[0]|=64;if(se[1]=pe,pe===126)se.writeUInt16BE(Q,2);else if(pe===127)se[2]=se[3]=0,se.writeUIntBE(Q,4,6);if(!D.mask)return Q?[se,P]:[se];if(se[1]|=128,se[G-4]=N[0],se[G-3]=N[1],se[G-2]=N[2],se[G-1]=N[3],!Q)return[se];if(B)return[se,P];if(F)return f(P,N,se,G,Q),[se];return f(P,N,P,0,Q),[se,P]}close(P,D,N,F){let G;if(P===void 0)G=s;else if(typeof P!=="number"||!u(P))throw TypeError("First argument must be a valid error code number");else if(D===void 0||!D.length)G=Buffer.allocUnsafe(2),G.writeUInt16BE(P,0);else{let Q=Buffer.byteLength(D);if(Q>123)throw RangeError("The message must not be greater than 123 bytes");if(G=Buffer.allocUnsafe(2+Q),G.writeUInt16BE(P,0),typeof D==="string")G.write(D,2);else if(o(D))G.set(D,2);else throw TypeError("Second argument must be a string or a Uint8Array")}let B={[g]:G.length,fin:!0,generateMask:this._generateMask,mask:N,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==E)this.enqueue([this.dispatch,G,!1,B,F]);else this.sendFrame(A.frame(G,B),F)}ping(P,D,N){let F,G;if(typeof P==="string")F=Buffer.byteLength(P),G=!1;else if(c(P))F=P.size,G=!1;else P=h(P),F=P.length,G=h.readOnly;if(F>125)throw RangeError("The data size must not be greater than 125 bytes");let B={[g]:F,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:9,readOnly:G,rsv1:!1};if(c(P))if(this._state!==E)this.enqueue([this.getBlobData,P,!1,B,N]);else this.getBlobData(P,!1,B,N);else if(this._state!==E)this.enqueue([this.dispatch,P,!1,B,N]);else this.sendFrame(A.frame(P,B),N)}pong(P,D,N){let F,G;if(typeof P==="string")F=Buffer.byteLength(P),G=!1;else if(c(P))F=P.size,G=!1;else P=h(P),F=P.length,G=h.readOnly;if(F>125)throw RangeError("The data size must not be greater than 125 bytes");let B={[g]:F,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:10,readOnly:G,rsv1:!1};if(c(P))if(this._state!==E)this.enqueue([this.getBlobData,P,!1,B,N]);else this.getBlobData(P,!1,B,N);else if(this._state!==E)this.enqueue([this.dispatch,P,!1,B,N]);else this.sendFrame(A.frame(P,B),N)}send(P,D,N){let F=this._extensions[i.extensionName],G=D.binary?2:1,B=D.compress,Q,pe;if(typeof P==="string")Q=Buffer.byteLength(P),pe=!1;else if(c(P))Q=P.size,pe=!1;else P=h(P),Q=P.length,pe=h.readOnly;if(this._firstFragment){if(this._firstFragment=!1,B&&F&&F.params[F._isServer?"server_no_context_takeover":"client_no_context_takeover"])B=Q>=F._threshold;this._compress=B}else B=!1,G=0;if(D.fin)this._firstFragment=!0;let se={[g]:Q,fin:D.fin,generateMask:this._generateMask,mask:D.mask,maskBuffer:this._maskBuffer,opcode:G,readOnly:pe,rsv1:B};if(c(P))if(this._state!==E)this.enqueue([this.getBlobData,P,this._compress,se,N]);else this.getBlobData(P,this._compress,se,N);else if(this._state!==E)this.enqueue([this.dispatch,P,this._compress,se,N]);else this.dispatch(P,this._compress,se,N)}getBlobData(P,D,N,F){this._bufferedBytes+=N[g],this._state=R,P.arrayBuffer().then((G)=>{if(this._socket.destroyed){let Q=Error("The socket was closed while the blob was being read");process.nextTick(w,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");w(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=T;function w(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){w(A,P,D),A.onerror(P)}}}),NC=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/event-target.js"(e,t){var{kForOnEventAttribute:r,kListener:n}=fo(),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 w of this.listeners(E))if(!R[r]&&w[n]===b&&!w[r])return;let T;if(E==="message")T=function w(C,A){let P=new _("message",{data:A?C:C.toString()});P[c]=this,S(b,this,P)};else if(E==="close")T=function w(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")T=function w(C){let A=new p("error",{error:C,message:C.message});A[c]=this,S(b,this,A)};else if(E==="open")T=function w(){let C=new h("open");C[c]=this,S(b,this,C)};else return;if(T[r]=!!R[r],T[n]=b,R.once)this.once(E,T);else this.on(E,T)},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)}}}),yu=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/extension.js"(e,t){var{tokenChars:r}=Ls();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}}}),Su=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/websocket.js"(e,t){var r=Te("events"),n=Te("https"),o=Te("http"),i=Te("net"),s=Te("querystring"),l=Te("tls"),{randomBytes:a,createHash:c}=Te("crypto"),{Duplex:u,Readable:f}=Te("stream"),{URL:h}=Te("url"),g=xs(),p=vv(),_=_v(),{isBlob:y}=Ls(),{BINARY_TYPES:S,CLOSE_TIMEOUT:E,EMPTY_BUFFER:b,GUID:R,kForOnEventAttribute:T,kListener:w,kStatusCode:C,kWebSocket:A,NOOP:P}=fo(),{EventTarget:{addEventListener:D,removeEventListener:N}}=NC(),{format:F,parse:G}=yu(),{toBuffer:B}=dl(),Q=Symbol("kAborted"),pe=[8,13],se=["CONNECTING","OPEN","CLOSING","CLOSED"],ve=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,me=class x 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=x.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",je),ge.on("ping",U),ge.on("pong",q),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=x.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=x.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[g.extensionName])this._extensions[g.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=x.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(z,ce){if(this.readyState===x.CLOSED)return;if(this.readyState===x.CONNECTING){K(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===x.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=x.CLOSING,Y(this)}pause(){if(this.readyState===x.CONNECTING||this.readyState===x.CLOSED)return;this._paused=!0,this._socket.pause()}ping(z,ce,ue){if(this.readyState===x.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!==x.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===x.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!==x.OPEN){W(this,z,ue);return}if(ce===void 0)ce=!this._isServer;this._sender.pong(z||b,ce,ue)}resume(){if(this.readyState===x.CONNECTING||this.readyState===x.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(z,ce,ue){if(this.readyState===x.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!==x.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===x.CLOSED)return;if(this.readyState===x.CONNECTING){K(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=x.CLOSING,this._socket.destroy()}};Object.defineProperty(me,"CONNECTING",{enumerable:!0,value:se.indexOf("CONNECTING")}),Object.defineProperty(me.prototype,"CONNECTING",{enumerable:!0,value:se.indexOf("CONNECTING")}),Object.defineProperty(me,"OPEN",{enumerable:!0,value:se.indexOf("OPEN")}),Object.defineProperty(me.prototype,"OPEN",{enumerable:!0,value:se.indexOf("OPEN")}),Object.defineProperty(me,"CLOSING",{enumerable:!0,value:se.indexOf("CLOSING")}),Object.defineProperty(me.prototype,"CLOSING",{enumerable:!0,value:se.indexOf("CLOSING")}),Object.defineProperty(me,"CLOSED",{enumerable:!0,value:se.indexOf("CLOSED")}),Object.defineProperty(me.prototype,"CLOSED",{enumerable:!0,value:se.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((x)=>{Object.defineProperty(me.prototype,x,{enumerable:!0})}),["open","error","close","message"].forEach((x)=>{Object.defineProperty(me.prototype,`on${x}`,{enumerable:!0,get(){for(let z of this.listeners(x))if(z[T])return z[w];return null},set(z){for(let ce of this.listeners(x))if(ce[T]){this.removeListener(x,ce);break}if(typeof z!=="function")return;this.addEventListener(x,z,{[T]:!0})}})}),me.prototype.addEventListener=D,me.prototype.removeEventListener=N,t.exports=me;function j(x,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:";x._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(x._redirects===0)throw Ue;else{ne(x,Ue);return}}let St=et?443:80,Jt=a(16).toString("base64"),Kt=et?n.request:o.request,Dt=new Set,It;if(ge.createConnection=ge.createConnection||(et?L: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":Jt,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)||Dt.has(Ue))throw SyntaxError("An invalid or duplicated subprotocol was specified");Dt.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(x._redirects===0){x._originalIpc=He,x._originalSecure=et,x._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(x.listenerCount("redirect")===0){let Ue=He?x._originalIpc?ge.socketPath===x._originalHostOrSocketPath:!1:x._originalIpc?!1:Ne.host===x._originalHostOrSocketPath;if(!Ue||x._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=x._req=Kt(ge),x._redirects)x.emit("redirect",x.url,at)}else at=x._req=Kt(ge);if(ge.timeout)at.on("timeout",()=>{K(x,at,"Opening handshake has timed out")});if(at.on("error",(Ue)=>{if(at===null||at[Q])return;at=x._req=null,ne(x,Ue)}),at.on("response",(Ue)=>{let ze=Ue.headers.location,Qe=Ue.statusCode;if(ze&&ge.followRedirects&&Qe>=300&&Qe<400){if(++x._redirects>ge.maxRedirects){K(x,at,"Maximum redirects exceeded");return}at.abort();let nr;try{nr=new h(ze,z)}catch(qt){let Mt=SyntaxError(`Invalid URL: ${ze}`);ne(x,Mt);return}j(x,nr,ce,ue)}else if(!x.emit("unexpected-response",at,Ue))K(x,at,`Unexpected server response: ${Ue.statusCode}`)}),at.on("upgrade",(Ue,ze,Qe)=>{if(x.emit("upgrade",Ue),x.readyState!==me.CONNECTING)return;at=x._req=null;let nr=Ue.headers.upgrade;if(nr===void 0||nr.toLowerCase()!=="websocket"){K(x,ze,"Invalid Upgrade header");return}let qt=c("sha1").update(Jt+R).digest("base64");if(Ue.headers["sec-websocket-accept"]!==qt){K(x,ze,"Invalid Sec-WebSocket-Accept header");return}let Mt=Ue.headers["sec-websocket-protocol"],or;if(Mt!==void 0){if(!Dt.size)or="Server sent a subprotocol but none was requested";else if(!Dt.has(Mt))or="Server sent an invalid subprotocol"}else if(Dt.size)or="Server sent no subprotocol";if(or){K(x,ze,or);return}if(Mt)x._protocol=Mt;let ir=Ue.headers["sec-websocket-extensions"];if(ir!==void 0){if(!It){K(x,ze,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Cr;try{Cr=G(ir)}catch(Sr){K(x,ze,"Invalid Sec-WebSocket-Extensions header");return}let yr=Object.keys(Cr);if(yr.length!==1||yr[0]!==g.extensionName){K(x,ze,"Server indicated an extension that was not requested");return}try{It.accept(Cr[g.extensionName])}catch(Sr){K(x,ze,"Invalid Sec-WebSocket-Extensions header");return}x._extensions[g.extensionName]=It}x.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,x);else at.end();return ge}function ne(x,z){x._readyState=me.CLOSING,x._errorEmitted=!0,x.emit("error",z),x.emitClose()}function he(x){return x.path=x.socketPath,i.connect(x)}function L(x){if(x.path=void 0,!x.servername&&x.servername!=="")x.servername=i.isIP(x.host)?"":x.host;return l.connect(x)}function K(x,z,ce){x._readyState=me.CLOSING;let ue=Error(ce);if(Error.captureStackTrace(ue,K),z.setHeader){if(z[Q]=!0,z.abort(),z.socket&&!z.socket.destroyed)z.socket.destroy();process.nextTick(ne,x,ue)}else z.destroy(ue),z.once("error",x.emit.bind(x,"error")),z.once("close",x.emitClose.bind(x))}function W(x,z,ce){if(z){let ue=y(z)?z.size:B(z).length;if(x._socket)x._sender._bufferedBytes+=ue;else x._bufferedAmount+=ue}if(ce){let ue=Error(`WebSocket is not open: readyState ${x.readyState} (${se[x.readyState]})`);process.nextTick(ce,ue)}}function be(x,z){let ce=this[A];if(ce._closeFrameReceived=!0,ce._closeCode=x,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),x===1005)ce.close();else ce.close(x,z)}function Ce(){let x=this[A];if(!x.isPaused)x._socket.resume()}function Ve(x){let z=this[A];if(z._socket[A]!==void 0)z._socket.removeListener("data",Z),process.nextTick(H,z._socket),z.close(x[C]);if(!z._errorEmitted)z._errorEmitted=!0,z.emit("error",x)}function Ie(){this[A].emitClose()}function je(x,z){this[A].emit("message",x,z)}function U(x){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(x,!this._isServer,z._autoPongComplete);z.emit("ping",x)}function O(x){x._pendingAutoPongs--}function q(x){this[A].emit("pong",x)}function H(x){x.resume()}function J(x){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",x)}function Y(x){x._closeTimer=setTimeout(x._socket.destroy.bind(x._socket),x._closeTimeout)}function ee(){let x=this[A];if(this.removeListener("close",ee),this.removeListener("data",Z),this.removeListener("end",te),x._readyState=me.CLOSING,!this._readableState.endEmitted&&!x._closeFrameReceived&&!x._receiver._writableState.errorEmitted&&this._readableState.length!==0){let z=this.read(this._readableState.length);x._receiver.write(z)}if(x._receiver.end(),this[A]=void 0,clearTimeout(x._closeTimer),x._receiver._writableState.finished||x._receiver._writableState.errorEmitted)x.emitClose();else x._receiver.on("error",Ie),x._receiver.on("finish",Ie)}function Z(x){if(!this[A]._receiver.write(x))this.pause()}function te(){let x=this[A];x._readyState=me.CLOSING,x._receiver.end(),this.end()}function oe(){let x=this[A];if(this.removeListener("error",oe),this.on("error",P),x)x._readyState=me.CLOSING,this.destroy()}}}),OC=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/stream.js"(e,t){var r=Su(),{Duplex:n}=Te("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}}),yv=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/subprotocol.js"(e,t){var{tokenChars:r}=Ls();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}}}),MC=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/websocket-server.js"(e,t){var r=Te("events"),n=Te("http"),{Duplex:o}=Te("stream"),{createHash:i}=Te("crypto"),s=yu(),l=xs(),a=yv(),c=Su(),{CLOSE_TIMEOUT:u,GUID:f,kWebSocket:h}=fo(),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"){w(this,C,A,405,"Invalid HTTP method");return}if(F===void 0||F.toLowerCase()!=="websocket"){w(this,C,A,400,"Invalid Upgrade header");return}if(N===void 0||!g.test(N)){w(this,C,A,400,"Missing or invalid Sec-WebSocket-Key header");return}if(G!==13&&G!==8){w(this,C,A,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(C)){T(A,400);return}let B=C.headers["sec-websocket-protocol"],Q=new Set;if(B!==void 0)try{Q=a.parse(B)}catch(ve){w(this,C,A,400,"Invalid Sec-WebSocket-Protocol header");return}let pe=C.headers["sec-websocket-extensions"],se={};if(this.options.perMessageDeflate&&pe!==void 0){let ve=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let me=s.parse(pe);if(me[l.extensionName])ve.accept(me[l.extensionName]),se[l.extensionName]=ve}catch(me){w(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 T(A,j||401,ne,he);this.completeUpgrade(se,N,Q,C,A,P,D)});return}if(!this.options.verifyClient(ve))return T(A,401)}this.completeUpgrade(se,N,Q,C,A,P,D)}completeUpgrade(C,A,P,D,N,F,G){if(!N.readable||!N.writable)return N.destroy();if(N[h])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>p)return T(N,503);let Q=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${i("sha1").update(A+f).digest("base64")}`],pe=new this.options.WebSocket(null,void 0,this.options);if(P.size){let se=this.options.handleProtocols?this.options.handleProtocols(P,D):P.values().next().value;if(se)Q.push(`Sec-WebSocket-Protocol: ${se}`),pe._protocol=se}if(C[l.extensionName]){let se=C[l.extensionName].params,ve=s.format({[l.extensionName]:[se]});Q.push(`Sec-WebSocket-Extensions: ${ve}`),pe._extensions=C}if(this.emit("headers",Q,D),N.write(Q.concat(`\r
|
|
55
|
+
`).join(`\r
|
|
56
|
+
`)),N.removeListener("error",R),pe.setSocket(N,F,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(pe),pe.on("close",()=>{if(this.clients.delete(pe),this._shouldEmitClose&&!this.clients.size)process.nextTick(b,this)});G(pe,D)}};t.exports=S;function E(C,A){for(let P of Object.keys(A))C.on(P,A[P]);return function P(){for(let D of Object.keys(A))C.removeListener(D,A[D])}}function b(C){C._state=y,C.emit("close")}function R(){this.destroy()}function T(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 w(C,A,P,D,N,F){if(C.listenerCount("wsClientError")){let G=Error(N);Error.captureStackTrace(G,w),C.emit("wsClientError",G,P,A)}else T(P,D,N,F)}}}),{create:$C,defineProperty:Da,getOwnPropertyDescriptor:DC,getOwnPropertyNames:qC,getPrototypeOf:xC}=Object,LC=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),UC=(e,t)=>{let r={};for(var n in e)Da(r,n,{get:e[n],enumerable:!0});if(t)Da(r,Symbol.toStringTag,{value:"Module"});return r},FC=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=qC(t),i=0,s=o.length,l;i<s;i++)if(l=o[i],!LC.call(e,l)&&l!==r)Da(e,l,{get:((a)=>t[a]).bind(null,l),enumerable:!(n=DC(t,l))||n.enumerable})}return e},Sv=(e,t,r)=>(r=e!=null?$C(xC(e)):{},FC(t||!e||!e.__esModule?Da(r,"default",{value:e,enumerable:!0}):r,e)),GC=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ev=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),BC=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),HC=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function VC(e){return typeof e==="string"&&Ev.has(e.replace(/#$/,""))}function zC(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(GC.has(r))return"2020-12";if(Ev.has(r))return"2019-09";if(BC.has(r)||HC.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={};Ms(rt,{BIGINT_FORMAT_RANGES:()=>Ov,CONSTANT_CATCH:()=>Fv,Class:()=>wR,NUMBER_FORMAT_RANGES:()=>Tu,aborted:()=>sn,allowsEval:()=>Pv,assert:()=>YC,assertEqual:()=>jC,assertIs:()=>KC,assertNever:()=>XC,assertNotEqual:()=>WC,assignProp:()=>zr,attachSchema:()=>La,base64ToUint8Array:()=>qv,base64urlToUint8Array:()=>SR,cached:()=>Us,captureStackTrace:()=>Eu,cleanEnum:()=>yR,cleanRegex:()=>fl,clone:()=>$n,cloneDef:()=>tR,codePointLength:()=>ml,constantCatch:()=>kR,createTransparentProxy:()=>cR,defineLazy:()=>wv,defineLazyInternal:()=>gt,derived:()=>CR,esc:()=>Av,escapeRegex:()=>$o,explicitlyAborted:()=>$v,extend:()=>fR,finalizeIssue:()=>Nn,floatSafeRemainder:()=>Tv,getElementAtPath:()=>rR,getEnumValues:()=>qa,getLengthableOrigin:()=>gl,getParsedType:()=>aR,getSizableOrigin:()=>vR,hexToUint8Array:()=>bR,hide:()=>Uv,installLazyProp:()=>PR,isObject:()=>Ri,isPlainObject:()=>Mo,issue:()=>Ua,joinValues:()=>$c,jsonStringifyReplacer:()=>xa,members:()=>Lv,merge:()=>hR,mergeDefs:()=>Mn,normalizeParams:()=>Fe,nullish:()=>bv,numKeys:()=>sR,objectClone:()=>QC,omit:()=>dR,optionalKeys:()=>Nv,own:()=>Do,parsedType:()=>Dv,partial:()=>mR,pick:()=>uR,prefixIssues:()=>Co,primitiveTypes:()=>lR,promiseAllObject:()=>nR,propertyKeyTypes:()=>kv,randomString:()=>oR,rawShape:()=>pl,required:()=>gR,safeExtend:()=>pR,shallowClone:()=>iR,sizeCaps:()=>Dc,slugify:()=>Iv,stringifyPrimitive:()=>bu,toZod:()=>JC,uint8ArrayToBase64:()=>xv,uint8ArrayToBase64url:()=>ER,uint8ArrayToHex:()=>TR,unwrapMessage:()=>pi});function jC(e){return e}function WC(e){return e}function JC(){return(e)=>e}function KC(e){}function XC(e){throw Error("Unexpected value in exhaustive check")}function YC(e){}function qa(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 $c(e,t="|"){return e.map((r)=>bu(r)).join(t)}function xa(e,t){if(typeof t==="bigint")return t.toString();return t}var ZC=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 Us(e){return new ZC(e)}function bv(e){return e===null||e===void 0}function fl(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Tv(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 Kf=Symbol("evaluating");function wv(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Kf)return;if(n===void 0)n=Kf,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function QC(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function zr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function pl(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function kn(e){return pl(e._zod.def)??e._zod.def.shape}function Cv(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return zr(this,t,n),n},enumerable:!0,configurable:!0})}function Rv(e,t,r){if(t in e)zr(e,t,r);else e[t]=r}function Oo(e,t,r,n){let o=kn(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Cv(e,i,()=>{let l=t._zod.def.shape[i];return n?n(l,i):l});else Rv(e,i,n?n(s.value,i):s.value)}}function eR(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Cv(e,r,()=>t[r]);else Rv(e,r,n.value)}}function Mn(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function tR(e){return Mn(e._zod.def)}function rR(e,t){if(!t)return e;return t.reduce((r,n)=>r?.[n],e)}function nR(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 oR(e=10){let r="";for(let n=0;n<e;n++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function Av(e){return JSON.stringify(e)}function Iv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Eu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ri(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Pv=Us(()=>{if(Vr.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Mo(e){if(Ri(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(Ri(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function iR(e){if(Mo(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 sR(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var aR=(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}`)}},kv=new Set(["string","number","symbol"]),lR=new Set(["string","number","bigint","boolean","symbol","undefined"]);function $o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $n(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 cR(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 bu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Nv(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Tu=(()=>({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]}))(),Ov={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function uR(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 Oo(i,e,hl(e,t)),$n(e,Mn(r,{shape:i,checks:[]}))}function hl(e,t){let r=kn(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 dR(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(hl(e,t)),s={};return Oo(s,e,Reflect.ownKeys(kn(e)).filter((l)=>!i.has(l))),$n(e,Mn(r,{shape:s,checks:[]}))}function fR(e,t){if(!Mo(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=kn(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 $n(e,Mn(e._zod.def,{shape:Mv(e,t)}))}function Mv(e,t){let r={};return Oo(r,e,Reflect.ownKeys(kn(e))),eR(r,t),r}function pR(e,t){if(!Mo(t))throw Error("Invalid input to safeExtend: expected a plain object");return $n(e,Mn(e._zod.def,{shape:Mv(e,t)}))}function hR(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={};Oo(r,e,Reflect.ownKeys(kn(e))),Oo(r,t,Reflect.ownKeys(kn(t)));let n=Mn(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return $n(e,n)}function mR(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(hl(t,r)):void 0,a={};return Oo(a,t,Reflect.ownKeys(kn(t)),e&&((c,u)=>l&&!l.has(u)?c:new e({type:"optional",innerType:c}))),$n(t,Mn(t._zod.def,{shape:a,checks:[]}))}function gR(e,t,r){let n=r?new Set(hl(t,r)):void 0,o={};return Oo(o,t,Reflect.ownKeys(kn(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),$n(t,Mn(t._zod.def,{shape:o}))}function sn(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 $v(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 Co(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function pi(e){return typeof e==="string"?e:e?.message}function Dc(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 La(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Nn(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:pi(e.inst?._zod.def?.error?.(e))??pi(i?.(e))??pi(t?.error?.(e))??pi(r.customError?.(e))??pi(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 vR(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var _R=/[\uD800-\uDBFF]/;function ml(e){let t=e.length;if(!_R.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 gl(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Dv(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 Ua(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function yR(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function qv(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 xv(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function SR(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return qv(t+r)}function ER(e){return xv(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function bR(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 TR(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}var wR=class{constructor(...e){}};function Lv(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else RR(e,r,n.value)}}function Do(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Uv(e,t,r){return Do(e,t,r,!1)}function CR(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Do(this,r,n(this))},set(o){Do(this,r,o)}})}return t}function RR(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Do(this,t,r.bind(this))},set(n){Do(this,t,n)}})}function AR(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var vc,oo=!1,IR={configurable:!0,get(){oo=!0;return}};function gt(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&vc!==e._zod){vc=void 0;return}vc=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,IR);let o=oo;oo=!1;try{let i=r(this);if(oo)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return oo=oo||o,i}catch(i){throw delete this[t],oo=oo||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function PR(e,t,r,n){let o=AR(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 Fv="~constantCatch";function kR(e){let t=()=>e;return t[Fv]=!0,t}var Xf,NR=Object.freeze({status:"aborted"}),_c={value:void 0,enumerable:!1},Yf="captureStackTrace"in Error?Error:null;function OR(e){let t=Yf;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Yf=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){_c.value=new i(g);try{Object.defineProperty(h,"_zod",_c)}finally{_c.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),Lv(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?OR(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 Io=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gv=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(Xf=globalThis).__zod_globalConfig??(Xf.__zod_globalConfig={});var Vr=globalThis.__zod_globalConfig;function an(e){if(e)Object.assign(Vr,e);return Vr}function MR(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xa,2)),e.message}function $R(e){this._zod.message=e}var DR={get:MR,set:$R,enumerable:!0,configurable:!0},yc={value:void 0,enumerable:!1},Zf=new WeakSet([Object.prototype,Error.prototype]),Bv=(e,t)=>{e.name="$ZodError",yc.value=t,Object.defineProperty(e,"issues",yc),yc.value=void 0,Object.defineProperty(e,"message",DR);let r=Object.getPrototypeOf(e);if(!Zf.has(r))Zf.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})}})},qR=de("$ZodError",Bv),N4=de("$ZodError",Bv,void 0,{Parent:Error});function xR(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 LR(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)xR(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function UR(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 vl(e,t){return{callee:t?.callee??e,Err:t?.Err}}var wu=(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 Io;if(l.issues.length){let a=new(i?.Err??e)(l.issues.map((c)=>Nn(c,s,an())));throw Eu(a,i?.callee??t),a}return l.value};return t},Cu=(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)=>Nn(c,s,an())));throw Eu(a,i?.callee??t),a}return l.value};return t},Ru=(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 Io;return i.issues.length?Hv(e,i.issues,o):{success:!0,data:i.value}};function Hv(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Nn(o,r,an()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Au=(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?Hv(e,i.issues,o):{success:!0,data:i.value}},FR=Symbol.for("zod.compile.invalid"),GR=Symbol.for("zod.compile.fallback"),BR=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==FR)return!0;if(n.definite===!0&&r===void 0)return!1}return HR(e,t,r)};function HR(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[GR]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new Io;return i.issues.length===0}var VR=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},zR=(e)=>{let t=wu(e),r=(n,o,i,s)=>{let l=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,l,vl(r,s))};return r},jR=(e)=>{let t=wu(e),r=(n,o,i,s)=>t(n,o,i,vl(r,s));return r},WR=(e)=>{let t=Cu(e),r=async(n,o,i,s)=>{let l=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,l,vl(r,s))};return r},JR=(e)=>{let t=Cu(e),r=async(n,o,i,s)=>await t(n,o,i,vl(r,s));return r},KR=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ru(e)(t,r,o)},XR=(e)=>(t,r,n)=>Ru(e)(t,r,n),YR=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Au(e)(t,r,o)},ZR=(e)=>async(t,r,n)=>Au(e)(t,r,n),QR=/^[cC][0-9a-z]{6,}$/,eA=/^[0-9a-z]+$/,tA=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,rA=/^[0-9a-vA-V]{20}$/,nA=/^[A-Za-z0-9]{27}$/,oA=/^[a-zA-Z0-9_-]{21}$/;function iA(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var sA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,aA=/^([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})$/,Qf=(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})$`)},lA=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cA="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function uA(){return new RegExp(cA,"u")}var dA=/^(?:(?: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])$/,fA=/^(([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}|:))$/,pA=/^((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])$/,hA=/^(([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])$/,mA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gA=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,vA=/^https?$/,_A=/^\+[1-9]\d{6,14}$/,Vv="(?:(?:\\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 yA(e){return new RegExp(`^${e}$`)}var SA=yA(Vv);function qc(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 EA(e){return new RegExp(`^${qc(e)}$`)}function bA(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${qc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${qc({precision:e.precision})}`:r;return new RegExp(`^${Vv}T(?:${n})$`)}var TA=/^[\s\S]{0,}$/,wA=/^-?\d+n?$/,CA=/^-?\d+$/,Iu=/^-?\d+(?:\.\d+)?$/,RA=/^(?:true|false)$/i,AA=/^null$/i,IA=/^[^A-Z]*$/,PA=/^[^a-z]*$/,gr=de("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Pu=(e)=>{let t=e.value;return!bv(t)&&t.length!==void 0},Fa={number:"number",bigint:"bigint",object:"date"},zv=de("$ZodCheckLessThan",(e,t)=>{gr.init(e,t);let r=Fa[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Fa[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})}}),jv=de("$ZodCheckGreaterThan",(e,t)=>{gr.init(e,t);let r=Fa[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Fa[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})}}),kA=de("$ZodCheckMultipleOf",(e,t)=>{gr.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):Tv(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})}}),NA=de("$ZodCheckNumberFormat",(e,t)=>{gr.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Tu[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})}}),OA=de("$ZodCheckMaxLength",(e,t)=>{var r;gr.init(e,t),(r=e._zod.def).when??(r.when=Pu),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?ml(o):i)<=t.maximum)return;let l=gl(o);n.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),MA=de("$ZodCheckMinLength",(e,t)=>{var r;gr.init(e,t),(r=e._zod.def).when??(r.when=Pu),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?ml(o):i)>=t.minimum)return;let l=gl(o);n.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$A=de("$ZodCheckLengthEquals",(e,t)=>{var r;gr.init(e,t),(r=e._zod.def).when??(r.when=Pu),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?ml(o):i;if(s===t.length)return;let l=gl(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})}}),_l=de("$ZodCheckStringFormat",(e,t)=>{var r,n;if(gr.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=()=>{})}),DA=de("$ZodCheckRegex",(e,t)=>{_l.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})}}),qA=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=IA),_l.init(e,t)}),xA=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=PA),_l.init(e,t)}),LA=de("$ZodCheckIncludes",(e,t)=>{gr.init(e,t);let r=$o(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})}}),UA=de("$ZodCheckStartsWith",(e,t)=>{gr.init(e,t);let r=new RegExp(`^${$o(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})}}),FA=de("$ZodCheckEndsWith",(e,t)=>{gr.init(e,t);let r=new RegExp(`.*${$o(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})}}),GA=de("$ZodCheckOverwrite",(e,t)=>{gr.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}}),BA=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
61
|
+
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
62
|
+
${t.join(`
|
|
63
|
+
`)}
|
|
64
|
+
};`)(...Object.values(this.closed))}},HA={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=HA;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=sn(l),f;for(let h of a){if(h._zod.def.when){if($v(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 Io;if(f||p instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await p,l.issues.length===g)return;if(La(l.issues,g,e),!u)u=sn(l,g)});else{if(l.issues.length===g)continue;if(La(l.issues,g,e),!u)u=sn(l,g)}}if(f)return f.then(()=>l);return l},s=(l,a,c)=>{if(sn(l))return l.aborted=!0,l;let u=i(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Io;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 Io;return c.then((u)=>i(u,o,a))}return i(c,o,a)}}},{get "~standard"(){return Uv(this,"~standard",Jv(this))},set "~standard"(e){Do(this,"~standard",e)}}),Wv=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Nn(r,t,an()))}:{value:e.value};async function VA(e,t){let r={async:!0};return Wv(await e._zod.run({value:t,issues:[]},r),r)}function Jv(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Wv(n,r)}catch(n){}return VA(e,t)},vendor:"zod",version:1}}var ku=de("$ZodString",(e,t)=>{bt.init(e,t),e._zod.pattern=t.pattern??TA,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)=>{_l.init(e,t),ku.init(e,t)}),zA=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=aA),Nt.init(e,t)}),jA=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=Qf(n))}else t.pattern??(t.pattern=Qf());Nt.init(e,t)}),WA=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lA),Nt.init(e,t)}),Kv=1,Ga=2;function Xv(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function JA(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Xv(e)||Ga;return KA(e,t)}function KA(e,t){if(!t.normalize&&t.protocol?.source===vA.source&&!/^https?:\/\//i.test(e))return Kv;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Ga}return new URL(e)}catch{return Ga}}var XA=/[\t\n\r]/g;function ep(e){return e.replace(XA,"")}function YA(e,t){return t.lastIndex=0,t.test(e.hostname)}function ZA(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var QA=de("$ZodURL",(e,t)=>{Nt.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=JA(n,t);if(o===Kv){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Ga){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=ep(n);return}if(t.hostname&&!YA(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&&!ZA(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:ep(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),eI=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uA()),Nt.init(e,t)}),tI=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?oA:iA(t.length)),Nt.init(e,t)}),rI=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=QR),Nt.init(e,t)}),nI=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=eA),Nt.init(e,t)}),oI=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tA),Nt.init(e,t)}),iI=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rA),Nt.init(e,t)}),sI=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nA),Nt.init(e,t)}),aI=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=bA(t)),Nt.init(e,t)}),lI=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=SA),Nt.init(e,t)}),cI=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=EA(t)),Nt.init(e,t)}),uI=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sA),Nt.init(e,t)}),dI=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dA),Nt.init(e,t)}),fI=/^[0-9a-fA-F:.]+$/;function Yv(e){if(!fI.test(e))return!1;return Xv(`http://[${e}]`)}var pI=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fA),Nt.init(e,t),e._zod.check=(r)=>{if(!Yv(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),hI=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pA),Nt.init(e,t)});function mI(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 Yv(r)}var gI=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hA),Nt.init(e,t),e._zod.check=(r)=>{if(!mI(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Zv(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 Qv=/^[0-9a-zA-Z+/]*={0,2}$/,vI=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qv),Nt.init(e,t),e._zod.check=(r)=>{if(Zv(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Nu=/^[A-Za-z0-9_-]*$/;function _I(e){if(!Nu.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Zv(r)}var yI=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Nu),Nt.init(e,t),e._zod.check=(r)=>{if(_I(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),SI=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_A),Nt.init(e,t)});function EI(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 bI=de("$ZodJWT",(e,t)=>{Nt.init(e,t),e._zod.check=(r)=>{if(EI(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),e_=de("$ZodNumber",(e,t)=>{bt.init(e,t),e._zod.pattern=Iu,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}}),TI=de("$ZodNumberFormat",(e,t)=>{NA.init(e,t),e_.init(e,t)}),wI=de("$ZodBoolean",(e,t)=>{bt.init(e,t),e._zod.pattern=RA,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}}),CI=de("$ZodBigInt",(e,t)=>{bt.init(e,t),e._zod.pattern=wA,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}}),RI=de("$ZodNull",(e,t)=>{bt.init(e,t),e._zod.pattern=AA,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}}),AI=de("$ZodAny",(e,t)=>{bt.init(e,t),e._zod.parse=(r)=>r}),II=de("$ZodUnknown",(e,t)=>{bt.init(e,t),e._zod.parse=(r)=>r}),PI=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)}),kI=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 NI(e,t){let r=Dc(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 Dc(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,La(i.issues,u,e),i}}return o(i,s)}}var OI=(e)=>Array.isArray(e)?e.length:-1;function tp(e,t,r){if(e.issues.length)t.issues.push(...Co(r,e.issues));t.value[r]=e.value}var MI=de("$ZodArray",(e,t)=>{bt.init(e,t);let r=Vr.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)=>tp(f,n,a)));else if(tp(u,n,a),l&&u.issues.length!==0&&sn(u))break}if(s.length)return Promise.all(s).then(()=>n);return n},NI(e,OI)});function Ba(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(...Co(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 $I=[];function t_(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:$I,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=Nv(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function r_(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(sn(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)=>Ba(y,r,p,t,f,h)));else Ba(_,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 DI=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=Us(()=>t_(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))zr(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=Ri,s=t.catchall,l,a=Vr.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(sn(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((T)=>Ba(T,c,y,f,E,b)));else Ba(R,c,y,f,E,b)}if(!s)return h.length?Promise.all(h).then(()=>c):c;return r_(h,f,c,u,o.value,e,p===!0)}}),qI=de("$ZodObjectJIT",(e,t)=>{DI.init(e,t);let r=e._zod.parse,n=Us(()=>t_(t)),o=Vr.memoizer,i=(g)=>{let p=n.value,_=p.symbolKeys,y=new BA(["payload","ctx"],{shape:g,inst:e,memo:o,syms:_}),S=(T)=>`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`,E=(T,w)=>`
|
|
65
|
+
let ${T}_ab = false;
|
|
66
|
+
for (let i = 0; i < ${T}.issues.length; i++) {
|
|
67
|
+
const iss = ${T}.issues[i];
|
|
68
|
+
iss.path = iss.path ? [${w}, ...iss.path] : [${w}];
|
|
69
|
+
payload.issues.push(iss);
|
|
70
|
+
if (iss.continue !== true) ${T}_ab = true;
|
|
71
|
+
}
|
|
72
|
+
if (${T}_ab && ctx && ctx.abortEarly) {
|
|
73
|
+
payload.value = newResult;
|
|
74
|
+
return payload;
|
|
75
|
+
}`;y.write("const input = payload.value;");let b=Object.create(null),R=0;for(let T of p.allKeys)b[T]=`key_${R++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let T of p.allKeys){if(T==="__proto__")continue;let w=b[T],C=typeof T==="symbol"?`syms[${_.indexOf(T)}]`:Av(T),A=`${C} in input`,P=g[T],D=P?._zod?.optin,N=D!==void 0,F=P?._zod?.optout==="optional";if(y.write(`const ${w} = ${S(C)};`),N&&F){let G=D==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;y.write(`
|
|
76
|
+
const ${w}_present = ${A};
|
|
77
|
+
if (!${w}.issues.length || ${w}_present) {
|
|
78
|
+
if (${w}.issues.length) {${E(w,C)}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (${G}) {
|
|
82
|
+
newResult[${C}] = ${w}.value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
`)}else if(!N)y.write(`
|
|
87
|
+
const ${w}_present = ${A};
|
|
88
|
+
if (${w}.issues.length) {${E(w,C)}
|
|
89
|
+
}
|
|
90
|
+
if (!${w}_present && !${w}.issues.length) {
|
|
91
|
+
payload.issues.push({
|
|
92
|
+
code: "invalid_type",
|
|
93
|
+
expected: "nonoptional",
|
|
94
|
+
input: undefined,
|
|
95
|
+
path: [${C}]
|
|
96
|
+
});
|
|
97
|
+
if (ctx && ctx.abortEarly) {
|
|
98
|
+
payload.value = newResult;
|
|
99
|
+
return payload;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (${w}_present) {
|
|
104
|
+
newResult[${C}] = ${w}.value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
`);else if(y.write(`
|
|
108
|
+
if (${w}.issues.length) {${E(w,C)}
|
|
109
|
+
}
|
|
110
|
+
`),D==="defaulted")y.write(`newResult[${C}] = ${w}.value;`);else y.write(`
|
|
111
|
+
if (${w}.value !== undefined || ${A}) {
|
|
112
|
+
newResult[${C}] = ${w}.value;
|
|
113
|
+
}
|
|
114
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,l=Ri,a=!Vr.jitless,u=a&&Pv.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 r_([],_,g,p,h,e,p?.abortEarly===!0)}return r(g,p)}});function rp(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)=>!sn(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)=>Nn(s,n,an())))}),t}var n_=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)=>fl(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 rp(s,n,e,o);return Promise.all(s).then((l)=>rp(l,n,e,o))}});function xI(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 LI=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,n_.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))zr(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=pl(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=Us(()=>xI(t));e._zod.parse=(o,i)=>{let s=o.value;if(!Ri(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}}),UI=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])=>np(r,a,c));return np(r,i,s)}});function xc(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(Mo(e)&&Mo(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=xc(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=xc(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 np(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=xc(t.value,r.value);if(!a.valid){if(sn(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var FI=de("$ZodRecord",(e,t)=>{bt.init(e,t);let r=Vr.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Mo(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)=>Nn(p,o,an())),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(...Co(u,p.issues));n.value[h]=p.value}));else{if(g.issues.length)n.issues.push(...Co(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"&&Iu.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)=>Nn(p,o,an())),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(...Co(c,p.issues));n.value[h]=p.value}));else{if(g.issues.length)n.issues.push(...Co(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}}),GI=de("$ZodEnum",(e,t)=>{bt.init(e,t);let r=qa(t.entries),n=new Set(r);e._zod.values=n,gt(e,"pattern",(o)=>{let i=qa(o.def.entries).filter((s)=>kv.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>$o(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}}),BI=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"?$o(i):i?$o(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}}),HI=de("$ZodTransform",(e,t)=>{bt.init(e,t),e._zod.optin="optional",Vr.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gv(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 Io;return r.value=o,r}});function op(e,t){return e.value=t.issues.length?void 0:t.value,e}var o_=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(`^(${fl(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)=>op(r,i));return op(r,o)}return t.innerType._zod.run(r,n)}}),VI=de("$ZodExactOptional",(e,t)=>{o_.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)}),zI=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(`^(${fl(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)}}),jI=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)=>ip(i,t));return ip(o,t)}});function ip(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var WI=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)}}),JI=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)=>sp(i,e));return sp(o,e)}});function sp(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 ap(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)=>Nn(o,n,an()))},input:e.value}),e}var KI=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)=>ap(r,i,t,n));return ap(r,o,t,n)}}),i_=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)=>pa(s,t.in,n));return pa(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>pa(i,t.out,n));return pa(o,t.out,n)}});function pa(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 XI=de("$ZodPreprocess",(e,t)=>{i_.init(e,t)}),YI=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(lp);return lp(o)}});function lp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var ZI=de("$ZodLazy",(e,t)=>{bt.init(e,t),wv(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)}),QI=de("$ZodCustom",(e,t)=>{gr.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)=>cp(i,r,n,e));cp(o,r,n,e);return}});function cp(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(Ua(o))}}var eP=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}},Lc="~memo",up=[];function s_(e){return e!==null&&typeof e==="object"}function Sc(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var a_=new WeakMap,_s=0,Na=1,Ss=2;function Oa(e,t,r){let n=a_.get(e);if(n!==void 0)return n?Ss:_s;if(t.has(e))return Ss;t.add(e);let o=_s,i=(u)=>{if(o!==Ss&&u?._zod){let f=Oa(u,t,r);if(f>o)o=f}},s=(u,f)=>{let h=_s;for(let g of Reflect.ownKeys(u)){let p=Object.getOwnPropertyDescriptor(u,g);if(f&&!p.enumerable)continue;let _=p.get?Na:p.value?._zod?Oa(p.value,t,r):_s;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=pl(a);l(u?s(u,!0):Na),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?Oa(u,t,!1):Na);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),tP(e,o)}function tP(e,t){if(t!==Na)a_.set(e,t===Ss);return t}function rP(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ha,ma=[],nP={alloc(e,t,r){let n=ha;if(!n)return r;ha=void 0;let o={value:r,issues:null};return n.set(t.value,o),ma.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"&&iP(i,o.value))throw new eP;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=Oa(e,new Set,!1);if(S===_s){if(e._zod.parse=s,e._zod.run===l)e._zod.run=s;return s(a,c)}if(S===Ss||n)r=!0;else n=!0}let u=a.value;if(!s_(u))return s(a,c);let f=c[Lc];if(!f)f={buckets:new WeakMap,backEdges:void 0},c[Lc]=f;let h;if(o===c)h=i;else h=rP(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(...Sc(g.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(g.value);return a}ha=h;let p=ma.length,_=s(a,c);ha=void 0;let y=ma.length>p?ma.pop():void 0;if(_ instanceof Promise)return _.then((S)=>{if(y)y.issues=S.issues.length?Sc(S.issues):up;return S});if(y)y.issues=_.issues.length?Sc(_.issues):up;return _};if(e._zod.parse=l,e._zod.run===s)e._zod.run=l})}};function oP(){return nP}function iP(e,t){let r=e[Lc]?.backEdges;return r!==void 0&&s_(t)&&r.has(t)}var sP=()=>{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=Dv(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 ${bu(i.values[0])}`;return`Invalid option: expected one of ${$c(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":""}: ${$c(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 aP(){return{localeError:sP()}}var dp,lP=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 cP(){return new lP}(dp=globalThis).__zod_globalRegistry??(dp.__zod_globalRegistry=cP());var ys=globalThis.__zod_globalRegistry;function yl(e){if(e.checks)e.checks=[...e.checks];return e}function uP(e,t){return new e(yl({type:"string",...Fe(t)}))}function dP(e,t){return new e(yl({type:"string",coerce:!0,...Fe(t)}))}function l_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Fe(t)})}function fP(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Fe(t)})}function pP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Fe(t)})}function hP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Fe(t)})}function mP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Fe(t)})}function gP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Fe(t)})}function c_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Fe(t)})}function vP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Fe(t)})}function _P(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Fe(t)})}function yP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Fe(t)})}function SP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Fe(t)})}function EP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Fe(t)})}function bP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Fe(t)})}function TP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Fe(t)})}function wP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Fe(t)})}function CP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Fe(t)})}function RP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Fe(t)})}function AP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Fe(t)})}function IP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Fe(t)})}function PP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Fe(t)})}function kP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Fe(t)})}function NP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Fe(t)})}function u_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Fe(t)})}function d_(e,t){return new e({type:"string",format:"date",check:"string_format",...Fe(t)})}function f_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Fe(t)})}function p_(e,t){return new e({type:"string",format:"duration",check:"string_format",...Fe(t)})}function OP(e,t){return new e(yl({type:"number",checks:[],...Fe(t)}))}function MP(e,t){return new e(yl({type:"number",coerce:!0,checks:[],...Fe(t)}))}function $P(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Fe(t)})}function DP(e,t){return new e({type:"boolean",...Fe(t)})}function qP(e,t){return new e({type:"boolean",coerce:!0,...Fe(t)})}function xP(e,t){return new e({type:"bigint",coerce:!0,...Fe(t)})}function LP(e,t){return new e({type:"null",...Fe(t)})}function UP(e){return new e({type:"any"})}function FP(e){return new e({type:"unknown"})}function GP(e,t){return new e({type:"never",...Fe(t)})}function BP(e,t){return new e({type:"date",coerce:!0,...Fe(t)})}function Ha(e,t){return new zv({check:"less_than",...Fe(t),value:e,inclusive:!1})}function Po(e,t){return new zv({check:"less_than",...Fe(t),value:e,inclusive:!0})}function Va(e,t){return new jv({check:"greater_than",...Fe(t),value:e,inclusive:!1})}function ko(e,t){return new jv({check:"greater_than",...Fe(t),value:e,inclusive:!0})}function Uc(e,t){return new kA({check:"multiple_of",...Fe(t),value:e})}function h_(e,t){return new OA({check:"max_length",...Fe(t),maximum:e})}function za(e,t){return new MA({check:"min_length",...Fe(t),minimum:e})}function m_(e,t){return new $A({check:"length_equals",...Fe(t),length:e})}function HP(e,t){return new DA({check:"string_format",format:"regex",...Fe(t),pattern:e})}function VP(e){return new qA({check:"string_format",format:"lowercase",...Fe(e)})}function zP(e){return new xA({check:"string_format",format:"uppercase",...Fe(e)})}function jP(e,t){return new LA({check:"string_format",format:"includes",...Fe(t),includes:e})}function WP(e,t){return new UA({check:"string_format",format:"starts_with",...Fe(t),prefix:e})}function JP(e,t){return new FA({check:"string_format",format:"ends_with",...Fe(t),suffix:e})}function Di(e){return new GA({check:"overwrite",tx:e})}function KP(e){return Di((t)=>t.normalize(e))}function XP(){return Di((e)=>e.trim())}function YP(){return Di((e)=>e.toLowerCase())}function ZP(){return Di((e)=>e.toUpperCase())}function QP(){return Di((e)=>Iv(e))}function ek(e,t,r){return new e({type:"array",element:t,...Fe(r)})}function tk(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Fe(r)})}function rk(e,t){let r=nk((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(Ua(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(Ua(i))}},e(n.value,n)),t);return r}function nk(e,t){let r=new gr({check:"custom",...Fe(t)});return r._zod.check=e,r}function Es(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))zr(e,n,r[n]);return e}function ja(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??ys,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 Qt(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)Es(s.schema,a);if(t.io==="input"&&cr(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 fp(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wa(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}/${fp(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+fp(u)}},i=(s)=>{if(s[1].schema.$ref)return;let l=s[1],{ref:a,defId:c}=o(s);if(l.def={...l.schema},c)l.defId=c;let u=l.schema;for(let f in u)delete u[f];u.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let l=s[1];if(l.cycle)throw Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
115
|
+
|
|
116
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let l=s[1];if(t===s[0]){i(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(l.cycle){i(s);continue}if(l.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function g_(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;g_(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 v_=new Set(["type","properties","required","additionalProperties"]),pp=["oneOf","anyOf"];function hp(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 Fc(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!v_.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]??hp(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]:Fc(l)??{allOf:l};zr(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=hp(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 ok(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of v_)if(o in e)return;let r=t.filter((o)=>pp.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Fc(t);else{let o=r[0],i=pp.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)=>Fc([...s,a]));if(l.some((a)=>!a))return;n={[i]:l}}if(!n)return;delete e.allOf,Es(e,n)}function Ja(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 Es(c,p);if(Es(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())g_(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)??[])ok(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)}Es(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;zr(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:Ka(t,"input",e.processors),output:Ka(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch(l){throw Error("Error converting schema to JSON.")}}function cr(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 cr(n.element,r);if(n.type==="set")return cr(n.valueType,r);if(n.type==="lazy")return cr(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 cr(n.innerType,r);if(n.type==="intersection")return cr(n.left,r)||cr(n.right,r);if(n.type==="record"||n.type==="map")return cr(n.keyType,r)||cr(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return cr(n.in,r)||cr(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(cr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(cr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(cr(o,r))return!0;if(n.rest&&cr(n.rest,r))return!0;return!1}return!1}var ik=(e,t={})=>(r)=>{let n=ja({...r,processors:t});return At(e,n),Wa(n,e),Ja(n,e)},Ka=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=ja({...o??{},target:i,io:t,processors:r});return At(e,s),Wa(s,e),Ja(s,e)},Ai=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ii=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},mp=(e,t)=>{Ai(e,"minimum",t),Ii(e,"maximum",t)},__=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},y_=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},S_=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},E_=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},gp=(e,t)=>Ai(e,"minimum",t.minimum),vp=(e,t)=>Ii(e,"maximum",t.maximum),_p=(e)=>(t,r)=>{E_(t,r.format);let[n,o]=e[r.format];Ai(t,"minimum",n),Ii(t,"maximum",o)},sk={greater_than:(e,t)=>Ai(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ii(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>__(e,t.value),number_format:_p(Tu),bigint_format:_p(Ov),min_length:gp,max_length:vp,length_equals:(e,t)=>mp(e,t.length),min_size:gp,max_size:vp,size_equals:(e,t)=>mp(e,t.size),string_format:(e,t)=>{if(E_(e,t.format),t.pattern)y_(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)=>S_(e,t.mime)};function zt(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)sk[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)Ai(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)Ai(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Ii(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Ii(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)__(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)S_(t,o.mime);for(let i of o.patterns??[])y_(t,i);return t}var ak={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},lk=new Map([[Qv,mA],[Nu,gA]]),b_=(e)=>lk.get(e)??e,T_=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:l,patterns:a,contentEncoding:c,laxFormat:u}=zt(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(l){if(o.format=ak[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(b_);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}))]}},w_=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:l,exclusiveMaximum:a,exclusiveMinimum:c,isInt:u}=zt(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 Qt(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}))]}},C_=(e,t,r,n)=>{r.type="boolean"},R_=(e,t,r,n)=>{Qt(e,t,r,n,"BigInt cannot be represented in JSON Schema")},ck=(e,t,r,n)=>{Qt(e,t,r,n,"Symbols cannot be represented in JSON Schema")},A_=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},uk=(e,t,r,n)=>{Qt(e,t,r,n,"Undefined cannot be represented in JSON Schema")},dk=(e,t,r,n)=>{Qt(e,t,r,n,"Void cannot be represented in JSON Schema")},I_=(e,t,r,n)=>{r.not={}},P_=(e,t,r,n)=>{},k_=(e,t,r,n)=>{},N_=(e,t,r,n)=>{Qt(e,t,r,n,"Date cannot be represented in JSON Schema")},O_=(e,t,r,n)=>{let o=e._zod.def,i=qa(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},M_=(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(Qt(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Qt(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}},fk=(e,t,r,n)=>{Qt(e,t,r,n,"NaN cannot be represented in JSON Schema")},pk=(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},hk=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:l}=zt(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}))},mk=(e,t,r,n)=>{r.type="boolean"},$_=(e,t,r,n)=>{Qt(e,t,r,n,"Custom types cannot be represented in JSON Schema")},gk=(e,t,r,n)=>{Qt(e,t,r,n,"Function types cannot be represented in JSON Schema")},D_=(e,t,r,n)=>{Qt(e,t,r,n,"Transforms cannot be represented in JSON Schema")},vk=(e,t,r,n)=>{Qt(e,t,r,n,"Map cannot be represented in JSON Schema")},_k=(e,t,r,n)=>{Qt(e,t,r,n,"Set cannot be represented in JSON Schema")},q_=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:l}=zt(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 Rs(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Rs(t.out);if(t.type==="catch")return Rs(t.innerType);return e._zod.optin}var x_=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Qt(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in s)zr(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"?Rs(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"]})},L_=(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},U_=(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)},yk=(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"?Rs(_)!==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}=zt(e);if(typeof g==="number")o.minItems=g;if(typeof p==="number")o.maxItems=p};function Gc(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 _=Gc(e,p,r);return _===p?t:_}for(let p of["anyOf","oneOf"]){let _=t[p];if(!Array.isArray(_))continue;let y=_.map((S)=>Gc(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")?Iu:CA).source;return g}var Bc=new WeakMap;function Sk(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 Bc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Gc(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 F_=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,l=zt(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)zr(o.patternProperties,b_(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=Bc.get(t);if(!u)u=[],Bc.set(t,u),t.deferred.push(()=>Sk(t));u.push(e)}o.additionalProperties=At(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,c=t.io==="input"&&Rs(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)}},G_=(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"}]},B_=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ou=Symbol();function H_(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 Qt(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Ou}var V_=(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=H_(o.defaultValue,e,t,r,n);if(s!==Ou)r.default=s},z_=(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=H_(o.defaultValue,e,t,r,n);if(s!==Ou)r._prefault=s},j_=(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{Qt(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},W_=(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},J_=(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},Ek=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Mu=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},K_=(e,t,r,n)=>{let o=e._zod.innerType;At(o,t,n);let i=t.seen.get(e);i.ref=o},yp={string:T_,number:w_,boolean:C_,bigint:R_,symbol:ck,null:A_,undefined:uk,void:dk,never:I_,any:P_,unknown:k_,date:N_,enum:O_,literal:M_,nan:fk,template_literal:pk,file:hk,success:mk,custom:$_,function:gk,transform:D_,map:vk,set:_k,array:q_,object:x_,union:L_,intersection:U_,tuple:yk,record:F_,nullable:G_,nonoptional:B_,default:V_,prefault:z_,catch:j_,pipe:W_,readonly:J_,promise:Ek,optional:Mu,lazy:K_};function X_(e,t){if("_idmap"in e){let n=e,o=ja({...t,processors:yp}),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;Wa(o,u),zr(s,c,Ja(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=ja({...t,processors:yp});return At(e,r),Wa(r,e),Ja(r,e)}var Sp=new WeakSet([Object.prototype,Error.prototype]);function ga(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 bk=(e,t)=>{qR.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Sp.has(r))return;Sp.add(r),ga(r,"format",(n)=>(o)=>UR(n,o)),ga(r,"flatten",(n)=>(o)=>LR(n,o)),ga(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,xa,2)}),ga(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,xa,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},Mr=de("ZodError",bk,void 0,{Parent:Error}),Tk=wu(Mr),wk=Cu(Mr),Y_=Ru(Mr),Ck=Au(Mr),Rk=zR(Mr),Ak=jR(Mr),Ik=WR(Mr),Pk=JR(Mr),kk=KR(Mr),Nk=XR(Mr),Ok=YR(Mr),Mk=ZR(Mr);function $k(){if(!Vr.localeError)an(aP())}function Sl(){if(!Vr.memoizer)an({memoizer:oP()})}var Tt=de("ZodType",(e,t)=>($k(),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 $n(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(RN(e,t))},superRefine(e,t){return this.check(AN(e,t))},overwrite(e){return this.check(Di(e))},optional(){return De(this)},exactOptional(){return fN(this)},nullable(){return Tp(this)},nullish(){return De(Tp(this))},nonoptional(e){return _N(this,e)},array(){return ie(this)},or(e){return ke([this,e])},and(e){return qo(this,e)},transform(e){return wp(this,sy(e))},default(e){return mN(this,e)},prefault(e){return vN(this,e)},catch(e){return SN(this,e)},pipe(e){return wp(this,e)},readonly(){return TN(this)},describe(e){let t=this.clone();return ys.add(t,{description:e}),t},meta(...e){if(e.length===0)return ys.get(this);let t=this.clone();return ys.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",{...Jv(this),jsonSchema:{input:Ka(this,"input"),output:Ka(this,"output")}})},set "~standard"(e){rt.own(this,"~standard",e)},parse:function e(t,r){return Tk(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await wk(this,t,r,{callee:e})},safeParse(e,t){return Y_(this,e,t)},async safeParseAsync(e,t){return Ck(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){rt.own(this,"spa",e)},validate(e,t){return BR(this,e,t)},validateAsync(e,t){return VR(this,e,t)},encode:function e(t,r){return Rk(this,t,r,{callee:e})},decode:function e(t,r){return Ak(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ik(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Pk(this,t,r,{callee:e})},safeEncode(e,t){return kk(this,e,t)},safeDecode(e,t){return Nk(this,e,t)},async safeEncodeAsync(e,t){return Ok(this,e,t)},async safeDecodeAsync(e,t){return Mk(this,e,t)},toJSONSchema(e){return ik(this,{})(e)},get description(){return ys.get(this)?.description},get _def(){return this._zod.def}}),Z_=de("_ZodString",(e,t)=>{ku.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>T_(e,r,n,o)},rt.derived({format:(e)=>zt(e).format??null,minLength:(e)=>zt(e).minimum??null,maxLength:(e)=>zt(e).maximum??null},{regex(...e){return this.check(HP(...e))},includes(...e){return this.check(jP(...e))},startsWith(...e){return this.check(WP(...e))},endsWith(...e){return this.check(JP(...e))},min(...e){return this.check(za(...e))},max(...e){return this.check(h_(...e))},length(...e){return this.check(m_(...e))},nonempty(...e){return this.check(za(1,...e))},lowercase(e){return this.check(VP(e))},uppercase(e){return this.check(zP(e))},trim(){return this.check(XP())},normalize(...e){return this.check(KP(...e))},toLowerCase(){return this.check(YP())},toUpperCase(){return this.check(ZP())},slugify(){return this.check(QP())}})),Q_=de("ZodString",(e,t)=>{ku.init(e,t),Z_.init(e,t)},{email(e){return this.check(l_(ey,e))},url(e){return this.check(c_(ty,e))},jwt(e){return this.check(NP(Yk,e))},emoji(e){return this.check(vP(xk,e))},guid(e){return this.check(fP(qk,e))},uuid(e){return this.check(pP(va,e))},uuidv4(e){return this.check(hP(va,e))},uuidv6(e){return this.check(mP(va,e))},uuidv7(e){return this.check(gP(va,e))},nanoid(e){return this.check(_P(Lk,e))},cuid(e){return this.check(yP(Uk,e))},cuid2(e){return this.check(SP(Fk,e))},ulid(e){return this.check(EP(Gk,e))},base64(e){return this.check(IP(Jk,e))},base64url(e){return this.check(PP(Kk,e))},xid(e){return this.check(bP(Bk,e))},ksuid(e){return this.check(TP(Hk,e))},ipv4(e){return this.check(wP(Vk,e))},ipv6(e){return this.check(CP(zk,e))},cidrv4(e){return this.check(RP(jk,e))},cidrv6(e){return this.check(AP(Wk,e))},e164(e){return this.check(kP(Xk,e))},datetime(e){return this.check(u_($u,e))},date(e){return this.check(d_(Du,e))},time(e){return this.check(f_(qu,e))},duration(e){return this.check(p_(xu,e))}});function k(e){return uP(Q_,e)}var Ot=de("ZodStringFormat",(e,t)=>{Nt.init(e,t),Z_.init(e,t)}),$u=de("ZodISODateTime",(e,t)=>{aI.init(e,t),Ot.init(e,t)}),Du=de("ZodISODate",(e,t)=>{lI.init(e,t),Ot.init(e,t)}),qu=de("ZodISOTime",(e,t)=>{cI.init(e,t),Ot.init(e,t)}),xu=de("ZodISODuration",(e,t)=>{uI.init(e,t),Ot.init(e,t)}),ey=de("ZodEmail",(e,t)=>{WA.init(e,t),Ot.init(e,t)});function Dk(e){return l_(ey,e)}var qk=de("ZodGUID",(e,t)=>{zA.init(e,t),Ot.init(e,t)}),va=de("ZodUUID",(e,t)=>{jA.init(e,t),Ot.init(e,t)}),ty=de("ZodURL",(e,t)=>{QA.init(e,t),Ot.init(e,t)});function ry(e){return c_(ty,e)}var xk=de("ZodEmoji",(e,t)=>{eI.init(e,t),Ot.init(e,t)}),Lk=de("ZodNanoID",(e,t)=>{tI.init(e,t),Ot.init(e,t)}),Uk=de("ZodCUID",(e,t)=>{rI.init(e,t),Ot.init(e,t)}),Fk=de("ZodCUID2",(e,t)=>{nI.init(e,t),Ot.init(e,t)}),Gk=de("ZodULID",(e,t)=>{oI.init(e,t),Ot.init(e,t)}),Bk=de("ZodXID",(e,t)=>{iI.init(e,t),Ot.init(e,t)}),Hk=de("ZodKSUID",(e,t)=>{sI.init(e,t),Ot.init(e,t)}),Vk=de("ZodIPv4",(e,t)=>{dI.init(e,t),Ot.init(e,t)}),zk=de("ZodIPv6",(e,t)=>{pI.init(e,t),Ot.init(e,t)}),jk=de("ZodCIDRv4",(e,t)=>{hI.init(e,t),Ot.init(e,t)}),Wk=de("ZodCIDRv6",(e,t)=>{gI.init(e,t),Ot.init(e,t)}),Jk=de("ZodBase64",(e,t)=>{vI.init(e,t),Ot.init(e,t)}),Kk=de("ZodBase64URL",(e,t)=>{yI.init(e,t),Ot.init(e,t)}),Xk=de("ZodE164",(e,t)=>{SI.init(e,t),Ot.init(e,t)}),Yk=de("ZodJWT",(e,t)=>{bI.init(e,t),Ot.init(e,t)}),Lu=de("ZodNumber",(e,t)=>{e_.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>w_(e,r,n,o),e.isFinite=!0},rt.derived({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=zt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=zt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=zt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>zt(e).format??null},{gt(e,t){return this.check(Va(e,t))},gte(e,t){return this.check(ko(e,t))},min(e,t){return this.check(ko(e,t))},lt(e,t){return this.check(Ha(e,t))},lte(e,t){return this.check(Po(e,t))},max(e,t){return this.check(Po(e,t))},int(e){return this.check(Ep(e))},safe(e){return this.check(Ep(e))},positive(e){return this.check(Va(0,e))},nonnegative(e){return this.check(ko(0,e))},negative(e){return this.check(Ha(0,e))},nonpositive(e){return this.check(Po(0,e))},multipleOf(e,t){return this.check(Uc(e,t))},step(e,t){return this.check(Uc(e,t))},finite(){return this}}));function Ee(e){return OP(Lu,e)}var Zk=de("ZodNumberFormat",(e,t)=>{TI.init(e,t),Lu.init(e,t)});function Ep(e){return $P(Zk,e)}var ny=de("ZodBoolean",(e,t)=>{wI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>C_(e,r,n,o)});function Pe(e){return DP(ny,e)}var Qk=de("ZodBigInt",(e,t)=>{CI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>R_(e,r,n,o)},rt.derived({minValue:(e)=>zt(e).minimum??null,maxValue:(e)=>zt(e).maximum??null,format:(e)=>zt(e).format??null},{gte(e,t){return this.check(ko(e,t))},min(e,t){return this.check(ko(e,t))},gt(e,t){return this.check(Va(e,t))},lt(e,t){return this.check(Ha(e,t))},lte(e,t){return this.check(Po(e,t))},max(e,t){return this.check(Po(e,t))},positive(e){return this.check(Va(BigInt(0),e))},negative(e){return this.check(Ha(BigInt(0),e))},nonpositive(e){return this.check(Po(BigInt(0),e))},nonnegative(e){return this.check(ko(BigInt(0),e))},multipleOf(e,t){return this.check(Uc(e,t))}})),eN=de("ZodNull",(e,t)=>{RI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>A_(e,r,n,o)});function As(e){return LP(eN,e)}var tN=de("ZodAny",(e,t)=>{AI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>P_(e,r,n,o)});function rN(){return UP(tN)}var nN=de("ZodUnknown",(e,t)=>{II.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>k_(e,r,n,o)});function qe(){return FP(nN)}var oN=de("ZodNever",(e,t)=>{PI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>I_(e,r,n,o)});function iN(e){return GP(oN,e)}var sN=de("ZodDate",(e,t)=>{kI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>N_(e,r,n,o),e.min=(r,n)=>e.check(ko(r,n)),e.max=(r,n)=>e.check(Po(r,n))},rt.derived({minDate:(e)=>{let{minimum:t}=zt(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=zt(e);return t?new Date(t):null}},{})),aN=de("ZodArray",(e,t)=>{Sl(),MI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>q_(e,r,n,o),e.element=t.element},{min(e,t){return this.check(za(e,t))},nonempty(e){return this.check(za(1,e))},max(e,t){return this.check(h_(e,t))},length(e,t){return this.check(m_(e,t))},unwrap(){return this.element}});function ie(e,t){return ek(aN,e,t)}var oy=de("ZodObject",(e,t)=>{Sl(),qI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>x_(e,r,n,o),rt.installLazyProp(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return We(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:qe()}))},loose(){return this.clone(rt.mergeDefs(this._zod.def,{catchall:qe()}))},strict(){return this.clone(rt.mergeDefs(this._zod.def,{catchall:iN()}))},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(ay,this,e[0])},exactPartial(...e){return rt.partial(ly,this,e[0],"exactPartial")},required(...e){return rt.required(cy,this,e[0])}});function X(e,t){let r={type:"object",shape:e??{},...rt.normalizeParams(t)};return new oy(r)}function Ge(e,t){return new oy({type:"object",shape:e,catchall:qe(),...rt.normalizeParams(t)})}var iy=de("ZodUnion",(e,t)=>{n_.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>L_(e,r,n,o),e.options=t.options});function ke(e,t){return new iy({type:"union",options:e,...rt.normalizeParams(t)})}var lN=de("ZodDiscriminatedUnion",(e,t)=>{iy.init(e,t),LI.init(e,t)});function Xa(e,t,r){return new lN({type:"union",options:t,discriminator:e,...rt.normalizeParams(r)})}var cN=de("ZodIntersection",(e,t)=>{UI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>U_(e,r,n,o)});function qo(e,t){return new cN({type:"intersection",left:e,right:t})}var bp=de("ZodRecord",(e,t)=>{Sl(),FI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>F_(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Re(e,t,r){if(!t||!t._zod)return new bp({type:"record",keyType:k(),valueType:e,...rt.normalizeParams(t)});return new bp({type:"record",keyType:e,valueType:t,...rt.normalizeParams(r)})}var Hc=de("ZodEnum",(e,t)=>{GI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(n,o,i)=>O_(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 Hc({...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 Hc({...t,checks:[],...rt.normalizeParams(o),entries:i})}});function We(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Hc({type:"enum",entries:r,...rt.normalizeParams(t)})}var uN=de("ZodLiteral",(e,t)=>{BI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>M_(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ae(e,t){return new uN({type:"literal",values:Array.isArray(e)?e:[e],...rt.normalizeParams(t)})}var dN=de("ZodTransform",(e,t)=>{Sl(),HI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>D_(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gv(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 sy(e){return new dN({type:"transform",transform:e})}var ay=de("ZodOptional",(e,t)=>{o_.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function De(e){return new ay({type:"optional",innerType:e})}var ly=de("ZodExactOptional",(e,t)=>{VI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fN(e){return new ly({type:"optional",innerType:e})}var pN=de("ZodNullable",(e,t)=>{zI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>G_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Tp(e){return new pN({type:"nullable",innerType:e})}var hN=de("ZodDefault",(e,t)=>{jI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>V_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mN(e,t){return new hN({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():rt.shallowClone(t)}})}var gN=de("ZodPrefault",(e,t)=>{WI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>z_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vN(e,t){return new gN({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():rt.shallowClone(t)}})}var cy=de("ZodNonOptional",(e,t)=>{JI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>B_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _N(e,t){return new cy({type:"nonoptional",innerType:e,...rt.normalizeParams(t)})}var yN=de("ZodCatch",(e,t)=>{KI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>j_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function SN(e,t){return new yN({type:"catch",innerType:e,catchValue:typeof t==="function"?t:rt.constantCatch(t)})}var uy=de("ZodPipe",(e,t)=>{i_.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>W_(e,r,n,o),e.in=t.in,e.out=t.out});function wp(e,t){return new uy({type:"pipe",in:e,out:t})}var EN=de("ZodPreprocess",(e,t)=>{uy.init(e,t),XI.init(e,t)}),bN=de("ZodReadonly",(e,t)=>{YI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>J_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function TN(e){return new bN({type:"readonly",innerType:e})}var wN=de("ZodLazy",(e,t)=>{ZI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>K_(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Uu(e){return new wN({type:"lazy",getter:e})}var CN=de("ZodCustom",(e,t)=>{QI.init(e,t),Tt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$_(e,r,n,o)});function RN(e,t={}){return tk(CN,e,t)}function AN(e,t){return rk(e,t)}function Is(e,t){return new EN({type:"pipe",in:sy(e),out:t})}var IN={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"},Cp;Cp||(Cp={});var qi={};Ms(qi,{ZodISODate:()=>Du,ZodISODateTime:()=>$u,ZodISODuration:()=>xu,ZodISOTime:()=>qu,date:()=>kN,datetime:()=>PN,duration:()=>ON,time:()=>NN});function PN(e){return u_($u,e)}function kN(e){return d_(Du,e)}function NN(e){return f_(qu,e)}function ON(e){return p_(xu,e)}var dy={};Ms(dy,{bigint:()=>qN,boolean:()=>DN,date:()=>xN,number:()=>$N,string:()=>MN});function MN(e){return dP(Q_,e)}function $N(e){return MP(Lu,e)}function DN(e){return qP(ny,e)}function qN(e){return xP(Qk,e)}function xN(e){return BP(sN,e)}var Vc="2025-11-25",LN=[Vc,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],UN="io.modelcontextprotocol/related-task",xi="io.modelcontextprotocol/protocolVersion",Fu="io.modelcontextprotocol/clientInfo",Si="io.modelcontextprotocol/serverInfo",Fs="io.modelcontextprotocol/clientCapabilities",Gu="io.modelcontextprotocol/subscriptionId",El="io.modelcontextprotocol/logLevel",bl="2.0",Pi=Uu(()=>ke([k(),Ee(),Pe(),As(),Re(k(),Pi),ie(Pi)])),Lt=Re(k(),Pi),FN=ie(Pi),Bu=ke([k(),Ee().int()]),Hu=k(),fy=X({ttl:Ee().optional()}),py=X({taskId:k()}),Vu=Ge({progressToken:Bu.optional(),[UN]:py.optional()}),rr=X({_meta:Vu.optional()}),Gs=rr.extend({task:fy.optional()}),Ut=X({method:k(),params:rr.loose().optional()}),vr=X({_meta:Vu.optional()}),_r=X({method:k(),params:vr.loose().optional()}),zu=Ge({get[Si](){return Cl.optional().catch(void 0)}}),Ft=Ge({_meta:zu.optional()}),Li=ke([k(),Ee().int()]),ju=X({jsonrpc:ae(bl),id:Li,...Ut.shape}).strict(),Wu=X({jsonrpc:ae(bl),..._r.shape}).strict(),Tl=X({jsonrpc:ae(bl),id:Li,result:Ft}).strict(),wl=X({jsonrpc:ae(bl),id:Li.optional(),error:X({code:Ee().int(),message:k(),data:qe().optional()})}).strict(),hy=ke([ju,Wu,Tl,wl]),GN=ke([Tl,wl]),Ju=Ft.strict(),my=vr.extend({requestId:Li.optional(),reason:k().optional()}),Ku=_r.extend({method:ae("notifications/cancelled"),params:my}),gy=X({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:We(["light","dark"]).optional()}),Ui=X({icons:ie(gy).optional()}),xo=X({name:k(),title:k().optional()}),Cl=xo.extend({...xo.shape,...Ui.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),BN=qo(X({applyDefaults:Pe().optional()}),Lt),HN=Is((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},qo(X({form:BN.optional(),url:Lt.optional()}),Lt.optional())),vy=Ge({list:Lt.optional(),cancel:Lt.optional(),requests:Ge({sampling:Ge({createMessage:Lt.optional()}).optional(),elicitation:Ge({create:Lt.optional()}).optional()}).optional()}),_y=Ge({list:Lt.optional(),cancel:Lt.optional(),requests:Ge({tools:Ge({call:Lt.optional()}).optional()}).optional()}),yy=X({experimental:Re(k(),Lt).optional(),sampling:X({context:Lt.optional(),tools:Lt.optional()}).optional(),elicitation:HN.optional(),roots:X({listChanged:Pe().optional()}).optional(),tasks:vy.optional(),extensions:Re(k(),Lt).optional()}),Sy=rr.extend({protocolVersion:k(),capabilities:yy,clientInfo:Cl}),Ey=Ut.extend({method:ae("initialize"),params:Sy}),Xu=X({experimental:Re(k(),Lt).optional(),logging:Lt.optional(),completions:Lt.optional(),prompts:X({listChanged:Pe().optional()}).optional(),resources:X({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:X({listChanged:Pe().optional()}).optional(),tasks:_y.optional(),extensions:Re(k(),Lt).optional()}),by=Ft.extend({protocolVersion:k(),capabilities:Xu,serverInfo:Cl,instructions:k().optional()}),Ty=_r.extend({method:ae("notifications/initialized"),params:vr.optional()}),wy=Ut.extend({method:ae("server/discover"),params:rr.optional()}),Cy=Ft.extend({supportedVersions:ie(k()),capabilities:Xu,instructions:k().optional()}),Yu=Ut.extend({method:ae("ping"),params:rr.optional()}),Ry=X({progress:Ee(),total:De(Ee()),message:De(k())}),Ay=X({...vr.shape,...Ry.shape,progressToken:Bu}),Zu=_r.extend({method:ae("notifications/progress"),params:Ay}),Iy=rr.extend({cursor:Hu.optional()}),Fi=Ut.extend({params:Iy.optional()}),Gi=Ft.extend({nextCursor:Hu.optional()}),Qu=X({uri:k(),mimeType:De(k()),_meta:Re(k(),qe()).optional()}),ed=Qu.extend({text:k()}),td=k().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),rd=Qu.extend({blob:td}),Bi=We(["user","assistant"]),Go=X({audience:ie(Bi).optional(),priority:Ee().min(0).max(1).optional(),lastModified:qi.datetime({offset:!0}).optional()}),nd=X({...xo.shape,...Ui.shape,uri:k(),description:De(k()),mimeType:De(k()),size:De(Ee()),annotations:Go.optional(),_meta:De(Ge({}))}),Py=X({...xo.shape,...Ui.shape,uriTemplate:k(),description:De(k()),mimeType:De(k()),annotations:Go.optional(),_meta:De(Ge({}))}),ky=Fi.extend({method:ae("resources/list")}),Ny=Gi.extend({resources:ie(nd)}),Oy=Fi.extend({method:ae("resources/templates/list")}),My=Gi.extend({resourceTemplates:ie(Py)}),Rl=rr.extend({uri:k()}),$y=Rl,Dy=Ut.extend({method:ae("resources/read"),params:$y}),qy=Ft.extend({contents:ie(ke([ed,rd]))}),xy=_r.extend({method:ae("notifications/resources/list_changed"),params:vr.optional()}),Ly=Rl,Uy=Ut.extend({method:ae("resources/subscribe"),params:Ly}),Fy=Rl,Gy=Ut.extend({method:ae("resources/unsubscribe"),params:Fy}),od=X({toolsListChanged:Pe().optional(),promptsListChanged:Pe().optional(),resourcesListChanged:Pe().optional(),resourceSubscriptions:ie(k()).optional()}),By=rr.extend({notifications:od}),Hy=Ut.extend({method:ae("subscriptions/listen"),params:By}),Vy=vr.extend({notifications:od}),zy=_r.extend({method:ae("notifications/subscriptions/acknowledged"),params:Vy}),jy=zu.extend({[Gu]:Li}),Wy=Ft.extend({_meta:jy}),Jy=vr.extend({uri:k()}),Ky=_r.extend({method:ae("notifications/resources/updated"),params:Jy}),Xy=X({name:k(),description:De(k()),required:De(Pe())}),Yy=X({...xo.shape,...Ui.shape,description:De(k()),arguments:De(ie(Xy)),_meta:De(Ge({}))}),Zy=Fi.extend({method:ae("prompts/list")}),Qy=Gi.extend({prompts:ie(Yy)}),e0=rr.extend({name:k(),arguments:Re(k(),k()).optional()}),t0=Ut.extend({method:ae("prompts/get"),params:e0}),Al=X({type:ae("text"),text:k(),annotations:Go.optional(),_meta:Re(k(),qe()).optional()}),Il=X({type:ae("image"),data:td,mimeType:k(),annotations:Go.optional(),_meta:Re(k(),qe()).optional()}),Pl=X({type:ae("audio"),data:td,mimeType:k(),annotations:Go.optional(),_meta:Re(k(),qe()).optional()}),r0=X({type:ae("tool_use"),name:k(),id:k(),input:Re(k(),qe()),_meta:Re(k(),qe()).optional()}),n0=X({type:ae("resource"),resource:ke([ed,rd]),annotations:Go.optional(),_meta:Re(k(),qe()).optional()}),o0=nd.extend({type:ae("resource_link")}),kl=ke([Al,Il,Pl,o0,n0]),i0=X({role:Bi,content:kl}),s0=Ft.extend({description:k().optional(),messages:ie(i0)}),a0=_r.extend({method:ae("notifications/prompts/list_changed"),params:vr.optional()}),l0=X({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),c0=X({taskSupport:We(["required","optional","forbidden"]).optional()}),id=X({...xo.shape,...Ui.shape,description:k().optional(),inputSchema:X({type:ae("object"),properties:Re(k(),Pi).optional(),required:ie(k()).optional()}).catchall(qe()),outputSchema:Ge({$schema:k().optional()}).optional(),annotations:l0.optional(),execution:c0.optional(),_meta:Re(k(),qe()).optional()}),u0=Fi.extend({method:ae("tools/list")}),d0=Gi.extend({tools:ie(id)}),sd=Ft.extend({content:ie(kl).default([]),structuredContent:qe().optional(),isError:Pe().optional()}),VN=sd.or(Ft.extend({toolResult:qe()})),f0=Gs.extend({name:k(),arguments:Re(k(),qe()).optional()}),p0=Ut.extend({method:ae("tools/call"),params:f0}),h0=_r.extend({method:ae("notifications/tools/list_changed"),params:vr.optional()}),zN=X({autoRefresh:Pe().default(!0),debounceMs:Ee().int().nonnegative().default(300)}),Ps=We(["debug","info","notice","warning","error","critical","alert","emergency"]),m0=rr.extend({level:Ps}),g0=Ut.extend({method:ae("logging/setLevel"),params:m0}),v0=vr.extend({level:Ps,logger:k().optional(),data:qe()}),_0=_r.extend({method:ae("notifications/message"),params:v0}),y0=X({name:k().optional()}),S0=X({hints:ie(y0).optional(),costPriority:Ee().min(0).max(1).optional(),speedPriority:Ee().min(0).max(1).optional(),intelligencePriority:Ee().min(0).max(1).optional()}),E0=X({mode:We(["auto","required","none"]).optional()}),b0=X({type:ae("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:ie(kl),structuredContent:qe().optional(),isError:Pe().optional(),_meta:Re(k(),qe()).optional()}),T0=Xa("type",[Al,Il,Pl]),ks=Xa("type",[Al,Il,Pl,r0,b0]),w0=X({role:Bi,content:ke([ks,ie(ks)]),_meta:Re(k(),qe()).optional()}),C0=Gs.extend({messages:ie(w0),modelPreferences:S0.optional(),systemPrompt:k().optional(),includeContext:We(["none","thisServer","allServers"]).optional(),temperature:Ee().optional(),maxTokens:Ee().int(),stopSequences:ie(k()).optional(),metadata:Lt.optional(),tools:ie(id).optional(),toolChoice:E0.optional()}),R0=Ut.extend({method:ae("sampling/createMessage"),params:C0}),A0=Ft.extend({model:k(),stopReason:De(We(["endTurn","stopSequence","maxTokens"]).or(k())),role:Bi,content:T0}),I0=Ft.extend({model:k(),stopReason:De(We(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:Bi,content:ke([ks,ie(ks)])}),ad=X({type:ae("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),Nl=X({type:ae("string"),title:k().optional(),description:k().optional(),minLength:Ee().optional(),maxLength:Ee().optional(),format:We(["email","uri","date","date-time"]).optional(),default:k().optional()}),Ya=X({type:We(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Ee().optional(),maximum:Ee().optional(),default:Ee().optional()}),ld=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),cd=X({type:ae("string"),title:k().optional(),description:k().optional(),oneOf:ie(X({const:k(),title:k()})),default:k().optional()}),ud=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),P0=ke([ld,cd]),dd=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({type:ae("string"),enum:ie(k())}),default:ie(k()).optional()}),fd=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({anyOf:ie(X({const:k(),title:k()}))}),default:ie(k()).optional()}),k0=ke([dd,fd]),N0=ke([ud,P0,k0]),pd=ke([N0,ad,Nl,Ya]),Ol=Gs.extend({mode:ae("form").optional(),message:k(),requestedSchema:X({type:ae("object"),properties:Re(k(),pd),required:ie(k()).optional()}).catchall(qe())}),O0=Gs.extend({mode:ae("url"),message:k(),elicitationId:k(),url:k().url()}),M0=ke([Ol,O0]),$0=Ut.extend({method:ae("elicitation/create"),params:M0}),D0=vr.extend({elicitationId:k()}),q0=_r.extend({method:ae("notifications/elicitation/complete"),params:D0}),x0=Ft.extend({action:We(["accept","decline","cancel"]),content:Is((e)=>e===null?void 0:e,Re(k(),ke([k(),Ee(),Pe(),ie(k())])).optional())}),L0=X({type:ae("ref/resource"),uri:k()}),U0=X({type:ae("ref/prompt"),name:k()}),F0=rr.extend({ref:ke([U0,L0]),argument:X({name:k(),value:k()}),context:X({arguments:Re(k(),k()).optional()}).optional()}),G0=Ut.extend({method:ae("completion/complete"),params:F0}),B0=Ft.extend({completion:Ge({values:ie(k()).max(100),total:De(Ee().int()),hasMore:De(Pe())})}),H0=X({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),qe()).optional()}),V0=Ut.extend({method:ae("roots/list"),params:rr.optional()}),z0=Ft.extend({roots:ie(H0)}),j0=_r.extend({method:ae("notifications/roots/list_changed"),params:vr.optional()}),jN=Ge({ttl:Ee().optional(),pollInterval:Ee().optional()}),W0=We(["working","input_required","completed","failed","cancelled"]),Hi=X({taskId:k(),status:W0,ttl:ke([Ee(),As()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:De(Ee()),statusMessage:De(k())}),WN=Ft.extend({task:Hi}),J0=vr.merge(Hi),JN=_r.extend({method:ae("notifications/tasks/status"),params:J0}),KN=Ut.extend({method:ae("tasks/get"),params:rr.extend({taskId:k()})}),XN=Ft.merge(Hi),YN=Ut.extend({method:ae("tasks/result"),params:rr.extend({taskId:k()})}),ZN=Ft.loose(),QN=Fi.extend({method:ae("tasks/list")}),eO=Gi.extend({tasks:ie(Hi)}),tO=Ut.extend({method:ae("tasks/cancel"),params:rr.extend({taskId:k()})}),rO=Ft.merge(Hi),nO=ke([Yu,Ey,wy,G0,g0,t0,Zy,ky,Oy,Dy,Uy,Gy,Hy,p0,u0]),oO=ke([Ku,Zu,Ty,j0]),iO=ke([Ju,A0,I0,x0,z0]),sO=ke([Yu,R0,$0,V0]),aO=ke([Ku,Zu,_0,Ky,xy,h0,a0,zy,q0]),lO=ke([Ju,by,Cy,B0,s0,Qy,Ny,My,qy,sd,d0,Wy]),Zt=ry().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:IN.custom,message:"URL must be parseable",fatal:!0}),NR}).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"}),cO=Ge({resource:k().url(),authorization_servers:ie(Zt).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()}),K0=Ge({issuer:k(),authorization_endpoint:Zt,token_endpoint:Zt,registration_endpoint:Zt.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:Zt.optional(),revocation_endpoint:Zt.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()}),X0=Ge({issuer:k(),authorization_endpoint:Zt,token_endpoint:Zt,userinfo_endpoint:Zt.optional(),jwks_uri:Zt,registration_endpoint:Zt.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:Zt.optional(),op_tos_uri:Zt.optional(),client_id_metadata_document_supported:Pe().optional(),authorization_response_iss_parameter_supported:Pe().optional().catch(void 0)}),uO=X({...X0.shape,...K0.pick({code_challenge_methods_supported:!0}).shape}),dO=X({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:dy.number().optional(),scope:k().optional(),refresh_token:k().optional(),issuer:k().optional().catch(void 0)}).strip(),fO=X({issued_token_type:ae("urn:ietf:params:oauth:token-type:id-jag"),access_token:k(),token_type:k().optional(),expires_in:Ee().optional(),scope:k().optional()}).strip(),pO=X({error:k(),error_description:k().optional(),error_uri:k().optional()}),Rp=Zt.optional().or(ae("").transform(()=>{return})),Y0=X({redirect_uris:ie(Zt),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:Zt.optional(),logo_uri:Rp,scope:k().optional(),contacts:ie(k()).optional(),tos_uri:Rp,policy_uri:k().optional(),jwks_uri:Zt.optional(),jwks:rN().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),Z0=X({client_id:k(),client_secret:k().optional(),client_id_issued_at:Ee().optional(),client_secret_expires_at:Ee().optional(),issuer:k().optional().catch(void 0)}).strip(),hO=Y0.merge(Z0),mO=X({error:k(),error_description:k().optional()}).strip(),gO=X({token:k(),token_type_hint:k().optional()}).strip(),zc=Symbol.for("mcp.sdk.errorBrands");function hd(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,zc,{value:r,enumerable:!1,configurable:!0})}function ki(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,zc)){let r=t[zc];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var O4=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return ki(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 ki(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",hd(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 ki(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 ki(this,e)}constructor(e,t,r,n){super(t,n);this.code=e,this.data=r,this.name="SdkError",hd(this,new.target)}},M4=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 Ap(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function vO(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function _O(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 Q0(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(Ap(o)&&Ap(i)){let s={};for(let[l,a]of Object.entries(o))if(a!==void 0&&i[l]===void 0&&!vO(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 eS="2026-07-28",hi=[eS];function Bs(e){return e>=eS}function yO(e){return e.filter((t)=>!Bs(t))}function Ip(e){return e.filter((t)=>Bs(t))}function tS(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 rS=["task","inputRequests","requestState"];function nS(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||rS.some((t)=>(t in e)))return e;return{...e,content:[]}}function SO(){let e=Uu(()=>ke([k(),Ee(),Pe(),As(),Re(k(),e),ie(e)])),t=Re(k(),e),r=ke([k(),Ee().int()]),n=k(),o=X({ttl:Ee().optional()}),i=X({taskId:k()}),s=Ge({progressToken:r.optional(),"io.modelcontextprotocol/related-task":i.optional()}),l=X({_meta:s.optional()}),a=l.extend({task:o.optional()}),c=X({method:k(),params:l.loose().optional()}),u=X({_meta:s.optional()}),f=X({method:k(),params:u.loose().optional()}),h=Ge({_meta:s.optional()}),g=ke([k(),Ee().int()]),p=h.strict(),_=u.extend({requestId:g.optional(),reason:k().optional()}),y=f.extend({method:ae("notifications/cancelled"),params:_}),S=X({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:We(["light","dark"]).optional()}),E=X({icons:ie(S).optional()}),b=X({name:k(),title:k().optional()}),R=b.extend({...b.shape,...E.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),T=qo(X({applyDefaults:Pe().optional()}),t),w=Is((Vt)=>{if(Vt&&typeof Vt==="object"&&!Array.isArray(Vt)&&Object.keys(Vt).length===0)return{form:{}};return Vt},qo(X({form:T.optional(),url:t.optional()}),t.optional())),C=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({sampling:Ge({createMessage:t.optional()}).optional(),elicitation:Ge({create:t.optional()}).optional()}).optional()}),A=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({tools:Ge({call:t.optional()}).optional()}).optional()}),P=X({experimental:Re(k(),t).optional(),sampling:X({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:X({listChanged:Pe().optional()}).optional(),tasks:C.optional(),extensions:Re(k(),t).optional()}),D=l.extend({protocolVersion:k(),capabilities:P,clientInfo:R}),N=c.extend({method:ae("initialize"),params:D}),F=X({experimental:Re(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:X({listChanged:Pe().optional()}).optional(),resources:X({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:X({listChanged:Pe().optional()}).optional(),tasks:A.optional(),extensions:Re(k(),t).optional()}),G=h.extend({protocolVersion:k(),capabilities:F,serverInfo:R,instructions:k().optional()}),B=f.extend({method:ae("notifications/initialized"),params:u.optional()}),Q=c.extend({method:ae("ping"),params:l.optional()}),pe=X({progress:Ee(),total:De(Ee()),message:De(k())}),se=X({...u.shape,...pe.shape,progressToken:r}),ve=f.extend({method:ae("notifications/progress"),params:se}),me=l.extend({cursor:n.optional()}),j=c.extend({params:me.optional()}),ne=h.extend({nextCursor:n.optional()}),he=X({uri:k(),mimeType:De(k()),_meta:Re(k(),qe()).optional()}),L=he.extend({text:k()}),K=k().refine((Vt)=>{try{return atob(Vt),!0}catch{return!1}},{message:"Invalid Base64 string"}),W=he.extend({blob:K}),be=We(["user","assistant"]),Ce=X({audience:ie(be).optional(),priority:Ee().min(0).max(1).optional(),lastModified:qi.datetime({offset:!0}).optional()}),Ve=X({...b.shape,...E.shape,uri:k(),description:De(k()),mimeType:De(k()),size:De(Ee()),annotations:Ce.optional(),_meta:De(Ge({}))}),Ie=X({...b.shape,...E.shape,uriTemplate:k(),description:De(k()),mimeType:De(k()),annotations:Ce.optional(),_meta:De(Ge({}))}),je=j.extend({method:ae("resources/list")}),U=ne.extend({resources:ie(Ve)}),O=j.extend({method:ae("resources/templates/list")}),q=ne.extend({resourceTemplates:ie(Ie)}),H=l.extend({uri:k()}),J=H,Y=c.extend({method:ae("resources/read"),params:J}),ee=h.extend({contents:ie(ke([L,W]))}),Z=f.extend({method:ae("notifications/resources/list_changed"),params:u.optional()}),te=H,oe=c.extend({method:ae("resources/subscribe"),params:te}),x=H,z=c.extend({method:ae("resources/unsubscribe"),params:x}),ce=u.extend({uri:k()}),ue=f.extend({method:ae("notifications/resources/updated"),params:ce}),ge=X({name:k(),description:De(k()),required:De(Pe())}),Ne=X({...b.shape,...E.shape,description:De(k()),arguments:De(ie(ge)),_meta:De(Ge({}))}),et=j.extend({method:ae("prompts/list")}),He=ne.extend({prompts:ie(Ne)}),Je=l.extend({name:k(),arguments:Re(k(),k()).optional()}),St=c.extend({method:ae("prompts/get"),params:Je}),Jt=X({type:ae("text"),text:k(),annotations:Ce.optional(),_meta:Re(k(),qe()).optional()}),Kt=X({type:ae("image"),data:K,mimeType:k(),annotations:Ce.optional(),_meta:Re(k(),qe()).optional()}),Dt=X({type:ae("audio"),data:K,mimeType:k(),annotations:Ce.optional(),_meta:Re(k(),qe()).optional()}),It=X({type:ae("tool_use"),name:k(),id:k(),input:Re(k(),qe()),_meta:Re(k(),qe()).optional()}),at=X({type:ae("resource"),resource:ke([L,W]),annotations:Ce.optional(),_meta:Re(k(),qe()).optional()}),Ue=Ve.extend({type:ae("resource_link")}),ze=ke([Jt,Kt,Dt,Ue,at]),Qe=X({role:be,content:ze}),nr=h.extend({description:k().optional(),messages:ie(Qe)}),qt=f.extend({method:ae("notifications/prompts/list_changed"),params:u.optional()}),Mt=X({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),or=X({taskSupport:We(["required","optional","forbidden"]).optional()}),ir=X({...b.shape,...E.shape,description:k().optional(),inputSchema:X({type:ae("object"),properties:Re(k(),e).optional(),required:ie(k()).optional()}).catchall(qe()),outputSchema:X({type:ae("object"),properties:Re(k(),e).optional(),required:ie(k()).optional()}).catchall(qe()).optional(),annotations:Mt.optional(),execution:or.optional(),_meta:Re(k(),qe()).optional()}),Cr=j.extend({method:ae("tools/list")}),yr=ne.extend({tools:ie(ir)}),Sr=h.extend({content:ie(ze),structuredContent:Re(k(),qe()).optional(),isError:Pe().optional()}),xt=a.extend({name:k(),arguments:Re(k(),qe()).optional()}),po=c.extend({method:ae("tools/call"),params:xt}),Vo=f.extend({method:ae("notifications/tools/list_changed"),params:u.optional()}),xn=We(["debug","info","notice","warning","error","critical","alert","emergency"]),Ln=l.extend({level:xn}),dn=c.extend({method:ae("logging/setLevel"),params:Ln}),fn=u.extend({level:xn,logger:k().optional(),data:qe()}),ho=f.extend({method:ae("notifications/message"),params:fn}),dr=X({name:k().optional()}),Un=X({hints:ie(dr).optional(),costPriority:Ee().min(0).max(1).optional(),speedPriority:Ee().min(0).max(1).optional(),intelligencePriority:Ee().min(0).max(1).optional()}),mo=X({mode:We(["auto","required","none"]).optional()}),zo=X({type:ae("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:ie(ze),structuredContent:X({}).loose().optional(),isError:Pe().optional(),_meta:Re(k(),qe()).optional()}),fr=Xa("type",[Jt,Kt,Dt]),Gt=Xa("type",[Jt,Kt,Dt,It,zo]),Er=X({role:be,content:ke([Gt,ie(Gt)]),_meta:Re(k(),qe()).optional()}),pn=a.extend({messages:ie(Er),modelPreferences:Un.optional(),systemPrompt:k().optional(),includeContext:We(["none","thisServer","allServers"]).optional(),temperature:Ee().optional(),maxTokens:Ee().int(),stopSequences:ie(k()).optional(),metadata:t.optional(),tools:ie(ir).optional(),toolChoice:mo.optional()}),br=c.extend({method:ae("sampling/createMessage"),params:pn}),Fn=h.extend({model:k(),stopReason:De(We(["endTurn","stopSequence","maxTokens"]).or(k())),role:be,content:fr}),hn=h.extend({model:k(),stopReason:De(We(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:be,content:ke([Gt,ie(Gt)])}),Gn=X({type:ae("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),Kr=X({type:ae("string"),title:k().optional(),description:k().optional(),minLength:Ee().optional(),maxLength:Ee().optional(),format:We(["email","uri","date","date-time"]).optional(),default:k().optional()}),Bn=X({type:We(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Ee().optional(),maximum:Ee().optional(),default:Ee().optional()}),Hn=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),Vn=X({type:ae("string"),title:k().optional(),description:k().optional(),oneOf:ie(X({const:k(),title:k()})),default:k().optional()}),zn=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),jn=ke([Hn,Vn]),xr=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({type:ae("string"),enum:ie(k())}),default:ie(k()).optional()}),Lr=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({anyOf:ie(X({const:k(),title:k()}))}),default:ie(k()).optional()}),jo=ke([xr,Lr]),Wo=ke([zn,jn,jo]),sr=ke([Wo,Gn,Kr,Bn]),ar=a.extend({mode:ae("form").optional(),message:k(),requestedSchema:X({type:ae("object"),properties:Re(k(),sr),required:ie(k()).optional()}).catchall(qe())}),Wn=a.extend({mode:ae("url"),message:k(),elicitationId:k(),url:k().url()}),Ht=ke([ar,Wn]),Jo=c.extend({method:ae("elicitation/create"),params:Ht}),mn=u.extend({elicitationId:k()}),Xr=f.extend({method:ae("notifications/elicitation/complete"),params:mn}),gn=h.extend({action:We(["accept","decline","cancel"]),content:Is((Vt)=>Vt===null?void 0:Vt,Re(k(),ke([k(),Ee(),Pe(),ie(k())])).optional())}),Xt=X({type:ae("ref/resource"),uri:k()}),go=X({type:ae("ref/prompt"),name:k()}),Jn=l.extend({ref:ke([go,Xt]),argument:X({name:k(),value:k()}),context:X({arguments:Re(k(),k()).optional()}).optional()}),Kn=c.extend({method:ae("completion/complete"),params:Jn}),vn=h.extend({completion:Ge({values:ie(k()).max(100),total:De(Ee().int()),hasMore:De(Pe())})}),_n=X({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),qe()).optional()}),yn=c.extend({method:ae("roots/list"),params:l.optional()}),vo=h.extend({roots:ie(_n)}),Ko=f.extend({method:ae("notifications/roots/list_changed"),params:u.optional()}),Xn=Ge({ttl:Ee().optional(),pollInterval:Ee().optional()}),Ur=We(["working","input_required","completed","failed","cancelled"]),Yr=X({taskId:k(),status:Ur,ttl:ke([Ee(),As()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:De(Ee()),statusMessage:De(k())}),er=h.extend({task:Yr}),Xo=u.merge(Yr),Zr=f.extend({method:ae("notifications/tasks/status"),params:Xo}),Sn=c.extend({method:ae("tasks/get"),params:l.extend({taskId:k()})}),Yn=h.merge(Yr),En=c.extend({method:ae("tasks/result"),params:l.extend({taskId:k()})}),_o=h.loose(),Pt=j.extend({method:ae("tasks/list")}),Et=ne.extend({tasks:ie(Yr)}),Qr=c.extend({method:ae("tasks/cancel"),params:l.extend({taskId:k()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:a,RequestSchema:c,NotificationsParamsSchema:u,NotificationSchema:f,ResultSchema:h,RequestIdSchema:g,EmptyResultSchema:p,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:y,IconSchema:S,IconsSchema:E,BaseMetadataSchema:b,ImplementationSchema:R,ClientTasksCapabilitySchema:C,ServerTasksCapabilitySchema:A,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:D,InitializeRequestSchema:N,ServerCapabilitiesSchema:F,InitializeResultSchema:G,InitializedNotificationSchema:B,PingRequestSchema:Q,ProgressSchema:pe,ProgressNotificationParamsSchema:se,ProgressNotificationSchema:ve,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:j,PaginatedResultSchema:ne,ResourceContentsSchema:he,TextResourceContentsSchema:L,BlobResourceContentsSchema:W,RoleSchema:be,AnnotationsSchema:Ce,ResourceSchema:Ve,ResourceTemplateSchema:Ie,ListResourcesRequestSchema:je,ListResourcesResultSchema:U,ListResourceTemplatesRequestSchema:O,ListResourceTemplatesResultSchema:q,ResourceRequestParamsSchema:H,ReadResourceRequestParamsSchema:J,ReadResourceRequestSchema:Y,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:Z,SubscribeRequestParamsSchema:te,SubscribeRequestSchema:oe,UnsubscribeRequestParamsSchema:x,UnsubscribeRequestSchema:z,ResourceUpdatedNotificationParamsSchema:ce,ResourceUpdatedNotificationSchema:ue,PromptArgumentSchema:ge,PromptSchema:Ne,ListPromptsRequestSchema:et,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:Je,GetPromptRequestSchema:St,TextContentSchema:Jt,ImageContentSchema:Kt,AudioContentSchema:Dt,ToolUseContentSchema:It,EmbeddedResourceSchema:at,ResourceLinkSchema:Ue,ContentBlockSchema:ze,PromptMessageSchema:Qe,GetPromptResultSchema:nr,PromptListChangedNotificationSchema:qt,ToolAnnotationsSchema:Mt,ToolExecutionSchema:or,ToolSchema:ir,ListToolsRequestSchema:Cr,ListToolsResultSchema:yr,CallToolResultSchema:Sr,CallToolRequestParamsSchema:xt,CallToolRequestSchema:po,ToolListChangedNotificationSchema:Vo,LoggingLevelSchema:xn,SetLevelRequestParamsSchema:Ln,SetLevelRequestSchema:dn,LoggingMessageNotificationParamsSchema:fn,LoggingMessageNotificationSchema:ho,ModelHintSchema:dr,ModelPreferencesSchema:Un,ToolChoiceSchema:mo,ToolResultContentSchema:zo,SamplingContentSchema:fr,SamplingMessageContentBlockSchema:Gt,SamplingMessageSchema:Er,CreateMessageRequestParamsSchema:pn,CreateMessageRequestSchema:br,CreateMessageResultSchema:Fn,CreateMessageResultWithToolsSchema:hn,BooleanSchemaSchema:Gn,StringSchemaSchema:Kr,NumberSchemaSchema:Bn,UntitledSingleSelectEnumSchemaSchema:Hn,TitledSingleSelectEnumSchemaSchema:Vn,LegacyTitledEnumSchemaSchema:zn,SingleSelectEnumSchemaSchema:jn,UntitledMultiSelectEnumSchemaSchema:xr,TitledMultiSelectEnumSchemaSchema:Lr,MultiSelectEnumSchemaSchema:jo,EnumSchemaSchema:Wo,PrimitiveSchemaDefinitionSchema:sr,ElicitRequestFormParamsSchema:ar,ElicitRequestURLParamsSchema:Wn,ElicitRequestParamsSchema:Ht,ElicitRequestSchema:Jo,ElicitationCompleteNotificationParamsSchema:mn,ElicitationCompleteNotificationSchema:Xr,ElicitResultSchema:gn,ResourceTemplateReferenceSchema:Xt,PromptReferenceSchema:go,CompleteRequestParamsSchema:Jn,CompleteRequestSchema:Kn,CompleteResultSchema:vn,RootSchema:_n,ListRootsRequestSchema:yn,ListRootsResultSchema:vo,RootsListChangedNotificationSchema:Ko,TaskCreationParamsSchema:Xn,TaskStatusSchema:Ur,TaskSchema:Yr,CreateTaskResultSchema:er,TaskStatusNotificationParamsSchema:Xo,TaskStatusNotificationSchema:Zr,GetTaskRequestSchema:Sn,GetTaskResultSchema:Yn,GetTaskPayloadRequestSchema:En,GetTaskPayloadResultSchema:_o,ListTasksRequestSchema:Pt,ListTasksResultSchema:Et,CancelTaskRequestSchema:Qr,CancelTaskResultSchema:h.merge(Yr),ClientRequestSchema:ke([Q,N,Kn,dn,St,et,je,O,Y,oe,z,po,Cr,Sn,En,Pt,Qr]),ClientNotificationSchema:ke([y,ve,B,Ko,Zr]),ClientResultSchema:ke([p,Fn,hn,gn,vo,Yn,Et,er]),ServerRequestSchema:ke([Q,br,Jo,yn,Sn,En,Pt,Qr]),ServerNotificationSchema:ke([y,ve,ho,ue,Z,Vo,qt,Zr,Xr]),ServerResultSchema:ke([p,G,vn,nr,He,U,q,ee,Sr,yr,Yn,Et,er]),CallToolResultWireSchema:qe().superRefine((Vt,js)=>{if(typeof Vt!=="object"||Vt===null||Array.isArray(Vt)||Vt.content!==void 0)return;for(let yo of rS)if(yo in Vt){js.addIssue({code:"custom",message:`content is required when the body carries '${yo}' — another result family cannot default into an empty tools/call success`});return}}).transform(nS).pipe(Sr)}}var EO;function oS(){return EO??=SO()}function iS(e){return e.type!=="object"}var bO=new Set(["const","enum","default","examples"]),TO=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Pp(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function wO(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Pp(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=VC(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&&Pp(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(bO.has(a))s[a]=c;else if(TO.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 sS={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},aS={"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},CO={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},_a;function md(){if(_a)return _a;let e=oS();return _a={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}},_a}function lS(e){return Object.prototype.hasOwnProperty.call(sS,e)}function cS(e){return Object.prototype.hasOwnProperty.call(aS,e)}function RO(e){return Object.prototype.hasOwnProperty.call(CO,e)}function AO(e){return RO(e)?md().resultSchemas[e]:void 0}function IO(e){return lS(e)?md().requestSchemas[e]:void 0}function PO(e){return cS(e)?md().notificationSchemas[e]:void 0}var $4=Object.keys(sS),D4=Object.keys(aS);function jc(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ya(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 kp={ok:!1,reason:"not-in-era"};function Np(e){return jc(e)&&jc(e.outputSchema)&&iS(e.outputSchema)}function Op(e){return e}var gd={era:"2025-11-25",hasRequestMethod:lS,hasNotificationMethod:cS,validateRequest:(e,t)=>ya(IO(e),t),validateResult:(e,t)=>ya(AO(e),t),validateNotification:(e,t)=>ya(PO(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>kp,validateInputResponse:()=>kp,samplingResultVariant:(e,t)=>{let r=oS();return ya(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=tS(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),i=t!==void 0&&iS(t);if(!o&&!i)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(jc(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:Op(r)}}return{kind:"complete",result:Op(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>Np(n)))return t;return{...t,tools:r.map((n)=>Np(n)?{...n,outputSchema:wO(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function kO(){let e=Uu(()=>ke([k(),Ee(),Pe(),As(),Re(k(),e),ie(e)])),t=Re(k(),e),r=ke([k(),Ee().int()]),n=k(),o=ke([k(),Ee().int()]),i=We(["user","assistant"]),s=We(["debug","info","notice","warning","error","critical","alert","emergency"]),l=k().refine((Et)=>{try{return atob(Et),!0}catch{return!1}},{message:"Invalid Base64 string"}),a=X({ttl:Ee().optional()}),c=X({taskId:k()}),u=Ge({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),f=X({_meta:u.optional()}),h=f.extend({task:a.optional()}),g=X({_meta:u.optional()}),p=X({method:k(),params:g.loose().optional()}),_=X({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:We(["light","dark"]).optional()}),y=X({icons:ie(_).optional()}),S=X({name:k(),title:k().optional()}),E=S.extend({...S.shape,...y.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),b=qo(X({applyDefaults:Pe().optional()}),t),R=Is((Et)=>{if(Et&&typeof Et==="object"&&!Array.isArray(Et)&&Object.keys(Et).length===0)return{form:{}};return Et},qo(X({form:b.optional(),url:t.optional()}),t.optional())),T=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({sampling:Ge({createMessage:t.optional()}).optional(),elicitation:Ge({create:t.optional()}).optional()}).optional()}),w=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({tools:Ge({call:t.optional()}).optional()}).optional()}),C=X({experimental:Re(k(),t).optional(),sampling:X({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:X({listChanged:Pe().optional()}).optional(),tasks:T.optional(),extensions:Re(k(),t).optional()}),A=X({experimental:Re(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:X({listChanged:Pe().optional()}).optional(),resources:X({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:X({listChanged:Pe().optional()}).optional(),tasks:w.optional(),extensions:Re(k(),t).optional()}),P=X({progress:Ee(),total:De(Ee()),message:De(k())}),D=X({...g.shape,...P.shape,progressToken:r}),N=p.extend({method:ae("notifications/progress"),params:D}),F=g.extend({level:s,logger:k().optional(),data:qe()}),G=p.extend({method:ae("notifications/message"),params:F}),B=X({uri:k(),mimeType:De(k()),_meta:Re(k(),qe()).optional()}),Q=B.extend({text:k()}),pe=B.extend({blob:l}),se=X({audience:ie(i).optional(),priority:Ee().min(0).max(1).optional(),lastModified:qi.datetime({offset:!0}).optional()}),ve=X({...S.shape,...y.shape,uri:k(),description:De(k()),mimeType:De(k()),size:De(Ee()),annotations:se.optional(),_meta:De(Ge({}))}),me=X({...S.shape,...y.shape,uriTemplate:k(),description:De(k()),mimeType:De(k()),annotations:se.optional(),_meta:De(Ge({}))}),j=p.extend({method:ae("notifications/resources/list_changed"),params:g.optional()}),ne=g.extend({uri:k()}),he=p.extend({method:ae("notifications/resources/updated"),params:ne}),L=X({name:k(),description:De(k()),required:De(Pe())}),K=X({...S.shape,...y.shape,description:De(k()),arguments:De(ie(L)),_meta:De(Ge({}))}),W=p.extend({method:ae("notifications/prompts/list_changed"),params:g.optional()}),be=X({type:ae("text"),text:k(),annotations:se.optional(),_meta:Re(k(),qe()).optional()}),Ce=X({type:ae("image"),data:l,mimeType:k(),annotations:se.optional(),_meta:Re(k(),qe()).optional()}),Ve=X({type:ae("audio"),data:l,mimeType:k(),annotations:se.optional(),_meta:Re(k(),qe()).optional()}),Ie=X({type:ae("tool_use"),name:k(),id:k(),input:Re(k(),qe()),_meta:Re(k(),qe()).optional()}),je=X({type:ae("resource"),resource:ke([Q,pe]),annotations:se.optional(),_meta:Re(k(),qe()).optional()}),U=ve.extend({type:ae("resource_link")}),O=ke([be,Ce,Ve,U,je]),q=X({role:i,content:O}),H=X({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),J=p.extend({method:ae("notifications/tools/list_changed"),params:g.optional()}),Y=X({name:k().optional()}),ee=X({hints:ie(Y).optional(),costPriority:Ee().min(0).max(1).optional(),speedPriority:Ee().min(0).max(1).optional(),intelligencePriority:Ee().min(0).max(1).optional()}),Z=X({mode:We(["auto","required","none"]).optional()}),te=X({type:ae("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),oe=X({type:ae("string"),title:k().optional(),description:k().optional(),minLength:Ee().optional(),maxLength:Ee().optional(),format:We(["email","uri","date","date-time"]).optional(),default:k().optional()}),x=X({type:We(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Ee().optional(),maximum:Ee().optional(),default:Ee().optional()}),z=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),ce=X({type:ae("string"),title:k().optional(),description:k().optional(),oneOf:ie(X({const:k(),title:k()})),default:k().optional()}),ue=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),ge=ke([z,ce]),Ne=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({type:ae("string"),enum:ie(k())}),default:ie(k()).optional()}),et=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({anyOf:ie(X({const:k(),title:k()}))}),default:ie(k()).optional()}),He=ke([Ne,et]),Je=ke([ue,ge,He]),St=ke([Je,te,oe,x]),Jt=h.extend({mode:ae("form").optional(),message:k(),requestedSchema:X({type:ae("object"),properties:Re(k(),St),required:ie(k()).optional()}).catchall(qe())}),Kt=X({type:ae("ref/resource"),uri:k()}),Dt=X({type:ae("ref/prompt"),name:k()}),It=X({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),qe()).optional()}),at=C.shape,Ue=X({experimental:at.experimental,sampling:at.sampling,elicitation:at.elicitation,roots:at.roots,extensions:at.extensions}),ze=A.shape,Qe=X({experimental:ze.experimental,logging:ze.logging,completions:ze.completions,prompts:ze.prompts,resources:ze.resources,tools:ze.tools,extensions:ze.extensions}),nr=Ge({progressToken:r.optional(),[xi]:k(),[Fu]:E.optional(),[Fs]:Ue,[El]:s.optional()}),qt=X({...S.shape,...y.shape,description:k().optional(),inputSchema:Ge({$schema:k().optional(),type:ae("object")}),outputSchema:Ge({$schema:k().optional()}).optional(),annotations:H.optional(),_meta:Re(k(),qe()).optional()}),Mt=X({type:ae("tool_result"),toolUseId:k(),content:ie(O),structuredContent:qe().optional(),isError:Pe().optional(),_meta:Re(k(),qe()).optional()}),or=ke([be,Ce,Ve,Ie,Mt]),ir=X({role:i,content:ke([or,ie(or)]),_meta:Re(k(),qe()).optional()}),Cr=k(),yr=Ge({[Si]:E.optional().catch(void 0)}),Sr=yr.optional();function xt(Et){return Ge({_meta:Sr,resultType:Cr.default("complete"),...Et})}let po=xt({}),Vo=xt({nextCursor:n.optional()}),xn=xt({content:ie(O),structuredContent:qe().optional(),isError:Pe().optional()}),Ln=xt({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),tools:ie(qt),nextCursor:n.optional()}),dn=xt({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),prompts:ie(K),nextCursor:n.optional()}),fn=xt({description:k().optional(),messages:ie(q)}),ho=xt({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),resources:ie(ve),nextCursor:n.optional()}),dr=xt({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),resourceTemplates:ie(me),nextCursor:n.optional()}),Un=xt({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),contents:ie(ke([Q,pe]))}),mo=xt({completion:X({values:ie(k()).max(100),total:Ee().int().optional(),hasMore:Pe().optional()}).loose()}),zo=xt({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"])}),fr=xt({ttlMs:Ee().int().min(0).catch(0),cacheScope:We(["public","private"]).catch("private"),supportedVersions:ie(k()),capabilities:Qe,instructions:k().optional()}),Gt=X({messages:ie(ir),modelPreferences:ee.optional(),systemPrompt:k().optional(),includeContext:We(["none","thisServer","allServers"]).optional(),temperature:Ee().optional(),maxTokens:Ee().int(),stopSequences:ie(k()).optional(),metadata:t.optional(),tools:ie(qt).optional(),toolChoice:Z.optional()}),Er=X({method:ae("sampling/createMessage"),params:Gt}),pn=X({method:ae("roots/list"),params:X({_meta:Re(k(),qe()).optional()}).optional()}),br=X({...ir.shape,model:k(),stopReason:k().optional()}),Fn=X({roots:ie(It)}),hn=X({action:We(["accept","decline","cancel"]),content:Re(k(),ke([k(),Ee(),Pe(),ie(k())])).optional()}),Gn=X({mode:ae("url"),message:k(),url:k().url()}),Kr=ke([Jt,Gn]),Bn=X({method:ae("elicitation/create"),params:Kr}),Hn=ke([Er,pn,Bn]),Vn=ke([br,Fn,hn]),zn=Re(k(),Hn),jn=Re(k(),Vn),xr=xt({inputRequests:zn.optional(),requestState:k().optional()}),Lr={inputResponses:jn.optional(),requestState:k().optional()},jo=X({_meta:nr,...Lr}),Wo=Ge({progressToken:r.optional()});function sr(Et,Qr){return X({method:ae(Et),params:X({_meta:nr,...Qr})})}function ar(Et,Qr){return X({method:ae(Et),params:X({_meta:Wo.optional(),...Qr}).optional()})}let Wn={name:k(),arguments:Re(k(),qe()).optional(),...Lr},Ht={cursor:n.optional()},Jo=sr("tools/call",Wn),mn=sr("tools/list",Ht),Xr=sr("prompts/list",Ht),gn=sr("prompts/get",{name:k(),arguments:Re(k(),k()).optional(),...Lr}),Xt=sr("resources/list",Ht),go=sr("resources/templates/list",Ht),Jn=sr("resources/read",{uri:k(),...Lr}),Kn={ref:ke([Dt,Kt]),argument:X({name:k(),value:k()}),context:X({arguments:Re(k(),k()).optional()}).optional()},vn=sr("completion/complete",Kn),_n=sr("server/discover",{}),yn=X({toolsListChanged:Pe().optional(),promptsListChanged:Pe().optional(),resourcesListChanged:Pe().optional(),resourceSubscriptions:ie(k()).optional()}),vo={notifications:yn},Ko=sr("subscriptions/listen",vo),Xn=yr.extend({"io.modelcontextprotocol/subscriptionId":o}),Ur=Ge({_meta:Xn,resultType:Cr.default("complete")}),Yr={"tools/call":ar("tools/call",Wn),"tools/list":ar("tools/list",Ht),"prompts/get":ar("prompts/get",{name:k(),arguments:Re(k(),k()).optional()}),"prompts/list":ar("prompts/list",Ht),"resources/list":ar("resources/list",Ht),"resources/templates/list":ar("resources/templates/list",Ht),"resources/read":ar("resources/read",{uri:k()}),"completion/complete":ar("completion/complete",Kn),"server/discover":ar("server/discover",{}),"subscriptions/listen":ar("subscriptions/listen",vo)};function er(Et){return Ge({_meta:Sr,...Et})}let Xo={"tools/call":er({content:ie(O),structuredContent:qe().optional(),isError:Pe().optional()}),"tools/list":er({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),tools:ie(qt),nextCursor:n.optional()}),"prompts/get":er({description:k().optional(),messages:ie(q)}),"prompts/list":er({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),prompts:ie(K),nextCursor:n.optional()}),"resources/list":er({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),resources:ie(ve),nextCursor:n.optional()}),"resources/templates/list":er({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),resourceTemplates:ie(me),nextCursor:n.optional()}),"resources/read":er({ttlMs:Ee().int().min(0),cacheScope:We(["public","private"]),contents:ie(ke([Q,pe]))}),"completion/complete":er({completion:X({values:ie(k()).max(100),total:Ee().int().optional(),hasMore:Pe().optional()}).loose()}),"server/discover":er({ttlMs:Ee().int().min(0).catch(0),cacheScope:We(["public","private"]).catch("private"),supportedVersions:ie(k()),capabilities:Qe,instructions:k().optional()}),"subscriptions/listen":er({})},Zr=Ge({"io.modelcontextprotocol/subscriptionId":o.optional()}),Sn=X({method:ae("notifications/subscriptions/acknowledged"),params:X({_meta:Zr.optional(),notifications:yn})}),Yn=X({_meta:Zr.optional(),requestId:o,reason:k().optional()}),En=X({method:ae("notifications/cancelled"),params:Yn}),_o={"notifications/cancelled":En,"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":Sn},Pt=(Et)=>X({jsonrpc:ae("2.0"),id:ke([k(),Ee().int()]),result:Et}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:a,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:g,NotificationSchema:p,IconSchema:_,IconsSchema:y,BaseMetadataSchema:S,ImplementationSchema:E,ClientTasksCapabilitySchema:T,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:C,ServerCapabilitiesSchema:A,ProgressSchema:P,ProgressNotificationParamsSchema:D,ProgressNotificationSchema:N,LoggingMessageNotificationParamsSchema:F,LoggingMessageNotificationSchema:G,ResourceContentsSchema:B,TextResourceContentsSchema:Q,BlobResourceContentsSchema:pe,AnnotationsSchema:se,ResourceSchema:ve,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:j,ResourceUpdatedNotificationParamsSchema:ne,ResourceUpdatedNotificationSchema:he,PromptArgumentSchema:L,PromptSchema:K,PromptListChangedNotificationSchema:W,TextContentSchema:be,ImageContentSchema:Ce,AudioContentSchema:Ve,ToolUseContentSchema:Ie,EmbeddedResourceSchema:je,ResourceLinkSchema:U,ContentBlockSchema:O,PromptMessageSchema:q,ToolAnnotationsSchema:H,ToolListChangedNotificationSchema:J,ModelHintSchema:Y,ModelPreferencesSchema:ee,ToolChoiceSchema:Z,BooleanSchemaSchema:te,StringSchemaSchema:oe,NumberSchemaSchema:x,UntitledSingleSelectEnumSchemaSchema:z,TitledSingleSelectEnumSchemaSchema:ce,LegacyTitledEnumSchemaSchema:ue,SingleSelectEnumSchemaSchema:ge,UntitledMultiSelectEnumSchemaSchema:Ne,TitledMultiSelectEnumSchemaSchema:et,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:Je,PrimitiveSchemaDefinitionSchema:St,ElicitRequestFormParamsSchema:Jt,ResourceTemplateReferenceSchema:Kt,PromptReferenceSchema:Dt,RootSchema:It,ClientCapabilities2026Schema:Ue,ServerCapabilities2026Schema:Qe,RequestMetaEnvelopeSchema:nr,ToolSchema:qt,ToolResultContentSchema:Mt,SamplingMessageContentBlockSchema:or,SamplingMessageSchema:ir,ResultTypeSchema:Cr,ResultMetaSchema:yr,ResultSchema:po,PaginatedResultSchema:Vo,CallToolResultSchema:xn,ListToolsResultSchema:Ln,ListPromptsResultSchema:dn,GetPromptResultSchema:fn,ListResourcesResultSchema:ho,ListResourceTemplatesResultSchema:dr,ReadResourceResultSchema:Un,CompleteResultSchema:mo,CacheableResultSchema:zo,DiscoverResultSchema:fr,CreateMessageRequestParamsSchema:Gt,CreateMessageRequestSchema:Er,ListRootsRequestSchema:pn,CreateMessageResultSchema:br,ListRootsResultSchema:Fn,ElicitResultSchema:hn,ElicitRequestURLParamsSchema:Gn,ElicitRequestParamsSchema:Kr,ElicitRequestSchema:Bn,InputRequestSchema:Hn,InputResponseSchema:Vn,InputRequestsSchema:zn,InputResponsesSchema:jn,InputRequiredResultSchema:xr,InputResponseRequestParamsSchema:jo,CallToolRequestSchema:Jo,ListToolsRequestSchema:mn,ListPromptsRequestSchema:Xr,GetPromptRequestSchema:gn,ListResourcesRequestSchema:Xt,ListResourceTemplatesRequestSchema:go,ReadResourceRequestSchema:Jn,CompleteRequestSchema:vn,DiscoverRequestSchema:_n,SubscriptionFilterSchema:yn,SubscriptionsListenRequestSchema:Ko,SubscriptionsListenResultMetaSchema:Xn,SubscriptionsListenResultSchema:Ur,dispatchRequestSchemas:Yr,dispatchResultSchemas:Xo,NotificationMetaSchema:Zr,SubscriptionsAcknowledgedNotificationSchema:Sn,CancelledNotificationParamsSchema:Yn,CancelledNotificationSchema:En,notificationSchemas2026:_o,JSONRPCResultResponseSchema:Pt(po),CallToolResultResponseSchema:Pt(ke([xn,xr])),ListToolsResultResponseSchema:Pt(Ln),ListPromptsResultResponseSchema:Pt(dn),GetPromptResultResponseSchema:Pt(ke([fn,xr])),ListResourcesResultResponseSchema:Pt(ho),ListResourceTemplatesResultResponseSchema:Pt(dr),ReadResourceResultResponseSchema:Pt(ke([Un,xr])),CompleteResultResponseSchema:Pt(mo),DiscoverResultResponseSchema:Pt(fr),SubscriptionsListenResultResponseSchema:Pt(Ur)}}var NO;function lo(){return NO??=kO()}var OO=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function MO(e){return OO.includes(e)}var Ei=Symbol("modelcontextprotocol.resultCacheHintFallback");function Wc(e,t){if(t===void 0)return e;let r=e[Ei];if(r===void 0)return{...e,[Ei]: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,[Ei]:n}}function $O(e){return e[Ei]}function vd(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function _d(e){return e==="public"||e==="private"}function uS(e,t){if(e.ttlMs!==void 0&&!vd(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!_d(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var we=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}({}),xe=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return ki(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 ki(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",hd(this,new.target)}static fromError(t,r,n){if(t===we.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new DO(o.elicitations,r)}if(t===we.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new Za({supported:o.supported,requested:o.requested},r)}if(t===we.InvalidParams||t===we.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===we.ResourceNotFound||Object.keys(o).length===1))return new dS(o.uri,r)}if(t===we.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new fS({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},dS=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(we.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},DO=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(we.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Za=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(we.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},fS=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(we.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},qO=0,xO="private",LO=["tools/call","prompts/get","resources/read"];function UO(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(LO.includes(e))return t;throw new xe(we.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function FO(e,t){let r=$O(t);if(t.resultType!=="complete"||!MO(e))return r===void 0?t:zO(t);let n=t,o=vd(n.ttlMs)?n.ttlMs:HO(r),i=_d(n.cacheScope)?n.cacheScope:VO(r),s={...n,ttlMs:o,cacheScope:i};return delete s[Ei],s}function GO(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function BO(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[Si]:t}};if(!GO(r))return e;if(r[Si]!==void 0)return e;return{...e,_meta:{...r,[Si]:t}}}function HO(e){return e!==void 0&&vd(e.ttlMs)?e.ttlMs:qO}function VO(e){return e!==void 0&&_d(e.cacheScope)?e.cacheScope:xO}function zO(e){let t={...e};return delete t[Ei],t}var jO=["elicitation/create","sampling/createMessage","roots/list"],Sa;function pS(){if(Sa)return Sa;let e=lo();return Sa={request:{"elicitation/create":X({method:ae("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":X({method:ae("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":X({method:ae("roots/list"),params:Ge({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Sa}function hS(e){return jO.includes(e)}function Ec(e){return hS(e)?pS().request[e]:void 0}function WO(e){return hS(e)?pS().response[e]:void 0}var yd={"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},mS={"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 gS(e){return Object.prototype.hasOwnProperty.call(yd,e)}function vS(e){return Object.prototype.hasOwnProperty.call(mS,e)}function JO(e){return Object.prototype.hasOwnProperty.call(yd,e)}function KO(e){return gS(e)?lo().dispatchRequestSchemas[e]:void 0}function XO(e){return JO(e)?lo().dispatchResultSchemas[e]:void 0}function YO(e){return vS(e)?lo().notificationSchemas2026[e]:void 0}var q4=Object.keys(yd),x4=Object.keys(mS);function bs(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function us(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 ZO={ok:!1,reason:"not-in-era"},QO=[xi,Fs];function eM(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)=>bs(l)&&("execution"in l)))o().tools=i.map((l)=>{if(!bs(l)||!("execution"in l))return l;let a={...l};return delete a.execution,a});let s=t.capabilities;if(bs(s)&&"tasks"in s){let l={...s};delete l.tasks,o().capabilities=l}return r}var Sd={era:"2026-07-28",hasRequestMethod:gS,hasNotificationMethod:vS,hasInputRequestMethod:(e)=>Ec(e)!==void 0,validateRequest:(e,t)=>us(KO(e),t),validateResult:(e,t)=>us(XO(e),t),validateNotification:(e,t)=>us(YO(e),t),validateInputRequest:(e,t)=>us(Ec(e),t),validateInputResponse:(e,t)=>us(WO(e),t),samplingResultVariant:()=>ZO,outboundEnvelope(e){return{[xi]:e.protocolVersion,[Fu]:e.clientInfo,[Fs]:e.clientCapabilities,...e.logLevel!==void 0&&{[El]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of QO)if(!(n in e))t.push({key:n,problem:"missing"});let r=lo().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)=>tS(e),inputRequestSchema:Ec,decodeResult(e,t){if(!bs(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=bs(s)?s:{},a=t.requestState,c=t._meta===void 0?void 0:lo().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=tM(),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 BO(FO(e,UO(e,eM(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=lo().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("; ")}`}},Ea;function tM(){if(Ea)return Ea;let e=lo();return Ea={"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},Ea}var Ml="2026-07-28";function Lo(e){return e!==void 0&&Bs(e)?Sd:gd}function Mp(e){if(e.revision!==void 0)return Lo(e.revision).era;return e.era==="modern"?Sd.era:gd.era}function bc(e){return _S.some((t)=>t.hasRequestMethod(e))}function Tc(e){return _S.some((t)=>t.hasNotificationMethod(e))}function $p(e){return e==="tasks/get"||e==="tasks/cancel"}var _S=[gd,Sd];function Dp(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Hs(e){if(!Dp(e))return;let t=e._meta;return Dp(t)?t:void 0}function Ed(e){let t=Hs(e);return t!==void 0&&xi in t}function bd(e){let t=Hs(e)?.[xi];return typeof t==="string"?t:void 0}function Td(e){return Lo(Ml).validateEnvelopeMeta(e)}var rM=UC({AnnotationsSchema:()=>Go,AudioContentSchema:()=>Pl,BaseMetadataSchema:()=>xo,BaseRequestParamsSchema:()=>rr,BlobResourceContentsSchema:()=>rd,BooleanSchemaSchema:()=>ad,CallToolRequestParamsSchema:()=>f0,CallToolRequestSchema:()=>p0,CallToolResultSchema:()=>sd,CancelTaskRequestSchema:()=>tO,CancelTaskResultSchema:()=>rO,CancelledNotificationParamsSchema:()=>my,CancelledNotificationSchema:()=>Ku,ClientCapabilitiesSchema:()=>yy,ClientNotificationSchema:()=>oO,ClientRequestSchema:()=>nO,ClientResultSchema:()=>iO,ClientTasksCapabilitySchema:()=>vy,CompatibilityCallToolResultSchema:()=>VN,CompleteRequestParamsSchema:()=>F0,CompleteRequestSchema:()=>G0,CompleteResultSchema:()=>B0,ContentBlockSchema:()=>kl,CreateMessageRequestParamsSchema:()=>C0,CreateMessageRequestSchema:()=>R0,CreateMessageResultSchema:()=>A0,CreateMessageResultWithToolsSchema:()=>I0,CreateTaskResultSchema:()=>WN,CursorSchema:()=>Hu,DiscoverRequestSchema:()=>wy,DiscoverResultSchema:()=>Cy,ElicitRequestFormParamsSchema:()=>Ol,ElicitRequestParamsSchema:()=>M0,ElicitRequestSchema:()=>$0,ElicitRequestURLParamsSchema:()=>O0,ElicitResultSchema:()=>x0,ElicitationCompleteNotificationParamsSchema:()=>D0,ElicitationCompleteNotificationSchema:()=>q0,EmbeddedResourceSchema:()=>n0,EmptyResultSchema:()=>Ju,EnumSchemaSchema:()=>N0,GetPromptRequestParamsSchema:()=>e0,GetPromptRequestSchema:()=>t0,GetPromptResultSchema:()=>s0,GetTaskPayloadRequestSchema:()=>YN,GetTaskPayloadResultSchema:()=>ZN,GetTaskRequestSchema:()=>KN,GetTaskResultSchema:()=>XN,IconSchema:()=>gy,IconsSchema:()=>Ui,ImageContentSchema:()=>Il,ImplementationSchema:()=>Cl,InitializeRequestParamsSchema:()=>Sy,InitializeRequestSchema:()=>Ey,InitializeResultSchema:()=>by,InitializedNotificationSchema:()=>Ty,JSONArraySchema:()=>FN,JSONObjectSchema:()=>Lt,JSONRPCErrorResponseSchema:()=>wl,JSONRPCMessageSchema:()=>hy,JSONRPCNotificationSchema:()=>Wu,JSONRPCRequestSchema:()=>ju,JSONRPCResponseSchema:()=>GN,JSONRPCResultResponseSchema:()=>Tl,JSONValueSchema:()=>Pi,LegacyTitledEnumSchemaSchema:()=>ud,ListChangedOptionsBaseSchema:()=>zN,ListPromptsRequestSchema:()=>Zy,ListPromptsResultSchema:()=>Qy,ListResourceTemplatesRequestSchema:()=>Oy,ListResourceTemplatesResultSchema:()=>My,ListResourcesRequestSchema:()=>ky,ListResourcesResultSchema:()=>Ny,ListRootsRequestSchema:()=>V0,ListRootsResultSchema:()=>z0,ListTasksRequestSchema:()=>QN,ListTasksResultSchema:()=>eO,ListToolsRequestSchema:()=>u0,ListToolsResultSchema:()=>d0,LoggingLevelSchema:()=>Ps,LoggingMessageNotificationParamsSchema:()=>v0,LoggingMessageNotificationSchema:()=>_0,ModelHintSchema:()=>y0,ModelPreferencesSchema:()=>S0,MultiSelectEnumSchemaSchema:()=>k0,NotificationSchema:()=>_r,NotificationsParamsSchema:()=>vr,NumberSchemaSchema:()=>Ya,PaginatedRequestParamsSchema:()=>Iy,PaginatedRequestSchema:()=>Fi,PaginatedResultSchema:()=>Gi,PingRequestSchema:()=>Yu,PrimitiveSchemaDefinitionSchema:()=>pd,ProgressNotificationParamsSchema:()=>Ay,ProgressNotificationSchema:()=>Zu,ProgressSchema:()=>Ry,ProgressTokenSchema:()=>Bu,PromptArgumentSchema:()=>Xy,PromptListChangedNotificationSchema:()=>a0,PromptMessageSchema:()=>i0,PromptReferenceSchema:()=>U0,PromptSchema:()=>Yy,ReadResourceRequestParamsSchema:()=>$y,ReadResourceRequestSchema:()=>Dy,ReadResourceResultSchema:()=>qy,RelatedTaskMetadataSchema:()=>py,RequestIdSchema:()=>Li,RequestMetaSchema:()=>Vu,RequestSchema:()=>Ut,ResourceContentsSchema:()=>Qu,ResourceLinkSchema:()=>o0,ResourceListChangedNotificationSchema:()=>xy,ResourceRequestParamsSchema:()=>Rl,ResourceSchema:()=>nd,ResourceTemplateReferenceSchema:()=>L0,ResourceTemplateSchema:()=>Py,ResourceUpdatedNotificationParamsSchema:()=>Jy,ResourceUpdatedNotificationSchema:()=>Ky,ResultMetaObjectSchema:()=>zu,ResultSchema:()=>Ft,RoleSchema:()=>Bi,RootSchema:()=>H0,RootsListChangedNotificationSchema:()=>j0,SamplingContentSchema:()=>T0,SamplingMessageContentBlockSchema:()=>ks,SamplingMessageSchema:()=>w0,ServerCapabilitiesSchema:()=>Xu,ServerNotificationSchema:()=>aO,ServerRequestSchema:()=>sO,ServerResultSchema:()=>lO,ServerTasksCapabilitySchema:()=>_y,SetLevelRequestParamsSchema:()=>m0,SetLevelRequestSchema:()=>g0,SingleSelectEnumSchemaSchema:()=>P0,StringSchemaSchema:()=>Nl,SubscribeRequestParamsSchema:()=>Ly,SubscribeRequestSchema:()=>Uy,SubscriptionFilterSchema:()=>od,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Vy,SubscriptionsAcknowledgedNotificationSchema:()=>zy,SubscriptionsListenRequestParamsSchema:()=>By,SubscriptionsListenRequestSchema:()=>Hy,SubscriptionsListenResultMetaSchema:()=>jy,SubscriptionsListenResultSchema:()=>Wy,TaskAugmentedRequestParamsSchema:()=>Gs,TaskCreationParamsSchema:()=>jN,TaskMetadataSchema:()=>fy,TaskSchema:()=>Hi,TaskStatusNotificationParamsSchema:()=>J0,TaskStatusNotificationSchema:()=>JN,TaskStatusSchema:()=>W0,TextContentSchema:()=>Al,TextResourceContentsSchema:()=>ed,TitledMultiSelectEnumSchemaSchema:()=>fd,TitledSingleSelectEnumSchemaSchema:()=>cd,ToolAnnotationsSchema:()=>l0,ToolChoiceSchema:()=>E0,ToolExecutionSchema:()=>c0,ToolListChangedNotificationSchema:()=>h0,ToolResultContentSchema:()=>b0,ToolSchema:()=>id,ToolUseContentSchema:()=>r0,UnsubscribeRequestParamsSchema:()=>Fy,UnsubscribeRequestSchema:()=>Gy,UntitledMultiSelectEnumSchemaSchema:()=>dd,UntitledSingleSelectEnumSchemaSchema:()=>ld}),nn=(e)=>ju.safeParse(e).success,vi=(e)=>Wu.safeParse(e).success,Jc=(e)=>Tl.safeParse(e).success,yS=(e)=>wl.safeParse(e).success,Ro=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function nM(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function oM(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var qp="x-mcp-header",iM=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,sM=new Set(["string","integer","boolean","number"]);function aM(e){let t=[],r=new Map,n=(i,s,l)=>{if(i===null||typeof i!=="object")return;let a=i;if(qp in a){if(!l||s.length===0)return`${ba(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[qp];if(typeof u!=="string"||u.length===0)return`${ba(s)}: x-mcp-header MUST be a non-empty string`;if(!iM.test(u))return`${ba(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||!sM.has(f))return`${ba(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 lM){let f=a[u];if(f===void 0)continue;let h=Array.isArray(f)?f:f!==null&&typeof f==="object"&&cM.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 lM=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cM=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function ba(e){return e.length===0?"<root>":e.join(".")}var Ma=-32020,L4=[{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:[we.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:[Ma,we.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:[we.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:[we.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:[we.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:[Ma],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:[we.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:[Ma],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."}],U4={[we.ParseError]:400,[we.InvalidRequest]:400,[we.MethodNotFound]:404,[we.UnsupportedProtocolVersion]:400,[we.MissingRequiredClientCapability]:400,[Ma]:400};function Ta(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 SS(e){if(!Ed(e))return!1;let t=bd(e);if(t===void 0||!Bs(t))return!1;let r=Hs(e);return r!==void 0&&Td(r).length===0}function uM(e,t){switch(e.reason){case"http-method":return Ta("http-method","modern-only-method-not-allowed",405,new xe(-32000,"Method not allowed."),!0);case"batch":return Ta("jsonrpc-shape","modern-only-batch-not-supported",400,new xe(we.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return Ta("jsonrpc-shape","modern-only-response-post",400,new xe(we.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 Ta("era-classification","modern-only-missing-envelope",400,r===void 0?new xe(we.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new Za({supported:[...t],requested:r}),!0)}}}function wd(e,t){return Y_(e,t)}function ds(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Ni(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 xp=!1,Kc="draft-2020-12";function Oi(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:Kc});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(!xp)xp=!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=X_(e,{target:Kc,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 ES(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 ES(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"||ES(n)))}return!1}function dM(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 bi(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>dM(n)).join(", ")};return{success:!0,data:r.value}}function fM(e){let t=X_(e,{target:Kc,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var pM=/\\\.\\d\{(\d+)\}/;function hM(e){let t=pM.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)=>qi.datetime({local:n,offset:o,precision:i}))))}function mM(e,t){let r;switch(e){case"email":r=[Dk()];break;case"uri":r=[ry()];break;case"date":r=[qi.date()];break;case"date-time":r=hM(t);break}return new Set(r.map((n)=>fM(n)).filter((n)=>n!==void 0))}function gM(e,t,r){if(r!=="zod")return!0;return mM(e,t).has(t)}function vM(e){let t=Oi(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 Ns(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function _M(e){try{return Oi(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new xe(we.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var yM=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Cd(e){return yM.has(e)||e.startsWith("x-")}var SM=new Set(["$schema",...Object.keys(Ol.shape.requestedSchema.shape)]),Lp={string:ds([Nl,ld,cd,ud]),number:ds([Ya]),integer:ds([Ya]),boolean:ds([ad]),array:ds([dd,fd])},EM=new Set(Nl.shape.format.unwrap().options);function bM(e,t,r,n){if(!Ns(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(Lp,e.type)?Lp[e.type]:void 0;if(o===void 0)return e;let i={};for(let[s,l]of Object.entries(e))if(o.has(s)||Cd(s))i[s]=l;else if(s==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!EM.has(e.format))i[s]=l;else if(typeof l!=="string"||!gM(e.format,l,r))n.push(`${t}.${s}`)}else n.push(`${t}.${s}`);return i}function TM(e,t){let r={},n=[];for(let[o,i]of Object.entries(e))if(o==="properties"&&Ns(i))r[o]=Object.fromEntries(Object.entries(i).map(([s,l])=>[s,bM(l,`properties.${s}`,t,n)]));else if(SM.has(o))r[o]=i;else if(!Cd(o))n.push(o);if(n.length>0)throw new xe(we.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function wM(e,t){if(!Ns(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!wd(pd,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function Xc(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>Xc(n,t[o],`${r}[${o}]`));if(!Ns(e)||!Ns(t))return[];return Object.entries(e).flatMap(([n,o])=>{let i=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return Cd(n)?[]:[i];return Xc(o,t[n],i)})}function CM(e){if(!Ni(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=TM(_M(e.requestedSchema),t),n=wd(Ol.shape.requestedSchema,r);if(!n.success)throw new xe(we.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${wM(r,n.error.message)}`);let o=Xc(r,n.data);if(o.length>0)throw new xe(we.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 xe(we.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function RM(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 F4=Object.assign(RM,{elicit(e){try{return{method:"elicitation/create",params:CM(e)}}catch(t){throw t instanceof xe?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"}}}),AM=250;function IM(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function PM(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 kM(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 NM=["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"],OM={IdJagTokenExchangeResponseSchema:fO,OAuthClientInformationFullSchema:hO,OAuthClientInformationSchema:Z0,OAuthClientMetadataSchema:Y0,OAuthClientRegistrationErrorSchema:mO,OAuthErrorResponseSchema:pO,OAuthMetadataSchema:K0,OAuthProtectedResourceMetadataSchema:cO,OAuthTokenRevocationRequestSchema:gO,OAuthTokensSchema:dO,OpenIdProviderDiscoveryMetadataSchema:uO,OpenIdProviderMetadataSchema:X0},bS={},TS={};function wS(e,t){let r=e.slice(0,-6);bS[r]=t,TS[r]=(n)=>t.safeParse(n).success}for(let e of NM)wS(e,rM[e]);for(let[e,t]of Object.entries(OM))wS(e,t);var G4=Object.freeze(bS),B4=Object.freeze(TS);function MM(e){switch(e){case"initialize":case"notifications/initialized":return Lo(void 0);case"server/discover":return Lo(Ml);default:return}}var $M=60000,DM=[xi,Fu,Fs,El],qM=["inputResponses","requestState"];function Up(e,t){let r=e.params;if(!Ts(r))return{message:e,lifted:{}};let n=r._meta,o=Ts(n)?DM.filter((a)=>(a in n)):[],i=t==="request"?qM.filter((a)=>(a in r)):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};let s={},l={...r};if(o.length>0&&Ts(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 Fp(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 $l(e){return()=>e}var xM=$l(void 0);function CS(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:$l(t)}}}var RS;function LM(e,t){RS(e,t)}var UM=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{RS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??LN,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),Jc(o)||yS(o))this._onresponse(o);else if(nn(o))this._onrequest(o,i);else if(vi(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}=Up(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let s=Mp(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(Tc(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}=Up(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 _=Mp(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(we.UnsupportedProtocolVersion,`Unsupported protocol version: ${y}`,{supported:this._supportedProtocolVersions,requested:y});return}}if(bc(r.method)&&!o.hasRequestMethod(r.method)&&!($p(r.method)&&this._customSchemaRequestMethods.has(r.method))){s(we.MethodNotFound,"Method not found");return}let l=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(l===void 0){s(we.MethodNotFound,"Method not found");return}let a=o.checkInboundEnvelope(n);if(a!==void 0){s(we.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:GM(n.inputResponses),g={sessionId:i?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:n.requestState===void 0?xM:$l(n.requestState),signal:f.signal,send:(_,y,S)=>{let E=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(E,_.method),Ni(y))return u(_,y,S);let b=Fp(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(we.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:we.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),Jc(e))r(e);else r(xe.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(Ni(t)){if(!$p(e.method))this._assertOutboundRequestInEra(n,e.method);return this._requestWithSchemaViaCodec(n,e,t,r)}this._assertOutboundRequestInEra(n,e.method);let o=Fp(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 Lo(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=MM(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(bc(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=(w)=>{h(w)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(w){g(w);return}if(n?.signal?.aborted){let w=n.signal.reason;throw w instanceof Ye?w:new Ye(tt.RequestTimeout,String(w))}let p=e.era===Ml&&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=(w)=>{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(w)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch((C)=>this._onerror(Error(`Failed to send cancellation: ${C}`)))}else p.abort();h(w instanceof Ye?w:new Ye(tt.RequestTimeout,String(w)))};this._responseHandlers.set(_,(w)=>{if(n?.signal?.aborted)return;if(E=!0,w instanceof Error)return h(w);let C;try{C=e.decodeResult(t.method,w.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(BM(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;bi(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??$M,T=()=>b(new Ye(tt.RequestTimeout,"Request timed out",{timeout:R}));this._setupTimeout(_,R,n?.maxTotalTimeout,T,n?.resetTimeoutOnProgress??!1),this._transport.send(S,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l,requestSignal:p?.signal}).catch((w)=>{this._progressHandlers.delete(_),h(w)})}).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(Tc(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(!bc(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 xe(we.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 bi(t.params,{...o.params});if(!s.success)throw new xe(we.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(!Tc(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 xe(we.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 bi(t.params,{...n.params});if(!o.success)throw new xe(we.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ts(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function FM(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]=Ts(s)&&Ts(i)?{...s,...i}:i}return r}function Gp(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function GM(e){let t={},r=[];if(!Gp(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!Gp(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function BM(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var HM=Se((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(l){if(!l)throw TypeError("argument string is required");var a=typeof l==="object"?i(l):l;if(typeof a!=="string")throw TypeError("argument string is required to be a string");var c=a.indexOf(";"),u=c!==-1?a.slice(0,c).trim():a.trim();if(!n.test(u))throw TypeError("invalid media type");var f=new s(u.toLowerCase());if(c!==-1){var h,g,p;t.lastIndex=c;while(g=t.exec(a)){if(g.index!==c)throw TypeError("invalid parameter format");if(c+=g[0].length,h=g[1].toLowerCase(),p=g[2],p.charCodeAt(0)===34){if(p=p.slice(1,-1),p.indexOf("\\")!==-1)p=p.replace(r,"$1")}f.parameters[h]=p}if(c!==a.length)throw TypeError("invalid parameter format")}return f}function i(l){var a;if(typeof l.getHeader==="function")a=l.getHeader("content-type");else if(typeof l.headers==="object")a=l.headers&&l.headers["content-type"];if(typeof a!=="string")throw TypeError("content-type header is missing from object");return a}function s(l){this.parameters=Object.create(null),this.type=l}}),H4=Sv(HM(),1),VM=10485760,zM=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??VM}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){while(this._buffer){let e=this._buffer.indexOf(`
|
|
117
|
+
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return jM(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function jM(e){return hy.parse(JSON.parse(e))}function WM(e){return JSON.stringify(e)+`
|
|
118
|
+
`}var JM=/^[A-Za-z0-9._-]{1,128}$/;function KM(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 XM(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 Bp(e){let t=KM(e);return XM(e,t.warnings),t.isValid}function YM(e){return typeof e==="object"&&e!==null&&"_zod"in e}function ZM(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function QM(e){if(typeof e!=="object"||e===null)return!1;if(Ni(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>YM(r))}function wc(e){if(e===void 0)return;if(QM(e))return X(e);if(typeof e==="object"&&e!==null&&!Ni(e)&&Object.values(e).some((t)=>ZM(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(!Ni(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 Qa=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(S){super();if(!e.IDENTIFIER.test(S))throw Error("CodeGen: name must be a valid identifier");this.str=S}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(S){super();this._items=typeof S==="string"?[S]:S}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let S=this._items[0];return S===""||S==='""'}get str(){var S;return(S=this._str)!==null&&S!==void 0?S:this._str=this._items.reduce((E,b)=>`${E}${b}`,"")}get names(){var S;return(S=this._names)!==null&&S!==void 0?S:this._names=this._items.reduce((E,b)=>{if(b instanceof r)E[b.str]=(E[b.str]||0)+1;return E},{})}};e._Code=n,e.nil=new n("");function o(S,...E){let b=[S[0]],R=0;while(R<E.length)l(b,E[R]),b.push(S[++R]);return new n(b)}e._=o;let i=new n("+");function s(S,...E){let b=[g(S[0])],R=0;while(R<E.length)b.push(i),l(b,E[R]),b.push(i,g(S[++R]));return a(b),new n(b)}e.str=s;function l(S,E){if(E instanceof n)S.push(...E._items);else if(E instanceof r)S.push(E);else S.push(f(E))}e.addCodeArg=l;function a(S){let E=1;while(E<S.length-1){if(S[E]===i){let b=c(S[E-1],S[E+1]);if(b!==void 0){S.splice(E-1,3,b);continue}S[E++]="+"}E++}}function c(S,E){if(E==='""')return S;if(S==='""')return E;if(typeof S=="string"){if(E instanceof r||S[S.length-1]!=='"')return;if(typeof E!="string")return`${S.slice(0,-1)}${E}"`;if(E[0]==='"')return S.slice(0,-1)+E.slice(1);return}if(typeof E=="string"&&E[0]==='"'&&!(S instanceof r))return`"${S}${E.slice(1)}`}function u(S,E){return E.emptyStr()?S:S.emptyStr()?E:s`${S}${E}`}e.strConcat=u;function f(S){return typeof S=="number"||typeof S=="boolean"||S===null?S:g(Array.isArray(S)?S.join(","):S)}function h(S){return new n(g(S))}e.stringify=h;function g(S){return JSON.stringify(S).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=g;function p(S){return typeof S=="string"&&e.IDENTIFIER.test(S)?new n(`.${S}`):o`[${S}]`}e.getProperty=p;function _(S){if(typeof S=="string"&&e.IDENTIFIER.test(S))return new n(`${S}`);throw Error(`CodeGen: invalid export name: ${S}, use explicit $id name mapping`)}e.getEsmExportName=_;function y(S){return new n(S.toString())}e.regexpCode=y}),Hp=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Qa();var r=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`);this.value=a.value}},n;(function(a){a[a.Started=0]="Started",a[a.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var o=class{constructor({prefixes:a,parent:c}={}){this._names={},this._prefixes=a,this._parent=c}toName(a){return a instanceof t.Name?a:this.name(a)}name(a){return new t.Name(this._newName(a))}_newName(a){let c=this._names[a]||this._nameGroup(a);return`${a}${c.index++}`}_nameGroup(a){var c,u;if(((u=(c=this._parent)===null||c===void 0?void 0:c._prefixes)===null||u===void 0?void 0:u.has(a))||this._prefixes&&!this._prefixes.has(a))throw Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};e.Scope=o;var i=class extends t.Name{constructor(a,c){super(c);this.prefix=a}setValue(a,{property:c,itemIndex:u}){this.value=a,this.scopePath=t._`.${new t.Name(c)}[${u}]`}};e.ValueScopeName=i;let s=t._`\n`;var l=class extends o{constructor(a){super(a);this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?s:t.nil}}get(){return this._scope}name(a){return new i(a,this._newName(a))}value(a,c){var u;if(c.ref===void 0)throw Error("CodeGen: ref must be passed in value");let f=this.toName(a),{prefix:h}=f,g=(u=c.key)!==null&&u!==void 0?u:c.ref,p=this._values[h];if(p){let S=p.get(g);if(S)return S}else p=this._values[h]=new Map;p.set(g,f);let _=this._scope[h]||(this._scope[h]=[]),y=_.length;return _[y]=c.ref,f.setValue(c,{property:h,itemIndex:y}),f}getValue(a,c){let u=this._values[a];if(!u)return;return u.get(c)}scopeRefs(a,c=this._values){return this._reduceValues(c,(u)=>{if(u.scopePath===void 0)throw Error(`CodeGen: name "${u}" has no value`);return t._`${a}${u.scopePath}`})}scopeCode(a=this._values,c,u){return this._reduceValues(a,(f)=>{if(f.value===void 0)throw Error(`CodeGen: name "${f}" has no value`);return f.value.code},c,u)}_reduceValues(a,c,u={},f){let h=t.nil;for(let g in a){let p=a[g];if(!p)continue;let _=u[g]=u[g]||new Map;p.forEach((y)=>{if(_.has(y))return;_.set(y,n.Started);let S=c(y);if(S){let E=this.opts.es5?e.varKinds.var:e.varKinds.const;h=t._`${h}${E} ${y} = ${S};${this.opts._n}`}else if(S=f===null||f===void 0?void 0:f(y))h=t._`${h}${S}${this.opts._n}`;else throw new r(y);_.set(y,n.Completed)})}return h}};e.ValueScope=l}),Xe=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=Qa(),r=Hp();var n=Qa();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=Hp();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(L,K){return this}},s=class extends i{constructor(L,K,W){super();this.varKind=L,this.name=K,this.rhs=W}render({es5:L,_n:K}){let W=L?r.varKinds.var:this.varKind,be=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${be};`+K}optimizeNames(L,K){if(!L[this.name.str])return;if(this.rhs)this.rhs=B(this.rhs,L,K);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},l=class extends i{constructor(L,K,W){super();this.lhs=L,this.rhs=K,this.sideEffects=W}render({_n:L}){return`${this.lhs} = ${this.rhs};`+L}optimizeNames(L,K){if(this.lhs instanceof t.Name&&!L[this.lhs.str]&&!this.sideEffects)return;return this.rhs=B(this.rhs,L,K),this}get names(){return G(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends l{constructor(L,K,W,be){super(L,W,be);this.op=K}render({_n:L}){return`${this.lhs} ${this.op}= ${this.rhs};`+L}},c=class extends i{constructor(L){super();this.label=L,this.names={}}render({_n:L}){return`${this.label}:`+L}},u=class extends i{constructor(L){super();this.label=L,this.names={}}render({_n:L}){return`break${this.label?` ${this.label}`:""};`+L}},f=class extends i{constructor(L){super();this.error=L}render({_n:L}){return`throw ${this.error};`+L}get names(){return this.error.names}},h=class extends i{constructor(L){super();this.code=L}render({_n:L}){return`${this.code};`+L}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(L,K){return this.code=B(this.code,L,K),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},g=class extends i{constructor(L=[]){super();this.nodes=L}render(L){return this.nodes.reduce((K,W)=>K+W.render(L),"")}optimizeNodes(){let{nodes:L}=this,K=L.length;while(K--){let W=L[K].optimizeNodes();if(Array.isArray(W))L.splice(K,1,...W);else if(W)L[K]=W;else L.splice(K,1)}return L.length>0?this:void 0}optimizeNames(L,K){let{nodes:W}=this,be=W.length;while(be--){let Ce=W[be];if(Ce.optimizeNames(L,K))continue;Q(L,Ce.names),W.splice(be,1)}return W.length>0?this:void 0}get names(){return this.nodes.reduce((L,K)=>F(L,K.names),{})}},p=class extends g{render(L){return"{"+L._n+super.render(L)+"}"+L._n}},_=class extends g{},y=class extends p{};y.kind="else";var S=class L extends p{constructor(K,W){super(W);this.condition=K}render(K){let W=`if(${this.condition})`+super.render(K);if(this.else)W+="else "+this.else.render(K);return W}optimizeNodes(){super.optimizeNodes();let K=this.condition;if(K===!0)return this.nodes;let W=this.else;if(W){let be=W.optimizeNodes();W=this.else=Array.isArray(be)?new y(be):be}if(W){if(K===!1)return W instanceof L?W:W.nodes;if(this.nodes.length)return this;return new L(pe(K),W instanceof L?[W]:W.nodes)}if(K===!1||!this.nodes.length)return;return this}optimizeNames(K,W){var be;if(this.else=(be=this.else)===null||be===void 0?void 0:be.optimizeNames(K,W),!(super.optimizeNames(K,W)||this.else))return;return this.condition=B(this.condition,K,W),this}get names(){let K=super.names;if(G(K,this.condition),this.else)F(K,this.else.names);return K}};S.kind="if";var E=class extends p{};E.kind="for";var b=class extends E{constructor(L){super();this.iteration=L}render(L){return`for(${this.iteration})`+super.render(L)}optimizeNames(L,K){if(!super.optimizeNames(L,K))return;return this.iteration=B(this.iteration,L,K),this}get names(){return F(super.names,this.iteration.names)}},R=class extends E{constructor(L,K,W,be){super();this.varKind=L,this.name=K,this.from=W,this.to=be}render(L){let K=L.es5?r.varKinds.var:this.varKind,{name:W,from:be,to:Ce}=this;return`for(${K} ${W}=${be}; ${W}<${Ce}; ${W}++)`+super.render(L)}get names(){return G(G(super.names,this.from),this.to)}},T=class extends E{constructor(L,K,W,be){super();this.loop=L,this.varKind=K,this.name=W,this.iterable=be}render(L){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(L)}optimizeNames(L,K){if(!super.optimizeNames(L,K))return;return this.iterable=B(this.iterable,L,K),this}get names(){return F(super.names,this.iterable.names)}},w=class extends p{constructor(L,K,W){super();this.name=L,this.args=K,this.async=W}render(L){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(L)}};w.kind="func";var C=class extends g{render(L){return"return "+super.render(L)}};C.kind="return";var A=class extends p{render(L){let K="try"+super.render(L);if(this.catch)K+=this.catch.render(L);if(this.finally)K+=this.finally.render(L);return K}optimizeNodes(){var L,K;return super.optimizeNodes(),(L=this.catch)===null||L===void 0||L.optimizeNodes(),(K=this.finally)===null||K===void 0||K.optimizeNodes(),this}optimizeNames(L,K){var W,be;return super.optimizeNames(L,K),(W=this.catch)===null||W===void 0||W.optimizeNames(L,K),(be=this.finally)===null||be===void 0||be.optimizeNames(L,K),this}get names(){let L=super.names;if(this.catch)F(L,this.catch.names);if(this.finally)F(L,this.finally.names);return L}},P=class extends p{constructor(L){super();this.error=L}render(L){return`catch(${this.error})`+super.render(L)}};P.kind="catch";var D=class extends p{render(L){return"finally"+super.render(L)}};D.kind="finally";var N=class{constructor(L,K={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...K,_n:K.lines?`
|
|
119
|
+
`:""},this._extScope=L,this._scope=new r.Scope({parent:L}),this._nodes=[new _]}toString(){return this._root.render(this.opts)}name(L){return this._scope.name(L)}scopeName(L){return this._extScope.name(L)}scopeValue(L,K){let W=this._extScope.value(L,K);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(L,K){return this._extScope.getValue(L,K)}scopeRefs(L){return this._extScope.scopeRefs(L,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(L,K,W,be){let Ce=this._scope.toName(K);if(W!==void 0&&be)this._constants[Ce.str]=W;return this._leafNode(new s(L,Ce,W)),Ce}const(L,K,W){return this._def(r.varKinds.const,L,K,W)}let(L,K,W){return this._def(r.varKinds.let,L,K,W)}var(L,K,W){return this._def(r.varKinds.var,L,K,W)}assign(L,K,W){return this._leafNode(new l(L,K,W))}add(L,K){return this._leafNode(new a(L,e.operators.ADD,K))}code(L){if(typeof L=="function")L();else if(L!==t.nil)this._leafNode(new h(L));return this}object(...L){let K=["{"];for(let[W,be]of L){if(K.length>1)K.push(",");if(K.push(W),W!==be||this.opts.es5)K.push(":"),(0,t.addCodeArg)(K,be)}return K.push("}"),new t._Code(K)}if(L,K,W){if(this._blockNode(new S(L)),K&&W)this.code(K).else().code(W).endIf();else if(K)this.code(K).endIf();else if(W)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(L){return this._elseNode(new S(L))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(S,y)}_for(L,K){if(this._blockNode(L),K)this.code(K).endFor();return this}for(L,K){return this._for(new b(L),K)}forRange(L,K,W,be,Ce=this.opts.es5?r.varKinds.var:r.varKinds.let){let Ve=this._scope.toName(L);return this._for(new R(Ce,Ve,K,W),()=>be(Ve))}forOf(L,K,W,be=r.varKinds.const){let Ce=this._scope.toName(L);if(this.opts.es5){let Ve=K instanceof t.Name?K:this.var("_arr",K);return this.forRange("_i",0,t._`${Ve}.length`,(Ie)=>{this.var(Ce,t._`${Ve}[${Ie}]`),W(Ce)})}return this._for(new T("of",be,Ce,K),()=>W(Ce))}forIn(L,K,W,be=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(L,t._`Object.keys(${K})`,W);let Ce=this._scope.toName(L);return this._for(new T("in",be,Ce,K),()=>W(Ce))}endFor(){return this._endBlockNode(E)}label(L){return this._leafNode(new c(L))}break(L){return this._leafNode(new u(L))}return(L){let K=new C;if(this._blockNode(K),this.code(L),K.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(L,K,W){if(!K&&!W)throw Error('CodeGen: "try" without "catch" and "finally"');let be=new A;if(this._blockNode(be),this.code(L),K){let Ce=this.name("e");this._currNode=be.catch=new P(Ce),K(Ce)}if(W)this._currNode=be.finally=new D,this.code(W);return this._endBlockNode(P,D)}throw(L){return this._leafNode(new f(L))}block(L,K){if(this._blockStarts.push(this._nodes.length),L)this.code(L).endBlock(K);return this}endBlock(L){let K=this._blockStarts.pop();if(K===void 0)throw Error("CodeGen: not in self-balancing block");let W=this._nodes.length-K;if(W<0||L!==void 0&&W!==L)throw Error(`CodeGen: wrong number of nodes: ${W} vs ${L} expected`);return this._nodes.length=K,this}func(L,K=t.nil,W,be){if(this._blockNode(new w(L,K,W)),be)this.code(be).endFunc();return this}endFunc(){return this._endBlockNode(w)}optimize(L=1){while(L-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(L){return this._currNode.nodes.push(L),this}_blockNode(L){this._currNode.nodes.push(L),this._nodes.push(L)}_endBlockNode(L,K){let W=this._currNode;if(W instanceof L||K&&W instanceof K)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${K?`${L.kind}/${K.kind}`:L.kind}"`)}_elseNode(L){let K=this._currNode;if(!(K instanceof S))throw Error('CodeGen: "else" without "if"');return this._currNode=K.else=L,this}get _root(){return this._nodes[0]}get _currNode(){let L=this._nodes;return L[L.length-1]}set _currNode(L){let K=this._nodes;K[K.length-1]=L}};e.CodeGen=N;function F(L,K){for(let W in K)L[W]=(L[W]||0)+(K[W]||0);return L}function G(L,K){return K instanceof t._CodeOrName?F(L,K.names):L}function B(L,K,W){if(L instanceof t.Name)return be(L);if(!Ce(L))return L;return new t._Code(L._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||K[Ve.str]!==1)return Ve;return delete K[Ve.str],Ie}function Ce(Ve){return Ve instanceof t._Code&&Ve._items.some((Ie)=>Ie instanceof t.Name&&K[Ie.str]===1&&W[Ie.str]!==void 0)}}function Q(L,K){for(let W in K)L[W]=(L[W]||0)-(K[W]||0)}function pe(L){return typeof L=="boolean"||typeof L=="number"||L===null?!L:t._`!${he(L)}`}e.not=pe;let se=ne(e.operators.AND);function ve(...L){return L.reduce(se)}e.and=ve;let me=ne(e.operators.OR);function j(...L){return L.reduce(me)}e.or=j;function ne(L){return(K,W)=>K===t.nil?W:W===t.nil?K:t._`${he(K)} ${L} ${he(W)}`}function he(L){return L instanceof t.Name?L:t._`(${L})`}}),ut=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=Xe(),r=Qa();function n(w){let C={};for(let A of w)C[A]=!0;return C}e.toHash=n;function o(w,C){if(typeof C=="boolean")return C;if(Object.keys(C).length===0)return!0;return i(w,C),!s(C,w.self.RULES.all)}e.alwaysValidSchema=o;function i(w,C=w.schema){let{opts:A,self:P}=w;if(!A.strictSchema)return;if(typeof C==="boolean")return;let D=P.RULES.keywords;for(let N in C)if(!D[N])T(w,`unknown keyword: "${N}"`)}e.checkUnknownRules=i;function s(w,C){if(typeof w=="boolean")return!w;for(let A in w)if(C[A])return!0;return!1}e.schemaHasRules=s;function l(w,C){if(typeof w=="boolean")return!w;for(let A in w)if(A!=="$ref"&&C.all[A])return!0;return!1}e.schemaHasRulesButRef=l;function a({topSchemaRef:w,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._`${w}${C}${(0,t.getProperty)(P)}`}e.schemaRefOrVal=a;function c(w){return h(decodeURIComponent(w))}e.unescapeFragment=c;function u(w){return encodeURIComponent(f(w))}e.escapeFragment=u;function f(w){if(typeof w=="number")return`${w}`;return w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=f;function h(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=h;function g(w,C){if(Array.isArray(w))for(let A of w)C(A);else C(w)}e.eachItem=g;function p({mergeNames:w,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?w(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:(w,C,A)=>w.if(t._`${A} !== true && ${C} !== undefined`,()=>{w.if(t._`${C} === true`,()=>w.assign(A,!0),()=>w.assign(A,t._`${A} || {}`).code(t._`Object.assign(${A}, ${C})`))}),mergeToName:(w,C,A)=>w.if(t._`${A} !== true`,()=>{if(C===!0)w.assign(A,!0);else w.assign(A,t._`${A} || {}`),y(w,A,C)}),mergeValues:(w,C)=>w===!0?!0:{...w,...C},resultToName:_}),items:p({mergeNames:(w,C,A)=>w.if(t._`${A} !== true && ${C} !== undefined`,()=>w.assign(A,t._`${C} === true ? true : ${A} > ${C} ? ${A} : ${C}`)),mergeToName:(w,C,A)=>w.if(t._`${A} !== true`,()=>w.assign(A,C===!0?!0:t._`${A} > ${C} ? ${A} : ${C}`)),mergeValues:(w,C)=>w===!0?!0:Math.max(w,C),resultToName:(w,C)=>w.var("items",C)})};function _(w,C){if(C===!0)return w.var("props",!0);let A=w.var("props",t._`{}`);if(C!==void 0)y(w,A,C);return A}e.evaluatedPropsToName=_;function y(w,C,A){Object.keys(A).forEach((P)=>w.assign(t._`${C}${(0,t.getProperty)(P)}`,!0))}e.setEvaluated=y;let S={};function E(w,C){return w.scopeValue("func",{ref:C,code:S[C.code]||(S[C.code]=new r._Code(C.code))})}e.useFunc=E;var b;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(b||(e.Type=b={}));function R(w,C,A){if(w instanceof t.Name){let P=C===b.Num;return A?P?t._`"[" + ${w} + "]"`:t._`"['" + ${w} + "']"`:P?t._`"/" + ${w}`:t._`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(w).toString():"/"+f(w)}e.getErrorPath=R;function T(w,C,A=w.opts.strictSchema){if(!A)return;if(C=`strict mode: ${C}`,A===!0)throw Error(C);w.self.logger.warn(C)}e.checkStrictMode=T}),jr=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Dl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=Xe(),r=ut(),n=jr();e.keywordError={message:({keyword:y})=>t.str`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:S})=>S?t.str`"${y}" keyword must be ${S} ($data)`:t.str`"${y}" keyword is invalid ($data)`};function o(y,S=e.keywordError,E,b){let{it:R}=y,{gen:T,compositeRule:w,allErrors:C}=R,A=f(y,S,E);if(b!==null&&b!==void 0?b:w||C)a(T,A);else c(R,t._`[${A}]`)}e.reportError=o;function i(y,S=e.keywordError,E){let{it:b}=y,{gen:R,compositeRule:T,allErrors:w}=b;if(a(R,f(y,S,E)),!(T||w))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:T}){if(R===void 0)throw Error("ajv implementation error");let w=y.name("err");y.forRange("i",R,n.default.errors,(C)=>{if(y.const(w,t._`${n.default.vErrors}[${C}]`),y.if(t._`${w}.instancePath === undefined`,()=>y.assign(t._`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,T.errorPath))),y.assign(t._`${w}.schemaPath`,t.str`${T.errSchemaPath}/${S}`),T.opts.verbose)y.assign(t._`${w}.schema`,E),y.assign(t._`${w}.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,T=[g(R,E),p(y,E)];return _(y,S,T),b.object(...T)}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:T,schemaValue:w,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,w],[u.parentSchema,t._`${D}${N}`],[n.default.data,T]);if(P)b.push([u.propertyName,P])}}),e$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Dl(),r=Xe(),n=jr(),o={message:"boolean schema is false"};function i(a){let{gen:c,schema:u,validateName:f}=a;if(u===!1)l(a,!1);else if(typeof u=="object"&&u.$async===!0)c.return(n.default.data);else c.assign(r._`${f}.errors`,null),c.return(!0)}e.topBoolOrEmptySchema=i;function s(a,c){let{gen:u,schema:f}=a;if(f===!1)u.var(c,!1),l(a);else u.var(c,!0)}e.boolOrEmptySchema=s;function l(a,c){let{gen:u,data:f}=a,h={gen:u,keyword:"false schema",data:f,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(h,o,void 0,c)}}),AS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(o){return typeof o=="string"&&t.has(o)}e.isJSONType=r;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=n}),IS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:o,self:i},s){let l=i.RULES.types[s];return l&&l!==!0&&r(o,l)}e.schemaHasRulesForType=t;function r(o,i){return i.rules.some((s)=>n(o,s))}e.shouldUseGroup=r;function n(o,i){var s;return o[i.keyword]!==void 0||((s=i.definition.implements)===null||s===void 0?void 0:s.some((l)=>o[l]!==void 0))}e.shouldUseRule=n}),el=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=AS(),r=IS(),n=Dl(),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:T,data:w,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,w,C.strictNumbers,s.Wrong);T.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((T)=>u.has(T)||R==="array"&&T==="array"):[]}function h(b,R,T){let{gen:w,data:C,opts:A}=b,P=w.let("dataType",o._`typeof ${C}`),D=w.let("coerced",o._`undefined`);if(A.coerceTypes==="array")w.if(o._`${P} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>w.assign(C,o._`${C}[0]`).assign(P,o._`typeof ${C}`).if(_(R,C,A.strictNumbers),()=>w.assign(D,C)));w.if(o._`${D} !== undefined`);for(let F of T)if(u.has(F)||F==="array"&&A.coerceTypes==="array")N(F);w.else(),S(b),w.endIf(),w.if(o._`${D} !== undefined`,()=>{w.assign(C,D),g(b,D)});function N(F){switch(F){case"string":w.elseIf(o._`${P} == "number" || ${P} == "boolean"`).assign(D,o._`"" + ${C}`).elseIf(o._`${C} === null`).assign(D,o._`""`);return;case"number":w.elseIf(o._`${P} == "boolean" || ${C} === null
|
|
120
|
+
|| (${P} == "string" && ${C} && ${C} == +${C})`).assign(D,o._`+${C}`);return;case"integer":w.elseIf(o._`${P} === "boolean" || ${C} === null
|
|
121
|
+
|| (${P} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(D,o._`+${C}`);return;case"boolean":w.elseIf(o._`${C} === "false" || ${C} === 0 || ${C} === null`).assign(D,!1).elseIf(o._`${C} === "true" || ${C} === 1`).assign(D,!0);return;case"null":w.elseIf(o._`${C} === "" || ${C} === 0 || ${C} === false`),w.assign(D,null);return;case"array":w.elseIf(o._`${P} === "string" || ${P} === "number"
|
|
122
|
+
|| ${P} === "boolean" || ${C} === null`).assign(D,o._`[${C}]`)}}}function g({gen:b,parentData:R,parentDataProperty:T},w){b.if(o._`${R} !== undefined`,()=>b.assign(o._`${R}[${T}]`,w))}function p(b,R,T,w=s.Correct){let C=w===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 w===s.Correct?A:(0,o.not)(A);function P(D=o.nil){return(0,o.and)(o._`typeof ${R} == "number"`,D,T?o._`isFinite(${R})`:o.nil)}}e.checkDataType=p;function _(b,R,T,w){if(b.length===1)return p(b[0],R,T,w);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,T,w));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:T,schema:w}=b,C=(0,i.schemaRefOrVal)(b,w,"type");return{gen:R,keyword:"type",data:T,schema:w.type,schemaCode:C,schemaValue:C,parentSchema:w,params:{},it:b}}}),t$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=Xe(),r=ut();function n(i,s){let{properties:l,items:a}=i.schema;if(s==="object"&&l)for(let c in l)o(i,c,l[c].default);else if(s==="array"&&Array.isArray(a))a.forEach((c,u)=>o(i,u,c.default))}e.assignDefaults=n;function o(i,s,l){let{gen:a,compositeRule:c,data:u,opts:f}=i;if(l===void 0)return;let h=t._`${u}${(0,t.getProperty)(s)}`;if(c){(0,r.checkStrictMode)(i,`default is ignored for: ${h}`);return}let g=t._`${h} === undefined`;if(f.useDefaults==="empty")g=t._`${g} || ${h} === null || ${h} === ""`;a.if(g,t._`${h} = ${(0,t.stringify)(l)}`)}}),Wr=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=Xe(),r=ut(),n=jr(),o=ut();function i(b,R){let{gen:T,data:w,it:C}=b;T.if(f(T,w,R,C.opts.ownProperties),()=>{b.setParams({missingProperty:t._`${R}`},!0),b.error()})}e.checkReportMissingProp=i;function s({gen:b,data:R,it:{opts:T}},w,C){return(0,t.or)(...w.map((A)=>(0,t.and)(f(b,R,A,T.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,T){return t._`${a(b)}.call(${R}, ${T})`}e.isOwnProperty=c;function u(b,R,T,w){let C=t._`${R}${(0,t.getProperty)(T)} !== undefined`;return w?t._`${C} && ${c(b,R,T)}`:C}e.propertyInData=u;function f(b,R,T,w){let C=t._`${R}${(0,t.getProperty)(T)} === undefined`;return w?(0,t.or)(C,(0,t.not)(c(b,R,T))):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((T)=>!(0,r.alwaysValidSchema)(b,R[T]))}e.schemaProperties=g;function p({schemaCode:b,data:R,it:{gen:T,topSchemaRef:w,schemaPath:C,errorPath:A},it:P},D,N,F){let G=F?t._`${b}, ${R}, ${w}${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}, ${T.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}},T){let w=R.unicodeRegExp?"u":"",{regExp:C}=R.code,A=C(T,w);return b.scopeValue("pattern",{key:A.toString(),ref:A,code:t._`${C.code==="new RegExp"?_:(0,o.useFunc)(b,C)}(${T}, ${w})`})}e.usePattern=y;function S(b){let{gen:R,data:T,keyword:w,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._`${T}.length`);R.forRange("i",0,N,(F)=>{b.subschema({keyword:w,dataProp:F,dataPropType:r.Type.Num},A),R.if((0,t.not)(A),D)})}}e.validateArray=S;function E(b){let{gen:R,schema:T,keyword:w,it:C}=b;if(!Array.isArray(T))throw Error("ajv implementation error");if(T.some((D)=>(0,r.alwaysValidSchema)(C,D))&&!C.opts.unevaluated)return;let A=R.let("valid",!1),P=R.name("_valid");R.block(()=>T.forEach((D,N)=>{let F=b.subschema({keyword:w,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}),r$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Xe(),r=jr(),n=Wr(),o=Dl();function i(g,p){let{gen:_,keyword:y,schema:S,parentSchema:E,it:b}=g,R=p.macro.call(b.self,S,E,b),T=u(_,y,R);if(b.opts.validateSchema!==!1)b.self.validateSchema(R,!0);let w=_.name("valid");g.subschema({schema:R,schemaPath:t.nil,errSchemaPath:`${b.errSchemaPath}/${y}`,topSchemaRef:T,compositeRule:!0},w),g.pass(w,()=>g.error(!0))}e.macroKeywordCode=i;function s(g,p){var _;let{gen:y,keyword:S,schema:E,parentSchema:b,$data:R,it:T}=g;c(T,p);let w=u(y,S,!R&&p.compile?p.compile.call(T.self,E,b,T):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 ${T.ValidationError}`,()=>y.assign(G,t._`${B}.errors`),()=>y.throw(B))),G}function D(){let G=t._`${w}.errors`;return y.assign(G,null),N(t.nil),G}function N(G=p.async?t._`await `:t.nil){let B=T.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,w,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}),n$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=Xe(),r=ut();function n(s,{keyword:l,schemaProp:a,schema:c,schemaPath:u,errSchemaPath:f,topSchemaRef:h}){if(l!==void 0&&c!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(l!==void 0){let g=s.schema[l];return a===void 0?{schema:g,schemaPath:t._`${s.schemaPath}${(0,t.getProperty)(l)}`,errSchemaPath:`${s.errSchemaPath}/${l}`}:{schema:g[a],schemaPath:t._`${s.schemaPath}${(0,t.getProperty)(l)}${(0,t.getProperty)(a)}`,errSchemaPath:`${s.errSchemaPath}/${l}/${(0,r.escapeFragment)(a)}`}}if(c!==void 0){if(u===void 0||f===void 0||h===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:u,topSchemaRef:h,errSchemaPath:f}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function o(s,l,{dataProp:a,dataPropType:c,data:u,dataTypes:f,propertyName:h}){if(u!==void 0&&a!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:g}=l;if(a!==void 0){let{errorPath:_,dataPathArr:y,opts:S}=l;p(g.let("data",t._`${l.data}${(0,t.getProperty)(a)}`,!0)),s.errorPath=t.str`${_}${(0,r.getErrorPath)(a,c,S.jsPropertySyntax)}`,s.parentDataProperty=t._`${a}`,s.dataPathArr=[...y,s.parentDataProperty]}if(u!==void 0){if(p(u instanceof t.Name?u:g.let("data",u,!0)),h!==void 0)s.propertyName=h}if(f)s.dataTypes=f;function p(_){s.data=_,s.dataLevel=l.dataLevel+1,s.dataTypes=[],l.definedProperties=new Set,s.parentData=l.data,s.dataNames=[...l.dataNames,_]}}e.extendSubschemaData=o;function i(s,{jtdDiscriminator:l,jtdMetadata:a,compositeRule:c,createErrors:u,allErrors:f}){if(c!==void 0)s.compositeRule=c;if(u!==void 0)s.createErrors=u;if(f!==void 0)s.allErrors=f;s.jtdDiscriminator=l,s.jtdMetadata=a}e.extendSubschemaMode=i}),PS=Se((e,t)=>{t.exports=function r(n,o){if(n===o)return!0;if(n&&o&&typeof n=="object"&&typeof o=="object"){if(n.constructor!==o.constructor)return!1;var i,s,l;if(Array.isArray(n)){if(i=n.length,i!=o.length)return!1;for(s=i;s--!==0;)if(!r(n[s],o[s]))return!1;return!0}if(n.constructor===RegExp)return n.source===o.source&&n.flags===o.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===o.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===o.toString();if(l=Object.keys(n),i=l.length,i!==Object.keys(o).length)return!1;for(s=i;s--!==0;)if(!Object.prototype.hasOwnProperty.call(o,l[s]))return!1;for(s=i;s--!==0;){var a=l[s];if(!r(n[a],o[a]))return!1}return!0}return n!==n&&o!==o}}),o$=Se((e,t)=>{var r=t.exports=function(i,s,l){if(typeof s=="function")l=s,s={};l=s.cb||l;var a=typeof l=="function"?l:l.pre||function(){},c=l.post||function(){};n(s,a,c,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function n(i,s,l,a,c,u,f,h,g,p){if(a&&typeof a=="object"&&!Array.isArray(a)){s(a,c,u,f,h,g,p);for(var _ in a){var y=a[_];if(Array.isArray(y)){if(_ in r.arrayKeywords)for(var S=0;S<y.length;S++)n(i,s,l,y[S],c+"/"+_+"/"+S,u,c,_,a,S)}else if(_ in r.propsKeywords){if(y&&typeof y=="object")for(var E in y)n(i,s,l,y[E],c+"/"+_+"/"+o(E),u,c,_,a,E)}else if(_ in r.keywords||i.allKeys&&!(_ in r.skipKeywords))n(i,s,l,y,c+"/"+_,u,c,_,a)}l(a,c,u,f,h,g,p)}}function o(i){return i.replace(/~/g,"~0").replace(/\//g,"~1")}}),ql=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=ut(),r=PS(),n=o$(),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),T={"":R},w=c(b,R,!1),C={},A=new Set;return n(y,{allKeys:!0},(N,F,G,B)=>{if(B===void 0)return;let Q=w+F,pe=T[B];if(typeof N[E]=="string")pe=se.call(this,N[E]);ve.call(this,N.$anchor),ve.call(this,N.$dynamicAnchor),T[F]=pe;function se(me){let j=this.opts.uriResolver.resolve;if(me=h(pe?j(pe,me):me),A.has(me))throw D(me);A.add(me);let ne=this.refs[me];if(typeof ne=="string")ne=this.refs[ne];if(typeof ne=="object")P(N,ne.schema,me);else if(me!==h(Q))if(me[0]==="#")P(N,C[me],me),C[me]=N;else this.refs[me]=Q;return me}function ve(me){if(typeof me=="string"){if(!p.test(me))throw Error(`invalid anchor "${me}"`);se.call(this,`#${me}`)}}}),C;function P(N,F,G){if(F!==void 0&&!r(N,F))throw D(G)}function D(N){return Error(`reference "${N}" resolves to more than one schema`)}}e.getSchemaRefs=_}),Vi=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=e$(),r=el(),n=IS(),o=el(),i=t$(),s=r$(),l=n$(),a=Xe(),c=jr(),u=ql(),f=ut(),h=Dl();function g(O){if(w(O)){if(A(O),T(O)){S(O);return}}p(O,()=>(0,t.topBoolOrEmptySchema)(O))}e.validateFunctionCode=g;function p({gen:O,validateName:q,schema:H,schemaEnv:J,opts:Y},ee){if(Y.code.es5)O.func(q,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(q,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,q){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}`),q.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),q.dynamicRef)O.var(c.default.dynamicAnchors,a._`{}`)})}function S(O){let{schema:q,opts:H,gen:J}=O;p(O,()=>{if(H.$comment&&q.$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:q,validateName:H}=O;O.evaluated=q.const("evaluated",a._`${H}.evaluated`),q.if(a._`${O.evaluated}.dynamicProps`,()=>q.assign(a._`${O.evaluated}.props`,a._`undefined`)),q.if(a._`${O.evaluated}.dynamicItems`,()=>q.assign(a._`${O.evaluated}.items`,a._`undefined`))}function b(O,q){let H=typeof O=="object"&&O[q.schemaId];return H&&(q.code.source||q.code.process)?a._`/*# sourceURL=${H} */`:a.nil}function R(O,q){if(w(O)){if(A(O),T(O)){C(O,q);return}}(0,t.boolOrEmptySchema)(O,q)}function T({schema:O,self:q}){if(typeof O=="boolean")return!O;for(let H in O)if(q.RULES.all[H])return!0;return!1}function w(O){return typeof O.schema!="boolean"}function C(O,q){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(q,a._`${ee} === ${c.default.errors}`)}function A(O){(0,f.checkUnknownRules)(O),D(O)}function P(O,q){if(O.opts.jtd)return se(O,[],!1,q);let H=(0,r.getSchemaTypes)(O.schema);se(O,H,!(0,r.coerceAndCheckDataType)(O,H),q)}function D(O){let{schema:q,errSchemaPath:H,opts:J,self:Y}=O;if(q.$ref&&J.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(q,Y.RULES))Y.logger.warn(`$ref: keywords ignored in schema at path "${H}"`)}function N(O){let{schema:q,opts:H}=O;if(q.default!==void 0&&H.useDefaults&&H.strictSchema)(0,f.checkStrictMode)(O,"default is ignored in the schema root")}function F(O){let q=O.schema[O.opts.schemaId];if(q)O.baseId=(0,u.resolveUrl)(O.opts.uriResolver,O.baseId,q)}function G(O){if(O.schema.$async&&!O.schemaEnv.$async)throw Error("async schema in sync schema")}function B({gen:O,schemaEnv:q,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:q.root});O.code(a._`${c.default.self}.opts.$comment(${ee}, ${Z}, ${te}.schema)`)}}function Q(O){let{gen:q,schemaEnv:H,validateName:J,ValidationError:Y,opts:ee}=O;if(H.$async)q.if(a._`${c.default.errors} === 0`,()=>q.return(c.default.data),()=>q.throw(a._`new ${Y}(${c.default.vErrors})`));else{if(q.assign(a._`${J}.errors`,c.default.vErrors),ee.unevaluated)pe(O);q.return(a._`${c.default.errors} === 0`)}}function pe({gen:O,evaluated:q,props:H,items:J}){if(H instanceof a.Name)O.assign(a._`${q}.props`,H);if(J instanceof a.Name)O.assign(a._`${q}.items`,J)}function se(O,q,H,J){let{gen:Y,schema:ee,data:Z,allErrors:te,opts:oe,self:x}=O,{RULES:z}=x;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,q);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),q.length===1&&q[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,q){let{gen:H,schema:J,opts:{useDefaults:Y}}=O;if(Y)(0,i.assignDefaults)(O,q.type);H.block(()=>{for(let ee of q.rules)if((0,n.shouldUseRule)(J,ee))Ve(O,ee.keyword,ee.definition,q.type)})}function me(O,q){if(O.schemaEnv.meta||!O.opts.strictTypes)return;if(j(O,q),!O.opts.allowUnionTypes)ne(O,q);he(O,O.dataTypes)}function j(O,q){if(!q.length)return;if(!O.dataTypes.length){O.dataTypes=q;return}q.forEach((H)=>{if(!K(O.dataTypes,H))be(O,`type "${H}" not allowed by context "${O.dataTypes.join(",")}"`)}),W(O,q)}function ne(O,q){if(q.length>1&&!(q.length===2&&q.includes("null")))be(O,"use allowUnionTypes to allow union type keyword")}function he(O,q){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)=>L(q,Z)))be(O,`missing type "${ee.join(",")}" for keyword "${J}"`)}}}function L(O,q){return O.includes(q)||q==="number"&&O.includes("integer")}function K(O,q){return O.includes(q)||q==="integer"&&O.includes("number")}function W(O,q){let H=[];for(let J of O.dataTypes)if(K(q,J))H.push(J);else if(q.includes("integer")&&J==="number")H.push("integer");O.dataTypes=H}function be(O,q){let H=O.schemaEnv.baseId+O.errSchemaPath;q+=` at "${H}" (strictTypes)`,(0,f.checkStrictMode)(O,q,O.opts.strictTypes)}var Ce=class{constructor(O,q,H){if((0,s.validateKeywordUsage)(O,q,H),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=H,this.data=O.data,this.schema=O.schema[H],this.$data=q.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(O,this.schema,H,this.$data),this.schemaType=q.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=q,this.$data)this.schemaCode=O.gen.const("vSchema",U(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,q.schemaType,q.allowUndefined))throw Error(`${H} value must be ${JSON.stringify(q.schemaType)}`);if("code"in q?q.trackErrors:q.errors!==!1)this.errsCount=O.gen.const("_errs",c.default.errors)}result(O,q,H){this.failResult((0,a.not)(O),q,H)}failResult(O,q,H){if(this.gen.if(O),H)H();else this.error();if(q){if(this.gen.else(),q(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(O,q){this.failResult((0,a.not)(O),void 0,q)}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:q}=this;this.fail(a._`${q} !== undefined && (${(0,a.or)(this.invalid$data(),O)})`)}error(O,q,H){if(q){this.setParams(q),this._error(O,H),this.setParams({});return}this._error(O,H)}_error(O,q){(O?h.reportExtraError:h.reportError)(this,this.def.error,q)}$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,q){if(q)Object.assign(this.params,O);else this.params=O}block$data(O,q,H=a.nil){this.gen.block(()=>{this.check$data(O,H),q()})}check$data(O=a.nil,q=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`,q)),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:q,schemaType:H,def:J,it:Y}=this;return(0,a.or)(ee(),Z());function ee(){if(H.length){if(!(q instanceof a.Name))throw Error("ajv implementation error");let te=Array.isArray(H)?H:[H];return a._`${(0,o.checkDataTypes)(te,q,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}(${q})`}return a.nil}}subschema(O,q){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,q),J}mergeEvaluated(O,q){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,q);if(H.items!==!0&&O.items!==void 0)H.items=f.mergeEvaluated.items(J,O.items,H.items,q)}mergeValidEvaluated(O,q){let{it:H,gen:J}=this;if(H.opts.unevaluated&&(H.props!==!0||H.items!==!0))return J.if(q,()=>this.mergeEvaluated(O,a.Name)),!0}};e.KeywordCxt=Ce;function Ve(O,q,H,J){let Y=new Ce(O,H,q);if("code"in H)H.code(Y,J);else if(Y.$data&&H.validate)(0,s.funcKeywordCode)(Y,H);else if("macro"in H)(0,s.macroKeywordCode)(Y,H);else if(H.compile||H.validate)(0,s.funcKeywordCode)(Y,H)}let Ie=/^\/(?:[^~]|~0|~1)*$/,je=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function U(O,{dataLevel:q,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 x=je.exec(O);if(!x)throw Error(`Invalid JSON-pointer: ${O}`);let z=+x[1];if(Y=x[2],Y==="#"){if(z>=q)throw Error(oe("property/index",z));return J[q-z]}if(z>q)throw Error(oe("data",z));if(ee=H[q-z],!Y)return ee}let Z=ee,te=Y.split("/");for(let x of te)if(x)ee=a._`${ee}${(0,a.getProperty)((0,f.unescapeJsonPointer)(x))}`,Z=a._`${Z} && ${ee}`;return Z;function oe(x,z){return`Cannot access ${x} ${z} levels up, current level is ${q}`}}e.getData=U}),Vs=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed");this.errors=r,this.ajv=this.validation=!0}};e.default=t}),zi=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ql();var r=class extends Error{constructor(n,o,i,s){super(s||`can't resolve reference ${i} from id ${o}`);this.missingRef=(0,t.resolveUrl)(n,o,i),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}};e.default=r}),xl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Xe(),r=Vs(),n=jr(),o=ql(),i=ut(),s=Vi();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:T}=this.opts.code,{ownProperties:w}=this.opts,C=new t.CodeGen(this.scope,{es5:R,lines:T,ownProperties:w}),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 T=S.refs[b];if(T)return T;let w=g.call(this,S,b);if(w===void 0){let C=(R=S.localRefs)===null||R===void 0?void 0:R[b],{schemaId:A}=this.opts;if(C)w=new l({schema:C,schemaId:A,root:S,baseId:E})}if(w===void 0)return;return S.refs[b]=u.call(this,w)}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),T=(0,o.getFullPath)(this.opts.uriResolver,S.baseId,void 0);if(Object.keys(S.schema).length>0&&R===T)return y.call(this,b,S);let w=(0,o.normalizeId)(R),C=this.refs[w]||this.schemas[w];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(w===(0,o.normalizeId)(E)){let{schema:A}=C,{schemaId:P}=this.opts,D=A[P];if(D)T=(0,o.resolveUrl)(this.opts.uriResolver,T,D);return new l({schema:A,schemaId:P,root:S,baseId:T})}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 T;if(((T=S.fragment)===null||T===void 0?void 0:T[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 w;if(typeof b!="boolean"&&b.$ref&&!(0,i.schemaHasRulesButRef)(b,this.RULES)){let A=(0,o.resolveUrl)(this.opts.uriResolver,E,b.$ref);w=p.call(this,R,A)}let{schemaId:C}=this.opts;if(w=w||new l({schema:b,schemaId:C,root:R,baseId:E}),w.schema!==w.root.schema)return w}}),i$=Se((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),kS=Se((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function o(p){let _="",y=0,S=0;for(S=0;S<p.length;S++){if(y=p[S].charCodeAt(0),y===48)continue;if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";_+=p[S];break}for(S+=1;S<p.length;S++){if(y=p[S].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";_+=p[S]}return _}let i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(p){return p.length=0,!0}function l(p,_,y){if(p.length){let S=o(p);if(S!=="")_.push(S);else return y.error=!0,!1;p.length=0}return!0}function a(p){let _=0,y={error:!1,address:"",zone:""},S=[],E=[],b=!1,R=!1,T=l;for(let w=0;w<p.length;w++){let C=p[w];if(C==="["||C==="]")continue;if(C===":"){if(b===!0)R=!0;if(!T(E,S,y))break;if(++_>7){y.error=!0;break}if(w>0&&p[w-1]===":")b=!0;S.push(":");continue}else if(C==="%"){if(!T(E,S,y))break;T=s}else{E.push(C);continue}}if(E.length)if(T===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}}),s$=Se((e,t)=>{let{isUUID:r}=kS(),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=w(`${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=w(`${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},T={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(T,null);function w(C){return C&&(T[C]||T[C.toLowerCase()])||void 0}t.exports={wsIsSecure:s,SCHEMES:T,isValidSchemeName:i,getSchemeHandler:w}}),a$=Se((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:i,isIPv4:s,nonSimpleDomain:l}=kS(),{SCHEMES:a,getSchemeHandler:c}=s$();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 T=R?Object.assign({scheme:"null"},R):{scheme:"null"},w=h(y(E,T),y(b,T),T,!0);return T.skipEscape=!0,p(w,T)}function h(E,b,R,T){let w={};if(!T)E=y(p(E,R),R),b=y(p(b,R),R);if(R=R||{},!R.tolerant&&b.scheme)w.scheme=b.scheme,w.userinfo=b.userinfo,w.host=b.host,w.port=b.port,w.path=n(b.path||""),w.query=b.query;else{if(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)w.userinfo=b.userinfo,w.host=b.host,w.port=b.port,w.path=n(b.path||""),w.query=b.query;else{if(!b.path)if(w.path=E.path,b.query!==void 0)w.query=b.query;else w.query=E.query;else{if(b.path[0]==="/")w.path=n(b.path);else{if((E.userinfo!==void 0||E.host!==void 0||E.port!==void 0)&&!E.path)w.path="/"+b.path;else if(!E.path)w.path=b.path;else w.path=E.path.slice(0,E.path.lastIndexOf("/")+1)+b.path;w.path=n(w.path)}w.query=b.query}w.userinfo=E.userinfo,w.host=E.host,w.port=E.port}w.scheme=E.scheme}return w.fragment=b.fragment,w}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:""},T=Object.assign({},b),w=[],C=c(T.scheme||R.scheme);if(C&&C.serialize)C.serialize(R,T);if(R.path!==void 0)if(!T.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(T.reference!=="suffix"&&R.scheme)w.push(R.scheme,":");let A=o(R);if(A!==void 0){if(T.reference!=="suffix")w.push("//");if(w.push(A),R.path&&R.path[0]!=="/")w.push("/")}if(R.path!==void 0){let P=R.path;if(!T.absolutePath&&(!C||!C.absolutePath))P=n(P);if(A===void 0&&P[0]==="/"&&P[1]==="/")P="/%2F"+P.slice(2);w.push(P)}if(R.query!==void 0)w.push("?",R.query);if(R.fragment!==void 0)w.push("#",R.fragment);return w.join("")}let _=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(E,b){let R=Object.assign({},b),T={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},w=!1;if(R.reference==="suffix")if(R.scheme)E=R.scheme+":"+E;else E="//"+E;let C=E.match(_);if(C){if(T.scheme=C[1],T.userinfo=C[3],T.host=C[4],T.port=parseInt(C[5],10),T.path=C[6]||"",T.query=C[7],T.fragment=C[8],isNaN(T.port))T.port=C[5];if(T.host)if(s(T.host)===!1){let P=r(T.host);T.host=P.host.toLowerCase(),w=P.isIPV6}else w=!0;if(T.scheme===void 0&&T.userinfo===void 0&&T.host===void 0&&T.port===void 0&&T.query===void 0&&!T.path)T.reference="same-document";else if(T.scheme===void 0)T.reference="relative";else if(T.fragment===void 0)T.reference="absolute";else T.reference="uri";if(R.reference&&R.reference!=="suffix"&&R.reference!==T.reference)T.error=T.error||"URI is not a "+R.reference+" reference.";let A=c(R.scheme||T.scheme);if(!R.unicodeSupport&&(!A||!A.unicodeSupport)){if(T.host&&(R.domainHost||A&&A.domainHost)&&w===!1&&l(T.host))try{T.host=URL.domainToASCII(T.host.toLowerCase())}catch(P){T.error=T.error||"Host's domain name can not be converted to ASCII: "+P}}if(!A||A&&!A.skipNormalize){if(E.indexOf("%")!==-1){if(T.scheme!==void 0)T.scheme=unescape(T.scheme);if(T.host!==void 0)T.host=unescape(T.host)}if(T.path)T.path=escape(unescape(T.path));if(T.fragment)T.fragment=encodeURI(decodeURIComponent(T.fragment))}if(A&&A.parse)A.parse(T,R)}else T.error=T.error||"URI can not be parsed.";return T}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}),l$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a$();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),Rd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Vi();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=Vs(),o=zi(),i=AS(),s=xl(),l=Xe(),a=ql(),c=el(),u=ut(),f=i$(),h=l$(),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,L,K,W,be,Ce,Ve,Ie,je,U,O,q,H,J,Y,ee,Z,te,oe,x,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=(L=(he=j.code)===null||he===void 0?void 0:he.regExp)!==null&&L!==void 0?L:g,St=(K=j.uriResolver)!==null&&K!==void 0?K:h.default;return{strictSchema:(be=(W=j.strictSchema)!==null&&W!==void 0?W:Ne)!==null&&be!==void 0?be:!0,strictNumbers:(Ve=(Ce=j.strictNumbers)!==null&&Ce!==void 0?Ce:Ne)!==null&&Ve!==void 0?Ve:!0,strictTypes:(je=(Ie=j.strictTypes)!==null&&Ie!==void 0?Ie:Ne)!==null&&je!==void 0?je:"log",strictTuples:(O=(U=j.strictTuples)!==null&&U!==void 0?U:Ne)!==null&&O!==void 0?O:"log",strictRequired:(H=(q=j.strictRequired)!==null&&q!==void 0?q: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:(x=j.addUsedSchema)!==null&&x!==void 0?x:!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 L=j.validateFormats;if(j.validateFormats=!1,this.RULES=(0,i.getRules)(),T.call(this,y,j,"NOT SUPPORTED"),T.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=L}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:j,meta:ne,schemaId:he}=this.opts,L=f;if(he==="id")L={...f},L.id=L.$id,delete L.$id;if(ne&&j)this.addMetaSchema(L,L[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 L=he(ne);if(!("$async"in he))this.errors=he.errors;return L}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 L.call(this,j,ne);async function L(Ie,je){await K.call(this,Ie.$schema);let U=this._addSchema(Ie,je);return U.validate||W.call(this,U)}async function K(Ie){if(Ie&&!this.getSchema(Ie))await L.call(this,{$ref:Ie},!0)}async function W(Ie){try{return this._compileSchemaEnv(Ie)}catch(je){if(!(je instanceof o.default))throw je;return be.call(this,je),await Ce.call(this,je.missingSchema),W.call(this,Ie)}}function be({missingSchema:Ie,missingRef:je}){if(this.refs[Ie])throw Error(`AnySchema ${Ie} is loaded but ${je} cannot be resolved`)}async function Ce(Ie){let je=await Ve.call(this,Ie);if(!this.refs[Ie])await K.call(this,je.$schema);if(!this.refs[Ie])this.addSchema(je,Ie,ne)}async function Ve(Ie){let je=this._loading[Ie];if(je)return je;try{return await(this._loading[Ie]=he(Ie))}finally{delete this._loading[Ie]}}}addSchema(j,ne,he,L=this.opts.validateSchema){if(Array.isArray(j)){for(let W of j)this.addSchema(W,void 0,he,L);return this}let K;if(typeof j==="object"){let{schemaId:W}=this.opts;if(K=j[W],K!==void 0&&typeof K!="string")throw Error(`schema ${W} must be string`)}return ne=(0,a.normalizeId)(ne||K),this._checkUnique(ne),this.schemas[ne]=this._addSchema(j,he,ne,L,!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 L=this.validate(he,j);if(!L&&ne){let K="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(K);else throw Error(K)}return L}getSchema(j){let ne;while(typeof(ne=w.call(this,j))=="string")j=ne;if(ne===void 0){let{schemaId:he}=this.opts,L=new s.SchemaEnv({schema:{},schemaId:he});if(ne=s.resolveSchema.call(this,L,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=w.call(this,j);if(typeof ne=="object")this._cache.delete(ne.schema);return delete this.schemas[j],delete this.refs[j],this}case"object":{let ne=j;this._cache.delete(ne);let he=j[this.opts.schemaId];if(he)he=(0,a.normalizeId)(he),delete this.schemas[he],delete this.refs[he];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(j){for(let ne of j)this.addKeyword(ne);return this}addKeyword(j,ne){let he;if(typeof j=="string"){if(he=j,typeof ne=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),ne.keyword=he}else if(typeof j=="object"&&ne===void 0){if(ne=j,he=ne.keyword,Array.isArray(he)&&!he.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(B.call(this,he,ne),!ne)return(0,u.eachItem)(he,(K)=>Q.call(this,K)),this;se.call(this,ne);let L={...ne,type:(0,c.getJSONTypes)(ne.type),schemaType:(0,c.getJSONTypes)(ne.schemaType)};return(0,u.eachItem)(he,L.type.length===0?(K)=>Q.call(this,K,L):(K)=>L.type.forEach((W)=>Q.call(this,K,L,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 L=he.rules.findIndex((K)=>K.keyword===j);if(L>=0)he.rules.splice(L,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((L)=>`${he}${L.instancePath} ${L.message}`).reduce((L,K)=>L+ne+K)}$dataMetaSchema(j,ne){let he=this.RULES.all;j=JSON.parse(JSON.stringify(j));for(let L of ne){let K=L.split("/").slice(1),W=j;for(let be of K)W=W[be];for(let be in he){let Ce=he[be];if(typeof Ce!="object")continue;let{$data:Ve}=Ce.definition,Ie=W[be];if(Ve&&Ie)W[be]=me(Ie)}}return j}_removeAllSchemas(j,ne){for(let he in j){let L=j[he];if(!ne||ne.test(he)){if(typeof L=="string")delete j[he];else if(L&&!L.meta)this._cache.delete(L.schema),delete j[he]}}}_addSchema(j,ne,he,L=this.opts.validateSchema,K=this.opts.addUsedSchema){let W,{schemaId:be}=this.opts;if(typeof j=="object")W=j[be];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof j!="boolean")throw Error("schema must be object or boolean");let Ce=this._cache.get(j);if(Ce!==void 0)return Ce;he=(0,a.normalizeId)(W||he);let 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),K&&!he.startsWith("#")){if(he)this._checkUnique(he);this.refs[he]=Ce}if(L)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 T(j,ne,he,L="error"){for(let K in j){let W=K;if(W in ne)this.logger[L](`${he}: option ${K}. ${j[W]}`)}}function w(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,(L)=>{if(he.keywords[L])throw Error(`Keyword ${L} is already defined`);if(!G.test(L))throw Error(`Keyword ${L} 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 L;let K=ne===null||ne===void 0?void 0:ne.post;if(he&&K)throw Error('keyword with "post" flag cannot have "type"');let{RULES:W}=this,be=K?W.post:W.rules.find(({type: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,(L=ne.implements)===null||L===void 0||L.forEach((Ve)=>this.addKeyword(Ve))}function pe(j,ne,he){let L=j.rules.findIndex((K)=>K.keyword===he);if(L>=0)j.rules.splice(L,0,ne);else j.rules.push(ne),this.logger.warn(`rule ${he} is not defined`)}function se(j){let{metaSchema:ne}=j;if(ne===void 0)return;if(j.$data&&this.opts.$data)ne=me(ne);j.validateSchema=this.compile(ne,!0)}let ve={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function me(j){return{anyOf:[j,ve]}}}),c$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),Ad=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=zi(),r=Wr(),n=Xe(),o=jr(),i=xl(),s=ut(),l={keyword:"$ref",schemaType:"string",code(u){let{gen:f,schema:h,it:g}=u,{baseId:p,schemaEnv:_,validateName:y,opts:S,self:E}=g,{root:b}=_;if((h==="#"||h==="#/")&&p===b.baseId)return T();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 w(R);return C(R);function T(){if(_===b)return c(u,y,_,_.$async);let A=f.scopeValue("root",{ref:b});return c(u,n._`${A}.validate`,b,b.$async)}function w(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 T();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)),w(P),!y)p.assign(A,!1)}),u.ok(A)}function T(){u.result((0,r.callValidateCode)(u,f,b),()=>C(f),()=>w(f))}function w(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}),NS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c$(),r=Ad(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),u$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:i,schemaCode:s})=>t.str`must be ${n[i].okStr} ${s}`,params:({keyword:i,schemaCode:s})=>t._`{comparison: ${n[i].okStr}, limit: ${s}}`},code(i){let{keyword:s,data:l,schemaCode:a}=i;i.fail$data(t._`${l} ${n[s].fail} ${a} || isNaN(${l})`)}};e.default=o}),d$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>t.str`must be multiple of ${n}`,params:({schemaCode:n})=>t._`{multipleOf: ${n}}`},code(n){let{gen:o,data:i,schemaCode:s,it:l}=n,a=l.opts.multipleOfPrecision,c=o.let("res"),u=a?t._`Math.abs(Math.round(${c}) - ${c}) > 1e-${a}`:t._`${c} !== parseInt(${c})`;n.fail$data(t._`(${s} === 0 || (${c} = ${i}/${s}, ${u}))`)}};e.default=r}),f$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,o=0,i=0,s;while(i<n)if(o++,s=r.charCodeAt(i++),s>=55296&&s<=56319&&i<n){if(s=r.charCodeAt(i),(s&64512)===56320)i++}return o}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),p$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=f$(),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}),h$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Wr(),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}),m$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxProperties"?"more":"fewer";return t.str`must NOT have ${i} than ${o} properties`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:s}=n,l=o==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data(t._`Object.keys(${i}).length ${l} ${s}`)}};e.default=r}),g$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Wr(),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 T=`required property "${R}" is not defined at "${f.schemaEnv.baseId+f.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(f,T,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}),v$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxItems"?"more":"fewer";return t.str`must NOT have ${i} than ${o} items`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:s}=n,l=o==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data(t._`${i}.length ${l} ${s}`)}};e.default=r}),Id=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=PS();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),_$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=el(),r=Xe(),n=ut(),o=Id(),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`),T=l.let("j");s.setParams({i:R,j:T}),l.assign(p,!0),l.if(r._`${R} > 1`,()=>(S()?E:b)(R,T))}function S(){return _.length>0&&!_.some((R)=>R==="object"||R==="array")}function E(R,T){let w=l.name("item"),C=(0,t.checkDataTypes)(_,w,g.opts.strictNumbers,t.DataType.Wrong),A=l.const("indices",r._`{}`);l.for(r._`;${R}--;`,()=>{if(l.let(w,r._`${a}[${R}]`),l.if(C,r._`continue`),_.length>1)l.if(r._`typeof ${w} == "string"`,r._`${w} += "_"`);l.if(r._`typeof ${A}[${w}] == "number"`,()=>{l.assign(T,r._`${A}[${w}]`),s.error(),l.assign(p,!1).break()}).code(r._`${A}[${w}] = ${R}`)})}function b(R,T){let w=(0,n.useFunc)(l,o.default),C=l.name("outer");l.label(C).for(r._`;${R}--;`,()=>l.for(r._`${T} = ${R}; ${T}--;`,()=>l.if(r._`${w}(${a}[${R}], ${a}[${T}])`,()=>{s.error(),l.assign(p,!1).break(C)})))}}};e.default=i}),y$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Id(),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}),S$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Id(),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}),OS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u$(),r=d$(),n=p$(),o=h$(),i=m$(),s=g$(),l=v$(),a=_$(),c=y$(),u=S$(),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}),MS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=Xe(),r=ut(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>t.str`must NOT have more than ${i} items`,params:({params:{len:i}})=>t._`{limit: ${i}}`},code(i){let{parentSchema:s,it:l}=i,{items:a}=s;if(!Array.isArray(a)){(0,r.checkStrictMode)(l,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(i,a)}};function o(i,s){let{gen:l,schema:a,data:c,keyword:u,it:f}=i;f.items=!0;let h=l.const("len",t._`${c}.length`);if(a===!1)i.setParams({len:s.length}),i.pass(t._`${h} <= ${s.length}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(f,a)){let p=l.var("valid",t._`${h} <= ${s.length}`);l.if((0,t.not)(p),()=>g(p)),i.ok(p)}function g(p){l.forRange("i",s.length,h,(_)=>{if(i.subschema({keyword:u,dataProp:_,dataPropType:r.Type.Num},p),!f.allErrors)l.if((0,t.not)(p),()=>l.break())})}}e.validateAdditionalItems=o,e.default=n}),$S=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=Xe(),r=ut(),n=Wr(),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,T=R===S.minItems&&(R===S.maxItems||S[l]===!1);if(E.strictTuples&&!T){let w=`"${h}" is ${R}-tuple, but minItems or maxItems/${l} are not specified or different at path "${b}"`;(0,r.checkStrictMode)(g,w,E.strictTuples)}}}e.validateTuple=i,e.default=o}),E$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$S(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),b$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Wr(),o=MS(),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}),T$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:i}})=>i===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${i} valid item(s)`,params:({params:{min:o,max:i}})=>i===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${i}}`},code(o){let{gen:i,schema:s,parentSchema:l,data:a,it:c}=o,u,f,{minContains:h,maxContains:g}=l;if(c.opts.next)u=h===void 0?1:h,f=g;else u=1;let p=i.const("len",t._`${a}.length`);if(o.setParams({min:u,max:f}),f===void 0&&u===0){(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(f!==void 0&&u>f){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(c,s)){let b=t._`${p} >= ${u}`;if(f!==void 0)b=t._`${b} && ${p} <= ${f}`;o.pass(b);return}c.items=!0;let _=i.name("valid");if(f===void 0&&u===1)S(_,()=>i.if(_,()=>i.break()));else if(u===0){if(i.let(_,!0),f!==void 0)i.if(t._`${a}.length > 0`,y)}else i.let(_,!1),y();o.result(_,()=>o.reset());function y(){let b=i.name("_valid"),R=i.let("count",0);S(b,()=>i.if(b,()=>E(R)))}function S(b,R){i.forRange("i",0,p,(T)=>{o.subschema({keyword:"contains",dataProp:T,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}),Pd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Xe(),r=ut(),n=Wr();e.error={message:({params:{property:a,depsCount:c,deps:u}})=>{let f=c===1?"property":"properties";return t.str`must have ${f} ${u} when property ${a} is present`},params:({params:{property:a,depsCount:c,deps:u,missingProperty:f}})=>t._`{property: ${a},
|
|
123
|
+
missingProperty: ${f},
|
|
124
|
+
depsCount: ${c},
|
|
125
|
+
deps: ${u}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(a){let[c,u]=i(a);s(a,c),l(a,u)}};function i({schema:a}){let c={},u={};for(let f in a){if(f==="__proto__")continue;let h=Array.isArray(a[f])?c:u;h[f]=a[f]}return[c,u]}function s(a,c=a.schema){let{gen:u,data:f,it:h}=a;if(Object.keys(c).length===0)return;let g=u.let("missing");for(let p in c){let _=c[p];if(_.length===0)continue;let y=(0,n.propertyInData)(u,f,p,h.opts.ownProperties);if(a.setParams({property:p,depsCount:_.length,deps:_.join(", ")}),h.allErrors)u.if(y,()=>{for(let S of _)(0,n.checkReportMissingProp)(a,S)});else u.if(t._`${y} && (${(0,n.checkMissingProp)(a,_,g)})`),(0,n.reportMissingProp)(a,g),u.else()}}e.validatePropertyDeps=s;function l(a,c=a.schema){let{gen:u,data:f,keyword:h,it:g}=a,p=u.name("valid");for(let _ in c){if((0,r.alwaysValidSchema)(g,c[_]))continue;u.if((0,n.propertyInData)(u,f,_,g.opts.ownProperties),()=>{let y=a.subschema({keyword:h,schemaProp:_},p);a.mergeValidEvaluated(y,p)},()=>u.var(p,!0)),a.ok(p)}}e.validateSchemaDeps=l,e.default=o}),w$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},code(o){let{gen:i,schema:s,data:l,it:a}=o;if((0,r.alwaysValidSchema)(a,s))return;let c=i.name("valid");i.forIn("key",l,(u)=>{o.setParams({propertyName:u}),o.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},c),i.if((0,t.not)(c),()=>{if(o.error(!0),!a.allErrors)i.break()})}),o.ok(c)}};e.default=n}),DS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Wr(),r=Xe(),n=jr(),o=ut(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:s})=>r._`{additionalProperty: ${s.additionalProperty}}`},code(s){let{gen:l,schema:a,parentSchema:c,data:u,errsCount:f,it:h}=s;if(!f)throw Error("ajv implementation error");let{allErrors:g,opts:p}=h;if(h.props=!0,p.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(h,a))return;let _=(0,t.allSchemaProperties)(c.properties),y=(0,t.allSchemaProperties)(c.patternProperties);S(),s.ok(r._`${f} === ${n.default.errors}`);function S(){l.forIn("key",u,(w)=>{if(!_.length&&!y.length)R(w);else l.if(E(w),()=>R(w))})}function E(w){let C;if(_.length>8){let A=(0,o.schemaRefOrVal)(h,c.properties,"properties");C=(0,t.isOwnProperty)(l,A,w)}else if(_.length)C=(0,r.or)(..._.map((A)=>r._`${w} === ${A}`));else C=r.nil;if(y.length)C=(0,r.or)(C,...y.map((A)=>r._`${(0,t.usePattern)(s,A)}.test(${w})`));return(0,r.not)(C)}function b(w){l.code(r._`delete ${u}[${w}]`)}function R(w){if(p.removeAdditional==="all"||p.removeAdditional&&a===!1){b(w);return}if(a===!1){if(s.setParams({additionalProperty:w}),s.error(),!g)l.break();return}if(typeof a=="object"&&!(0,o.alwaysValidSchema)(h,a)){let C=l.name("valid");if(p.removeAdditional==="failing")T(w,C,!1),l.if((0,r.not)(C),()=>{s.reset(),b(w)});else if(T(w,C),!g)l.if((0,r.not)(C),()=>l.break())}}function T(w,C,A){let P={keyword:"additionalProperties",dataProp:w,dataPropType:o.Type.Str};if(A===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});s.subschema(P,C)}}};e.default=i}),C$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Vi(),r=Wr(),n=ut(),o=DS(),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}),R$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Wr(),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((T)=>(0,n.alwaysValidSchema)(f,a[T]));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 T of g){if(_)b(T);if(f.allErrors)R(T);else l.var(y,!0),R(T),l.if(y)}}function b(T){for(let w in _)if(new RegExp(T).test(w))(0,n.checkStrictMode)(f,`property ${w} matches pattern ${T} (use allowMatchingProperties)`)}function R(T){l.forIn("key",c,(w)=>{l.if(r._`${(0,t.usePattern)(s,T)}.test(${w})`,()=>{let C=p.includes(T);if(!C)s.subschema({keyword:"patternProperties",schemaProp:T,dataProp:w,dataPropType:o.Type.Str},y);if(f.opts.unevaluated&&S!==!0)l.assign(r._`${S}[${w}]`,!0);else if(!C&&!f.allErrors)l.if((0,r.not)(y),()=>l.break())})})}}};e.default=i}),A$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:i,it:s}=n;if((0,t.alwaysValidSchema)(s,i)){n.fail();return}let l=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},l),n.failResult(l,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),I$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Wr().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),P$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},code(o){let{gen:i,schema:s,parentSchema:l,it:a}=o;if(!Array.isArray(s))throw Error("ajv implementation error");if(a.opts.discriminator&&l.discriminator)return;let c=s,u=i.let("valid",!1),f=i.let("passing",null),h=i.name("_valid");o.setParams({passing:f}),i.block(g),o.result(u,()=>o.reset(),()=>o.error(!0));function g(){c.forEach((p,_)=>{let y;if((0,r.alwaysValidSchema)(a,p))i.var(h,!0);else y=o.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},h);if(_>0)i.if(t._`${h} && ${u}`).assign(u,!1).assign(f,t._`[${f}, ${_}]`).else();i.if(h,()=>{if(i.assign(u,!0),i.assign(f,_),y)o.mergeEvaluated(y,t.Name)})})}}};e.default=n}),k$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:i,it:s}=n;if(!Array.isArray(i))throw Error("ajv implementation error");let l=o.name("valid");i.forEach((a,c)=>{if((0,t.alwaysValidSchema)(s,a))return;let u=n.subschema({keyword:"allOf",schemaProp:c},l);n.ok(l),n.mergeEvaluated(u)})}};e.default=r}),N$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>t.str`must match "${i.ifClause}" schema`,params:({params:i})=>t._`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:s,parentSchema:l,it:a}=i;if(l.then===void 0&&l.else===void 0)(0,r.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let c=o(a,"then"),u=o(a,"else");if(!c&&!u)return;let f=s.let("valid",!0),h=s.name("_valid");if(g(),i.reset(),c&&u){let _=s.let("ifClause");i.setParams({ifClause:_}),s.if(h,p("then",_),p("else",_))}else if(c)s.if(h,p("then"));else s.if((0,t.not)(h),p("else"));i.pass(f,()=>i.error(!0));function g(){let _=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);i.mergeEvaluated(_)}function p(_,y){return()=>{let S=i.subschema({keyword:_},h);if(s.assign(f,h),i.mergeValidEvaluated(S,f),y)s.assign(y,t._`${_}`);else i.setParams({ifClause:_})}}}};function o(i,s){let l=i.schema[s];return l!==void 0&&!(0,r.alwaysValidSchema)(i,l)}e.default=n}),O$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:i}){if(o.if===void 0)(0,t.checkStrictMode)(i,`"${n}" without "if" is ignored`)}};e.default=r}),qS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=MS(),r=E$(),n=$S(),o=b$(),i=T$(),s=Pd(),l=w$(),a=DS(),c=C$(),u=R$(),f=A$(),h=I$(),g=P$(),p=k$(),_=N$(),y=O$();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}),M$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>t.str`must match format "${n}"`,params:({schemaCode:n})=>t._`{format: ${n}}`},code(n,o){let{gen:i,data:s,$data:l,schema:a,schemaCode:c,it:u}=n,{opts:f,errSchemaPath:h,schemaEnv:g,self:p}=u;if(!f.validateFormats)return;if(l)_();else y();function _(){let S=i.scopeValue("formats",{ref:p.formats,code:f.code.formats}),E=i.const("fDef",t._`${S}[${c}]`),b=i.let("fType"),R=i.let("format");i.if(t._`typeof ${E} == "object" && !(${E} instanceof RegExp)`,()=>i.assign(b,t._`${E}.type || "string"`).assign(R,t._`${E}.validate`),()=>i.assign(b,t._`"string"`).assign(R,E)),n.fail$data((0,t.or)(T(),w()));function T(){if(f.strictSchema===!1)return t.nil;return t._`${c} && !${R}`}function w(){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){T();return}if(S===!0)return;let[E,b,R]=w(S);if(E===o)n.pass(C());function T(){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 w(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}),xS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[M$().default];e.default=t}),LS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),US=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=NS(),r=OS(),n=qS(),o=xS(),i=LS(),s=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=s}),$$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),kd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=$$(),n=xl(),o=zi(),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 T in R)a.elseIf(t._`${y} === ${T}`),a.assign(_,E(R[T]));a.else(),l.error(!1,{discrError:r.DiscrError.Mapping,tag:y,tagName:p}),a.endIf()}function E(R){let T=a.name("valid"),w=l.subschema({keyword:"oneOf",schemaProp:R},T);return l.mergeEvaluated(w,t.Name),T}function b(){var R;let T={},w=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&&(w||A(F)),P(G,N)}if(!C)throw Error(`discriminator: "${p}" must be required`);return T;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 T)throw Error(`discriminator: "${p}" values must be unique strings`);T[N]=F}}}};e.default=s}),D$=Se((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),FS=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=Rd(),n=US(),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=Vi();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=Vs();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=zi();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),GS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=Xe(),r=jr(),n=xl(),o=Ad(),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}),BS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=Xe(),r=jr(),n=Ad(),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}),q$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=GS(),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}),x$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=BS(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),HS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=GS(),r=BS(),n=q$(),o=x$(),i=[t.default,r.default,n.default,o.default];e.default=i}),L$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Pd(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),U$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Pd(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),F$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:i}){if(o.contains===void 0)(0,t.checkStrictMode)(i,`"${n}" without "contains" is ignored`)}};e.default=r}),VS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=L$(),r=U$(),n=F$(),o=[t.default,r.default,n.default];e.default=o}),G$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=jr(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>t._`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:s,schema:l,data:a,errsCount:c,it:u}=i;if(!c)throw Error("ajv implementation error");let{allErrors:f,props:h}=u;if(h instanceof t.Name)s.if(t._`${h} !== true`,()=>s.forIn("key",a,(y)=>s.if(p(h,y),()=>g(y))));else if(h!==!0)s.forIn("key",a,(y)=>h===void 0?g(y):s.if(_(h,y),()=>g(y)));u.props=!0,i.ok(t._`${c} === ${n.default.errors}`);function g(y){if(l===!1){if(i.setParams({unevaluatedProperty:y}),i.error(),!f)s.break();return}if(!(0,r.alwaysValidSchema)(u,l)){let S=s.name("valid");if(i.subschema({keyword:"unevaluatedProperties",dataProp:y,dataPropType:r.Type.Str},S),!f)s.if((0,t.not)(S),()=>s.break())}}function p(y,S){return t._`!${y} || !${y}[${S}]`}function _(y,S){let E=[];for(let b in y)if(y[b]===!0)E.push(t._`${S} !== ${b}`);return(0,t.and)(...E)}}};e.default=o}),B$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},code(o){let{gen:i,schema:s,data:l,it:a}=o,c=a.items||0;if(c===!0)return;let u=i.const("len",t._`${l}.length`);if(s===!1)o.setParams({len:c}),o.fail(t._`${u} > ${c}`);else if(typeof s=="object"&&!(0,r.alwaysValidSchema)(a,s)){let h=i.var("valid",t._`${u} <= ${c}`);i.if((0,t.not)(h),()=>f(h,c)),o.ok(h)}a.items=!0;function f(h,g){i.forRange("i",g,u,(p)=>{if(o.subschema({keyword:"unevaluatedItems",dataProp:p,dataPropType:r.Type.Num},h),!a.allErrors)i.if((0,t.not)(h),()=>i.break())})}}};e.default=n}),zS=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=G$(),r=B$(),n=[t.default,r.default];e.default=n}),H$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),V$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),z$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),j$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),W$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),J$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),K$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),X$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H$(),r=V$(),n=z$(),o=j$(),i=W$(),s=J$(),l=K$(),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}),Y$=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=Rd(),n=US(),o=HS(),i=VS(),s=zS(),l=kd(),a=X$(),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=Vi();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=Vs();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return g.default}});var p=zi();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),Z$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=NS(),r=OS(),n=qS(),o=HS(),i=VS(),s=zS(),l=xS(),a=LS(),c=[o.default,t.default,r.default,(0,n.default)(!0),l.default,a.metadataVocabulary,a.contentVocabulary,i.default,s.default];e.default=c}),Q$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),eD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),tD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),rD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),nD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),oD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),iD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),sD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),aD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q$(),r=eD(),n=tD(),o=rD(),i=nD(),s=oD(),l=iD(),a=sD(),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}),lD=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=Rd(),n=Z$(),o=kd(),i=aD(),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=Vi();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=Vs();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var f=zi();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),cD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(N,F){return{validate:N,compare:F}}e.fullFormats={date:t(i,s),time:t(a(!0),c),"date-time":t(h(!0),g),"iso-time":t(a(),u),"iso-date-time":t(h(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:S,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:D,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:b,int32:{type:"number",validate:w},int64:{type:"number",validate:C},float:{type:"number",validate:A},double:{type:"number",validate:A},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,g),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(N){return N%4===0&&(N%100!==0||N%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(N){let F=n.exec(N);if(!F)return!1;let G=+F[1],B=+F[2],Q=+F[3];return B>=1&&B<=12&&Q>=1&&Q<=(B===2&&r(G)?29:o[B])}function s(N,F){if(!(N&&F))return;if(N>F)return 1;if(N<F)return-1;return 0}let l=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function a(N){return function F(G){let B=l.exec(G);if(!B)return!1;let Q=+B[1],pe=+B[2],se=+B[3],ve=B[4],me=B[5]==="-"?-1:1,j=+(B[6]||0),ne=+(B[7]||0);if(j>23||ne>59||N&&!ve)return!1;if(Q<=23&&pe<=59&&se<60)return!0;let he=pe-ne*me,L=Q-j*me-(he<0?1:0);return(L===23||L===-1)&&(he===59||he===-1)&&se<61}}function c(N,F){if(!(N&&F))return;let G=new Date("2020-01-01T"+N).valueOf(),B=new Date("2020-01-01T"+F).valueOf();if(!(G&&B))return;return G-B}function u(N,F){if(!(N&&F))return;let G=l.exec(N),B=l.exec(F);if(!(G&&B))return;if(N=G[1]+G[2]+G[3],F=B[1]+B[2]+B[3],N>F)return 1;if(N<F)return-1;return 0}let f=/t|\s/i;function h(N){let F=a(N);return function G(B){let Q=B.split(f);return Q.length===2&&i(Q[0])&&F(Q[1])}}function g(N,F){if(!(N&&F))return;let G=new Date(N).valueOf(),B=new Date(F).valueOf();if(!(G&&B))return;return G-B}function p(N,F){if(!(N&&F))return;let[G,B]=N.split(f),[Q,pe]=F.split(f),se=s(G,Q);if(se===void 0)return;return se||c(B,pe)}let _=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function S(N){return _.test(N)&&y.test(N)}let E=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function b(N){return E.lastIndex=0,E.test(N)}let R=-2147483648,T=2147483647;function w(N){return Number.isInteger(N)&&N<=T&&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}}}),uD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=FS(),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 T=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(T))}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}),dD=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=cD(),n=uD(),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}),jS=FS(),fD=Y$(),pD=lD(),hD=Sv(dD(),1),mD=hD.default;function Cc(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return mD(t),t}var gD=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Cc(pD.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=zC(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??=Cc(fD.Ajv2019);return this._ajvDraft7??=Cc(jS.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)}}},V4=jS.Ajv,WS=Symbol.for("mcp.completable");function zp(e){return!!e&&typeof e==="object"&&WS in e}function vD(e){return e[WS]?.complete}function _D(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 yD(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 JS=1024;function jp(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[Gu]:t}}}}function SD(e){let t=Lo(Ml).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var ED=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),bD=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=JS,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=SD(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=yD(t,this._serverCapabilities);return this._subs.set(e.id,r),jp({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!ED.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,n=TD(e.method,r),o=[];for(let[i,s]of this._subs)if(_D(s,n))o.push(jp({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:{[Gu]:t,...this._serverInfo!==void 0&&{[Si]:this._serverInfo}}}});return this._subs.clear(),e}};function TD(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 wD(e){return typeof e==="object"&&e!==null&&"setScopeChallengeResolver"in e&&typeof e.setScopeChallengeResolver==="function"}var CD=8,RD=600000;function AD(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??CD,roundTimeoutMs:e?.roundTimeoutMs??RD,legacyShim:e?.legacyShim??!0}}function KS(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new xe(we.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=_O(n);if(o===void 0)throw new xe(we.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 ID(){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 Rc(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new xe(we.InternalError,t)}var PD=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 Rc(e,IM(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 xe(we.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:T,required:w}=KS(e,b,R);if(T.method!=="roots/list"&&T.params===void 0)throw new xe(we.InternalError,`Handler for ${e} returned an input request '${b}' of kind '${T.method}' without params`);if(Q0(w,y)!==void 0)return Rc(e,`Cannot request input '${b}' (${T.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,T])}let E=kM(l);try{let b={relatedRequestId:n.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:E.signal},R=await Promise.all(S.map(async([T,w])=>{try{return[T,await this._dispatchLeg(w,b)]}catch(C){throw E.abort(C),C}}));g=Object.fromEntries(R)}catch(b){if(l.aborted)throw b;return Rc(e,`Fulfilling input required by '${e}' failed: ${b instanceof Error?b.message:String(b)}`)}finally{E.dispose()}}else await PM(AM,l);let p={...n,mcpReq:{...n.mcpReq,inputResponses:g,droppedInputResponseKeys:void 0,requestState:$l(h)}};if(h!==void 0){let y=await this._host.verifyRequestState(h,p,e);if(y!==void 0)p=CS(p,y)}let _=await t(r,p);if(!Ro(_))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:ID()};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)}}},kD=new Set(["tools/call","prompts/get","resources/read"]),ND,XS,YS;function OD(e,t){XS(e,t)}function MD(e){return YS(e)}var $D=class extends UM{_clientCapabilities;_clientVersion;static{ND=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},XS=(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())},YS=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new PD({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 gD,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=AD(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)uS(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Ip(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=wd(Ps,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?.[El],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(Ps.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=FM(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=kD.has(e);if(r===void 0&&!n)return async(o,i)=>{let s=await t(o,i);if(Ro(s))throw new xe(we.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(Ro(s)){if(!n)throw new xe(we.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:Wc(s,r)}}return async(r,n)=>{let o=Lo(this._negotiatedProtocolVersion),i=o.validateRequest("tools/call",r);if(!i.ok)throw new xe(i.reason==="not-in-era"?we.InternalError:we.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(Ro(s))return s;let l=nS(s),a=o.validateResult("tools/call",l);if(!a.ok)throw new xe(a.reason==="not-in-era"?we.InternalError:we.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&&Bs(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 xe(we.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=CS(n,f)}let l;try{l=await t(r,s)}catch(f){if(f instanceof xe&&f.code===we.UrlElicitationRequired){if(!o)throw f;throw new xe(we.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(!Ro(l))return l;if(!o){if(!this._inputRequiredServing.legacyShim)throw new xe(we.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??Vc}, 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 xe(we.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:_}=KS(e,h,g),y=Q0(_,f);if(y!==void 0)throw new fS({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 xe(we.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Fs]: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=yO(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??Vc;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Ip(this._supportedProtocolVersions),capabilities:DD(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 xe(we.InvalidParams,"The last message must contain only tool_result content if any is present");if(!u)throw new xe(we.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 xe(we.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 xe(we.InvalidParams,`Elicitation response content does not match requested schema: ${l.errorMessage}`)}catch(l){if(l instanceof xe)throw l;throw new xe(we.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 DD(e){return{...e}}function qD(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 xD(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 ZS=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 Jp;try{let r=Oi(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new $D(e,t),this._maxToolInputElements=xD(t?.maxToolInputElements),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(e){if(wD(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?LD(e,t.inputSchema):Jp,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};if(t.outputSchema)r.outputSchema=Oi(t.outputSchema,"output");return r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new xe(we.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new xe(we.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),Ro(o))return o;return this.server.projectCallToolResult(o,r.outputSchemaJson)}catch(n){if(n instanceof xe&&n.code===we.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&&qD(t,this._maxToolInputElements)>this._maxToolInputElements)throw new xe(we.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let n=await bi(e.inputSchema,t??{});if(!n.success)throw new xe(we.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${n.error}`);return n.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(Ro(t))return;if(t.isError)return;if(t.structuredContent===void 0)throw new xe(we.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=await bi(e.outputSchema,t.structuredContent);if(!n.success)throw new xe(we.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 nM(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return oM(e),this.handleResourceCompletion(e,e.params.ref);default:throw new xe(we.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new xe(we.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new xe(we.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return fs;let n=Qp(Zp(r.argsSchema)?.[e.params.argument.name]);if(!zp(n))return fs;let o=vD(n);if(!o)return fs;return Yp(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 fs;throw new xe(we.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return fs;return Yp(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 xe(we.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 xe(we.InvalidParams,`Resource ${r} disabled`);return Wc(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 xe(we.InvalidParams,`Resource template ${o.resourceTemplate.uriTemplate} disabled`);return Wc(await o.readCallback(r,i,t),o.cacheHint)}}throw new dS(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?vM(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 xe(we.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new xe(we.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)uS(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:Xp(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=Xp(e,a,c);if(f.enabled!==void 0)u.enabled=f.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,n){let f=Zp(n);if(f){if(Object.values(f).some((h)=>zp(Qp(h))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,n,o,i,s,l,a,c,u){Bp(e);let f=u,h,g={title:t,description:r,inputSchema:n,outputSchema:o,get outputSchemaJson(){return h??=Kp(g.outputSchema)},set outputSchemaJson(p){h=p},annotations:i,icons:s,execution:l,scopeChallenge:a,_meta:c,handler:u,executor:Wp(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")Bp(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=Wp(g.inputSchema,f);if(p.outputSchema!==void 0)g.outputSchema=p.outputSchema,g.outputSchemaJson=Kp(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,wc(i),wc(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,wc(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 Wp(e,t){if(e){let n=t;return async(o,i)=>n(o,i)}let r=t;return async(n,o)=>r(o)}var Jp={type:"object",properties:{}};function LD(e,t){let r=Oi(t,"input"),n=aM(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 Kp(e){if(e===void 0)return;try{return Oi(e,"output")}catch{return}}function Xp(e,t,r){if(t){let n=r;return async(o,i)=>{let s=await bi(t,o??{});if(!s.success)throw new xe(we.InvalidParams,`Invalid arguments for prompt ${e}: ${s.error}`);return n(s.data,i)}}else{let n=r;return async(o,i)=>n(i)}}function Yp(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var fs={completion:{values:[],hasMore:!1}};function Zp(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function UD(e){return e?.type==="optional"}function Qp(e){if(!UD(e))return e;return e.def?.innerType??e}var eh=Symbol("swallowsErrorsAfterClose"),FD=class{_readBuffer;_started=!1;_closed=!1;constructor(e=Vp.stdin,t=Vp.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new zM({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(e)=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=(e)=>{this.onerror?.(e)};_onstdouterror=(e)=>{if(this._closed)return;this.onerror?.(e),this.close().catch(()=>{})};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0;for(let e of this._stdout.listeners("error"))if(e[eh])this._stdout.off("error",e);if(this._stdin.readableEnded||this._stdin.destroyed)setImmediate(this._onstdinclose);this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[eh]=!0,this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((t,r)=>{let n=WM(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)})}},th=3000,GD=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(Jc(e)||yS(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(nn(e))this._pendingRequests.add(e.id);else if(vi(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 BD(e){let t=e.params;if(e.method==="initialize"&&!SS(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(!Ed(t))return{kind:"legacy",reason:"no-claim"};let r=Hs(t),n=(r===void 0?[]:Td(r))[0];if(n!==void 0)return{kind:"invalid-envelope",issue:n};let o=bd(t);if(o===void 0||!hi.includes(o))return{kind:"unsupported-revision",requested:o??"unknown"};return{kind:"modern",revision:o,classification:{era:"modern",revision:o}}}function HD(e,t={}){let r=t.legacy??"serve",n=t.transport??new FD,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(Hr(F))),u=new bD(t.maxSubscriptions??JS),f=(A)=>{if(!vi(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(Hr(N)));return"handled"},h=async(A)=>{if(nn(A)&&A.method==="subscriptions/listen"){let P=Hs(A.params),D=Ed(A.params)?(P===void 0?[]:Td(P))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},N=bd(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||!hi.includes(N)){let G=new Za({supported:[...hi],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(Hr(G))),!0}if(vi(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=uM({kind:"legacy",reason:P,...D!==void 0&&{requestedVersion:D}},hi);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;w()},_=async(A,P)=>{let D=await e({era:A}),N=D instanceof ZS?D.server:D;if(A==="modern")LM(N,P),OD(N,hi),u.setServerCapabilities(N.getCapabilities(),MD(N));let F=new GD(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(Hr(P))),S=async(A)=>{i=A.channel;try{if(!await A.channel.whenRequestsAnswered(th))a(Error(`Discarded the probe instance with requests still unanswered after ${th}ms; continuing with the fallback`));await A.product.close()}catch(P){a(Hr(P))}finally{i=void 0}},E=async(A)=>{if(o.phase==="closed")return;if(o.phase==="pinned"){if(o.era==="modern"&&nn(A)&&A.method==="initialize"&&!SS(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(!nn(A)&&!vi(A)){a(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let P=BD(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(nn(A))await c(A.id,we.InvalidParams,D,{envelope:P.issue});else a(Error(`Discarded a notification with a malformed envelope: ${D}`));return}case"unsupported-revision":if(nn(A)){let D=new Za({supported:[...hi],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(nn(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(vi(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(nn(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,T=async()=>{if(R)return;R=!0;try{while(b.length>0){let A=b.shift();try{await E(A)}catch(P){if(nn(A))await c(A.id,we.InternalError,"Internal server error");a(Hr(P))}}}finally{R=!1}},w=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(Hr(D)));if(A.phase==="probe"||A.phase==="pinned")await A.instance.product.close().catch((P)=>a(Hr(P)));await n.close().catch((P)=>a(Hr(P)))};n.onmessage=(A)=>{b.push(A),T()},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(Hr(P)))};let C=n.start().catch((A)=>{throw a(Hr(A)),A});return C.catch(()=>{}),{close:async()=>{await C.catch(()=>{}),await w()}}}function Hr(e){return e instanceof Error?e:Error(String(e))}var VD=wr(pw(),1),zD=wr(PC(),1),X4=wr(OC(),1),Y4=wr(yu(),1),Z4=wr(xs(),1),Q4=wr(vv(),1),ez=wr(_v(),1),tz=wr(yv(),1),XD=wr(Su(),1),rz=wr(MC(),1),YD=void 0,ZD=void 0;function QD(){return{geminiUrl:YD,vertexUrl:ZD}}function e1(e,t,r,n){var o,i;if(!(e===null||e===void 0?void 0:e.baseUrl)){let s=QD();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 Dn=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 t1(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)}Yc(e,o,i,0,s)}}function Yc(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])Yc(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)Yc(s[i],t,r,n+1,o)}}function Nd(e){if(typeof e!=="string")throw Error("fromImageBytes must be a string");return e}function r1(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 n1(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"],i1(s));return t}function o1(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"],s1(s));return t}function i1(e){let t={},r=d(e,["generatedSamples"]);if(r!=null){let i=r;if(Array.isArray(i))i=i.map((s)=>a1(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 s1(e){let t={},r=d(e,["videos"]);if(r!=null){let i=r;if(Array.isArray(i))i=i.map((s)=>l1(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 a1(e){let t={},r=d(e,["video"]);if(r!=null)m(t,["video"],h1(r));return t}function l1(e){let t={},r=d(e,["_self"]);if(r!=null)m(t,["video"],m1(r));return t}function c1(e){let t={},r=d(e,["operationName"]);if(r!=null)m(t,["_url","operationName"],r);return t}function u1(e){let t={},r=d(e,["operationName"]);if(r!=null)m(t,["_url","operationName"],r);return t}function d1(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"],f1(s));return t}function f1(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 Od(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"],p1(s));return t}function p1(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 h1(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"],Nd(n));let o=d(e,["encoding"]);if(o!=null)m(t,["mimeType"],o);return t}function m1(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"],Nd(n));let o=d(e,["mimeType"]);if(o!=null)m(t,["mimeType"],o);return t}var rh;(function(e){e.MEDIA_PROCESSING_UNSPECIFIED="MEDIA_PROCESSING_UNSPECIFIED",e.STATIC="STATIC",e.AGENTIC="AGENTIC"})(rh||(rh={}));var nh;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(nh||(nh={}));var oh;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(oh||(oh={}));var ih;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(ih||(ih={}));var io;(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"})(io||(io={}));var sh;(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"})(sh||(sh={}));var ah;(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"})(ah||(ah={}));var lh;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})(lh||(lh={}));var ch;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER",e.ENVIRONMENT_MOBILE="ENVIRONMENT_MOBILE",e.ENVIRONMENT_DESKTOP="ENVIRONMENT_DESKTOP"})(ch||(ch={}));var uh;(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"})(uh||(uh={}));var dh;(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"})(dh||(dh={}));var fh;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.BLOCKING="BLOCKING",e.NON_BLOCKING="NON_BLOCKING"})(fh||(fh={}));var ph;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(ph||(ph={}));var hh;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(hh||(hh={}));var mh;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(mh||(mh={}));var gh;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",e.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",e.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE"})(gh||(gh={}));var vh;(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"})(vh||(vh={}));var _h;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(_h||(_h={}));var yh;(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"})(yh||(yh={}));var Sh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})(Sh||(Sh={}));var Eh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.VERBATIM="VERBATIM",e.SMART="SMART"})(Eh||(Eh={}));var bh;(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"})(bh||(bh={}));var Th;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(Th||(Th={}));var wh;(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"})(wh||(wh={}));var Ch;(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"})(Ch||(Ch={}));var Rh;(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"})(Rh||(Rh={}));var Ah;(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"})(Ah||(Ah={}));var Ih;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(Ih||(Ih={}));var Ph;(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"})(Ph||(Ph={}));var kh;(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"})(kh||(kh={}));var tl;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO",e.VIDEO="VIDEO"})(tl||(tl={}));var Nh;(function(e){e.DELIVERY_UNSPECIFIED="DELIVERY_UNSPECIFIED",e.INLINE="INLINE",e.URI="URI"})(Nh||(Nh={}));var Oh;(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"})(Oh||(Oh={}));var Mh;(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"})(Mh||(Mh={}));var $h;(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"})($h||($h={}));var Dh;(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"})(Dh||(Dh={}));var qh;(function(e){e.RESPONSE_PARSE_TYPE_UNSPECIFIED="RESPONSE_PARSE_TYPE_UNSPECIFIED",e.IDENTITY="IDENTITY",e.REGEX_EXTRACT="REGEX_EXTRACT"})(qh||(qh={}));var xh;(function(e){e.MATCH_OPERATION_UNSPECIFIED="MATCH_OPERATION_UNSPECIFIED",e.REGEX_CONTAINS="REGEX_CONTAINS",e.PARTIAL_MATCH="PARTIAL_MATCH",e.EXACT_MATCH="EXACT_MATCH"})(xh||(xh={}));var Lh;(function(e){e.REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED="REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.HIGH="HIGH"})(Lh||(Lh={}));var Zc;(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"})(Zc||(Zc={}));var Uh;(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"})(Uh||(Uh={}));var Fh;(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"})(Fh||(Fh={}));var Gh;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",e.BASELINE="BASELINE",e.CANDIDATE="CANDIDATE",e.TIE="TIE"})(Gh||(Gh={}));var Bh;(function(e){e.VIDEO_ORIENTATION_UNSPECIFIED="VIDEO_ORIENTATION_UNSPECIFIED",e.LANDSCAPE="LANDSCAPE",e.PORTRAIT="PORTRAIT"})(Bh||(Bh={}));var Hh;(function(e){e.TUNING_SPEED_UNSPECIFIED="TUNING_SPEED_UNSPECIFIED",e.REGULAR="REGULAR",e.FAST="FAST"})(Hh||(Hh={}));var Vh;(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"})(Vh||(Vh={}));var zh;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(zh||(zh={}));var jh;(function(e){e.UNSPECIFIED="unspecified",e.FLEX="flex",e.STANDARD="standard",e.PRIORITY="priority"})(jh||(jh={}));var Wh;(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"})(Wh||(Wh={}));var Jh;(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"})(Jh||(Jh={}));var Qc;(function(e){e.COLLECTION="COLLECTION"})(Qc||(Qc={}));var Kh;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(Kh||(Kh={}));var rl;(function(e){e.PREDICT="PREDICT",e.EMBED_CONTENT="EMBED_CONTENT"})(rl||(rl={}));var Xh;(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"})(Xh||(Xh={}));var Yh;(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"})(Yh||(Yh={}));var Zh;(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"})(Zh||(Zh={}));var Qh;(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"})(Qh||(Qh={}));var em;(function(e){e.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",e.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",e.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",e.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(em||(em={}));var tm;(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"})(tm||(tm={}));var rm;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(rm||(rm={}));var nm;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(nm||(nm={}));var om;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(om||(om={}));var im;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(im||(im={}));var sm;(function(e){e.CROP="CROP",e.PAD="PAD"})(sm||(sm={}));var am;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING",e.DISTILLATION="DISTILLATION",e.REINFORCEMENT_TUNING="REINFORCEMENT_TUNING"})(am||(am={}));var lm;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(lm||(lm={}));var cm;(function(e){e.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",e.UPLOADED="UPLOADED",e.GENERATED="GENERATED",e.REGISTERED="REGISTERED"})(cm||(cm={}));var um;(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"})(um||(um={}));var dm;(function(e){e.INTERACTION_STATUS_UNSPECIFIED="INTERACTION_STATUS_UNSPECIFIED",e.IN_PROGRESS="IN_PROGRESS",e.REQUIRES_ACTION="REQUIRES_ACTION",e.IDLE="IDLE"})(dm||(dm={}));var fm;(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"})(fm||(fm={}));var pm;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(pm||(pm={}));var hm;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(hm||(hm={}));var mm;(function(e){e.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",e.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",e.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(mm||(mm={}));var gm;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",e.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",e.NO_INTERRUPTION="NO_INTERRUPTION"})(gm||(gm={}));var vm;(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"})(vm||(vm={}));var _m;(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"})(_m||(_m={}));var ym;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",e.QUALITY="QUALITY",e.DIVERSITY="DIVERSITY",e.VOCALIZATION="VOCALIZATION"})(ym||(ym={}));var _i;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(_i||(_i={}));var Mi=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()}},ps=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}},Sm=class{},g1=class{},v1=class{},_1=class{},y1=class{},S1=class{},Em=class{},bm=class{},Tm=class{},E1=class{},eu=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,o,i=t;if(r)o=o1(i);else o=n1(i);return Object.assign(n,o),n}},b1=class{},wm=class{},T1=class{},Cm=class{},Rm=class{},w1=class{},C1=class{},R1=class{},A1=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,i=d1(t);return Object.assign(n,i),n}},I1=class{},P1=class{},k1=class{},N1=class{},Am=class{},O1=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}},M1=class{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0];return}},eE=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,i=Od(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 tE(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 rE(e){if(Array.isArray(e))return e.map((t)=>nl(t));else return[nl(e)]}function nl(e){if(typeof e==="object"&&e!==null)return e;throw Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function nE(e){let t=nl(e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function oE(e){let t=nl(e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function Im(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 iE(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)=>Im(t));return[Im(e)]}function tu(e){return e!==null&&e!==void 0&&typeof e==="object"&&"parts"in e&&Array.isArray(e.parts)}function Pm(e){return e!==null&&e!==void 0&&typeof e==="object"&&"functionCall"in e}function km(e){return e!==null&&e!==void 0&&typeof e==="object"&&"functionResponse"in e}function jt(e){if(e===null||e===void 0)throw Error("ContentUnion is required");if(tu(e))return e;return{role:"user",parts:iE(e)}}function Md(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap((r)=>{let n=jt(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=jt(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)=>jt(r));return[jt(t)]}function hr(e){if(e===null||e===void 0||Array.isArray(e)&&e.length===0)throw Error("contents are required");if(!Array.isArray(e)){if(Pm(e)||km(e))throw Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[jt(e)]}let t=[],r=[],n=tu(e[0]);for(let o of e){let i=tu(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(Pm(o)||km(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:iE(r)});return t}function $1(e,t){if(e.includes("null"))t.nullable=!0;let r=e.filter((n)=>n!=="null");if(r.length===1)t.type=Object.values(io).includes(r[0].toUpperCase())?r[0].toUpperCase():io.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let n of r)t.anyOf.push({type:Object.values(io).includes(n.toUpperCase())?n.toUpperCase():io.TYPE_UNSPECIFIED})}}function Ti(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)$1(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(io).includes(l.toUpperCase())?l.toUpperCase():io.TYPE_UNSPECIFIED}else if(r.includes(s))t[s]=Ti(l);else if(n.includes(s)){let a=[];for(let c of l){if(c.type=="null"){t.nullable=!0;continue}a.push(Ti(c))}t[s]=a}else if(o.includes(s)){let a={};for(let[c,u]of Object.entries(l))a[c]=Ti(u);t[s]=a}else{if(s==="additionalProperties")continue;t[s]=l}}return t}function $d(e){return Ti(e)}function ji(e){return e}function Dd(e){if(typeof e==="object")return e;else if(typeof e==="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};else throw Error(`Unsupported speechConfig type: ${typeof e}`)}function qd(e){if("multiSpeakerVoiceConfig"in e)throw Error("multiSpeakerVoiceConfig is not supported in the live API.");return e}function Wi(e){if(e.functionDeclarations)for(let t of e.functionDeclarations){if(t.parameters){if(!Object.keys(t.parameters).includes("$schema"))t.parameters=Ti(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=Ti(t.response);else if(!t.responseJsonSchema)t.responseJsonSchema=t.response,delete t.response}}return e}function Ji(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 D1(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 qn(e,t){if(typeof t!=="string")throw Error("name must be a string");return D1(e,t,"cachedContents")}function sE(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 Bo(e){return Nd(e)}function q1(e){return e!==null&&e!==void 0&&typeof e==="object"&&"name"in e}function aE(e){return e!==null&&e!==void 0&&typeof e==="object"&&"video"in e}function lE(e){return e!==null&&e!==void 0&&typeof e==="object"&&"uri"in e}function xd(e){var t;let r;if(q1(e))r=e.name;if(lE(e)){if(r=e.uri,r===void 0)return}if(aE(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 cE(e,t){let r;if(e.isVertexAI())r=t?"publishers/google/models":"models";else r=t?"models":"tunedModels";return r}function uE(e){for(let t of["models","tunedModels","publisherModels"])if(x1(e,t))return e[t];return[]}function x1(e,t){return e!==null&&typeof e==="object"&&t in e}function L1(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 U1(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=L1(o,t);if(s.functionDeclarations)r.push(...s.functionDeclarations)}return{functionDeclarations:r}}function dE(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 F1(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 fE(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 Ki(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 pE(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 G1(e){return e.includes("gemini")&&e!=="gemini-embedding-001"||e.includes("maas")}function B1(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 H1(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)=>Eq(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 V1(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"],Oq(i));return t}function z1(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"],Mq(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 $a(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"],pE(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"],H1(fE(c)));return t}function ru(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"],pE(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"],j1(f));let h=d(e,["outputConfig"]);if(h!=null)m(t,["dest"],V1(fE(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 j1(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 W1(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)=>Sq(e,s));m(r,["requests","requests"],i)}return r}function J1(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 K1(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Ki(e,n));return r}function X1(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Ki(e,n));return r}function Y1(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"],Z1(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 Z1(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 hE(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>Iq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Q1(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 eq(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"],z1(F1(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 Nm(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"],W1(e,dE(e,o)));let i=d(t,["config"]);if(i!=null)Q1(i,r);return r}function tq(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"],J1(dE(e,o)));let i=d(t,["config"]);if(i!=null)eq(i,r);return r}function rq(e,t){let r={},n=d(e,["displayName"]);if(t!==void 0&&n!=null)m(t,["batch","displayName"],n);return r}function nq(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"],uq(e,o));let i=d(t,["config"]);if(i!=null)rq(i,r);return r}function oq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Ki(e,n));return r}function iq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Ki(e,n));return r}function sq(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 aq(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 lq(e,t){let r={},n=d(t,["contents"]);if(n!=null){let i=Md(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"],cq(o,r)),t1(r,{"requests[].*":"requests[].request.*"});return r}function cq(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 uq(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"],lq(e,o));return r}function dq(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 fq(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 pq(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"],hE(jt(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"],$d(E));let b=d(t,["responseJsonSchema"]);if(b!=null)m(n,["responseJsonSchema"],ji(b));if(d(t,["routingConfig"])!==void 0)throw Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(t,["modelSelectionConfig"])!==void 0)throw Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let R=d(t,["safetySettings"]);if(r!==void 0&&R!=null){let se=R;if(Array.isArray(se))se=se.map((ve)=>Pq(ve));m(r,["safetySettings"],se)}let T=d(t,["tools"]);if(r!==void 0&&T!=null){let se=Ji(T);if(Array.isArray(se))se=se.map((ve)=>Nq(Wi(ve)));m(r,["tools"],se)}let w=d(t,["toolConfig"]);if(r!==void 0&&w!=null)m(r,["toolConfig"],kq(w));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"],qn(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"],Dd(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"],yq(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 hq(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)=>Y1(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 mq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Ki(e,n));return r}function gq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Ki(e,n));return r}function vq(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],B1(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 _q(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 yq(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 Sq(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=hr(o);if(Array.isArray(l))l=l.map((a)=>hE(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"],pq(e,s,d(r,["request"],{})));return r}function Eq(e){let t={},r=d(e,["response"]);if(r!=null)m(t,["response"],hq(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 bq(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 Tq(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);let i=d(e,["filter"]);if(t!==void 0&&i!=null)m(t,["_query","filter"],i);return r}function wq(e){let t={},r=d(e,["config"]);if(r!=null)bq(r,t);return t}function Cq(e){let t={},r=d(e,["config"]);if(r!=null)Tq(r,t);return t}function Rq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["operations"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>$a(s));m(t,["batchJobs"],i)}return t}function Aq(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)=>ru(s));m(t,["batchJobs"],i)}return t}function Iq(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"],dq(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 Pq(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 kq(e){let t={},r=d(e,["functionCallingConfig"]);if(r!=null)m(t,["functionCallingConfig"],fq(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 Nq(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"],vq(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"],_q(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 Oq(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 Mq(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 On;(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"})(On||(On={}));var Ho=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}},$q=class extends Dn{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new Ho(On.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=Nm(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=tq(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)=>ru(c))}else{let a=Nm(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)=>$a(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=nq(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)=>$a(l))}}async get(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=gq(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)=>ru(c))}else{let a=mq(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)=>$a(c))}}async cancel(e){var t,r,n,o;let i="",s={};if(this.apiClient.isVertexAI()){let l=X1(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=K1(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=Cq(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=Aq(c),f=new Am;return Object.assign(f,u),f})}else{let a=wq(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=Rq(c),f=new Am;return Object.assign(f,u),f})}}async delete(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=iq(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)=>aq(c))}else{let a=oq(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)=>sq(c))}}};function Dq(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 qq(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 Om(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>ox(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Mm(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>ix(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function xq(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=hr(s);if(Array.isArray(u))u=u.map((f)=>Om(f));m(t,["contents"],u)}let l=d(e,["systemInstruction"]);if(t!==void 0&&l!=null)m(t,["systemInstruction"],Om(jt(l)));let a=d(e,["tools"]);if(t!==void 0&&a!=null){let u=a;if(Array.isArray(u))u=u.map((f)=>lx(f));m(t,["tools"],u)}let c=d(e,["toolConfig"]);if(t!==void 0&&c!=null)m(t,["toolConfig"],sx(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 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);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=hr(s);if(Array.isArray(f))f=f.map((h)=>Mm(h));m(t,["contents"],f)}let l=d(e,["systemInstruction"]);if(t!==void 0&&l!=null)m(t,["systemInstruction"],Mm(jt(l)));let a=d(e,["tools"]);if(t!==void 0&&a!=null){let f=a;if(Array.isArray(f))f=f.map((h)=>cx(h));m(t,["tools"],f)}let c=d(e,["toolConfig"]);if(t!==void 0&&c!=null)m(t,["toolConfig"],ax(c));let u=d(e,["kmsKeyName"]);if(t!==void 0&&u!=null)m(t,["encryption_spec","kmsKeyName"],u);return r}function Uq(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],tE(e,n));let o=d(t,["config"]);if(o!=null)xq(o,r);return r}function Fq(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],tE(e,n));let o=d(t,["config"]);if(o!=null)Lq(o,r);return r}function Gq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],qn(e,n));return r}function Bq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],qn(e,n));return r}function Hq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function Vq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function zq(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 jq(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 Wq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],qn(e,n));return r}function Jq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],qn(e,n));return r}function Kq(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],Dq(r));let n=d(e,["enableWidget"]);if(n!=null)m(t,["enableWidget"],n);if(d(e,["groundingTypes"])!==void 0)throw Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function Xq(e){let t={};if(d(e,["blockingConfidence"])!==void 0)throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["excludeDomains"])!==void 0)throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["searchTypes"]);if(r!=null)m(t,["searchTypes"],r);let n=d(e,["timeRangeFilter"]);if(n!=null)m(t,["timeRangeFilter"],n);return t}function Yq(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 Zq(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 Qq(e){let t={},r=d(e,["config"]);if(r!=null)Yq(r,t);return t}function ex(e){let t={},r=d(e,["config"]);if(r!=null)Zq(r,t);return t}function tx(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 rx(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 nx(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 ox(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"],zq(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 ix(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 sx(e){let t={},r=d(e,["functionCallingConfig"]);if(r!=null)m(t,["functionCallingConfig"],jq(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 ax(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 lx(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"],Kq(r));let n=d(e,["mcpServers"]);if(n!=null){let f=n;if(Array.isArray(f))f=f.map((h)=>h);m(t,["mcpServers"],f)}let o=d(e,["codeExecution"]);if(o!=null)m(t,["codeExecution"],o);let i=d(e,["computerUse"]);if(i!=null)m(t,["computerUse"],i);if(d(e,["enterpriseWebSearch"])!==void 0)throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["exaAiSearch"])!==void 0)throw Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let s=d(e,["functionDeclarations"]);if(s!=null){let f=s;if(Array.isArray(f))f=f.map((h)=>h);m(t,["functionDeclarations"],f)}let l=d(e,["googleSearch"]);if(l!=null)m(t,["googleSearch"],Xq(l));let a=d(e,["googleSearchRetrieval"]);if(a!=null)m(t,["googleSearchRetrieval"],a);if(d(e,["parallelAiSearch"])!==void 0)throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=d(e,["urlContext"]);if(c!=null)m(t,["urlContext"],c);let u=d(e,["fileSearch"]);if(u!=null)m(t,["fileSearch"],u);return t}function cx(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((_)=>nx(_));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"],qq(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 ux(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 dx(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 fx(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],qn(e,n));let o=d(t,["config"]);if(o!=null)ux(o,r);return r}function px(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],qn(e,n));let o=d(t,["config"]);if(o!=null)dx(o,r);return r}var hx=class extends Dn{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new Ho(On.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=Fq(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=Uq(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=Jq(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=Wq(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=Bq(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=Vq(c),f=new Cm;return Object.assign(f,u),f})}else{let a=Gq(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=Hq(c),f=new Cm;return Object.assign(f,u),f})}}async update(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=px(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=fx(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=ex(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=rx(c),f=new Rm;return Object.assign(f,u),f})}else{let a=Qq(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=tx(c),f=new Rm;return Object.assign(f,u),f})}}};function $t(e,t){var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0)r[n]=e[n];if(e!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)if(t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o]))r[n[o]]=e[n[o]]}return r}function $m(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 wi(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 ws(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof $m==="function"?$m(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 mx(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 mE(r)}function mE(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 gx(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 Dm(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&&!mE(e[n]))i=!1;n++}if(i)t.push(...o);else t.pop()}return t}var vx=class{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new _x(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},_x=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(),gx(o)}async sendMessage(e){var t;await this.sendPromise;let r=jt(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=jt(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?Dm(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return wi(this,arguments,function*r(){var n,o,i,s,l,a;let c=[];try{for(var u=!0,f=ws(e),h;h=yield kt(f.next()),n=h.done,!n;u=!0){s=h.value,u=!1;let g=s;if(mx(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(...Dm(r));else this.history.push(e);this.history.push(...n)}},gE=class e extends Error{constructor(t){super(t.message);this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,e.prototype)}};function yx(e){let t={},r=d(e,["file"]);if(r!=null)m(t,["file"],r);return t}function Sx(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function Ex(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","file"],xd(r));return t}function bx(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function Tx(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","file"],xd(r));return t}function wx(e){let t={},r=d(e,["uris"]);if(r!=null)m(t,["uris"],r);return t}function Cx(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 Rx(e){let t={},r=d(e,["config"]);if(r!=null)Cx(r,t);return t}function Ax(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 Ix(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 Px=class e extends Dn{constructor(t){super();this.apiClient=t,this.list=async(r={})=>new Ho(On.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=Rx(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=Ax(a),u=new I1;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=yx(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=Sx(a),u=new P1;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=Tx(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=Ex(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=bx(a),u=new k1;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=wx(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=Ix(a),u=new N1;return Object.assign(u,c),u})}}};function kx(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 Nx(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 Ox(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>Kx(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Mx(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>Xx(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function $x(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 Dx(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"],ji(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"],vE(R));let T=d(e,["stopSequences"]);if(T!=null)m(t,["stopSequences"],T);let w=d(e,["temperature"]);if(w!=null)m(t,["temperature"],w);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 qx(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],kx(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 xx(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 Lx(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],n);let o=d(e,["responseModalities"]);if(t!==void 0&&o!=null)m(t,["setup","generationConfig","responseModalities"],o);let i=d(e,["temperature"]);if(t!==void 0&&i!=null)m(t,["setup","generationConfig","temperature"],i);let s=d(e,["topP"]);if(t!==void 0&&s!=null)m(t,["setup","generationConfig","topP"],s);let l=d(e,["topK"]);if(t!==void 0&&l!=null)m(t,["setup","generationConfig","topK"],l);let a=d(e,["maxOutputTokens"]);if(t!==void 0&&a!=null)m(t,["setup","generationConfig","maxOutputTokens"],a);let c=d(e,["mediaResolution"]);if(t!==void 0&&c!=null)m(t,["setup","generationConfig","mediaResolution"],c);let u=d(e,["seed"]);if(t!==void 0&&u!=null)m(t,["setup","generationConfig","seed"],u);let f=d(e,["speechConfig"]);if(t!==void 0&&f!=null)m(t,["setup","generationConfig","speechConfig"],qd(f));let h=d(e,["thinkingConfig"]);if(t!==void 0&&h!=null)m(t,["setup","generationConfig","thinkingConfig"],h);let g=d(e,["enableAffectiveDialog"]);if(t!==void 0&&g!=null)m(t,["setup","generationConfig","enableAffectiveDialog"],g);let p=d(e,["systemInstruction"]);if(t!==void 0&&p!=null)m(t,["setup","systemInstruction"],Ox(jt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let P=Ji(_);if(Array.isArray(P))P=P.map((D)=>tL(Wi(D)));m(t,["setup","tools"],P)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],Qx(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 T=d(e,["proactivity"]);if(t!==void 0&&T!=null)m(t,["setup","proactivity"],T);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 w=d(e,["avatarConfig"]);if(t!==void 0&&w!=null)m(t,["setup","avatarConfig"],w);let C=d(e,["safetySettings"]);if(t!==void 0&&C!=null){let P=C;if(Array.isArray(P))P=P.map((D)=>Zx(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 Ux(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],Dx(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"],vE(qd(f)));let h=d(e,["thinkingConfig"]);if(t!==void 0&&h!=null)m(t,["setup","generationConfig","thinkingConfig"],h);let g=d(e,["enableAffectiveDialog"]);if(t!==void 0&&g!=null)m(t,["setup","generationConfig","enableAffectiveDialog"],g);let p=d(e,["systemInstruction"]);if(t!==void 0&&p!=null)m(t,["setup","systemInstruction"],Mx(jt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let D=Ji(_);if(Array.isArray(D))D=D.map((N)=>rL(Wi(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 T=d(e,["proactivity"]);if(t!==void 0&&T!=null)m(t,["setup","proactivity"],T);let w=d(e,["explicitVadSignal"]);if(t!==void 0&&w!=null)m(t,["setup","explicitVadSignal"],w);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 Fx(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"],Lx(o,r));return r}function Gx(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"],Ux(o,r));return r}function Bx(e){let t={},r=d(e,["musicGenerationConfig"]);if(r!=null)m(t,["musicGenerationConfig"],r);return t}function Hx(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 Vx(e){let t={},r=d(e,["media"]);if(r!=null){let c=rE(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"],oE(n));let o=d(e,["audioStreamEnd"]);if(o!=null)m(t,["audioStreamEnd"],o);let i=d(e,["video"]);if(i!=null)m(t,["video"],nE(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 zx(e){let t={},r=d(e,["media"]);if(r!=null){let c=rE(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"],oE(n));let o=d(e,["audioStreamEnd"]);if(o!=null)m(t,["audioStreamEnd"],o);let i=d(e,["video"]);if(i!=null)m(t,["video"],nE(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 jx(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"],nL(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"],oL(u));return t}function Wx(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 Jx(e){let t={},r=d(e,["speakerVoiceConfigs"]);if(r!=null){let n=r;if(Array.isArray(n))n=n.map((o)=>eL(o));m(t,["speakerVoiceConfigs"],n)}return t}function Kx(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"],$x(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 Xx(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 Yx(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 Zx(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 Qx(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 eL(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"],_E(n));return t}function vE(e){let t={},r=d(e,["voiceConfig"]);if(r!=null)m(t,["voiceConfig"],_E(r));let n=d(e,["languageCode"]);if(n!=null)m(t,["languageCode"],n);let o=d(e,["multiSpeakerVoiceConfig"]);if(o!=null)m(t,["multiSpeakerVoiceConfig"],Jx(o));return t}function tL(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"],qx(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"],xx(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 rL(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((_)=>Wx(_));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"],Nx(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 nL(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 oL(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 _E(e){let t={},r=d(e,["replicatedVoiceConfig"]);if(r!=null)m(t,["replicatedVoiceConfig"],Yx(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 iL(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 sL(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"],aL(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 aL(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 lL(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=hr(i);if(Array.isArray(s))s=s.map((l)=>Xi(l));m(n,["contents"],s)}return n}function cL(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 uL(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 dL(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"],fL(o));return r}function fL(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 zs(e,t){let r={},n=d(e,["parts"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>gU(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function Xi(e,t){let r={},n=d(e,["parts"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>vU(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function pL(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 hL(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 mL(e,t,r){let n={},o=d(e,["systemInstruction"]);if(t!==void 0&&o!=null)m(t,["systemInstruction"],Xi(jt(o)));let i=d(e,["tools"]);if(t!==void 0&&i!=null){let l=i;if(Array.isArray(l))l=l.map((a)=>bE(a));m(t,["tools"],l)}let s=d(e,["generationConfig"]);if(t!==void 0&&s!=null)m(t,["generationConfig"],eU(s));return n}function gL(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=hr(i);if(Array.isArray(l))l=l.map((a)=>zs(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)hL(s);return n}function vL(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=hr(i);if(Array.isArray(l))l=l.map((a)=>Xi(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)mL(s,n);return n}function _L(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 yL(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 SL(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function EL(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function bL(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function TL(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function wL(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 CL(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)=>TU(c));m(n,["instances[0]","referenceImages"],a)}let l=d(t,["config"]);if(l!=null)wL(l,n);return n}function RL(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)=>Ul(s));m(r,["generatedImages"],i)}return r}function AL(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 IL(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 PL(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=Md(e,i);if(Array.isArray(c))c=c.map((u)=>u);m(n,["requests[]","content"],c)}let s=d(t,["content"]);if(s!=null)zs(jt(s));let l=d(t,["config"]);if(l!=null)AL(l,n);let a=d(t,["model"]);if(a!==void 0)m(n,["requests[]","model"],yt(e,a));return n}function kL(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=Md(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"],Xi(jt(a)))}let l=d(t,["config"]);if(l!=null)IL(l,n,r);return n}function NL(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 OL(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)=>dL(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 ML(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 $L(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 DL(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 qL(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"],zs(jt(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"],$d(b));let R=d(t,["responseJsonSchema"]);if(R!=null)m(o,["responseJsonSchema"],ji(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 T=d(t,["safetySettings"]);if(r!==void 0&&T!=null){let ve=T;if(Array.isArray(ve))ve=ve.map((me)=>CU(me));m(r,["safetySettings"],ve)}let w=d(t,["tools"]);if(r!==void 0&&w!=null){let ve=Ji(w);if(Array.isArray(ve))ve=ve.map((me)=>$U(Wi(me)));m(r,["tools"],ve)}let C=d(t,["toolConfig"]);if(r!==void 0&&C!=null)m(r,["toolConfig"],OU(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"],qn(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"],Dd(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"],iU(Q));let pe=d(t,["enableEnhancedCivicAnswers"]);if(pe!=null)m(o,["enableEnhancedCivicAnswers"],pe);if(d(t,["modelArmorConfig"])!==void 0)throw Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let se=d(t,["continuationToken"]);if(r!==void 0&&se!=null)m(r,["continuationToken"],se);return o}function xL(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"],Xi(jt(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"],$d(b));let R=d(t,["responseJsonSchema"]);if(R!=null)m(o,["responseJsonSchema"],ji(R));let T=d(t,["routingConfig"]);if(T!=null)m(o,["routingConfig"],T);let w=d(t,["modelSelectionConfig"]);if(w!=null)m(o,["modelConfig"],w);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=Ji(A);if(Array.isArray(ne))ne=ne.map((he)=>bE(Wi(he)));m(r,["tools"],ne)}let P=d(t,["toolConfig"]);if(r!==void 0&&P!=null)m(r,["toolConfig"],MU(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"],qn(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"],EE(Dd(B)));let Q=d(t,["audioTimestamp"]);if(Q!=null)m(o,["audioTimestamp"],Q);let pe=d(t,["thinkingConfig"]);if(pe!=null)m(o,["thinkingConfig"],pe);let se=d(t,["audioTranscriptionConfig"]);if(se!=null)m(o,["audioTranscriptionConfig"],se);let ve=d(t,["imageConfig"]);if(ve!=null)m(o,["imageConfig"],sU(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 qm(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=hr(i);if(Array.isArray(l))l=l.map((a)=>zs(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)m(n,["generationConfig"],qL(e,s,n));return n}function xm(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=hr(i);if(Array.isArray(l))l=l.map((a)=>Xi(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)m(n,["generationConfig"],xL(e,s,n));return n}function Lm(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)=>sL(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 Um(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 LL(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 UL(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)LL(s,n);return n}function FL(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)=>Ul(l));m(r,["generatedImages"],s)}let i=d(e,["positivePromptSafetyAttributes"]);if(i!=null)m(r,["positivePromptSafetyAttributes"],SE(i));return r}function GL(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"],Fl(f));let h=d(e,["referenceImages"]);if(t!==void 0&&h!=null){let p=h;if(Array.isArray(p))p=p.map((_)=>WU(_));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 BL(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"],Jr(y));let S=d(e,["referenceImages"]);if(t!==void 0&&S!=null){let w=S;if(Array.isArray(w))w=w.map((C)=>JU(C));m(t,["instances[0]","referenceImages"],w)}let E=d(e,["mask"]);if(t!==void 0&&E!=null)m(t,["instances[0]","mask"],jU(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 T=d(e,["resizeMode"]);if(t!==void 0&&T!=null)m(t,["parameters","resizeMode"],T);return n}function HL(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"],WL(l));return r}function VL(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"],JL(l));return r}function zL(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"],Fl(s));let l=d(t,["video"]);if(l!=null)m(n,["instances[0]","video"],TE(l));let a=d(t,["source"]);if(a!=null)KL(a,n);let c=d(t,["config"]);if(c!=null)GL(c,n);return n}function jL(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"],Jr(s));let l=d(t,["video"]);if(l!=null)m(n,["instances[0]","video"],wE(l));let a=d(t,["source"]);if(a!=null)XL(a,n);let c=d(t,["config"]);if(c!=null)BL(c,n);return n}function WL(e,t){let r={},n=d(e,["generatedSamples"]);if(n!=null){let s=n;if(Array.isArray(s))s=s.map((l)=>ZL(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 JL(e,t){let r={},n=d(e,["videos"]);if(n!=null){let s=n;if(Array.isArray(s))s=s.map((l)=>QL(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 KL(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"],Fl(i));let s=d(e,["video"]);if(t!==void 0&&s!=null)m(t,["instances[0]","video"],TE(s));return n}function XL(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"],Jr(i));let s=d(e,["video"]);if(t!==void 0&&s!=null)m(t,["instances[0]","video"],wE(s));return n}function Ul(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["image"],yE(n));let o=d(e,["raiFilteredReason"]);if(o!=null)m(r,["raiFilteredReason"],o);let i=d(e,["_self"]);if(i!=null)m(r,["safetyAttributes"],SE(i));let s=d(e,["prompt"]);if(s!=null)m(r,["enhancedPrompt"],s);return r}function YL(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["mask"],yE(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 ZL(e,t){let r={},n=d(e,["video"]);if(n!=null)m(r,["video"],VU(n));return r}function QL(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["video"],zU(n));return r}function eU(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"],ji(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 T=d(e,["speechConfig"]);if(T!=null)m(r,["speechConfig"],EE(T));let w=d(e,["stopSequences"]);if(w!=null)m(r,["stopSequences"],w);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 tU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function rU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function nU(e,t){let r={},n=d(e,["authConfig"]);if(n!=null)m(r,["authConfig"],iL(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 oU(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 iU(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 sU(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 yE(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"],Bo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function Fl(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"],Bo(n));let o=d(e,["mimeType"]);if(o!=null)m(r,["mimeType"],o);return r}function Jr(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"],Bo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function aU(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"],cE(e,a));return o}function lU(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"],cE(e,a));return o}function cU(e,t,r){let n={},o=d(t,["config"]);if(o!=null)aU(e,o,n);return n}function uU(e,t,r){let n={},o=d(t,["config"]);if(o!=null)lU(e,o,n);return n}function dU(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=uE(i);if(Array.isArray(s))s=s.map((l)=>nu(l));m(r,["models"],s)}return r}function fU(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=uE(i);if(Array.isArray(s))s=s.map((l)=>ou(l));m(r,["models"],s)}return r}function pU(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 hU(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 nu(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"],DU(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 ou(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)=>ML(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"],qU(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 mU(e,t){let r={},n=d(e,["speakerVoiceConfigs"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>NU(i));m(r,["speakerVoiceConfigs"],o)}return r}function gU(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"],$L(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 vU(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 _U(e,t){let r={},n=d(e,["productImage"]);if(n!=null)m(r,["image"],Jr(n));return r}function yU(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 SU(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)bU(i,n);let s=d(t,["config"]);if(s!=null)yU(s,n);return n}function EU(e,t){let r={},n=d(e,["predictions"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>Ul(i));m(r,["generatedImages"],o)}return r}function bU(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"],Jr(i));let s=d(e,["productImages"]);if(t!==void 0&&s!=null){let l=s;if(Array.isArray(l))l=l.map((a)=>_U(a));m(t,["instances[0]","productImages"],l)}return n}function TU(e,t){let r={},n=d(e,["referenceImage"]);if(n!=null)m(r,["referenceImage"],Jr(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"],pU(s));let l=d(e,["controlImageConfig"]);if(l!=null)m(r,["controlImageConfig"],pL(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 wU(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 SE(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 CU(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 RU(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Jr(n));return r}function AU(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 IU(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)kU(i,n);let s=d(t,["config"]);if(s!=null)AU(s,n);return n}function PU(e,t){let r={},n=d(e,["predictions"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>YL(i));m(r,["generatedMasks"],o)}return r}function kU(e,t,r){let n={},o=d(e,["prompt"]);if(t!==void 0&&o!=null)m(t,["instances[0]","prompt"],o);let i=d(e,["image"]);if(t!==void 0&&i!=null)m(t,["instances[0]","image"],Jr(i));let s=d(e,["scribbleImage"]);if(t!==void 0&&s!=null)m(t,["instances[0]","scribble"],RU(s));return n}function NU(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"],CE(o));return r}function EE(e,t){let r={},n=d(e,["voiceConfig"]);if(n!=null)m(r,["voiceConfig"],CE(n));let o=d(e,["languageCode"]);if(o!=null)m(r,["languageCode"],o);let i=d(e,["multiSpeakerVoiceConfig"]);if(i!=null)m(r,["multiSpeakerVoiceConfig"],mU(i));return r}function OU(e,t){let r={},n=d(e,["functionCallingConfig"]);if(n!=null)m(r,["functionCallingConfig"],DL(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 MU(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 $U(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"],nU(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"],oU(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 bE(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)=>hU(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"],uL(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 DU(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 qU(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 xU(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 LU(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 UU(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)xU(i,n);return n}function FU(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)LU(i,n);return n}function GU(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 BU(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"],Jr(i));let s=d(t,["upscaleFactor"]);if(s!=null)m(n,["parameters","upscaleConfig","upscaleFactor"],s);let l=d(t,["config"]);if(l!=null)GU(l,n);return n}function HU(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)=>Ul(s));m(r,["generatedImages"],i)}return r}function VU(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"],Bo(o));let i=d(e,["encoding"]);if(i!=null)m(r,["mimeType"],i);return r}function zU(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"],Bo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function jU(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["_self"],Jr(n));let o=d(e,["maskMode"]);if(o!=null)m(r,["maskMode"],o);return r}function WU(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Fl(n));let o=d(e,["referenceType"]);if(o!=null)m(r,["referenceType"],o);return r}function JU(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Jr(n));let o=d(e,["referenceType"]);if(o!=null)m(r,["referenceType"],o);return r}function TE(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"],Bo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["encoding"],i);return r}function wE(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"],Bo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function CE(e,t){let r={},n=d(e,["replicatedVoiceConfig"]);if(n!=null)m(r,["replicatedVoiceConfig"],wU(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 KU(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 XU(e,t){let r={},n=d(t,["config"]);if(n!=null)KU(e,n,r);return r}function YU(e,t){let r={},n=d(e,["force"]);if(t!==void 0&&n!=null)m(t,["_query","force"],n);return r}function ZU(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);let n=d(e,["config"]);if(n!=null)YU(n,t);return t}function QU(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);return t}function eF(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 tF(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"],nF(s));return t}function rF(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)eF(o,t);return t}function nF(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 oF(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 iF(e){let t={},r=d(e,["config"]);if(r!=null)oF(r,t);return t}function sF(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 RE(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 aF(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)RE(n,t);return t}function lF(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}var cF="Content-Type",uF="X-Server-Timeout",dF="User-Agent",iu="x-goog-api-client",fF="2.26.0",pF=`google-genai-sdk/${fF}`,hF="v1beta1",mF="v1beta",gF=new Set(["us","eu"]);function vF(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 _F(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 yF=5,SF=1,EF=60,bF=2,TF=1,wF=[408,429,500,502,503,504],CF=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&&gF.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:hF}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:mF,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===Qc.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)vF(t.timeout);if(t&&t.extraBody!==null)RF(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 Ac(l),new Mi(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 Ac(l),this.processStreamResponse(l))).catch((l)=>{if(l instanceof Error)throw l;else throw Error(`exception ${l} sending request`,{cause:l})})}processStreamResponse(e){return wi(this,arguments,function*t(){var r;let n=(r=e===null||e===void 0?void 0:e.body)===null||r===void 0?void 0:r.getReader(),o=new TextDecoder("utf-8");if(!n)throw Error("Response body is empty");try{let i="",s="data:",l=[`
|
|
126
|
+
|
|
127
|
+
`,"\r\r",`\r
|
|
128
|
+
\r
|
|
129
|
+
`];while(!0){let{done:a,value:c}=yield kt(n.read());if(a){if(i.trim().length>0)throw Error("Incomplete JSON segment at the end");break}let u=o.decode(c,{stream:!0});try{let g=JSON.parse(u);if("error"in g){let p=JSON.parse(JSON.stringify(g.error)),{status:_,code:y}=p,S=`got status: ${_}. ${JSON.stringify(g)}`;if(y>=400&&y<600)throw new gE({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 Mi(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:wF,p=async()=>{let E=_F(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 Ac(b)}finally{E.dispose()}return b};if(!r)return p();let _=Math.max(1,(l=r.attempts)!==null&&l!==void 0?l:yF),y=Math.round(((a=r.initialDelay)!==null&&a!==void 0?a:SF)*1000),S=Math.max(y,Math.round(((c=r.maxDelay)!==null&&c!==void 0?c:EF)*1000));return(0,VD.default)(p,{retries:_-1,factor:(u=r.expBase)!==null&&u!==void 0?u:bF,minTimeout:y,maxTimeout:S,randomize:((f=r.jitter)!==null&&f!==void 0?f:TF)>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=pF+" "+this.clientOptions.userAgentExtra;return e[dF]=t,e[iu]=t,e[cF]="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(uF,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)RE(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 Ac(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 gE({message:o,status:r});throw Error(o)}}function RF(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 AF="mcp_used/unknown",IF=!1;function AE(e){for(let t of e){if(PF(t))return!0;if(typeof t==="object"&&"inputSchema"in t)return!0}return IF}function IE(e){var t;let r=(t=e[iu])!==null&&t!==void 0?t:"";e[iu]=(r+` ${AF}`).trimStart()}function PF(e){return e!==null&&typeof e==="object"&&e instanceof NF}function kF(e){return wi(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 NF=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,ws(kF(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(),U1(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 OF(e,t,r){let n=new M1,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 MF=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=qF(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)=>{OF(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,DF(i),g);p.connect(),await c;let S={setup:{model:yt(this.apiClient,e.model)}};return p.send(JSON.stringify(S)),new $F(p,this.apiClient)}},$F=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=Hx(e);this.conn.send(JSON.stringify({clientContent:t}))}async setMusicGenerationConfig(e){if(!e.musicGenerationConfig)e.musicGenerationConfig={};let t=Bx(e);this.conn.send(JSON.stringify(t))}sendPlaybackControl(e){let t={playbackControl:e};this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(_i.PLAY)}pause(){this.sendPlaybackControl(_i.PAUSE)}stop(){this.sendPlaybackControl(_i.STOP)}resetContext(){this.sendPlaybackControl(_i.RESET_CONTEXT)}close(){this.conn.close()}};function DF(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}function qF(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}var xF="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function LF(e,t,r){let n=new O1,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=jx(i);Object.assign(n,s)}else Object.assign(n,i);t(n)}var UF=class{constructor(e,t,r){this.apiClient=e,this.auth=t,this.webSocketFactory=r,this.music=new MF(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&&AE(e.config.tools))IE(u);let f=HF(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}),T={onopen:_,onmessage:(G)=>{LF(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){}},w=this.webSocketFactory.create(c,BF(f),T);w.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:[tl.AUDIO]};else e.config.responseModalities=[tl.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=Gx(this.apiClient,N);else A=Fx(this.apiClient,N);delete A.config;let F=new GF(w,this.apiClient);w.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"}},FF={turnComplete:!0},GF=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=hr(t.turns),!e.isVertexAI())r=r.map((n)=>zs(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(xF)}return{toolResponse:{functionResponses:r}}}sendClientContent(e){e=Object.assign(Object.assign({},FF),e);let t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};if(this.apiClient.isVertexAI())t={realtimeInput:zx(e)};else t={realtimeInput:Vx(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 BF(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}function HF(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}var Fm=10;function Gm(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(Ci(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 Ci(e){return"callTool"in e&&typeof e.callTool==="function"}function VF(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)=>Ci(o)))!==null&&n!==void 0?n:!1}function Bm(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(Ci(n))return;let i=n;if(i.functionDeclarations&&i.functionDeclarations.length>0)r.push(o)}),r}function Hm(e){var t;return!((t=e===null||e===void 0?void 0:e.automaticFunctionCalling)===null||t===void 0?void 0:t.ignoreCallHistory)}var Gl=class e extends Dn{constructor(t){super();this.apiClient=t,this.embedContent=async(r)=>{if(!this.apiClient.isVertexAI()){if(r.model.includes("gemini-embedding-2"))r.contents=hr(r.contents);return await this.embedContentInternal(r)}if(r.model.includes("gemini")&&r.model!=="gemini-embedding-001"||r.model.includes("maas")){let o=hr(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:rl.EMBED_CONTENT});return await this.embedContentInternal(i)}else{let o=Object.assign(Object.assign({},r),{embeddingApiType:rl.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),!VF(r)||Gm(r.config))return await this.generateContentInternal(a);let c=Bm(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=hr(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:Fm,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(Ci(S)){let b=await S.callTool(u.functionCalls);y.push(...b)}if(p++,f={role:"user",parts:y},a.contents=hr(a.contents),a.contents.push(_),a.contents.push(f),Hm(a.config))h.push(_),h.push(f)}if(Hm(a.config))u.automaticFunctionCallingHistory=h;return u},this.generateContentStream=async(r)=>{var n,o,i,s,l;if(this.maybeMoveToResponseJsonSchema(r),Gm(r.config)){let f=await this.processParamsMaybeAddMcpUsage(r);return await this.generateContentStreamInternal(f)}let a=Bm(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 Ho(On.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(Ci(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&&AE(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();IE(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(Ci(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:Fm,s=!1,l=0,a=await this.initAfcToolsMap(t);return function(c,u,f){return wi(this,arguments,function*(){var h,g,p,_,y,S;while(l<i){if(s)l++,s=!1;let T=yield kt(c.processParamsMaybeAddMcpUsage(f)),w=yield kt(c.generateContentStreamInternal(T)),C=[],A=[];try{for(var E=!0,b=(g=void 0,ws(w)),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 ps;P.candidates=[{content:{role:"user",parts:C}}],yield yield kt(P);let D=[];D.push(...A),D.push({role:"user",parts:C});let N=hr(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=xm(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=Um(u),h=new ps;return Object.assign(h,f),h})}else{let c=qm(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=Lm(u),h=new ps;return Object.assign(h,f),h})}}async generateContentStreamInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=xm(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 wi(this,arguments,function*(){var h,g,p,_;try{for(var y=!0,S=ws(f),E;E=yield kt(S.next()),h=E.done,!h;y=!0){_=E.value,y=!1;let b=_,R=Um(yield kt(b.json()),t);R.sdkHttpResponse={headers:b.headers};let T=new ps;Object.assign(T,R),yield yield kt(T)}}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=qm(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 wi(this,arguments,function*(){var h,g,p,_;try{for(var y=!0,S=ws(f),E;E=yield kt(S.next()),h=E.done,!h;y=!0){_=E.value,y=!1;let b=_,R=Lm(yield kt(b.json()),t);R.sdkHttpResponse={headers:b.headers};let T=new ps;Object.assign(T,R),yield yield kt(T)}}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=kL(this.apiClient,t,t),u=G1(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=OL(f,t),g=new Sm;return Object.assign(g,h),g})}else{let c=PL(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=NL(u),h=new Sm;return Object.assign(h,f),h})}}async generateImagesInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=UL(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=FL(a),u=new g1;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=CL(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=RL(a),u=new v1;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=BU(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=HU(a),u=new _1;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=SU(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=EU(a),u=new y1;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=IU(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=PU(a),u=new S1;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=rU(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)=>ou(u))}else{let c=tU(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)=>nu(u))}}async listInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=uU(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=fU(u),h=new Em;return Object.assign(h,f),h})}else{let c=cU(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=dU(u),h=new Em;return Object.assign(h,f),h})}}async update(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=FU(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)=>ou(u))}else{let c=UU(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)=>nu(u))}}async delete(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=EL(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=TL(u),h=new bm;return Object.assign(h,f),h})}else{let c=SL(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=bL(u),h=new bm;return Object.assign(h,f),h})}}async countTokens(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=vL(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=yL(u),h=new Tm;return Object.assign(h,f),h})}else{let c=gL(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=_L(u),h=new Tm;return Object.assign(h,f),h})}}async computeTokens(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=lL(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=cL(a),u=new E1;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=jL(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=VL(u),h=new eu;return Object.assign(h,f),h})}else{let c=zL(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=HL(u),h=new eu;return Object.assign(h,f),h})}}};Gl.loggedGenerateImagesWarning=!1;Gl.loggedEditImageWarning=!1;Gl.loggedGenerateVideosWarning=!1;var zF=class extends Dn{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=u1(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=c1(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=r1(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 jF(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 WF(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>tG(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function JF(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"],eG(e,l));let a=d(t,["lockAdditionalFields"]);if(r!==void 0&&a!=null)m(r,["fieldMask"],a);return n}function KF(e,t){let r={},n=d(t,["config"]);if(n!=null)m(r,["config"],JF(e,n,r));return r}function XF(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 YF(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],jF(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 ZF(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 QF(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],n);let o=d(e,["responseModalities"]);if(t!==void 0&&o!=null)m(t,["setup","generationConfig","responseModalities"],o);let i=d(e,["temperature"]);if(t!==void 0&&i!=null)m(t,["setup","generationConfig","temperature"],i);let s=d(e,["topP"]);if(t!==void 0&&s!=null)m(t,["setup","generationConfig","topP"],s);let l=d(e,["topK"]);if(t!==void 0&&l!=null)m(t,["setup","generationConfig","topK"],l);let a=d(e,["maxOutputTokens"]);if(t!==void 0&&a!=null)m(t,["setup","generationConfig","maxOutputTokens"],a);let c=d(e,["mediaResolution"]);if(t!==void 0&&c!=null)m(t,["setup","generationConfig","mediaResolution"],c);let u=d(e,["seed"]);if(t!==void 0&&u!=null)m(t,["setup","generationConfig","seed"],u);let f=d(e,["speechConfig"]);if(t!==void 0&&f!=null)m(t,["setup","generationConfig","speechConfig"],qd(f));let h=d(e,["thinkingConfig"]);if(t!==void 0&&h!=null)m(t,["setup","generationConfig","thinkingConfig"],h);let g=d(e,["enableAffectiveDialog"]);if(t!==void 0&&g!=null)m(t,["setup","generationConfig","enableAffectiveDialog"],g);let p=d(e,["systemInstruction"]);if(t!==void 0&&p!=null)m(t,["setup","systemInstruction"],WF(jt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let P=Ji(_);if(Array.isArray(P))P=P.map((D)=>oG(Wi(D)));m(t,["setup","tools"],P)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],nG(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 T=d(e,["proactivity"]);if(t!==void 0&&T!=null)m(t,["setup","proactivity"],T);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 w=d(e,["avatarConfig"]);if(t!==void 0&&w!=null)m(t,["setup","avatarConfig"],w);let C=d(e,["safetySettings"]);if(t!==void 0&&C!=null){let P=C;if(Array.isArray(P))P=P.map((D)=>rG(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 eG(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"],QF(o,r));return r}function tG(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"],XF(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 rG(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 nG(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 oG(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"],YF(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"],ZF(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 iG(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 sG(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=iG(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 aG=class extends Dn{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=KF(this.apiClient,e);o=Ae("auth_tokens",s._url),i=s._query,delete s.config,delete s._url,delete s._query;let l=sG(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 lG(e,t){let r={},n=d(e,["force"]);if(t!==void 0&&n!=null)m(t,["_query","force"],n);return r}function cG(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);let n=d(e,["config"]);if(n!=null)lG(n,t);return t}function uG(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);return t}function dG(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 fG(e){let t={},r=d(e,["parent"]);if(r!=null)m(t,["_url","parent"],r);let n=d(e,["config"]);if(n!=null)dG(n,t);return t}function pG(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 hG=class extends Dn{constructor(e){super();this.apiClient=e,this.list=async(t)=>new Ho(On.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=uG(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=cG(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=fG(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=pG(l),c=new w1;return Object.assign(c,a),c})}}},mG=class extends Dn{constructor(e,t=new hG(e)){super();this.apiClient=e,this.documents=t,this.list=async(r={})=>new Ho(On.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 Mi){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=XU(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=QU(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=ZU(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=iF(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=sF(l),c=new C1;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=aF(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=lF(l),c=new R1;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=rF(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=tF(l),c=new A1;return Object.assign(c,a),c})}}};function gG(){if("Deno"in globalThis)return!0;return!1}var wa=void 0;function Os(){var e,t,r,n,o,i;if(wa)return wa;let s=globalThis,l={};if(gG())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 wa=l,wa}function vG(e){var t,r;let n=Object.assign({},e),o=Os();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 _G=class{constructor(e){this.options=e}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(e){return TG(await this.options.getAuthHeaders(e))}},yG=class{beforeCreateRequest(e,t){return Object.assign(Object.assign({},t),{url:SG(t.url)})}async beforeRequest(e,t){if(zm(t.headers,bG(e.security_source)),wG(e,t.headers),RG(t.headers))return t;let r=await EG(e.security_source,t.url);return zm(t.headers,r===null||r===void 0?void 0:r.default_headers),CG(t.headers,r),t}};function SG(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 EG(e,t){if(kE(e))return e.resolveGoogleGenAISecurity(t);let r=typeof e==="function"?await e():e;if(PE(r))return Vm(r);return Vm(void 0)}function bG(e){var t,r;if(kE(e))return(r=(t=e.getDefaultHeaders)===null||t===void 0?void 0:t.call(e))!==null&&r!==void 0?r:e.defaultHeaders;if(PE(e))return e.default_headers;return}function Vm(e){var t,r;let n=Os(),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 NE(o)?o:void 0}function TG(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 NE(o)?o:void 0}function zm(e,t){if(!t)return;for(let[r,n]of new Headers(t))if(e.get(r)===null)e.set(r,n)}function wG(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 CG(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",AG(t.access_token))}function RG(e){return e.get("authorization")!==null||e.get("x-goog-api-key")!==null}function AG(e){return e.slice(0,7).toLowerCase()==="bearer "?e:`Bearer ${e}`}function PE(e){return typeof e==="object"&&e!==null}function kE(e){return typeof e==="object"&&e!==null&&"resolveGoogleGenAISecurity"in e&&typeof e.resolveGoogleGenAISecurity==="function"}function NE(e){return e.api_key!==void 0||e.access_token!==void 0||e.default_headers!==void 0}var Yi=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}},jm=class extends Yi{constructor(){super(...arguments);this.name="UnexpectedClientError"}},Ca=class extends Yi{constructor(){super(...arguments);this.name="InvalidRequestError"}},OE=class extends Yi{constructor(){super(...arguments);this.name="RequestAbortedError"}},ME=class extends Yi{constructor(){super(...arguments);this.name="RequestTimeoutError"}},$E=class extends Yi{constructor(){super(...arguments);this.name="ConnectionError"}},cn=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"}},IG=class extends Error{},$r=class e extends IG{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=Jm(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&&BG(r)&&typeof r.message==="string"?r.message:void 0,s=Jm(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 ol({message:n,cause:r instanceof Error?r:void 0});if(t===400)return new NG(t,r,n,o);if(t===401)return new OG(t,r,n,o);if(t===403)return new MG(t,r,n,o);if(t===404)return new $G(t,r,n,o);if(t===409)return new DG(t,r,n,o);if(t===422)return new qG(t,r,n,o);if(t===429)return new xG(t,r,n,o);if(t>=500)return new LG(t,r,n,o);return new e(t,r,n,o)}},PG=class extends $r{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ol=class extends $r{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);this.cause=t}},kG=class extends ol{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."})}},NG=class extends $r{},OG=class extends $r{},MG=class extends $r{},$G=class extends $r{},DG=class extends $r{},qG=class extends $r{},xG=class extends $r{},LG=class extends $r{};function Ao(e){if(HG(e))return e;if(e instanceof cn)return UG(e);if(e instanceof Yi)return FG(e);return e}function UG(e){let t=GG(e),r=$r.generate(e.statusCode,t,e.message,e.headers);return hs(r,"body",e.body),hs(r,"contentType",e.contentType),hs(r,"rawResponse",e.rawResponse),hs(r,"statusCode",e.statusCode),hs(r,"cause",e),r}function FG(e){if(e instanceof ME)return new kG({message:e.message});if(e instanceof OE)return new PG({message:e.message});if(e instanceof $E)return new ol({message:e.message,cause:e});return new ol({message:e.message,cause:e})}function GG(e){let t=Wm(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=Wm(e,"error");return r&&typeof r==="object"?r:void 0}function Wm(e,t){return e&&typeof e==="object"?e[t]:void 0}function Jm(e){if(!e)return"";try{return JSON.stringify(e)}catch(t){return String(e)}}function BG(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function HG(e){return typeof e==="object"&&e!==null?$r.prototype.isPrototypeOf(e):!1}function hs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!1})}var VG=(e,t)=>{if(t==null)return fetch(e);else return fetch(e,t)},DE=class e{constructor(t={}){this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.options=t,this.fetcher=t.fetcher||VG}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}},Km=/\s*;\s*/g;function mi(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(Km),[i="",...s]=o;if(i.split("/").length!==2)return!1;let l=n.split(Km),[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 zG=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(!zG.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 jG(e,t,r){return ot(e,t)&&mi(e,r)}function qE(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 xE(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 WG(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 JG(e){let t=new yG;e.registerBeforeCreateRequestHook(t),e.registerBeforeRequestHook(t)}var Xm=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)}JG(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 Ym(e){return{ok:!0,value:e}}function In(e){return{ok:!1,error:e}}function Ld(e){return btoa(String.fromCodePoint(...e))}function KG(e){return new TextEncoder().encode(e)}function XG(e){return Ld(KG(e))}var YG=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(!YG.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 Zm=["https://generativelanguage.googleapis.com"];function ZG(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>=Zm.length)throw Error(`Invalid server index ${i}`);r=Zm[i]||""}let o=it(r)(n);return new URL(o)}var QG={userAgent:"speakeasy-sdk/typescript 2.4.1-preview.4 internal v1beta @google/genai"};function eB(...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 tB(t)}}function tB(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 co(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 rB=/%(2[346bcf]|3[abdf]|40|5[bd])/gi;function LE(e,t){return Bl(e,t==="percentExceptReserved"?"percent":t)}function Bl(e,t){switch(t){case"percent":return encodeURIComponent(e);case"percentExceptReserved":return encodeURIComponent(e).replace(rB,(r)=>decodeURIComponent(r));default:return e}}function nB(e){return(t,r,n)=>{let o="",i=(n===null||n===void 0?void 0:n.explode)?FE(t,r):[[t,r]];if(i.every(([c,u])=>u==null))return;let s=(c)=>Bl(c,n===null||n===void 0?void 0:n.charEncoding),l=(c)=>s(GE(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=HE(u,(_)=>`${l(_)}`))===null||f===void 0?void 0:f.join(a);else if(co(u))p=(h=VE(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=`${LE(c,n===null||n===void 0?void 0:n.charEncoding)}=${p}`,!g||g==="=")return;o+=`&${g}`}),o.slice(1)}}var UE=nB(",");function Dr(e,t,r){if(typeof t>"u")return;let o=((i)=>Bl(i,r===null||r===void 0?void 0:r.charEncoding))(JSON.stringify(t,BE));return(r===null||r===void 0?void 0:r.explode)?o:`${LE(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)?FE(e,t):[[e,t]];if(o.every(([l,a])=>a==null))return;let i=(l)=>Bl(l,r===null||r===void 0?void 0:r.charEncoding),s=(l)=>i(GE(l));return o.forEach(([l,a])=>{var c;let u="";if(a==null)return;else if(Array.isArray(a))u=(c=HE(a,(f)=>`${s(f)}`))===null||c===void 0?void 0:c.join(",");else if(co(a)){let f=VE(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)&&co(t)?`${l}=`:""}${s(a)}`;n+=u?`,${u}`:""}),n.slice(1)};function FE(e,t){if(Array.isArray(t))return t.map((r)=>[e,r]);else if(co(t))return Object.entries(t!==null&&t!==void 0?t:{}).map(([n,o])=>[n,o]);else return[[e,t]]}function GE(e){if(e==null)return"";else if(e instanceof Date)return e.toISOString();else if(e instanceof Uint8Array)return Ld(e);else if(typeof e==="object")return JSON.stringify(e,BE);return`${e}`}function BE(e,t){if(t instanceof Uint8Array)return Ld(t);else return t}function HE(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 VE(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 oB(...e){return e.filter(Boolean).join("&")}function iB(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 oB(...c)}}var qr=iB(UE),Qm={initialInterval:500,maxInterval:60000,exponent:1.5,maxElapsedTime:3600000},Ud=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)}},$i=class e extends Error{constructor(t,r){super(t);this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,e.prototype)}};async function sB(e,t){var r;switch(t.config.strategy){case"backoff":return cB(eg(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),(r=t.config.backoff)!==null&&r!==void 0?r:Qm);case"attempt-count-backoff":return uB(eg(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),Object.assign(Object.assign({},Qm),t.config.backoff),t.config);default:return await e(0)}}function eg(e,t){return async(r)=>{try{let n=await e(r);if(lB(n,t.statusCodes))throw new $i("Response failed with retryable status code",n);return n}catch(n){if(n instanceof $i)throw n;if(t.retryConnectionErrors&&(xE(n)||qE(n)))throw n;throw new Ud("Permanent error",{cause:n})}}}var aB=new RegExp("^[0-9]xx$","i");function lB(e,t){let r=`${e.status}`;return t.some((n)=>{if(!aB.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 cB(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 Ud)throw a.cause;if(Date.now()-s>r){if(a instanceof $i)return a.response;throw a}let u=0;if(a instanceof $i)u=zE(a.response);if(u<=0)u=n*Math.pow(l,o)+Math.random()*1000;let f=Math.min(u,i);await jE(f),l++}}async function uB(e,t,r){let n=0;while(!0)try{return await e(n)}catch(o){if(o instanceof Ud)throw o.cause;if(n>=r.maxRetries){if(o instanceof $i)return o.response;throw o}let i=0;if(o instanceof $i)i=zE(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 jE(s),n++}}function zE(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 jE(e){return new Promise((t)=>setTimeout(t,e))}var Ra=typeof globalThis>"u"?null:globalThis,dB=typeof Ra==="object"&&Ra!=null&&"importScripts"in Ra&&typeof Ra.importScripts==="function",fB=dB||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window==="object"&&typeof window.document<"u",un=class{constructor(e={}){let t=e;if(typeof t==="object"&&t!=null&&"hooks"in t&&t.hooks instanceof Xm)this._hooks=t.hooks;else this._hooks=new Xm;let r=new DE;e.http_client=e.http_client||r,e=this._hooks.sdkInit(e);let n=ZG(e);if(n)n.pathname=n.pathname.replace(/\/+$/,"")+"/";if(this._baseURL=n,this._httpClient=e.http_client||r,this._options=Object.assign(Object.assign({},vG(e)),{hooks:this._hooks}),this._logger=this._options.debug_logger,!this._logger&&Os().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 In(new Ca("No base URL provided for operation"));let p=new URL(g),_;if(c){if(p.pathname=p.pathname.replace(/\/+$/,"")+"/",_=new URL(c,p),!_.search&&p.search)_.search=p.search}else _=p;_.hash="";let y=(G,B)=>{if(!B)return G;let Q=new Set(B.split("&").filter((se)=>se!=="").map((se)=>{var ve;return(ve=se.split("=")[0])!==null&&ve!==void 0?ve:""}));return[...G.split("&").filter((se)=>{var ve;return se!==""&&!Q.has((ve=se.split("=")[0])!==null&&ve!==void 0?ve:"")}),B].join("&")},S=(G)=>Object.entries(G).map(([B,Q])=>{if(Q==null)return;let pe=co(Q)?JSON.stringify(Q):Q;return UE(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,T=h===null||h===void 0?void 0:h.basic.password;if(R!=null||T!=null){let G=XG([R||"",T||""].join(":"));b.set("Authorization",`Basic ${G}`)}let w=new Headers((h===null||h===void 0?void 0:h.headers)||{});for(let[G,B]of w)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(!fB)b.set((s=t.uaHeader)!==null&&s!==void 0?s:"user-agent",(l=t.userAgent)!==null&&l!==void 0?l:QG.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 In(new Ca("extra_body can only be merged into JSON object request bodies"));let Q;try{Q=P?JSON.parse(P):{}}catch(pe){return In(new Ca("extra_body can only be merged into JSON object request bodies",{cause:pe}))}if(!co(Q))return In(new Ca("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 In(new jm("Create request hook failed to execute",{cause:G}))}return Ym(new Request(F.url,F.options))}async _do(e,t){let{context:r,isErrorStatusCode:n}=t,o=r.timeout_ms;return sB(async()=>{var i;let s=e.clone(),l=s;if(o!=null&&o>0){let u=AbortSignal.timeout(o),f=(i=eB(s.signal,u))!==null&&i!==void 0?i:u;l=new Request(s,{signal:f})}let a=await this._hooks.beforeRequest(r,l);await pB(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 hB(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)=>Ym(i),(i)=>{switch(!0){case WG(i):return In(new OE("Request aborted by client",{cause:i}));case xE(i):return In(new ME("Request timed out",{cause:i}));case qE(i):return In(new $E("Unable to make request",{cause:i}));default:return In(new jm("Unexpected HTTP client error",{cause:i}))}})}},WE=/^(application|text)\/([^+]+\+)*json.*/,tg=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function pB(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 WE.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 hB(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(mi(t,"application/json")||WE.test(o)&&!tg.test(o)):e.log(await t.clone().json());break;case(mi(t,"application/jsonl")||tg.test(o)):case mi(t,"text/event-stream"):e.log(`<${n}>`);break;case mi(t,"text/*"):e.log(await t.clone().text());break;case mi(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 rg=class extends cn{constructor(e,t){if(e)e+=": ";e+=`Status ${t.response.status}`;let r=t.response.headers.get("content-type")||'""';if(r!=="application/json")e+=` Content-Type ${r.includes(" ")?`"${r}"`:r}`;let n=t.body||'""';e+=n.length>100?`
|
|
130
|
+
`:". ";let o=n;if(n.length>1e4){let i=n.substring(0,1e4),s=n.length-1e4;o=`${i}...and ${s} more chars`}e+=`Body: ${o}`,e=e.trim();super(e,t);this.name="GoogleGenAiDefaultError"}};function ng(e){try{return JSON.parse(e)}catch(t){return e}}function mB(e,t={}){var r,n;let o=t.flattened===!0,i=(r=t.sentinel)!==null&&r!==void 0?r:"";return new gB(e,(s)=>{if(i!==""&&s.data===i)return{done:!0,value:void 0};if(o)return{done:!1,value:s.data==null?void 0:ng(s.data)};return{done:!1,value:Object.assign(Object.assign({},s),{data:s.data==null?s.data:ng(s.data)})}},{dataRequired:(n=t.dataRequired)!==null&&n!==void 0?n:!0})}var gB=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=_B(i,s,l);if(!f){l=Math.max(0,s-vB+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=yB(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)}},Ir=13,Pr=10,JE=[[Ir,Pr,Ir,Pr],[Ir,Pr,Ir],[Ir,Pr,Pr],[Ir,Ir,Pr],[Pr,Ir,Pr],[Ir,Ir],[Pr,Ir],[Pr,Pr]],vB=JE.reduce((e,t)=>Math.max(e,t.length),0);function _B(e,t,r){for(let n=r;n<t;n++){if(e[n]!==Ir&&e[n]!==Pr)continue;for(let o of JE){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 yB(e,t,r,n){let i=new TextDecoder().decode(e).split(/\r\n|\r|\n/),s=[],l={},a=!0;for(let c of i){if(!c||c.startsWith(":"))continue;a=!1;let u=c.indexOf(":"),f=c,h="";if(u>0)f=c.slice(0,u),h=c[u+1]===" "?c.slice(u+2):c.slice(u+1);if(f==="data")s.push(h);else if(f==="event")l.event=h;else if(f==="id"&&!h.includes("\x00"))r.eventId=h;else if(f==="retry"&&/^\d+$/.test(h))l.retry=Number(h)}if(a)return;if(l.id=r.eventId,s.length)l.data=s.join(`
|
|
131
|
+
`);else if(n)return;return t(l)}var SB={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function uo(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 KE(e,t,r){return Object.assign(Object.assign(Object.assign({},r),{enc:"sse",codes:e}),t?{sse:t}:{})}function XE(e,t){return Object.assign(Object.assign({},t),{enc:"nil",codes:e})}function $e(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:SB[h.enc];if(p&&jG(r,g,p)){s=h;break}else if(!p&&ot(r,g)){s=h;break}}if(!s)return[{ok:!1,error:new rg("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=mB(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 rg("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:bB(r.headers)}:null;if("err"in s)u=Object.assign(Object.assign(Object.assign({},o===null||o===void 0?void 0:o.extraFields),f),co(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),co(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 EB=/, */;function bB(e){let t={};for(let[r,n]of e.entries())t[r]=n.split(EB);return t}var og={Incomplete:"incomplete",UnrecognisedSecurityType:"unrecognized_security_type"},TB=class e extends Error{constructor(t,r){super(r);this.code=t,this.name="SecurityError"}static incomplete(){return new e(og.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(t){return new e(og.UnrecognisedSecurityType,`Unrecognised security type: ${t}`)}};function wB(...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":CB(t,n);break;case"http:custom":break;case"http:bearer":Aa(t,n);break;case"oauth2":Aa(t,n);break;case"oauth2:password":Aa(t,n);break;case"oauth2:client_credentials":break;case"openIdConnect":Aa(t,n);break;default:throw TB.unrecognizedType(o)}}),t}function CB(e,t){if(t.value==null)return;e.basic=t.value}function Aa(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:Os().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:Os().GOOGLE_GENAI_API_KEY},{fieldName:"defaultHeaders",type:"http:custom",value:e===null||e===void 0?void 0:e.default_headers}]];return wB(...o)}async function ht(e){if(e==null)return;return typeof e==="function"?e():e}var YE,st=class e{constructor(t,r){this[YE]="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)}};YE=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 ZE(e,t,r,n){return new st(RB(e,t,r,n))}async function RB(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=Dr("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:(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]=await ft($e("4XX"),$e("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 QE(e,t,r,n){return new st(AB(e,t,r,n))}async function AB(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:(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]=await ft($e("4XX"),$e("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 eb(e,t,r,n){return new st(IB(e,t,r,n))}async function IB(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:(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]=await ft($e("4XX"),$e("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 tb(e,t,r,n,o,i){return new st(PB(e,t,r,n,o,i))}async function PB(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=qr({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,T=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!T.ok)return[T,{status:"request-error",request:R}];let w=T.value,[C]=await ft($e("4XX"),$e("5XX"),_t("default"))(w,R);if(!C.ok)return[C,{status:"complete",request:R,response:w}];return[C,{status:"complete",request:R,response:w}]}var kB=class extends un{list(e,t){return ct(tb(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,e===null||e===void 0?void 0:e.parent,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(ZE(this,n,r,t))}delete(e,t,r){return ct(QE(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(eb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function rb(e,t,r,n){return new st(NB(e,t,r,n))}async function NB(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=Dr("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:(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]=await ft($e("4XX"),$e("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 nb(e,t,r,n){return new st(OB(e,t,r,n))}async function OB(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:(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]=await ft($e("4XX"),$e("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function ob(e,t,r,n){return new st(MB(e,t,r,n))}async function MB(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:(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]=await ft($e("4XX"),$e("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 ib(e,t,r,n,o){return new st($B(e,t,r,n,o))}async function $B(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=qr({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 T=R.value,[w]=await ft($e("4XX"),$e("5XX"),_t("default"))(T,b);if(!w.ok)return[w,{status:"complete",request:b,response:T}];return[w,{status:"complete",request:b,response:T}]}function sb(e,t,r,n,o,i){return new st(DB(e,t,r,n,o,i))}async function DB(e,t,r,n,o,i){var s,l,a;let u={id:t,body:r,api_version:n,update_mask:o},f=Dr("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=qr({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,T=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!T.ok)return[T,{status:"request-error",request:R}];let w=T.value,[C]=await ft($e("4XX"),$e("5XX"),_t("default"))(w,R);if(!C.ok)return[C,{status:"complete",request:R,response:w}];return[C,{status:"complete",request:R,response:w}]}var qB=class extends un{list(e,t){return ct(ib(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(rb(this,n,r,t))}delete(e,t,r){return ct(nb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(ob(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let{api_version:n,update_mask:o}=t,i=$t(t,["api_version","update_mask"]);return ct(sb(this,e,i,n,o,r))}};function ab(e,t,r,n){return new st(xB(e,t,r,n))}async function xB(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=Dr("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:(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]=await ft($e("4XX"),$e("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function lb(e,t,r,n){return new st(LB(e,t,r,n))}async function LB(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:(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]=await ft($e("4XX"),$e("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 cb(e,t,r,n){return new st(UB(e,t,r,n))}async function UB(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:(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]=await ft($e("4XX"),$e("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,o){return new st(FB(e,t,r,n,o))}async function FB(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=qr({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 T=R.value,[w]=await ft($e("4XX"),$e("5XX"),_t("default"))(T,b);if(!w.ok)return[w,{status:"complete",request:b,response:T}];return[w,{status:"complete",request:b,response:T}]}function db(e,t,r,n,o,i,s,l){return new st(GB(e,t,r,n,o,i,s,l))}async function GB(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=qr({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"]},T=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(!T.ok)return[T,{status:"invalid"}];let w=T.value,C=await e._do(w,{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:w}];let A=C.value,[P]=await ft(_t(200),$e("4XX"),$e("5XX"))(A,w);if(!P.ok)return[P,{status:"complete",request:w,response:A}];return[P,{status:"complete",request:w,response:A}]}var BB=class extends un{list(e,t,r,n){return ct(db(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 fb(e,t,r,n,o,i,s,l,a,c,u){return new st(HB(e,t,r,n,o,i,s,l,a,c,u))}async function HB(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=qr({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"})})),T=await ht(e._options.security),w=pt(T),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:w,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:w,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(XE(200,{hdrs:!0}),$e("4XX"),$e("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 VB=class extends un{startUpload(e,t,r,n){return ct(fb(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))}},zB=class extends un{get internal(){var e;return(e=this._internal)!==null&&e!==void 0?e:this._internal=new VB(this._options)}get files(){var e;return(e=this._files)!==null&&e!==void 0?e:this._files=new BB(this._options)}listEnvironments(e,t){return ct(ub(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(ab(this,e,t,r))}deleteEnvironment(e,t,r){return ct(lb(this,e,t===null||t===void 0?void 0:t.api_version,r))}getEnvironment(e,t,r){return ct(cb(this,e,t===null||t===void 0?void 0:t.api_version,r))}},jB=class extends cn{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"}},WB=class extends cn{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"}},JB=class extends cn{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"}},KB=class extends cn{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"}},XB=class extends cn{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"}},YB=class extends cn{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"}},ZB=class extends cn{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"}},QB=class extends cn{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 pb(e,t,r,n){return new st(eH(e,t,r,n))}async function eH(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:(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={httpMeta:{response:b,request:S}},[T]=await ft(_t(200),uo("4XX",WB),uo("5XX",jB))(b,S,{extraFields:R});if(!T.ok)return[T,{status:"complete",request:S,response:b}];return[T,{status:"complete",request:S,response:b}]}function hb(e,t,r,n){return new st(tH(e,t,r,n))}async function tH(e,t,r,n){var o,i,s,l;let a={body:t,api_version:r},c=a,u=Dr("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,T={httpMeta:{response:R,request:E}},[w]=await ft(_t(200),KE(200,{sentinel:"[DONE]",flattened:!0}),uo("4XX",KB),uo("5XX",JB))(R,E,{extraFields:T});if(!w.ok)return[w,{status:"complete",request:E,response:R}];return[w,{status:"complete",request:E,response:R}]}function rH(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"}),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:(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={httpMeta:{response:b,request:S}},[T]=await ft(XE(200),uo("4XX",YB),uo("5XX",XB))(b,S,{extraFields:R});if(!T.ok)return[T,{status:"complete",request:S,response:b}];return[T,{status:"complete",request:S,response:b}]}function mb(e,t,r,n,o,i,s){return new st(oH(e,t,r,n,o,i,s))}async function oH(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),_=qr({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 T=R.value,w=await e._do(T,{context:b,isErrorStatusCode:(D)=>ot({status:D},["4XX","5XX"]),retryConfig:b.retry_config,retryCodes:b.retry_codes});if(!w.ok)return[w,{status:"request-error",request:T}];let C=w.value,A={httpMeta:{response:C,request:T}},[P]=await ft(_t(200),KE(200,{sentinel:"[DONE]",flattened:!0}),uo("4XX",QB),uo("5XX",ZB))(C,T,{extraFields:A});if(!P.ok)return[P,{status:"complete",request:T,response:C}];return[P,{status:"complete",request:T,response:C}]}var iH=class extends un{create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(hb(this,n,r,t))}delete(e,t,r){return ct(rH(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(mb(this,e,t===null||t===void 0?void 0:t.api_version,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(pb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function gb(e,t,r,n){return new st(sH(e,t,r,n))}async function sH(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=Dr("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:(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]=await ft($e("4XX"),$e("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){return new st(aH(e,t,r,n))}async function aH(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:(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]=await ft($e("4XX"),$e("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 _b(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}/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:(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]=await ft($e("4XX"),$e("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function yb(e,t,r,n,o,i){return new st(cH(e,t,r,n,o,i))}async function cH(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=qr({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,T=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!T.ok)return[T,{status:"request-error",request:R}];let w=T.value,[C]=await ft($e("4XX"),$e("5XX"),_t("default"))(w,R);if(!C.ok)return[C,{status:"complete",request:R,response:w}];return[C,{status:"complete",request:R,response:w}]}function Sb(e,t,r,n,o,i){return new st(uH(e,t,r,n,o,i))}async function uH(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=qr({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,T=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!T.ok)return[T,{status:"request-error",request:R}];let w=T.value,[C]=await ft($e("4XX"),$e("5XX"),_t("default"))(w,R);if(!C.ok)return[C,{status:"complete",request:R,response:w}];return[C,{status:"complete",request:R,response:w}]}function Eb(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={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:(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]=await ft($e("4XX"),$e("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,o){return new st(fH(e,t,r,n,o))}async function fH(e,t,r,n,o){var i,s,l;let c={id:t,body:r,api_version:n},u=Dr("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:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,[T]=await ft($e("4XX"),$e("5XX"),_t("default"))(R,E);if(!T.ok)return[T,{status:"complete",request:E,response:R}];return[T,{status:"complete",request:E,response:R}]}var pH=class extends un{list(e,t){return ct(Sb(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.filter,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(gb(this,n,r,t))}delete(e,t,r){return ct(vb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(_b(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let{api_version:n}=t,o=$t(t,["api_version"]);return ct(bb(this,e,o,n,r))}listExecutions(e,t,r){return ct(yb(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(Eb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function Tb(e,t,r,n){return new st(hH(e,t,r,n))}async function hH(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=Dr("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:(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]=await ft($e("4XX"),$e("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(mH(e,t,r,n))}async function mH(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:(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]=await ft($e("4XX"),$e("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 Cb(e,t,r,n){return new st(gH(e,t,r,n))}async function gH(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:(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]=await ft($e("4XX"),$e("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 Rb(e,t,r,n,o,i,s,l,a,c,u,f,h,g){return new st(vH(e,t,r,n,o,i,s,l,a,c,u,f,h,g))}async function vH(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"})},T=it("/{api_version}/voices")(R),w=qr({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:T,headers:C,query:w,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($e("4XX"),$e("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 _H=class extends un{list(e,t){return ct(Rb(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(Tb(this,e,t,r))}delete(e,t,r){return ct(wb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Cb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function Ab(e,t,r,n){return new st(yH(e,t,r,n))}async function yH(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=Dr("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:(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]=await ft($e("4XX"),$e("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 Ib(e,t,r,n){return new st(SH(e,t,r,n))}async function SH(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:(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]=await ft($e("4XX"),$e("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 Pb(e,t,r,n){return new st(EH(e,t,r,n))}async function EH(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:(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]=await ft($e("4XX"),$e("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(bH(e,t,r,n,o))}async function bH(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=qr({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 T=R.value,[w]=await ft($e("4XX"),$e("5XX"),_t("default"))(T,b);if(!w.ok)return[w,{status:"complete",request:b,response:T}];return[w,{status:"complete",request:b,response:T}]}function Nb(e,t,r,n,o){return new st(TH(e,t,r,n,o))}async function TH(e,t,r,n,o){var i,s,l;let c={id:t,api_version:r,body:n},u=Dr("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:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,[T]=await ft($e("4XX"),$e("5XX"),_t("default"))(R,E);if(!T.ok)return[T,{status:"complete",request:E,response:R}];return[T,{status:"complete",request:E,response:R}]}function Ob(e,t,r,n,o){return new st(wH(e,t,r,n,o))}async function wH(e,t,r,n,o){var i,s,l;let c={id:t,api_version:r,body:n},u=Dr("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:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,[T]=await ft($e("4XX"),$e("5XX"),_t("default"))(R,E);if(!T.ok)return[T,{status:"complete",request:E,response:R}];return[T,{status:"complete",request:E,response:R}]}function Mb(e,t,r,n,o,i){return new st(CH(e,t,r,n,o,i))}async function CH(e,t,r,n,o,i){var s,l,a;let u={id:t,api_version:r,update_mask:n,body:o},f=Dr("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=qr({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,T=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!T.ok)return[T,{status:"request-error",request:R}];let w=T.value,[C]=await ft($e("4XX"),$e("5XX"),_t("default"))(w,R);if(!C.ok)return[C,{status:"complete",request:R,response:w}];return[C,{status:"complete",request:R,response:w}]}var RH=class extends un{list(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))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(Ab(this,n,r,t))}delete(e,t,r){return ct(Ib(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Pb(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let n=t!==null&&t!==void 0?t:{},{api_version:o,update_mask:i}=n,s=$t(n,["api_version","update_mask"]),l=t===void 0||Object.keys(s).length===0?void 0:s;return ct(Mb(this,e,o,i,l,r))}ping(e,t,r,n){return ct(Nb(this,e,t,r,n))}rotateSigningSecret(e,t,r,n){return ct(Ob(this,e,t,r,n))}},AH=class e extends un{get environments(){var t;return(t=this._environments)!==null&&t!==void 0?t:this._environments=new zB(this._options)}get agents(){var t;return(t=this._agents)!==null&&t!==void 0?t:this._agents=new kB(this._options)}get credentials(){var t;return(t=this._credentials)!==null&&t!==void 0?t:this._credentials=new qB(this._options)}get interactions(){var t;return(t=this._interactions)!==null&&t!==void 0?t:this._interactions=new iH(this._options)}get triggers(){var t;return(t=this._triggers)!==null&&t!==void 0?t:this._triggers=new pH(this._options)}get voices(){var t;return(t=this._voices)!==null&&t!==void 0?t:this._voices=new _H(this._options)}get webhooks(){var t;return(t=this._webhooks)!==null&&t!==void 0?t:this._webhooks=new RH(this._options)}},IH=new Set(["lyria-3-pro-preview","lyria-3-clip-preview"]);function PH(e){let t=e.getBaseUrl();if(!t)throw Error("Base URL must be set.");return t.replace(/\/+$/,"")}function kH(e){let t=DH(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 mr(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 DE({fetcher:c}):void 0;return new AH(Object.assign(Object.assign({},t),{http_client:u,api_version:(o=t.api_version)!==null&&o!==void 0?o:kH(e),security:(i=t.security)!==null&&i!==void 0?i:new _G({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:PH(e)}))}var NH=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);if(n.stream===!0){let i=await Ic(()=>this.getClient(r).interactions.create(Object.assign(Object.assign({},n),{stream:!0,api_version:r}),nt(t,!0)));return sg(i)}let o=await vt(hb(this.getClient(r),n,r,nt(t)));return Pc(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 Ic(()=>this.getClient(n).interactions.get(e,{stream:o,last_event_id:i,include_input:s,api_version:n},nt(r,!0)));return sg(a)}let l=await vt(mb(this.getClient(n),e,n,s,i,o,nt(r)));return Pc(l)}async delete(e,t={},r){return Ic(()=>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 Pc(await vt(pb(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 mr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}},OH=class{constructor(e){this.parentClient=e}async create(e={},t){let r=e!==null&&e!==void 0?e:{},{api_version:n}=r,o=$t(r,["api_version"]);return vt(ZE(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(tb(this.getClient(r),r,n,o,i,nt(t)))}async get(e,t={},r){return vt(eb(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(QE(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 mr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}},MH=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(Ab(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(kb(this.getClient(),r,n,o,nt(t)))}async get(e,t={},r){return vt(Pb(this.getClient(),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async update(e,t={},r){let n=t!==null&&t!==void 0?t:{},{api_version:o,update_mask:i}=n,s=$t(n,["api_version","update_mask"]);return vt(Mb(this.getClient(),e,o,i,s,nt(r)))}async delete(e,t={},r){return vt(Ib(this.getClient(),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async rotateSigningSecret(e,t={},r){let n=t!==null&&t!==void 0?t:{},{api_version:o}=n,i=$t(n,["api_version"]);return vt(Ob(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(Nb(this.getClient(),e,n,o,nt(r)))}getClient(){var e;return(e=this.sdk)!==null&&e!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}},$H=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(gb(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(Sb(this.getClient(r),r,n,o,i,nt(t)))}async get(e,t={},r){return vt(_b(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async update(e,t,r){let{api_version:n}=t,o=$t(t,["api_version"]);return vt(bb(this.getClient(n),e,o,n,nt(r)))}async delete(e,t={},r){return vt(vb(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(Eb(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(yb(this.getClient(n),e,n,o,i,nt(r)))}getClient(e){var t;if(e)return mr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}};function DH(e){return e.replace(/^\/+|\/+$/g,"")}function nt(e,t=!1){var r,n,o,i;if(!e&&!t)return;let s=e!==null&&e!==void 0?e:{},{timeout:l,maxRetries:a,defaultBaseURL:c,query:u,body:f,fetchOptions:h}=s,g=$t(s,["timeout","maxRetries","defaultBaseURL","query","body","fetchOptions"]),p=Object.assign({},g);if(il(u))p.extra_query=u;else ig("query",u);if(il(f))p.extra_body=f;else ig("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 ig(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 Ao(t.error);return qH(t.value,r)}async function Ic(e){try{return await e()}catch(t){throw Ao(t)}}function sg(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 Ao(l)}},async return(s){if(!i.return)return{done:!0,value:s};try{return await i.return(s)}catch(l){throw Ao(l)}},async throw(s){if(!i.throw)throw Ao(s);try{return await i.throw(s)}catch(l){throw Ao(l)}},[Symbol.asyncIterator](){return this}}}}})}function qH(e,t){if(!il(e)||t.status!=="complete")return e;return Object.assign(Object.assign({},e),{sdkHttpResponse:xH(t.response,e)})}function xH(e,t){let r={};for(let[n,o]of e.headers.entries())r[n]=o;return{headers:r,responseInternal:e,json:async()=>t}}function Pc(e){let t=LH(e);if(!t)return e;return FH(t)}function LH(e){if(!il(e))return;if(Array.isArray(e.steps))return e;if(UH(e)){let t=e.outputs;if(Array.isArray(t)){let{outputs:r}=e,n=$t(e,["outputs"]);return Object.assign(Object.assign({},n),{steps:[{type:"model_output",content:t}]})}}return Object.assign(Object.assign({},e),{steps:[]})}function UH(e){let t=e.model;return typeof t==="string"&&IH.has(t)}function il(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function FH(e){var t,r;let n=GH(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 GH(e){return Object.assign(Object.assign({},e),{created:ag(e.created),updated:ag(e.updated)})}function ag(e){return e instanceof Date?e.toISOString():e}function BH(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 HH=class{constructor(e,t){this.resolveClient=e,this.parentClient=t}async list(e,t){return vt(db(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(!_)_=BH(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 fb(this.resolveClient(e.api_version),y,f,"start",p,_,"resumable",e.api_version,e.extract,e.overwrite,nt(t)).$inspect();if(!S.ok)throw Ao(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,T=0,w,C=g instanceof Blob?g:new Blob([g]);while(T<p||p===0&&T===0){let P=Math.min(T+R,p),D=C.slice(T,P),N=P>=p,F=N?"upload, finalize":"upload";if(w=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":`${T}`})})}),T=P,N)break}let A;if(w&&typeof w.json==="function")A=await w.json();else if(w&&w.responseInternal&&typeof w.responseInternal.json==="function")A=await w.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}},VH=class{constructor(e){this.parentClient=e,this.files=new HH((t)=>this.getClient(t),this.parentClient)}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(ab(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(ub(this.getClient(r),r,n,o,nt(t)))}async get(e,t={},r){return vt(cb(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(lb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}getClient(e){var t;if(e)return mr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}},zH=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(rb(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(ib(this.getClient(r),r,n,o,nt(t)))}async get(e,t={},r){return vt(ob(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async update(e,t,r){let{api_version:n,update_mask:o}=t,i=$t(t,["api_version","update_mask"]);return vt(sb(this.getClient(n),e,i,n,o,nt(r)))}async delete(e,t={},r){return vt(nb(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 mr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}},jH=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(Tb(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(Rb(this.getClient(r),r,n,o,i,s,l,a,c,u,f,h,g,nt(t)))}async get(e,t={},r){return vt(Cb(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 mr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=mr(this.parentClient)),this.sdk}},lg="x-goog-api-key",ms="https://www.googleapis.com/auth/cloud-platform",WH=class{constructor(e){if(e.apiKey!==void 0){this.apiKey=e.apiKey;return}let t=JH(e.googleAuthOptions);this.googleAuth=new zD.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(lg)!==null)return;if(this.apiKey===void 0)throw Error("Trying to set API key header but apiKey is not set");e.append(lg,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 JH(e){let t;if(!e)return t={scopes:[ms]},t;else{if(t=e,!t.scopes)return t.scopes=[ms],t;else if(typeof t.scopes==="string"&&t.scopes!==ms||Array.isArray(t.scopes)&&t.scopes.indexOf(ms)<0)throw Error(`Invalid auth scopes. Scopes must include: ${ms}`);return t}}var KH=class{async download(e,t){if(e.downloadPath){let r=await XH(e,t);if(r instanceof Mi){let n=jD(e.downloadPath);JD.fromWeb(r.responseInternal.body).pipe(n),await KD(n)}else try{await WD(e.downloadPath,r,{encoding:"base64"})}catch(n){throw Error(`Failed to write file to ${e.downloadPath}: ${n}`)}}}};async function XH(e,t){var r,n,o;let i=xd(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(aE(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(lE(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 YH=class{create(e,t,r){return new ZH(e,t,r)}},ZH=class{constructor(e,t,r){this.url=e,this.headers=t,this.callbacks=r}connect(){this.ws=new XD.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 QH(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function eV(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function tV(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function rV(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function nV(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)=>vV(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function oV(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 iV(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"],Ia(B))}else if(o==="PREFERENCE_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec"],Ia(B))}else if(o==="DISTILLATION"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["distillationSpec"],Ia(B))}else if(o==="REINFORCEMENT_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec"],Ia(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 T=d(e,["rewardConfig"]);if(t!==void 0&&T!=null)m(t,["reinforcementTuningSpec","singleRewardConfig"],T);let w=d(e,["compositeRewardConfig"]);if(t!==void 0&&w!=null)m(t,["reinforcementTuningSpec","compositeRewardConfig"],w);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 sV(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)EV(i);let s=d(e,["config"]);if(s!=null)oV(s,r);return r}function aV(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)bV(i,r,t);let s=d(e,["config"]);if(s!=null)iV(s,r,t);return r}function $b(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"],uV(a));return r}function lV(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"],$b(l));return r}function cV(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"],$b(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 uV(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"],ji(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 T=d(e,["speechConfig"]);if(T!=null)m(r,["speechConfig"],T);let w=d(e,["stopSequences"]);if(w!=null)m(r,["stopSequences"],w);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 dV(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function fV(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function pV(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 hV(e,t){let r={},n=d(e,["config"]);if(n!=null)pV(n,r);return r}function mV(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)=>au(l));m(r,["tuningJobs"],s)}return r}function gV(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 vV(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 _V(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)=>yV(a));m(r,["tools"],l)}return r}function yV(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)=>gV(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"],nV(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 SV(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 EV(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 bV(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 TV(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"],sE(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"],SV(h));return r}function au(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"],sE(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"],lV(S));let E=d(e,["distillationSpec"]);if(E!=null)m(r,["distillationSpec"],cV(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 T=d(e,["encryptionSpec"]);if(T!=null)m(r,["encryptionSpec"],T);let w=d(e,["partnerModelTuningSpec"]);if(w!=null)m(r,["partnerModelTuningSpec"],w);let C=d(e,["customBaseModel"]);if(C!=null)m(r,["customBaseModel"],C);let A=d(e,["evaluateDatasetRuns"]);if(A!=null){let ne=A;if(Array.isArray(ne))ne=ne.map((he)=>he);m(r,["evaluateDatasetRuns"],ne)}let P=d(e,["experiment"]);if(P!=null)m(r,["experiment"],P);let D=d(e,["fullFineTuningSpec"]);if(D!=null)m(r,["fullFineTuningSpec"],D);let N=d(e,["labels"]);if(N!=null)m(r,["labels"],N);let F=d(e,["outputUri"]);if(F!=null)m(r,["outputUri"],F);let G=d(e,["pipelineJob"]);if(G!=null)m(r,["pipelineJob"],G);let B=d(e,["serviceAccount"]);if(B!=null)m(r,["serviceAccount"],B);let Q=d(e,["tunedModelDisplayName"]);if(Q!=null)m(r,["tunedModelDisplayName"],Q);let pe=d(e,["tuningJobMetadata"]);if(pe!=null)m(r,["tuningJobMetadata"],pe);let se=d(e,["tuningJobState"]);if(se!=null)m(r,["tuningJobState"],se);let ve=d(e,["veoLoraTuningSpec"]);if(ve!=null)m(r,["veoLoraTuningSpec"],ve);let me=d(e,["veoTuningSpec"]);if(me!=null)m(r,["veoTuningSpec"],me);let j=d(e,["gcsMetricsUri"]);if(j!=null)m(r,["gcsMetricsUri"],j);return r}function wV(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 Ia(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 CV(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"],_V(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 RV(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 AV=class extends Dn{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new Ho(On.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:Zc.JOB_STATE_QUEUED}}}}async getInternal(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=fV(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)=>au(c))}else{let a=dV(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)=>TV(c))}}async listInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=hV(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=mV(l),c=new b1;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=eV(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=rV(c),f=new wm;return Object.assign(f,u),f})}else{let a=QH(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=tV(c),f=new wm;return Object.assign(f,u),f})}}async tuneInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=aV(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)=>au(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=sV(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)=>wV(l))}}async validateReward(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=CV(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=RV(l),c=new T1;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).")}},Db=8388608,qb=3,xb=1000,Lb=2,so="x-goog-upload-status";async function IV(e,t,r,n){var o;let i=await Ub(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[so])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return s.file}async function PV(e,t,r,n){var o;let i=await Ub(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[so])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let l=Od(s),a=new eE;return Object.assign(a,l),a}async function Ub(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 Mi(new Response),h="upload";c=e.size;while(u<c){let g=Math.min(Db,c-u),p=e.slice(u,u+g);if(u+g>=c)h+=", finalize";let _=0,y=xb;while(_<qb){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[so])break;_++,await Fb(y),y=y*Lb}if(u+=g,((s=f===null||f===void 0?void 0:f.headers)===null||s===void 0?void 0:s[so])!=="active")break;if(c<=u)throw Error("All content has been uploaded, but the upload status is not finalized.")}return f}async function kV(e){return{size:e.size,type:e.type}}function Fb(e){return new Promise((t)=>setTimeout(t,e))}var NV=class{async stat(e){let t={size:0,type:void 0};if(typeof e==="string"){let r=await Ll.stat(e);return t.size=r.size,t.type=this.inferMimeType(e),t}else return await kV(e)}async upload(e,t,r,n){if(typeof e==="string")return await this.uploadFileFromPath(e,t,r,n);else return IV(e,t,r,n)}async uploadToFileSearchStore(e,t,r,n){if(typeof e==="string")return await this.uploadFileToFileSearchStoreFromPath(e,t,r,n);else return PV(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[so])!=="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[so])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let l=Od(s),a=new eE;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 Mi(new Response),h="upload",g,p=QS.basename(e);try{if(g=await Ll.open(e,"r"),!g)throw Error("Failed to open file");c=(await g.stat()).size;while(u<c){let _=Math.min(Db,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=xb;while(b<qb){let T=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:T})}),(i=f===null||f===void 0?void 0:f.headers)===null||i===void 0?void 0:i[so])break;b++,await Fb(R),R=R*Lb}if(u+=S,((s=f===null||f===void 0?void 0:f.headers)===null||s===void 0?void 0:s[so])!=="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()}}},OV=class extends Px{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})})})}},MV="gl-node/";function $V(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=ao("GOOGLE_GENAI_USE_ENTERPRISE"),n=ao("GOOGLE_GENAI_USE_VERTEXAI"),o=cg(r),i=cg(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 DV=class{getNextGenClient(){let e=this.httpOptions;if(this._nextGenClient===void 0)this._nextGenClient=mr(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 NH(this.apiClient),this._interactions}get webhooks(){if(this._webhooks!==void 0)return this._webhooks;return this._webhooks=new MH(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 OH(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 $H(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 VH(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 zH(this.apiClient),this._credentials}get voices(){if(this._voices!==void 0)return this._voices;return this._voices=new jH(this.apiClient),this._voices}constructor(e={}){var t,r,n,o;if(this.vertexai=$V(e),(e.project||e.location)&&!this.vertexai)throw Error("Project and location are not supported for Gemini API backend.");let i=qV(),s=ao("GOOGLE_CLOUD_PROJECT"),l=ao("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=e1(e.httpOptions,this.vertexai,ao("GOOGLE_VERTEX_BASE_URL"),ao("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 WH({apiKey:this.apiKey,googleAuthOptions:e.googleAuthOptions});this.apiClient=new CF({auth:c,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:MV+process.version,uploader:new NV,downloader:new KH}),this.models=new Gl(this.apiClient),this.live=new UF(this.apiClient,c,new YH),this.batches=new $q(this.apiClient),this.chats=new vx(this.models,this.apiClient),this.caches=new hx(this.apiClient),this.files=new OV(this.apiClient),this.operations=new zF(this.apiClient),this.authTokens=new aG(this.apiClient),this.tunings=new AV(this.apiClient),this.fileSearchStores=new mG(this.apiClient)}};function ao(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 cg(e){if(e===void 0)return!1;return e.toLowerCase()==="true"}function qV(){let e=ao("GOOGLE_API_KEY"),t=ao("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 xV="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 LV(e=process.env){let t;return()=>{let r=UV(e);if(!r)throw Error(xV);return t??=new DV({apiKey:r}),t}}function UV(e){let t=e.SF_GEMINI_API_KEY?.trim();if(t&&!t.startsWith("${"))return t;return e.GEMINI_API_KEY?.trim()||void 0}function FV(e,t,r=process.env){return r[e]?.trim()||t}function GV(e){let t=e.SF_VIDEO_QUALITY?.trim().toLowerCase();return t==="low"||t==="high"?t:"medium"}var BV={low:"720p",medium:"720p",high:"1080p"};function HV(e){return{content:[{type:"text",text:JSON.stringify(e,null,2)}],structuredContent:e}}function VV(e){return{content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}async function kc(e){try{return HV(await e())}catch(t){return VV(t)}}var fe=(e)=>e,lz=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}),cz=fe({program:"cloudflared",subcommands:["tunnel"],flags:{"--no-autoupdate":"bool"},endOfOptions:!1,overridable:!0}),e4="io.bringes.superfactory.agent",uz=`designated => identifier "${e4}"`,dz=fe({program:"codesign",subcommands:[],flags:{"--force":"bool","--sign":"value","--identifier":"value","--requirements":"value"},endOfOptions:!1}),fz=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}),pz=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}),hz=fe({program:"codesign",subcommands:[],flags:{"--force":"bool","--options":"value","--timestamp":"bool","--entitlements":"value","--sign":"value","--verify":"bool","--deep":"bool","--strict":"bool"},endOfOptions:!1}),mz=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"]}),gz=fe({program:"spctl",subcommands:[],flags:{"-a":"bool","-vv":"bool","-t":"separate","--context":"separate"},endOfOptions:!1}),vz=fe({program:"ditto",subcommands:[],flags:{"-c":"bool","-k":"bool","--keepParent":"bool"},endOfOptions:!1}),_z=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}),yz=fe({program:"tar",subcommands:[],flags:{"-czf":"separate","-C":"separate"},endOfOptions:!1,inheritEnv:["COPYFILE_DISABLE"]}),Sz=fe({program:"lsregister",subcommands:[],flags:{"-dump":"bool","-u":"separate","-f":"bool"},endOfOptions:!1,overridable:!0}),Ez=fe({program:"findmnt",subcommands:[],flags:{"-n":"bool","-b":"bool","-o":"separate"},endOfOptions:!1}),bz=fe({program:"lsblk",subcommands:[],flags:{"-n":"bool","-b":"bool","-d":"bool","-o":"separate"},endOfOptions:!1}),Tz=fe({program:"growpart",subcommands:[],flags:{},endOfOptions:!1}),wz=fe({program:"resize2fs",subcommands:[],flags:{},endOfOptions:!1}),Cz=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}),Rz=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"]}),Az=fe({program:"ffprobe",subcommands:[],flags:{"-v":"separate","-select_streams":"separate","-show_entries":"separate","-of":"separate"},endOfOptions:!1}),Fd={GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",GIT_ASKPASS:"false",SSH_ASKPASS:"false",SSH_ASKPASS_REQUIRE:"force"},Gb=["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"],Iz=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:Gb,env:Fd}),Pz=fe({program:"pre-push",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),kz=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:Gb,env:Fd,overridable:!0});var Nz=fe({program:"caffeinate",subcommands:[],flags:{"-i":"bool","-s":"bool","-w":"separate"},endOfOptions:!1}),Oz=fe({program:"pmset",subcommands:["displaysleepnow"],flags:{},endOfOptions:!1}),Mz=fe({program:"ioreg",subcommands:[],flags:{"-r":"bool","-c":"separate","-k":"separate","-d":"separate"},endOfOptions:!1}),Hl=(e)=>fe({program:e,subcommands:["run"],flags:{},endOfOptions:!0}),$z=Hl("pnpm"),Dz=Hl("npm"),qz=Hl("yarn"),xz=Hl("bun"),Lz=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}),Uz=fe({program:"security",subcommands:["add-trusted-cert"],flags:{"-r":"separate","-p":"separate","-k":"separate"},endOfOptions:!1,overridable:!0}),Fz=fe({program:"ping",subcommands:[],flags:{"-c":"separate","-t":"separate","-W":"separate"},endOfOptions:!1}),Vl=["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"],Gz=fe({program:"bun",subcommands:["install"],flags:{"--frozen-lockfile":"bool"},endOfOptions:!1,inheritEnv:Vl}),Bz=fe({program:"pnpm",subcommands:["install"],flags:{"--frozen-lockfile":"bool","--prefer-offline":"bool"},endOfOptions:!1,inheritEnv:Vl}),Hz=fe({program:"yarn",subcommands:["install"],flags:{"--frozen-lockfile":"bool","--prefer-offline":"bool","--immutable":"bool"},endOfOptions:!1,inheritEnv:Vl}),Vz=fe({program:"npm",subcommands:["ci","install"],flags:{"--prefer-offline":"bool","--no-audit":"bool","--no-fund":"bool"},endOfOptions:!1,inheritEnv:Vl}),zz=fe({program:"bun",subcommands:[],flags:{"--version":"bool"},endOfOptions:!1,overridable:!0}),jz=fe({program:"colima",subcommands:["start"],flags:{"--version":"bool"},endOfOptions:!1}),Wz=fe({program:"brew",subcommands:["install","uninstall","upgrade"],flags:{"--version":"bool","--cask":"bool","--formula":"bool"},endOfOptions:!0,inheritEnv:["HOMEBREW_*"],overridable:!0}),Jz=fe({program:"sudo",subcommands:[],flags:{"-n":"bool","-u":"separate"},endOfOptions:!0,wraps:!0}),Kz=fe({program:"superfactory-root",overridable:!0,subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),Xz=fe({program:"apt-get",subcommands:["install","update","remove"],flags:{"-y":"bool","-q":"bool","--no-install-recommends":"bool","-o":"separate"},endOfOptions:!0}),Yz=fe({program:"env",subcommands:[],flags:{"-i":"bool","--chdir":"value"},endOfOptions:!1,wraps:!0}),Zz=fe({program:"rustup-init",subcommands:[],flags:{"-y":"bool","--no-modify-path":"bool","--profile":"value","--default-toolchain":"value"},endOfOptions:!0,overridable:!0}),Qz=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"]}),e2=fe({program:"ln",subcommands:[],flags:{"-s":"bool","-f":"bool","-n":"bool"},endOfOptions:!0}),t2=fe({program:"mv",subcommands:[],flags:{"-f":"bool","-T":"bool"},endOfOptions:!0}),r2=fe({program:"rm",subcommands:[],flags:{"-r":"bool","-f":"bool"},endOfOptions:!0}),n2=fe({program:"kill",subcommands:[],flags:{"-s":"separate"},endOfOptions:!0}),o2=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"]}),i2=fe({program:"open",subcommands:[],flags:{"-a":"separate"},endOfOptions:!1,overridable:!0}),s2=fe({program:"xdg-open",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),a2=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}),l2=fe({program:"expo",subcommands:["start"],flags:{"--localhost":"bool","--port":"value"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),c2=fe({program:"bun",subcommands:[],flags:{"--smol":"bool"},endOfOptions:!1,inheritEnv:["SF_*","DATABASE_URL"],overridable:!0}),u2=fe({program:"superfactory-agent",subcommands:["run","agent run","session-host","agent session-host"],flags:{"--version":"bool"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),d2=fe({program:"superfactory",subcommands:["finish-setup"],flags:{},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),f2=fe({program:"cat",subcommands:[],flags:{},endOfOptions:!0}),p2=fe({program:"sleep",subcommands:[],flags:{},endOfOptions:!1}),h2=fe({program:"setpriv",subcommands:[],flags:{"--no-new-privs":"bool"},endOfOptions:!1,wraps:!0}),m2=fe({program:"true",subcommands:[],flags:{},endOfOptions:!1}),g2=fe({program:"system_profiler",subcommands:[],flags:{"-json":"bool"},endOfOptions:!1}),v2=fe({program:"sysctl",subcommands:[],flags:{"-n":"bool"},endOfOptions:!1}),_2=fe({program:"vm_stat",subcommands:[],flags:{},endOfOptions:!1}),y2=fe({program:"systemd-detect-virt",subcommands:[],flags:{"--vm":"bool"},endOfOptions:!1}),S2=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),E2=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1,inheritEnv:["SF_LISTEN_PORT"]}),b2=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),T2=fe({program:"ipcrm",subcommands:[],flags:{"-m":"separate"},endOfOptions:!1}),w2=fe({program:"ipcs",subcommands:[],flags:{"-m":"bool","-p":"bool","-a":"bool"},endOfOptions:!1}),C2=fe({program:"ps",subcommands:[],flags:{"-axww":"bool","-o":"separate","-p":"separate","-E":"bool"},endOfOptions:!1}),R2=fe({program:"log",subcommands:["show"],flags:{"--style":"separate","--predicate":"separate","--start":"separate","--end":"separate"},endOfOptions:!1}),A2=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}),I2=fe({program:"curl",subcommands:[],flags:{"-s":"bool","-X":"separate","-H":"separate","-d":"separate"},endOfOptions:!1}),P2=fe({program:"networksetup",subcommands:[],flags:{"-listallhardwareports":"bool"},endOfOptions:!1}),k2=fe({program:"scutil",subcommands:[],flags:{"--get":"separate"},endOfOptions:!1}),N2=fe({program:"yq",subcommands:[],flags:{"-i":"bool"},endOfOptions:!1,overridable:!0}),O2=fe({program:"install",subcommands:[],flags:{"-D":"bool","-m":"separate"},endOfOptions:!0}),M2=fe({program:"unshare",subcommands:[],flags:{"--mount":"bool","--pid":"bool","--fork":"bool","--mount-proc":"bool","--propagation":"value"},endOfOptions:!1,wraps:!0}),$2=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),D2=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),q2=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),x2=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),L2=fe({program:"chmod",subcommands:[],flags:{"-R":"bool","+a":"separate","-a":"separate"},endOfOptions:!0}),U2=fe({program:"setfacl",subcommands:[],flags:{"-R":"bool","-P":"bool","-d":"bool","-m":"separate","-x":"separate"},endOfOptions:!0}),F2=fe({program:"pgrep",subcommands:[],flags:{"-U":"separate","-x":"bool"},endOfOptions:!1}),G2=fe({program:"afplay",subcommands:[],flags:{"-v":"separate"},endOfOptions:!1}),B2=fe({program:"usermod",subcommands:[],flags:{"--append":"bool","--groups":"value"},endOfOptions:!0}),H2=fe({program:"useradd",subcommands:[],flags:{"--system":"bool","--user-group":"bool","--no-create-home":"bool","--home-dir":"value","--shell":"value"},endOfOptions:!0}),V2=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),z2=fe({program:"osascript",subcommands:[],flags:{"-l":"separate","-e":"script"},endOfOptions:!1}),Gd={inheritEnv:["*"],excludeEnv:["SUPERFACTORY_*","SF_*"],env:Fd,overridable:!0},j2=fe({program:"bash",subcommands:[],flags:{"-l":"bool","-c":"script"},endOfOptions:!1,...Gd}),W2=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-ExecutionPolicy":"value","-Command":"script"},endOfOptions:!1,...Gd}),J2=fe({program:"cmd",subcommands:[],flags:{"/d":"bool","/s":"bool","/c":"script"},endOfOptions:!1,...Gd}),K2=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}),X2=fe({program:"postgres",subcommands:[],flags:{"-D":"separate","-p":"separate","-c":"separate"},endOfOptions:!1,overridable:!0}),Y2=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}),Z2=fe({program:"gitleaks",subcommands:["git"],flags:{"--log-opts":"value","--no-banner":"bool","--redact":"bool","--exit-code":"value"},endOfOptions:!0}),Q2=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"]}),ej=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_*"]}),tj=fe({program:"sf-tunnel",subcommands:[],flags:{"--version":"bool"},endOfOptions:!1,overridable:!0}),rj=fe({program:"cargo",subcommands:["build","zigbuild"],flags:{"--release":"bool","--locked":"bool","--target":"separate"},endOfOptions:!1,inheritEnv:["PATH","HOME","CARGO_*","RUSTUP_*"],overridable:!0}),nj=fe({program:"rustup",subcommands:["target list"],flags:{"--installed":"bool"},endOfOptions:!1,inheritEnv:["PATH","HOME","CARGO_*","RUSTUP_*"],overridable:!0}),oj=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),ij=fe({program:"sh",subcommands:[],flags:{"-s":"bool"},endOfOptions:!1}),sj=fe({program:"sh",subcommands:[],flags:{"-l":"bool"},endOfOptions:!1,inheritEnv:["*"],excludeEnv:["SUPERFACTORY_*","SF_*"],overridable:!0}),aj=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,inheritEnv:["*"]}),lj=fe({program:"ssh",subcommands:[],flags:{"-F":"separate","-L":"separate","-N":"bool","-o":"separate","-p":"separate"},endOfOptions:!0}),cj=fe({program:"ssh",subcommands:[],flags:{"-F":"separate","-o":"separate","-p":"separate","-T":"bool"},endOfOptions:!0,inheritEnv:["SSH_AUTH_SOCK"]}),uj=fe({program:"ssh",subcommands:[],flags:{"-N":"bool","-T":"bool","-o":"separate","-p":"separate","-R":"separate"},endOfOptions:!0}),dj=fe({program:"scp",subcommands:[],flags:{"-B":"bool","-q":"bool","-r":"bool","-o":"separate","-P":"separate"},endOfOptions:!0}),fj=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}),pj=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}),hj=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-STA":"bool","-ExecutionPolicy":"separate","-WindowStyle":"separate","-File":"separate"},endOfOptions:!1}),mj=fe({program:"osascript",subcommands:[],flags:{"-l":"separate"},endOfOptions:!1}),gj=fe({program:"python3",subcommands:[],flags:{"-I":"bool"},endOfOptions:!1,inheritEnv:["DISPLAY","WAYLAND_DISPLAY","XAUTHORITY","DBUS_SESSION_BUS_ADDRESS","XDG_*"]}),vj=fe({program:"superfactory-tray",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),_j=fe({program:"explorer",subcommands:[],flags:{},endOfOptions:!1}),yj=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"]}),Bb=["XDG_RUNTIME_DIR","DBUS_SESSION_BUS_ADDRESS","USER","LOGNAME"],Sj=fe({program:"sh",subcommands:[],flags:{},endOfOptions:!1,inheritEnv:Bb}),Ej=fe({program:"systemd-run",subcommands:[],flags:{"--user":"bool","--collect":"bool","--quiet":"bool"},endOfOptions:!0,inheritEnv:Bb}),bj=fe({program:"systemd-run",subcommands:[],flags:{"--unit":"value","--collect":"bool","--quiet":"bool","--wait":"bool","--service-type":"value","--property":"value","--setenv":"value"},endOfOptions:!0}),Tj=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),wj=fe({program:"vncdo",subcommands:[],flags:{"-s":"separate"},endOfOptions:!1}),Cj=fe({program:"taskkill",subcommands:[],flags:{"/F":"bool","/PID":"separate","/T":"bool"},endOfOptions:!1}),Rj=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-ExecutionPolicy":"value","-Command":"script"},endOfOptions:!1,inheritEnv:["SF_SESSION_*"]}),Aj=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}),Ij=fe({program:"schtasks",subcommands:[],flags:{"/run":"bool","/tn":"separate"},endOfOptions:!1}),Pj=fe({program:"Xvfb",subcommands:[],flags:{"-displayfd":"separate","-screen":"separate","-nolisten":"separate","-auth":"separate"},endOfOptions:!1,overridable:!0}),kj=fe({program:"fluxbox",subcommands:[],flags:{"-display":"separate","-rc":"separate"},endOfOptions:!1,overridable:!0}),Nj=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}),Oj=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"]}),Mj=fe({program:"axe",subcommands:["describe-ui","tap","button"],flags:{"--udid":"separate","-x":"separate","-y":"separate"},endOfOptions:!1}),$j=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:["*"]}),Dj=fe({program:"swiftc",subcommands:[],flags:{"-Onone":"bool","-o":"separate"},endOfOptions:!1,inheritEnv:["DEVELOPER_DIR","TMPDIR"]}),qj=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"]}),t4=["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"],xj=process.platform==="win32",Lj=new Set(t4.filter((e)=>!/^[A-Za-z_]\w*$/.test(e)));var dg=new Set,r4,Uj=process.platform==="win32"&&globalThis.Bun?import(["bun","ffi"].join(":")).then((e)=>{r4=e},(e)=>n4(`bun:ffi isn't there (${e.message}): programs keep the agent's priority`)):Promise.resolve();function n4(e){if(dg.has(e))return;dg.add(e),console.warn(`priority: ${e}`)}var Fj=Promise.resolve(),o4={".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 i4(e){let t=o4[YV(e).toLowerCase()];if(!t)throw Error(`Unsupported file type: ${e}`);return t}async function s4(e){let t=QV(e);return await KV(XV(t),{recursive:!0}),t}var Gj=process.platform==="win32"?"winget install -e --id Gyan.FFmpeg":process.platform==="darwin"?"brew install ffmpeg":a4()?"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 a4(){try{return/^NoNewPrivs:\s*1$/m.test(JV("/proc/self/status","utf8"))}catch{return!1}}var l4=process.platform==="win32"?[ZV(process.env.LOCALAPPDATA??"","Microsoft","WinGet","Links")]:["/opt/homebrew/bin","/usr/local/bin"];function c4(){let e=Object.keys(process.env).find((n)=>n.toUpperCase()==="PATH")??"PATH",t=process.env[e]??"",r=l4.filter((n)=>WV(n)&&!t.split(ug).includes(n));if(r.length)process.env[e]=[t,...r].filter(Boolean).join(ug)}c4();var u4=(e)=>new Promise((t)=>setTimeout(t,e));async function d4(e,t){let r={numberOfVideos:1};if(t.aspectRatio)r.aspectRatio=t.aspectRatio;if(t.durationSeconds)r.durationSeconds=t.durationSeconds;if(t.resolution)r.resolution=t.resolution;if(t.negativePrompt)r.negativePrompt=t.negativePrompt;if(t.generateAudio!==void 0)r.generateAudio=t.generateAudio;let n=t.image?await p4(t.image):void 0;return e.models.generateVideos({model:t.model,prompt:t.prompt,...n?{image:n}:{},config:r})}async function fg(e,t,r,{pollMs:n=1e4,timeoutMs:o}){let i=t.name??"",s=Date.now()+o,l=t;while(!l.done){if(Date.now()>=s)return{status:"running",operation:i,hint:"Still generating: call video_status with this operation and the same out path later."};await u4(Math.min(n,Math.max(0,s-Date.now()))),l=await e.operations.getVideosOperation({operation:l})}if(l.error)return{status:"failed",operation:i,error:JSON.stringify(l.error)};let a=l.response?.generatedVideos?.[0]?.video;if(!a){let u=l.response?.raiMediaFilteredReasons?.join("; ");return{status:"failed",operation:i,error:u?`Blocked by safety filters: ${u}`:"No video in the response."}}let c=await s4(r);return await e.files.download({file:a,downloadPath:c}),{status:"done",operation:i,path:c}}function f4(e){let t=new eu;return t.name=e,t}async function p4(e){let t=jV(e);return{imageBytes:(await zV(t)).toString("base64"),mimeType:i4(t)}}var pg=k().describe("Where to save the video, e.g. media/T-012/intro.mp4"),hg=Ee().min(0).max(900).default(360).describe("How long to wait for the video (generation takes 1-6 minutes); 0 returns at once with the operation to check later");function h4({gemini:e=LV(),env:t=process.env,pollMs:r}={}){let n=new ZS({name:"sf-video-generation",version:"0.1.0"});return n.registerTool("generate_video",{title:"Generate a video clip",description:"Generate a short video clip (about 4-8 s) from a text prompt, optionally starting from an image, with Veo or Gemini Omni. Waits for it and saves the mp4; if it takes longer than waitSeconds, returns the operation for video_status.",inputSchema:X({prompt:k().min(1).describe("Shot description: subject, action, camera, style, lighting, and any spoken line or sound"),out:pg,model:k().optional().describe("Default from SF_VIDEO_MODEL, else veo-3.1-generate-preview; e.g. veo-3.1-fast-generate-preview, gemini-omni-1.1-flash (see list_video_models)"),aspectRatio:We(["16:9","9:16"]).optional(),durationSeconds:Ee().int().min(2).max(20).optional(),resolution:We(["720p","1080p"]).optional().describe("Default from the video quality setting: 1080p for high, else 720p"),negativePrompt:k().optional().describe("What must not appear"),image:k().optional().describe("Path to a png/jpg used as the first frame (e.g. an app screenshot)"),generateAudio:Pe().optional(),waitSeconds:hg}),annotations:{openWorldHint:!0}},({out:o,waitSeconds:i,model:s,...l})=>kc(async()=>{let a=e(),c=s??FV("SF_VIDEO_MODEL","veo-3.1-generate-preview",t),u=l.resolution??BV[GV(t)],f=await d4(a,{...l,resolution:u,model:c});return{model:c,...await fg(a,f,o,{pollMs:r,timeoutMs:i*1000})}})),n.registerTool("video_status",{title:"Check a video generation",description:"Check a generation that generate_video returned as running; downloads the mp4 to `out` once it is done.",inputSchema:X({operation:k().describe("The operation name generate_video returned"),out:pg,waitSeconds:hg.default(0)}),annotations:{openWorldHint:!0}},({operation:o,out:i,waitSeconds:s})=>kc(async()=>{let l=e(),a=await l.operations.getVideosOperation({operation:f4(o)});return fg(l,a,i,{pollMs:r,timeoutMs:s*1000})})),n.registerTool("list_video_models",{title:"List video models",description:"The video generation models this API key can use (Veo, Gemini Omni).",inputSchema:X({}),annotations:{readOnlyHint:!0,openWorldHint:!0}},()=>kc(async()=>{let o=[];for await(let i of await e().models.list()){let s=i.name?.replace(/^models\//,"")??"";if(/veo|omni/i.test(s)||i.supportedActions?.includes("predictLongRunning"))o.push({name:s,displayName:i.displayName,description:i.description})}return{models:o}})),n}HD(()=>h4());
|