dal-code 1.0.50 → 1.0.52
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/CHANGELOG.md +1050 -5
- package/NOTICE +17 -1
- package/dist/bundle/chunks/anthropic-messages-NK5NGKAI.js +5 -0
- package/dist/bundle/chunks/anthropic.js +74 -0
- package/dist/bundle/chunks/azure-openai-responses-VEASENYL.js +1 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +88 -0
- package/dist/bundle/chunks/chunk-3YGHTGYM.js +7 -0
- package/dist/bundle/chunks/chunk-4LDEEFCY.js +1 -0
- package/dist/bundle/chunks/chunk-4UTLMBZZ.js +13 -0
- package/dist/bundle/chunks/chunk-4VJJ6NXH.js +8 -0
- package/dist/bundle/chunks/chunk-567OJLS7.js +1 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +5 -0
- package/dist/bundle/chunks/chunk-6EEJ4MZH.js +1 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +5 -0
- package/dist/bundle/chunks/chunk-723ZGEZ2.js +1 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +1 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +1 -0
- package/dist/bundle/chunks/chunk-A5CI3CVQ.js +1 -0
- package/dist/bundle/chunks/chunk-AAQZXQA7.js +1 -0
- package/dist/bundle/chunks/chunk-ANL2BCIQ.js +15 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +30 -0
- package/dist/bundle/chunks/chunk-CS4T4O5O.js +1 -0
- package/dist/bundle/chunks/chunk-D2WTLI2T.js +19 -0
- package/dist/bundle/chunks/chunk-DLKRCASW.js +17 -0
- package/dist/bundle/chunks/chunk-EH7SFF47.js +129 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +9 -0
- package/dist/bundle/chunks/chunk-HEFI7NO7.js +1 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +1 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +1 -0
- package/dist/bundle/chunks/chunk-K7VBBYTT.js +1 -0
- package/dist/bundle/chunks/chunk-KJW3E2CB.js +9 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +1 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +11 -0
- package/dist/bundle/chunks/chunk-ML5DIOWR.js +1 -0
- package/dist/bundle/chunks/chunk-ON7ZX67F.js +30 -0
- package/dist/bundle/chunks/chunk-OQWPBJCS.js +81 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +1 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +1 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +1 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +1 -0
- package/dist/bundle/chunks/chunk-R47JBGS3.js +1 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +1 -0
- package/dist/bundle/chunks/chunk-SE42OS3U.js +21 -0
- package/dist/bundle/chunks/chunk-TK2WJTRC.js +3 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +1 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +1 -0
- package/dist/bundle/chunks/chunk-UVKMBM5X.js +56 -0
- package/dist/bundle/chunks/chunk-WIZGOHKY.js +9 -0
- package/dist/bundle/chunks/chunk-XAS5HHBW.js +1180 -0
- package/dist/bundle/chunks/chunk-XDBGA662.js +43 -0
- package/dist/bundle/chunks/chunk-XJFQKN3N.js +2 -0
- package/dist/bundle/chunks/chunk-YWNDPXVM.js +25 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +1 -0
- package/dist/bundle/chunks/cli-GXB5WYKG.js +52 -0
- package/dist/bundle/chunks/cli-YPE3BB5X.js +30 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-B7WOBGWO.js +1 -0
- package/dist/bundle/chunks/codemode-worker.js +480 -0
- package/dist/bundle/chunks/dist-D3WIBXB5.js +10 -0
- package/dist/bundle/chunks/easter-egg-3d-5TFBCTIS.js +1 -0
- package/dist/bundle/chunks/execute-27QCJECT.js +506 -0
- package/dist/bundle/chunks/github-copilot.js +1 -0
- package/dist/bundle/chunks/google-generative-ai-MBMRBHSZ.js +1 -0
- package/dist/bundle/chunks/google-vertex-S2ZFBDPP.js +1 -0
- package/dist/bundle/chunks/http-proxy-KF35JLJN.js +1 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +12 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +20 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +1 -0
- package/dist/bundle/chunks/kimi-coding.js +1 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +8 -0
- package/dist/bundle/chunks/llama-cpp-classify-S4LVGNNY.js +21 -0
- package/dist/bundle/chunks/mcp-6LJKGKJQ.js +10 -0
- package/dist/bundle/chunks/meta.js +1 -0
- package/dist/bundle/chunks/mistral-conversations-C7LUXIEY.js +4 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +2 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +1 -0
- package/dist/bundle/chunks/node-ZTHARAQV.js +15 -0
- package/dist/bundle/chunks/office-5OWKTZOA.js +419 -0
- package/dist/bundle/chunks/openai-chatgpt.js +74 -0
- package/dist/bundle/chunks/openai-codex-responses-YQQXJ24E.js +9 -0
- package/dist/bundle/chunks/openai-codex.js +74 -0
- package/dist/bundle/chunks/openai-completions-7CMH2FKD.js +6 -0
- package/dist/bundle/chunks/openai-decisions-AOGZTREY.js +4 -0
- package/dist/bundle/chunks/openai-responses-ZSOGZ3MK.js +3 -0
- package/dist/bundle/chunks/openrouter-images-AHXST2TH.js +1 -0
- package/dist/bundle/chunks/openrouter.js +74 -0
- package/dist/bundle/chunks/pi-messages-QERJLMZ6.js +7 -0
- package/dist/bundle/chunks/radius.js +74 -0
- package/dist/bundle/chunks/review-5G56KIWY.js +80 -0
- package/dist/bundle/chunks/rewind-2OYLDDHH.js +8 -0
- package/dist/bundle/chunks/router-776Z7G7G.js +3 -0
- package/dist/bundle/chunks/runtime-NKPT25KD.js +1 -0
- package/dist/bundle/chunks/sdk-TVC4GDUX.js +1 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +3 -0
- package/dist/bundle/chunks/sync-JBDC3YBK.js +7 -0
- package/dist/bundle/chunks/typesafe-system-one-MMNGGQ46.js +1 -0
- package/dist/bundle/chunks/usage-BDCIALHO.js +1 -0
- package/dist/bundle/chunks/virtual-modules-25RQ6XTV.js +1 -0
- package/dist/bundle/chunks/xai.js +1 -0
- package/dist/bundle/cli-runtime.js +2 -0
- package/dist/bundle/cli.js +2 -0
- package/dist/bundle/index.js +1 -0
- package/dist/bundle/rpc-entry.js +2 -0
- package/dist/cli/args.js +1 -1
- package/dist/cli/auth-command.js +9 -6
- package/dist/cli/auth-login.js +2 -0
- package/dist/cli/auth-logout.js +1 -0
- package/dist/cli/auth-terminal.js +5 -0
- package/dist/cli/config-selector.js +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session.d.ts +8 -1
- package/dist/core/agent-session.js +12 -9
- package/dist/core/auth-storage.js +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bug-report.js +3 -3
- package/dist/core/cache-warmer.d.ts +3 -15
- package/dist/core/cache-warmer.js +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -2
- package/dist/core/compaction/branch-summarization.js +5 -5
- package/dist/core/compaction/compaction.d.ts +1 -0
- package/dist/core/compaction/compaction.js +14 -14
- package/dist/core/compaction/tool-output-pruning.js +1 -1
- package/dist/core/compaction/utils.d.ts +0 -1
- package/dist/core/compaction/utils.js +8 -8
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.js +1 -1
- package/dist/core/export-html/template.css +9 -0
- package/dist/core/export-html/template.js +46 -39
- package/dist/core/export-html/tool-renderer.js +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/pi-ai-extension-view.js +1 -0
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +25 -7
- package/dist/core/extensions/virtual-modules.js +1 -1
- package/dist/core/keybindings.d.ts +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/mcp-servers.d.ts +6 -17
- package/dist/core/mcp-servers.js +1 -1
- package/dist/core/model-config.d.ts +1912 -2211
- package/dist/core/model-config.js +4 -4
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.js +1 -1
- package/dist/core/package-manager.d.ts +10 -1
- package/dist/core/package-manager.js +2 -2
- package/dist/core/pi-ai-schemas.js +1 -0
- package/dist/core/pi-manifest.js +1 -1
- package/dist/core/preferred-providers.js +1 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/prompt-templates.js +2 -2
- package/dist/core/provider-composer.js +1 -1
- package/dist/core/provider-matching.js +1 -0
- package/dist/core/radius-mcp.js +1 -0
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resource-loader.d.ts +3 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/runtime-credentials.js +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/session-cwd.js +3 -7
- package/dist/core/session-manager.d.ts +1 -0
- package/dist/core/session-manager.js +12 -12
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/settings-schema.d.ts +4 -2
- package/dist/core/settings-schema.js +1 -1
- package/dist/core/skills.js +3 -3
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.js +1 -1
- package/dist/core/system-prompt.js +3 -3
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.js +15 -15
- package/dist/core/tools/edit-diff.d.ts +9 -4
- package/dist/core/tools/edit-diff.js +22 -15
- package/dist/core/tools/edit.d.ts +3 -3
- package/dist/core/tools/edit.js +3 -3
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.js +10 -11
- package/dist/core/tools/grep.d.ts +3 -3
- package/dist/core/tools/grep.js +8 -12
- package/dist/core/tools/ls.d.ts +2 -2
- package/dist/core/tools/ls.js +4 -4
- package/dist/core/tools/powershell.js +6 -2
- package/dist/core/tools/read.d.ts +5 -2
- package/dist/core/tools/read.js +20 -19
- package/dist/core/tools/render-utils.js +5 -5
- package/dist/core/tools/renderers/write.js +10 -10
- package/dist/core/tools/tool-definition-wrapper.d.ts +11 -0
- package/dist/core/tools/truncate.d.ts +2 -8
- package/dist/core/tools/truncate.js +10 -10
- package/dist/core/tools/write.d.ts +2 -2
- package/dist/core/trust-manager.js +2 -2
- package/dist/core/usage-totals.js +1 -1
- package/dist/dal/builtins.js +2 -2
- package/dist/dal/manifest.d.ts +1 -0
- package/dist/dal/manifest.js +1 -1
- package/dist/dal/safety-net.js +11 -3
- package/dist/extensions/codemode/execute.js +12 -12
- package/dist/extensions/codemode/renderer.js +6 -6
- package/dist/extensions/codemode/tool.d.ts +2 -1
- package/dist/extensions/codemode/tool.js +11 -10
- package/dist/extensions/llama/client.js +5 -5
- package/dist/extensions/llama/ui.js +2 -2
- package/dist/extensions/mcp/cli.js +21 -19
- package/dist/extensions/mcp/config.js +2 -2
- package/dist/extensions/mcp/index.js +7 -7
- package/dist/extensions/mcp/oauth.d.ts +3 -22
- package/dist/extensions/mcp/oauth.js +2 -2
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.js +1 -1
- package/dist/extensions/mcp/runtime.d.ts +2 -2
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/extensions/mcp/tools.d.ts +1 -8
- package/dist/extensions/mcp/tools.js +4 -9
- package/dist/extensions/mcp/ui.js +1 -1
- package/dist/extensions/tool-search/tool.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/modes/interactive/components/assistant-message.d.ts +4 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -2
- package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/branch-summary-message.js +2 -2
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +2 -2
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -2
- package/dist/modes/interactive/components/custom-message.js +3 -3
- package/dist/modes/interactive/components/diff.js +3 -3
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -0
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-selector.js +2 -2
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -0
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/markdown-transform.js +1 -1
- package/dist/modes/interactive/components/mermaid.js +4 -4
- package/dist/modes/interactive/components/model-selector.d.ts +1 -0
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts +2 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/provider-brand.js +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +2 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/settings-submenu.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +2 -2
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/dist/modes/interactive/components/tool-execution.js +3 -3
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -0
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +2 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/external-editor.js +3 -3
- package/dist/modes/interactive/interactive-mode.d.ts +10 -1
- package/dist/modes/interactive/interactive-mode.js +45 -40
- package/dist/modes/interactive/model-search.js +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +4 -0
- package/dist/modes/interactive/theme/theme.js +3 -6
- package/dist/modes/print-mode.js +7 -7
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +5 -2
- package/dist/node_modules/@dalcode/dal-learn/src/engine.js +4 -4
- package/dist/node_modules/@dalcode/dal-learn/src/extract.js +31 -5
- package/dist/node_modules/@dalcode/dal-learn/src/index.js +16 -16
- package/dist/node_modules/@dalcode/dal-learn/src/learn-mode.js +1 -0
- package/dist/node_modules/@dalcode/dal-learn/src/lesson-events.js +1 -0
- package/dist/node_modules/@dalcode/dal-learn/src/lessons.js +4 -3
- package/dist/node_modules/@dalcode/dal-learn/src/project-map.js +2 -2
- package/dist/node_modules/@dalcode/dal-learn/src/safety.js +2 -2
- package/dist/node_modules/@dalcode/dal-learn/src/signals.js +6 -5
- package/dist/node_modules/@dalcode/dal-learn/src/store.js +3 -2
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -3
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -3
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-sync/src/core.js +2 -2
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo-snapshot.js +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +3 -3
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/README.md +8 -6
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -2
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/README.md +58 -39
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +9 -9
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/strict-tool-limits.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/meta.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/trusted-url.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.d.ts +21 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-bedrock-provider.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-oauth.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +485 -498
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual-cn.json +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +65 -65
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/schema-builders.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/telemetry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +4 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.js +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/{typebox-helpers.d.ts → string-enum.d.ts} +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/string-enum.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +12 -5
- package/dist/node_modules/@earendil-works/pi-codemode/README.md +2 -2
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +2 -0
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +32 -0
- package/dist/node_modules/@earendil-works/pi-mcp/README.md +60 -5
- package/dist/node_modules/@earendil-works/pi-mcp/dist/config.d.ts +45 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/config.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/callback.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.d.ts +42 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.d.ts +5 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.js +11 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/lines.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.js +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.d.ts +1 -4
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.js +2 -2
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +6 -4
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-schema/CHANGELOG.md +37 -0
- package/dist/node_modules/@earendil-works/pi-schema/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-schema/README.md +319 -0
- package/dist/node_modules/@earendil-works/pi-schema/THIRD_PARTY_NOTICES/typebox-LICENSE +23 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/annotations.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/builders.d.ts +89 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/builders.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/checks.d.ts +51 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/checks.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/coerce.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/compiler.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/explain.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date_time.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/duration.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/email.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_email.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/bidi.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/puny.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/idn-hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/ascii.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/puny.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/unicode.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/pattern/pattern.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv4.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv6.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri_reference.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer_uri_fragment.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/regex.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/relative_json_pointer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/time.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_reference.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_template.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/url.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uuid.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/index.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/resolver.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/shared.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.d.ts +54 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.js +0 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/types.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/validator.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/validator.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/package.json +43 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/render.js +2 -2
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/README.md +2 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -10
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +5 -5
- package/dist/node_modules/@earendil-works/pi-tui/dist/layout.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/program-status.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -4
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +13 -13
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +17 -16
- package/dist/utils/ansi.js +1 -1
- package/dist/utils/changelog.js +3 -3
- package/dist/utils/clipboard-command.js +1 -1
- package/dist/utils/image-resize-core.js +1 -1
- package/dist/utils/image-resize.js +1 -1
- package/dist/utils/open-browser.js +1 -1
- package/dist/utils/paths.js +1 -1
- package/dist/utils/shell.js +3 -3
- package/dist/utils/syntax-highlight.js +4 -4
- package/dist/utils/terminal-question.js +1 -0
- package/dist/utils/tools-manager.js +1 -1
- package/dist/utils/web-url.js +1 -0
- package/examples/extensions/README.md +2 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/debug-provider.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +19 -29
- package/examples/extensions/gondolin/package.json +2 -2
- package/examples/extensions/plan-mode/index.ts +20 -9
- package/examples/extensions/plan-mode/utils.ts +42 -16
- package/examples/extensions/preset.ts +2 -0
- package/examples/extensions/reload-runtime.ts +17 -5
- package/examples/extensions/subagent/README.md +14 -11
- package/examples/extensions/subagent/index.ts +392 -171
- package/examples/extensions/todo.ts +7 -0
- package/examples/extensions/tools.ts +2 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/tsconfig.json +208 -0
- package/npm-shrinkwrap.json +407 -383
- package/package.json +6 -7
- package/examples/extensions/sandbox/index.ts +0 -327
- package/examples/extensions/sandbox/package-lock.json +0 -92
- package/examples/extensions/sandbox/package.json +0 -19
- /package/dist/node_modules/@earendil-works/pi-mcp/{LICENSES → THIRD_PARTY_NOTICES}/modelcontextprotocol-typescript-sdk.txt +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var Ha=Object.defineProperty;var p=(e,t)=>Ha(e,"name",{value:t,configurable:!0});import{createRequire as Va}from"node:module";const Fy=Va(import.meta.url);import{require_safe_buffer as Bt}from"./chunk-567OJLS7.js";import{getJsonSchemaToolParameters as $a,resolveJsonSchemaStrictSampling as tn,transformMessages as Ja}from"./chunk-6EEJ4MZH.js";import{sanitizeSurrogates as St}from"./chunk-L2ZPNLYD.js";import{retryProviderRequest as Wa}from"./chunk-ML5DIOWR.js";import{clampThinkingLevel as Xa,collapseSystemMessages as Ka,withoutInitialSystemMessage as Ya}from"./chunk-TK2WJTRC.js";import{__commonJS as z,__require as te,__toESM as ze}from"./chunk-JXWJOIH4.js";var za=z({"node_modules/retry/lib/retry_operation.js"(e,t){function r(n,i){typeof i=="boolean"&&(i={forever:i}),this._originalTimeouts=JSON.parse(JSON.stringify(n)),this._timeouts=n,this._options=i||{},this._maxRetryTime=i&&i.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))}p(r,"RetryOperation"),t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(n){if(this._timeout&&clearTimeout(this._timeout),!n)return!1;var i=new Date().getTime();if(n&&i-this._operationStart>=this._maxRetryTime)return this._errors.push(n),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(n);var o=this._timeouts.shift();if(o===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),o=this._cachedTimeouts.slice(-1);else return!1;var a=this;return this._timer=setTimeout(function(){a._attempts++,a._operationTimeoutCb&&(a._timeout=setTimeout(function(){a._operationTimeoutCb(a._attempts)},a._operationTimeout),a._options.unref&&a._timeout.unref()),a._fn(a._attempts)},o),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(n,i){this._fn=n,i&&(i.timeout&&(this._operationTimeout=i.timeout),i.cb&&(this._operationTimeoutCb=i.cb));var o=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){o._operationTimeoutCb()},o._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;for(var n={},i=null,o=0,a=0;a<this._errors.length;a++){var c=this._errors[a],u=c.message,d=(n[u]||0)+1;n[u]=d,d>=o&&(i=c,o=d)}return i}}}),Qa=z({"node_modules/retry/lib/retry.js"(e){var t=za();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:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in r)n[i]=r[i];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],a=0;a<n.retries;a++)o.push(this.createTimeout(a,n));return r&&r.forever&&!o.length&&o.push(this.createTimeout(a,n)),o.sort(function(c,u){return c-u}),o},e.createTimeout=function(r,n){var i=n.randomize?Math.random()+1:1,o=Math.round(i*Math.max(n.minTimeout,1)*Math.pow(n.factor,r));return o=Math.min(o,n.maxTimeout),o},e.wrap=function(r,n,i){if(n instanceof Array&&(i=n,n=null),!i){i=[];for(var o in r)typeof r[o]=="function"&&i.push(o)}for(var a=0;a<i.length;a++){var c=i[a],u=r[c];r[c]=function(d){var h=e.operation(n),m=Array.prototype.slice.call(arguments,1),g=m.pop();m.push(function(_){h.retry(_)||(_&&(arguments[0]=h.mainError()),g.apply(this,arguments))}),h.attempt(function(){d.apply(r,m)})}.bind(r,u),r[c].options=n}}}}),Za=z({"node_modules/retry/index.js"(e,t){t.exports=Qa()}}),ja=z({"node_modules/p-retry/index.js"(e,t){"use strict";var r=Za(),n=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],i=class extends Error{static{p(this,"AbortError")}constructor(u){super(),u instanceof Error?(this.originalError=u,{message:u}=u):(this.originalError=new Error(u),this.originalError.stack=this.stack),this.name="AbortError",this.message=u}},o=p((u,d,h)=>{let m=h.retries-(d-1);return u.attemptNumber=d,u.retriesLeft=m,u},"decorateErrorWithCounts"),a=p(u=>n.includes(u),"isNetworkError"),c=p((u,d)=>new Promise((h,m)=>{d={onFailedAttempt:p(()=>{},"onFailedAttempt"),retries:10,...d};let g=r.operation(d);g.attempt(async _=>{try{h(await u(_))}catch(f){if(!(f instanceof Error)){m(new TypeError(`Non-error was thrown: "${f}". You should only throw errors.`));return}if(f instanceof i)g.stop(),m(f.originalError);else if(f instanceof TypeError&&!a(f.message))g.stop(),m(f);else{o(f,_,d);try{await d.onFailedAttempt(f)}catch(y){m(y);return}g.retry(f)||m(g.mainError())}}})}),"pRetry2");t.exports=c,t.exports.default=c,t.exports.AbortError=i}}),rn=z({"node_modules/extend/index.js"(e,t){"use strict";var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=p(function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},"isArray"),c=p(function(h){if(!h||n.call(h)!=="[object Object]")return!1;var m=r.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&r.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!g)return!1;var _;for(_ in h);return typeof _>"u"||r.call(h,_)},"isPlainObject2"),u=p(function(h,m){i&&m.name==="__proto__"?i(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},"setProperty"),d=p(function(h,m){if(m==="__proto__")if(r.call(h,m)){if(o)return o(h,m).value}else return;return h[m]},"getProperty");t.exports=p(function h(){var m,g,_,f,y,E,C=arguments[0],S=1,A=arguments.length,v=!1;for(typeof C=="boolean"&&(v=C,C=arguments[1]||{},S=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});S<A;++S)if(m=arguments[S],m!=null)for(g in m)_=d(C,g),f=d(m,g),C!==f&&(v&&f&&(c(f)||(y=a(f)))?(y?(y=!1,E=_&&a(_)?_:[]):E=_&&c(_)?_:{},u(C,{name:g,newValue:h(v,E,f)})):typeof f<"u"&&u(C,{name:g,newValue:f}));return C},"extend")}}),el=z({"node_modules/gaxios/package.json"(e,t){t.exports={name:"gaxios",version:"7.1.4",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","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.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":"^22.13.1","@types/sinon":"^17.0.3","@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.1",linkinator:"^6.1.2",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.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",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-core/tree/main/packages/gaxios"}}}),tl=z({"node_modules/gaxios/build/cjs/src/util.cjs"(e,t){"use strict";var r=el();t.exports={pkg:r}}}),nn=z({"node_modules/gaxios/build/cjs/src/common.js"(e){"use strict";var t=e&&e.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosError=e.GAXIOS_ERROR_SYMBOL=void 0,e.defaultErrorRedactor=c;var r=t(rn()),n=t(tl()),i=n.default.pkg;e.GAXIOS_ERROR_SYMBOL=Symbol.for(`${i.name}-gaxios-error`);var o=class wa extends Error{static{p(this,"_GaxiosError")}config;response;code;status;error;[e.GAXIOS_ERROR_SYMBOL]=i.version;static[Symbol.hasInstance](d){return d&&typeof d=="object"&&e.GAXIOS_ERROR_SYMBOL in d&&d[e.GAXIOS_ERROR_SYMBOL]===i.version?!0:Function.prototype[Symbol.hasInstance].call(wa,d)}constructor(d,h,m,g){if(super(d,{cause:g}),this.config=h,this.response=m,this.error=g instanceof Error?g:void 0,this.config=(0,r.default)(!0,{},h),this.response&&(this.response.config=(0,r.default)(!0,{},this.response.config)),this.response){try{this.response.data=a(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}g instanceof DOMException?this.code=g.name:g&&typeof g=="object"&&"code"in g&&(typeof g.code=="string"||typeof g.code=="number")&&(this.code=g.code)}static extractAPIErrorFromResponse(d,h="The request failed"){let m=h;if(typeof d.data=="string"&&(m=d.data),d.data&&typeof d.data=="object"&&"error"in d.data&&d.data.error&&!d.ok){if(typeof d.data.error=="string")return{message:d.data.error,code:d.status,status:d.statusText};if(typeof d.data.error=="object"){m="message"in d.data.error&&typeof d.data.error.message=="string"?d.data.error.message:m;let g="status"in d.data.error&&typeof d.data.error.status=="string"?d.data.error.status:d.statusText,_="code"in d.data.error&&typeof d.data.error.code=="number"?d.data.error.code:d.status;if("errors"in d.data.error&&Array.isArray(d.data.error.errors)){let f=[];for(let y of d.data.error.errors)typeof y=="object"&&"message"in y&&typeof y.message=="string"&&f.push(y.message);return Object.assign({message:f.join(`
|
|
2
|
+
`)||m,code:_,status:g},d.data.error)}return Object.assign({message:m,code:_,status:g},d.data.error)}}return{message:m,code:d.status,status:d.statusText}}};e.GaxiosError=o;function a(u,d){switch(u){case"stream":return d;case"json":return JSON.parse(JSON.stringify(d));case"arraybuffer":return JSON.parse(Buffer.from(d).toString("utf8"));case"blob":return JSON.parse(d.text());default:return d}}p(a,"translateData");function c(u){let d="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function h(_){_&&_.forEach((f,y)=>{(/^authentication$/i.test(y)||/^authorization$/i.test(y)||/secret/i.test(y))&&_.set(y,d)})}p(h,"redactHeaders");function m(_,f){if(typeof _=="object"&&_!==null&&typeof _[f]=="string"){let y=_[f];(/grant_type=/i.test(y)||/assertion=/i.test(y)||/secret/i.test(y))&&(_[f]=d)}}p(m,"redactString");function g(_){!_||typeof _!="object"||(_ instanceof FormData||_ instanceof URLSearchParams||"forEach"in _&&"set"in _?_.forEach((f,y)=>{(["grant_type","assertion"].includes(y)||/secret/.test(y))&&_.set(y,d)}):("grant_type"in _&&(_.grant_type=d),"assertion"in _&&(_.assertion=d),"client_secret"in _&&(_.client_secret=d)))}return p(g,"redactObject"),u.config&&(h(u.config.headers),m(u.config,"data"),g(u.config.data),m(u.config,"body"),g(u.config.body),u.config.url.searchParams.has("token")&&u.config.url.searchParams.set("token",d),u.config.url.searchParams.has("client_secret")&&u.config.url.searchParams.set("client_secret",d)),u.response&&(c({config:u.response.config}),h(u.response.headers),u.response.bodyUsed&&(m(u.response,"data"),g(u.response.data))),u}p(c,"defaultErrorRedactor")}}),rl=z({"node_modules/gaxios/build/cjs/src/retry.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getRetryConfig=t;async function t(o){let a=n(o);if(!o||!o.config||!a&&!o.config.retry)return{shouldRetry:!1};a=a||{},a.currentRetryAttempt=a.currentRetryAttempt||0,a.retry=a.retry===void 0||a.retry===null?3:a.retry,a.httpMethodsToRetry=a.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],a.noResponseRetries=a.noResponseRetries===void 0||a.noResponseRetries===null?2:a.noResponseRetries,a.retryDelayMultiplier=a.retryDelayMultiplier?a.retryDelayMultiplier:2,a.timeOfFirstRequest=a.timeOfFirstRequest?a.timeOfFirstRequest:Date.now(),a.totalTimeout=a.totalTimeout?a.totalTimeout:Number.MAX_SAFE_INTEGER,a.maxRetryDelay=a.maxRetryDelay?a.maxRetryDelay:Number.MAX_SAFE_INTEGER;let c=[[100,199],[408,408],[429,429],[500,599]];if(a.statusCodesToRetry=a.statusCodesToRetry||c,o.config.retryConfig=a,!await(a.shouldRetry||r)(o))return{shouldRetry:!1,config:o.config};let u=i(a);o.config.retryConfig.currentRetryAttempt+=1;let d=a.retryBackoff?a.retryBackoff(o,u):new Promise(h=>{setTimeout(h,u)});return a.onRetryAttempt&&await a.onRetryAttempt(o),await d,{shouldRetry:!0,config:o.config}}p(t,"getRetryConfig");function r(o){let a=n(o);if(o.config.signal?.aborted&&o.code!=="TimeoutError"||o.code==="AbortError"||!a||a.retry===0||!o.response&&(a.currentRetryAttempt||0)>=a.noResponseRetries||!a.httpMethodsToRetry||!a.httpMethodsToRetry.includes(o.config.method?.toUpperCase()||"GET"))return!1;if(o.response&&o.response.status){let c=!1;for(let[u,d]of a.statusCodesToRetry){let h=o.response.status;if(h>=u&&h<=d){c=!0;break}}if(!c)return!1}return a.currentRetryAttempt=a.currentRetryAttempt||0,!(a.currentRetryAttempt>=a.retry)}p(r,"shouldRetryRequest");function n(o){if(o&&o.config&&o.config.retryConfig)return o.config.retryConfig}p(n,"getConfig");function i(o){let a=(o.currentRetryAttempt?0:o.retryDelay??100)+(Math.pow(o.retryDelayMultiplier,o.currentRetryAttempt)-1)/2*1e3,c=o.totalTimeout-(Date.now()-o.timeOfFirstRequest);return Math.min(a,c,o.maxRetryDelay)}p(i,"getNextRetryDelay")}}),on=z({"node_modules/gaxios/build/cjs/src/interceptor.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosInterceptorManager=void 0;var t=class extends Set{static{p(this,"GaxiosInterceptorManager")}};e.GaxiosInterceptorManager=t}}),nl=z({"node_modules/gaxios/build/cjs/src/gaxios.js"(e){"use strict";var t=e&&e.__importDefault||function(g){return g&&g.__esModule?g:{default:g}},r;Object.defineProperty(e,"__esModule",{value:!0}),e.Gaxios=void 0;var n=t(rn()),i=te("https"),o=nn(),a=rl(),c=te("stream"),u=on(),d=p(async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),"randomUUID"),h=204,m=class{static{p(this,"Gaxios")}agentCache=new Map;defaults;interceptors;constructor(g){this.defaults=g||{},this.interceptors={request:new u.GaxiosInterceptorManager,response:new u.GaxiosInterceptorManager}}fetch(...g){let _=g[0],f=g[1],y,E=new Headers;return typeof _=="string"?y=new URL(_):_ instanceof URL?y=_:_&&_.url&&(y=new URL(_.url)),_&&typeof _=="object"&&"headers"in _&&r.mergeHeaders(E,_.headers),f&&r.mergeHeaders(E,new Headers(f.headers)),typeof _=="object"&&!(_ instanceof URL)?this.request({...f,..._,headers:E,url:y}):this.request({...f,headers:E,url:y})}async request(g={}){let _=await this.#n(g);return _=await this.#t(_),this.#r(this._request(_))}async _defaultAdapter(g){let _=g.fetchImplementation||this.defaults.fetchImplementation||await r.#l(),f={...g};delete f.data;let y=await _(g.url,f),E=await this.getResponseData(g,y);return Object.getOwnPropertyDescriptor(y,"data")?.configurable||Object.defineProperties(y,{data:{configurable:!0,writable:!0,enumerable:!0,value:E}}),Object.assign(y,{config:g,data:E})}async _request(g){try{let _;if(g.adapter?_=await g.adapter(g,this._defaultAdapter.bind(this)):_=await this._defaultAdapter(g),!g.validateStatus(_.status)){if(g.responseType==="stream"){let y=[];for await(let E of _.data)y.push(E);_.data=y.toString()}let f=o.GaxiosError.extractAPIErrorFromResponse(_,`Request failed with status code ${_.status}`);throw new o.GaxiosError(f?.message,g,_,f)}return _}catch(_){let f;_ instanceof o.GaxiosError?f=_:_ instanceof Error?f=new o.GaxiosError(_.message,g,void 0,_):f=new o.GaxiosError("Unexpected Gaxios Error",g,void 0,_);let{shouldRetry:y,config:E}=await(0,a.getRetryConfig)(f);if(y&&E)return f.config.retryConfig.currentRetryAttempt=E.retryConfig.currentRetryAttempt,g.retryConfig=f.config?.retryConfig,this.#i(g),this._request(g);throw g.errorRedactor&&g.errorRedactor(f),f}}async getResponseData(g,_){if(_.status===h)return"";if(g.maxContentLength&&_.headers.has("content-length")&&g.maxContentLength<Number.parseInt(_.headers?.get("content-length")||""))throw new o.GaxiosError("Response's `Content-Length` is over the limit.",g,Object.assign(_,{config:g}));switch(g.responseType){case"stream":return _.body;case"json":{let f=await _.text();try{return JSON.parse(f)}catch{return f}}case"arraybuffer":return _.arrayBuffer();case"blob":return _.blob();case"text":return _.text();default:return this.getResponseDataFromContentType(_)}}#e(g,_=[]){let f=new URL(g),y=[..._],E=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let C of E)y.push(C.trim());for(let C of y)if(C instanceof RegExp){if(C.test(f.toString()))return!1}else if(C instanceof URL){if(C.origin===f.origin)return!1}else if(C.startsWith("*.")||C.startsWith(".")){let S=C.replace(/^\*\./,".");if(f.hostname.endsWith(S))return!1}else if(C===f.origin||C===f.hostname||C===f.href)return!1;return!0}async#t(g){let _=Promise.resolve(g);for(let f of this.interceptors.request.values())f&&(_=_.then(f.resolved,f.rejected));return _}async#r(g){let _=Promise.resolve(g);for(let f of this.interceptors.response.values())f&&(_=_.then(f.resolved,f.rejected));return _}async#n(g){let _=new Headers(this.defaults.headers);r.mergeHeaders(_,g.headers);let f=(0,n.default)(!0,{},this.defaults,g);if(!f.url)throw new Error("URL is required.");if(f.baseURL&&(f.url=new URL(f.url,f.baseURL)),f.url=new URL(f.url),f.params)if(f.paramsSerializer){let C=f.paramsSerializer(f.params);C.startsWith("?")&&(C=C.slice(1));let S=f.url.toString().includes("?")?"&":"?";f.url=f.url+S+C}else{let C=f.url instanceof URL?f.url:new URL(f.url);for(let[S,A]of new URLSearchParams(f.params))C.searchParams.append(S,A);f.url=C}typeof g.maxContentLength=="number"&&(f.size=g.maxContentLength),typeof g.maxRedirects=="number"&&(f.follow=g.maxRedirects);let y=typeof f.data=="string"||f.data instanceof ArrayBuffer||f.data instanceof Blob||globalThis.File&&f.data instanceof File||f.data instanceof FormData||f.data instanceof c.Readable||f.data instanceof ReadableStream||f.data instanceof String||f.data instanceof URLSearchParams||ArrayBuffer.isView(f.data)||["Blob","File","FormData"].includes(f.data?.constructor?.name||"");if(f.multipart?.length){let C=await d();_.set("content-type",`multipart/related; boundary=${C}`),f.body=c.Readable.from(this.getMultipartRequest(f.multipart,C))}else y?f.body=f.data:typeof f.data=="object"?_.get("Content-Type")==="application/x-www-form-urlencoded"?f.body=f.paramsSerializer?f.paramsSerializer(f.data):new URLSearchParams(f.data):(_.has("content-type")||_.set("content-type","application/json"),f.body=JSON.stringify(f.data)):f.data&&(f.body=f.data);f.validateStatus=f.validateStatus||this.validateStatus,f.responseType=f.responseType||"unknown",!_.has("accept")&&f.responseType==="json"&&_.set("accept","application/json");let E=f.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(!f.agent)if(E&&this.#e(f.url,f.noProxy)){let C=await r.#a();this.agentCache.has(E)?f.agent=this.agentCache.get(E):(f.agent=new C(E,{cert:f.cert,key:f.key}),this.agentCache.set(E,f.agent))}else f.cert&&f.key&&(this.agentCache.has(f.key)?f.agent=this.agentCache.get(f.key):(f.agent=new i.Agent({cert:f.cert,key:f.key}),this.agentCache.set(f.key,f.agent)));return typeof f.errorRedactor!="function"&&f.errorRedactor!==!1&&(f.errorRedactor=o.defaultErrorRedactor),f.body&&!("duplex"in f)&&(f.duplex="half"),this.#i(f),Object.assign(f,{headers:_,url:f.url instanceof URL?f.url:new URL(f.url)})}#i(g){if(g.timeout){let _=AbortSignal.timeout(g.timeout);g.signal&&!g.signal.aborted?g.signal=AbortSignal.any([g.signal,_]):g.signal=_}}validateStatus(g){return g>=200&&g<300}async getResponseDataFromContentType(g){let _=g.headers.get("Content-Type");if(_===null)return g.text();if(_=_.toLowerCase(),_.includes("application/json")){let f=await g.text();try{f=JSON.parse(f)}catch{}return f}else return _.match(/^text\//)?g.text():g.blob()}async*getMultipartRequest(g,_){let f=`--${_}--`;for(let y of g){let E=y.headers.get("Content-Type")||"application/octet-stream";yield`--${_}\r
|
|
3
|
+
Content-Type: ${E}\r
|
|
4
|
+
\r
|
|
5
|
+
`,typeof y.content=="string"?yield y.content:yield*y.content,yield`\r
|
|
6
|
+
`}yield f}static#o;static#s;static async#a(){return this.#o||=(await import("./https-proxy-agent-LVOO5TPL.js")).HttpsProxyAgent,this.#o}static async#l(){let g=typeof window<"u"&&!!window;return this.#s||=g?window.fetch:(await import("./src-QKGKDFSU.js")).default,this.#s}static mergeHeaders(g,..._){g=g instanceof Headers?g:new Headers(g);for(let f of _)(f instanceof Headers?f:new Headers(f)).forEach((y,E)=>{E==="set-cookie"?g.append(E,y):g.set(E,y)});return g}};e.Gaxios=m,r=m}}),Le=z({"node_modules/gaxios/build/cjs/src/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,c,u,d){d===void 0&&(d=u);var h=Object.getOwnPropertyDescriptor(c,u);(!h||("get"in h?!c.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:p(function(){return c[u]},"get")}),Object.defineProperty(a,d,h)}):(function(a,c,u,d){d===void 0&&(d=u),a[d]=c[u]})),r=e&&e.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&t(c,a,u)};Object.defineProperty(e,"__esModule",{value:!0}),e.instance=e.Gaxios=e.GaxiosError=void 0,e.request=o;var n=nl();Object.defineProperty(e,"Gaxios",{enumerable:!0,get:p(function(){return n.Gaxios},"get")});var i=nn();Object.defineProperty(e,"GaxiosError",{enumerable:!0,get:p(function(){return i.GaxiosError},"get")}),r(on(),e),e.instance=new n.Gaxios;async function o(a){return e.instance.request(a)}p(o,"request")}}),sn=z({"node_modules/bignumber.js/bignumber.js"(e,t){(function(r){"use strict";var n,i=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,a=Math.floor,c="[BigNumber Error] ",u=c+"Number primitive has more than 15 significant digits: ",d=1e14,h=14,m=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],_=1e7,f=1e9;function y(w){var k,R,M,D=Q.prototype={constructor:Q,toString:null,valueOf:null},J=new Q(1),O=20,L=4,B=-7,X=21,Y=-1e7,j=1e7,ie=!1,oe=1,Re=0,et={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ke="0123456789abcdefghijklmnopqrstuvwxyz",ft=!0;function Q(N,x){var U,V,q,H,W,F,P,b,G=this;if(!(G instanceof Q))return new Q(N,x);if(x==null){if(N&&N._isBigNumber===!0){G.s=N.s,!N.c||N.e>j?G.c=G.e=null:N.e<Y?G.c=[G.e=0]:(G.e=N.e,G.c=N.c.slice());return}if((F=typeof N=="number")&&N*0==0){if(G.s=1/N<0?(N=-N,-1):1,N===~~N){for(H=0,W=N;W>=10;W/=10,H++);H>j?G.c=G.e=null:(G.e=H,G.c=[N]);return}b=String(N)}else{if(!i.test(b=String(N)))return M(G,b,F);G.s=b.charCodeAt(0)==45?(b=b.slice(1),-1):1}(H=b.indexOf("."))>-1&&(b=b.replace(".","")),(W=b.search(/e/i))>0?(H<0&&(H=W),H+=+b.slice(W+1),b=b.substring(0,W)):H<0&&(H=b.length)}else{if(A(x,2,ke.length,"Base"),x==10&&ft)return G=new Q(N),qe(G,O+G.e+1,L);if(b=String(N),F=typeof N=="number"){if(N*0!=0)return M(G,b,F,x);if(G.s=1/N<0?(b=b.slice(1),-1):1,Q.DEBUG&&b.replace(/^0\.0*|\./,"").length>15)throw Error(u+N)}else G.s=b.charCodeAt(0)===45?(b=b.slice(1),-1):1;for(U=ke.slice(0,x),H=W=0,P=b.length;W<P;W++)if(U.indexOf(V=b.charAt(W))<0){if(V=="."){if(W>H){H=P;continue}}else if(!q&&(b==b.toUpperCase()&&(b=b.toLowerCase())||b==b.toLowerCase()&&(b=b.toUpperCase()))){q=!0,W=-1,H=0;continue}return M(G,String(N),F,x)}F=!1,b=R(b,x,10,G.s),(H=b.indexOf("."))>-1?b=b.replace(".",""):H=b.length}for(W=0;b.charCodeAt(W)===48;W++);for(P=b.length;b.charCodeAt(--P)===48;);if(b=b.slice(W,++P)){if(P-=W,F&&Q.DEBUG&&P>15&&(N>m||N!==a(N)))throw Error(u+G.s*N);if((H=H-W-1)>j)G.c=G.e=null;else if(H<Y)G.c=[G.e=0];else{if(G.e=H,G.c=[],W=(H+1)%h,H<0&&(W+=h),W<P){for(W&&G.c.push(+b.slice(0,W)),P-=h;W<P;)G.c.push(+b.slice(W,W+=h));W=h-(b=b.slice(W)).length}else W-=P;for(;W--;b+="0");G.c.push(+b)}}else G.c=[G.e=0]}p(Q,"BigNumber2"),Q.clone=y,Q.ROUND_UP=0,Q.ROUND_DOWN=1,Q.ROUND_CEIL=2,Q.ROUND_FLOOR=3,Q.ROUND_HALF_UP=4,Q.ROUND_HALF_DOWN=5,Q.ROUND_HALF_EVEN=6,Q.ROUND_HALF_CEIL=7,Q.ROUND_HALF_FLOOR=8,Q.EUCLID=9,Q.config=Q.set=function(N){var x,U;if(N!=null)if(typeof N=="object"){if(N.hasOwnProperty(x="DECIMAL_PLACES")&&(U=N[x],A(U,0,f,x),O=U),N.hasOwnProperty(x="ROUNDING_MODE")&&(U=N[x],A(U,0,8,x),L=U),N.hasOwnProperty(x="EXPONENTIAL_AT")&&(U=N[x],U&&U.pop?(A(U[0],-f,0,x),A(U[1],0,f,x),B=U[0],X=U[1]):(A(U,-f,f,x),B=-(X=U<0?-U:U))),N.hasOwnProperty(x="RANGE"))if(U=N[x],U&&U.pop)A(U[0],-f,-1,x),A(U[1],1,f,x),Y=U[0],j=U[1];else if(A(U,-f,f,x),U)Y=-(j=U<0?-U:U);else throw Error(c+x+" cannot be zero: "+U);if(N.hasOwnProperty(x="CRYPTO"))if(U=N[x],U===!!U)if(U)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))ie=U;else throw ie=!U,Error(c+"crypto unavailable");else ie=U;else throw Error(c+x+" not true or false: "+U);if(N.hasOwnProperty(x="MODULO_MODE")&&(U=N[x],A(U,0,9,x),oe=U),N.hasOwnProperty(x="POW_PRECISION")&&(U=N[x],A(U,0,f,x),Re=U),N.hasOwnProperty(x="FORMAT"))if(U=N[x],typeof U=="object")et=U;else throw Error(c+x+" not an object: "+U);if(N.hasOwnProperty(x="ALPHABET"))if(U=N[x],typeof U=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(U))ft=U.slice(0,10)=="0123456789",ke=U;else throw Error(c+x+" invalid: "+U)}else throw Error(c+"Object expected: "+N);return{DECIMAL_PLACES:O,ROUNDING_MODE:L,EXPONENTIAL_AT:[B,X],RANGE:[Y,j],CRYPTO:ie,MODULO_MODE:oe,POW_PRECISION:Re,FORMAT:et,ALPHABET:ke}},Q.isBigNumber=function(N){if(!N||N._isBigNumber!==!0)return!1;if(!Q.DEBUG)return!0;var x,U,V=N.c,q=N.e,H=N.s;e:if({}.toString.call(V)=="[object Array]"){if((H===1||H===-1)&&q>=-f&&q<=f&&q===a(q)){if(V[0]===0){if(q===0&&V.length===1)return!0;break e}if(x=(q+1)%h,x<1&&(x+=h),String(V[0]).length==x){for(x=0;x<V.length;x++)if(U=V[x],U<0||U>=d||U!==a(U))break e;if(U!==0)return!0}}}else if(V===null&&q===null&&(H===null||H===1||H===-1))return!0;throw Error(c+"Invalid BigNumber: "+N)},Q.maximum=Q.max=function(){return zt(arguments,-1)},Q.minimum=Q.min=function(){return zt(arguments,1)},Q.random=(function(){var N=9007199254740992,x=Math.random()*N&2097151?function(){return a(Math.random()*N)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(U){var V,q,H,W,F,P=0,b=[],G=new Q(J);if(U==null?U=O:A(U,0,f),W=o(U/h),ie)if(crypto.getRandomValues){for(V=crypto.getRandomValues(new Uint32Array(W*=2));P<W;)F=V[P]*131072+(V[P+1]>>>11),F>=9e15?(q=crypto.getRandomValues(new Uint32Array(2)),V[P]=q[0],V[P+1]=q[1]):(b.push(F%1e14),P+=2);P=W/2}else if(crypto.randomBytes){for(V=crypto.randomBytes(W*=7);P<W;)F=(V[P]&31)*281474976710656+V[P+1]*1099511627776+V[P+2]*4294967296+V[P+3]*16777216+(V[P+4]<<16)+(V[P+5]<<8)+V[P+6],F>=9e15?crypto.randomBytes(7).copy(V,P):(b.push(F%1e14),P+=7);P=W/7}else throw ie=!1,Error(c+"crypto unavailable");if(!ie)for(;P<W;)F=x(),F<9e15&&(b[P++]=F%1e14);for(W=b[--P],U%=h,W&&U&&(F=g[h-U],b[P]=a(W/F)*F);b[P]===0;b.pop(),P--);if(P<0)b=[H=0];else{for(H=-1;b[0]===0;b.splice(0,1),H-=h);for(P=1,F=b[0];F>=10;F/=10,P++);P<h&&(H-=h-P)}return G.e=H,G.c=b,G}})(),Q.sum=function(){for(var N=1,x=arguments,U=new Q(x[0]);N<x.length;)U=U.plus(x[N++]);return U},R=(function(){var N="0123456789";function x(U,V,q,H){for(var W,F=[0],P,b=0,G=U.length;b<G;){for(P=F.length;P--;F[P]*=V);for(F[0]+=H.indexOf(U.charAt(b++)),W=0;W<F.length;W++)F[W]>q-1&&(F[W+1]==null&&(F[W+1]=0),F[W+1]+=F[W]/q|0,F[W]%=q)}return F.reverse()}return p(x,"toBaseOut"),function(U,V,q,H,W){var F,P,b,G,$,K,Z,ae,ce=U.indexOf("."),Se=O,le=L;for(ce>=0&&(G=Re,Re=0,U=U.replace(".",""),ae=new Q(V),K=ae.pow(U.length-ce),Re=G,ae.c=x(I(C(K.c),K.e,"0"),10,q,N),ae.e=ae.c.length),Z=x(U,V,q,W?(F=ke,N):(F=N,ke)),b=G=Z.length;Z[--G]==0;Z.pop());if(!Z[0])return F.charAt(0);if(ce<0?--b:(K.c=Z,K.e=b,K.s=H,K=k(K,ae,Se,le,q),Z=K.c,$=K.r,b=K.e),P=b+Se+1,ce=Z[P],G=q/2,$=$||P<0||Z[P+1]!=null,$=le<4?(ce!=null||$)&&(le==0||le==(K.s<0?3:2)):ce>G||ce==G&&(le==4||$||le==6&&Z[P-1]&1||le==(K.s<0?8:7)),P<1||!Z[0])U=$?I(F.charAt(1),-Se,F.charAt(0)):F.charAt(0);else{if(Z.length=P,$)for(--q;++Z[--P]>q;)Z[P]=0,P||(++b,Z=[1].concat(Z));for(G=Z.length;!Z[--G];);for(ce=0,U="";ce<=G;U+=F.charAt(Z[ce++]));U=I(U,b,F.charAt(0))}return U}})(),k=(function(){function N(V,q,H){var W,F,P,b,G=0,$=V.length,K=q%_,Z=q/_|0;for(V=V.slice();$--;)P=V[$]%_,b=V[$]/_|0,W=Z*P+b*K,F=K*P+W%_*_+G,G=(F/H|0)+(W/_|0)+Z*b,V[$]=F%H;return G&&(V=[G].concat(V)),V}p(N,"multiply");function x(V,q,H,W){var F,P;if(H!=W)P=H>W?1:-1;else for(F=P=0;F<H;F++)if(V[F]!=q[F]){P=V[F]>q[F]?1:-1;break}return P}p(x,"compare2");function U(V,q,H,W){for(var F=0;H--;)V[H]-=F,F=V[H]<q[H]?1:0,V[H]=F*W+V[H]-q[H];for(;!V[0]&&V.length>1;V.splice(0,1));}return p(U,"subtract"),function(V,q,H,W,F){var P,b,G,$,K,Z,ae,ce,Se,le,de,be,Ye,tt,Pe,se,Me,Ue=V.s==q.s?1:-1,De=V.c,Te=q.c;if(!De||!De[0]||!Te||!Te[0])return new Q(!V.s||!q.s||(De?Te&&De[0]==Te[0]:!Te)?NaN:De&&De[0]==0||!Te?Ue*0:Ue/0);for(ce=new Q(Ue),Se=ce.c=[],b=V.e-q.e,Ue=H+b+1,F||(F=d,b=E(V.e/h)-E(q.e/h),Ue=Ue/h|0),G=0;Te[G]==(De[G]||0);G++);if(Te[G]>(De[G]||0)&&b--,Ue<0)Se.push(1),$=!0;else{for(tt=De.length,se=Te.length,G=0,Ue+=2,K=a(F/(Te[0]+1)),K>1&&(Te=N(Te,K,F),De=N(De,K,F),se=Te.length,tt=De.length),Ye=se,le=De.slice(0,se),de=le.length;de<se;le[de++]=0);Me=Te.slice(),Me=[0].concat(Me),Pe=Te[0],Te[1]>=F/2&&Pe++;do{if(K=0,P=x(Te,le,se,de),P<0){if(be=le[0],se!=de&&(be=be*F+(le[1]||0)),K=a(be/Pe),K>1)for(K>=F&&(K=F-1),Z=N(Te,K,F),ae=Z.length,de=le.length;x(Z,le,ae,de)==1;)K--,U(Z,se<ae?Me:Te,ae,F),ae=Z.length,P=1;else K==0&&(P=K=1),Z=Te.slice(),ae=Z.length;if(ae<de&&(Z=[0].concat(Z)),U(le,Z,de,F),de=le.length,P==-1)for(;x(Te,le,se,de)<1;)K++,U(le,se<de?Me:Te,de,F),de=le.length}else P===0&&(K++,le=[0]);Se[G++]=K,le[0]?le[de++]=De[Ye]||0:(le=[De[Ye]],de=1)}while((Ye++<tt||le[0]!=null)&&Ue--);$=le[0]!=null,Se[0]||Se.splice(0,1)}if(F==d){for(G=1,Ue=Se[0];Ue>=10;Ue/=10,G++);qe(ce,H+(ce.e=G+b*h-1)+1,W,$)}else ce.e=b,ce.r=+$;return ce}})();function Ft(N,x,U,V){var q,H,W,F,P;if(U==null?U=L:A(U,0,8),!N.c)return N.toString();if(q=N.c[0],W=N.e,x==null)P=C(N.c),P=V==1||V==2&&(W<=B||W>=X)?T(P,W):I(P,W,"0");else if(N=qe(new Q(N),x,U),H=N.e,P=C(N.c),F=P.length,V==1||V==2&&(x<=H||H<=B)){for(;F<x;P+="0",F++);P=T(P,H)}else if(x-=W+(V===2&&H>W),P=I(P,H,"0"),H+1>F){if(--x>0)for(P+=".";x--;P+="0");}else if(x+=H-F,x>0)for(H+1==F&&(P+=".");x--;P+="0");return N.s<0&&q?"-"+P:P}p(Ft,"format");function zt(N,x){for(var U,V,q=1,H=new Q(N[0]);q<N.length;q++)V=new Q(N[q]),(!V.s||(U=S(H,V))===x||U===0&&H.s===x)&&(H=V);return H}p(zt,"maxOrMin");function Ct(N,x,U){for(var V=1,q=x.length;!x[--q];x.pop());for(q=x[0];q>=10;q/=10,V++);return(U=V+U*h-1)>j?N.c=N.e=null:U<Y?N.c=[N.e=0]:(N.e=U,N.c=x),N}p(Ct,"normalise"),M=(function(){var N=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,U=/^\.([^.]+)$/,V=/^-?(Infinity|NaN)$/,q=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(H,W,F,P){var b,G=F?W:W.replace(q,"");if(V.test(G))H.s=isNaN(G)?null:G<0?-1:1;else{if(!F&&(G=G.replace(N,function($,K,Z){return b=(Z=Z.toLowerCase())=="x"?16:Z=="b"?2:8,!P||P==b?K:$}),P&&(b=P,G=G.replace(x,"$1").replace(U,"0.$1")),W!=G))return new Q(G,b);if(Q.DEBUG)throw Error(c+"Not a"+(P?" base "+P:"")+" number: "+W);H.s=null}H.c=H.e=null}})();function qe(N,x,U,V){var q,H,W,F,P,b,G,$=N.c,K=g;if($){e:{for(q=1,F=$[0];F>=10;F/=10,q++);if(H=x-q,H<0)H+=h,W=x,P=$[b=0],G=a(P/K[q-W-1]%10);else if(b=o((H+1)/h),b>=$.length)if(V){for(;$.length<=b;$.push(0));P=G=0,q=1,H%=h,W=H-h+1}else break e;else{for(P=F=$[b],q=1;F>=10;F/=10,q++);H%=h,W=H-h+q,G=W<0?0:a(P/K[q-W-1]%10)}if(V=V||x<0||$[b+1]!=null||(W<0?P:P%K[q-W-1]),V=U<4?(G||V)&&(U==0||U==(N.s<0?3:2)):G>5||G==5&&(U==4||V||U==6&&(H>0?W>0?P/K[q-W]:0:$[b-1])%10&1||U==(N.s<0?8:7)),x<1||!$[0])return $.length=0,V?(x-=N.e+1,$[0]=K[(h-x%h)%h],N.e=-x||0):$[0]=N.e=0,N;if(H==0?($.length=b,F=1,b--):($.length=b+1,F=K[h-H],$[b]=W>0?a(P/K[q-W]%K[W])*F:0),V)for(;;)if(b==0){for(H=1,W=$[0];W>=10;W/=10,H++);for(W=$[0]+=F,F=1;W>=10;W/=10,F++);H!=F&&(N.e++,$[0]==d&&($[0]=1));break}else{if($[b]+=F,$[b]!=d)break;$[b--]=0,F=1}for(H=$.length;$[--H]===0;$.pop());}N.e>j?N.c=N.e=null:N.e<Y&&(N.c=[N.e=0])}return N}p(qe,"round");function We(N){var x,U=N.e;return U===null?N.toString():(x=C(N.c),x=U<=B||U>=X?T(x,U):I(x,U,"0"),N.s<0?"-"+x:x)}return p(We,"valueOf"),D.absoluteValue=D.abs=function(){var N=new Q(this);return N.s<0&&(N.s=1),N},D.comparedTo=function(N,x){return S(this,new Q(N,x))},D.decimalPlaces=D.dp=function(N,x){var U,V,q,H=this;if(N!=null)return A(N,0,f),x==null?x=L:A(x,0,8),qe(new Q(H),N+H.e+1,x);if(!(U=H.c))return null;if(V=((q=U.length-1)-E(this.e/h))*h,q=U[q])for(;q%10==0;q/=10,V--);return V<0&&(V=0),V},D.dividedBy=D.div=function(N,x){return k(this,new Q(N,x),O,L)},D.dividedToIntegerBy=D.idiv=function(N,x){return k(this,new Q(N,x),0,1)},D.exponentiatedBy=D.pow=function(N,x){var U,V,q,H,W,F,P,b,G,$=this;if(N=new Q(N),N.c&&!N.isInteger())throw Error(c+"Exponent not an integer: "+We(N));if(x!=null&&(x=new Q(x)),F=N.e>14,!$.c||!$.c[0]||$.c[0]==1&&!$.e&&$.c.length==1||!N.c||!N.c[0])return G=new Q(Math.pow(+We($),F?N.s*(2-v(N)):+We(N))),x?G.mod(x):G;if(P=N.s<0,x){if(x.c?!x.c[0]:!x.s)return new Q(NaN);V=!P&&$.isInteger()&&x.isInteger(),V&&($=$.mod(x))}else{if(N.e>9&&($.e>0||$.e<-1||($.e==0?$.c[0]>1||F&&$.c[1]>=24e7:$.c[0]<8e13||F&&$.c[0]<=9999975e7)))return H=$.s<0&&v(N)?-0:0,$.e>-1&&(H=1/H),new Q(P?1/H:H);Re&&(H=o(Re/h+2))}for(F?(U=new Q(.5),P&&(N.s=1),b=v(N)):(q=Math.abs(+We(N)),b=q%2),G=new Q(J);;){if(b){if(G=G.times($),!G.c)break;H?G.c.length>H&&(G.c.length=H):V&&(G=G.mod(x))}if(q){if(q=a(q/2),q===0)break;b=q%2}else if(N=N.times(U),qe(N,N.e+1,1),N.e>14)b=v(N);else{if(q=+We(N),q===0)break;b=q%2}$=$.times($),H?$.c&&$.c.length>H&&($.c.length=H):V&&($=$.mod(x))}return V?G:(P&&(G=J.div(G)),x?G.mod(x):H?qe(G,Re,L,W):G)},D.integerValue=function(N){var x=new Q(this);return N==null?N=L:A(N,0,8),qe(x,x.e+1,N)},D.isEqualTo=D.eq=function(N,x){return S(this,new Q(N,x))===0},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(N,x){return S(this,new Q(N,x))>0},D.isGreaterThanOrEqualTo=D.gte=function(N,x){return(x=S(this,new Q(N,x)))===1||x===0},D.isInteger=function(){return!!this.c&&E(this.e/h)>this.c.length-2},D.isLessThan=D.lt=function(N,x){return S(this,new Q(N,x))<0},D.isLessThanOrEqualTo=D.lte=function(N,x){return(x=S(this,new Q(N,x)))===-1||x===0},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&this.c[0]==0},D.minus=function(N,x){var U,V,q,H,W=this,F=W.s;if(N=new Q(N,x),x=N.s,!F||!x)return new Q(NaN);if(F!=x)return N.s=-x,W.plus(N);var P=W.e/h,b=N.e/h,G=W.c,$=N.c;if(!P||!b){if(!G||!$)return G?(N.s=-x,N):new Q($?W:NaN);if(!G[0]||!$[0])return $[0]?(N.s=-x,N):new Q(G[0]?W:L==3?-0:0)}if(P=E(P),b=E(b),G=G.slice(),F=P-b){for((H=F<0)?(F=-F,q=G):(b=P,q=$),q.reverse(),x=F;x--;q.push(0));q.reverse()}else for(V=(H=(F=G.length)<(x=$.length))?F:x,F=x=0;x<V;x++)if(G[x]!=$[x]){H=G[x]<$[x];break}if(H&&(q=G,G=$,$=q,N.s=-N.s),x=(V=$.length)-(U=G.length),x>0)for(;x--;G[U++]=0);for(x=d-1;V>F;){if(G[--V]<$[V]){for(U=V;U&&!G[--U];G[U]=x);--G[U],G[V]+=d}G[V]-=$[V]}for(;G[0]==0;G.splice(0,1),--b);return G[0]?Ct(N,G,b):(N.s=L==3?-1:1,N.c=[N.e=0],N)},D.modulo=D.mod=function(N,x){var U,V,q=this;return N=new Q(N,x),!q.c||!N.s||N.c&&!N.c[0]?new Q(NaN):!N.c||q.c&&!q.c[0]?new Q(q):(oe==9?(V=N.s,N.s=1,U=k(q,N,0,3),N.s=V,U.s*=V):U=k(q,N,0,oe),N=q.minus(U.times(N)),!N.c[0]&&oe==1&&(N.s=q.s),N)},D.multipliedBy=D.times=function(N,x){var U,V,q,H,W,F,P,b,G,$,K,Z,ae,ce,Se,le=this,de=le.c,be=(N=new Q(N,x)).c;if(!de||!be||!de[0]||!be[0])return!le.s||!N.s||de&&!de[0]&&!be||be&&!be[0]&&!de?N.c=N.e=N.s=null:(N.s*=le.s,!de||!be?N.c=N.e=null:(N.c=[0],N.e=0)),N;for(V=E(le.e/h)+E(N.e/h),N.s*=le.s,P=de.length,$=be.length,P<$&&(ae=de,de=be,be=ae,q=P,P=$,$=q),q=P+$,ae=[];q--;ae.push(0));for(ce=d,Se=_,q=$;--q>=0;){for(U=0,K=be[q]%Se,Z=be[q]/Se|0,W=P,H=q+W;H>q;)b=de[--W]%Se,G=de[W]/Se|0,F=Z*b+G*K,b=K*b+F%Se*Se+ae[H]+U,U=(b/ce|0)+(F/Se|0)+Z*G,ae[H--]=b%ce;ae[H]=U}return U?++V:ae.splice(0,1),Ct(N,ae,V)},D.negated=function(){var N=new Q(this);return N.s=-N.s||null,N},D.plus=function(N,x){var U,V=this,q=V.s;if(N=new Q(N,x),x=N.s,!q||!x)return new Q(NaN);if(q!=x)return N.s=-x,V.minus(N);var H=V.e/h,W=N.e/h,F=V.c,P=N.c;if(!H||!W){if(!F||!P)return new Q(q/0);if(!F[0]||!P[0])return P[0]?N:new Q(F[0]?V:q*0)}if(H=E(H),W=E(W),F=F.slice(),q=H-W){for(q>0?(W=H,U=P):(q=-q,U=F),U.reverse();q--;U.push(0));U.reverse()}for(q=F.length,x=P.length,q-x<0&&(U=P,P=F,F=U,x=q),q=0;x;)q=(F[--x]=F[x]+P[x]+q)/d|0,F[x]=d===F[x]?0:F[x]%d;return q&&(F=[q].concat(F),++W),Ct(N,F,W)},D.precision=D.sd=function(N,x){var U,V,q,H=this;if(N!=null&&N!==!!N)return A(N,1,f),x==null?x=L:A(x,0,8),qe(new Q(H),N,x);if(!(U=H.c))return null;if(q=U.length-1,V=q*h+1,q=U[q]){for(;q%10==0;q/=10,V--);for(q=U[0];q>=10;q/=10,V++);}return N&&H.e+1>V&&(V=H.e+1),V},D.shiftedBy=function(N){return A(N,-m,m),this.times("1e"+N)},D.squareRoot=D.sqrt=function(){var N,x,U,V,q,H=this,W=H.c,F=H.s,P=H.e,b=O+4,G=new Q("0.5");if(F!==1||!W||!W[0])return new Q(!F||F<0&&(!W||W[0])?NaN:W?H:1/0);if(F=Math.sqrt(+We(H)),F==0||F==1/0?(x=C(W),(x.length+P)%2==0&&(x+="0"),F=Math.sqrt(+x),P=E((P+1)/2)-(P<0||P%2),F==1/0?x="5e"+P:(x=F.toExponential(),x=x.slice(0,x.indexOf("e")+1)+P),U=new Q(x)):U=new Q(F+""),U.c[0]){for(P=U.e,F=P+b,F<3&&(F=0);;)if(q=U,U=G.times(q.plus(k(H,q,b,1))),C(q.c).slice(0,F)===(x=C(U.c)).slice(0,F))if(U.e<P&&--F,x=x.slice(F-3,F+1),x=="9999"||!V&&x=="4999"){if(!V&&(qe(q,q.e+O+2,0),q.times(q).eq(H))){U=q;break}b+=4,F+=4,V=1}else{(!+x||!+x.slice(1)&&x.charAt(0)=="5")&&(qe(U,U.e+O+2,1),N=!U.times(U).eq(H));break}}return qe(U,U.e+O+1,L,N)},D.toExponential=function(N,x){return N!=null&&(A(N,0,f),N++),Ft(this,N,x,1)},D.toFixed=function(N,x){return N!=null&&(A(N,0,f),N=N+this.e+1),Ft(this,N,x)},D.toFormat=function(N,x,U){var V,q=this;if(U==null)N!=null&&x&&typeof x=="object"?(U=x,x=null):N&&typeof N=="object"?(U=N,N=x=null):U=et;else if(typeof U!="object")throw Error(c+"Argument not an object: "+U);if(V=q.toFixed(N,x),q.c){var H,W=V.split("."),F=+U.groupSize,P=+U.secondaryGroupSize,b=U.groupSeparator||"",G=W[0],$=W[1],K=q.s<0,Z=K?G.slice(1):G,ae=Z.length;if(P&&(H=F,F=P,P=H,ae-=H),F>0&&ae>0){for(H=ae%F||F,G=Z.substr(0,H);H<ae;H+=F)G+=b+Z.substr(H,F);P>0&&(G+=b+Z.slice(H)),K&&(G="-"+G)}V=$?G+(U.decimalSeparator||"")+((P=+U.fractionGroupSize)?$.replace(new RegExp("\\d{"+P+"}\\B","g"),"$&"+(U.fractionGroupSeparator||"")):$):G}return(U.prefix||"")+V+(U.suffix||"")},D.toFraction=function(N){var x,U,V,q,H,W,F,P,b,G,$,K,Z=this,ae=Z.c;if(N!=null&&(F=new Q(N),!F.isInteger()&&(F.c||F.s!==1)||F.lt(J)))throw Error(c+"Argument "+(F.isInteger()?"out of range: ":"not an integer: ")+We(F));if(!ae)return new Q(Z);for(x=new Q(J),b=U=new Q(J),V=P=new Q(J),K=C(ae),H=x.e=K.length-Z.e-1,x.c[0]=g[(W=H%h)<0?h+W:W],N=!N||F.comparedTo(x)>0?H>0?x:b:F,W=j,j=1/0,F=new Q(K),P.c[0]=0;G=k(F,x,0,1),q=U.plus(G.times(V)),q.comparedTo(N)!=1;)U=V,V=q,b=P.plus(G.times(q=b)),P=q,x=F.minus(G.times(q=x)),F=q;return q=k(N.minus(U),V,0,1),P=P.plus(q.times(b)),U=U.plus(q.times(V)),P.s=b.s=Z.s,H=H*2,$=k(b,V,H,L).minus(Z).abs().comparedTo(k(P,U,H,L).minus(Z).abs())<1?[b,V]:[P,U],j=W,$},D.toNumber=function(){return+We(this)},D.toPrecision=function(N,x){return N!=null&&A(N,1,f),Ft(this,N,x,2)},D.toString=function(N){var x,U=this,V=U.s,q=U.e;return q===null?V?(x="Infinity",V<0&&(x="-"+x)):x="NaN":(N==null?x=q<=B||q>=X?T(C(U.c),q):I(C(U.c),q,"0"):N===10&&ft?(U=qe(new Q(U),O+q+1,L),x=I(C(U.c),U.e,"0")):(A(N,2,ke.length,"Base"),x=R(I(C(U.c),q,"0"),10,N,V,!0)),V<0&&U.c[0]&&(x="-"+x)),x},D.valueOf=D.toJSON=function(){return We(this)},D._isBigNumber=!0,w!=null&&Q.set(w),Q}p(y,"clone");function E(w){var k=w|0;return w>0||w===k?k:k-1}p(E,"bitFloor");function C(w){for(var k,R,M=1,D=w.length,J=w[0]+"";M<D;){for(k=w[M++]+"",R=h-k.length;R--;k="0"+k);J+=k}for(D=J.length;J.charCodeAt(--D)===48;);return J.slice(0,D+1||1)}p(C,"coeffToString");function S(w,k){var R,M,D=w.c,J=k.c,O=w.s,L=k.s,B=w.e,X=k.e;if(!O||!L)return null;if(R=D&&!D[0],M=J&&!J[0],R||M)return R?M?0:-L:O;if(O!=L)return O;if(R=O<0,M=B==X,!D||!J)return M?0:!D^R?1:-1;if(!M)return B>X^R?1:-1;for(L=(B=D.length)<(X=J.length)?B:X,O=0;O<L;O++)if(D[O]!=J[O])return D[O]>J[O]^R?1:-1;return B==X?0:B>X^R?1:-1}p(S,"compare");function A(w,k,R,M){if(w<k||w>R||w!==a(w))throw Error(c+(M||"Argument")+(typeof w=="number"?w<k||w>R?" out of range: ":" not an integer: ":" not a primitive number: ")+String(w))}p(A,"intCheck");function v(w){var k=w.c.length-1;return E(w.e/h)==k&&w.c[k]%2!=0}p(v,"isOdd");function T(w,k){return(w.length>1?w.charAt(0)+"."+w.slice(1):w)+(k<0?"e":"e+")+k}p(T,"toExponential");function I(w,k,R){var M,D;if(k<0){for(D=R+".";++k;D+=R);w=D+w}else if(M=w.length,++k>M){for(D=R,k-=M;--k;D+=R);w+=D}else k<M&&(w=w.slice(0,k)+"."+w.slice(k));return w}p(I,"toFixedPoint"),n=y(),n.default=n.BigNumber=n,typeof define=="function"&&define.amd?define(function(){return n}):typeof t<"u"&&t.exports?t.exports=n:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=n)})(e)}}),il=z({"node_modules/json-bigint/lib/stringify.js"(e,t){var r=sn(),n=t.exports;(function(){"use strict";function i(_){return _<10?"0"+_:_}p(i,"f");var o=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,c,u,d={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},h;function m(_){return a.lastIndex=0,a.test(_)?'"'+_.replace(a,function(f){var y=d[f];return typeof y=="string"?y:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+_+'"'}p(m,"quote");function g(_,f){var y,E,C,S,A=c,v,T=f[_],I=T!=null&&(T instanceof r||r.isBigNumber(T));switch(T&&typeof T=="object"&&typeof T.toJSON=="function"&&(T=T.toJSON(_)),typeof h=="function"&&(T=h.call(f,_,T)),typeof T){case"string":return I?T:m(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(c+=u,v=[],Object.prototype.toString.apply(T)==="[object Array]"){for(S=T.length,y=0;y<S;y+=1)v[y]=g(y,T)||"null";return C=v.length===0?"[]":c?`[
|
|
7
|
+
`+c+v.join(`,
|
|
8
|
+
`+c)+`
|
|
9
|
+
`+A+"]":"["+v.join(",")+"]",c=A,C}if(h&&typeof h=="object")for(S=h.length,y=0;y<S;y+=1)typeof h[y]=="string"&&(E=h[y],C=g(E,T),C&&v.push(m(E)+(c?": ":":")+C));else Object.keys(T).forEach(function(w){var k=g(w,T);k&&v.push(m(w)+(c?": ":":")+k)});return C=v.length===0?"{}":c?`{
|
|
10
|
+
`+c+v.join(`,
|
|
11
|
+
`+c)+`
|
|
12
|
+
`+A+"}":"{"+v.join(",")+"}",c=A,C}}p(g,"str"),typeof n.stringify!="function"&&(n.stringify=function(_,f,y){var E;if(c="",u="",typeof y=="number")for(E=0;E<y;E+=1)u+=" ";else typeof y=="string"&&(u=y);if(h=f,f&&typeof f!="function"&&(typeof f!="object"||typeof f.length!="number"))throw new Error("JSON.stringify");return g("",{"":_})})})()}}),ol=z({"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])/,i=/(?: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)/,o=p(function(a){"use strict";var c={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(a!=null){if(a.strict===!0&&(c.strict=!0),a.storeAsString===!0&&(c.storeAsString=!0),c.alwaysParseAsBig=a.alwaysParseAsBig===!0?a.alwaysParseAsBig:!1,c.useNativeBigInt=a.useNativeBigInt===!0?a.useNativeBigInt:!1,typeof a.constructorAction<"u")if(a.constructorAction==="error"||a.constructorAction==="ignore"||a.constructorAction==="preserve")c.constructorAction=a.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${a.constructorAction}`);if(typeof a.protoAction<"u")if(a.protoAction==="error"||a.protoAction==="ignore"||a.protoAction==="preserve")c.protoAction=a.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${a.protoAction}`)}var u,d,h={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
13
|
+
`,r:"\r",t:" "},m,g=p(function(T){throw{name:"SyntaxError",message:T,at:u,text:m}},"error"),_=p(function(T){return T&&T!==d&&g("Expected '"+T+"' instead of '"+d+"'"),d=m.charAt(u),u+=1,d},"next"),f=p(function(){var T,I="";for(d==="-"&&(I="-",_("-"));d>="0"&&d<="9";)I+=d,_();if(d===".")for(I+=".";_()&&d>="0"&&d<="9";)I+=d;if(d==="e"||d==="E")for(I+=d,_(),(d==="-"||d==="+")&&(I+=d,_());d>="0"&&d<="9";)I+=d,_();if(T=+I,!isFinite(T))g("Bad number");else return r==null&&(r=sn()),I.length>15?c.storeAsString?I:c.useNativeBigInt?BigInt(I):new r(I):c.alwaysParseAsBig?c.useNativeBigInt?BigInt(T):new r(T):T},"number"),y=p(function(){var T,I,w="",k;if(d==='"')for(var R=u;_();){if(d==='"')return u-1>R&&(w+=m.substring(R,u-1)),_(),w;if(d==="\\"){if(u-1>R&&(w+=m.substring(R,u-1)),_(),d==="u"){for(k=0,I=0;I<4&&(T=parseInt(_(),16),!!isFinite(T));I+=1)k=k*16+T;w+=String.fromCharCode(k)}else if(typeof h[d]=="string")w+=h[d];else break;R=u}}g("Bad string")},"string"),E=p(function(){for(;d&&d<=" ";)_()},"white"),C=p(function(){switch(d){case"t":return _("t"),_("r"),_("u"),_("e"),!0;case"f":return _("f"),_("a"),_("l"),_("s"),_("e"),!1;case"n":return _("n"),_("u"),_("l"),_("l"),null}g("Unexpected '"+d+"'")},"word"),S,A=p(function(){var T=[];if(d==="["){if(_("["),E(),d==="]")return _("]"),T;for(;d;){if(T.push(S()),E(),d==="]")return _("]"),T;_(","),E()}}g("Bad array")},"array"),v=p(function(){var T,I=Object.create(null);if(d==="{"){if(_("{"),E(),d==="}")return _("}"),I;for(;d;){if(T=y(),E(),_(":"),c.strict===!0&&Object.hasOwnProperty.call(I,T)&&g('Duplicate key "'+T+'"'),n.test(T)===!0?c.protoAction==="error"?g("Object contains forbidden prototype property"):c.protoAction==="ignore"?S():I[T]=S():i.test(T)===!0?c.constructorAction==="error"?g("Object contains forbidden constructor property"):c.constructorAction==="ignore"?S():I[T]=S():I[T]=S(),E(),d==="}")return _("}"),I;_(","),E()}}g("Bad object")},"object");return S=p(function(){switch(E(),d){case"{":return v();case"[":return A();case'"':return y();case"-":return f();default:return d>="0"&&d<="9"?f():C()}},"value"),function(T,I){var w;return m=T+"",u=0,d=" ",w=S(),E(),d&&g("Syntax error"),typeof I=="function"?p((function k(R,M){var D,J,O=R[M];return O&&typeof O=="object"&&Object.keys(O).forEach(function(L){J=k(O,L),J!==void 0?O[L]=J:delete O[L]}),I.call(R,M,O)}),"walk")({"":w},""):w}},"json_parse");t.exports=o}}),sl=z({"node_modules/json-bigint/index.js"(e,t){var r=il().stringify,n=ol();t.exports=function(i){return{parse:n(i),stringify:r}},t.exports.parse=n(),t.exports.stringify=r}}),an=z({"node_modules/gcp-metadata/build/src/gcp-residency.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GCE_LINUX_BIOS_PATHS=void 0,e.isGoogleCloudServerless=i,e.isGoogleComputeEngineLinux=o,e.isGoogleComputeEngineMACAddress=a,e.isGoogleComputeEngine=c,e.detectGCPResidency=u;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 i(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}p(i,"isGoogleCloudServerless");function o(){if((0,r.platform)()!=="linux")return!1;try{(0,t.statSync)(e.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let d=(0,t.readFileSync)(e.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(d)}catch{return!1}}p(o,"isGoogleComputeEngineLinux");function a(){let d=(0,r.networkInterfaces)();for(let h of Object.values(d))if(h){for(let{mac:m}of h)if(n.test(m))return!0}return!1}p(a,"isGoogleComputeEngineMACAddress");function c(){return o()||a()}p(c,"isGoogleComputeEngine");function u(){return i()||c()}p(u,"detectGCPResidency")}}),al=z({"node_modules/google-logging-utils/build/src/colours.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Colours=void 0;var t=class we{static{p(this,"_Colours")}static isEnabled(n){return n&&n.isTTY&&(typeof n.getColorDepth=="function"?n.getColorDepth()>2:!0)}static refresh(){we.enabled=we.isEnabled(process==null?void 0:process.stderr),this.enabled?(we.reset="\x1B[0m",we.bright="\x1B[1m",we.dim="\x1B[2m",we.red="\x1B[31m",we.green="\x1B[32m",we.yellow="\x1B[33m",we.blue="\x1B[34m",we.magenta="\x1B[35m",we.cyan="\x1B[36m",we.white="\x1B[37m",we.grey="\x1B[90m"):(we.reset="",we.bright="",we.dim="",we.red="",we.green="",we.yellow="",we.blue="",we.magenta="",we.cyan="",we.white="",we.grey="")}};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()}}),ll=z({"node_modules/google-logging-utils/build/src/logging-utils.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(T,I,w,k){k===void 0&&(k=w);var R=Object.getOwnPropertyDescriptor(I,w);(!R||("get"in R?!I.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:p(function(){return I[w]},"get")}),Object.defineProperty(T,k,R)}):(function(T,I,w,k){k===void 0&&(k=w),T[k]=I[w]})),r=e&&e.__setModuleDefault||(Object.create?(function(T,I){Object.defineProperty(T,"default",{enumerable:!0,value:I})}):function(T,I){T.default=I}),n=e&&e.__importStar||(function(){var T=p(function(I){return T=Object.getOwnPropertyNames||function(w){var k=[];for(var R in w)Object.prototype.hasOwnProperty.call(w,R)&&(k[k.length]=R);return k},T(I)},"ownKeys");return function(I){if(I&&I.__esModule)return I;var w={};if(I!=null)for(var k=T(I),R=0;R<k.length;R++)k[R]!=="default"&&t(w,I,k[R]);return r(w,I),w}})();Object.defineProperty(e,"__esModule",{value:!0}),e.env=e.DebugLogBackendBase=e.placeholder=e.AdhocDebugLogger=e.LogSeverity=void 0,e.getNodeBackend=g,e.getDebugBackend=f,e.getStructuredBackend=E,e.setBackend=A,e.log=v;var i=te("events"),o=n(te("process")),a=n(te("util")),c=al(),u;(function(T){T.DEFAULT="DEFAULT",T.DEBUG="DEBUG",T.INFO="INFO",T.WARNING="WARNING",T.ERROR="ERROR"})(u||(e.LogSeverity=u={}));var d=class extends i.EventEmitter{static{p(this,"AdhocDebugLogger")}constructor(T,I){super(),this.namespace=T,this.upstream=I,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:p((w,k)=>this.on(w,k),"on")}),this.func.debug=(...w)=>this.invokeSeverity(u.DEBUG,...w),this.func.info=(...w)=>this.invokeSeverity(u.INFO,...w),this.func.warn=(...w)=>this.invokeSeverity(u.WARNING,...w),this.func.error=(...w)=>this.invokeSeverity(u.ERROR,...w),this.func.sublog=w=>v(w,this.func)}invoke(T,...I){if(this.upstream)try{this.upstream(T,...I)}catch{}try{this.emit("log",T,I)}catch{}}invokeSeverity(T,...I){this.invoke({severity:T},...I)}};e.AdhocDebugLogger=d,e.placeholder=new d("",()=>{}).func;var h=class{static{p(this,"DebugLogBackendBase")}constructor(){var T;this.cached=new Map,this.filters=[],this.filtersSet=!1;let I=(T=o.env[e.env.nodeEnables])!==null&&T!==void 0?T:"*";I==="all"&&(I="*"),this.filters=I.split(",")}log(T,I,...w){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let k=this.cached.get(T);k||(k=this.makeLogger(T),this.cached.set(T,k)),k(I,...w)}catch(k){console.error(k)}}};e.DebugLogBackendBase=h;var m=class extends h{static{p(this,"NodeBackend")}constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(T){return this.enabledRegexp.test(T)}makeLogger(T){return this.enabledRegexp.test(T)?(I,...w)=>{var k;let R=`${c.Colours.green}${T}${c.Colours.reset}`,M=`${c.Colours.yellow}${o.pid}${c.Colours.reset}`,D;switch(I.severity){case u.ERROR:D=`${c.Colours.red}${I.severity}${c.Colours.reset}`;break;case u.INFO:D=`${c.Colours.magenta}${I.severity}${c.Colours.reset}`;break;case u.WARNING:D=`${c.Colours.yellow}${I.severity}${c.Colours.reset}`;break;default:D=(k=I.severity)!==null&&k!==void 0?k:u.DEFAULT;break}let J=a.formatWithOptions({colors:c.Colours.enabled},...w),O=Object.assign({},I);delete O.severity;let L=Object.getOwnPropertyNames(O).length?JSON.stringify(O):"",B=L?`${c.Colours.grey}${L}${c.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",M,R,D,J,L?` ${B}`:"")}:()=>{}}setFilters(){let T=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${T}$`,"i")}};function g(){return new m}p(g,"getNodeBackend");var _=class extends h{static{p(this,"DebugBackend")}constructor(T){super(),this.debugPkg=T}makeLogger(T){let I=this.debugPkg(T);return(w,...k)=>{I(k[0],...k.slice(1))}}setFilters(){var T;let I=(T=o.env.NODE_DEBUG)!==null&&T!==void 0?T:"";o.env.NODE_DEBUG=`${I}${I?",":""}${this.filters.join(",")}`}};function f(T){return new _(T)}p(f,"getDebugBackend");var y=class extends h{static{p(this,"StructuredBackend")}constructor(T){var I;super(),this.upstream=(I=T)!==null&&I!==void 0?I:void 0}makeLogger(T){var I;let w=(I=this.upstream)===null||I===void 0?void 0:I.makeLogger(T);return(k,...R)=>{var M;let D=(M=k.severity)!==null&&M!==void 0?M:u.INFO,J=Object.assign({severity:D,message:a.format(...R)},k),O=JSON.stringify(J);w?w(k,O):console.log("%s",O)}}setFilters(){var T;(T=this.upstream)===null||T===void 0||T.setFilters()}};function E(T){return new y(T)}p(E,"getStructuredBackend"),e.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var C=new Map,S;function A(T){S=T,C.clear()}p(A,"setBackend");function v(T,I){if(!S&&!o.env[e.env.nodeEnables]||!T)return e.placeholder;I&&(T=`${I.instance.namespace}:${T}`);let w=C.get(T);if(w)return w.func;if(S===null)return e.placeholder;S===void 0&&(S=g());let k=(()=>{let R;return new d(T,(M,...D)=>{if(R!==S){if(S===null)return;S===void 0&&(S=g()),R=S}S?.log(T,M,...D)})})();return C.set(T,k),k.func}p(v,"log")}}),ln=z({"node_modules/google-logging-utils/build/src/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(n,i,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(i,o);(!c||("get"in c?!i.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:p(function(){return i[o]},"get")}),Object.defineProperty(n,a,c)}):(function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]})),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(ll(),e)}}),Zt=z({"node_modules/gcp-metadata/build/src/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(R,M,D,J){J===void 0&&(J=D);var O=Object.getOwnPropertyDescriptor(M,D);(!O||("get"in O?!M.__esModule:O.writable||O.configurable))&&(O={enumerable:!0,get:p(function(){return M[D]},"get")}),Object.defineProperty(R,J,O)}):(function(R,M,D,J){J===void 0&&(J=D),R[J]=M[D]})),r=e&&e.__setModuleDefault||(Object.create?(function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}):function(R,M){R.default=M}),n=e&&e.__importStar||(function(){var R=p(function(M){return R=Object.getOwnPropertyNames||function(D){var J=[];for(var O in D)Object.prototype.hasOwnProperty.call(D,O)&&(J[J.length]=O);return J},R(M)},"ownKeys");return function(M){if(M&&M.__esModule)return M;var D={};if(M!=null)for(var J=R(M),O=0;O<J.length;O++)J[O]!=="default"&&t(D,M,J[O]);return r(D,M),D}})(),i=e&&e.__exportStar||function(R,M){for(var D in R)D!=="default"&&!Object.prototype.hasOwnProperty.call(M,D)&&t(M,R,D)};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=f,e.project=y,e.universe=E,e.bulk=C,e.isAvailable=v,e.resetIsAvailableCache=T,e.getGCPResidency=I,e.setGCPResidency=w,e.requestTimeout=k;var o=Le(),a=sl(),c=an(),u=n(ln());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 d=u.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 h(R){return R||(R=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||e.HOST_ADDRESS),/^https?:\/\//.test(R)||(R=`http://${R}`),new URL(e.BASE_PATH,R).href}p(h,"getBaseUrl2");function m(R){Object.keys(R).forEach(M=>{switch(M){case"params":case"property":case"headers":break;case"qs":throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw new Error(`'${M}' is not a valid configuration option.`)}})}p(m,"validate");async function g(R,M={},D=3,J=!1){let O=new Headers(e.HEADERS),L="",B={};if(typeof R=="object"){let oe=R;new Headers(oe.headers).forEach((Re,et)=>O.set(et,Re)),L=oe.metadataKey,B=oe.params||B,D=oe.noResponseRetries||D,J=oe.fastFail||J}else L=R;typeof M=="string"?L+=`/${M}`:(m(M),M.property&&(L+=`/${M.property}`),new Headers(M.headers).forEach((oe,Re)=>O.set(Re,oe)),B=M.params||B);let X=J?_:o.request,Y={url:`${h()}/${L}`,headers:O,retryConfig:{noResponseRetries:D},params:B,responseType:"text",timeout:k()};d.info("instance request %j",Y);let j=await X(Y);d.info("instance metadata is %s",j.data);let ie=j.headers.get(e.HEADER_NAME);if(ie!==e.HEADER_VALUE)throw new RangeError(`Invalid response from metadata service: incorrect ${e.HEADER_NAME} header. Expected '${e.HEADER_VALUE}', got ${ie?`'${ie}'`:"no header"}`);if(typeof j.data=="string")try{return a.parse(j.data)}catch{}return j.data}p(g,"metadataAccessor");async function _(R){let M={...R,url:R.url?.toString().replace(h(),h(e.SECONDARY_HOST_ADDRESS))},D=(0,o.request)(R),J=(0,o.request)(M);return Promise.any([D,J])}p(_,"fastFailMetadataRequest");function f(R){return g("instance",R)}p(f,"instance");function y(R){return g("project",R)}p(y,"project");function E(R){return g("universe",R)}p(E,"universe");async function C(R){let M={};return await Promise.all(R.map(D=>(async()=>{let J=await g(D),O=D.metadataKey;M[O]=J})())),M}p(C,"bulk");function S(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}p(S,"detectGCPAvailableRetries");var A;async function v(){if(process.env.METADATA_SERVER_DETECTION){let R=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(R in e.METADATA_SERVER_DETECTION))throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${R}\`, but it should be \`${Object.keys(e.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(R){case"assume-present":return!0;case"none":return!1;case"bios-only":return I();case"ping-only":}}try{return A===void 0&&(A=g("instance",void 0,S(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await A,!0}catch(R){let M=R;if(process.env.DEBUG_AUTH&&console.info(M),M.type==="request-timeout"||M.response&&M.response.status===404)return!1;if(!(M.response&&M.response.status===404)&&(!M.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(M.code.toString()))){let D="UNKNOWN";M.code&&(D=M.code.toString()),process.emitWarning(`received unexpected error = ${M.message} code = ${D}`,"MetadataLookupWarning")}return!1}}p(v,"isAvailable");function T(){A=void 0}p(T,"resetIsAvailableCache"),e.gcpResidencyCache=null;function I(){return e.gcpResidencyCache===null&&w(),e.gcpResidencyCache}p(I,"getGCPResidency");function w(R=null){e.gcpResidencyCache=R!==null?R:(0,c.detectGCPResidency)()}p(w,"setGCPResidency");function k(){return I()?0:3e3}p(k,"requestTimeout"),i(an(),e)}}),ul=z({"node_modules/base64-js/index.js"(e){"use strict";e.byteLength=u,e.toByteArray=h,e.fromByteArray=_;var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(o=0,a=i.length;o<a;++o)t[o]=i[o],r[i.charCodeAt(o)]=o;var o,a;r[45]=62,r[95]=63;function c(f){var y=f.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=f.indexOf("=");E===-1&&(E=y);var C=E===y?0:4-E%4;return[E,C]}p(c,"getLens");function u(f){var y=c(f),E=y[0],C=y[1];return(E+C)*3/4-C}p(u,"byteLength");function d(f,y,E){return(y+E)*3/4-E}p(d,"_byteLength");function h(f){var y,E=c(f),C=E[0],S=E[1],A=new n(d(f,C,S)),v=0,T=S>0?C-4:C,I;for(I=0;I<T;I+=4)y=r[f.charCodeAt(I)]<<18|r[f.charCodeAt(I+1)]<<12|r[f.charCodeAt(I+2)]<<6|r[f.charCodeAt(I+3)],A[v++]=y>>16&255,A[v++]=y>>8&255,A[v++]=y&255;return S===2&&(y=r[f.charCodeAt(I)]<<2|r[f.charCodeAt(I+1)]>>4,A[v++]=y&255),S===1&&(y=r[f.charCodeAt(I)]<<10|r[f.charCodeAt(I+1)]<<4|r[f.charCodeAt(I+2)]>>2,A[v++]=y>>8&255,A[v++]=y&255),A}p(h,"toByteArray");function m(f){return t[f>>18&63]+t[f>>12&63]+t[f>>6&63]+t[f&63]}p(m,"tripletToBase64");function g(f,y,E){for(var C,S=[],A=y;A<E;A+=3)C=(f[A]<<16&16711680)+(f[A+1]<<8&65280)+(f[A+2]&255),S.push(m(C));return S.join("")}p(g,"encodeChunk");function _(f){for(var y,E=f.length,C=E%3,S=[],A=16383,v=0,T=E-C;v<T;v+=A)S.push(g(f,v,v+A>T?T:v+A));return C===1?(y=f[E-1],S.push(t[y>>2]+t[y<<4&63]+"==")):C===2&&(y=(f[E-2]<<8)+f[E-1],S.push(t[y>>10]+t[y>>4&63]+t[y<<2&63]+"=")),S.join("")}p(_,"fromByteArray")}}),un=z({"node_modules/google-auth-library/build/src/crypto/shared.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fromArrayBufferToHex=t;function t(r){return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}p(t,"fromArrayBufferToHex")}}),dl=z({"node_modules/google-auth-library/build/src/crypto/browser/crypto.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserCrypto=void 0;var t=ul(),r=un(),n=class Xr{static{p(this,"_BrowserCrypto")}constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(o){let a=new TextEncoder().encode(o),c=await window.crypto.subtle.digest("SHA-256",a);return t.fromByteArray(new Uint8Array(c))}randomBytesBase64(o){let a=new Uint8Array(o);return window.crypto.getRandomValues(a),t.fromByteArray(a)}static padBase64(o){for(;o.length%4!==0;)o+="=";return o}async verify(o,a,c){let u={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},d=new TextEncoder().encode(a),h=t.toByteArray(Xr.padBase64(c)),m=await window.crypto.subtle.importKey("jwk",o,u,!0,["verify"]);return await window.crypto.subtle.verify(u,m,Buffer.from(h),d)}async sign(o,a){let c={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},u=new TextEncoder().encode(a),d=await window.crypto.subtle.importKey("jwk",o,c,!0,["sign"]),h=await window.crypto.subtle.sign(c,d,u);return t.fromByteArray(new Uint8Array(h))}decodeBase64StringUtf8(o){let a=t.toByteArray(Xr.padBase64(o));return new TextDecoder().decode(a)}encodeBase64StringUtf8(o){let a=new TextEncoder().encode(o);return t.fromByteArray(a)}async sha256DigestHex(o){let a=new TextEncoder().encode(o),c=await window.crypto.subtle.digest("SHA-256",a);return(0,r.fromArrayBufferToHex)(c)}async signWithHmacSha256(o,a){let c=typeof o=="string"?o:String.fromCharCode(...new Uint16Array(o)),u=new TextEncoder,d=await window.crypto.subtle.importKey("raw",u.encode(c),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",d,u.encode(a))}};e.BrowserCrypto=n}}),cl=z({"node_modules/google-auth-library/build/src/crypto/node/crypto.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeCrypto=void 0;var t=te("crypto"),r=class{static{p(this,"NodeCrypto")}async sha256DigestBase64(o){return t.createHash("sha256").update(o).digest("base64")}randomBytesBase64(o){return t.randomBytes(o).toString("base64")}async verify(o,a,c){let u=t.createVerify("RSA-SHA256");return u.update(a),u.end(),u.verify(o,c,"base64")}async sign(o,a){let c=t.createSign("RSA-SHA256");return c.update(a),c.end(),c.sign(o,"base64")}decodeBase64StringUtf8(o){return Buffer.from(o,"base64").toString("utf-8")}encodeBase64StringUtf8(o){return Buffer.from(o,"utf-8").toString("base64")}async sha256DigestHex(o){return t.createHash("sha256").update(o).digest("hex")}async signWithHmacSha256(o,a){let c=typeof o=="string"?o:i(o);return n(t.createHmac("sha256",c).update(a).digest())}};e.NodeCrypto=r;function n(o){let a=new ArrayBuffer(o.length),c=new Uint8Array(a);for(let u=0;u<o.length;++u)c[u]=o[u];return a}p(n,"toArrayBuffer");function i(o){return Buffer.from(o)}p(i,"toBuffer")}}),jt=z({"node_modules/google-auth-library/build/src/crypto/crypto.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(c,u,d,h){h===void 0&&(h=d);var m=Object.getOwnPropertyDescriptor(u,d);(!m||("get"in m?!u.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:p(function(){return u[d]},"get")}),Object.defineProperty(c,h,m)}):(function(c,u,d,h){h===void 0&&(h=d),c[h]=u[d]})),r=e&&e.__exportStar||function(c,u){for(var d in c)d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&t(u,c,d)};Object.defineProperty(e,"__esModule",{value:!0}),e.createCrypto=o,e.hasBrowserCrypto=a;var n=dl(),i=cl();r(un(),e);function o(){return a()?new n.BrowserCrypto:new i.NodeCrypto}p(o,"createCrypto");function a(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}p(a,"hasBrowserCrypto")}}),pl=z({"node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js"(e,t){"use strict";function r(o){var a=(o/8|0)+(o%8===0?0:1);return a}p(r,"getParamSize");var n={ES256:r(256),ES384:r(384),ES512:r(521)};function i(o){var a=n[o];if(a)return a;throw new Error('Unknown algorithm "'+o+'"')}p(i,"getParamBytesForAlg"),t.exports=i}}),dn=z({"node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js"(e,t){"use strict";var r=Bt().Buffer,n=pl(),i=128,o=0,a=32,c=16,u=2,d=c|a|o<<6,h=u|o<<6;function m(E){return E.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}p(m,"base64Url");function g(E){if(r.isBuffer(E))return E;if(typeof E=="string")return r.from(E,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}p(g,"signatureAsBuffer");function _(E,C){E=g(E);var S=n(C),A=S+1,v=E.length,T=0;if(E[T++]!==d)throw new Error('Could not find expected "seq"');var I=E[T++];if(I===(i|1)&&(I=E[T++]),v-T<I)throw new Error('"seq" specified length of "'+I+'", only "'+(v-T)+'" remaining');if(E[T++]!==h)throw new Error('Could not find expected "int" for "r"');var w=E[T++];if(v-T-2<w)throw new Error('"r" specified length of "'+w+'", only "'+(v-T-2)+'" available');if(A<w)throw new Error('"r" specified length of "'+w+'", max of "'+A+'" is acceptable');var k=T;if(T+=w,E[T++]!==h)throw new Error('Could not find expected "int" for "s"');var R=E[T++];if(v-T!==R)throw new Error('"s" specified length of "'+R+'", expected "'+(v-T)+'"');if(A<R)throw new Error('"s" specified length of "'+R+'", max of "'+A+'" is acceptable');var M=T;if(T+=R,T!==v)throw new Error('Expected to consume entire buffer, but "'+(v-T)+'" bytes remain');var D=S-w,J=S-R,O=r.allocUnsafe(D+w+J+R);for(T=0;T<D;++T)O[T]=0;E.copy(O,T,k+Math.max(-D,0),k+w),T=S;for(var L=T;T<L+J;++T)O[T]=0;return E.copy(O,T,M+Math.max(-J,0),M+R),O=O.toString("base64"),O=m(O),O}p(_,"derToJose");function f(E,C,S){for(var A=0;C+A<S&&E[C+A]===0;)++A;var v=E[C+A]>=i;return v&&--A,A}p(f,"countPadding");function y(E,C){E=g(E);var S=n(C),A=E.length;if(A!==S*2)throw new TypeError('"'+C+'" signatures must be "'+S*2+'" bytes, saw "'+A+'"');var v=f(E,0,S),T=f(E,S,E.length),I=S-v,w=S-T,k=2+I+1+1+w,R=k<i,M=r.allocUnsafe((R?2:3)+k),D=0;return M[D++]=d,R?M[D++]=k:(M[D++]=i|1,M[D++]=k&255),M[D++]=h,M[D++]=I,v<0?(M[D++]=0,D+=E.copy(M,D,0,S)):D+=E.copy(M,D,v,S),M[D++]=h,M[D++]=w,T<0?(M[D++]=0,E.copy(M,D,S)):E.copy(M,D,S+T),M}p(y,"joseToDer"),t.exports={derToJose:_,joseToDer:y}}}),Qe=z({"node_modules/google-auth-library/build/src/util.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0,e.snakeToCamel=a,e.originalOrCamelOptions=c,e.removeUndefinedValuesInObject=d,e.isValidFile=h,e.getWellKnownCertificateConfigFileLocation=m;var t=te("fs"),r=te("os"),n=te("path"),i="certificate_config.json",o="gcloud";function a(_){return _.replace(/([_][^_])/g,f=>f.slice(1).toUpperCase())}p(a,"snakeToCamel");function c(_){function f(y){let E=_||{};return E[y]??E[a(y)]}return p(f,"get"),{get:f}}p(c,"originalOrCamelOptions");var u=class{static{p(this,"LRUCache")}capacity;#e=new Map;maxAge;constructor(_){this.capacity=_.capacity,this.maxAge=_.maxAge}#t(_,f){this.#e.delete(_),this.#e.set(_,{value:f,lastAccessed:Date.now()})}set(_,f){this.#t(_,f),this.#r()}get(_){let f=this.#e.get(_);if(f)return this.#t(_,f.value),this.#r(),f.value}#r(){let _=this.maxAge?Date.now()-this.maxAge:0,f=this.#e.entries().next();for(;!f.done&&(this.#e.size>this.capacity||f.value[1].lastAccessed<_);)this.#e.delete(f.value[0]),f=this.#e.entries().next()}};e.LRUCache=u;function d(_){return Object.entries(_).forEach(([f,y])=>{(y===void 0||y==="undefined")&&delete _[f]}),_}p(d,"removeUndefinedValuesInObject");async function h(_){try{return(await t.promises.lstat(_)).isFile()}catch{return!1}}p(h,"isValidFile");function m(){let _=process.env.CLOUDSDK_CONFIG||(g()?n.join(process.env.APPDATA||"",o):n.join(process.env.HOME||"",".config",o));return n.join(_,i)}p(m,"getWellKnownCertificateConfigFileLocation");function g(){return r.platform().startsWith("win")}p(g,"_isWindows")}}),hl=z({"node_modules/google-auth-library/package.json"(e,t){t.exports={name:"google-auth-library",version:"10.6.2",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:"packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node-core.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.0","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","docs-test":"echo 'disabled until linkinator is fixed'","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/google-auth-library-nodejs"}}}),cn=z({"node_modules/google-auth-library/build/src/shared.cjs"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.USER_AGENT=e.PRODUCT_NAME=e.pkg=void 0;var t=hl();e.pkg=t;var r="google-api-nodejs-client";e.PRODUCT_NAME=r;var n=`${r}/${t.version}`;e.USER_AGENT=n}}),He=z({"node_modules/google-auth-library/build/src/auth/authclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AuthClient=e.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=e.DEFAULT_UNIVERSE=void 0;var t=te("events"),r=Le(),n=Qe(),i=ln(),o=cn();e.DEFAULT_UNIVERSE="googleapis.com",e.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300*1e3;var a=class Fe extends t.EventEmitter{static{p(this,"_AuthClient")}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(u={}){super();let d=(0,n.originalOrCamelOptions)(u);this.apiKey=u.apiKey,this.projectId=d.get("project_id")??null,this.quotaProjectId=d.get("quota_project_id"),this.credentials=d.get("credentials")??{},this.universeDomain=d.get("universe_domain")??e.DEFAULT_UNIVERSE,this.transporter=u.transporter??new r.Gaxios(u.transporterOptions),d.get("useAuthRequestParameters")!==!1&&(this.transporter.interceptors.request.add(Fe.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(Fe.DEFAULT_RESPONSE_INTERCEPTOR)),u.eagerRefreshThresholdMillis&&(this.eagerRefreshThresholdMillis=u.eagerRefreshThresholdMillis),this.forceRefreshOnFailure=u.forceRefreshOnFailure??!1}fetch(...u){let d=u[0],h=u[1],m,g=new Headers;return typeof d=="string"?m=new URL(d):d instanceof URL?m=d:d&&d.url&&(m=new URL(d.url)),d&&typeof d=="object"&&"headers"in d&&r.Gaxios.mergeHeaders(g,d.headers),h&&r.Gaxios.mergeHeaders(g,new Headers(h.headers)),typeof d=="object"&&!(d instanceof URL)?this.request({...h,...d,headers:g,url:m}):this.request({...h,headers:g,url:m})}setCredentials(u){this.credentials=u}addSharedMetadataHeaders(u){return!u.has("x-goog-user-project")&&this.quotaProjectId&&u.set("x-goog-user-project",this.quotaProjectId),u}addUserProjectAndAuthHeaders(u,d){let h=d.get("x-goog-user-project"),m=d.get("authorization");return h&&u.set("x-goog-user-project",h),m&&u.set("authorization",m),u}static log=(0,i.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:p(async u=>{if(!u.headers.has("x-goog-api-client")){let h=process.version.replace(/^v/,"");u.headers.set("x-goog-api-client",`gl-node/${h}`)}let d=u.headers.get("User-Agent");d?d.includes(`${o.PRODUCT_NAME}/`)||u.headers.set("User-Agent",`${d} ${o.USER_AGENT}`):u.headers.set("User-Agent",o.USER_AGENT);try{let h=u,m=h[Fe.RequestMethodNameSymbol],g=`${Math.floor(Math.random()*1e3)}`;h[Fe.RequestLogIdSymbol]=g;let _={url:u.url,headers:u.headers};m?Fe.log.info("%s [%s] request %j",m,g,_):Fe.log.info("[%s] request %j",g,_)}catch{}return u},"resolved")};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:p(async u=>{try{let d=u.config,h=d[Fe.RequestMethodNameSymbol],m=d[Fe.RequestLogIdSymbol];h?Fe.log.info("%s [%s] response %j",h,m,u.data):Fe.log.info("[%s] response %j",m,u.data)}catch{}return u},"resolved"),rejected:p(async u=>{try{let d=u.config,h=d[Fe.RequestMethodNameSymbol],m=d[Fe.RequestLogIdSymbol];h?Fe.log.info("%s [%s] error %j",h,m,u.response?.data):Fe.log.error("[%s] error %j",m,u.response?.data)}catch{}throw u},"rejected")};static setMethodName(u,d){try{let h=u;h[Fe.RequestMethodNameSymbol]=d}catch{}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};e.AuthClient=a}}),pn=z({"node_modules/google-auth-library/build/src/auth/loginticket.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LoginTicket=void 0;var t=class{static{p(this,"LoginTicket")}envelope;payload;constructor(r,n){this.envelope=r,this.payload=n}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let r=this.getPayload();return r&&r.sub?r.sub:null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}};e.LoginTicket=t}}),It=z({"node_modules/google-auth-library/build/src/auth/oauth2client.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OAuth2Client=e.ClientAuthentication=e.CertificateFormat=e.CodeChallengeMethod=void 0;var t=Le(),r=te("querystring"),n=te("stream"),i=dn(),o=Qe(),a=jt(),c=He(),u=pn(),d;(function(_){_.Plain="plain",_.S256="S256"})(d||(e.CodeChallengeMethod=d={}));var h;(function(_){_.PEM="PEM",_.JWK="JWK"})(h||(e.CertificateFormat=h={}));var m;(function(_){_.ClientSecretPost="ClientSecretPost",_.ClientSecretBasic="ClientSecretBasic",_.None="None"})(m||(e.ClientAuthentication=m={}));var g=class Ke extends c.AuthClient{static{p(this,"_OAuth2Client")}redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=h.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(f={},y,E){super(typeof f=="object"?f:{}),typeof f!="object"&&(f={clientId:f,clientSecret:y,redirectUri:E}),this._clientId=f.clientId||f.client_id,this._clientSecret=f.clientSecret||f.client_secret,this.redirectUri=f.redirectUri||f.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",...f.endpoints},this.clientAuthentication=f.clientAuthentication||m.ClientSecretPost,this.issuers=f.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(f={}){if(f.code_challenge_method&&!f.code_challenge)throw new Error("If a code_challenge_method is provided, code_challenge must be included.");return f.response_type=f.response_type||"code",f.client_id=f.client_id||this._clientId,f.redirect_uri=f.redirect_uri||this.redirectUri,Array.isArray(f.scope)&&(f.scope=f.scope.join(" ")),this.endpoints.oauth2AuthBaseUrl.toString()+"?"+r.stringify(f)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let f=(0,a.createCrypto)(),y=f.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),E=(await f.sha256DigestBase64(y)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:y,codeChallenge:E}}getToken(f,y){let E=typeof f=="string"?{code:f}:f;if(y)this.getTokenAsync(E).then(C=>y(null,C.tokens,C.res),C=>y(C,null,C.response));else return this.getTokenAsync(E)}async getTokenAsync(f){let y=this.endpoints.oauth2TokenUrl.toString(),E=new Headers,C={client_id:f.client_id||this._clientId,code_verifier:f.codeVerifier,code:f.code,grant_type:"authorization_code",redirect_uri:f.redirect_uri||this.redirectUri};if(this.clientAuthentication===m.ClientSecretBasic){let T=Buffer.from(`${this._clientId}:${this._clientSecret}`);E.set("authorization",`Basic ${T.toString("base64")}`)}this.clientAuthentication===m.ClientSecretPost&&(C.client_secret=this._clientSecret);let S={...Ke.RETRY_CONFIG,method:"POST",url:y,data:new URLSearchParams((0,o.removeUndefinedValuesInObject)(C)),headers:E};c.AuthClient.setMethodName(S,"getTokenAsync");let A=await this.transporter.request(S),v=A.data;return A.data&&A.data.expires_in&&(v.expiry_date=new Date().getTime()+A.data.expires_in*1e3,delete v.expires_in),this.emit("tokens",v),{tokens:v,res:A}}async refreshToken(f){if(!f)return this.refreshTokenNoCache(f);if(this.refreshTokenPromises.has(f))return this.refreshTokenPromises.get(f);let y=this.refreshTokenNoCache(f).then(E=>(this.refreshTokenPromises.delete(f),E),E=>{throw this.refreshTokenPromises.delete(f),E});return this.refreshTokenPromises.set(f,y),y}async refreshTokenNoCache(f){if(!f)throw new Error("No refresh token is set.");let y=this.endpoints.oauth2TokenUrl.toString(),E={refresh_token:f,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},C;try{let A={...Ke.RETRY_CONFIG,method:"POST",url:y,data:new URLSearchParams((0,o.removeUndefinedValuesInObject)(E))};c.AuthClient.setMethodName(A,"refreshTokenNoCache"),C=await this.transporter.request(A)}catch(A){throw A instanceof t.GaxiosError&&A.message==="invalid_grant"&&A.response?.data&&/ReAuth/i.test(A.response.data.error_description)&&(A.message=JSON.stringify(A.response.data)),A}let S=C.data;return C.data&&C.data.expires_in&&(S.expiry_date=new Date().getTime()+C.data.expires_in*1e3,delete S.expires_in),this.emit("tokens",S),{tokens:S,res:C}}refreshAccessToken(f){if(f)this.refreshAccessTokenAsync().then(y=>f(null,y.credentials,y.res),f);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let f=await this.refreshToken(this.credentials.refresh_token),y=f.tokens;return y.refresh_token=this.credentials.refresh_token,this.credentials=y,{credentials:this.credentials,res:f.res}}getAccessToken(f){if(f)this.getAccessTokenAsync().then(y=>f(null,y.token,y.res),f);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 new Error("No refresh token or refresh handler callback is set.");let f=await this.refreshAccessTokenAsync();if(!f.credentials||f.credentials&&!f.credentials.access_token)throw new Error("Could not refresh access token.");return{token:f.credentials.access_token,res:f.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(f){return(await this.getRequestMetadataAsync(f)).headers}async getRequestMetadataAsync(f){let y=this.credentials;if(!y.access_token&&!y.refresh_token&&!this.apiKey&&!this.refreshHandler)throw new Error("No access, refresh token, API key or refresh handler callback is set.");if(y.access_token&&!this.isTokenExpiring()){y.token_type=y.token_type||"Bearer";let v=new Headers({authorization:y.token_type+" "+y.access_token});return{headers:this.addSharedMetadataHeaders(v)}}if(this.refreshHandler){let v=await this.processAndValidateRefreshHandler();if(v?.access_token){this.setCredentials(v);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 E=null,C=null;try{E=await this.refreshToken(y.refresh_token),C=E.tokens}catch(v){let T=v;throw T.response&&(T.response.status===403||T.response.status===404)&&(T.message=`Could not refresh access token: ${T.message}`),T}let S=this.credentials;S.token_type=S.token_type||"Bearer",C.refresh_token=S.refresh_token,this.credentials=C;let A=new Headers({authorization:S.token_type+" "+C.access_token});return{headers:this.addSharedMetadataHeaders(A),res:E.res}}static getRevokeTokenUrl(f){return new Ke().getRevokeTokenURL(f).toString()}getRevokeTokenURL(f){let y=new URL(this.endpoints.oauth2RevokeUrl);return y.searchParams.append("token",f),y}revokeToken(f,y){let E={...Ke.RETRY_CONFIG,url:this.getRevokeTokenURL(f).toString(),method:"POST"};if(c.AuthClient.setMethodName(E,"revokeToken"),y)this.transporter.request(E).then(C=>y(null,C),y);else return this.transporter.request(E)}revokeCredentials(f){if(f)this.revokeCredentialsAsync().then(y=>f(null,y),f);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let f=this.credentials.access_token;if(this.credentials={},f)return this.revokeToken(f);throw new Error("No access token to revoke.")}request(f,y){if(y)this.requestAsync(f).then(E=>y(null,E),E=>y(E,E.response));else return this.requestAsync(f)}async requestAsync(f,y=!1){try{let E=await this.getRequestMetadataAsync();return f.headers=t.Gaxios.mergeHeaders(f.headers),this.addUserProjectAndAuthHeaders(f.headers,E.headers),this.apiKey&&f.headers.set("X-Goog-Api-Key",this.apiKey),await this.transporter.request(f)}catch(E){let C=E.response;if(C){let S=C.status,A=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),v=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,T=C.config.data instanceof n.Readable,I=S===401||S===403;if(!y&&I&&!T&&A)return await this.refreshAccessTokenAsync(),this.requestAsync(f,!0);if(!y&&I&&!T&&v){let w=await this.processAndValidateRefreshHandler();return w?.access_token&&this.setCredentials(w),this.requestAsync(f,!0)}}throw E}}verifyIdToken(f,y){if(y&&typeof y!="function")throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(y)this.verifyIdTokenAsync(f).then(E=>y(null,E),y);else return this.verifyIdTokenAsync(f)}async verifyIdTokenAsync(f){if(!f.idToken)throw new Error("The verifyIdToken method requires an ID Token");let y=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(f.idToken,y.certs,f.audience,this.issuers,f.maxExpiry)}async getTokenInfo(f){let{data:y}=await this.transporter.request({...Ke.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${f}`},url:this.endpoints.tokenInfoUrl.toString()}),E=Object.assign({expiry_date:new Date().getTime()+y.expires_in*1e3,scopes:y.scope.split(" ")},y);return delete E.expires_in,delete E.scope,E}getFederatedSignonCerts(f){if(f)this.getFederatedSignonCertsAsync().then(y=>f(null,y.certs,y.res),f);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let f=new Date().getTime(),y=(0,a.hasBrowserCrypto)()?h.JWK:h.PEM;if(this.certificateExpiry&&f<this.certificateExpiry.getTime()&&this.certificateCacheFormat===y)return{certs:this.certificateCache,format:y};let E,C;switch(y){case h.PEM:C=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case h.JWK:C=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${y}`)}try{let I={...Ke.RETRY_CONFIG,url:C};c.AuthClient.setMethodName(I,"getFederatedSignonCertsAsync"),E=await this.transporter.request(I)}catch(I){throw I instanceof Error&&(I.message=`Failed to retrieve verification certificates: ${I.message}`),I}let S=E?.headers.get("cache-control"),A=-1;if(S){let I=/max-age=(?<maxAge>[0-9]+)/.exec(S)?.groups?.maxAge;I&&(A=Number(I)*1e3)}let v={};switch(y){case h.PEM:v=E.data;break;case h.JWK:for(let I of E.data.keys)v[I.kid]=I;break;default:throw new Error(`Unsupported certificate format ${y}`)}let T=new Date;return this.certificateExpiry=A===-1?null:new Date(T.getTime()+A),this.certificateCache=v,this.certificateCacheFormat=y,{certs:v,format:y,res:E}}getIapPublicKeys(f){if(f)this.getIapPublicKeysAsync().then(y=>f(null,y.pubkeys,y.res),f);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let f,y=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let E={...Ke.RETRY_CONFIG,url:y};c.AuthClient.setMethodName(E,"getIapPublicKeysAsync"),f=await this.transporter.request(E)}catch(E){throw E instanceof Error&&(E.message=`Failed to retrieve verification certificates: ${E.message}`),E}return{pubkeys:f.data,res:f}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(f,y,E,C,S){let A=(0,a.createCrypto)();S||(S=Ke.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);let v=f.split(".");if(v.length!==3)throw new Error("Wrong number of segments in token: "+f);let T=v[0]+"."+v[1],I=v[2],w,k;try{w=JSON.parse(A.decodeBase64StringUtf8(v[0]))}catch(B){throw B instanceof Error&&(B.message=`Can't parse token envelope: ${v[0]}': ${B.message}`),B}if(!w)throw new Error("Can't parse token envelope: "+v[0]);try{k=JSON.parse(A.decodeBase64StringUtf8(v[1]))}catch(B){throw B instanceof Error&&(B.message=`Can't parse token payload '${v[0]}`),B}if(!k)throw new Error("Can't parse token payload: "+v[1]);if(!Object.prototype.hasOwnProperty.call(y,w.kid))throw new Error("No pem found for envelope: "+JSON.stringify(w));let R=y[w.kid];if(w.alg==="ES256"&&(I=i.joseToDer(I,"ES256").toString("base64")),!await A.verify(R,T,I))throw new Error("Invalid token signature: "+f);if(!k.iat)throw new Error("No issue time in token: "+JSON.stringify(k));if(!k.exp)throw new Error("No expiration time in token: "+JSON.stringify(k));let M=Number(k.iat);if(isNaN(M))throw new Error("iat field using invalid format");let D=Number(k.exp);if(isNaN(D))throw new Error("exp field using invalid format");let J=new Date().getTime()/1e3;if(D>=J+S)throw new Error("Expiration time too far in future: "+JSON.stringify(k));let O=M-Ke.CLOCK_SKEW_SECS_,L=D+Ke.CLOCK_SKEW_SECS_;if(J<O)throw new Error("Token used too early, "+J+" < "+O+": "+JSON.stringify(k));if(J>L)throw new Error("Token used too late, "+J+" > "+L+": "+JSON.stringify(k));if(C&&C.indexOf(k.iss)<0)throw new Error("Invalid issuer, expected one of ["+C+"], but got "+k.iss);if(typeof E<"u"&&E!==null){let B=k.aud,X=!1;if(E.constructor===Array?X=E.indexOf(B)>-1:X=B===E,!X)throw new Error("Wrong recipient, payload audience != requiredAudience")}return new u.LoginTicket(w,k)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let f=await this.refreshHandler();if(!f.access_token)throw new Error("No access token is returned by the refreshHandler callback.");return f}}isTokenExpiring(){let f=this.credentials.expiry_date;return f?f<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};e.OAuth2Client=g}}),hn=z({"node_modules/google-auth-library/build/src/auth/computeclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Compute=void 0;var t=Le(),r=Zt(),n=It(),i=class extends n.OAuth2Client{static{p(this,"Compute")}serviceAccountEmail;scopes;constructor(o={}){super(o),this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=o.serviceAccountEmail||"default",this.scopes=Array.isArray(o.scopes)?o.scopes:o.scopes?[o.scopes]:[]}async refreshTokenNoCache(){let o=`service-accounts/${this.serviceAccountEmail}/token`,a;try{let u={property:o};this.scopes.length>0&&(u.params={scopes:this.scopes.join(",")}),a=await r.instance(u)}catch(u){throw u instanceof t.GaxiosError&&(u.message=`Could not refresh access token: ${u.message}`,this.wrapError(u)),u}let c=a;return a&&a.expires_in&&(c.expiry_date=new Date().getTime()+a.expires_in*1e3,delete c.expires_in),this.emit("tokens",c),{tokens:c,res:null}}async fetchIdToken(o){let a=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${o}`,c;try{let u={property:a};c=await r.instance(u)}catch(u){throw u instanceof Error&&(u.message=`Could not fetch ID token: ${u.message}`),u}return c}wrapError(o){let a=o.response;a&&a.status&&(o.status=a.status,a.status===403?o.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: "+o.message:a.status===404&&(o.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: "+o.message))}};e.Compute=i}}),fn=z({"node_modules/google-auth-library/build/src/auth/idtokenclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IdTokenClient=void 0;var t=It(),r=class extends t.OAuth2Client{static{p(this,"IdTokenClient")}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 n=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:n,expiry_date:this.getIdTokenExpiryDate(n)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(n){let i=n.split(".")[1];if(i)return JSON.parse(Buffer.from(i,"base64").toString("ascii")).exp*1e3}};e.IdTokenClient=r}}),mn=z({"node_modules/google-auth-library/build/src/auth/envDetect.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GCPEnv=void 0,e.clear=i,e.getEnv=o;var t=Zt(),r;(function(_){_.APP_ENGINE="APP_ENGINE",_.KUBERNETES_ENGINE="KUBERNETES_ENGINE",_.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",_.COMPUTE_ENGINE="COMPUTE_ENGINE",_.CLOUD_RUN="CLOUD_RUN",_.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",_.NONE="NONE"})(r||(e.GCPEnv=r={}));var n;function i(){n=void 0}p(i,"clear");async function o(){return n||(n=a(),n)}p(o,"getEnv2");async function a(){let _=r.NONE;return c()?_=r.APP_ENGINE:u()?_=r.CLOUD_FUNCTIONS:await g()?await m()?_=r.KUBERNETES_ENGINE:d()?_=r.CLOUD_RUN:h()?_=r.CLOUD_RUN_JOBS:_=r.COMPUTE_ENGINE:_=r.NONE,_}p(a,"getEnvMemoized");function c(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}p(c,"isAppEngine");function u(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}p(u,"isCloudFunction");function d(){return!!process.env.K_CONFIGURATION}p(d,"isCloudRun");function h(){return!!process.env.CLOUD_RUN_JOB}p(h,"isCloudRunJob");async function m(){try{return await t.instance("attributes/cluster-name"),!0}catch{return!1}}p(m,"isKubernetesEngine");async function g(){return t.isAvailable()}p(g,"isComputeEngine")}}),gn=z({"node_modules/jws/lib/data-stream.js"(e,t){var r=Bt().Buffer,n=te("stream"),i=te("util");function o(a){if(this.buffer=null,this.writable=!0,this.readable=!0,!a)return this.buffer=r.alloc(0),this;if(typeof a.pipe=="function")return this.buffer=r.alloc(0),a.pipe(this),this;if(a.length||typeof a=="object")return this.buffer=a,this.writable=!1,process.nextTick(function(){this.emit("end",a),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof a+")")}p(o,"DataStream"),i.inherits(o,n),o.prototype.write=function(a){this.buffer=r.concat([this.buffer,r.from(a)]),this.emit("data",a)},o.prototype.end=function(a){a&&this.write(a),this.emit("end",a),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=o}}),fl=z({"node_modules/buffer-equal-constant-time/index.js"(e,t){"use strict";var r=te("buffer").Buffer,n=te("buffer").SlowBuffer;t.exports=i;function i(c,u){if(!r.isBuffer(c)||!r.isBuffer(u)||c.length!==u.length)return!1;for(var d=0,h=0;h<c.length;h++)d|=c[h]^u[h];return d===0}p(i,"bufferEq"),i.install=function(){r.prototype.equal=n.prototype.equal=function(c){return i(this,c)}};var o=r.prototype.equal,a=n.prototype.equal;i.restore=function(){r.prototype.equal=o,n.prototype.equal=a}}}),_n=z({"node_modules/jwa/index.js"(e,t){var r=Bt().Buffer,n=te("crypto"),i=dn(),o=te("util"),a=`"%s" is not a valid algorithm.
|
|
14
|
+
Supported algorithms are:
|
|
15
|
+
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,c="secret must be a string or buffer",u="key must be a string or a buffer",d="key must be a string, a buffer or an object",h=typeof n.createPublicKey=="function";h&&(u+=" or a KeyObject",c+="or a KeyObject");function m(B){if(!r.isBuffer(B)&&typeof B!="string"&&(!h||typeof B!="object"||typeof B.type!="string"||typeof B.asymmetricKeyType!="string"||typeof B.export!="function"))throw E(u)}p(m,"checkIsPublicKey");function g(B){if(!r.isBuffer(B)&&typeof B!="string"&&typeof B!="object")throw E(d)}p(g,"checkIsPrivateKey");function _(B){if(!r.isBuffer(B)){if(typeof B=="string")return B;if(!h||typeof B!="object"||B.type!=="secret"||typeof B.export!="function")throw E(c)}}p(_,"checkIsSecretKey");function f(B){return B.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}p(f,"fromBase64");function y(B){B=B.toString();var X=4-B.length%4;if(X!==4)for(var Y=0;Y<X;++Y)B+="=";return B.replace(/\-/g,"+").replace(/_/g,"/")}p(y,"toBase64");function E(B){var X=[].slice.call(arguments,1),Y=o.format.bind(o,B).apply(null,X);return new TypeError(Y)}p(E,"typeError");function C(B){return r.isBuffer(B)||typeof B=="string"}p(C,"bufferOrString");function S(B){return C(B)||(B=JSON.stringify(B)),B}p(S,"normalizeInput");function A(B){return function(X,Y){_(Y),X=S(X);var j=n.createHmac("sha"+B,Y),ie=(j.update(X),j.digest("base64"));return f(ie)}}p(A,"createHmacSigner");var v,T="timingSafeEqual"in n?function(B,X){return B.byteLength!==X.byteLength?!1:n.timingSafeEqual(B,X)}:function(B,X){return v||(v=fl()),v(B,X)};function I(B){return function(X,Y,j){var ie=A(B)(X,j);return T(r.from(Y),r.from(ie))}}p(I,"createHmacVerifier");function w(B){return function(X,Y){g(Y),X=S(X);var j=n.createSign("RSA-SHA"+B),ie=(j.update(X),j.sign(Y,"base64"));return f(ie)}}p(w,"createKeySigner");function k(B){return function(X,Y,j){m(j),X=S(X),Y=y(Y);var ie=n.createVerify("RSA-SHA"+B);return ie.update(X),ie.verify(j,Y,"base64")}}p(k,"createKeyVerifier");function R(B){return function(X,Y){g(Y),X=S(X);var j=n.createSign("RSA-SHA"+B),ie=(j.update(X),j.sign({key:Y,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return f(ie)}}p(R,"createPSSKeySigner");function M(B){return function(X,Y,j){m(j),X=S(X),Y=y(Y);var ie=n.createVerify("RSA-SHA"+B);return ie.update(X),ie.verify({key:j,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},Y,"base64")}}p(M,"createPSSKeyVerifier");function D(B){var X=w(B);return function(){var Y=X.apply(null,arguments);return Y=i.derToJose(Y,"ES"+B),Y}}p(D,"createECDSASigner");function J(B){var X=k(B);return function(Y,j,ie){j=i.joseToDer(j,"ES"+B).toString("base64");var oe=X(Y,j,ie);return oe}}p(J,"createECDSAVerifer");function O(){return function(){return""}}p(O,"createNoneSigner");function L(){return function(B,X){return X===""}}p(L,"createNoneVerifier"),t.exports=function(B){var X={hs:A,rs:w,ps:R,es:D,none:O},Y={hs:I,rs:k,ps:M,es:J,none:L},j=B.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!j)throw E(a,B);var ie=(j[1]||j[3]).toLowerCase(),oe=j[2];return{sign:X[ie](oe),verify:Y[ie](oe)}}}}),yn=z({"node_modules/jws/lib/tostring.js"(e,t){var r=te("buffer").Buffer;t.exports=function(n){return typeof n=="string"?n:typeof n=="number"||r.isBuffer(n)?n.toString():JSON.stringify(n)}}}),ml=z({"node_modules/jws/lib/sign-stream.js"(e,t){var r=Bt().Buffer,n=gn(),i=_n(),o=te("stream"),a=yn(),c=te("util");function u(g,_){return r.from(g,_).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}p(u,"base64url");function d(g,_,f){f=f||"utf8";var y=u(a(g),"binary"),E=u(a(_),f);return c.format("%s.%s",y,E)}p(d,"jwsSecuredInput");function h(g){var _=g.header,f=g.payload,y=g.secret||g.privateKey,E=g.encoding,C=i(_.alg),S=d(_,f,E),A=C.sign(S,y);return c.format("%s.%s",S,A)}p(h,"jwsSign");function m(g){var _=g.secret;if(_=_??g.privateKey,_=_??g.key,/^hs/i.test(g.header.alg)===!0&&_==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var f=new n(_);this.readable=!0,this.header=g.header,this.encoding=g.encoding,this.secret=this.privateKey=this.key=f,this.payload=new n(g.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}p(m,"SignStream"),c.inherits(m,o),m.prototype.sign=function(){try{var g=h({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(_){this.readable=!1,this.emit("error",_),this.emit("close")}},m.sign=h,t.exports=m}}),gl=z({"node_modules/jws/lib/verify-stream.js"(e,t){var r=Bt().Buffer,n=gn(),i=_n(),o=te("stream"),a=yn(),c=te("util"),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function d(A){return Object.prototype.toString.call(A)==="[object Object]"}p(d,"isObject");function h(A){if(d(A))return A;try{return JSON.parse(A)}catch{return}}p(h,"safeJsonParse");function m(A){var v=A.split(".",1)[0];return h(r.from(v,"base64").toString("binary"))}p(m,"headerFromJWS");function g(A){return A.split(".",2).join(".")}p(g,"securedInputFromJWS");function _(A){return A.split(".")[2]}p(_,"signatureFromJWS");function f(A,v){v=v||"utf8";var T=A.split(".")[1];return r.from(T,"base64").toString(v)}p(f,"payloadFromJWS");function y(A){return u.test(A)&&!!m(A)}p(y,"isValidJws");function E(A,v,T){if(!v){var I=new Error("Missing algorithm parameter for jws.verify");throw I.code="MISSING_ALGORITHM",I}A=a(A);var w=_(A),k=g(A),R=i(v);return R.verify(k,w,T)}p(E,"jwsVerify");function C(A,v){if(v=v||{},A=a(A),!y(A))return null;var T=m(A);if(!T)return null;var I=f(A);return(T.typ==="JWT"||v.json)&&(I=JSON.parse(I,v.encoding)),{header:T,payload:I,signature:_(A)}}p(C,"jwsDecode");function S(A){A=A||{};var v=A.secret;if(v=v??A.publicKey,v=v??A.key,/^hs/i.test(A.algorithm)===!0&&v==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var T=new n(v);this.readable=!0,this.algorithm=A.algorithm,this.encoding=A.encoding,this.secret=this.publicKey=this.key=T,this.signature=new n(A.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}p(S,"VerifyStream"),c.inherits(S,o),S.prototype.verify=function(){try{var A=E(this.signature.buffer,this.algorithm,this.key.buffer),v=C(this.signature.buffer,this.encoding);return this.emit("done",A,v),this.emit("data",A),this.emit("end"),this.readable=!1,A}catch(T){this.readable=!1,this.emit("error",T),this.emit("close")}},S.decode=C,S.isValid=y,S.verify=E,t.exports=S}}),En=z({"node_modules/jws/index.js"(e){var t=ml(),r=gl(),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(i){return new t(i)},e.createVerify=function(i){return new r(i)}}}),_l=z({"node_modules/google-auth-library/build/src/gtoken/jwsSign.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.buildPayloadForJwsSign=i,e.getJwsSign=o;var t=En(),r="RS256",n="https://oauth2.googleapis.com/token";function i(a){let c=Math.floor(new Date().getTime()/1e3);return{iss:a.iss,scope:a.scope,aud:n,exp:c+3600,iat:c,sub:a.sub,...a.additionalClaims}}p(i,"buildPayloadForJwsSign");function o(a){let c=i(a);return(0,t.sign)({header:{alg:r},payload:c,secret:a.key})}p(o,"getJwsSign")}}),yl=z({"node_modules/google-auth-library/build/src/gtoken/getToken.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getToken=o;var t=_l(),r="https://oauth2.googleapis.com/token",n="urn:ietf:params:oauth:grant-type:jwt-bearer",i=p(a=>({method:"POST",url:r,data:new URLSearchParams({grant_type:n,assertion:(0,t.getJwsSign)(a)}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}}),"generateRequestOptions");async function o(a){if(!a.transporter)throw new Error("No transporter set.");try{let c=i(a);return(await a.transporter.request(c)).data}catch(c){let u=c,d=u.response?.data;throw d?.error&&(u.message=`${d.error}: ${d.error_description}`),u}}p(o,"getToken")}}),El=z({"node_modules/google-auth-library/build/src/gtoken/errorWithCode.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorWithCode=void 0;var t=class extends Error{static{p(this,"ErrorWithCode")}code;constructor(r,n){super(r),this.code=n}};e.ErrorWithCode=t}}),vn=z({"node_modules/google-auth-library/build/src/gtoken/getCredentials.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCredentials=m;var t=te("path"),r=te("fs"),n=te("util"),i=El(),o=r.readFile?(0,n.promisify)(r.readFile):async()=>{throw new i.ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")},a;(function(g){g.JSON=".json",g.DER=".der",g.CRT=".crt",g.PEM=".pem",g.P12=".p12",g.PFX=".pfx"})(a||(a={}));var c=class{static{p(this,"JsonCredentialsProvider")}keyFilePath;constructor(g){this.keyFilePath=g}async getCredentials(){let g=await o(this.keyFilePath,"utf8"),_;try{_=JSON.parse(g)}catch(E){let C=E;throw new Error(`Invalid JSON key file: ${C.message}`)}let f=_.private_key,y=_.client_email;if(!f||!y)throw new i.ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS");return{privateKey:f,clientEmail:y}}},u=class{static{p(this,"PemCredentialsProvider")}keyFilePath;constructor(g){this.keyFilePath=g}async getCredentials(){return{privateKey:await o(this.keyFilePath,"utf8")}}},d=class{static{p(this,"P12CredentialsProvider")}async getCredentials(){throw new i.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")}},h=class{static{p(this,"CredentialsProviderFactory")}static create(g){switch(t.extname(g)){case a.JSON:return new c(g);case a.DER:case a.CRT:case a.PEM:return new u(g);case a.P12:case a.PFX:return new d;default:throw new i.ErrorWithCode("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}};async function m(g){return h.create(g).getCredentials()}p(m,"getCredentials")}}),vl=z({"node_modules/google-auth-library/build/src/gtoken/tokenHandler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenHandler=void 0;var t=yl(),r=vn(),n=class{static{p(this,"TokenHandler")}token;tokenExpiresAt;inFlightRequest;tokenOptions;constructor(i){this.tokenOptions=i}async processCredentials(){if(!this.tokenOptions.key&&!this.tokenOptions.keyFile)throw new Error("No key or keyFile set.");if(!this.tokenOptions.key&&this.tokenOptions.keyFile){let i=await(0,r.getCredentials)(this.tokenOptions.keyFile);this.tokenOptions.key=i.privateKey,this.tokenOptions.email=i.clientEmail}}isTokenExpiring(){if(!this.token||!this.tokenExpiresAt)return!0;let i=new Date().getTime(),o=this.tokenOptions.eagerRefreshThresholdMillis??0;return this.tokenExpiresAt<=i+o}hasExpired(){let i=new Date().getTime();return this.token&&this.tokenExpiresAt?new Date().getTime()>=this.tokenExpiresAt:!0}async getToken(i){if(await this.processCredentials(),this.inFlightRequest&&!i)return this.inFlightRequest;if(this.token&&!this.isTokenExpiring()&&!i)return this.token;try{this.inFlightRequest=(0,t.getToken)(this.tokenOptions);let o=await this.inFlightRequest;return this.token=o,this.tokenExpiresAt=new Date().getTime()+(o.expires_in??0)*1e3,o}finally{this.inFlightRequest=void 0}}};e.TokenHandler=n}}),Tl=z({"node_modules/google-auth-library/build/src/gtoken/revokeToken.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.revokeToken=n;var t="https://oauth2.googleapis.com/revoke?token=",r=!0;async function n(i,o){let a=t+i;return await o.request({url:a,retry:r})}p(n,"revokeToken")}}),Tn=z({"node_modules/google-auth-library/build/src/gtoken/googleToken.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleToken=void 0;var t=Le(),r=vl(),n=Tl(),i=class{static{p(this,"GoogleToken")}tokenOptions;tokenHandler;constructor(o){this.tokenOptions=o||{},this.tokenOptions.transporter=this.tokenOptions.transporter||{request:p(a=>(0,t.request)(a),"request")},this.tokenOptions.iss||(this.tokenOptions.iss=this.tokenOptions.email),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(o,a={forceRefresh:!1}){let c;typeof o=="function"?c=o:typeof o=="object"&&(a=o);let u=this.tokenHandler.getToken(a.forceRefresh??!1);return c&&u.then(d=>c(null,d),c),u}revokeToken(o){if(!this.accessToken)return Promise.reject(new Error("No token to revoke."));let a=(0,n.revokeToken)(this.accessToken,this.tokenOptions.transporter);o&&a.then(()=>o(),o),this.tokenHandler=new r.TokenHandler(this.tokenOptions)}get googleTokenOptions(){return this.tokenOptions}};e.GoogleToken=i}}),An=z({"node_modules/google-auth-library/build/src/auth/jwtaccess.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JWTAccess=void 0;var t=En(),r=Qe(),n={alg:"RS256",typ:"JWT"},i=class Ra{static{p(this,"_JWTAccess")}email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new r.LRUCache({capacity:500,maxAge:3600*1e3});constructor(a,c,u,d){this.email=a,this.key=c,this.keyId=u,this.eagerRefreshThresholdMillis=d??300*1e3}getCachedKey(a,c){let u=a;if(c&&Array.isArray(c)&&c.length?u=a?`${a}_${c.join("_")}`:`${c.join("_")}`:typeof c=="string"&&(u=a?`${a}_${c}`:c),!u)throw Error("Scopes or url must be provided");return u}getRequestHeaders(a,c,u){let d=this.getCachedKey(a,u),h=this.cache.get(d),m=Date.now();if(h&&h.expiration-m>this.eagerRefreshThresholdMillis)return new Headers(h.headers);let g=Math.floor(Date.now()/1e3),_=Ra.getExpirationTime(g),f;if(Array.isArray(u)&&(u=u.join(" ")),u?f={iss:this.email,sub:this.email,scope:u,exp:_,iat:g}:f={iss:this.email,sub:this.email,aud:a,exp:_,iat:g},c){for(let A in f)if(c[A])throw new Error(`The '${A}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let y=this.keyId?{...n,kid:this.keyId}:n,E=Object.assign(f,c),C=t.sign({header:y,payload:E,secret:this.key}),S=new Headers({authorization:`Bearer ${C}`});return this.cache.set(d,{expiration:_*1e3,headers:S}),S}static getExpirationTime(a){return a+3600}fromJSON(a){if(!a)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!a.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!a.private_key)throw new 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}fromStream(a,c){if(c)this.fromStreamAsync(a).then(()=>c(),c);else return this.fromStreamAsync(a)}fromStreamAsync(a){return new Promise((c,u)=>{a||u(new Error("Must pass in a stream containing the service account auth settings."));let d="";a.setEncoding("utf8").on("data",h=>d+=h).on("error",u).on("end",()=>{try{let h=JSON.parse(d);this.fromJSON(h),c()}catch(h){u(h)}})})}};e.JWTAccess=i}}),Cn=z({"node_modules/google-auth-library/build/src/auth/jwtclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JWT=void 0;var t=Tn(),r=vn(),n=An(),i=It(),o=He(),a=class Pa extends i.OAuth2Client{static{p(this,"_JWT")}email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(u={}){super(u),this.email=u.email,this.keyFile=u.keyFile,this.key=u.key,this.keyId=u.keyId,this.scopes=u.scopes,this.subject=u.subject,this.additionalClaims=u.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(u){let d=new Pa(this);return d.scopes=u,d}async getRequestMetadataAsync(u){u=this.defaultServicePath?`https://${this.defaultServicePath}/`:u;let d=!this.hasUserScopes()&&u||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==o.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==o.DEFAULT_UNIVERSE)throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${o.DEFAULT_UNIVERSE}`);if(!this.apiKey&&d)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:h}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${h.id_token}`}))}}else{this.access||(this.access=new n.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis));let h;this.hasUserScopes()?h=this.scopes:u||(h=this.defaultScopes);let m=this.useJWTAccessWithScope||this.universeDomain!==o.DEFAULT_UNIVERSE,g=await this.access.getRequestHeaders(u??void 0,this.additionalClaims,m?h:void 0);return{headers:this.addSharedMetadataHeaders(g)}}else return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(u):{headers:new Headers}}async fetchIdToken(u){let d=new t.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:u},transporter:this.transporter});if(await d.getToken({forceRefresh:!0}),!d.idToken)throw new Error("Unknown error: Failed to fetch ID token");return d.idToken}hasUserScopes(){return this.scopes?this.scopes.length>0:!1}hasAnyScopes(){return!!(this.scopes&&this.scopes.length>0||this.defaultScopes&&this.defaultScopes.length>0)}authorize(u){if(u)this.authorizeAsync().then(d=>u(null,d),u);else return this.authorizeAsync()}async authorizeAsync(){let u=await this.refreshToken();if(!u)throw new Error("No result returned");return this.credentials=u.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.googleTokenOptions?.key,this.email=this.gtoken.googleTokenOptions?.iss,u.tokens}async refreshTokenNoCache(){let u=this.createGToken(),d={access_token:(await u.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:u.expiresAt,id_token:u.idToken};return this.emit("tokens",d),{res:null,tokens:d}}createGToken(){return 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})),this.gtoken}fromJSON(u){if(!u)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!u.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!u.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=u.client_email,this.key=u.private_key,this.keyId=u.private_key_id,this.projectId=u.project_id,this.quotaProjectId=u.quota_project_id,this.universeDomain=u.universe_domain||this.universeDomain}fromStream(u,d){if(d)this.fromStreamAsync(u).then(()=>d(),d);else return this.fromStreamAsync(u)}fromStreamAsync(u){return new Promise((d,h)=>{if(!u)throw new Error("Must pass in a stream containing the service account auth settings.");let m="";u.setEncoding("utf8").on("error",h).on("data",g=>m+=g).on("end",()=>{try{let g=JSON.parse(m);this.fromJSON(g),d()}catch(g){h(g)}})})}fromAPIKey(u){if(typeof u!="string")throw new Error("Must provide an API Key string.");this.apiKey=u}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){let u=this.createGToken(),d=await(0,r.getCredentials)(this.keyFile);return{private_key:d.privateKey,client_email:d.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};e.JWT=a}}),Sn=z({"node_modules/google-auth-library/build/src/auth/refreshclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UserRefreshClient=e.USER_REFRESH_ACCOUNT_TYPE=void 0;var t=It(),r=He();e.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var n=class Kr extends t.OAuth2Client{static{p(this,"_UserRefreshClient")}_refreshToken;constructor(o,a,c,u,d){let h=o&&typeof o=="object"?o:{clientId:o,clientSecret:a,refreshToken:c,eagerRefreshThresholdMillis:u,forceRefreshOnFailure:d};super(h),this._refreshToken=h.refreshToken,this.credentials.refresh_token=h.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(o){let a={...Kr.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:o}),responseType:"json"};return r.AuthClient.setMethodName(a,"fetchIdToken"),(await this.transporter.request(a)).data.id_token}fromJSON(o){if(!o)throw new Error("Must pass in a JSON object containing the user refresh token");if(o.type!=="authorized_user")throw new Error('The incoming JSON object does not have the "authorized_user" type');if(!o.client_id)throw new Error("The incoming JSON object does not contain a client_id field");if(!o.client_secret)throw new Error("The incoming JSON object does not contain a client_secret field");if(!o.refresh_token)throw new Error("The incoming JSON object does not contain a refresh_token field");this._clientId=o.client_id,this._clientSecret=o.client_secret,this._refreshToken=o.refresh_token,this.credentials.refresh_token=o.refresh_token,this.quotaProjectId=o.quota_project_id,this.universeDomain=o.universe_domain||this.universeDomain}fromStream(o,a){if(a)this.fromStreamAsync(o).then(()=>a(),a);else return this.fromStreamAsync(o)}async fromStreamAsync(o){return new Promise((a,c)=>{if(!o)return c(new Error("Must pass in a stream containing the user refresh token."));let u="";o.setEncoding("utf8").on("error",c).on("data",d=>u+=d).on("end",()=>{try{let d=JSON.parse(u);return this.fromJSON(d),a()}catch(d){return c(d)}})})}static fromJSON(o){let a=new Kr;return a.fromJSON(o),a}};e.UserRefreshClient=n}}),In=z({"node_modules/google-auth-library/build/src/auth/impersonated.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Impersonated=e.IMPERSONATED_ACCOUNT_TYPE=void 0;var t=It(),r=Le(),n=Qe();e.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var i=class yr extends t.OAuth2Client{static{p(this,"_Impersonated")}sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(a={}){if(super(a),this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=a.sourceClient??new t.OAuth2Client,this.targetPrincipal=a.targetPrincipal??"",this.delegates=a.delegates??[],this.targetScopes=a.targetScopes??[],this.lifetime=a.lifetime??3600,!(0,n.originalOrCamelOptions)(a).get("universe_domain"))this.universeDomain=this.sourceClient.universeDomain;else if(this.sourceClient.universeDomain!==this.universeDomain)throw new RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`);this.endpoint=a.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(a){await this.sourceClient.getAccessToken();let c=`projects/-/serviceAccounts/${this.targetPrincipal}`,u=`${this.endpoint}/v1/${c}:signBlob`,d={delegates:this.delegates,payload:Buffer.from(a).toString("base64")};return(await this.sourceClient.request({...yr.RETRY_CONFIG,url:u,data:d,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let a="projects/-/serviceAccounts/"+this.targetPrincipal,c=`${this.endpoint}/v1/${a}:generateAccessToken`,u={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},d=await this.sourceClient.request({...yr.RETRY_CONFIG,url:c,data:u,method:"POST"}),h=d.data;return this.credentials.access_token=h.accessToken,this.credentials.expiry_date=Date.parse(h.expireTime),{tokens:this.credentials,res:d}}catch(a){if(!(a instanceof Error))throw a;let c=0,u="";throw a instanceof r.GaxiosError&&(c=a?.response?.data?.error?.status,u=a?.response?.data?.error?.message),c&&u?(a.message=`${c}: unable to impersonate: ${u}`,a):(a.message=`unable to impersonate: ${a}`,a)}}async fetchIdToken(a,c){await this.sourceClient.getAccessToken();let u=`projects/-/serviceAccounts/${this.targetPrincipal}`,d=`${this.endpoint}/v1/${u}:generateIdToken`,h={delegates:this.delegates,audience:a,includeEmail:c?.includeEmail??!0,useEmailAzp:c?.includeEmail??!0};return(await this.sourceClient.request({...yr.RETRY_CONFIG,url:d,data:h,method:"POST"})).data.token}};e.Impersonated=i}}),wn=z({"node_modules/google-auth-library/build/src/auth/oauth2common.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthClientAuthHandler=void 0,e.getErrorFromOAuthErrorResponse=o;var t=Le(),r=jt(),n=["PUT","POST","PATCH"],i=class{static{p(this,"OAuthClientAuthHandler")}#e=(0,r.createCrypto)();#t;transporter;constructor(a){a&&"clientId"in a?(this.#t=a,this.transporter=new t.Gaxios):(this.#t=a?.clientAuthentication,this.transporter=a?.transporter||new t.Gaxios)}applyClientAuthenticationOptions(a,c){a.headers=t.Gaxios.mergeHeaders(a.headers),this.injectAuthenticatedHeaders(a,c),c||this.injectAuthenticatedRequestBody(a)}injectAuthenticatedHeaders(a,c){if(c)a.headers=t.Gaxios.mergeHeaders(a.headers,{authorization:`Bearer ${c}`});else if(this.#t?.confidentialClientType==="basic"){a.headers=t.Gaxios.mergeHeaders(a.headers);let u=this.#t.clientId,d=this.#t.clientSecret||"",h=this.#e.encodeBase64StringUtf8(`${u}:${d}`);t.Gaxios.mergeHeaders(a.headers,{authorization:`Basic ${h}`})}}injectAuthenticatedRequestBody(a){if(this.#t?.confidentialClientType==="request-body"){let c=(a.method||"GET").toUpperCase();if(!n.includes(c))throw new Error(`${c} HTTP method does not support ${this.#t.confidentialClientType} client authentication`);let u=new Headers(a.headers).get("content-type");if(u?.startsWith("application/x-www-form-urlencoded")||a.data instanceof URLSearchParams){let d=new URLSearchParams(a.data??"");d.append("client_id",this.#t.clientId),d.append("client_secret",this.#t.clientSecret||""),a.data=d}else if(u?.startsWith("application/json"))a.data=a.data||{},Object.assign(a.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""});else throw new Error(`${u} 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=i;function o(a,c){let u=a.error,d=a.error_description,h=a.error_uri,m=`Error code ${u}`;typeof d<"u"&&(m+=`: ${d}`),typeof h<"u"&&(m+=` - ${h}`);let g=new Error(m);if(c){let _=Object.keys(c);c.stack&&_.push("stack"),_.forEach(f=>{f!=="message"&&Object.defineProperty(g,f,{value:c[f],writable:!1,enumerable:!0})})}return g}p(o,"getErrorFromOAuthErrorResponse")}}),vr=z({"node_modules/google-auth-library/build/src/auth/stscredentials.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StsCredentials=void 0;var t=Le(),r=He(),n=wn(),i=Qe(),o=class Na extends n.OAuthClientAuthHandler{static{p(this,"_StsCredentials")}#e;constructor(c={tokenExchangeEndpoint:""},u){(typeof c!="object"||c instanceof URL)&&(c={tokenExchangeEndpoint:c,clientAuthentication:u}),super(c),this.#e=c.tokenExchangeEndpoint}async exchangeToken(c,u,d){let h={grant_type:c.grantType,resource:c.resource,audience:c.audience,scope:c.scope?.join(" "),requested_token_type:c.requestedTokenType,subject_token:c.subjectToken,subject_token_type:c.subjectTokenType,actor_token:c.actingParty?.actorToken,actor_token_type:c.actingParty?.actorTokenType,options:d&&JSON.stringify(d)},m={...Na.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:u,data:new URLSearchParams((0,i.removeUndefinedValuesInObject)(h)),responseType:"json"};r.AuthClient.setMethodName(m,"exchangeToken"),this.applyClientAuthenticationOptions(m);try{let g=await this.transporter.request(m),_=g.data;return _.res=g,_}catch(g){throw g instanceof t.GaxiosError&&g.response?(0,n.getErrorFromOAuthErrorResponse)(g.response.data,g):g}}};e.StsCredentials=o}}),mt=z({"node_modules/google-auth-library/build/src/auth/baseexternalclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BaseExternalAccountClient=e.CLOUD_RESOURCE_MANAGER=e.EXTERNAL_ACCOUNT_TYPE=e.EXPIRATION_TIME_OFFSET=void 0;var t=Le(),r=te("stream"),n=He(),i=vr(),o=Qe(),a=cn(),c="urn:ietf:params:oauth:grant-type:token-exchange",u="urn:ietf:params:oauth:token-type:access_token",d="https://www.googleapis.com/auth/cloud-platform",h=3600;e.EXPIRATION_TIME_OFFSET=300*1e3,e.EXTERNAL_ACCOUNT_TYPE="external_account",e.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var m="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",g="https://sts.{universeDomain}/v1/token",_=class Yr extends n.AuthClient{static{p(this,"_BaseExternalAccountClient")}scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(y){super(y);let E=(0,o.originalOrCamelOptions)(y),C=E.get("type");if(C&&C!==e.EXTERNAL_ACCOUNT_TYPE)throw new Error(`Expected "${e.EXTERNAL_ACCOUNT_TYPE}" type but received "${y.type}"`);let S=E.get("client_id"),A=E.get("client_secret");this.tokenUrl=E.get("token_url")??g.replace("{universeDomain}",this.universeDomain);let v=E.get("subject_token_type"),T=E.get("workforce_pool_user_project"),I=E.get("service_account_impersonation_url"),w=E.get("service_account_impersonation"),k=(0,o.originalOrCamelOptions)(w).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(E.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),S&&(this.clientAuth={confidentialClientType:"basic",clientId:S,clientSecret:A}),this.stsCredential=new i.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=E.get("scopes")||[d],this.cachedAccessToken=null,this.audience=E.get("audience"),this.subjectTokenType=v,this.workforcePoolUserProject=T;let R=new RegExp(m);if(this.workforcePoolUserProject&&!this.audience.match(R))throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");this.serviceAccountImpersonationUrl=I,this.serviceAccountImpersonationLifetime=k,this.serviceAccountImpersonationLifetime?this.configLifetimeRequested=!0:(this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=h),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 new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);return/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl)?.groups?.email||null}return null}setCredentials(y){super.setCredentials(y),this.cachedAccessToken=y}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let y=await this.getAccessToken(),E=new Headers({authorization:`Bearer ${y.token}`});return this.addSharedMetadataHeaders(E)}request(y,E){if(E)this.requestAsync(y).then(C=>E(null,C),C=>E(C,C.response));else return this.requestAsync(y)}async getProjectId(){let y=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;if(y){let E=await this.getRequestHeaders(),C={...Yr.RETRY_CONFIG,headers:E,url:`${this.cloudResourceManagerURL.toString()}${y}`,responseType:"json"};n.AuthClient.setMethodName(C,"getProjectId");let S=await this.transporter.request(C);return this.projectId=S.data.projectId,this.projectId}return null}async requestAsync(y,E=!1){let C;try{let S=await this.getRequestHeaders();y.headers=t.Gaxios.mergeHeaders(y.headers),this.addUserProjectAndAuthHeaders(y.headers,S),C=await this.transporter.request(y)}catch(S){let A=S.response;if(A){let v=A.status,T=A.config.data instanceof r.Readable;if(!E&&(v===401||v===403)&&!T&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(y,!0)}throw S}return C}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){let y=await this.retrieveSubjectToken(),E={grantType:c,audience:this.audience,requestedTokenType:u,subjectToken:y,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[d]:this.getScopesArray()},C=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,S=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),A=await this.stsCredential.exchangeToken(E,S,C);return this.serviceAccountImpersonationUrl?this.cachedAccessToken=await this.getImpersonatedAccessToken(A.access_token):A.expires_in?this.cachedAccessToken={access_token:A.access_token,expiry_date:new Date().getTime()+A.expires_in*1e3,res:A.res}:this.cachedAccessToken={access_token:A.access_token,res:A.res},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(y){let E=y.match(/\/projects\/([^/]+)/);return E?E[1]:null}async getImpersonatedAccessToken(y){let E={...Yr.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${y}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"};n.AuthClient.setMethodName(E,"getImpersonatedAccessToken");let C=await this.transporter.request(E),S=C.data;return{access_token:S.accessToken,expiry_date:new Date(S.expireTime).getTime(),res:C}}isExpired(y){let E=new Date().getTime();return y.expiry_date?E>=y.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){return typeof this.scopes=="string"?[this.scopes]:this.scopes||[d]}getMetricsHeaderValue(){let y=process.version.replace(/^v/,""),E=this.serviceAccountImpersonationUrl!==void 0,C=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${y} auth/${a.pkg.version} google-byoid-sdk source/${C} sa-impersonation/${E} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};e.BaseExternalAccountClient=_}}),Al=z({"node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FileSubjectTokenSupplier=void 0;var t=te("util"),r=te("fs"),n=(0,t.promisify)(r.readFile??(()=>{})),i=(0,t.promisify)(r.realpath??(()=>{})),o=(0,t.promisify)(r.lstat??(()=>{})),a=class{static{p(this,"FileSubjectTokenSupplier")}filePath;formatType;subjectTokenFieldName;constructor(c){this.filePath=c.filePath,this.formatType=c.formatType,this.subjectTokenFieldName=c.subjectTokenFieldName}async getSubjectToken(){let c=this.filePath;try{if(c=await i(c),!(await o(c)).isFile())throw new Error}catch(h){throw h instanceof Error&&(h.message=`The file at ${c} does not exist, or it is not a file. ${h.message}`),h}let u,d=await n(c,{encoding:"utf8"});if(this.formatType==="text"?u=d:this.formatType==="json"&&this.subjectTokenFieldName&&(u=JSON.parse(d)[this.subjectTokenFieldName]),!u)throw new Error("Unable to parse the subject_token from the credential_source file");return u}};e.FileSubjectTokenSupplier=a}}),Cl=z({"node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UrlSubjectTokenSupplier=void 0;var t=He(),r=class{static{p(this,"UrlSubjectTokenSupplier")}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 i={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType};t.AuthClient.setMethodName(i,"getSubjectToken");let o;if(this.formatType==="text"?o=(await n.transporter.request(i)).data:this.formatType==="json"&&this.subjectTokenFieldName&&(o=(await n.transporter.request(i)).data[this.subjectTokenFieldName]),!o)throw new Error("Unable to parse the subject_token from the credential_source URL");return o}};e.UrlSubjectTokenSupplier=r}}),Sl=z({"node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CertificateSubjectTokenSupplier=e.InvalidConfigurationError=e.CertificateSourceUnavailableError=e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var t=Qe(),r=te("fs"),n=te("crypto"),i=te("https");e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var o=class extends Error{static{p(this,"CertificateSourceUnavailableError")}constructor(u){super(u),this.name="CertificateSourceUnavailableError"}};e.CertificateSourceUnavailableError=o;var a=class extends Error{static{p(this,"InvalidConfigurationError")}constructor(u){super(u),this.name="InvalidConfigurationError"}};e.InvalidConfigurationError=a;var c=class{static{p(this,"CertificateSubjectTokenSupplier")}certificateConfigPath;trustChainPath;cert;key;constructor(u){if(!u.useDefaultCertificateConfig&&!u.certificateConfigLocation)throw new a("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(u.useDefaultCertificateConfig&&u.certificateConfigLocation)throw new a("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=u.trustChainPath,this.certificateConfigPath=u.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new a("Cannot create mTLS Agent with missing certificate or key");return new i.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();let{certPath:u,keyPath:d}=await this.#t();return{cert:this.cert,key:this.key}=await this.#r(u,d),await this.#n(this.cert)}async#e(){let u=this.certificateConfigPath;if(u){if(await(0,t.isValidFile)(u))return u;throw new o(`Provided certificate config path is invalid: ${u}`)}let d=process.env[e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(d){if(await(0,t.isValidFile)(d))return d;throw new o(`Path from environment variable "${e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${d}`)}let h=(0,t.getWellKnownCertificateConfigFileLocation)();if(await(0,t.isValidFile)(h))return h;throw new o(`Could not find certificate configuration file. Searched override path, the "${e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${h}).`)}async#t(){let u=this.certificateConfigPath,d;try{d=await r.promises.readFile(u,"utf8")}catch{throw new o(`Failed to read certificate config file at: ${u}`)}try{let h=JSON.parse(d),m=h?.cert_configs?.workload?.cert_path,g=h?.cert_configs?.workload?.key_path;if(!m||!g)throw new a(`Certificate config file (${u}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:m,keyPath:g}}catch(h){throw h instanceof a?h:new a(`Failed to parse certificate config from ${u}: ${h.message}`)}}async#r(u,d){let h,m;try{h=await r.promises.readFile(u),new n.X509Certificate(h)}catch(g){let _=g instanceof Error?g.message:String(g);throw new o(`Failed to read certificate file at ${u}: ${_}`)}try{m=await r.promises.readFile(d),(0,n.createPrivateKey)(m)}catch(g){let _=g instanceof Error?g.message:String(g);throw new o(`Failed to read private key file at ${d}: ${_}`)}return{cert:h,key:m}}async#n(u){let d=new n.X509Certificate(u);if(!this.trustChainPath)return JSON.stringify([d.raw.toString("base64")]);try{let h=((await r.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((_,f)=>{try{return new n.X509Certificate(_)}catch(y){let E=y instanceof Error?y.message:String(y);throw new a(`Failed to parse certificate at index ${f} in trust chain file ${this.trustChainPath}: ${E}`)}}),m=h.findIndex(_=>d.raw.equals(_.raw)),g;if(m===-1)g=[d,...h];else if(m===0)g=h;else throw new a(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${m}).`);return JSON.stringify(g.map(_=>_.raw.toString("base64")))}catch(h){if(h instanceof a)throw h;let m=h instanceof Error?h.message:String(h);throw new o(`Failed to process certificate chain from ${this.trustChainPath}: ${m}`)}}};e.CertificateSubjectTokenSupplier=c}}),Rn=z({"node_modules/google-auth-library/build/src/auth/identitypoolclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IdentityPoolClient=void 0;var t=mt(),r=Qe(),n=Al(),i=Cl(),o=Sl(),a=vr(),c=Le(),u=class ka extends t.BaseExternalAccountClient{static{p(this,"_IdentityPoolClient")}subjectTokenSupplier;constructor(h){super(h);let m=(0,r.originalOrCamelOptions)(h),g=m.get("credential_source"),_=m.get("subject_token_supplier");if(!g&&!_)throw new Error("A credential source or subject token supplier must be specified.");if(g&&_)throw new Error("Only one of credential source or subject token supplier can be specified.");if(_)this.subjectTokenSupplier=_,this.credentialSourceType="programmatic";else{let f=(0,r.originalOrCamelOptions)(g),y=(0,r.originalOrCamelOptions)(f.get("format")),E=y.get("type")||"text",C=y.get("subject_token_field_name");if(E!=="json"&&E!=="text")throw new Error(`Invalid credential_source format "${E}"`);if(E==="json"&&!C)throw new Error("Missing subject_token_field_name for JSON credential_source format");let S=f.get("file"),A=f.get("url"),v=f.get("certificate"),T=f.get("headers");if(S&&A||A&&v||S&&v)throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');if(S)this.credentialSourceType="file",this.subjectTokenSupplier=new n.FileSubjectTokenSupplier({filePath:S,formatType:E,subjectTokenFieldName:C});else if(A)this.credentialSourceType="url",this.subjectTokenSupplier=new i.UrlSubjectTokenSupplier({url:A,formatType:E,subjectTokenFieldName:C,headers:T,additionalGaxiosOptions:ka.RETRY_CONFIG});else if(v){this.credentialSourceType="certificate";let I=new o.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:v.use_default_certificate_config,certificateConfigLocation:v.certificate_config_location,trustChainPath:v.trust_chain_path});this.subjectTokenSupplier=I}else throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let h=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof o.CertificateSubjectTokenSupplier){let m=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new a.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new c.Gaxios({agent:m})}),this.transporter=new c.Gaxios({...this.transporter.defaults||{},agent:m})}return h}};e.IdentityPoolClient=u}}),Pn=z({"node_modules/google-auth-library/build/src/auth/awsrequestsigner.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AwsRequestSigner=void 0;var t=Le(),r=jt(),n="AWS4-HMAC-SHA256",i="aws4_request",o=class{static{p(this,"AwsRequestSigner")}getCredentials;region;crypto;constructor(d,h){this.getCredentials=d,this.region=h,this.crypto=(0,r.createCrypto)()}async getRequestOptions(d){if(!d.url)throw new RangeError('"url" is required in "amzOptions"');let h=typeof d.data=="object"?JSON.stringify(d.data):d.data,m=d.url,g=d.method||"GET",_=d.body||h,f=d.headers,y=await this.getCredentials(),E=new URL(m);if(typeof _!="string"&&_!==void 0)throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${_}`);let C=await u({crypto:this.crypto,host:E.host,canonicalUri:E.pathname,canonicalQuerystring:E.search.slice(1),method:g,region:this.region,securityCredentials:y,requestPayload:_,additionalAmzHeaders:f}),S=t.Gaxios.mergeHeaders(C.amzDate?{"x-amz-date":C.amzDate}:{},{authorization:C.authorizationHeader,host:E.host},f||{});y.token&&t.Gaxios.mergeHeaders(S,{"x-amz-security-token":y.token});let A={url:m,method:g,headers:S};return _!==void 0&&(A.body=_),A}};e.AwsRequestSigner=o;async function a(d,h,m){return await d.signWithHmacSha256(h,m)}p(a,"sign");async function c(d,h,m,g,_){let f=await a(d,`AWS4${h}`,m),y=await a(d,f,g),E=await a(d,y,_);return await a(d,E,"aws4_request")}p(c,"getSigningKey");async function u(d){let h=t.Gaxios.mergeHeaders(d.additionalAmzHeaders),m=d.requestPayload||"",g=d.host.split(".")[0],_=new Date,f=_.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),y=_.toISOString().replace(/[-]/g,"").replace(/T.*/,"");d.securityCredentials.token&&h.set("x-amz-security-token",d.securityCredentials.token);let E=t.Gaxios.mergeHeaders({host:d.host},h.has("date")?{}:{"x-amz-date":f},h),C="",S=[...E.keys()].sort();S.forEach(D=>{C+=`${D}:${E.get(D)}
|
|
16
|
+
`});let A=S.join(";"),v=await d.crypto.sha256DigestHex(m),T=`${d.method.toUpperCase()}
|
|
17
|
+
${d.canonicalUri}
|
|
18
|
+
${d.canonicalQuerystring}
|
|
19
|
+
${C}
|
|
20
|
+
${A}
|
|
21
|
+
${v}`,I=`${y}/${d.region}/${g}/${i}`,w=`${n}
|
|
22
|
+
${f}
|
|
23
|
+
${I}
|
|
24
|
+
`+await d.crypto.sha256DigestHex(T),k=await c(d.crypto,d.securityCredentials.secretAccessKey,y,d.region,g),R=await a(d.crypto,k,w),M=`${n} Credential=${d.securityCredentials.accessKeyId}/${I}, SignedHeaders=${A}, Signature=${(0,r.fromArrayBufferToHex)(R)}`;return{amzDate:h.has("date")?void 0:f,authorizationHeader:M,canonicalQuerystring:d.canonicalQuerystring}}p(u,"generateAuthenticationHeaderMap")}}),Il=z({"node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultAwsSecurityCredentialsSupplier=void 0;var t=He(),r=class{static{p(this,"DefaultAwsSecurityCredentialsSupplier")}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 i=new Headers;if(!this.#n&&this.imdsV2SessionTokenUrl&&i.set("x-aws-ec2-metadata-token",await this.#e(n.transporter)),!this.regionUrl)throw new RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let o={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",responseType:"text",headers:i};t.AuthClient.setMethodName(o,"getAwsRegion");let a=await n.transporter.request(o);return a.data.substr(0,a.data.length-1)}async getAwsSecurityCredentials(n){if(this.#i)return this.#i;let i=new Headers;this.imdsV2SessionTokenUrl&&i.set("x-aws-ec2-metadata-token",await this.#e(n.transporter));let o=await this.#t(i,n.transporter),a=await this.#r(o,i,n.transporter);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,token:a.Token}}async#e(n){let i={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return t.AuthClient.setMethodName(i,"#getImdsV2SessionToken"),(await n.request(i)).data}async#t(n,i){if(!this.securityCredentialsUrl)throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let o={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:n};return t.AuthClient.setMethodName(o,"#getAwsRoleName"),(await i.request(o)).data}async#r(n,i,o){let a={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${n}`,headers:i,responseType:"json"};return t.AuthClient.setMethodName(a,"#retrieveAwsSecurityCredentials"),(await o.request(a)).data}get#n(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get#i(){return process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY?{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN}:null}};e.DefaultAwsSecurityCredentialsSupplier=r}}),Nn=z({"node_modules/google-auth-library/build/src/auth/awsclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AwsClient=void 0;var t=Pn(),r=mt(),n=Il(),i=Qe(),o=Le(),a=class zr extends r.BaseExternalAccountClient{static{p(this,"_AwsClient")}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(u){super(u);let d=(0,i.originalOrCamelOptions)(u),h=d.get("credential_source"),m=d.get("aws_security_credentials_supplier");if(!h&&!m)throw new Error("A credential source or AWS security credentials supplier must be specified.");if(h&&m)throw new Error("Only one of credential source or AWS security credentials supplier can be specified.");if(m)this.awsSecurityCredentialsSupplier=m,this.regionalCredVerificationUrl=zr.#e,this.credentialSourceType="programmatic";else{let g=(0,i.originalOrCamelOptions)(h);this.environmentId=g.get("environment_id");let _=g.get("region_url"),f=g.get("url"),y=g.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new n.DefaultAwsSecurityCredentialsSupplier({regionUrl:_,securityCredentialsUrl:f,imdsV2SessionTokenUrl:y}),this.regionalCredVerificationUrl=g.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let u=this.environmentId?.match(/^(aws)(\d+)$/);if(!u||!this.regionalCredVerificationUrl)throw new Error('No valid AWS "credential_source" provided');if(parseInt(u[2],10)!==1)throw new Error(`aws version "${u[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new t.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let u=await this.awsRequestSigner.getRequestOptions({...zr.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),d=[];return o.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},u.headers).forEach((h,m)=>d.push({key:m,value:h})),encodeURIComponent(JSON.stringify({url:u.url,method:u.method,headers:d}))}};e.AwsClient=a}}),kn=z({"node_modules/google-auth-library/build/src/auth/executable-response.js"(e){"use strict";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",i=class{static{p(this,"ExecutableResponse")}version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(_){if(!_.version)throw new a("Executable response must contain a 'version' field.");if(_.success===void 0)throw new c("Executable response must contain a 'success' field.");if(this.version=_.version,this.success=_.success,this.success){if(this.expirationTime=_.expiration_time,this.tokenType=_.token_type,this.tokenType!==t&&this.tokenType!==r&&this.tokenType!==n)throw new d(`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(!_.saml_response)throw new g(`Executable response must contain a 'saml_response' field when token_type=${t}.`);this.subjectToken=_.saml_response}else{if(!_.id_token)throw new g(`Executable response must contain a 'id_token' field when token_type=${r} or ${n}.`);this.subjectToken=_.id_token}}else{if(!_.code)throw new h("Executable response must contain a 'code' field when unsuccessful.");if(!_.message)throw new m("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=_.code,this.errorMessage=_.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};e.ExecutableResponse=i;var o=class extends Error{static{p(this,"ExecutableResponseError")}constructor(_){super(_),Object.setPrototypeOf(this,new.target.prototype)}};e.ExecutableResponseError=o;var a=class extends o{static{p(this,"InvalidVersionFieldError")}};e.InvalidVersionFieldError=a;var c=class extends o{static{p(this,"InvalidSuccessFieldError")}};e.InvalidSuccessFieldError=c;var u=class extends o{static{p(this,"InvalidExpirationTimeFieldError")}};e.InvalidExpirationTimeFieldError=u;var d=class extends o{static{p(this,"InvalidTokenTypeFieldError")}};e.InvalidTokenTypeFieldError=d;var h=class extends o{static{p(this,"InvalidCodeFieldError")}};e.InvalidCodeFieldError=h;var m=class extends o{static{p(this,"InvalidMessageFieldError")}};e.InvalidMessageFieldError=m;var g=class extends o{static{p(this,"InvalidSubjectTokenError")}};e.InvalidSubjectTokenError=g}}),Dn=z({"node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PluggableAuthHandler=e.ExecutableError=void 0;var t=kn(),r=te("child_process"),n=te("fs"),i=class extends Error{static{p(this,"ExecutableError")}code;constructor(a,c){super(`The executable failed with exit code: ${c} and error message: ${a}.`),this.code=c,Object.setPrototypeOf(this,new.target.prototype)}};e.ExecutableError=i;var o=class Da{static{p(this,"_PluggableAuthHandler")}commandComponents;timeoutMillis;outputFile;constructor(c){if(!c.command)throw new Error("No command provided.");if(this.commandComponents=Da.parseCommand(c.command),this.timeoutMillis=c.timeoutMillis,!this.timeoutMillis)throw new Error("No timeoutMillis provided.");this.outputFile=c.outputFile}retrieveResponseFromExecutable(c){return new Promise((u,d)=>{let h=r.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(c)}}),m="";h.stdout.on("data",_=>{m+=_}),h.stderr.on("data",_=>{m+=_});let g=setTimeout(()=>(h.removeAllListeners(),h.kill(),d(new Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);h.on("close",_=>{if(clearTimeout(g),_===0)try{let f=JSON.parse(m),y=new t.ExecutableResponse(f);return u(y)}catch(f){return f instanceof t.ExecutableResponseError?d(f):d(new t.ExecutableResponseError(`The executable returned an invalid response: ${m}`))}else return d(new i(m,_.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let c;try{c=await n.promises.realpath(this.outputFile)}catch{return}if(!(await n.promises.lstat(c)).isFile())return;let u=await n.promises.readFile(c,{encoding:"utf8"});if(u!=="")try{let d=JSON.parse(u);return new t.ExecutableResponse(d).isValid()?new t.ExecutableResponse(d):void 0}catch(d){throw d instanceof t.ExecutableResponseError?d:new t.ExecutableResponseError(`The output file contained an invalid response: ${u}`)}}static parseCommand(c){let u=c.match(/(?:[^\s"]+|"[^"]*")+/g);if(!u)throw new Error(`Provided command: "${c}" could not be parsed.`);for(let d=0;d<u.length;d++)u[d][0]==='"'&&u[d].slice(-1)==='"'&&(u[d]=u[d].slice(1,-1));return u}};e.PluggableAuthHandler=o}}),Mn=z({"node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PluggableAuthClient=e.ExecutableError=void 0;var t=mt(),r=kn(),n=Dn(),i=Dn();Object.defineProperty(e,"ExecutableError",{enumerable:!0,get:p(function(){return i.ExecutableError},"get")});var o=30*1e3,a=5*1e3,c=120*1e3,u="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",d=1,h=class extends t.BaseExternalAccountClient{static{p(this,"PluggableAuthClient")}command;timeoutMillis;outputFile;handler;constructor(m){if(super(m),!m.credential_source.executable)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(this.command=m.credential_source.executable.command,!this.command)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(m.credential_source.executable.timeout_millis===void 0)this.timeoutMillis=o;else if(this.timeoutMillis=m.credential_source.executable.timeout_millis,this.timeoutMillis<a||this.timeoutMillis>c)throw new Error(`Timeout must be between ${a} and ${c} milliseconds.`);this.outputFile=m.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[u]!=="1")throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let m;if(this.outputFile&&(m=await this.handler.retrieveCachedResponse()),!m){let g=new Map;g.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),g.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),g.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile&&g.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let _=this.getServiceAccountEmail();_&&g.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",_),m=await this.handler.retrieveResponseFromExecutable(g)}if(m.version>d)throw new Error(`Version of executable is not currently supported, maximum supported version is ${d}.`);if(!m.success)throw new n.ExecutableError(m.errorMessage,m.errorCode);if(this.outputFile&&!m.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(m.isExpired())throw new Error("Executable response is expired.");return m.subjectToken}};e.PluggableAuthClient=h}}),xn=z({"node_modules/google-auth-library/build/src/auth/externalclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAccountClient=void 0;var t=mt(),r=Rn(),n=Nn(),i=Mn(),o=class{static{p(this,"ExternalAccountClient")}constructor(){throw new 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(a){return a&&a.type===t.EXTERNAL_ACCOUNT_TYPE?a.credential_source?.environment_id?new n.AwsClient(a):a.credential_source?.executable?new i.PluggableAuthClient(a):new r.IdentityPoolClient(a):null}};e.ExternalAccountClient=o}}),bn=z({"node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAccountAuthorizedUserClient=e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var t=He(),r=wn(),n=Le(),i=te("stream"),o=mt();e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var a="https://sts.{universeDomain}/v1/oauthtoken",c=class Ma extends r.OAuthClientAuthHandler{static{p(this,"_ExternalAccountAuthorizedUserHandler")}#e;constructor(h){super(h),this.#e=h.tokenRefreshEndpoint}async refreshToken(h,m){let g={...Ma.RETRY_CONFIG,url:this.#e,method:"POST",headers:m,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:h}),responseType:"json"};t.AuthClient.setMethodName(g,"refreshToken"),this.applyClientAuthenticationOptions(g);try{let _=await this.transporter.request(g),f=_.data;return f.res=_,f}catch(_){throw _ instanceof n.GaxiosError&&_.response?(0,r.getErrorFromOAuthErrorResponse)(_.response.data,_):_}}},u=class extends t.AuthClient{static{p(this,"ExternalAccountAuthorizedUserClient")}cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(d){super(d),d.universe_domain&&(this.universeDomain=d.universe_domain),this.refreshToken=d.refresh_token;let h={confidentialClientType:"basic",clientId:d.client_id,clientSecret:d.client_secret};this.externalAccountAuthorizedUserHandler=new c({tokenRefreshEndpoint:d.token_url??a.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:h}),this.cachedAccessToken=null,this.quotaProjectId=d.quota_project_id,typeof d?.eagerRefreshThresholdMillis!="number"?this.eagerRefreshThresholdMillis=o.EXPIRATION_TIME_OFFSET:this.eagerRefreshThresholdMillis=d.eagerRefreshThresholdMillis,this.forceRefreshOnFailure=!!d?.forceRefreshOnFailure}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let d=await this.getAccessToken(),h=new Headers({authorization:`Bearer ${d.token}`});return this.addSharedMetadataHeaders(h)}request(d,h){if(h)this.requestAsync(d).then(m=>h(null,m),m=>h(m,m.response));else return this.requestAsync(d)}async requestAsync(d,h=!1){let m;try{let g=await this.getRequestHeaders();d.headers=n.Gaxios.mergeHeaders(d.headers),this.addUserProjectAndAuthHeaders(d.headers,g),m=await this.transporter.request(d)}catch(g){let _=g.response;if(_){let f=_.status,y=_.config.data instanceof i.Readable;if(!h&&(f===401||f===403)&&!y&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(d,!0)}throw g}return m}async refreshAccessTokenAsync(){let d=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);return this.cachedAccessToken={access_token:d.access_token,expiry_date:new Date().getTime()+d.expires_in*1e3,res:d.res},d.refresh_token!==void 0&&(this.refreshToken=d.refresh_token),this.cachedAccessToken}isExpired(d){let h=new Date().getTime();return d.expiry_date?h>=d.expiry_date-this.eagerRefreshThresholdMillis:!1}};e.ExternalAccountAuthorizedUserClient=u}}),wl=z({"node_modules/google-auth-library/build/src/auth/googleauth.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleAuth=e.GoogleAuthExceptionMessages=void 0;var t=te("child_process"),r=te("fs"),n=Le(),i=Zt(),o=te("os"),a=te("path"),c=jt(),u=hn(),d=fn(),h=mn(),m=Cn(),g=Sn(),_=In(),f=xn(),y=mt(),E=He(),C=bn(),S=Qe();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.
|
|
25
|
+
To learn more about authentication and Google APIs, visit:
|
|
26
|
+
https://cloud.google.com/docs/authentication/getting-started`,NO_CREDENTIALS_FOUND:`Unable to find credentials in current environment.
|
|
27
|
+
To learn more about authentication and Google APIs, visit:
|
|
28
|
+
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.
|
|
29
|
+
To learn more about Universe Domain retrieval, visit:
|
|
30
|
+
https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`};var A=class{static{p(this,"GoogleAuth2")}checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#e=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(v={}){if(this._cachedProjectId=v.projectId||null,this.cachedCredential=v.authClient||null,this.keyFilename=v.keyFilename||v.keyFile,this.scopes=v.scopes,this.clientOptions=v.clientOptions||{},this.jsonContent=v.credentials||null,this.apiKey=v.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw new RangeError(e.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);v.universeDomain&&(this.clientOptions.universeDomain=v.universeDomain)}setGapicJWTValues(v){v.defaultServicePath=this.defaultServicePath,v.useJWTAccessWithScope=this.useJWTAccessWithScope,v.defaultScopes=this.defaultScopes}getProjectId(v){if(v)this.getProjectIdAsync().then(T=>v(null,T),v);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(v){if(v instanceof Error&&v.message===e.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;throw v}}async findAndCacheProjectId(){let v=null;if(v||=await this.getProductionProjectId(),v||=await this.getFileProjectId(),v||=await this.getDefaultServiceProjectId(),v||=await this.getGCEProjectId(),v||=await this.getExternalAccountClientProjectId(),v)return this._cachedProjectId=v,v;throw new Error(e.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){return this._cachedProjectId?this._cachedProjectId:(this._findProjectIdPromise||(this._findProjectIdPromise=this.findAndCacheProjectId()),this._findProjectIdPromise)}async getUniverseDomainFromMetadataServer(){let v;try{v=await i.universe("universe-domain"),v||=E.DEFAULT_UNIVERSE}catch(T){if(T&&T?.response?.status===404)v=E.DEFAULT_UNIVERSE;else throw T}return v}async getUniverseDomain(){let v=(0,S.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{v??=(await this.getClient()).universeDomain}catch{v??=E.DEFAULT_UNIVERSE}return v}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(v={},T){let I;if(typeof v=="function"?T=v:I=v,T)this.getApplicationDefaultAsync(I).then(w=>T(null,w.credential,w.projectId),T);else return this.getApplicationDefaultAsync(I)}async getApplicationDefaultAsync(v={}){if(this.cachedCredential)return await this.#t(this.cachedCredential,null);let T;if(T=await this._tryGetApplicationCredentialsFromEnvironmentVariable(v),T)return T instanceof m.JWT?T.scopes=this.scopes:T instanceof y.BaseExternalAccountClient&&(T.scopes=this.getAnyScopes()),await this.#t(T);if(T=await this._tryGetApplicationCredentialsFromWellKnownFile(v),T)return T instanceof m.JWT?T.scopes=this.scopes:T instanceof y.BaseExternalAccountClient&&(T.scopes=this.getAnyScopes()),await this.#t(T);if(await this._checkIsGCE())return v.scopes=this.getAnyScopes(),await this.#t(new u.Compute(v));throw new Error(e.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#t(v,T=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let I=await this.getProjectIdOptional();return T&&(v.quotaProjectId=T),this.cachedCredential=v,{credential:v,projectId:I}}async _checkIsGCE(){return this.checkIsGCE===void 0&&(this.checkIsGCE=i.getGCPResidency()||await i.isAvailable()),this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(v){let T=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!T||T.length===0)return null;try{return this._getApplicationCredentialsFromFilePath(T,v)}catch(I){throw I instanceof Error&&(I.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${I.message}`),I}}async _tryGetApplicationCredentialsFromWellKnownFile(v){let T=null;if(this._isWindows())T=process.env.APPDATA;else{let I=process.env.HOME;I&&(T=a.join(I,".config"))}return T&&(T=a.join(T,"gcloud","application_default_credentials.json"),r.existsSync(T)||(T=null)),T?await this._getApplicationCredentialsFromFilePath(T,v):null}async _getApplicationCredentialsFromFilePath(v,T={}){if(!v||v.length===0)throw new Error("The file path is invalid.");try{if(v=r.realpathSync(v),!r.lstatSync(v).isFile())throw new Error}catch(w){throw w instanceof Error&&(w.message=`The file at ${v} does not exist, or it is not a file. ${w.message}`),w}let I=r.createReadStream(v);return this.fromStream(I,T)}fromImpersonatedJSON(v){if(!v)throw new Error("Must pass in a JSON object containing an impersonated refresh token");if(v.type!==_.IMPERSONATED_ACCOUNT_TYPE)throw new Error(`The incoming JSON object does not have the "${_.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!v.source_credentials)throw new Error("The incoming JSON object does not contain a source_credentials field");if(!v.service_account_impersonation_url)throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");let T=this.fromJSON(v.source_credentials);if(v.service_account_impersonation_url?.length>256)throw new RangeError(`Target principal is too long: ${v.service_account_impersonation_url}`);let I=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(v.service_account_impersonation_url)?.groups?.target;if(!I)throw new RangeError(`Cannot extract target principal from ${v.service_account_impersonation_url}`);let w=(this.scopes||v.scopes||this.defaultScopes)??[];return new _.Impersonated({...v,sourceClient:T,targetPrincipal:I,targetScopes:Array.isArray(w)?w:[w]})}fromJSON(v,T={}){let I,w=(0,S.originalOrCamelOptions)(T).get("universe_domain");return v.type===g.USER_REFRESH_ACCOUNT_TYPE?(I=new g.UserRefreshClient(T),I.fromJSON(v)):v.type===_.IMPERSONATED_ACCOUNT_TYPE?I=this.fromImpersonatedJSON(v):v.type===y.EXTERNAL_ACCOUNT_TYPE?(I=f.ExternalAccountClient.fromJSON({...v,...T}),I.scopes=this.getAnyScopes()):v.type===C.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?I=new C.ExternalAccountAuthorizedUserClient({...v,...T}):(T.scopes=this.scopes,I=new m.JWT(T),this.setGapicJWTValues(I),I.fromJSON(v)),w&&(I.universeDomain=w),I}_cacheClientFromJSON(v,T){let I=this.fromJSON(v,T);return this.jsonContent=v,this.cachedCredential=I,I}fromStream(v,T={},I){let w={};if(typeof T=="function"?I=T:w=T,I)this.fromStreamAsync(v,w).then(k=>I(null,k),I);else return this.fromStreamAsync(v,w)}fromStreamAsync(v,T){return new Promise((I,w)=>{if(!v)throw new Error("Must pass in a stream containing the Google auth settings.");let k=[];v.setEncoding("utf8").on("error",w).on("data",R=>k.push(R)).on("end",()=>{try{try{let R=JSON.parse(k.join("")),M=this._cacheClientFromJSON(R,T);return I(M)}catch(R){if(!this.keyFilename)throw R;let M=new m.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=M,this.setGapicJWTValues(M),I(M)}}catch(R){return w(R)}})})}fromAPIKey(v,T={}){return new m.JWT({...T,apiKey:v})}_isWindows(){let v=o.platform();return!!(v&&v.length>=3&&v.substring(0,3).toLowerCase()==="win")}async getDefaultServiceProjectId(){return new Promise(v=>{(0,t.exec)("gcloud config config-helper --format json",(T,I)=>{if(!T&&I)try{let w=JSON.parse(I).configuration.properties.core.project;v(w);return}catch{}v(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let T=await this.getClient();if(T&&T.projectId)return T.projectId}let v=await this._tryGetApplicationCredentialsFromEnvironmentVariable();return v?v.projectId:null}async getExternalAccountClientProjectId(){return!this.jsonContent||this.jsonContent.type!==y.EXTERNAL_ACCOUNT_TYPE?null:await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await i.project("project-id")}catch{return null}}getCredentials(v){if(v)this.getCredentialsAsync().then(T=>v(null,T),v);else return this.getCredentialsAsync()}async getCredentialsAsync(){let v=await this.getClient();if(v instanceof _.Impersonated)return{client_email:v.getTargetPrincipal()};if(v instanceof y.BaseExternalAccountClient){let T=v.getServiceAccountEmail();if(T)return{client_email:T,universe_domain:v.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[T,I]=await Promise.all([i.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:T,universe_domain:I}}throw new Error(e.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#e=this.#e||this.#r();try{return await this.#e}finally{this.#e=null}}async#r(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);if(this.keyFilename){let v=a.resolve(this.keyFilename),T=r.createReadStream(v);return await this.fromStreamAsync(T,this.clientOptions)}else if(this.apiKey){let v=await this.fromAPIKey(this.apiKey,this.clientOptions);v.scopes=this.scopes;let{credential:T}=await this.#t(v);return T}else{let{credential:v}=await this.getApplicationDefaultAsync(this.clientOptions);return v}}async getIdTokenClient(v){let T=await this.getClient();if(!("fetchIdToken"in T))throw new 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 d.IdTokenClient({targetAudience:v,idTokenProvider:T})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(v){return(await this.getClient()).getRequestHeaders(v)}async authorizeRequest(v={}){let T=v.url,I=await(await this.getClient()).getRequestHeaders(T);return v.headers=n.Gaxios.mergeHeaders(v.headers,I),v}async fetch(...v){return(await this.getClient()).fetch(...v)}async request(v){return(await this.getClient()).request(v)}getEnv(){return(0,h.getEnv)()}async sign(v,T){let I=await this.getClient(),w=await this.getUniverseDomain();if(T=T||`https://iamcredentials.${w}/v1/projects/-/serviceAccounts/`,I instanceof _.Impersonated)return(await I.sign(v)).signedBlob;let k=(0,c.createCrypto)();if(I instanceof m.JWT&&I.key)return await k.sign(I.key,v);let R=await this.getCredentials();if(!R.client_email)throw new Error("Cannot sign data without `client_email`.");return this.signBlob(k,R.client_email,v,T)}async signBlob(v,T,I,w){let k=new URL(w+`${T}:signBlob`);return(await this.request({method:"POST",url:k.href,data:{payload:v.encodeBase64StringUtf8(I)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};e.GoogleAuth=A}}),Rl=z({"node_modules/google-auth-library/build/src/auth/iam.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IAMAuth=void 0;var t=class{static{p(this,"IAMAuth")}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}}),Pl=z({"node_modules/google-auth-library/build/src/auth/downscopedclient.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DownscopedClient=e.EXPIRATION_TIME_OFFSET=e.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var t=Le(),r=te("stream"),n=He(),i=vr(),o="urn:ietf:params:oauth:grant-type:token-exchange",a="urn:ietf:params:oauth:token-type:access_token",c="urn:ietf:params:oauth:token-type:access_token";e.MAX_ACCESS_BOUNDARY_RULES_COUNT=10,e.EXPIRATION_TIME_OFFSET=300*1e3;var u=class extends n.AuthClient{static{p(this,"DownscopedClient")}authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(d,h={accessBoundary:{accessBoundaryRules:[]}}){if(super(d instanceof n.AuthClient?{}:d),d instanceof n.AuthClient?(this.authClient=d,this.credentialAccessBoundary=h):(this.authClient=d.authClient,this.credentialAccessBoundary=d.credentialAccessBoundary),this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw new Error("At least one access boundary rule needs to be defined.");if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>e.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw new Error(`The provided access boundary has more than ${e.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let m of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(m.availablePermissions.length===0)throw new Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new i.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(d){if(!d.expiry_date)throw new Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(d),this.cachedDownscopedAccessToken=d}async getAccessToken(){return(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let d=await this.getAccessToken(),h=new Headers({authorization:`Bearer ${d.token}`});return this.addSharedMetadataHeaders(h)}request(d,h){if(h)this.requestAsync(d).then(m=>h(null,m),m=>h(m,m.response));else return this.requestAsync(d)}async requestAsync(d,h=!1){let m;try{let g=await this.getRequestHeaders();d.headers=t.Gaxios.mergeHeaders(d.headers),this.addUserProjectAndAuthHeaders(d.headers,g),m=await this.transporter.request(d)}catch(g){let _=g.response;if(_){let f=_.status,y=_.config.data instanceof r.Readable;if(!h&&(f===401||f===403)&&!y&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(d,!0)}throw g}return m}async refreshAccessTokenAsync(){let d=(await this.authClient.getAccessToken()).token,h={grantType:o,requestedTokenType:a,subjectToken:d,subjectTokenType:c},m=await this.stsCredential.exchangeToken(h,void 0,this.credentialAccessBoundary),g=this.authClient.credentials?.expiry_date||null,_=m.expires_in?new Date().getTime()+m.expires_in*1e3:g;return this.cachedDownscopedAccessToken={access_token:m.access_token,expiry_date:_,res:m.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(d){let h=new Date().getTime();return d.expiry_date?h>=d.expiry_date-this.eagerRefreshThresholdMillis:!1}};e.DownscopedClient=u}}),Nl=z({"node_modules/google-auth-library/build/src/auth/passthrough.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PassThroughClient=void 0;var t=He(),r=class extends t.AuthClient{static{p(this,"PassThroughClient")}async request(n){return this.transporter.request(n)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};e.PassThroughClient=r}}),kl=z({"node_modules/google-auth-library/build/src/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(R,M,D,J){J===void 0&&(J=D);var O=Object.getOwnPropertyDescriptor(M,D);(!O||("get"in O?!M.__esModule:O.writable||O.configurable))&&(O={enumerable:!0,get:p(function(){return M[D]},"get")}),Object.defineProperty(R,J,O)}):(function(R,M,D,J){J===void 0&&(J=D),R[J]=M[D]})),r=e&&e.__exportStar||function(R,M){for(var D in R)D!=="default"&&!Object.prototype.hasOwnProperty.call(M,D)&&t(M,R,D)};Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleAuth=e.auth=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=wl();Object.defineProperty(e,"GoogleAuth",{enumerable:!0,get:p(function(){return n.GoogleAuth},"get")}),e.gcpMetadata=Zt(),e.gaxios=Le();var i=He();Object.defineProperty(e,"AuthClient",{enumerable:!0,get:p(function(){return i.AuthClient},"get")}),Object.defineProperty(e,"DEFAULT_UNIVERSE",{enumerable:!0,get:p(function(){return i.DEFAULT_UNIVERSE},"get")});var o=hn();Object.defineProperty(e,"Compute",{enumerable:!0,get:p(function(){return o.Compute},"get")});var a=mn();Object.defineProperty(e,"GCPEnv",{enumerable:!0,get:p(function(){return a.GCPEnv},"get")});var c=Rl();Object.defineProperty(e,"IAMAuth",{enumerable:!0,get:p(function(){return c.IAMAuth},"get")});var u=fn();Object.defineProperty(e,"IdTokenClient",{enumerable:!0,get:p(function(){return u.IdTokenClient},"get")});var d=An();Object.defineProperty(e,"JWTAccess",{enumerable:!0,get:p(function(){return d.JWTAccess},"get")});var h=Cn();Object.defineProperty(e,"JWT",{enumerable:!0,get:p(function(){return h.JWT},"get")});var m=In();Object.defineProperty(e,"Impersonated",{enumerable:!0,get:p(function(){return m.Impersonated},"get")});var g=It();Object.defineProperty(e,"CodeChallengeMethod",{enumerable:!0,get:p(function(){return g.CodeChallengeMethod},"get")}),Object.defineProperty(e,"OAuth2Client",{enumerable:!0,get:p(function(){return g.OAuth2Client},"get")}),Object.defineProperty(e,"ClientAuthentication",{enumerable:!0,get:p(function(){return g.ClientAuthentication},"get")});var _=pn();Object.defineProperty(e,"LoginTicket",{enumerable:!0,get:p(function(){return _.LoginTicket},"get")});var f=Sn();Object.defineProperty(e,"UserRefreshClient",{enumerable:!0,get:p(function(){return f.UserRefreshClient},"get")});var y=Nn();Object.defineProperty(e,"AwsClient",{enumerable:!0,get:p(function(){return y.AwsClient},"get")});var E=Pn();Object.defineProperty(e,"AwsRequestSigner",{enumerable:!0,get:p(function(){return E.AwsRequestSigner},"get")});var C=Rn();Object.defineProperty(e,"IdentityPoolClient",{enumerable:!0,get:p(function(){return C.IdentityPoolClient},"get")});var S=xn();Object.defineProperty(e,"ExternalAccountClient",{enumerable:!0,get:p(function(){return S.ExternalAccountClient},"get")});var A=mt();Object.defineProperty(e,"BaseExternalAccountClient",{enumerable:!0,get:p(function(){return A.BaseExternalAccountClient},"get")});var v=Pl();Object.defineProperty(e,"DownscopedClient",{enumerable:!0,get:p(function(){return v.DownscopedClient},"get")});var T=Mn();Object.defineProperty(e,"PluggableAuthClient",{enumerable:!0,get:p(function(){return T.PluggableAuthClient},"get")}),Object.defineProperty(e,"ExecutableError",{enumerable:!0,get:p(function(){return T.ExecutableError},"get")});var I=bn();Object.defineProperty(e,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:p(function(){return I.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE},"get")}),Object.defineProperty(e,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:p(function(){return I.ExternalAccountAuthorizedUserClient},"get")});var w=Nl();Object.defineProperty(e,"PassThroughClient",{enumerable:!0,get:p(function(){return w.PassThroughClient},"get")}),r(Tn(),e);var k=new n.GoogleAuth;e.auth=k}}),at=z({"node_modules/ws/lib/constants.js"(e,t){"use strict";var r=["nodebuffer","arraybuffer","fragments"],n=typeof Blob<"u";n&&r.push("blob"),t.exports={BINARY_TYPES:r,CLOSE_TIMEOUT:3e4,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:p(()=>{},"NOOP")}}}),er=z({"node_modules/ws/lib/buffer-util.js"(e,t){"use strict";var{EMPTY_BUFFER:r}=at(),n=Buffer[Symbol.species];function i(d,h){if(d.length===0)return r;if(d.length===1)return d[0];let m=Buffer.allocUnsafe(h),g=0;for(let _=0;_<d.length;_++){let f=d[_];m.set(f,g),g+=f.length}return g<h?new n(m.buffer,m.byteOffset,g):m}p(i,"concat");function o(d,h,m,g,_){for(let f=0;f<_;f++)m[g+f]=d[f]^h[f&3]}p(o,"_mask");function a(d,h){for(let m=0;m<d.length;m++)d[m]^=h[m&3]}p(a,"_unmask");function c(d){return d.length===d.buffer.byteLength?d.buffer:d.buffer.slice(d.byteOffset,d.byteOffset+d.length)}p(c,"toArrayBuffer");function u(d){if(u.readOnly=!0,Buffer.isBuffer(d))return d;let h;return d instanceof ArrayBuffer?h=new n(d):ArrayBuffer.isView(d)?h=new n(d.buffer,d.byteOffset,d.byteLength):(h=Buffer.from(d),u.readOnly=!1),h}if(p(u,"toBuffer"),t.exports={concat:i,mask:o,toArrayBuffer:c,toBuffer:u,unmask:a},!process.env.WS_NO_BUFFER_UTIL)try{let d=te("bufferutil");t.exports.mask=function(h,m,g,_,f){f<48?o(h,m,g,_,f):d.mask(h,m,g,_,f)},t.exports.unmask=function(h,m){h.length<32?a(h,m):d.unmask(h,m)}}catch{}}}),Dl=z({"node_modules/ws/lib/limiter.js"(e,t){"use strict";var r=Symbol("kDone"),n=Symbol("kRun"),i=class{static{p(this,"Limiter")}constructor(o){this[r]=()=>{this.pending--,this[n]()},this.concurrency=o||1/0,this.jobs=[],this.pending=0}add(o){this.jobs.push(o),this[n]()}[n](){if(this.pending!==this.concurrency&&this.jobs.length){let o=this.jobs.shift();this.pending++,o(this[r])}}};t.exports=i}}),Ht=z({"node_modules/ws/lib/permessage-deflate.js"(e,t){"use strict";var r=te("zlib"),n=er(),i=Dl(),{kStatusCode:o}=at(),a=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),u=Symbol("permessage-deflate"),d=Symbol("total-length"),h=Symbol("callback"),m=Symbol("buffers"),g=Symbol("error"),_,f=class{static{p(this,"PerMessageDeflate2")}constructor(S){if(this._options=S||{},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,!_){let A=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;_=new i(A)}}static get extensionName(){return"permessage-deflate"}offer(){let S={};return this._options.serverNoContextTakeover&&(S.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(S.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(S.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?S.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(S.client_max_window_bits=!0),S}accept(S){return S=this.normalizeParams(S),this.params=this._isServer?this.acceptAsServer(S):this.acceptAsClient(S),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let S=this._deflate[h];this._deflate.close(),this._deflate=null,S&&S(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(S){let A=this._options,v=S.find(T=>!(A.serverNoContextTakeover===!1&&T.server_no_context_takeover||T.server_max_window_bits&&(A.serverMaxWindowBits===!1||typeof A.serverMaxWindowBits=="number"&&A.serverMaxWindowBits>T.server_max_window_bits)||typeof A.clientMaxWindowBits=="number"&&!T.client_max_window_bits));if(!v)throw new Error("None of the extension offers can be accepted");return A.serverNoContextTakeover&&(v.server_no_context_takeover=!0),A.clientNoContextTakeover&&(v.client_no_context_takeover=!0),typeof A.serverMaxWindowBits=="number"&&(v.server_max_window_bits=A.serverMaxWindowBits),typeof A.clientMaxWindowBits=="number"?v.client_max_window_bits=A.clientMaxWindowBits:(v.client_max_window_bits===!0||A.clientMaxWindowBits===!1)&&delete v.client_max_window_bits,v}acceptAsClient(S){let A=S[0];if(this._options.clientNoContextTakeover===!1&&A.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!A.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(A.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&A.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return A}normalizeParams(S){return S.forEach(A=>{Object.keys(A).forEach(v=>{let T=A[v];if(T.length>1)throw new Error(`Parameter "${v}" must have only a single value`);if(T=T[0],v==="client_max_window_bits"){if(T!==!0){let I=+T;if(!Number.isInteger(I)||I<8||I>15)throw new TypeError(`Invalid value for parameter "${v}": ${T}`);T=I}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${v}": ${T}`)}else if(v==="server_max_window_bits"){let I=+T;if(!Number.isInteger(I)||I<8||I>15)throw new TypeError(`Invalid value for parameter "${v}": ${T}`);T=I}else if(v==="client_no_context_takeover"||v==="server_no_context_takeover"){if(T!==!0)throw new TypeError(`Invalid value for parameter "${v}": ${T}`)}else throw new Error(`Unknown parameter "${v}"`);A[v]=T})}),S}decompress(S,A,v){_.add(T=>{this._decompress(S,A,(I,w)=>{T(),v(I,w)})})}compress(S,A,v){_.add(T=>{this._compress(S,A,(I,w)=>{T(),v(I,w)})})}_decompress(S,A,v){let T=this._isServer?"client":"server";if(!this._inflate){let I=`${T}_max_window_bits`,w=typeof this.params[I]!="number"?r.Z_DEFAULT_WINDOWBITS:this.params[I];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:w}),this._inflate[u]=this,this._inflate[d]=0,this._inflate[m]=[],this._inflate.on("error",C),this._inflate.on("data",E)}this._inflate[h]=v,this._inflate.write(S),A&&this._inflate.write(c),this._inflate.flush(()=>{let I=this._inflate[g];if(I){this._inflate.close(),this._inflate=null,v(I);return}let w=n.concat(this._inflate[m],this._inflate[d]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[d]=0,this._inflate[m]=[],A&&this.params[`${T}_no_context_takeover`]&&this._inflate.reset()),v(null,w)})}_compress(S,A,v){let T=this._isServer?"server":"client";if(!this._deflate){let I=`${T}_max_window_bits`,w=typeof this.params[I]!="number"?r.Z_DEFAULT_WINDOWBITS:this.params[I];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:w}),this._deflate[d]=0,this._deflate[m]=[],this._deflate.on("data",y)}this._deflate[h]=v,this._deflate.write(S),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let I=n.concat(this._deflate[m],this._deflate[d]);A&&(I=new a(I.buffer,I.byteOffset,I.length-4)),this._deflate[h]=null,this._deflate[d]=0,this._deflate[m]=[],A&&this.params[`${T}_no_context_takeover`]&&this._deflate.reset(),v(null,I)})}};t.exports=f;function y(S){this[m].push(S),this[d]+=S.length}p(y,"deflateOnData");function E(S){if(this[d]+=S.length,this[u]._maxPayload<1||this[d]<=this[u]._maxPayload){this[m].push(S);return}this[g]=new RangeError("Max payload size exceeded"),this[g].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[g][o]=1009,this.removeListener("data",E),this.reset()}p(E,"inflateOnData");function C(S){if(this[u]._inflate=null,this[g]){this[h](this[g]);return}S[o]=1007,this[h](S)}p(C,"inflateOnError")}}),Vt=z({"node_modules/ws/lib/validation.js"(e,t){"use strict";var{isUtf8:r}=te("buffer"),{hasBlob:n}=at(),i=[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 o(u){return u>=1e3&&u<=1014&&u!==1004&&u!==1005&&u!==1006||u>=3e3&&u<=4999}p(o,"isValidStatusCode");function a(u){let d=u.length,h=0;for(;h<d;)if((u[h]&128)===0)h++;else if((u[h]&224)===192){if(h+1===d||(u[h+1]&192)!==128||(u[h]&254)===192)return!1;h+=2}else if((u[h]&240)===224){if(h+2>=d||(u[h+1]&192)!==128||(u[h+2]&192)!==128||u[h]===224&&(u[h+1]&224)===128||u[h]===237&&(u[h+1]&224)===160)return!1;h+=3}else if((u[h]&248)===240){if(h+3>=d||(u[h+1]&192)!==128||(u[h+2]&192)!==128||(u[h+3]&192)!==128||u[h]===240&&(u[h+1]&240)===128||u[h]===244&&u[h+1]>143||u[h]>244)return!1;h+=4}else return!1;return!0}p(a,"_isValidUTF8");function c(u){return n&&typeof u=="object"&&typeof u.arrayBuffer=="function"&&typeof u.type=="string"&&typeof u.stream=="function"&&(u[Symbol.toStringTag]==="Blob"||u[Symbol.toStringTag]==="File")}if(p(c,"isBlob"),t.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:a,tokenChars:i},r)t.exports.isValidUTF8=function(u){return u.length<24?a(u):r(u)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let u=te("utf-8-validate");t.exports.isValidUTF8=function(d){return d.length<32?a(d):u(d)}}catch{}}}),Un=z({"node_modules/ws/lib/receiver.js"(e,t){"use strict";var{Writable:r}=te("stream"),n=Ht(),{BINARY_TYPES:i,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=at(),{concat:u,toArrayBuffer:d,unmask:h}=er(),{isValidStatusCode:m,isValidUTF8:g}=Vt(),_=Buffer[Symbol.species],f=0,y=1,E=2,C=3,S=4,A=5,v=6,T=class extends r{static{p(this,"Receiver2")}constructor(I={}){super(),this._allowSynchronousEvents=I.allowSynchronousEvents!==void 0?I.allowSynchronousEvents:!0,this._binaryType=I.binaryType||i[0],this._extensions=I.extensions||{},this._isServer=!!I.isServer,this._maxBufferedChunks=I.maxBufferedChunks|0,this._maxFragments=I.maxFragments|0,this._maxPayload=I.maxPayload|0,this._skipUTF8Validation=!!I.skipUTF8Validation,this[c]=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._fragments=[],this._errored=!1,this._loop=!1,this._state=f}_write(I,w,k){if(this._opcode===8&&this._state==f)return k();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){k(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=I.length,this._buffers.push(I),this.startLoop(k)}consume(I){if(this._bufferedBytes-=I,I===this._buffers[0].length)return this._buffers.shift();if(I<this._buffers[0].length){let k=this._buffers[0];return this._buffers[0]=new _(k.buffer,k.byteOffset+I,k.length-I),new _(k.buffer,k.byteOffset,I)}let w=Buffer.allocUnsafe(I);do{let k=this._buffers[0],R=w.length-I;I>=k.length?w.set(this._buffers.shift(),R):(w.set(new Uint8Array(k.buffer,k.byteOffset,I),R),this._buffers[0]=new _(k.buffer,k.byteOffset+I,k.length-I)),I-=k.length}while(I>0);return w}startLoop(I){this._loop=!0;do switch(this._state){case f:this.getInfo(I);break;case y:this.getPayloadLength16(I);break;case E:this.getPayloadLength64(I);break;case C:this.getMask();break;case S:this.getData(I);break;case A:case v:this._loop=!1;return}while(this._loop);this._errored||I()}getInfo(I){if(this._bufferedBytes<2){this._loop=!1;return}let w=this.consume(2);if((w[0]&48)!==0){let R=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");I(R);return}let k=(w[0]&64)===64;if(k&&!this._extensions[n.extensionName]){let R=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");I(R);return}if(this._fin=(w[0]&128)===128,this._opcode=w[0]&15,this._payloadLength=w[1]&127,this._opcode===0){if(k){let R=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");I(R);return}if(!this._fragmented){let R=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");I(R);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let R=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");I(R);return}this._compressed=k}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let R=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");I(R);return}if(k){let R=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");I(R);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let R=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");I(R);return}}else{let R=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");I(R);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(w[1]&128)===128,this._isServer){if(!this._masked){let R=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");I(R);return}}else if(this._masked){let R=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");I(R);return}this._payloadLength===126?this._state=y:this._payloadLength===127?this._state=E:this.haveLength(I)}getPayloadLength16(I){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(I)}getPayloadLength64(I){if(this._bufferedBytes<8){this._loop=!1;return}let w=this.consume(8),k=w.readUInt32BE(0);if(k>Math.pow(2,21)-1){let R=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");I(R);return}this._payloadLength=k*Math.pow(2,32)+w.readUInt32BE(4),this.haveLength(I)}haveLength(I){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let w=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");I(w);return}this._masked?this._state=C:this._state=S}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=S}getData(I){let w=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}w=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&h(w,this._mask)}if(this._opcode>7){this.controlMessage(w,I);return}if(this._compressed){this._state=A,this.decompress(w,I);return}if(w.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let k=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");I(k);return}this._messageLength=this._totalPayloadLength,this._fragments.push(w)}this.dataMessage(I)}decompress(I,w){this._extensions[n.extensionName].decompress(I,this._fin,(k,R)=>{if(k)return w(k);if(R.length){if(this._messageLength+=R.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let M=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");w(M);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let M=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");w(M);return}this._fragments.push(R)}this.dataMessage(w),this._state===f&&this.startLoop(w)})}dataMessage(I){if(!this._fin){this._state=f;return}let w=this._messageLength,k=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let R;this._binaryType==="nodebuffer"?R=u(k,w):this._binaryType==="arraybuffer"?R=d(u(k,w)):this._binaryType==="blob"?R=new Blob(k):R=k,this._allowSynchronousEvents?(this.emit("message",R,!0),this._state=f):(this._state=v,setImmediate(()=>{this.emit("message",R,!0),this._state=f,this.startLoop(I)}))}else{let R=u(k,w);if(!this._skipUTF8Validation&&!g(R)){let M=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");I(M);return}this._state===A||this._allowSynchronousEvents?(this.emit("message",R,!1),this._state=f):(this._state=v,setImmediate(()=>{this.emit("message",R,!1),this._state=f,this.startLoop(I)}))}}controlMessage(I,w){if(this._opcode===8){if(I.length===0)this._loop=!1,this.emit("conclude",1005,o),this.end();else{let k=I.readUInt16BE(0);if(!m(k)){let M=this.createError(RangeError,`invalid status code ${k}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");w(M);return}let R=new _(I.buffer,I.byteOffset+2,I.length-2);if(!this._skipUTF8Validation&&!g(R)){let M=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");w(M);return}this._loop=!1,this.emit("conclude",k,R),this.end()}this._state=f;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",I),this._state=f):(this._state=v,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",I),this._state=f,this.startLoop(w)}))}createError(I,w,k,R,M){this._loop=!1,this._errored=!0;let D=new I(k?`Invalid WebSocket frame: ${w}`:w);return Error.captureStackTrace(D,this.createError),D.code=M,D[a]=R,D}};t.exports=T}}),Gn=z({"node_modules/ws/lib/sender.js"(e,t){"use strict";var{Duplex:r}=te("stream"),{randomFillSync:n}=te("crypto"),{types:{isUint8Array:i}}=te("util"),o=Ht(),{EMPTY_BUFFER:a,kWebSocket:c,NOOP:u}=at(),{isBlob:d,isValidStatusCode:h}=Vt(),{mask:m,toBuffer:g}=er(),_=Symbol("kByteLength"),f=Buffer.alloc(4),y=8*1024,E,C=y,S=0,A=1,v=2,T=class Tt{static{p(this,"_Sender")}constructor(R,M,D){this._extensions=M||{},D&&(this._generateMask=D,this._maskBuffer=Buffer.alloc(4)),this._socket=R,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=S,this.onerror=u,this[c]=void 0}static frame(R,M){let D,J=!1,O=2,L=!1;M.mask&&(D=M.maskBuffer||f,M.generateMask?M.generateMask(D):(C===y&&(E===void 0&&(E=Buffer.alloc(y)),n(E,0,y),C=0),D[0]=E[C++],D[1]=E[C++],D[2]=E[C++],D[3]=E[C++]),L=(D[0]|D[1]|D[2]|D[3])===0,O=6);let B;typeof R=="string"?(!M.mask||L)&&M[_]!==void 0?B=M[_]:(R=Buffer.from(R),B=R.length):(B=R.length,J=M.mask&&M.readOnly&&!L);let X=B;B>=65536?(O+=8,X=127):B>125&&(O+=2,X=126);let Y=Buffer.allocUnsafe(J?B+O:O);return Y[0]=M.fin?M.opcode|128:M.opcode,M.rsv1&&(Y[0]|=64),Y[1]=X,X===126?Y.writeUInt16BE(B,2):X===127&&(Y[2]=Y[3]=0,Y.writeUIntBE(B,4,6)),M.mask?(Y[1]|=128,Y[O-4]=D[0],Y[O-3]=D[1],Y[O-2]=D[2],Y[O-1]=D[3],L?[Y,R]:J?(m(R,D,Y,O,B),[Y]):(m(R,D,R,0,B),[Y,R])):[Y,R]}close(R,M,D,J){let O;if(R===void 0)O=a;else{if(typeof R!="number"||!h(R))throw new TypeError("First argument must be a valid error code number");if(M===void 0||!M.length)O=Buffer.allocUnsafe(2),O.writeUInt16BE(R,0);else{let B=Buffer.byteLength(M);if(B>123)throw new RangeError("The message must not be greater than 123 bytes");if(O=Buffer.allocUnsafe(2+B),O.writeUInt16BE(R,0),typeof M=="string")O.write(M,2);else if(i(M))O.set(M,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let L={[_]:O.length,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==S?this.enqueue([this.dispatch,O,!1,L,J]):this.sendFrame(Tt.frame(O,L),J)}ping(R,M,D){let J,O;if(typeof R=="string"?(J=Buffer.byteLength(R),O=!1):d(R)?(J=R.size,O=!1):(R=g(R),J=R.length,O=g.readOnly),J>125)throw new RangeError("The data size must not be greater than 125 bytes");let L={[_]:J,fin:!0,generateMask:this._generateMask,mask:M,maskBuffer:this._maskBuffer,opcode:9,readOnly:O,rsv1:!1};d(R)?this._state!==S?this.enqueue([this.getBlobData,R,!1,L,D]):this.getBlobData(R,!1,L,D):this._state!==S?this.enqueue([this.dispatch,R,!1,L,D]):this.sendFrame(Tt.frame(R,L),D)}pong(R,M,D){let J,O;if(typeof R=="string"?(J=Buffer.byteLength(R),O=!1):d(R)?(J=R.size,O=!1):(R=g(R),J=R.length,O=g.readOnly),J>125)throw new RangeError("The data size must not be greater than 125 bytes");let L={[_]:J,fin:!0,generateMask:this._generateMask,mask:M,maskBuffer:this._maskBuffer,opcode:10,readOnly:O,rsv1:!1};d(R)?this._state!==S?this.enqueue([this.getBlobData,R,!1,L,D]):this.getBlobData(R,!1,L,D):this._state!==S?this.enqueue([this.dispatch,R,!1,L,D]):this.sendFrame(Tt.frame(R,L),D)}send(R,M,D){let J=this._extensions[o.extensionName],O=M.binary?2:1,L=M.compress,B,X;typeof R=="string"?(B=Buffer.byteLength(R),X=!1):d(R)?(B=R.size,X=!1):(R=g(R),B=R.length,X=g.readOnly),this._firstFragment?(this._firstFragment=!1,L&&J&&J.params[J._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(L=B>=J._threshold),this._compress=L):(L=!1,O=0),M.fin&&(this._firstFragment=!0);let Y={[_]:B,fin:M.fin,generateMask:this._generateMask,mask:M.mask,maskBuffer:this._maskBuffer,opcode:O,readOnly:X,rsv1:L};d(R)?this._state!==S?this.enqueue([this.getBlobData,R,this._compress,Y,D]):this.getBlobData(R,this._compress,Y,D):this._state!==S?this.enqueue([this.dispatch,R,this._compress,Y,D]):this.dispatch(R,this._compress,Y,D)}getBlobData(R,M,D,J){this._bufferedBytes+=D[_],this._state=v,R.arrayBuffer().then(O=>{if(this._socket.destroyed){let B=new Error("The socket was closed while the blob was being read");process.nextTick(I,this,B,J);return}this._bufferedBytes-=D[_];let L=g(O);M?this.dispatch(L,M,D,J):(this._state=S,this.sendFrame(Tt.frame(L,D),J),this.dequeue())}).catch(O=>{process.nextTick(w,this,O,J)})}dispatch(R,M,D,J){if(!M){this.sendFrame(Tt.frame(R,D),J);return}let O=this._extensions[o.extensionName];this._bufferedBytes+=D[_],this._state=A,O.compress(R,D.fin,(L,B)=>{if(this._socket.destroyed){let X=new Error("The socket was closed while data was being compressed");I(this,X,J);return}this._bufferedBytes-=D[_],this._state=S,D.readOnly=!1,this.sendFrame(Tt.frame(B,D),J),this.dequeue()})}dequeue(){for(;this._state===S&&this._queue.length;){let R=this._queue.shift();this._bufferedBytes-=R[3][_],Reflect.apply(R[0],this,R.slice(1))}}enqueue(R){this._bufferedBytes+=R[3][_],this._queue.push(R)}sendFrame(R,M){R.length===2?(this._socket.cork(),this._socket.write(R[0]),this._socket.write(R[1],M),this._socket.uncork()):this._socket.write(R[0],M)}};t.exports=T;function I(k,R,M){typeof M=="function"&&M(R);for(let D=0;D<k._queue.length;D++){let J=k._queue[D],O=J[J.length-1];typeof O=="function"&&O(R)}}p(I,"callCallbacks");function w(k,R,M){I(k,R,M),k.onerror(R)}p(w,"onError")}}),Ml=z({"node_modules/ws/lib/event-target.js"(e,t){"use strict";var{kForOnEventAttribute:r,kListener:n}=at(),i=Symbol("kCode"),o=Symbol("kData"),a=Symbol("kError"),c=Symbol("kMessage"),u=Symbol("kReason"),d=Symbol("kTarget"),h=Symbol("kType"),m=Symbol("kWasClean"),g=class{static{p(this,"Event")}constructor(S){this[d]=null,this[h]=S}get target(){return this[d]}get type(){return this[h]}};Object.defineProperty(g.prototype,"target",{enumerable:!0}),Object.defineProperty(g.prototype,"type",{enumerable:!0});var _=class extends g{static{p(this,"CloseEvent")}constructor(S,A={}){super(S),this[i]=A.code===void 0?0:A.code,this[u]=A.reason===void 0?"":A.reason,this[m]=A.wasClean===void 0?!1:A.wasClean}get code(){return this[i]}get reason(){return this[u]}get wasClean(){return this[m]}};Object.defineProperty(_.prototype,"code",{enumerable:!0}),Object.defineProperty(_.prototype,"reason",{enumerable:!0}),Object.defineProperty(_.prototype,"wasClean",{enumerable:!0});var f=class extends g{static{p(this,"ErrorEvent")}constructor(S,A={}){super(S),this[a]=A.error===void 0?null:A.error,this[c]=A.message===void 0?"":A.message}get error(){return this[a]}get message(){return this[c]}};Object.defineProperty(f.prototype,"error",{enumerable:!0}),Object.defineProperty(f.prototype,"message",{enumerable:!0});var y=class extends g{static{p(this,"MessageEvent")}constructor(S,A={}){super(S),this[o]=A.data===void 0?null:A.data}get data(){return this[o]}};Object.defineProperty(y.prototype,"data",{enumerable:!0});var E={addEventListener(S,A,v={}){for(let I of this.listeners(S))if(!v[r]&&I[n]===A&&!I[r])return;let T;if(S==="message")T=p(function(I,w){let k=new y("message",{data:w?I:I.toString()});k[d]=this,C(A,this,k)},"wrapper");else if(S==="close")T=p(function(I,w){let k=new _("close",{code:I,reason:w.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});k[d]=this,C(A,this,k)},"wrapper");else if(S==="error")T=p(function(I){let w=new f("error",{error:I,message:I.message});w[d]=this,C(A,this,w)},"wrapper");else if(S==="open")T=p(function(){let I=new g("open");I[d]=this,C(A,this,I)},"wrapper");else return;T[r]=!!v[r],T[n]=A,v.once?this.once(S,T):this.on(S,T)},removeEventListener(S,A){for(let v of this.listeners(S))if(v[n]===A&&!v[r]){this.removeListener(S,v);break}}};t.exports={CloseEvent:_,ErrorEvent:f,Event:g,EventTarget:E,MessageEvent:y};function C(S,A,v){typeof S=="object"&&S.handleEvent?S.handleEvent.call(S,v):S.call(A,v)}p(C,"callListener")}}),Tr=z({"node_modules/ws/lib/extension.js"(e,t){"use strict";var{tokenChars:r}=Vt();function n(a,c,u){a[c]===void 0?a[c]=[u]:a[c].push(u)}p(n,"push");function i(a){let c=Object.create(null),u=Object.create(null),d=!1,h=!1,m=!1,g,_,f=-1,y=-1,E=-1,C=0;for(;C<a.length;C++)if(y=a.charCodeAt(C),g===void 0)if(E===-1&&r[y]===1)f===-1&&(f=C);else if(C!==0&&(y===32||y===9))E===-1&&f!==-1&&(E=C);else if(y===59||y===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${C}`);E===-1&&(E=C);let A=a.slice(f,E);y===44?(n(c,A,u),u=Object.create(null)):g=A,f=E=-1}else throw new SyntaxError(`Unexpected character at index ${C}`);else if(_===void 0)if(E===-1&&r[y]===1)f===-1&&(f=C);else if(y===32||y===9)E===-1&&f!==-1&&(E=C);else if(y===59||y===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${C}`);E===-1&&(E=C),n(u,a.slice(f,E),!0),y===44&&(n(c,g,u),u=Object.create(null),g=void 0),f=E=-1}else if(y===61&&f!==-1&&E===-1)_=a.slice(f,C),f=E=-1;else throw new SyntaxError(`Unexpected character at index ${C}`);else if(h){if(r[y]!==1)throw new SyntaxError(`Unexpected character at index ${C}`);f===-1?f=C:d||(d=!0),h=!1}else if(m)if(r[y]===1)f===-1&&(f=C);else if(y===34&&f!==-1)m=!1,E=C;else if(y===92)h=!0;else throw new SyntaxError(`Unexpected character at index ${C}`);else if(y===34&&a.charCodeAt(C-1)===61)m=!0;else if(E===-1&&r[y]===1)f===-1&&(f=C);else if(f!==-1&&(y===32||y===9))E===-1&&(E=C);else if(y===59||y===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${C}`);E===-1&&(E=C);let A=a.slice(f,E);d&&(A=A.replace(/\\/g,""),d=!1),n(u,_,A),y===44&&(n(c,g,u),u=Object.create(null),g=void 0),_=void 0,f=E=-1}else throw new SyntaxError(`Unexpected character at index ${C}`);if(f===-1||m||y===32||y===9)throw new SyntaxError("Unexpected end of input");E===-1&&(E=C);let S=a.slice(f,E);return g===void 0?n(c,S,u):(_===void 0?n(u,S,!0):d?n(u,_,S.replace(/\\/g,"")):n(u,_,S),n(c,g,u)),c}p(i,"parse");function o(a){return Object.keys(a).map(c=>{let u=a[c];return Array.isArray(u)||(u=[u]),u.map(d=>[c].concat(Object.keys(d).map(h=>{let m=d[h];return Array.isArray(m)||(m=[m]),m.map(g=>g===!0?h:`${h}=${g}`).join("; ")})).join("; ")).join(", ")}).join(", ")}p(o,"format"),t.exports={format:o,parse:i}}}),Ar=z({"node_modules/ws/lib/websocket.js"(e,t){"use strict";var r=te("events"),n=te("https"),i=te("http"),o=te("net"),a=te("tls"),{randomBytes:c,createHash:u}=te("crypto"),{Duplex:d,Readable:h}=te("stream"),{URL:m}=te("url"),g=Ht(),_=Un(),f=Gn(),{isBlob:y}=Vt(),{BINARY_TYPES:E,CLOSE_TIMEOUT:C,EMPTY_BUFFER:S,GUID:A,kForOnEventAttribute:v,kListener:T,kStatusCode:I,kWebSocket:w,NOOP:k}=at(),{EventTarget:{addEventListener:R,removeEventListener:M}}=Ml(),{format:D,parse:J}=Tr(),{toBuffer:O}=er(),L=Symbol("kAborted"),B=[8,13],X=["CONNECTING","OPEN","CLOSING","CLOSED"],Y=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,j=class Ne extends r{static{p(this,"_WebSocket")}constructor(b,G,$){super(),this._binaryType=E[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=S,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=Ne.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,b!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,G===void 0?G=[]:Array.isArray(G)||(typeof G=="object"&&G!==null?($=G,G=[]):G=[G]),ie(this,b,G,$)):(this._autoPong=$.autoPong,this._closeTimeout=$.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(b){E.includes(b)&&(this._binaryType=b,this._receiver&&(this._receiver._binaryType=b))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}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(b,G,$){let K=new _({allowSynchronousEvents:$.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:$.maxBufferedChunks,maxFragments:$.maxFragments,maxPayload:$.maxPayload,skipUTF8Validation:$.skipUTF8Validation}),Z=new f(b,this._extensions,$.generateMask);this._receiver=K,this._sender=Z,this._socket=b,K[w]=this,Z[w]=this,b[w]=this,K.on("conclude",Q),K.on("drain",Ft),K.on("error",zt),K.on("message",qe),K.on("ping",We),K.on("pong",N),Z.onerror=U,b.setTimeout&&b.setTimeout(0),b.setNoDelay&&b.setNoDelay(),G.length>0&&b.unshift(G),b.on("close",q),b.on("data",H),b.on("end",W),b.on("error",F),this._readyState=Ne.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=Ne.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[g.extensionName]&&this._extensions[g.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=Ne.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(b,G){if(this.readyState!==Ne.CLOSED){if(this.readyState===Ne.CONNECTING){ke(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===Ne.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=Ne.CLOSING,this._sender.close(b,G,!this._isServer,$=>{$||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),V(this)}}pause(){this.readyState===Ne.CONNECTING||this.readyState===Ne.CLOSED||(this._paused=!0,this._socket.pause())}ping(b,G,$){if(this.readyState===Ne.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof b=="function"?($=b,b=G=void 0):typeof G=="function"&&($=G,G=void 0),typeof b=="number"&&(b=b.toString()),this.readyState!==Ne.OPEN){ft(this,b,$);return}G===void 0&&(G=!this._isServer),this._sender.ping(b||S,G,$)}pong(b,G,$){if(this.readyState===Ne.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof b=="function"?($=b,b=G=void 0):typeof G=="function"&&($=G,G=void 0),typeof b=="number"&&(b=b.toString()),this.readyState!==Ne.OPEN){ft(this,b,$);return}G===void 0&&(G=!this._isServer),this._sender.pong(b||S,G,$)}resume(){this.readyState===Ne.CONNECTING||this.readyState===Ne.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(b,G,$){if(this.readyState===Ne.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof G=="function"&&($=G,G={}),typeof b=="number"&&(b=b.toString()),this.readyState!==Ne.OPEN){ft(this,b,$);return}let K={binary:typeof b!="string",mask:!this._isServer,compress:!0,fin:!0,...G};this._extensions[g.extensionName]||(K.compress=!1),this._sender.send(b||S,K,$)}terminate(){if(this.readyState!==Ne.CLOSED){if(this.readyState===Ne.CONNECTING){ke(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=Ne.CLOSING,this._socket.destroy())}}};Object.defineProperty(j,"CONNECTING",{enumerable:!0,value:X.indexOf("CONNECTING")}),Object.defineProperty(j.prototype,"CONNECTING",{enumerable:!0,value:X.indexOf("CONNECTING")}),Object.defineProperty(j,"OPEN",{enumerable:!0,value:X.indexOf("OPEN")}),Object.defineProperty(j.prototype,"OPEN",{enumerable:!0,value:X.indexOf("OPEN")}),Object.defineProperty(j,"CLOSING",{enumerable:!0,value:X.indexOf("CLOSING")}),Object.defineProperty(j.prototype,"CLOSING",{enumerable:!0,value:X.indexOf("CLOSING")}),Object.defineProperty(j,"CLOSED",{enumerable:!0,value:X.indexOf("CLOSED")}),Object.defineProperty(j.prototype,"CLOSED",{enumerable:!0,value:X.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(P=>{Object.defineProperty(j.prototype,P,{enumerable:!0})}),["open","error","close","message"].forEach(P=>{Object.defineProperty(j.prototype,`on${P}`,{enumerable:!0,get(){for(let b of this.listeners(P))if(b[v])return b[T];return null},set(b){for(let G of this.listeners(P))if(G[v]){this.removeListener(P,G);break}typeof b=="function"&&this.addEventListener(P,b,{[v]:!0})}})}),j.prototype.addEventListener=R,j.prototype.removeEventListener=M,t.exports=j;function ie(P,b,G,$){let K={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:C,protocolVersion:B[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...$,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(P._autoPong=K.autoPong,P._closeTimeout=K.closeTimeout,!B.includes(K.protocolVersion))throw new RangeError(`Unsupported protocol version: ${K.protocolVersion} (supported versions: ${B.join(", ")})`);let Z;if(b instanceof m)Z=b;else try{Z=new m(b)}catch{throw new SyntaxError(`Invalid URL: ${b}`)}Z.protocol==="http:"?Z.protocol="ws:":Z.protocol==="https:"&&(Z.protocol="wss:"),P._url=Z.href;let ae=Z.protocol==="wss:",ce=Z.protocol==="ws+unix:",Se;if(Z.protocol!=="ws:"&&!ae&&!ce?Se=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:ce&&!Z.pathname?Se="The URL's pathname is empty":Z.hash&&(Se="The URL contains a fragment identifier"),Se){let se=new SyntaxError(Se);if(P._redirects===0)throw se;oe(P,se);return}let le=ae?443:80,de=c(16).toString("base64"),be=ae?n.request:i.request,Ye=new Set,tt;if(K.createConnection=K.createConnection||(ae?et:Re),K.defaultPort=K.defaultPort||le,K.port=Z.port||le,K.host=Z.hostname.startsWith("[")?Z.hostname.slice(1,-1):Z.hostname,K.headers={...K.headers,"Sec-WebSocket-Version":K.protocolVersion,"Sec-WebSocket-Key":de,Connection:"Upgrade",Upgrade:"websocket"},K.path=Z.pathname+Z.search,K.timeout=K.handshakeTimeout,K.perMessageDeflate&&(tt=new g({...K.perMessageDeflate,isServer:!1,maxPayload:K.maxPayload}),K.headers["Sec-WebSocket-Extensions"]=D({[g.extensionName]:tt.offer()})),G.length){for(let se of G){if(typeof se!="string"||!Y.test(se)||Ye.has(se))throw new SyntaxError("An invalid or duplicated subprotocol was specified");Ye.add(se)}K.headers["Sec-WebSocket-Protocol"]=G.join(",")}if(K.origin&&(K.protocolVersion<13?K.headers["Sec-WebSocket-Origin"]=K.origin:K.headers.Origin=K.origin),(Z.username||Z.password)&&(K.auth=`${Z.username}:${Z.password}`),ce){let se=K.path.split(":");K.socketPath=se[0],K.path=se[1]}let Pe;if(K.followRedirects){if(P._redirects===0){P._originalIpc=ce,P._originalSecure=ae,P._originalHostOrSocketPath=ce?K.socketPath:Z.host;let se=$&&$.headers;if($={...$,headers:{}},se)for(let[Me,Ue]of Object.entries(se))$.headers[Me.toLowerCase()]=Ue}else if(P.listenerCount("redirect")===0){let se=ce?P._originalIpc?K.socketPath===P._originalHostOrSocketPath:!1:P._originalIpc?!1:Z.host===P._originalHostOrSocketPath;(!se||P._originalSecure&&!ae)&&(delete K.headers.authorization,delete K.headers.cookie,se||delete K.headers.host,K.auth=void 0)}K.auth&&!$.headers.authorization&&($.headers.authorization="Basic "+Buffer.from(K.auth).toString("base64")),Pe=P._req=be(K),P._redirects&&P.emit("redirect",P.url,Pe)}else Pe=P._req=be(K);K.timeout&&Pe.on("timeout",()=>{ke(P,Pe,"Opening handshake has timed out")}),Pe.on("error",se=>{Pe===null||Pe[L]||(Pe=P._req=null,oe(P,se))}),Pe.on("response",se=>{let Me=se.headers.location,Ue=se.statusCode;if(Me&&K.followRedirects&&Ue>=300&&Ue<400){if(++P._redirects>K.maxRedirects){ke(P,Pe,"Maximum redirects exceeded");return}Pe.abort();let De;try{De=new m(Me,b)}catch{let Te=new SyntaxError(`Invalid URL: ${Me}`);oe(P,Te);return}ie(P,De,G,$)}else P.emit("unexpected-response",Pe,se)||ke(P,Pe,`Unexpected server response: ${se.statusCode}`)}),Pe.on("upgrade",(se,Me,Ue)=>{if(P.emit("upgrade",se),P.readyState!==j.CONNECTING)return;Pe=P._req=null;let De=se.headers.upgrade;if(De===void 0||De.toLowerCase()!=="websocket"){ke(P,Me,"Invalid Upgrade header");return}let Te=u("sha1").update(de+A).digest("base64");if(se.headers["sec-websocket-accept"]!==Te){ke(P,Me,"Invalid Sec-WebSocket-Accept header");return}let Qt=se.headers["sec-websocket-protocol"],qt;if(Qt!==void 0?Ye.size?Ye.has(Qt)||(qt="Server sent an invalid subprotocol"):qt="Server sent a subprotocol but none was requested":Ye.size&&(qt="Server sent no subprotocol"),qt){ke(P,Me,qt);return}Qt&&(P._protocol=Qt);let jr=se.headers["sec-websocket-extensions"];if(jr!==void 0){if(!tt){ke(P,Me,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Er;try{Er=J(jr)}catch{ke(P,Me,"Invalid Sec-WebSocket-Extensions header");return}let en=Object.keys(Er);if(en.length!==1||en[0]!==g.extensionName){ke(P,Me,"Server indicated an extension that was not requested");return}try{tt.accept(Er[g.extensionName])}catch{ke(P,Me,"Invalid Sec-WebSocket-Extensions header");return}P._extensions[g.extensionName]=tt}P.setSocket(Me,Ue,{allowSynchronousEvents:K.allowSynchronousEvents,generateMask:K.generateMask,maxBufferedChunks:K.maxBufferedChunks,maxFragments:K.maxFragments,maxPayload:K.maxPayload,skipUTF8Validation:K.skipUTF8Validation})}),K.finishRequest?K.finishRequest(Pe,P):Pe.end()}p(ie,"initAsClient");function oe(P,b){P._readyState=j.CLOSING,P._errorEmitted=!0,P.emit("error",b),P.emitClose()}p(oe,"emitErrorAndClose");function Re(P){return P.path=P.socketPath,o.connect(P)}p(Re,"netConnect");function et(P){return P.path=void 0,!P.servername&&P.servername!==""&&(P.servername=o.isIP(P.host)?"":P.host),a.connect(P)}p(et,"tlsConnect");function ke(P,b,G){P._readyState=j.CLOSING;let $=new Error(G);Error.captureStackTrace($,ke),b.setHeader?(b[L]=!0,b.abort(),b.socket&&!b.socket.destroyed&&b.socket.destroy(),process.nextTick(oe,P,$)):(b.destroy($),b.once("error",P.emit.bind(P,"error")),b.once("close",P.emitClose.bind(P)))}p(ke,"abortHandshake");function ft(P,b,G){if(b){let $=y(b)?b.size:O(b).length;P._socket?P._sender._bufferedBytes+=$:P._bufferedAmount+=$}if(G){let $=new Error(`WebSocket is not open: readyState ${P.readyState} (${X[P.readyState]})`);process.nextTick(G,$)}}p(ft,"sendAfterClose");function Q(P,b){let G=this[w];G._closeFrameReceived=!0,G._closeMessage=b,G._closeCode=P,G._socket[w]!==void 0&&(G._socket.removeListener("data",H),process.nextTick(x,G._socket),P===1005?G.close():G.close(P,b))}p(Q,"receiverOnConclude");function Ft(){let P=this[w];P.isPaused||P._socket.resume()}p(Ft,"receiverOnDrain");function zt(P){let b=this[w];b._socket[w]!==void 0&&(b._socket.removeListener("data",H),process.nextTick(x,b._socket),b.close(P[I])),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",P))}p(zt,"receiverOnError");function Ct(){this[w].emitClose()}p(Ct,"receiverOnFinish");function qe(P,b){this[w].emit("message",P,b)}p(qe,"receiverOnMessage");function We(P){let b=this[w];b._autoPong&&b.pong(P,!this._isServer,k),b.emit("ping",P)}p(We,"receiverOnPing");function N(P){this[w].emit("pong",P)}p(N,"receiverOnPong");function x(P){P.resume()}p(x,"resume");function U(P){let b=this[w];b.readyState!==j.CLOSED&&(b.readyState===j.OPEN&&(b._readyState=j.CLOSING,V(b)),this._socket.end(),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",P)))}p(U,"senderOnError");function V(P){P._closeTimer=setTimeout(P._socket.destroy.bind(P._socket),P._closeTimeout)}p(V,"setCloseTimer");function q(){let P=this[w];if(this.removeListener("close",q),this.removeListener("data",H),this.removeListener("end",W),P._readyState=j.CLOSING,!this._readableState.endEmitted&&!P._closeFrameReceived&&!P._receiver._writableState.errorEmitted&&this._readableState.length!==0){let b=this.read(this._readableState.length);P._receiver.write(b)}P._receiver.end(),this[w]=void 0,clearTimeout(P._closeTimer),P._receiver._writableState.finished||P._receiver._writableState.errorEmitted?P.emitClose():(P._receiver.on("error",Ct),P._receiver.on("finish",Ct))}p(q,"socketOnClose");function H(P){this[w]._receiver.write(P)||this.pause()}p(H,"socketOnData");function W(){let P=this[w];P._readyState=j.CLOSING,P._receiver.end(),this.end()}p(W,"socketOnEnd");function F(){let P=this[w];this.removeListener("error",F),this.on("error",k),P&&(P._readyState=j.CLOSING,this.destroy())}p(F,"socketOnError")}}),xl=z({"node_modules/ws/lib/stream.js"(e,t){"use strict";var r=Ar(),{Duplex:n}=te("stream");function i(u){u.emit("close")}p(i,"emitClose");function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}p(o,"duplexOnEnd");function a(u){this.removeListener("error",a),this.destroy(),this.listenerCount("error")===0&&this.emit("error",u)}p(a,"duplexOnError");function c(u,d){let h=!0,m=new n({...d,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return u.on("message",function(g,_){let f=!_&&m._readableState.objectMode?g.toString():g;m.push(f)||u.pause()}),u.once("error",function(g){m.destroyed||(h=!1,m.destroy(g))}),u.once("close",function(){m.destroyed||m.push(null)}),m._destroy=function(g,_){if(u.readyState===u.CLOSED){_(g),process.nextTick(i,m);return}let f=!1;u.once("error",function(y){f=!0,_(y)}),u.once("close",function(){f||_(g),process.nextTick(i,m)}),h&&u.terminate()},m._final=function(g){if(u.readyState===u.CONNECTING){u.once("open",function(){m._final(g)});return}u._socket!==null&&(u._socket._writableState.finished?(g(),m._readableState.endEmitted&&m.destroy()):(u._socket.once("finish",function(){g()}),u.close()))},m._read=function(){u.isPaused&&u.resume()},m._write=function(g,_,f){if(u.readyState===u.CONNECTING){u.once("open",function(){m._write(g,_,f)});return}u.send(g,f)},m.on("end",o),m.on("error",a),m}p(c,"createWebSocketStream2"),t.exports=c}}),Ln=z({"node_modules/ws/lib/subprotocol.js"(e,t){"use strict";var{tokenChars:r}=Vt();function n(i){let o=new Set,a=-1,c=-1,u=0;for(u;u<i.length;u++){let h=i.charCodeAt(u);if(c===-1&&r[h]===1)a===-1&&(a=u);else if(u!==0&&(h===32||h===9))c===-1&&a!==-1&&(c=u);else if(h===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u);let m=i.slice(a,c);if(o.has(m))throw new SyntaxError(`The "${m}" subprotocol is duplicated`);o.add(m),a=c=-1}else throw new SyntaxError(`Unexpected character at index ${u}`)}if(a===-1||c!==-1)throw new SyntaxError("Unexpected end of input");let d=i.slice(a,u);if(o.has(d))throw new SyntaxError(`The "${d}" subprotocol is duplicated`);return o.add(d),o}p(n,"parse"),t.exports={parse:n}}}),bl=z({"node_modules/ws/lib/websocket-server.js"(e,t){"use strict";var r=te("events"),n=te("http"),{Duplex:i}=te("stream"),{createHash:o}=te("crypto"),a=Tr(),c=Ht(),u=Ln(),d=Ar(),{CLOSE_TIMEOUT:h,GUID:m,kWebSocket:g}=at(),_=/^[+/0-9A-Za-z]{22}==$/,f=0,y=1,E=2,C=class extends r{static{p(this,"WebSocketServer2")}constructor(w,k){if(super(),w={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:h,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d,...w},w.port==null&&!w.server&&!w.noServer||w.port!=null&&(w.server||w.noServer)||w.server&&w.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(w.port!=null?(this._server=n.createServer((R,M)=>{let D=n.STATUS_CODES[426];M.writeHead(426,{"Content-Length":D.length,"Content-Type":"text/plain"}),M.end(D)}),this._server.listen(w.port,w.host,w.backlog,k)):w.server&&(this._server=w.server),this._server){let R=this.emit.bind(this,"connection");this._removeListeners=S(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:p((M,D,J)=>{this.handleUpgrade(M,D,J,R)},"upgrade")})}w.perMessageDeflate===!0&&(w.perMessageDeflate={}),w.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=w,this._state=f}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(w){if(this._state===E){w&&this.once("close",()=>{w(new Error("The server is not running"))}),process.nextTick(A,this);return}if(w&&this.once("close",w),this._state!==y)if(this._state=y,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(A,this):process.nextTick(A,this);else{let k=this._server;this._removeListeners(),this._removeListeners=this._server=null,k.close(()=>{A(this)})}}shouldHandle(w){if(this.options.path){let k=w.url.indexOf("?");if((k!==-1?w.url.slice(0,k):w.url)!==this.options.path)return!1}return!0}handleUpgrade(w,k,R,M){k.on("error",v);let D=w.headers["sec-websocket-key"],J=w.headers.upgrade,O=+w.headers["sec-websocket-version"];if(w.method!=="GET"){I(this,w,k,405,"Invalid HTTP method");return}if(J===void 0||J.toLowerCase()!=="websocket"){I(this,w,k,400,"Invalid Upgrade header");return}if(D===void 0||!_.test(D)){I(this,w,k,400,"Missing or invalid Sec-WebSocket-Key header");return}if(O!==13&&O!==8){I(this,w,k,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(w)){T(k,400);return}let L=w.headers["sec-websocket-protocol"],B=new Set;if(L!==void 0)try{B=u.parse(L)}catch{I(this,w,k,400,"Invalid Sec-WebSocket-Protocol header");return}let X=w.headers["sec-websocket-extensions"],Y={};if(this.options.perMessageDeflate&&X!==void 0){let j=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let ie=a.parse(X);ie[c.extensionName]&&(j.accept(ie[c.extensionName]),Y[c.extensionName]=j)}catch{I(this,w,k,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let j={origin:w.headers[`${O===8?"sec-websocket-origin":"origin"}`],secure:!!(w.socket.authorized||w.socket.encrypted),req:w};if(this.options.verifyClient.length===2){this.options.verifyClient(j,(ie,oe,Re,et)=>{if(!ie)return T(k,oe||401,Re,et);this.completeUpgrade(Y,D,B,w,k,R,M)});return}if(!this.options.verifyClient(j))return T(k,401)}this.completeUpgrade(Y,D,B,w,k,R,M)}completeUpgrade(w,k,R,M,D,J,O){if(!D.readable||!D.writable)return D.destroy();if(D[g])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>f)return T(D,503);let L=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${o("sha1").update(k+m).digest("base64")}`],B=new this.options.WebSocket(null,void 0,this.options);if(R.size){let X=this.options.handleProtocols?this.options.handleProtocols(R,M):R.values().next().value;X&&(L.push(`Sec-WebSocket-Protocol: ${X}`),B._protocol=X)}if(w[c.extensionName]){let X=w[c.extensionName].params,Y=a.format({[c.extensionName]:[X]});L.push(`Sec-WebSocket-Extensions: ${Y}`),B._extensions=w}this.emit("headers",L,M),D.write(L.concat(`\r
|
|
31
|
+
`).join(`\r
|
|
32
|
+
`)),D.removeListener("error",v),B.setSocket(D,J,{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(B),B.on("close",()=>{this.clients.delete(B),this._shouldEmitClose&&!this.clients.size&&process.nextTick(A,this)})),O(B,M)}};t.exports=C;function S(w,k){for(let R of Object.keys(k))w.on(R,k[R]);return function(){for(let R of Object.keys(k))w.removeListener(R,k[R])}}p(S,"addListeners");function A(w){w._state=E,w.emit("close")}p(A,"emitClose");function v(){this.destroy()}p(v,"socketOnError");function T(w,k,R,M){R=R||n.STATUS_CODES[k],M={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(R),...M},w.once("finish",w.destroy),w.end(`HTTP/1.1 ${k} ${n.STATUS_CODES[k]}\r
|
|
33
|
+
`+Object.keys(M).map(D=>`${D}: ${M[D]}`).join(`\r
|
|
34
|
+
`)+`\r
|
|
35
|
+
\r
|
|
36
|
+
`+R)}p(T,"abortHandshake");function I(w,k,R,M,D,J){if(w.listenerCount("wsClientError")){let O=new Error(D);Error.captureStackTrace(O,I),w.emit("wsClientError",O,R,k)}else T(R,M,D,J)}p(I,"abortHandshakeOrEmitwsClientError")}}),Ul=ze(ja(),1),Gl=ze(kl(),1);import{createWriteStream as Ll}from"fs";import*as On from"fs/promises";import{writeFile as Ol}from"fs/promises";import{Readable as Fl}from"node:stream";import{finished as ql}from"node:stream/promises";var zy=ze(xl(),1),Qy=ze(Tr(),1),Zy=ze(Ht(),1),jy=ze(Un(),1),eE=ze(Gn(),1),tE=ze(Ln(),1),Bl=ze(Ar(),1),rE=ze(bl(),1);import*as Hl from"path";var Vl,$l;function Jl(){return{geminiUrl:Vl,vertexUrl:$l}}p(Jl,"getDefaultBaseUrls");function Wl(e,t,r,n){var i,o;if(!e?.baseUrl){let a=Jl();return t?(i=a.vertexUrl)!==null&&i!==void 0?i:r:(o=a.geminiUrl)!==null&&o!==void 0?o:n}return e.baseUrl}p(Wl,"getBaseUrl");var rt=class{static{p(this,"BaseModule")}};function ee(e,t){let r=/\{([^}]+)\}/g;return e.replace(r,(n,i)=>{if(Object.prototype.hasOwnProperty.call(t,i)){let o=t[i];return o!=null?String(o):""}else throw new Error(`Key '${i}' not found in valueMap.`)})}p(ee,"formatMap");function l(e,t,r){for(let o=0;o<t.length-1;o++){let a=t[o];if(a.endsWith("[]")){let c=a.slice(0,-2);if(!(c in e))if(Array.isArray(r))e[c]=Array.from({length:r.length},()=>({}));else throw new Error(`Value must be a list given an array path ${a}`);if(Array.isArray(e[c])){let u=e[c];if(Array.isArray(r))for(let d=0;d<u.length;d++){let h=u[d];l(h,t.slice(o+1),r[d])}else for(let d of u)l(d,t.slice(o+1),r)}return}else if(a.endsWith("[0]")){let c=a.slice(0,-3);c in e||(e[c]=[{}]);let u=e[c];l(u[0],t.slice(o+1),r);return}(!e[a]||typeof e[a]!="object")&&(e[a]={}),e=e[a]}let n=t[t.length-1],i=e[n];if(i!==void 0){if(!r||typeof r=="object"&&Object.keys(r).length===0||r===i)return;if(typeof i=="object"&&typeof r=="object"&&i!==null&&r!==null)Object.assign(i,r);else throw new Error(`Cannot set value for an existing key. Key: ${n}`)}else n==="_self"&&typeof r=="object"&&r!==null&&!Array.isArray(r)?Object.assign(e,r):e[n]=r}p(l,"setValueByPath");function s(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 i=t[n];if(i.endsWith("[]")){let o=i.slice(0,-2);if(o in e){let a=e[o];return Array.isArray(a)?a.map(c=>s(c,t.slice(n+1),r)):r}else return r}else e=e[i]}return e}catch(n){if(n instanceof TypeError)return r;throw n}}p(s,"getValueByPath");function Xl(e,t){for(let[r,n]of Object.entries(t)){let i=r.split("."),o=n.split("."),a=new Set,c=-1;for(let u=0;u<i.length;u++)if(i[u]==="*"){c=u;break}if(c!==-1&&o.length>c)for(let u=c;u<o.length;u++){let d=o[u];d!=="*"&&!d.endsWith("[]")&&!d.endsWith("[0]")&&a.add(d)}Cr(e,i,o,0,a)}}p(Xl,"moveValueByPath");function Cr(e,t,r,n,i){if(n>=t.length||typeof e!="object"||e===null)return;let o=t[n];if(o.endsWith("[]")){let a=o.slice(0,-2),c=e;if(a in c&&Array.isArray(c[a]))for(let u of c[a])Cr(u,t,r,n+1,i)}else if(o==="*"){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let a=e,c=Object.keys(a).filter(d=>!d.startsWith("_")&&!i.has(d)),u={};for(let d of c)u[d]=a[d];for(let[d,h]of Object.entries(u)){let m=[];for(let g of r.slice(n))g==="*"?m.push(d):m.push(g);l(a,m,h)}for(let d of c)delete a[d]}}else{let a=e;o in a&&Cr(a[o],t,r,n+1,i)}}p(Cr,"_moveValueRecursive");function Sr(e){if(typeof e!="string")throw new Error("fromImageBytes must be a string");return e}p(Sr,"tBytes$1");function Kl(e){let t={},r=s(e,["operationName"]);r!=null&&l(t,["operationName"],r);let n=s(e,["resourceName"]);return n!=null&&l(t,["_url","resourceName"],n),t}p(Kl,"fetchPredictOperationParametersToVertex");function Yl(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["metadata"]);n!=null&&l(t,["metadata"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);o!=null&&l(t,["error"],o);let a=s(e,["response","generateVideoResponse"]);return a!=null&&l(t,["response"],Ql(a)),t}p(Yl,"generateVideosOperationFromMldev$1");function zl(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["metadata"]);n!=null&&l(t,["metadata"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);o!=null&&l(t,["error"],o);let a=s(e,["response"]);return a!=null&&l(t,["response"],Zl(a)),t}p(zl,"generateVideosOperationFromVertex$1");function Ql(e){let t={},r=s(e,["generatedSamples"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(a=>jl(a))),l(t,["generatedVideos"],o)}let n=s(e,["raiMediaFilteredCount"]);n!=null&&l(t,["raiMediaFilteredCount"],n);let i=s(e,["raiMediaFilteredReasons"]);return i!=null&&l(t,["raiMediaFilteredReasons"],i),t}p(Ql,"generateVideosResponseFromMldev$1");function Zl(e){let t={},r=s(e,["videos"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(a=>eu(a))),l(t,["generatedVideos"],o)}let n=s(e,["raiMediaFilteredCount"]);n!=null&&l(t,["raiMediaFilteredCount"],n);let i=s(e,["raiMediaFilteredReasons"]);return i!=null&&l(t,["raiMediaFilteredReasons"],i),t}p(Zl,"generateVideosResponseFromVertex$1");function jl(e){let t={},r=s(e,["video"]);return r!=null&&l(t,["video"],su(r)),t}p(jl,"generatedVideoFromMldev$1");function eu(e){let t={},r=s(e,["_self"]);return r!=null&&l(t,["video"],au(r)),t}p(eu,"generatedVideoFromVertex$1");function tu(e){let t={},r=s(e,["operationName"]);return r!=null&&l(t,["_url","operationName"],r),t}p(tu,"getOperationParametersToMldev");function ru(e){let t={},r=s(e,["operationName"]);return r!=null&&l(t,["_url","operationName"],r),t}p(ru,"getOperationParametersToVertex");function nu(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["metadata"]);n!=null&&l(t,["metadata"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);o!=null&&l(t,["error"],o);let a=s(e,["response"]);return a!=null&&l(t,["response"],iu(a)),t}p(nu,"importFileOperationFromMldev$1");function iu(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["parent"]);n!=null&&l(t,["parent"],n);let i=s(e,["documentName"]);return i!=null&&l(t,["documentName"],i),t}p(iu,"importFileResponseFromMldev$1");function Ir(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["metadata"]);n!=null&&l(t,["metadata"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);o!=null&&l(t,["error"],o);let a=s(e,["response"]);return a!=null&&l(t,["response"],ou(a)),t}p(Ir,"uploadToFileSearchStoreOperationFromMldev");function ou(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["parent"]);n!=null&&l(t,["parent"],n);let i=s(e,["documentName"]);return i!=null&&l(t,["documentName"],i),t}p(ou,"uploadToFileSearchStoreResponseFromMldev");function su(e){let t={},r=s(e,["uri"]);r!=null&&l(t,["uri"],r);let n=s(e,["encodedVideo"]);n!=null&&l(t,["videoBytes"],Sr(n));let i=s(e,["encoding"]);return i!=null&&l(t,["mimeType"],i),t}p(su,"videoFromMldev$1");function au(e){let t={},r=s(e,["gcsUri"]);r!=null&&l(t,["uri"],r);let n=s(e,["bytesBase64Encoded"]);n!=null&&l(t,["videoBytes"],Sr(n));let i=s(e,["mimeType"]);return i!=null&&l(t,["mimeType"],i),t}p(au,"videoFromVertex$1");var Fn;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(Fn||(Fn={}));var qn;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(qn||(qn={}));var Bn;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(Bn||(Bn={}));var lt;(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"})(lt||(lt={}));var Hn;(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"})(Hn||(Hn={}));var Vn;(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"})(Vn||(Vn={}));var $n;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})($n||($n={}));var Jn;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER",e.ENVIRONMENT_MOBILE="ENVIRONMENT_MOBILE",e.ENVIRONMENT_DESKTOP="ENVIRONMENT_DESKTOP"})(Jn||(Jn={}));var Wn;(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"})(Wn||(Wn={}));var Xn;(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"})(Xn||(Xn={}));var Kn;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.BLOCKING="BLOCKING",e.NON_BLOCKING="NON_BLOCKING"})(Kn||(Kn={}));var Yn;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(Yn||(Yn={}));var gt;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(gt||(gt={}));var zn;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(zn||(zn={}));var Qn;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",e.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",e.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE"})(Qn||(Qn={}));var Zn;(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"})(Zn||(Zn={}));var jn;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(jn||(jn={}));var ei;(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"})(ei||(ei={}));var _t;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})(_t||(_t={}));var xe;(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"})(xe||(xe={}));var ti;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(ti||(ti={}));var ri;(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"})(ri||(ri={}));var ni;(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"})(ni||(ni={}));var ii;(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"})(ii||(ii={}));var oi;(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.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(oi||(oi={}));var si;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(si||(si={}));var ai;(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"})(ai||(ai={}));var li;(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"})(li||(li={}));var tr;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO",e.VIDEO="VIDEO"})(tr||(tr={}));var ui;(function(e){e.DELIVERY_UNSPECIFIED="DELIVERY_UNSPECIFIED",e.INLINE="INLINE",e.URI="URI"})(ui||(ui={}));var di;(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"})(di||(di={}));var ci;(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"})(ci||(ci={}));var pi;(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"})(pi||(pi={}));var hi;(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"})(hi||(hi={}));var fi;(function(e){e.RESPONSE_PARSE_TYPE_UNSPECIFIED="RESPONSE_PARSE_TYPE_UNSPECIFIED",e.IDENTITY="IDENTITY",e.REGEX_EXTRACT="REGEX_EXTRACT"})(fi||(fi={}));var mi;(function(e){e.MATCH_OPERATION_UNSPECIFIED="MATCH_OPERATION_UNSPECIFIED",e.REGEX_CONTAINS="REGEX_CONTAINS",e.PARTIAL_MATCH="PARTIAL_MATCH",e.EXACT_MATCH="EXACT_MATCH"})(mi||(mi={}));var gi;(function(e){e.REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED="REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.HIGH="HIGH"})(gi||(gi={}));var wr;(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"})(wr||(wr={}));var _i;(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"})(_i||(_i={}));var yi;(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"})(yi||(yi={}));var Ei;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",e.BASELINE="BASELINE",e.CANDIDATE="CANDIDATE",e.TIE="TIE"})(Ei||(Ei={}));var vi;(function(e){e.VIDEO_ORIENTATION_UNSPECIFIED="VIDEO_ORIENTATION_UNSPECIFIED",e.LANDSCAPE="LANDSCAPE",e.PORTRAIT="PORTRAIT"})(vi||(vi={}));var Ti;(function(e){e.TUNING_SPEED_UNSPECIFIED="TUNING_SPEED_UNSPECIFIED",e.REGULAR="REGULAR",e.FAST="FAST"})(Ti||(Ti={}));var Ai;(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"})(Ai||(Ai={}));var Ci;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(Ci||(Ci={}));var Si;(function(e){e.UNSPECIFIED="unspecified",e.FLEX="flex",e.STANDARD="standard",e.PRIORITY="priority"})(Si||(Si={}));var Ii;(function(e){e.MEDIA_PROCESSING_UNSPECIFIED="MEDIA_PROCESSING_UNSPECIFIED",e.STATIC="STATIC",e.AGENTIC="AGENTIC"})(Ii||(Ii={}));var wi;(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"})(wi||(wi={}));var Ri;(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"})(Ri||(Ri={}));var rr;(function(e){e.COLLECTION="COLLECTION"})(rr||(rr={}));var Pi;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(Pi||(Pi={}));var nr;(function(e){e.PREDICT="PREDICT",e.EMBED_CONTENT="EMBED_CONTENT"})(nr||(nr={}));var Ni;(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"})(Ni||(Ni={}));var ki;(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"})(ki||(ki={}));var Di;(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"})(Di||(Di={}));var Mi;(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"})(Mi||(Mi={}));var xi;(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"})(xi||(xi={}));var bi;(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"})(bi||(bi={}));var Ui;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(Ui||(Ui={}));var Gi;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(Gi||(Gi={}));var Li;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(Li||(Li={}));var Oi;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(Oi||(Oi={}));var Fi;(function(e){e.CROP="CROP",e.PAD="PAD"})(Fi||(Fi={}));var qi;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING",e.DISTILLATION="DISTILLATION",e.REINFORCEMENT_TUNING="REINFORCEMENT_TUNING"})(qi||(qi={}));var Bi;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(Bi||(Bi={}));var Hi;(function(e){e.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",e.UPLOADED="UPLOADED",e.GENERATED="GENERATED",e.REGISTERED="REGISTERED"})(Hi||(Hi={}));var Vi;(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"})(Vi||(Vi={}));var $i;(function(e){e.INTERACTION_STATUS_UNSPECIFIED="INTERACTION_STATUS_UNSPECIFIED",e.IN_PROGRESS="IN_PROGRESS",e.REQUIRES_ACTION="REQUIRES_ACTION",e.IDLE="IDLE"})($i||($i={}));var Ji;(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"})(Ji||(Ji={}));var Wi;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(Wi||(Wi={}));var Xi;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Xi||(Xi={}));var Ki;(function(e){e.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",e.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",e.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Ki||(Ki={}));var Yi;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",e.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",e.NO_INTERRUPTION="NO_INTERRUPTION"})(Yi||(Yi={}));var zi;(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"})(zi||(zi={}));var Qi;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.VERBATIM="VERBATIM",e.SMART="SMART"})(Qi||(Qi={}));var Zi;(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"})(Zi||(Zi={}));var ji;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",e.QUALITY="QUALITY",e.DIVERSITY="DIVERSITY",e.VOCALIZATION="VOCALIZATION"})(ji||(ji={}));var wt;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(wt||(wt={}));var Rt=class{static{p(this,"HttpResponse")}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()}},$t=class{static{p(this,"GenerateContentResponse")}get text(){var e,t,r,n,i,o,a,c;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;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning text from the first one.");let u="",d=!1,h=[];for(let m of(c=(a=(o=(i=this.candidates)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)!==null&&c!==void 0?c:[]){for(let[g,_]of Object.entries(m))g!=="text"&&g!=="thought"&&g!=="thoughtSignature"&&(_!==null||_!==void 0)&&h.push(g);if(typeof m.text=="string"){if(typeof m.thought=="boolean"&&m.thought)continue;d=!0,u+=m.text}}return h.length>0&&console.warn(`there are non-text parts ${h} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),d?u:void 0}get data(){var e,t,r,n,i,o,a,c;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;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning data from the first one.");let u="",d=[];for(let h of(c=(a=(o=(i=this.candidates)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)!==null&&c!==void 0?c:[]){for(let[m,g]of Object.entries(h))m!=="inlineData"&&(g!==null||g!==void 0)&&d.push(m);h.inlineData&&typeof h.inlineData.data=="string"&&(u+=atob(h.inlineData.data))}return d.length>0&&console.warn(`there are non-data parts ${d} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),u.length>0?btoa(u):void 0}get functionCalls(){var e,t,r,n,i,o,a,c;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;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let u=(c=(a=(o=(i=this.candidates)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||c===void 0?void 0:c.filter(d=>d.functionCall).map(d=>d.functionCall).filter(d=>d!==void 0);if(u?.length!==0)return u}get executableCode(){var e,t,r,n,i,o,a,c,u;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;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning executable code from the first one.");let d=(c=(a=(o=(i=this.candidates)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||c===void 0?void 0:c.filter(h=>h.executableCode).map(h=>h.executableCode).filter(h=>h!==void 0);if(d?.length!==0)return(u=d?.[0])===null||u===void 0?void 0:u.code}get codeExecutionResult(){var e,t,r,n,i,o,a,c,u;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;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning code execution result from the first one.");let d=(c=(a=(o=(i=this.candidates)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||c===void 0?void 0:c.filter(h=>h.codeExecutionResult).map(h=>h.codeExecutionResult).filter(h=>h!==void 0);if(d?.length!==0)return(u=d?.[0])===null||u===void 0?void 0:u.output}},eo=class{static{p(this,"EmbedContentResponse")}},lu=class{static{p(this,"GenerateImagesResponse")}},uu=class{static{p(this,"EditImageResponse")}},du=class{static{p(this,"UpscaleImageResponse")}},cu=class{static{p(this,"RecontextImageResponse")}},pu=class{static{p(this,"SegmentImageResponse")}},to=class{static{p(this,"ListModelsResponse")}},ro=class{static{p(this,"DeleteModelResponse")}},no=class{static{p(this,"CountTokensResponse")}},hu=class{static{p(this,"ComputeTokensResponse")}},io=class xa{static{p(this,"_GenerateVideosOperation")}_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new xa,i,o=t;return r?i=zl(o):i=Yl(o),Object.assign(n,i),n}},fu=class{static{p(this,"ListTuningJobsResponse")}},oo=class{static{p(this,"CancelTuningJobResponse")}},mu=class{static{p(this,"ValidateRewardResponse")}},so=class{static{p(this,"DeleteCachedContentResponse")}},ao=class{static{p(this,"ListCachedContentsResponse")}},gu=class{static{p(this,"ListDocumentsResponse")}},_u=class{static{p(this,"ListFileSearchStoresResponse")}},yu=class{static{p(this,"UploadToFileSearchStoreResumableResponse")}},Eu=class ba{static{p(this,"_ImportFileOperation")}_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new ba,i=nu(t);return Object.assign(n,i),n}},vu=class{static{p(this,"ListFilesResponse")}},Tu=class{static{p(this,"CreateFileResponse")}},Au=class{static{p(this,"DeleteFileResponse")}},Cu=class{static{p(this,"RegisterFilesResponse")}},lo=class{static{p(this,"ListBatchJobsResponse")}},Su=class{static{p(this,"LiveServerMessage")}get text(){var e,t,r;let n="",i=!1,o=[];for(let a 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[c,u]of Object.entries(a))c!=="text"&&c!=="thought"&&u!==null&&o.push(c);if(typeof a.text=="string"){if(typeof a.thought=="boolean"&&a.thought)continue;i=!0,n+=a.text}}return o.length>0&&console.warn(`there are non-text parts ${o} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),i?n:void 0}get data(){var e,t,r;let n="",i=[];for(let o 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[a,c]of Object.entries(o))a!=="inlineData"&&c!==null&&i.push(a);o.inlineData&&typeof o.inlineData.data=="string"&&(n+=atob(o.inlineData.data))}return i.length>0&&console.warn(`there are non-data parts ${i} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),n.length>0?btoa(n):void 0}},Iu=class{static{p(this,"LiveMusicServerMessage")}get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}},uo=class Ua{static{p(this,"_UploadToFileSearchStoreOperation")}_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new Ua,i=Ir(t);return Object.assign(n,i),n}};function ue(e,t){if(!t||typeof t!="string")throw new Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw new Error("invalid model parameter");if(e.isVertexAI()){if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;if(t.indexOf("/")>=0){let r=t.split("/",2);return`publishers/${r[0]}/models/${r[1]}`}else return`publishers/google/models/${t}`}else return t.startsWith("models/")||t.startsWith("tunedModels/")?t:`models/${t}`}p(ue,"tModel");function co(e,t){let r=ue(e,t);return r?r.startsWith("publishers/")&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/${r}`:r.startsWith("models/")&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/publishers/google/${r}`:r:""}p(co,"tCachesModel");function po(e){return Array.isArray(e)?e.map(t=>ir(t)):[ir(e)]}p(po,"tBlobs");function ir(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}p(ir,"tBlob");function ho(e){let t=ir(e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}p(ho,"tImageBlob");function fo(e){let t=ir(e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}p(fo,"tAudioBlob");function mo(e){if(e==null)throw new Error("PartUnion is required");if(typeof e=="object")return e;if(typeof e=="string")return{text:e};throw new Error(`Unsupported part type: ${typeof e}`)}p(mo,"tPart");function go(e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("PartListUnion is required");return Array.isArray(e)?e.map(t=>mo(t)):[mo(e)]}p(go,"tParts");function Rr(e){return e!=null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)}p(Rr,"_isContent");function _o(e){return e!=null&&typeof e=="object"&&"functionCall"in e}p(_o,"_isFunctionCallPart");function yo(e){return e!=null&&typeof e=="object"&&"functionResponse"in e}p(yo,"_isFunctionResponsePart");function Ge(e){if(e==null)throw new Error("ContentUnion is required");return Rr(e)?e:{role:"user",parts:go(e)}}p(Ge,"tContent");function Pr(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap(r=>{let n=Ge(r);return n.parts&&n.parts.length>0&&n.parts[0].text!==void 0?[n.parts[0].text]:[]});if(e.isVertexAI()){let r=Ge(t);return r.parts&&r.parts.length>0&&r.parts[0].text!==void 0?[r.parts[0].text]:[]}return Array.isArray(t)?t.map(r=>Ge(r)):[Ge(t)]}p(Pr,"tContentsForEmbed");function Be(e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("contents are required");if(!Array.isArray(e)){if(_o(e)||yo(e))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[Ge(e)]}let t=[],r=[],n=Rr(e[0]);for(let i of e){let o=Rr(i);if(o!=n)throw new 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(o)t.push(i);else{if(_o(i)||yo(i))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");r.push(i)}}return n||t.push({role:"user",parts:go(r)}),t}p(Be,"tContents");function wu(e,t){e.includes("null")&&(t.nullable=!0);let r=e.filter(n=>n!=="null");if(r.length===1)t.type=Object.values(lt).includes(r[0].toUpperCase())?r[0].toUpperCase():lt.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let n of r)t.anyOf.push({type:Object.values(lt).includes(n.toUpperCase())?n.toUpperCase():lt.TYPE_UNSPECIFIED})}}p(wu,"flattenTypeArrayToAnyOf");function Pt(e){let t={},r=["items"],n=["anyOf"],i=["properties"];if(e.type&&e.anyOf)throw new Error("type and anyOf cannot be both populated.");let o=e.anyOf;o!=null&&o.length==2&&(o[0].type==="null"?(t.nullable=!0,e=o[1]):o[1].type==="null"&&(t.nullable=!0,e=o[0])),e.type instanceof Array&&wu(e.type,t);for(let[a,c]of Object.entries(e))if(c!=null)if(a=="type"){if(c==="null")throw new Error("type: null can not be the only possible type for the field.");if(c instanceof Array)continue;t.type=Object.values(lt).includes(c.toUpperCase())?c.toUpperCase():lt.TYPE_UNSPECIFIED}else if(r.includes(a))t[a]=Pt(c);else if(n.includes(a)){let u=[];for(let d of c){if(d.type=="null"){t.nullable=!0;continue}u.push(Pt(d))}t[a]=u}else if(i.includes(a)){let u={};for(let[d,h]of Object.entries(c))u[d]=Pt(h);t[a]=u}else{if(a==="additionalProperties")continue;t[a]=c}return t}p(Pt,"processJsonSchema");function Nr(e){return Pt(e)}p(Nr,"tSchema");function kr(e){if(typeof e=="object")return e;if(typeof e=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};throw new Error(`Unsupported speechConfig type: ${typeof e}`)}p(kr,"tSpeechConfig");function Dr(e){if("multiSpeakerVoiceConfig"in e)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return e}p(Dr,"tLiveSpeechConfig");function Nt(e){if(e.functionDeclarations)for(let t of e.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes("$schema")?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=Pt(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=Pt(t.response));return e}p(Nt,"tTool");function kt(e){if(e==null)throw new Error("tools is required");if(!Array.isArray(e))throw new Error("tools is required and must be an array of Tools");let t=[];for(let r of e)t.push(r);return t}p(kt,"tTools");function Ru(e,t,r,n=1){let i=!t.startsWith(`${r}/`)&&t.split("/").length===n;return e.isVertexAI()?t.startsWith("projects/")?t:t.startsWith("locations/")?`projects/${e.getProject()}/${t}`:t.startsWith(`${r}/`)?`projects/${e.getProject()}/locations/${e.getLocation()}/${t}`:i?`projects/${e.getProject()}/locations/${e.getLocation()}/${r}/${t}`:t:i?`${r}/${t}`:t}p(Ru,"resourceName");function nt(e,t){if(typeof t!="string")throw new Error("name must be a string");return Ru(e,t,"cachedContents")}p(nt,"tCachedContentName");function Eo(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}}p(Eo,"tTuningJobStatus");function yt(e){return Sr(e)}p(yt,"tBytes");function Pu(e){return e!=null&&typeof e=="object"&&"name"in e}p(Pu,"_isFile");function vo(e){return e!=null&&typeof e=="object"&&"video"in e}p(vo,"isGeneratedVideo");function To(e){return e!=null&&typeof e=="object"&&"uri"in e}p(To,"isVideo");function Mr(e){var t;let r;if(Pu(e)&&(r=e.name),!(To(e)&&(r=e.uri,r===void 0))&&!(vo(e)&&(r=(t=e.video)===null||t===void 0?void 0:t.uri,r===void 0))){if(typeof e=="string"&&(r=e),r===void 0)throw new Error("Could not extract file name from the provided input.");if(r.startsWith("https://")){let n=r.split("files/")[1].match(/[a-z0-9]+/);if(n===null)throw new Error(`Could not extract file name from URI ${r}`);r=n[0]}else r.startsWith("files/")&&(r=r.split("files/")[1]);return r}}p(Mr,"tFileName");function Ao(e,t){let r;return e.isVertexAI()?r=t?"publishers/google/models":"models":r=t?"models":"tunedModels",r}p(Ao,"tModelsUrl");function Co(e){for(let t of["models","tunedModels","publisherModels"])if(Nu(e,t))return e[t];return[]}p(Co,"tExtractModels");function Nu(e,t){return e!==null&&typeof e=="object"&&t in e}p(Nu,"hasField");function ku(e,t={}){let r=e,n={name:r.name,description:r.description,parametersJsonSchema:r.inputSchema};return r.outputSchema&&(n.responseJsonSchema=r.outputSchema),t.behavior&&(n.behavior=t.behavior),{functionDeclarations:[n]}}p(ku,"mcpToGeminiTool");function Du(e,t={}){let r=[],n=new Set;for(let i of e){let o=i.name;if(n.has(o))throw new Error(`Duplicate function name ${o} found in MCP tools. Please ensure function names are unique.`);n.add(o);let a=ku(i,t);a.functionDeclarations&&r.push(...a.functionDeclarations)}return{functionDeclarations:r}}p(Du,"mcpToolsToGeminiTool");function So(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 new Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))r={fileName:t};else throw new Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(e.isVertexAI())throw new 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,i=[r.inlinedRequests,r.fileName].filter(Boolean).length;if(e.isVertexAI()){if(i>0||n!==1)throw new Error("Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.")}else if(n>0||i!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return r}p(So,"tBatchJobSource");function Mu(e){if(typeof e!="string")return e;let t=e;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};throw new Error(`Unsupported destination: ${t}`)}p(Mu,"tBatchJobDestination");function Io(e){if(typeof e!="object"||e===null)return{};let t=e,r=t.inlinedResponses;if(typeof r!="object"||r===null)return e;let n=r.inlinedResponses;if(!Array.isArray(n)||n.length===0)return e;let i=!1;for(let o of n){if(typeof o!="object"||o===null)continue;let a=o.response;if(!(typeof a!="object"||a===null)&&a.embedding!==void 0){i=!0;break}}return i&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),e}p(Io,"tRecvBatchJobDestination");function Dt(e,t){let r=t;if(!e.isVertexAI()){if(/batches\/[^/]+$/.test(r))return r.split("/").pop();throw new Error(`Invalid batch job name: ${r}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(r))return r.split("/").pop();if(/^\d+$/.test(r))return r;throw new Error(`Invalid batch job name: ${r}.`)}p(Dt,"tBatchJobName");function wo(e){let t=e;return t==="BATCH_STATE_UNSPECIFIED"?"JOB_STATE_UNSPECIFIED":t==="BATCH_STATE_PENDING"?"JOB_STATE_PENDING":t==="BATCH_STATE_RUNNING"?"JOB_STATE_RUNNING":t==="BATCH_STATE_SUCCEEDED"?"JOB_STATE_SUCCEEDED":t==="BATCH_STATE_FAILED"?"JOB_STATE_FAILED":t==="BATCH_STATE_CANCELLED"?"JOB_STATE_CANCELLED":t==="BATCH_STATE_EXPIRED"?"JOB_STATE_EXPIRED":t}p(wo,"tJobState");function xu(e){return e.includes("gemini")&&e!=="gemini-embedding-001"||e.includes("maas")}p(xu,"tIsVertexEmbedContentModel");function bu(e){let t={},r=s(e,["apiKey"]);if(r!=null&&l(t,["apiKey"],r),s(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(bu,"authConfigToMldev$4");function Uu(e){let t={},r=s(e,["responsesFile"]);r!=null&&l(t,["fileName"],r);let n=s(e,["inlinedResponses","inlinedResponses"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(a=>md(a))),l(t,["inlinedResponses"],o)}let i=s(e,["inlinedEmbedContentResponses","inlinedResponses"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["inlinedEmbedContentResponses"],o)}return t}p(Uu,"batchJobDestinationFromMldev");function Gu(e){let t={},r=s(e,["predictionsFormat"]);r!=null&&l(t,["format"],r);let n=s(e,["gcsDestination","outputUriPrefix"]);n!=null&&l(t,["gcsUri"],n);let i=s(e,["bigqueryDestination","outputUri"]);i!=null&&l(t,["bigqueryUri"],i);let o=s(e,["vertexMultimodalDatasetDestination"]);return o!=null&&l(t,["vertexDataset"],wd(o)),t}p(Gu,"batchJobDestinationFromVertex");function Lu(e){let t={},r=s(e,["format"]);r!=null&&l(t,["predictionsFormat"],r);let n=s(e,["gcsUri"]);n!=null&&l(t,["gcsDestination","outputUriPrefix"],n);let i=s(e,["bigqueryUri"]);i!=null&&l(t,["bigqueryDestination","outputUri"],i);let o=s(e,["vertexDataset"]);if(o!=null&&l(t,["vertexMultimodalDatasetDestination"],Rd(o)),s(e,["fileName"])!==void 0)throw new Error("fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(Lu,"batchJobDestinationToVertex");function or(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["metadata","displayName"]);n!=null&&l(t,["displayName"],n);let i=s(e,["metadata","state"]);i!=null&&l(t,["state"],wo(i));let o=s(e,["metadata","createTime"]);o!=null&&l(t,["createTime"],o);let a=s(e,["metadata","endTime"]);a!=null&&l(t,["endTime"],a);let c=s(e,["metadata","updateTime"]);c!=null&&l(t,["updateTime"],c);let u=s(e,["metadata","model"]);u!=null&&l(t,["model"],u);let d=s(e,["metadata","output"]);return d!=null&&l(t,["dest"],Uu(Io(d))),t}p(or,"batchJobFromMldev");function xr(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["displayName"]);n!=null&&l(t,["displayName"],n);let i=s(e,["state"]);i!=null&&l(t,["state"],wo(i));let o=s(e,["error"]);o!=null&&l(t,["error"],o);let a=s(e,["createTime"]);a!=null&&l(t,["createTime"],a);let c=s(e,["startTime"]);c!=null&&l(t,["startTime"],c);let u=s(e,["endTime"]);u!=null&&l(t,["endTime"],u);let d=s(e,["updateTime"]);d!=null&&l(t,["updateTime"],d);let h=s(e,["model"]);h!=null&&l(t,["model"],h);let m=s(e,["inputConfig"]);m!=null&&l(t,["src"],Ou(m));let g=s(e,["outputConfig"]);g!=null&&l(t,["dest"],Gu(Io(g)));let _=s(e,["outputInfo"]);_!=null&&l(t,["outputInfo"],_);let f=s(e,["completionStats"]);return f!=null&&l(t,["completionStats"],f),t}p(xr,"batchJobFromVertex");function Ou(e){let t={},r=s(e,["instancesFormat"]);r!=null&&l(t,["format"],r);let n=s(e,["gcsSource","uris"]);n!=null&&l(t,["gcsUri"],n);let i=s(e,["bigquerySource","inputUri"]);i!=null&&l(t,["bigqueryUri"],i);let o=s(e,["vertexMultimodalDatasetSource","datasetName"]);return o!=null&&l(t,["vertexDatasetName"],o),t}p(Ou,"batchJobSourceFromVertex");function Fu(e,t){let r={};if(s(t,["format"])!==void 0)throw new Error("format parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(t,["vertexDatasetName"])!==void 0)throw new Error("vertexDatasetName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(t,["fileName"]);n!=null&&l(r,["fileName"],n);let i=s(t,["inlinedRequests"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>fd(e,a))),l(r,["requests","requests"],o)}return r}p(Fu,"batchJobSourceToMldev");function qu(e){let t={},r=s(e,["format"]);r!=null&&l(t,["instancesFormat"],r);let n=s(e,["gcsUri"]);n!=null&&l(t,["gcsSource","uris"],n);let i=s(e,["bigqueryUri"]);i!=null&&l(t,["bigquerySource","inputUri"],i);let o=s(e,["vertexDatasetName"]);if(o!=null&&l(t,["vertexMultimodalDatasetSource","datasetName"],o),s(e,["fileName"])!==void 0)throw new Error("fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(qu,"batchJobSourceToVertex");function Bu(e){let t={},r=s(e,["data"]);if(r!=null&&l(t,["data"],r),s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(Bu,"blobToMldev$4");function Hu(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],Dt(e,n)),r}p(Hu,"cancelBatchJobParametersToMldev");function Vu(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],Dt(e,n)),r}p(Vu,"cancelBatchJobParametersToVertex");function $u(e){let t={},r=s(e,["content"]);r!=null&&l(t,["content"],r);let n=s(e,["citationMetadata"]);n!=null&&l(t,["citationMetadata"],Ju(n));let i=s(e,["tokenCount"]);i!=null&&l(t,["tokenCount"],i);let o=s(e,["finishReason"]);o!=null&&l(t,["finishReason"],o);let a=s(e,["groundingMetadata"]);a!=null&&l(t,["groundingMetadata"],a);let c=s(e,["avgLogprobs"]);c!=null&&l(t,["avgLogprobs"],c);let u=s(e,["index"]);u!=null&&l(t,["index"],u);let d=s(e,["logprobsResult"]);d!=null&&l(t,["logprobsResult"],d);let h=s(e,["safetyRatings"]);if(h!=null){let g=h;Array.isArray(g)&&(g=g.map(_=>_)),l(t,["safetyRatings"],g)}let m=s(e,["urlContextMetadata"]);return m!=null&&l(t,["urlContextMetadata"],m),t}p($u,"candidateFromMldev$1");function Ju(e){let t={},r=s(e,["citationSources"]);if(r!=null){let n=r;Array.isArray(n)&&(n=n.map(i=>i)),l(t,["citations"],n)}return t}p(Ju,"citationMetadataFromMldev$1");function Ro(e){let t={},r=s(e,["parts"]);if(r!=null){let i=r;Array.isArray(i)&&(i=i.map(o=>Ad(o))),l(t,["parts"],i)}let n=s(e,["role"]);return n!=null&&l(t,["role"],n),t}p(Ro,"contentToMldev$4");function Wu(e,t){let r={},n=s(e,["displayName"]);if(t!==void 0&&n!=null&&l(t,["batch","displayName"],n),s(e,["dest"])!==void 0)throw new Error("dest parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let i=s(e,["webhookConfig"]);return t!==void 0&&i!=null&&l(t,["batch","webhookConfig"],i),r}p(Wu,"createBatchJobConfigToMldev");function Xu(e,t){let r={},n=s(e,["displayName"]);t!==void 0&&n!=null&&l(t,["displayName"],n);let i=s(e,["dest"]);if(t!==void 0&&i!=null&&l(t,["outputConfig"],Lu(Mu(i))),s(e,["webhookConfig"])!==void 0)throw new Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p(Xu,"createBatchJobConfigToVertex");function Po(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["_url","model"],ue(e,n));let i=s(t,["src"]);i!=null&&l(r,["batch","inputConfig"],Fu(e,So(e,i)));let o=s(t,["config"]);return o!=null&&Wu(o,r),r}p(Po,"createBatchJobParametersToMldev");function Ku(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["model"],ue(e,n));let i=s(t,["src"]);i!=null&&l(r,["inputConfig"],qu(So(e,i)));let o=s(t,["config"]);return o!=null&&Xu(o,r),r}p(Ku,"createBatchJobParametersToVertex");function Yu(e,t){let r={},n=s(e,["displayName"]);return t!==void 0&&n!=null&&l(t,["batch","displayName"],n),r}p(Yu,"createEmbeddingsBatchJobConfigToMldev");function zu(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["_url","model"],ue(e,n));let i=s(t,["src"]);i!=null&&l(r,["batch","inputConfig"],nd(e,i));let o=s(t,["config"]);return o!=null&&Yu(o,r),r}p(zu,"createEmbeddingsBatchJobParametersToMldev");function Qu(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],Dt(e,n)),r}p(Qu,"deleteBatchJobParametersToMldev");function Zu(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],Dt(e,n)),r}p(Zu,"deleteBatchJobParametersToVertex");function ju(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["name"]);n!=null&&l(t,["name"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);return o!=null&&l(t,["error"],o),t}p(ju,"deleteResourceJobFromMldev");function ed(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["name"]);n!=null&&l(t,["name"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);return o!=null&&l(t,["error"],o),t}p(ed,"deleteResourceJobFromVertex");function td(e,t){let r={},n=s(t,["contents"]);if(n!=null){let o=Pr(e,n);Array.isArray(o)&&(o=o.map(a=>a)),l(r,["requests[]","request","content"],o)}let i=s(t,["config"]);return i!=null&&(l(r,["_self"],rd(i,r)),Xl(r,{"requests[].*":"requests[].request.*"})),r}p(td,"embedContentBatchToMldev");function rd(e,t){let r={},n=s(e,["taskType"]);t!==void 0&&n!=null&&l(t,["requests[]","taskType"],n);let i=s(e,["title"]);t!==void 0&&i!=null&&l(t,["requests[]","title"],i);let o=s(e,["outputDimensionality"]);if(t!==void 0&&o!=null&&l(t,["requests[]","outputDimensionality"],o),s(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["documentOcr"])!==void 0)throw new Error("documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["audioTrackExtraction"])!==void 0)throw new Error("audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(rd,"embedContentConfigToMldev$1");function nd(e,t){let r={},n=s(t,["fileName"]);n!=null&&l(r,["file_name"],n);let i=s(t,["inlinedRequests"]);return i!=null&&l(r,["requests"],td(e,i)),r}p(nd,"embeddingsBatchJobSourceToMldev");function id(e){let t={};if(s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["fileUri"]);r!=null&&l(t,["fileUri"],r);let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(id,"fileDataToMldev$4");function od(e){let t={},r=s(e,["args"]);r!=null&&l(t,["args"],r);let n=s(e,["id"]);n!=null&&l(t,["id"],n);let i=s(e,["name"]);if(i!=null&&l(t,["name"],i),s(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(od,"functionCallToMldev$4");function sd(e){let t={},r=s(e,["allowedFunctionNames"]);r!=null&&l(t,["allowedFunctionNames"],r);let n=s(e,["mode"]);if(n!=null&&l(t,["mode"],n),s(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(sd,"functionCallingConfigToMldev$2");function ad(e,t,r){let n={},i=s(t,["serviceTier"]);r!==void 0&&i!=null&&l(r,["serviceTier"],i);let o=s(t,["systemInstruction"]);r!==void 0&&o!=null&&l(r,["systemInstruction"],Ro(Ge(o)));let a=s(t,["temperature"]);a!=null&&l(n,["temperature"],a);let c=s(t,["topP"]);c!=null&&l(n,["topP"],c);let u=s(t,["topK"]);u!=null&&l(n,["topK"],u);let d=s(t,["candidateCount"]);d!=null&&l(n,["candidateCount"],d);let h=s(t,["maxOutputTokens"]);h!=null&&l(n,["maxOutputTokens"],h);let m=s(t,["stopSequences"]);m!=null&&l(n,["stopSequences"],m);let g=s(t,["responseLogprobs"]);g!=null&&l(n,["responseLogprobs"],g);let _=s(t,["logprobs"]);_!=null&&l(n,["logprobs"],_);let f=s(t,["presencePenalty"]);f!=null&&l(n,["presencePenalty"],f);let y=s(t,["frequencyPenalty"]);y!=null&&l(n,["frequencyPenalty"],y);let E=s(t,["seed"]);E!=null&&l(n,["seed"],E);let C=s(t,["responseMimeType"]);C!=null&&l(n,["responseMimeType"],C);let S=s(t,["responseSchema"]);S!=null&&l(n,["responseSchema"],Nr(S));let A=s(t,["responseJsonSchema"]);if(A!=null&&l(n,["responseJsonSchema"],A),s(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let v=s(t,["safetySettings"]);if(r!==void 0&&v!=null){let B=v;Array.isArray(B)&&(B=B.map(X=>Cd(X))),l(r,["safetySettings"],B)}let T=s(t,["tools"]);if(r!==void 0&&T!=null){let B=kt(T);Array.isArray(B)&&(B=B.map(X=>Id(Nt(X)))),l(r,["tools"],B)}let I=s(t,["toolConfig"]);if(r!==void 0&&I!=null&&l(r,["toolConfig"],Sd(I)),s(t,["labels"])!==void 0)throw new Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let w=s(t,["cachedContent"]);r!==void 0&&w!=null&&l(r,["cachedContent"],nt(e,w));let k=s(t,["responseModalities"]);k!=null&&l(n,["responseModalities"],k);let R=s(t,["mediaResolution"]);R!=null&&l(n,["mediaResolution"],R);let M=s(t,["speechConfig"]);if(M!=null&&l(n,["speechConfig"],kr(M)),s(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let D=s(t,["thinkingConfig"]);D!=null&&l(n,["thinkingConfig"],D);let J=s(t,["audioTranscriptionConfig"]);J!=null&&l(n,["audioTranscriptionConfig"],J);let O=s(t,["imageConfig"]);O!=null&&l(n,["imageConfig"],hd(O));let L=s(t,["enableEnhancedCivicAnswers"]);if(L!=null&&l(n,["enableEnhancedCivicAnswers"],L),s(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}p(ad,"generateContentConfigToMldev$1");function ld(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["candidates"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(h=>$u(h))),l(t,["candidates"],d)}let i=s(e,["modelVersion"]);i!=null&&l(t,["modelVersion"],i);let o=s(e,["promptFeedback"]);o!=null&&l(t,["promptFeedback"],o);let a=s(e,["responseId"]);a!=null&&l(t,["responseId"],a);let c=s(e,["usageMetadata"]);c!=null&&l(t,["usageMetadata"],c);let u=s(e,["modelStatus"]);return u!=null&&l(t,["modelStatus"],u),t}p(ld,"generateContentResponseFromMldev$1");function ud(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],Dt(e,n)),r}p(ud,"getBatchJobParametersToMldev");function dd(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],Dt(e,n)),r}p(dd,"getBatchJobParametersToVertex");function cd(e){let t={},r=s(e,["authConfig"]);r!=null&&l(t,["authConfig"],bu(r));let n=s(e,["enableWidget"]);if(n!=null&&l(t,["enableWidget"],n),s(e,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(cd,"googleMapsToMldev$4");function pd(e){let t={};if(s(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["searchTypes"]);r!=null&&l(t,["searchTypes"],r);let n=s(e,["timeRangeFilter"]);return n!=null&&l(t,["timeRangeFilter"],n),t}p(pd,"googleSearchToMldev$4");function hd(e){let t={},r=s(e,["aspectRatio"]);r!=null&&l(t,["aspectRatio"],r);let n=s(e,["imageSize"]);if(n!=null&&l(t,["imageSize"],n),s(e,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["imageOutputOptions"])!==void 0)throw new Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(hd,"imageConfigToMldev$1");function fd(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["request","model"],ue(e,n));let i=s(t,["contents"]);if(i!=null){let c=Be(i);Array.isArray(c)&&(c=c.map(u=>Ro(u))),l(r,["request","contents"],c)}let o=s(t,["metadata"]);o!=null&&l(r,["metadata"],o);let a=s(t,["config"]);return a!=null&&l(r,["request","generationConfig"],ad(e,a,s(r,["request"],{}))),r}p(fd,"inlinedRequestToMldev");function md(e){let t={},r=s(e,["response"]);r!=null&&l(t,["response"],ld(r));let n=s(e,["metadata"]);n!=null&&l(t,["metadata"],n);let i=s(e,["error"]);return i!=null&&l(t,["error"],i),t}p(md,"inlinedResponseFromMldev");function gd(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);if(t!==void 0&&i!=null&&l(t,["_query","pageToken"],i),s(e,["filter"])!==void 0)throw new Error("filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(gd,"listBatchJobsConfigToMldev");function _d(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);t!==void 0&&i!=null&&l(t,["_query","pageToken"],i);let o=s(e,["filter"]);return t!==void 0&&o!=null&&l(t,["_query","filter"],o),r}p(_d,"listBatchJobsConfigToVertex");function yd(e){let t={},r=s(e,["config"]);return r!=null&&gd(r,t),t}p(yd,"listBatchJobsParametersToMldev");function Ed(e){let t={},r=s(e,["config"]);return r!=null&&_d(r,t),t}p(Ed,"listBatchJobsParametersToVertex");function vd(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["operations"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>or(a))),l(t,["batchJobs"],o)}return t}p(vd,"listBatchJobsResponseFromMldev");function Td(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["batchPredictionJobs"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>xr(a))),l(t,["batchJobs"],o)}return t}p(Td,"listBatchJobsResponseFromVertex");function Ad(e){let t={},r=s(e,["mediaResolution"]);r!=null&&l(t,["mediaResolution"],r);let n=s(e,["toolCall"]);n!=null&&l(t,["toolCall"],n);let i=s(e,["toolResponse"]);i!=null&&l(t,["toolResponse"],i);let o=s(e,["audioTranscription"]);o!=null&&l(t,["audioTranscription"],o);let a=s(e,["codeExecutionResult"]);a!=null&&l(t,["codeExecutionResult"],a);let c=s(e,["executableCode"]);c!=null&&l(t,["executableCode"],c);let u=s(e,["fileData"]);u!=null&&l(t,["fileData"],id(u));let d=s(e,["functionCall"]);d!=null&&l(t,["functionCall"],od(d));let h=s(e,["functionResponse"]);h!=null&&l(t,["functionResponse"],h);let m=s(e,["inlineData"]);m!=null&&l(t,["inlineData"],Bu(m));let g=s(e,["text"]);g!=null&&l(t,["text"],g);let _=s(e,["thought"]);_!=null&&l(t,["thought"],_);let f=s(e,["thoughtSignature"]);f!=null&&l(t,["thoughtSignature"],f);let y=s(e,["videoMetadata"]);y!=null&&l(t,["videoMetadata"],y);let E=s(e,["partMetadata"]);E!=null&&l(t,["partMetadata"],E);let C=s(e,["mediaProcessing"]);return C!=null&&l(t,["mediaProcessing"],C),t}p(Ad,"partToMldev$4");function Cd(e){let t={},r=s(e,["category"]);if(r!=null&&l(t,["category"],r),s(e,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["threshold"]);return n!=null&&l(t,["threshold"],n),t}p(Cd,"safetySettingToMldev$3");function Sd(e){let t={},r=s(e,["functionCallingConfig"]);r!=null&&l(t,["functionCallingConfig"],sd(r));let n=s(e,["retrievalConfig"]);n!=null&&l(t,["retrievalConfig"],n);let i=s(e,["includeServerSideToolInvocations"]);return i!=null&&l(t,["includeServerSideToolInvocations"],i),t}p(Sd,"toolConfigToMldev$2");function Id(e){let t={};if(s(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["googleMaps"]);r!=null&&l(t,["googleMaps"],cd(r));let n=s(e,["mcpServers"]);if(n!=null){let m=n;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["mcpServers"],m)}let i=s(e,["codeExecution"]);i!=null&&l(t,["codeExecution"],i);let o=s(e,["computerUse"]);if(o!=null&&l(t,["computerUse"],o),s(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let a=s(e,["functionDeclarations"]);if(a!=null){let m=a;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["functionDeclarations"],m)}let c=s(e,["googleSearch"]);c!=null&&l(t,["googleSearch"],pd(c));let u=s(e,["googleSearchRetrieval"]);if(u!=null&&l(t,["googleSearchRetrieval"],u),s(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=s(e,["urlContext"]);d!=null&&l(t,["urlContext"],d);let h=s(e,["fileSearch"]);return h!=null&&l(t,["fileSearch"],h),t}p(Id,"toolToMldev$4");function wd(e){let t={},r=s(e,["bigqueryDestination","outputUri"]);r!=null&&l(t,["bigqueryDestination"],r);let n=s(e,["displayName"]);return n!=null&&l(t,["displayName"],n),t}p(wd,"vertexMultimodalDatasetDestinationFromVertex");function Rd(e){let t={},r=s(e,["bigqueryDestination"]);r!=null&&l(t,["bigqueryDestination","outputUri"],r);let n=s(e,["displayName"]);return n!=null&&l(t,["displayName"],n),t}p(Rd,"vertexMultimodalDatasetDestinationToVertex");var it;(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"})(it||(it={}));var Et=class{static{p(this,"Pager")}constructor(e,t,r,n){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,r,n)}init(e,t,r){var n,i;this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.sdkHttpResponseInternal=t?.sdkHttpResponse,this.idxInternal=0;let o={config:{}};!r||Object.keys(r).length===0?o={config:{}}:typeof r=="object"?o=Object.assign({},r):o=r,o.config&&(o.config.pageToken=t.nextPageToken),this.paramsInternal=o,this.pageInternalSize=(i=(n=o.config)===null||n===void 0?void 0:n.pageSize)!==null&&i!==void 0?i: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:p(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}},"next"),return:p(async()=>({value:void 0,done:!0}),"return")}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");let e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){var e;return((e=this.params.config)===null||e===void 0?void 0:e.pageToken)!==void 0}},Pd=class extends rt{static{p(this,"Batches")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Et(it.PAGED_ITEM_BATCH_JOBS,r=>this.listInternal(r),await this.listInternal(t),t),this.create=async t=>(this.apiClient.isVertexAI()&&(t.config=this.formatDestination(t.src,t.config)),this.createInternal(t)),this.createEmbeddings=async t=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(t)}}createInlinedGenerateContentRequest(e){let t=Po(this.apiClient,e),r=t._url,n=ee("{model}:batchGenerateContent",r),i=t.batch.inputConfig.requests,o=i.requests,a=[];for(let c of o){let u=Object.assign({},c);if(u.systemInstruction){let d=u.systemInstruction;delete u.systemInstruction;let h=u.request;h.systemInstruction=d,u.request=h}a.push(u)}return i.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]}getBigqueryUri(e){if(typeof e=="string")return e.startsWith("bq://")?e:void 0;if(!Array.isArray(e))return e.bigqueryUri}formatDestination(e,t){let r=t?Object.assign({},t):{},n=Date.now().toString();if(r.displayName||(r.displayName=`genaiBatchJob_${n}`),r.dest===void 0){let i=this.getGcsUri(e),o=this.getBigqueryUri(e);if(i)i.endsWith(".jsonl")?r.dest=`${i.slice(0,-6)}/dest`:r.dest=`${i}_dest_${n}`;else if(o)r.dest=`${o}_dest_${n}`;else throw new 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,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=Ku(this.apiClient,e);return a=ee("batchPredictionJobs",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json()),o.then(d=>xr(d))}else{let u=Po(this.apiClient,e);return a=ee("{model}:batchGenerateContent",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o.then(d=>or(d))}}async createEmbeddingsInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=zu(this.apiClient,e);return i=ee("{model}:asyncBatchEmbedContent",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>or(c))}}async get(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=dd(this.apiClient,e);return a=ee("batchPredictionJobs/{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json()),o.then(d=>xr(d))}else{let u=ud(this.apiClient,e);return a=ee("batches/{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o.then(d=>or(d))}}async cancel(e){var t,r,n,i;let o="",a={};if(this.apiClient.isVertexAI()){let c=Vu(this.apiClient,e);o=ee("batchPredictionJobs/{name}:cancel",c._url),a=c._query,delete c._url,delete c._query,await this.apiClient.request({path:o,queryParams:a,body:JSON.stringify(c),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 c=Hu(this.apiClient,e);o=ee("batches/{name}:cancel",c._url),a=c._query,delete c._url,delete c._query,await this.apiClient.request({path:o,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal})}}async listInternal(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=Ed(e);return a=ee("batchPredictionJobs",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=Td(d),m=new lo;return Object.assign(m,h),m})}else{let u=yd(e);return a=ee("batches",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=vd(d),m=new lo;return Object.assign(m,h),m})}}async delete(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=Zu(this.apiClient,e);return a=ee("batchPredictionJobs/{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>ed(d))}else{let u=Qu(this.apiClient,e);return a=ee("batches/{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>ju(d))}}};function Nd(e){let t={},r=s(e,["apiKey"]);if(r!=null&&l(t,["apiKey"],r),s(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Nd,"authConfigToMldev$3");function kd(e){let t={},r=s(e,["data"]);if(r!=null&&l(t,["data"],r),s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(kd,"blobToMldev$3");function Dd(e){let t={},r=s(e,["enablePromptInjectionDetection"]);r!=null&&l(t,["enablePromptInjectionDetection"],r);let n=s(e,["environment"]);n!=null&&l(t,["environment"],n);let i=s(e,["excludedPredefinedFunctions"]);if(i!=null&&l(t,["excludedPredefinedFunctions"],i),s(e,["disabledSafetyPolicies"])!==void 0)throw new Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(Dd,"computerUseToVertex$2");function No(e){let t={},r=s(e,["parts"]);if(r!=null){let i=r;Array.isArray(i)&&(i=i.map(o=>ec(o))),l(t,["parts"],i)}let n=s(e,["role"]);return n!=null&&l(t,["role"],n),t}p(No,"contentToMldev$3");function ko(e){let t={},r=s(e,["parts"]);if(r!=null){let i=r;Array.isArray(i)&&(i=i.map(o=>tc(o))),l(t,["parts"],i)}let n=s(e,["role"]);return n!=null&&l(t,["role"],n),t}p(ko,"contentToVertex$3");function Md(e,t){let r={},n=s(e,["ttl"]);t!==void 0&&n!=null&&l(t,["ttl"],n);let i=s(e,["expireTime"]);t!==void 0&&i!=null&&l(t,["expireTime"],i);let o=s(e,["displayName"]);t!==void 0&&o!=null&&l(t,["displayName"],o);let a=s(e,["contents"]);if(t!==void 0&&a!=null){let h=Be(a);Array.isArray(h)&&(h=h.map(m=>No(m))),l(t,["contents"],h)}let c=s(e,["systemInstruction"]);t!==void 0&&c!=null&&l(t,["systemInstruction"],No(Ge(c)));let u=s(e,["tools"]);if(t!==void 0&&u!=null){let h=u;Array.isArray(h)&&(h=h.map(m=>ic(m))),l(t,["tools"],h)}let d=s(e,["toolConfig"]);if(t!==void 0&&d!=null&&l(t,["toolConfig"],rc(d)),s(e,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(Md,"createCachedContentConfigToMldev");function xd(e,t){let r={},n=s(e,["ttl"]);t!==void 0&&n!=null&&l(t,["ttl"],n);let i=s(e,["expireTime"]);t!==void 0&&i!=null&&l(t,["expireTime"],i);let o=s(e,["displayName"]);t!==void 0&&o!=null&&l(t,["displayName"],o);let a=s(e,["contents"]);if(t!==void 0&&a!=null){let m=Be(a);Array.isArray(m)&&(m=m.map(g=>ko(g))),l(t,["contents"],m)}let c=s(e,["systemInstruction"]);t!==void 0&&c!=null&&l(t,["systemInstruction"],ko(Ge(c)));let u=s(e,["tools"]);if(t!==void 0&&u!=null){let m=u;Array.isArray(m)&&(m=m.map(g=>oc(g))),l(t,["tools"],m)}let d=s(e,["toolConfig"]);t!==void 0&&d!=null&&l(t,["toolConfig"],nc(d));let h=s(e,["kmsKeyName"]);return t!==void 0&&h!=null&&l(t,["encryption_spec","kmsKeyName"],h),r}p(xd,"createCachedContentConfigToVertex");function bd(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["model"],co(e,n));let i=s(t,["config"]);return i!=null&&Md(i,r),r}p(bd,"createCachedContentParametersToMldev");function Ud(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["model"],co(e,n));let i=s(t,["config"]);return i!=null&&xd(i,r),r}p(Ud,"createCachedContentParametersToVertex");function Gd(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],nt(e,n)),r}p(Gd,"deleteCachedContentParametersToMldev");function Ld(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],nt(e,n)),r}p(Ld,"deleteCachedContentParametersToVertex");function Od(e){let t={},r=s(e,["sdkHttpResponse"]);return r!=null&&l(t,["sdkHttpResponse"],r),t}p(Od,"deleteCachedContentResponseFromMldev");function Fd(e){let t={},r=s(e,["sdkHttpResponse"]);return r!=null&&l(t,["sdkHttpResponse"],r),t}p(Fd,"deleteCachedContentResponseFromVertex");function qd(e){let t={};if(s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["fileUri"]);r!=null&&l(t,["fileUri"],r);let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(qd,"fileDataToMldev$3");function Bd(e){let t={},r=s(e,["args"]);r!=null&&l(t,["args"],r);let n=s(e,["id"]);n!=null&&l(t,["id"],n);let i=s(e,["name"]);if(i!=null&&l(t,["name"],i),s(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Bd,"functionCallToMldev$3");function Hd(e){let t={},r=s(e,["allowedFunctionNames"]);r!=null&&l(t,["allowedFunctionNames"],r);let n=s(e,["mode"]);if(n!=null&&l(t,["mode"],n),s(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Hd,"functionCallingConfigToMldev$1");function Vd(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],nt(e,n)),r}p(Vd,"getCachedContentParametersToMldev");function $d(e,t){let r={},n=s(t,["name"]);return n!=null&&l(r,["_url","name"],nt(e,n)),r}p($d,"getCachedContentParametersToVertex");function Jd(e){let t={},r=s(e,["authConfig"]);r!=null&&l(t,["authConfig"],Nd(r));let n=s(e,["enableWidget"]);if(n!=null&&l(t,["enableWidget"],n),s(e,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Jd,"googleMapsToMldev$3");function Wd(e){let t={};if(s(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["searchTypes"]);r!=null&&l(t,["searchTypes"],r);let n=s(e,["timeRangeFilter"]);return n!=null&&l(t,["timeRangeFilter"],n),t}p(Wd,"googleSearchToMldev$3");function Xd(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);return t!==void 0&&i!=null&&l(t,["_query","pageToken"],i),r}p(Xd,"listCachedContentsConfigToMldev");function Kd(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);return t!==void 0&&i!=null&&l(t,["_query","pageToken"],i),r}p(Kd,"listCachedContentsConfigToVertex");function Yd(e){let t={},r=s(e,["config"]);return r!=null&&Xd(r,t),t}p(Yd,"listCachedContentsParametersToMldev");function zd(e){let t={},r=s(e,["config"]);return r!=null&&Kd(r,t),t}p(zd,"listCachedContentsParametersToVertex");function Qd(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["cachedContents"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["cachedContents"],o)}return t}p(Qd,"listCachedContentsResponseFromMldev");function Zd(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["cachedContents"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["cachedContents"],o)}return t}p(Zd,"listCachedContentsResponseFromVertex");function jd(e){let t={};if(s(e,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(jd,"mcpServerToVertex$2");function ec(e){let t={},r=s(e,["mediaResolution"]);r!=null&&l(t,["mediaResolution"],r);let n=s(e,["toolCall"]);n!=null&&l(t,["toolCall"],n);let i=s(e,["toolResponse"]);i!=null&&l(t,["toolResponse"],i);let o=s(e,["audioTranscription"]);o!=null&&l(t,["audioTranscription"],o);let a=s(e,["codeExecutionResult"]);a!=null&&l(t,["codeExecutionResult"],a);let c=s(e,["executableCode"]);c!=null&&l(t,["executableCode"],c);let u=s(e,["fileData"]);u!=null&&l(t,["fileData"],qd(u));let d=s(e,["functionCall"]);d!=null&&l(t,["functionCall"],Bd(d));let h=s(e,["functionResponse"]);h!=null&&l(t,["functionResponse"],h);let m=s(e,["inlineData"]);m!=null&&l(t,["inlineData"],kd(m));let g=s(e,["text"]);g!=null&&l(t,["text"],g);let _=s(e,["thought"]);_!=null&&l(t,["thought"],_);let f=s(e,["thoughtSignature"]);f!=null&&l(t,["thoughtSignature"],f);let y=s(e,["videoMetadata"]);y!=null&&l(t,["videoMetadata"],y);let E=s(e,["partMetadata"]);E!=null&&l(t,["partMetadata"],E);let C=s(e,["mediaProcessing"]);return C!=null&&l(t,["mediaProcessing"],C),t}p(ec,"partToMldev$3");function tc(e){let t={},r=s(e,["mediaResolution"]);if(r!=null&&l(t,["mediaResolution"],r),s(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let n=s(e,["audioTranscription"]);n!=null&&l(t,["audioTranscription"],n);let i=s(e,["codeExecutionResult"]);i!=null&&l(t,["codeExecutionResult"],i);let o=s(e,["executableCode"]);o!=null&&l(t,["executableCode"],o);let a=s(e,["fileData"]);a!=null&&l(t,["fileData"],a);let c=s(e,["functionCall"]);c!=null&&l(t,["functionCall"],c);let u=s(e,["functionResponse"]);u!=null&&l(t,["functionResponse"],u);let d=s(e,["inlineData"]);d!=null&&l(t,["inlineData"],d);let h=s(e,["text"]);h!=null&&l(t,["text"],h);let m=s(e,["thought"]);m!=null&&l(t,["thought"],m);let g=s(e,["thoughtSignature"]);g!=null&&l(t,["thoughtSignature"],g);let _=s(e,["videoMetadata"]);if(_!=null&&l(t,["videoMetadata"],_),s(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let f=s(e,["mediaProcessing"]);return f!=null&&l(t,["mediaProcessing"],f),t}p(tc,"partToVertex$3");function rc(e){let t={},r=s(e,["functionCallingConfig"]);r!=null&&l(t,["functionCallingConfig"],Hd(r));let n=s(e,["retrievalConfig"]);n!=null&&l(t,["retrievalConfig"],n);let i=s(e,["includeServerSideToolInvocations"]);return i!=null&&l(t,["includeServerSideToolInvocations"],i),t}p(rc,"toolConfigToMldev$1");function nc(e){let t={},r=s(e,["functionCallingConfig"]);r!=null&&l(t,["functionCallingConfig"],r);let n=s(e,["retrievalConfig"]);if(n!=null&&l(t,["retrievalConfig"],n),s(e,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(nc,"toolConfigToVertex$1");function ic(e){let t={};if(s(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["googleMaps"]);r!=null&&l(t,["googleMaps"],Jd(r));let n=s(e,["mcpServers"]);if(n!=null){let m=n;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["mcpServers"],m)}let i=s(e,["codeExecution"]);i!=null&&l(t,["codeExecution"],i);let o=s(e,["computerUse"]);if(o!=null&&l(t,["computerUse"],o),s(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let a=s(e,["functionDeclarations"]);if(a!=null){let m=a;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["functionDeclarations"],m)}let c=s(e,["googleSearch"]);c!=null&&l(t,["googleSearch"],Wd(c));let u=s(e,["googleSearchRetrieval"]);if(u!=null&&l(t,["googleSearchRetrieval"],u),s(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=s(e,["urlContext"]);d!=null&&l(t,["urlContext"],d);let h=s(e,["fileSearch"]);return h!=null&&l(t,["fileSearch"],h),t}p(ic,"toolToMldev$3");function oc(e){let t={},r=s(e,["retrieval"]);r!=null&&l(t,["retrieval"],r);let n=s(e,["googleMaps"]);n!=null&&l(t,["googleMaps"],n);let i=s(e,["mcpServers"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(y=>jd(y))),l(t,["mcpServers"],f)}let o=s(e,["codeExecution"]);o!=null&&l(t,["codeExecution"],o);let a=s(e,["computerUse"]);a!=null&&l(t,["computerUse"],Dd(a));let c=s(e,["enterpriseWebSearch"]);c!=null&&l(t,["enterpriseWebSearch"],c);let u=s(e,["exaAiSearch"]);u!=null&&l(t,["exaAiSearch"],u);let d=s(e,["functionDeclarations"]);if(d!=null){let f=d;Array.isArray(f)&&(f=f.map(y=>y)),l(t,["functionDeclarations"],f)}let h=s(e,["googleSearch"]);h!=null&&l(t,["googleSearch"],h);let m=s(e,["googleSearchRetrieval"]);m!=null&&l(t,["googleSearchRetrieval"],m);let g=s(e,["parallelAiSearch"]);g!=null&&l(t,["parallelAiSearch"],g);let _=s(e,["urlContext"]);if(_!=null&&l(t,["urlContext"],_),s(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(oc,"toolToVertex$2");function sc(e,t){let r={},n=s(e,["ttl"]);t!==void 0&&n!=null&&l(t,["ttl"],n);let i=s(e,["expireTime"]);return t!==void 0&&i!=null&&l(t,["expireTime"],i),r}p(sc,"updateCachedContentConfigToMldev");function ac(e,t){let r={},n=s(e,["ttl"]);t!==void 0&&n!=null&&l(t,["ttl"],n);let i=s(e,["expireTime"]);return t!==void 0&&i!=null&&l(t,["expireTime"],i),r}p(ac,"updateCachedContentConfigToVertex");function lc(e,t){let r={},n=s(t,["name"]);n!=null&&l(r,["_url","name"],nt(e,n));let i=s(t,["config"]);return i!=null&&sc(i,r),r}p(lc,"updateCachedContentParametersToMldev");function uc(e,t){let r={},n=s(t,["name"]);n!=null&&l(r,["_url","name"],nt(e,n));let i=s(t,["config"]);return i!=null&&ac(i,r),r}p(uc,"updateCachedContentParametersToVertex");var dc=class extends rt{static{p(this,"Caches")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Et(it.PAGED_ITEM_CACHED_CONTENTS,r=>this.listInternal(r),await this.listInternal(t),t)}async create(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=Ud(this.apiClient,e);return a=ee("cachedContents",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json()),o.then(d=>d)}else{let u=bd(this.apiClient,e);return a=ee("cachedContents",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async get(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=$d(this.apiClient,e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json()),o.then(d=>d)}else{let u=Vd(this.apiClient,e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async delete(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=Ld(this.apiClient,e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=Fd(d),m=new so;return Object.assign(m,h),m})}else{let u=Gd(this.apiClient,e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=Od(d),m=new so;return Object.assign(m,h),m})}}async update(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=uc(this.apiClient,e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json()),o.then(d=>d)}else{let u=lc(this.apiClient,e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"PATCH",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async listInternal(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=zd(e);return a=ee("cachedContents",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=Zd(d),m=new ao;return Object.assign(m,h),m})}else{let u=Yd(e);return a=ee("cachedContents",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=Qd(d),m=new ao;return Object.assign(m,h),m})}}};function Oe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}p(Oe,"__rest");function Do(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:p(function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}},"next")};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}p(Do,"__values");function Ie(e){return this instanceof Ie?(this.v=e,this):new Ie(e)}p(Ie,"__await");function Mt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(_){return function(f){return Promise.resolve(f).then(_,m)}}function c(_,f){n[_]&&(i[_]=function(y){return new Promise(function(E,C){o.push([_,y,E,C])>1||u(_,y)})},f&&(i[_]=f(i[_])))}function u(_,f){try{d(n[_](f))}catch(y){g(o[0][3],y)}}function d(_){_.value instanceof Ie?Promise.resolve(_.value.v).then(h,m):g(o[0][2],_)}function h(_){u("next",_)}function m(_){u("throw",_)}function g(_,f){_(f),o.shift(),o.length&&u(o[0][0],o[0][1])}}p(Mt,"__asyncGenerator");function Jt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Do=="function"?Do(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(a){return new Promise(function(c,u){a=e[o](a),i(c,u,a.done,a.value)})}}function i(o,a,c,u){Promise.resolve(u).then(function(d){o({value:d,done:c})},a)}}p(Jt,"__asyncValues");function cc(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;return r===void 0?!1:Mo(r)}p(cc,"isValidResponse");function Mo(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}p(Mo,"isValidContent");function pc(e){if(e.length!==0){for(let t of e)if(t.role!=="user"&&t.role!=="model")throw new Error(`Role must be user or model, but got ${t.role}.`)}}p(pc,"validateHistory");function xo(e){if(e===void 0||e.length===0)return[];let t=[],r=e.length,n=0;for(;n<r;)if(e[n].role==="user")t.push(e[n]),n++;else{let i=[],o=!0;for(;n<r&&e[n].role==="model";)i.push(e[n]),o&&!Mo(e[n])&&(o=!1),n++;o?t.push(...i):t.pop()}return t}p(xo,"extractCuratedHistory");var hc=class{static{p(this,"Chats")}constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new fc(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},fc=class{static{p(this,"Chat")}constructor(e,t,r,n={},i=[]){this.apiClient=e,this.modelsModule=t,this.model=r,this.config=n,this.history=i,this.sendPromise=Promise.resolve(),pc(i)}async sendMessage(e){var t;await this.sendPromise;let r=Ge(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 i,o,a;let c=await n,u=(o=(i=c.candidates)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.content,d=c.automaticFunctionCallingHistory,h=this.getHistory(!0).length,m=[];d!=null&&(m=(a=d.slice(h))!==null&&a!==void 0?a:[]);let g=u?[u]:[];this.recordHistory(r,g,m)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),n}async sendMessageStream(e){var t;await this.sendPromise;let r=Ge(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(()=>{}).catch(()=>{});let i=await n;return this.processStreamResponse(i,r)}getHistory(e=!1){let t=e?xo(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return Mt(this,arguments,function*(){var r,n,i,o,a,c;let u=[];try{for(var d=!0,h=Jt(e),m;m=yield Ie(h.next()),r=m.done,!r;d=!0){o=m.value,d=!1;let g=o;if(cc(g)){let _=(c=(a=g.candidates)===null||a===void 0?void 0:a[0])===null||c===void 0?void 0:c.content;_!==void 0&&u.push(_)}yield yield Ie(g)}}catch(g){n={error:g}}finally{try{!d&&!r&&(i=h.return)&&(yield Ie(i.call(h)))}finally{if(n)throw n.error}}this.recordHistory(t,u)})}recordHistory(e,t,r){let n=[];t.length>0&&t.every(i=>i.role!==void 0)?n=t:n.push({role:"model",parts:[]}),r&&r.length>0?this.history.push(...xo(r)):this.history.push(e),this.history.push(...n)}},bo=class Ga extends Error{static{p(this,"_ApiError")}constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,Ga.prototype)}};function mc(e){let t={},r=s(e,["file"]);return r!=null&&l(t,["file"],r),t}p(mc,"createFileParametersToMldev");function gc(e){let t={},r=s(e,["sdkHttpResponse"]);return r!=null&&l(t,["sdkHttpResponse"],r),t}p(gc,"createFileResponseFromMldev");function _c(e){let t={},r=s(e,["name"]);return r!=null&&l(t,["_url","file"],Mr(r)),t}p(_c,"deleteFileParametersToMldev");function yc(e){let t={},r=s(e,["sdkHttpResponse"]);return r!=null&&l(t,["sdkHttpResponse"],r),t}p(yc,"deleteFileResponseFromMldev");function Ec(e){let t={},r=s(e,["name"]);return r!=null&&l(t,["_url","file"],Mr(r)),t}p(Ec,"getFileParametersToMldev");function vc(e){let t={},r=s(e,["uris"]);return r!=null&&l(t,["uris"],r),t}p(vc,"internalRegisterFilesParametersToMldev");function Tc(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);return t!==void 0&&i!=null&&l(t,["_query","pageToken"],i),r}p(Tc,"listFilesConfigToMldev");function Ac(e){let t={},r=s(e,["config"]);return r!=null&&Tc(r,t),t}p(Ac,"listFilesParametersToMldev");function Cc(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["files"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["files"],o)}return t}p(Cc,"listFilesResponseFromMldev");function Sc(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["files"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),l(t,["files"],i)}return t}p(Sc,"registerFilesResponseFromMldev");var Ic=class extends rt{static{p(this,"Files$1")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Et(it.PAGED_ITEM_FILES,r=>this.listInternal(r),await this.listInternal(t),t)}async upload(e){if(this.apiClient.isVertexAI())throw new 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(e.file,e.config).then(t=>t)}async download(e){await this.apiClient.downloadFile(e)}async registerFiles(e){throw new Error("registerFiles is only supported in Node.js environments.")}async _registerFiles(e){return this.registerFilesInternal(e)}async listInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=Ac(e);return i=ee("files",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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 d=u;return d.sdkHttpResponse={headers:c.headers},d})),n.then(c=>{let u=Cc(c),d=new vu;return Object.assign(d,u),d})}}async createInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=mc(e);return i=ee("upload/v1beta/files",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>{let u=gc(c),d=new Tu;return Object.assign(d,u),d})}}async get(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=Ec(e);return i=ee("files/{file}",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>c)}}async delete(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=_c(e);return i=ee("files/{file}",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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 d=u;return d.sdkHttpResponse={headers:c.headers},d})),n.then(c=>{let u=yc(c),d=new Au;return Object.assign(d,u),d})}}async registerFilesInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=vc(e);return i=ee("files:register",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>{let u=Sc(c),d=new Cu;return Object.assign(d,u),d})}}};function wc(e){let t={},r=s(e,["apiKey"]);if(r!=null&&l(t,["apiKey"],r),s(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(wc,"authConfigToMldev$2");function sr(e){let t={},r=s(e,["data"]);if(r!=null&&l(t,["data"],r),s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(sr,"blobToMldev$2");function Rc(e){let t={},r=s(e,["enablePromptInjectionDetection"]);r!=null&&l(t,["enablePromptInjectionDetection"],r);let n=s(e,["environment"]);n!=null&&l(t,["environment"],n);let i=s(e,["excludedPredefinedFunctions"]);if(i!=null&&l(t,["excludedPredefinedFunctions"],i),s(e,["disabledSafetyPolicies"])!==void 0)throw new Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(Rc,"computerUseToVertex$1");function Pc(e){let t={},r=s(e,["parts"]);if(r!=null){let i=r;Array.isArray(i)&&(i=i.map(o=>Wc(o))),l(t,["parts"],i)}let n=s(e,["role"]);return n!=null&&l(t,["role"],n),t}p(Pc,"contentToMldev$2");function Nc(e){let t={},r=s(e,["parts"]);if(r!=null){let i=r;Array.isArray(i)&&(i=i.map(o=>Xc(o))),l(t,["parts"],i)}let n=s(e,["role"]);return n!=null&&l(t,["role"],n),t}p(Nc,"contentToVertex$2");function kc(e){let t={};if(s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["fileUri"]);r!=null&&l(t,["fileUri"],r);let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(kc,"fileDataToMldev$2");function Dc(e){let t={},r=s(e,["args"]);r!=null&&l(t,["args"],r);let n=s(e,["id"]);n!=null&&l(t,["id"],n);let i=s(e,["name"]);if(i!=null&&l(t,["name"],i),s(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Dc,"functionCallToMldev$2");function Mc(e){let t={},r=s(e,["modelSelectionConfig"]);r!=null&&l(t,["modelConfig"],r);let n=s(e,["responseJsonSchema"]);n!=null&&l(t,["responseJsonSchema"],n);let i=s(e,["audioTranscriptionConfig"]);i!=null&&l(t,["audioTranscriptionConfig"],i);let o=s(e,["audioTimestamp"]);o!=null&&l(t,["audioTimestamp"],o);let a=s(e,["candidateCount"]);a!=null&&l(t,["candidateCount"],a);let c=s(e,["enableAffectiveDialog"]);c!=null&&l(t,["enableAffectiveDialog"],c);let u=s(e,["frequencyPenalty"]);u!=null&&l(t,["frequencyPenalty"],u);let d=s(e,["logprobs"]);d!=null&&l(t,["logprobs"],d);let h=s(e,["maxOutputTokens"]);h!=null&&l(t,["maxOutputTokens"],h);let m=s(e,["mediaResolution"]);m!=null&&l(t,["mediaResolution"],m);let g=s(e,["presencePenalty"]);g!=null&&l(t,["presencePenalty"],g);let _=s(e,["responseFormat"]);if(_!=null){let M=_;Array.isArray(M)&&(M=M.map(D=>D)),l(t,["responseFormat"],M)}let f=s(e,["responseLogprobs"]);f!=null&&l(t,["responseLogprobs"],f);let y=s(e,["responseMimeType"]);y!=null&&l(t,["responseMimeType"],y);let E=s(e,["responseModalities"]);E!=null&&l(t,["responseModalities"],E);let C=s(e,["responseSchema"]);C!=null&&l(t,["responseSchema"],C);let S=s(e,["routingConfig"]);S!=null&&l(t,["routingConfig"],S);let A=s(e,["seed"]);A!=null&&l(t,["seed"],A);let v=s(e,["speechConfig"]);v!=null&&l(t,["speechConfig"],Uo(v));let T=s(e,["stopSequences"]);T!=null&&l(t,["stopSequences"],T);let I=s(e,["temperature"]);I!=null&&l(t,["temperature"],I);let w=s(e,["thinkingConfig"]);w!=null&&l(t,["thinkingConfig"],w);let k=s(e,["topK"]);k!=null&&l(t,["topK"],k);let R=s(e,["topP"]);if(R!=null&&l(t,["topP"],R),s(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["translationConfig"])!==void 0)throw new Error("translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(Mc,"generationConfigToVertex$1");function xc(e){let t={},r=s(e,["authConfig"]);r!=null&&l(t,["authConfig"],wc(r));let n=s(e,["enableWidget"]);if(n!=null&&l(t,["enableWidget"],n),s(e,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(xc,"googleMapsToMldev$2");function bc(e){let t={};if(s(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["searchTypes"]);r!=null&&l(t,["searchTypes"],r);let n=s(e,["timeRangeFilter"]);return n!=null&&l(t,["timeRangeFilter"],n),t}p(bc,"googleSearchToMldev$2");function Uc(e,t){let r={},n=s(e,["generationConfig"]);t!==void 0&&n!=null&&l(t,["setup","generationConfig"],n);let i=s(e,["responseModalities"]);t!==void 0&&i!=null&&l(t,["setup","generationConfig","responseModalities"],i);let o=s(e,["temperature"]);t!==void 0&&o!=null&&l(t,["setup","generationConfig","temperature"],o);let a=s(e,["topP"]);t!==void 0&&a!=null&&l(t,["setup","generationConfig","topP"],a);let c=s(e,["topK"]);t!==void 0&&c!=null&&l(t,["setup","generationConfig","topK"],c);let u=s(e,["maxOutputTokens"]);t!==void 0&&u!=null&&l(t,["setup","generationConfig","maxOutputTokens"],u);let d=s(e,["mediaResolution"]);t!==void 0&&d!=null&&l(t,["setup","generationConfig","mediaResolution"],d);let h=s(e,["seed"]);t!==void 0&&h!=null&&l(t,["setup","generationConfig","seed"],h);let m=s(e,["speechConfig"]);t!==void 0&&m!=null&&l(t,["setup","generationConfig","speechConfig"],Dr(m));let g=s(e,["thinkingConfig"]);t!==void 0&&g!=null&&l(t,["setup","generationConfig","thinkingConfig"],g);let _=s(e,["enableAffectiveDialog"]);t!==void 0&&_!=null&&l(t,["setup","generationConfig","enableAffectiveDialog"],_);let f=s(e,["systemInstruction"]);t!==void 0&&f!=null&&l(t,["setup","systemInstruction"],Pc(Ge(f)));let y=s(e,["tools"]);if(t!==void 0&&y!=null){let R=kt(y);Array.isArray(R)&&(R=R.map(M=>Zc(Nt(M)))),l(t,["setup","tools"],R)}let E=s(e,["sessionResumption"]);t!==void 0&&E!=null&&l(t,["setup","sessionResumption"],zc(E));let C=s(e,["inputAudioTranscription"]);t!==void 0&&C!=null&&l(t,["setup","inputAudioTranscription"],C);let S=s(e,["outputAudioTranscription"]);t!==void 0&&S!=null&&l(t,["setup","outputAudioTranscription"],S);let A=s(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&l(t,["setup","realtimeInputConfig"],A);let v=s(e,["contextWindowCompression"]);t!==void 0&&v!=null&&l(t,["setup","contextWindowCompression"],v);let T=s(e,["proactivity"]);if(t!==void 0&&T!=null&&l(t,["setup","proactivity"],T),s(e,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let I=s(e,["avatarConfig"]);t!==void 0&&I!=null&&l(t,["setup","avatarConfig"],I);let w=s(e,["safetySettings"]);if(t!==void 0&&w!=null){let R=w;Array.isArray(R)&&(R=R.map(M=>Yc(M))),l(t,["setup","safetySettings"],R)}let k=s(e,["translationConfig"]);return t!==void 0&&k!=null&&l(t,["setup","generationConfig","translationConfig"],k),r}p(Uc,"liveConnectConfigToMldev$1");function Gc(e,t){let r={},n=s(e,["generationConfig"]);t!==void 0&&n!=null&&l(t,["setup","generationConfig"],Mc(n));let i=s(e,["responseModalities"]);t!==void 0&&i!=null&&l(t,["setup","generationConfig","responseModalities"],i);let o=s(e,["temperature"]);t!==void 0&&o!=null&&l(t,["setup","generationConfig","temperature"],o);let a=s(e,["topP"]);t!==void 0&&a!=null&&l(t,["setup","generationConfig","topP"],a);let c=s(e,["topK"]);t!==void 0&&c!=null&&l(t,["setup","generationConfig","topK"],c);let u=s(e,["maxOutputTokens"]);t!==void 0&&u!=null&&l(t,["setup","generationConfig","maxOutputTokens"],u);let d=s(e,["mediaResolution"]);t!==void 0&&d!=null&&l(t,["setup","generationConfig","mediaResolution"],d);let h=s(e,["seed"]);t!==void 0&&h!=null&&l(t,["setup","generationConfig","seed"],h);let m=s(e,["speechConfig"]);t!==void 0&&m!=null&&l(t,["setup","generationConfig","speechConfig"],Uo(Dr(m)));let g=s(e,["thinkingConfig"]);t!==void 0&&g!=null&&l(t,["setup","generationConfig","thinkingConfig"],g);let _=s(e,["enableAffectiveDialog"]);t!==void 0&&_!=null&&l(t,["setup","generationConfig","enableAffectiveDialog"],_);let f=s(e,["systemInstruction"]);t!==void 0&&f!=null&&l(t,["setup","systemInstruction"],Nc(Ge(f)));let y=s(e,["tools"]);if(t!==void 0&&y!=null){let M=kt(y);Array.isArray(M)&&(M=M.map(D=>jc(Nt(D)))),l(t,["setup","tools"],M)}let E=s(e,["sessionResumption"]);t!==void 0&&E!=null&&l(t,["setup","sessionResumption"],E);let C=s(e,["inputAudioTranscription"]);t!==void 0&&C!=null&&l(t,["setup","inputAudioTranscription"],C);let S=s(e,["outputAudioTranscription"]);t!==void 0&&S!=null&&l(t,["setup","outputAudioTranscription"],S);let A=s(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&l(t,["setup","realtimeInputConfig"],A);let v=s(e,["contextWindowCompression"]);t!==void 0&&v!=null&&l(t,["setup","contextWindowCompression"],v);let T=s(e,["proactivity"]);t!==void 0&&T!=null&&l(t,["setup","proactivity"],T);let I=s(e,["explicitVadSignal"]);t!==void 0&&I!=null&&l(t,["setup","explicitVadSignal"],I);let w=s(e,["avatarConfig"]);t!==void 0&&w!=null&&l(t,["setup","avatarConfig"],w);let k=s(e,["safetySettings"]);if(t!==void 0&&k!=null){let M=k;Array.isArray(M)&&(M=M.map(D=>D)),l(t,["setup","safetySettings"],M)}let R=s(e,["translationConfig"]);return t!==void 0&&R!=null&&l(t,["setup","generationConfig","translationConfig"],R),r}p(Gc,"liveConnectConfigToVertex");function Lc(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["setup","model"],ue(e,n));let i=s(t,["config"]);return i!=null&&l(r,["config"],Uc(i,r)),r}p(Lc,"liveConnectParametersToMldev");function Oc(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["setup","model"],ue(e,n));let i=s(t,["config"]);return i!=null&&l(r,["config"],Gc(i,r)),r}p(Oc,"liveConnectParametersToVertex");function Fc(e){let t={},r=s(e,["musicGenerationConfig"]);return r!=null&&l(t,["musicGenerationConfig"],r),t}p(Fc,"liveMusicSetConfigParametersToMldev");function qc(e){let t={},r=s(e,["weightedPrompts"]);if(r!=null){let n=r;Array.isArray(n)&&(n=n.map(i=>i)),l(t,["weightedPrompts"],n)}return t}p(qc,"liveMusicSetWeightedPromptsParametersToMldev");function Bc(e){let t={},r=s(e,["media"]);if(r!=null){let d=po(r);Array.isArray(d)&&(d=d.map(h=>sr(h))),l(t,["mediaChunks"],d)}let n=s(e,["audio"]);n!=null&&l(t,["audio"],sr(fo(n)));let i=s(e,["audioStreamEnd"]);i!=null&&l(t,["audioStreamEnd"],i);let o=s(e,["video"]);o!=null&&l(t,["video"],sr(ho(o)));let a=s(e,["text"]);a!=null&&l(t,["text"],a);let c=s(e,["activityStart"]);c!=null&&l(t,["activityStart"],c);let u=s(e,["activityEnd"]);return u!=null&&l(t,["activityEnd"],u),t}p(Bc,"liveSendRealtimeInputParametersToMldev");function Hc(e){let t={},r=s(e,["media"]);if(r!=null){let d=po(r);Array.isArray(d)&&(d=d.map(h=>h)),l(t,["mediaChunks"],d)}let n=s(e,["audio"]);n!=null&&l(t,["audio"],fo(n));let i=s(e,["audioStreamEnd"]);i!=null&&l(t,["audioStreamEnd"],i);let o=s(e,["video"]);o!=null&&l(t,["video"],ho(o));let a=s(e,["text"]);a!=null&&l(t,["text"],a);let c=s(e,["activityStart"]);c!=null&&l(t,["activityStart"],c);let u=s(e,["activityEnd"]);return u!=null&&l(t,["activityEnd"],u),t}p(Hc,"liveSendRealtimeInputParametersToVertex");function Vc(e){let t={},r=s(e,["setupComplete"]);r!=null&&l(t,["setupComplete"],r);let n=s(e,["serverContent"]);n!=null&&l(t,["serverContent"],n);let i=s(e,["toolCall"]);i!=null&&l(t,["toolCall"],i);let o=s(e,["toolCallCancellation"]);o!=null&&l(t,["toolCallCancellation"],o);let a=s(e,["usageMetadata"]);a!=null&&l(t,["usageMetadata"],ep(a));let c=s(e,["goAway"]);c!=null&&l(t,["goAway"],c);let u=s(e,["sessionResumptionUpdate"]);u!=null&&l(t,["sessionResumptionUpdate"],u);let d=s(e,["voiceActivityDetectionSignal"]);d!=null&&l(t,["voiceActivityDetectionSignal"],d);let h=s(e,["voiceActivity"]);return h!=null&&l(t,["voiceActivity"],tp(h)),t}p(Vc,"liveServerMessageFromVertex");function $c(e){let t={};if(s(e,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p($c,"mcpServerToVertex$1");function Jc(e){let t={},r=s(e,["speakerVoiceConfigs"]);if(r!=null){let n=r;Array.isArray(n)&&(n=n.map(i=>Qc(i))),l(t,["speakerVoiceConfigs"],n)}return t}p(Jc,"multiSpeakerVoiceConfigToVertex$1");function Wc(e){let t={},r=s(e,["mediaResolution"]);r!=null&&l(t,["mediaResolution"],r);let n=s(e,["toolCall"]);n!=null&&l(t,["toolCall"],n);let i=s(e,["toolResponse"]);i!=null&&l(t,["toolResponse"],i);let o=s(e,["audioTranscription"]);o!=null&&l(t,["audioTranscription"],o);let a=s(e,["codeExecutionResult"]);a!=null&&l(t,["codeExecutionResult"],a);let c=s(e,["executableCode"]);c!=null&&l(t,["executableCode"],c);let u=s(e,["fileData"]);u!=null&&l(t,["fileData"],kc(u));let d=s(e,["functionCall"]);d!=null&&l(t,["functionCall"],Dc(d));let h=s(e,["functionResponse"]);h!=null&&l(t,["functionResponse"],h);let m=s(e,["inlineData"]);m!=null&&l(t,["inlineData"],sr(m));let g=s(e,["text"]);g!=null&&l(t,["text"],g);let _=s(e,["thought"]);_!=null&&l(t,["thought"],_);let f=s(e,["thoughtSignature"]);f!=null&&l(t,["thoughtSignature"],f);let y=s(e,["videoMetadata"]);y!=null&&l(t,["videoMetadata"],y);let E=s(e,["partMetadata"]);E!=null&&l(t,["partMetadata"],E);let C=s(e,["mediaProcessing"]);return C!=null&&l(t,["mediaProcessing"],C),t}p(Wc,"partToMldev$2");function Xc(e){let t={},r=s(e,["mediaResolution"]);if(r!=null&&l(t,["mediaResolution"],r),s(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let n=s(e,["audioTranscription"]);n!=null&&l(t,["audioTranscription"],n);let i=s(e,["codeExecutionResult"]);i!=null&&l(t,["codeExecutionResult"],i);let o=s(e,["executableCode"]);o!=null&&l(t,["executableCode"],o);let a=s(e,["fileData"]);a!=null&&l(t,["fileData"],a);let c=s(e,["functionCall"]);c!=null&&l(t,["functionCall"],c);let u=s(e,["functionResponse"]);u!=null&&l(t,["functionResponse"],u);let d=s(e,["inlineData"]);d!=null&&l(t,["inlineData"],d);let h=s(e,["text"]);h!=null&&l(t,["text"],h);let m=s(e,["thought"]);m!=null&&l(t,["thought"],m);let g=s(e,["thoughtSignature"]);g!=null&&l(t,["thoughtSignature"],g);let _=s(e,["videoMetadata"]);if(_!=null&&l(t,["videoMetadata"],_),s(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let f=s(e,["mediaProcessing"]);return f!=null&&l(t,["mediaProcessing"],f),t}p(Xc,"partToVertex$2");function Kc(e){let t={},r=s(e,["mimeType"]);r!=null&&l(t,["mimeType"],r);let n=s(e,["voiceSampleAudio"]);if(n!=null&&l(t,["voiceSampleAudio"],n),s(e,["consentAudio"])!==void 0)throw new Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["voiceConsentSignature"])!==void 0)throw new Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(Kc,"replicatedVoiceConfigToVertex$1");function Yc(e){let t={},r=s(e,["category"]);if(r!=null&&l(t,["category"],r),s(e,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["threshold"]);return n!=null&&l(t,["threshold"],n),t}p(Yc,"safetySettingToMldev$2");function zc(e){let t={},r=s(e,["handle"]);if(r!=null&&l(t,["handle"],r),s(e,["transparent"])!==void 0)throw new Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(zc,"sessionResumptionConfigToMldev$1");function Qc(e){let t={},r=s(e,["speaker"]);r!=null&&l(t,["speaker"],r);let n=s(e,["voiceConfig"]);return n!=null&&l(t,["voiceConfig"],Go(n)),t}p(Qc,"speakerVoiceConfigToVertex$1");function Uo(e){let t={},r=s(e,["voiceConfig"]);r!=null&&l(t,["voiceConfig"],Go(r));let n=s(e,["languageCode"]);n!=null&&l(t,["languageCode"],n);let i=s(e,["multiSpeakerVoiceConfig"]);return i!=null&&l(t,["multiSpeakerVoiceConfig"],Jc(i)),t}p(Uo,"speechConfigToVertex$1");function Zc(e){let t={};if(s(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["googleMaps"]);r!=null&&l(t,["googleMaps"],xc(r));let n=s(e,["mcpServers"]);if(n!=null){let m=n;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["mcpServers"],m)}let i=s(e,["codeExecution"]);i!=null&&l(t,["codeExecution"],i);let o=s(e,["computerUse"]);if(o!=null&&l(t,["computerUse"],o),s(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let a=s(e,["functionDeclarations"]);if(a!=null){let m=a;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["functionDeclarations"],m)}let c=s(e,["googleSearch"]);c!=null&&l(t,["googleSearch"],bc(c));let u=s(e,["googleSearchRetrieval"]);if(u!=null&&l(t,["googleSearchRetrieval"],u),s(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=s(e,["urlContext"]);d!=null&&l(t,["urlContext"],d);let h=s(e,["fileSearch"]);return h!=null&&l(t,["fileSearch"],h),t}p(Zc,"toolToMldev$2");function jc(e){let t={},r=s(e,["retrieval"]);r!=null&&l(t,["retrieval"],r);let n=s(e,["googleMaps"]);n!=null&&l(t,["googleMaps"],n);let i=s(e,["mcpServers"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(y=>$c(y))),l(t,["mcpServers"],f)}let o=s(e,["codeExecution"]);o!=null&&l(t,["codeExecution"],o);let a=s(e,["computerUse"]);a!=null&&l(t,["computerUse"],Rc(a));let c=s(e,["enterpriseWebSearch"]);c!=null&&l(t,["enterpriseWebSearch"],c);let u=s(e,["exaAiSearch"]);u!=null&&l(t,["exaAiSearch"],u);let d=s(e,["functionDeclarations"]);if(d!=null){let f=d;Array.isArray(f)&&(f=f.map(y=>y)),l(t,["functionDeclarations"],f)}let h=s(e,["googleSearch"]);h!=null&&l(t,["googleSearch"],h);let m=s(e,["googleSearchRetrieval"]);m!=null&&l(t,["googleSearchRetrieval"],m);let g=s(e,["parallelAiSearch"]);g!=null&&l(t,["parallelAiSearch"],g);let _=s(e,["urlContext"]);if(_!=null&&l(t,["urlContext"],_),s(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}p(jc,"toolToVertex$1");function ep(e){let t={},r=s(e,["candidatesTokenCount"]);r!=null&&l(t,["responseTokenCount"],r);let n=s(e,["candidatesTokensDetails"]);if(n!=null){let _=n;Array.isArray(_)&&(_=_.map(f=>f)),l(t,["responseTokensDetails"],_)}let i=s(e,["cacheTokensDetails"]);if(i!=null){let _=i;Array.isArray(_)&&(_=_.map(f=>f)),l(t,["cacheTokensDetails"],_)}let o=s(e,["cachedContentTokenCount"]);o!=null&&l(t,["cachedContentTokenCount"],o);let a=s(e,["promptTokenCount"]);a!=null&&l(t,["promptTokenCount"],a);let c=s(e,["promptTokensDetails"]);if(c!=null){let _=c;Array.isArray(_)&&(_=_.map(f=>f)),l(t,["promptTokensDetails"],_)}let u=s(e,["thoughtsTokenCount"]);u!=null&&l(t,["thoughtsTokenCount"],u);let d=s(e,["toolUsePromptTokenCount"]);d!=null&&l(t,["toolUsePromptTokenCount"],d);let h=s(e,["toolUsePromptTokensDetails"]);if(h!=null){let _=h;Array.isArray(_)&&(_=_.map(f=>f)),l(t,["toolUsePromptTokensDetails"],_)}let m=s(e,["totalTokenCount"]);m!=null&&l(t,["totalTokenCount"],m);let g=s(e,["trafficType"]);return g!=null&&l(t,["trafficType"],g),t}p(ep,"usageMetadataFromVertex");function tp(e){let t={},r=s(e,["type"]);r!=null&&l(t,["voiceActivityType"],r);let n=s(e,["audioOffset"]);return n!=null&&l(t,["audioOffset"],n),t}p(tp,"voiceActivityFromVertex");function Go(e){let t={},r=s(e,["replicatedVoiceConfig"]);r!=null&&l(t,["replicatedVoiceConfig"],Kc(r));let n=s(e,["prebuiltVoiceConfig"]);return n!=null&&l(t,["prebuiltVoiceConfig"],n),t}p(Go,"voiceConfigToVertex$1");function rp(e,t){let r={},n=s(e,["apiKey"]);if(n!=null&&l(r,["apiKey"],n),s(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(rp,"authConfigToMldev$1");function np(e,t){let r={},n=s(e,["data"]);if(n!=null&&l(r,["data"],n),s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let i=s(e,["mimeType"]);return i!=null&&l(r,["mimeType"],i),r}p(np,"blobToMldev$1");function ip(e,t){let r={},n=s(e,["content"]);n!=null&&l(r,["content"],n);let i=s(e,["citationMetadata"]);i!=null&&l(r,["citationMetadata"],op(i));let o=s(e,["tokenCount"]);o!=null&&l(r,["tokenCount"],o);let a=s(e,["finishReason"]);a!=null&&l(r,["finishReason"],a);let c=s(e,["groundingMetadata"]);c!=null&&l(r,["groundingMetadata"],c);let u=s(e,["avgLogprobs"]);u!=null&&l(r,["avgLogprobs"],u);let d=s(e,["index"]);d!=null&&l(r,["index"],d);let h=s(e,["logprobsResult"]);h!=null&&l(r,["logprobsResult"],h);let m=s(e,["safetyRatings"]);if(m!=null){let _=m;Array.isArray(_)&&(_=_.map(f=>f)),l(r,["safetyRatings"],_)}let g=s(e,["urlContextMetadata"]);return g!=null&&l(r,["urlContextMetadata"],g),r}p(ip,"candidateFromMldev");function op(e,t){let r={},n=s(e,["citationSources"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),l(r,["citations"],i)}return r}p(op,"citationMetadataFromMldev");function sp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["contents"]);if(o!=null){let a=Be(o);Array.isArray(a)&&(a=a.map(c=>xt(c))),l(n,["contents"],a)}return n}p(sp,"computeTokensParametersToVertex");function ap(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["tokensInfo"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(r,["tokensInfo"],o)}return r}p(ap,"computeTokensResponseFromVertex");function lp(e,t){let r={},n=s(e,["enablePromptInjectionDetection"]);n!=null&&l(r,["enablePromptInjectionDetection"],n);let i=s(e,["environment"]);i!=null&&l(r,["environment"],i);let o=s(e,["excludedPredefinedFunctions"]);if(o!=null&&l(r,["excludedPredefinedFunctions"],o),s(e,["disabledSafetyPolicies"])!==void 0)throw new Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p(lp,"computerUseToVertex");function up(e,t){let r={},n=s(e,["values"]);n!=null&&l(r,["values"],n);let i=s(e,["statistics"]);return i!=null&&l(r,["statistics"],dp(i)),r}p(up,"contentEmbeddingFromVertex");function dp(e,t){let r={},n=s(e,["truncated"]);n!=null&&l(r,["truncated"],n);let i=s(e,["token_count"]);i!=null&&l(r,["tokenCount"],i);let o=s(e,["tokensDetails"]);if(o!=null){let a=o;Array.isArray(a)&&(a=a.map(c=>c)),l(r,["tokensDetails"],a)}return r}p(dp,"contentEmbeddingStatisticsFromVertex");function Wt(e,t){let r={},n=s(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(a=>mh(a))),l(r,["parts"],o)}let i=s(e,["role"]);return i!=null&&l(r,["role"],i),r}p(Wt,"contentToMldev$1");function xt(e,t){let r={},n=s(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(a=>gh(a))),l(r,["parts"],o)}let i=s(e,["role"]);return i!=null&&l(r,["role"],i),r}p(xt,"contentToVertex$1");function cp(e,t){let r={},n=s(e,["controlType"]);n!=null&&l(r,["controlType"],n);let i=s(e,["enableControlImageComputation"]);return i!=null&&l(r,["computeControl"],i),r}p(cp,"controlReferenceConfigToVertex");function pp(e,t){let r={};if(s(e,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["tools"])!==void 0)throw new Error("tools parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(pp,"countTokensConfigToMldev");function hp(e,t,r){let n={},i=s(e,["systemInstruction"]);t!==void 0&&i!=null&&l(t,["systemInstruction"],xt(Ge(i)));let o=s(e,["tools"]);if(t!==void 0&&o!=null){let c=o;Array.isArray(c)&&(c=c.map(u=>$o(u))),l(t,["tools"],c)}let a=s(e,["generationConfig"]);return t!==void 0&&a!=null&&l(t,["generationConfig"],jp(a)),n}p(hp,"countTokensConfigToVertex");function fp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["contents"]);if(o!=null){let c=Be(o);Array.isArray(c)&&(c=c.map(u=>Wt(u))),l(n,["contents"],c)}let a=s(t,["config"]);return a!=null&&pp(a),n}p(fp,"countTokensParametersToMldev");function mp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["contents"]);if(o!=null){let c=Be(o);Array.isArray(c)&&(c=c.map(u=>xt(u))),l(n,["contents"],c)}let a=s(t,["config"]);return a!=null&&hp(a,n),n}p(mp,"countTokensParametersToVertex");function gp(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["totalTokens"]);i!=null&&l(r,["totalTokens"],i);let o=s(e,["cachedContentTokenCount"]);return o!=null&&l(r,["cachedContentTokenCount"],o),r}p(gp,"countTokensResponseFromMldev");function _p(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["totalTokens"]);return i!=null&&l(r,["totalTokens"],i),r}p(_p,"countTokensResponseFromVertex");function yp(e,t,r){let n={},i=s(t,["model"]);return i!=null&&l(n,["_url","name"],ue(e,i)),n}p(yp,"deleteModelParametersToMldev");function Ep(e,t,r){let n={},i=s(t,["model"]);return i!=null&&l(n,["_url","name"],ue(e,i)),n}p(Ep,"deleteModelParametersToVertex");function vp(e,t){let r={},n=s(e,["sdkHttpResponse"]);return n!=null&&l(r,["sdkHttpResponse"],n),r}p(vp,"deleteModelResponseFromMldev");function Tp(e,t){let r={},n=s(e,["sdkHttpResponse"]);return n!=null&&l(r,["sdkHttpResponse"],n),r}p(Tp,"deleteModelResponseFromVertex");function Ap(e,t,r){let n={},i=s(e,["outputGcsUri"]);t!==void 0&&i!=null&&l(t,["parameters","storageUri"],i);let o=s(e,["negativePrompt"]);t!==void 0&&o!=null&&l(t,["parameters","negativePrompt"],o);let a=s(e,["numberOfImages"]);t!==void 0&&a!=null&&l(t,["parameters","sampleCount"],a);let c=s(e,["aspectRatio"]);t!==void 0&&c!=null&&l(t,["parameters","aspectRatio"],c);let u=s(e,["guidanceScale"]);t!==void 0&&u!=null&&l(t,["parameters","guidanceScale"],u);let d=s(e,["seed"]);t!==void 0&&d!=null&&l(t,["parameters","seed"],d);let h=s(e,["safetyFilterLevel"]);t!==void 0&&h!=null&&l(t,["parameters","safetySetting"],h);let m=s(e,["personGeneration"]);t!==void 0&&m!=null&&l(t,["parameters","personGeneration"],m);let g=s(e,["includeSafetyAttributes"]);t!==void 0&&g!=null&&l(t,["parameters","includeSafetyAttributes"],g);let _=s(e,["includeRaiReason"]);t!==void 0&&_!=null&&l(t,["parameters","includeRaiReason"],_);let f=s(e,["language"]);t!==void 0&&f!=null&&l(t,["parameters","language"],f);let y=s(e,["outputMimeType"]);t!==void 0&&y!=null&&l(t,["parameters","outputOptions","mimeType"],y);let E=s(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&l(t,["parameters","outputOptions","compressionQuality"],E);let C=s(e,["addWatermark"]);t!==void 0&&C!=null&&l(t,["parameters","addWatermark"],C);let S=s(e,["labels"]);t!==void 0&&S!=null&&l(t,["labels"],S);let A=s(e,["editMode"]);t!==void 0&&A!=null&&l(t,["parameters","editMode"],A);let v=s(e,["baseSteps"]);return t!==void 0&&v!=null&&l(t,["parameters","editConfig","baseSteps"],v),n}p(Ap,"editImageConfigToVertex");function Cp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["prompt"]);o!=null&&l(n,["instances[0]","prompt"],o);let a=s(t,["referenceImages"]);if(a!=null){let u=a;Array.isArray(u)&&(u=u.map(d=>Ah(d))),l(n,["instances[0]","referenceImages"],u)}let c=s(t,["config"]);return c!=null&&Ap(c,n),n}p(Cp,"editImageParametersInternalToVertex");function Sp(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["predictions"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>ar(a))),l(r,["generatedImages"],o)}return r}p(Sp,"editImageResponseFromVertex");function Ip(e,t,r){let n={},i=s(e,["taskType"]);t!==void 0&&i!=null&&l(t,["requests[]","taskType"],i);let o=s(e,["title"]);t!==void 0&&o!=null&&l(t,["requests[]","title"],o);let a=s(e,["outputDimensionality"]);if(t!==void 0&&a!=null&&l(t,["requests[]","outputDimensionality"],a),s(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["documentOcr"])!==void 0)throw new Error("documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["audioTrackExtraction"])!==void 0)throw new Error("audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}p(Ip,"embedContentConfigToMldev");function wp(e,t,r){let n={},i=s(r,["embeddingApiType"]);if(i===void 0&&(i="PREDICT"),i==="PREDICT"){let m=s(e,["taskType"]);t!==void 0&&m!=null&&l(t,["instances[]","task_type"],m)}else if(i==="EMBED_CONTENT"){let m=s(e,["taskType"]);t!==void 0&&m!=null&&l(t,["embedContentConfig","taskType"],m)}let o=s(r,["embeddingApiType"]);if(o===void 0&&(o="PREDICT"),o==="PREDICT"){let m=s(e,["title"]);t!==void 0&&m!=null&&l(t,["instances[]","title"],m)}else if(o==="EMBED_CONTENT"){let m=s(e,["title"]);t!==void 0&&m!=null&&l(t,["embedContentConfig","title"],m)}let a=s(r,["embeddingApiType"]);if(a===void 0&&(a="PREDICT"),a==="PREDICT"){let m=s(e,["outputDimensionality"]);t!==void 0&&m!=null&&l(t,["parameters","outputDimensionality"],m)}else if(a==="EMBED_CONTENT"){let m=s(e,["outputDimensionality"]);t!==void 0&&m!=null&&l(t,["embedContentConfig","outputDimensionality"],m)}let c=s(r,["embeddingApiType"]);if(c===void 0&&(c="PREDICT"),c==="PREDICT"){let m=s(e,["mimeType"]);t!==void 0&&m!=null&&l(t,["instances[]","mimeType"],m)}let u=s(r,["embeddingApiType"]);if(u===void 0&&(u="PREDICT"),u==="PREDICT"){let m=s(e,["autoTruncate"]);t!==void 0&&m!=null&&l(t,["parameters","autoTruncate"],m)}else if(u==="EMBED_CONTENT"){let m=s(e,["autoTruncate"]);t!==void 0&&m!=null&&l(t,["embedContentConfig","autoTruncate"],m)}let d=s(r,["embeddingApiType"]);if(d===void 0&&(d="PREDICT"),d==="EMBED_CONTENT"){let m=s(e,["documentOcr"]);t!==void 0&&m!=null&&l(t,["embedContentConfig","documentOcr"],m)}let h=s(r,["embeddingApiType"]);if(h===void 0&&(h="PREDICT"),h==="EMBED_CONTENT"){let m=s(e,["audioTrackExtraction"]);t!==void 0&&m!=null&&l(t,["embedContentConfig","audioTrackExtraction"],m)}return n}p(wp,"embedContentConfigToVertex");function Rp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["contents"]);if(o!=null){let d=Pr(e,o);Array.isArray(d)&&(d=d.map(h=>h)),l(n,["requests[]","content"],d)}let a=s(t,["content"]);a!=null&&Wt(Ge(a));let c=s(t,["config"]);c!=null&&Ip(c,n);let u=s(t,["model"]);return u!==void 0&&l(n,["requests[]","model"],ue(e,u)),n}p(Rp,"embedContentParametersPrivateToMldev");function Pp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(r,["embeddingApiType"]);if(o===void 0&&(o="PREDICT"),o==="PREDICT"){let u=s(t,["contents"]);if(u!=null){let d=Pr(e,u);Array.isArray(d)&&(d=d.map(h=>h)),l(n,["instances[]","content"],d)}}let a=s(r,["embeddingApiType"]);if(a===void 0&&(a="PREDICT"),a==="EMBED_CONTENT"){let u=s(t,["content"]);u!=null&&l(n,["content"],xt(Ge(u)))}let c=s(t,["config"]);return c!=null&&wp(c,n,r),n}p(Pp,"embedContentParametersPrivateToVertex");function Np(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["embeddings"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(c=>c)),l(r,["embeddings"],a)}let o=s(e,["metadata"]);return o!=null&&l(r,["metadata"],o),r}p(Np,"embedContentResponseFromMldev");function kp(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["predictions[]","embeddings"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(c=>up(c))),l(r,["embeddings"],a)}let o=s(e,["metadata"]);if(o!=null&&l(r,["metadata"],o),t&&s(t,["embeddingApiType"])==="EMBED_CONTENT"){let a=s(e,["embedding"]),c=s(e,["usageMetadata"]),u=s(e,["truncated"]);if(a){let d={};c&&c.promptTokenCount&&(d.tokenCount=c.promptTokenCount),c&&c.promptTokensDetails&&(d.tokensDetails=c.promptTokensDetails),u&&(d.truncated=u),a.statistics=d,l(r,["embeddings"],[a])}}return r}p(kp,"embedContentResponseFromVertex");function Dp(e,t){let r={},n=s(e,["endpoint"]);n!=null&&l(r,["name"],n);let i=s(e,["deployedModelId"]);return i!=null&&l(r,["deployedModelId"],i),r}p(Dp,"endpointFromVertex");function Mp(e,t){let r={};if(s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["fileUri"]);n!=null&&l(r,["fileUri"],n);let i=s(e,["mimeType"]);return i!=null&&l(r,["mimeType"],i),r}p(Mp,"fileDataToMldev$1");function xp(e,t){let r={},n=s(e,["args"]);n!=null&&l(r,["args"],n);let i=s(e,["id"]);i!=null&&l(r,["id"],i);let o=s(e,["name"]);if(o!=null&&l(r,["name"],o),s(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(xp,"functionCallToMldev$1");function bp(e,t){let r={},n=s(e,["allowedFunctionNames"]);n!=null&&l(r,["allowedFunctionNames"],n);let i=s(e,["mode"]);if(i!=null&&l(r,["mode"],i),s(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(bp,"functionCallingConfigToMldev");function Up(e,t,r,n){let i={},o=s(t,["serviceTier"]);r!==void 0&&o!=null&&l(r,["serviceTier"],o);let a=s(t,["systemInstruction"]);r!==void 0&&a!=null&&l(r,["systemInstruction"],Wt(Ge(a)));let c=s(t,["temperature"]);c!=null&&l(i,["temperature"],c);let u=s(t,["topP"]);u!=null&&l(i,["topP"],u);let d=s(t,["topK"]);d!=null&&l(i,["topK"],d);let h=s(t,["candidateCount"]);h!=null&&l(i,["candidateCount"],h);let m=s(t,["maxOutputTokens"]);m!=null&&l(i,["maxOutputTokens"],m);let g=s(t,["stopSequences"]);g!=null&&l(i,["stopSequences"],g);let _=s(t,["responseLogprobs"]);_!=null&&l(i,["responseLogprobs"],_);let f=s(t,["logprobs"]);f!=null&&l(i,["logprobs"],f);let y=s(t,["presencePenalty"]);y!=null&&l(i,["presencePenalty"],y);let E=s(t,["frequencyPenalty"]);E!=null&&l(i,["frequencyPenalty"],E);let C=s(t,["seed"]);C!=null&&l(i,["seed"],C);let S=s(t,["responseMimeType"]);S!=null&&l(i,["responseMimeType"],S);let A=s(t,["responseSchema"]);A!=null&&l(i,["responseSchema"],Nr(A));let v=s(t,["responseJsonSchema"]);if(v!=null&&l(i,["responseJsonSchema"],v),s(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let T=s(t,["safetySettings"]);if(r!==void 0&&T!=null){let X=T;Array.isArray(X)&&(X=X.map(Y=>Sh(Y))),l(r,["safetySettings"],X)}let I=s(t,["tools"]);if(r!==void 0&&I!=null){let X=kt(I);Array.isArray(X)&&(X=X.map(Y=>xh(Nt(Y)))),l(r,["tools"],X)}let w=s(t,["toolConfig"]);if(r!==void 0&&w!=null&&l(r,["toolConfig"],Dh(w)),s(t,["labels"])!==void 0)throw new Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let k=s(t,["cachedContent"]);r!==void 0&&k!=null&&l(r,["cachedContent"],nt(e,k));let R=s(t,["responseModalities"]);R!=null&&l(i,["responseModalities"],R);let M=s(t,["mediaResolution"]);M!=null&&l(i,["mediaResolution"],M);let D=s(t,["speechConfig"]);if(D!=null&&l(i,["speechConfig"],kr(D)),s(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let J=s(t,["thinkingConfig"]);J!=null&&l(i,["thinkingConfig"],J);let O=s(t,["audioTranscriptionConfig"]);O!=null&&l(i,["audioTranscriptionConfig"],O);let L=s(t,["imageConfig"]);L!=null&&l(i,["imageConfig"],ih(L));let B=s(t,["enableEnhancedCivicAnswers"]);if(B!=null&&l(i,["enableEnhancedCivicAnswers"],B),s(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return i}p(Up,"generateContentConfigToMldev");function Gp(e,t,r,n){let i={},o=s(t,["serviceTier"]);r!==void 0&&o!=null&&l(r,["serviceTier"],o);let a=s(t,["systemInstruction"]);r!==void 0&&a!=null&&l(r,["systemInstruction"],xt(Ge(a)));let c=s(t,["temperature"]);c!=null&&l(i,["temperature"],c);let u=s(t,["topP"]);u!=null&&l(i,["topP"],u);let d=s(t,["topK"]);d!=null&&l(i,["topK"],d);let h=s(t,["candidateCount"]);h!=null&&l(i,["candidateCount"],h);let m=s(t,["maxOutputTokens"]);m!=null&&l(i,["maxOutputTokens"],m);let g=s(t,["stopSequences"]);g!=null&&l(i,["stopSequences"],g);let _=s(t,["responseLogprobs"]);_!=null&&l(i,["responseLogprobs"],_);let f=s(t,["logprobs"]);f!=null&&l(i,["logprobs"],f);let y=s(t,["presencePenalty"]);y!=null&&l(i,["presencePenalty"],y);let E=s(t,["frequencyPenalty"]);E!=null&&l(i,["frequencyPenalty"],E);let C=s(t,["seed"]);C!=null&&l(i,["seed"],C);let S=s(t,["responseMimeType"]);S!=null&&l(i,["responseMimeType"],S);let A=s(t,["responseSchema"]);A!=null&&l(i,["responseSchema"],Nr(A));let v=s(t,["responseJsonSchema"]);v!=null&&l(i,["responseJsonSchema"],v);let T=s(t,["routingConfig"]);T!=null&&l(i,["routingConfig"],T);let I=s(t,["modelSelectionConfig"]);I!=null&&l(i,["modelConfig"],I);let w=s(t,["safetySettings"]);if(r!==void 0&&w!=null){let oe=w;Array.isArray(oe)&&(oe=oe.map(Re=>Re)),l(r,["safetySettings"],oe)}let k=s(t,["tools"]);if(r!==void 0&&k!=null){let oe=kt(k);Array.isArray(oe)&&(oe=oe.map(Re=>$o(Nt(Re)))),l(r,["tools"],oe)}let R=s(t,["toolConfig"]);r!==void 0&&R!=null&&l(r,["toolConfig"],Mh(R));let M=s(t,["labels"]);r!==void 0&&M!=null&&l(r,["labels"],M);let D=s(t,["cachedContent"]);r!==void 0&&D!=null&&l(r,["cachedContent"],nt(e,D));let J=s(t,["responseModalities"]);J!=null&&l(i,["responseModalities"],J);let O=s(t,["mediaResolution"]);O!=null&&l(i,["mediaResolution"],O);let L=s(t,["speechConfig"]);L!=null&&l(i,["speechConfig"],Vo(kr(L)));let B=s(t,["audioTimestamp"]);B!=null&&l(i,["audioTimestamp"],B);let X=s(t,["thinkingConfig"]);X!=null&&l(i,["thinkingConfig"],X);let Y=s(t,["audioTranscriptionConfig"]);Y!=null&&l(i,["audioTranscriptionConfig"],Y);let j=s(t,["imageConfig"]);if(j!=null&&l(i,["imageConfig"],oh(j)),s(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let ie=s(t,["modelArmorConfig"]);return r!==void 0&&ie!=null&&l(r,["modelArmorConfig"],ie),i}p(Gp,"generateContentConfigToVertex");function Lo(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["contents"]);if(o!=null){let c=Be(o);Array.isArray(c)&&(c=c.map(u=>Wt(u))),l(n,["contents"],c)}let a=s(t,["config"]);return a!=null&&l(n,["generationConfig"],Up(e,a,n)),n}p(Lo,"generateContentParametersToMldev");function Oo(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["contents"]);if(o!=null){let c=Be(o);Array.isArray(c)&&(c=c.map(u=>xt(u))),l(n,["contents"],c)}let a=s(t,["config"]);return a!=null&&l(n,["generationConfig"],Gp(e,a,n)),n}p(Oo,"generateContentParametersToVertex");function Fo(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["candidates"]);if(i!=null){let h=i;Array.isArray(h)&&(h=h.map(m=>ip(m))),l(r,["candidates"],h)}let o=s(e,["modelVersion"]);o!=null&&l(r,["modelVersion"],o);let a=s(e,["promptFeedback"]);a!=null&&l(r,["promptFeedback"],a);let c=s(e,["responseId"]);c!=null&&l(r,["responseId"],c);let u=s(e,["usageMetadata"]);u!=null&&l(r,["usageMetadata"],u);let d=s(e,["modelStatus"]);return d!=null&&l(r,["modelStatus"],d),r}p(Fo,"generateContentResponseFromMldev");function qo(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["candidates"]);if(i!=null){let h=i;Array.isArray(h)&&(h=h.map(m=>m)),l(r,["candidates"],h)}let o=s(e,["createTime"]);o!=null&&l(r,["createTime"],o);let a=s(e,["modelVersion"]);a!=null&&l(r,["modelVersion"],a);let c=s(e,["promptFeedback"]);c!=null&&l(r,["promptFeedback"],c);let u=s(e,["responseId"]);u!=null&&l(r,["responseId"],u);let d=s(e,["usageMetadata"]);return d!=null&&l(r,["usageMetadata"],d),r}p(qo,"generateContentResponseFromVertex");function Lp(e,t,r){let n={},i=s(e,["outputGcsUri"]);t!==void 0&&i!=null&&l(t,["parameters","storageUri"],i);let o=s(e,["negativePrompt"]);t!==void 0&&o!=null&&l(t,["parameters","negativePrompt"],o);let a=s(e,["numberOfImages"]);t!==void 0&&a!=null&&l(t,["parameters","sampleCount"],a);let c=s(e,["aspectRatio"]);t!==void 0&&c!=null&&l(t,["parameters","aspectRatio"],c);let u=s(e,["guidanceScale"]);t!==void 0&&u!=null&&l(t,["parameters","guidanceScale"],u);let d=s(e,["seed"]);t!==void 0&&d!=null&&l(t,["parameters","seed"],d);let h=s(e,["safetyFilterLevel"]);t!==void 0&&h!=null&&l(t,["parameters","safetySetting"],h);let m=s(e,["personGeneration"]);t!==void 0&&m!=null&&l(t,["parameters","personGeneration"],m);let g=s(e,["includeSafetyAttributes"]);t!==void 0&&g!=null&&l(t,["parameters","includeSafetyAttributes"],g);let _=s(e,["includeRaiReason"]);t!==void 0&&_!=null&&l(t,["parameters","includeRaiReason"],_);let f=s(e,["language"]);t!==void 0&&f!=null&&l(t,["parameters","language"],f);let y=s(e,["outputMimeType"]);t!==void 0&&y!=null&&l(t,["parameters","outputOptions","mimeType"],y);let E=s(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&l(t,["parameters","outputOptions","compressionQuality"],E);let C=s(e,["addWatermark"]);t!==void 0&&C!=null&&l(t,["parameters","addWatermark"],C);let S=s(e,["labels"]);t!==void 0&&S!=null&&l(t,["labels"],S);let A=s(e,["imageSize"]);t!==void 0&&A!=null&&l(t,["parameters","sampleImageSize"],A);let v=s(e,["enhancePrompt"]);return t!==void 0&&v!=null&&l(t,["parameters","enhancePrompt"],v),n}p(Lp,"generateImagesConfigToVertex");function Op(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["prompt"]);o!=null&&l(n,["instances[0]","prompt"],o);let a=s(t,["config"]);return a!=null&&Lp(a,n),n}p(Op,"generateImagesParametersToVertex");function Fp(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["predictions"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(c=>ar(c))),l(r,["generatedImages"],a)}let o=s(e,["positivePromptSafetyAttributes"]);return o!=null&&l(r,["positivePromptSafetyAttributes"],Ho(o)),r}p(Fp,"generateImagesResponseFromVertex");function qp(e,t,r){let n={},i=s(e,["numberOfVideos"]);if(t!==void 0&&i!=null&&l(t,["parameters","sampleCount"],i),s(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["fps"])!==void 0)throw new Error("fps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let o=s(e,["durationSeconds"]);if(t!==void 0&&o!=null&&l(t,["parameters","durationSeconds"],o),s(e,["seed"])!==void 0)throw new Error("seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let a=s(e,["aspectRatio"]);t!==void 0&&a!=null&&l(t,["parameters","aspectRatio"],a);let c=s(e,["resolution"]);t!==void 0&&c!=null&&l(t,["parameters","resolution"],c);let u=s(e,["personGeneration"]);if(t!==void 0&&u!=null&&l(t,["parameters","personGeneration"],u),s(e,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=s(e,["negativePrompt"]);t!==void 0&&d!=null&&l(t,["parameters","negativePrompt"],d);let h=s(e,["enhancePrompt"]);if(t!==void 0&&h!=null&&l(t,["parameters","enhancePrompt"],h),s(e,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=s(e,["lastFrame"]);t!==void 0&&m!=null&&l(t,["instances[0]","lastFrame"],lr(m));let g=s(e,["referenceImages"]);if(t!==void 0&&g!=null){let f=g;Array.isArray(f)&&(f=f.map(y=>Wh(y))),l(t,["instances[0]","referenceImages"],f)}if(s(e,["mask"])!==void 0)throw new Error("mask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["labels"])!==void 0)throw new Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let _=s(e,["webhookConfig"]);if(t!==void 0&&_!=null&&l(t,["webhookConfig"],_),s(e,["resizeMode"])!==void 0)throw new Error("resizeMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}p(qp,"generateVideosConfigToMldev");function Bp(e,t,r){let n={},i=s(e,["numberOfVideos"]);t!==void 0&&i!=null&&l(t,["parameters","sampleCount"],i);let o=s(e,["outputGcsUri"]);t!==void 0&&o!=null&&l(t,["parameters","storageUri"],o);let a=s(e,["fps"]);t!==void 0&&a!=null&&l(t,["parameters","fps"],a);let c=s(e,["durationSeconds"]);t!==void 0&&c!=null&&l(t,["parameters","durationSeconds"],c);let u=s(e,["seed"]);t!==void 0&&u!=null&&l(t,["parameters","seed"],u);let d=s(e,["aspectRatio"]);t!==void 0&&d!=null&&l(t,["parameters","aspectRatio"],d);let h=s(e,["resolution"]);t!==void 0&&h!=null&&l(t,["parameters","resolution"],h);let m=s(e,["personGeneration"]);t!==void 0&&m!=null&&l(t,["parameters","personGeneration"],m);let g=s(e,["pubsubTopic"]);t!==void 0&&g!=null&&l(t,["parameters","pubsubTopic"],g);let _=s(e,["negativePrompt"]);t!==void 0&&_!=null&&l(t,["parameters","negativePrompt"],_);let f=s(e,["enhancePrompt"]);t!==void 0&&f!=null&&l(t,["parameters","enhancePrompt"],f);let y=s(e,["generateAudio"]);t!==void 0&&y!=null&&l(t,["parameters","generateAudio"],y);let E=s(e,["lastFrame"]);t!==void 0&&E!=null&&l(t,["instances[0]","lastFrame"],Xe(E));let C=s(e,["referenceImages"]);if(t!==void 0&&C!=null){let I=C;Array.isArray(I)&&(I=I.map(w=>Xh(w))),l(t,["instances[0]","referenceImages"],I)}let S=s(e,["mask"]);t!==void 0&&S!=null&&l(t,["instances[0]","mask"],Jh(S));let A=s(e,["compressionQuality"]);t!==void 0&&A!=null&&l(t,["parameters","compressionQuality"],A);let v=s(e,["labels"]);if(t!==void 0&&v!=null&&l(t,["labels"],v),s(e,["webhookConfig"])!==void 0)throw new Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let T=s(e,["resizeMode"]);return t!==void 0&&T!=null&&l(t,["parameters","resizeMode"],T),n}p(Bp,"generateVideosConfigToVertex");function Hp(e,t){let r={},n=s(e,["name"]);n!=null&&l(r,["name"],n);let i=s(e,["metadata"]);i!=null&&l(r,["metadata"],i);let o=s(e,["done"]);o!=null&&l(r,["done"],o);let a=s(e,["error"]);a!=null&&l(r,["error"],a);let c=s(e,["response","generateVideoResponse"]);return c!=null&&l(r,["response"],Wp(c)),r}p(Hp,"generateVideosOperationFromMldev");function Vp(e,t){let r={},n=s(e,["name"]);n!=null&&l(r,["name"],n);let i=s(e,["metadata"]);i!=null&&l(r,["metadata"],i);let o=s(e,["done"]);o!=null&&l(r,["done"],o);let a=s(e,["error"]);a!=null&&l(r,["error"],a);let c=s(e,["response"]);return c!=null&&l(r,["response"],Xp(c)),r}p(Vp,"generateVideosOperationFromVertex");function $p(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["prompt"]);o!=null&&l(n,["instances[0]","prompt"],o);let a=s(t,["image"]);a!=null&&l(n,["instances[0]","image"],lr(a));let c=s(t,["video"]);c!=null&&l(n,["instances[0]","video"],Jo(c));let u=s(t,["source"]);u!=null&&Kp(u,n);let d=s(t,["config"]);return d!=null&&qp(d,n),n}p($p,"generateVideosParametersToMldev");function Jp(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["prompt"]);o!=null&&l(n,["instances[0]","prompt"],o);let a=s(t,["image"]);a!=null&&l(n,["instances[0]","image"],Xe(a));let c=s(t,["video"]);c!=null&&l(n,["instances[0]","video"],Wo(c));let u=s(t,["source"]);u!=null&&Yp(u,n);let d=s(t,["config"]);return d!=null&&Bp(d,n),n}p(Jp,"generateVideosParametersToVertex");function Wp(e,t){let r={},n=s(e,["generatedSamples"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(c=>Qp(c))),l(r,["generatedVideos"],a)}let i=s(e,["raiMediaFilteredCount"]);i!=null&&l(r,["raiMediaFilteredCount"],i);let o=s(e,["raiMediaFilteredReasons"]);return o!=null&&l(r,["raiMediaFilteredReasons"],o),r}p(Wp,"generateVideosResponseFromMldev");function Xp(e,t){let r={},n=s(e,["videos"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(c=>Zp(c))),l(r,["generatedVideos"],a)}let i=s(e,["raiMediaFilteredCount"]);i!=null&&l(r,["raiMediaFilteredCount"],i);let o=s(e,["raiMediaFilteredReasons"]);return o!=null&&l(r,["raiMediaFilteredReasons"],o),r}p(Xp,"generateVideosResponseFromVertex");function Kp(e,t,r){let n={},i=s(e,["prompt"]);t!==void 0&&i!=null&&l(t,["instances[0]","prompt"],i);let o=s(e,["image"]);t!==void 0&&o!=null&&l(t,["instances[0]","image"],lr(o));let a=s(e,["video"]);return t!==void 0&&a!=null&&l(t,["instances[0]","video"],Jo(a)),n}p(Kp,"generateVideosSourceToMldev");function Yp(e,t,r){let n={},i=s(e,["prompt"]);t!==void 0&&i!=null&&l(t,["instances[0]","prompt"],i);let o=s(e,["image"]);t!==void 0&&o!=null&&l(t,["instances[0]","image"],Xe(o));let a=s(e,["video"]);return t!==void 0&&a!=null&&l(t,["instances[0]","video"],Wo(a)),n}p(Yp,"generateVideosSourceToVertex");function ar(e,t){let r={},n=s(e,["_self"]);n!=null&&l(r,["image"],Bo(n));let i=s(e,["raiFilteredReason"]);i!=null&&l(r,["raiFilteredReason"],i);let o=s(e,["_self"]);o!=null&&l(r,["safetyAttributes"],Ho(o));let a=s(e,["prompt"]);return a!=null&&l(r,["enhancedPrompt"],a),r}p(ar,"generatedImageFromVertex");function zp(e,t){let r={},n=s(e,["_self"]);n!=null&&l(r,["mask"],Bo(n));let i=s(e,["labels"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(r,["labels"],o)}return r}p(zp,"generatedImageMaskFromVertex");function Qp(e,t){let r={},n=s(e,["video"]);return n!=null&&l(r,["video"],Vh(n)),r}p(Qp,"generatedVideoFromMldev");function Zp(e,t){let r={},n=s(e,["_self"]);return n!=null&&l(r,["video"],$h(n)),r}p(Zp,"generatedVideoFromVertex");function jp(e,t){let r={},n=s(e,["modelSelectionConfig"]);n!=null&&l(r,["modelConfig"],n);let i=s(e,["responseJsonSchema"]);i!=null&&l(r,["responseJsonSchema"],i);let o=s(e,["audioTranscriptionConfig"]);o!=null&&l(r,["audioTranscriptionConfig"],o);let a=s(e,["audioTimestamp"]);a!=null&&l(r,["audioTimestamp"],a);let c=s(e,["candidateCount"]);c!=null&&l(r,["candidateCount"],c);let u=s(e,["enableAffectiveDialog"]);u!=null&&l(r,["enableAffectiveDialog"],u);let d=s(e,["frequencyPenalty"]);d!=null&&l(r,["frequencyPenalty"],d);let h=s(e,["logprobs"]);h!=null&&l(r,["logprobs"],h);let m=s(e,["maxOutputTokens"]);m!=null&&l(r,["maxOutputTokens"],m);let g=s(e,["mediaResolution"]);g!=null&&l(r,["mediaResolution"],g);let _=s(e,["presencePenalty"]);_!=null&&l(r,["presencePenalty"],_);let f=s(e,["responseFormat"]);if(f!=null){let D=f;Array.isArray(D)&&(D=D.map(J=>J)),l(r,["responseFormat"],D)}let y=s(e,["responseLogprobs"]);y!=null&&l(r,["responseLogprobs"],y);let E=s(e,["responseMimeType"]);E!=null&&l(r,["responseMimeType"],E);let C=s(e,["responseModalities"]);C!=null&&l(r,["responseModalities"],C);let S=s(e,["responseSchema"]);S!=null&&l(r,["responseSchema"],S);let A=s(e,["routingConfig"]);A!=null&&l(r,["routingConfig"],A);let v=s(e,["seed"]);v!=null&&l(r,["seed"],v);let T=s(e,["speechConfig"]);T!=null&&l(r,["speechConfig"],Vo(T));let I=s(e,["stopSequences"]);I!=null&&l(r,["stopSequences"],I);let w=s(e,["temperature"]);w!=null&&l(r,["temperature"],w);let k=s(e,["thinkingConfig"]);k!=null&&l(r,["thinkingConfig"],k);let R=s(e,["topK"]);R!=null&&l(r,["topK"],R);let M=s(e,["topP"]);if(M!=null&&l(r,["topP"],M),s(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["translationConfig"])!==void 0)throw new Error("translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p(jp,"generationConfigToVertex");function eh(e,t,r){let n={},i=s(t,["model"]);return i!=null&&l(n,["_url","name"],ue(e,i)),n}p(eh,"getModelParametersToMldev");function th(e,t,r){let n={},i=s(t,["model"]);return i!=null&&l(n,["_url","name"],ue(e,i)),n}p(th,"getModelParametersToVertex");function rh(e,t){let r={},n=s(e,["authConfig"]);n!=null&&l(r,["authConfig"],rp(n));let i=s(e,["enableWidget"]);if(i!=null&&l(r,["enableWidget"],i),s(e,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(rh,"googleMapsToMldev$1");function nh(e,t){let r={};if(s(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["searchTypes"]);n!=null&&l(r,["searchTypes"],n);let i=s(e,["timeRangeFilter"]);return i!=null&&l(r,["timeRangeFilter"],i),r}p(nh,"googleSearchToMldev$1");function ih(e,t){let r={},n=s(e,["aspectRatio"]);n!=null&&l(r,["aspectRatio"],n);let i=s(e,["imageSize"]);if(i!=null&&l(r,["imageSize"],i),s(e,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["imageOutputOptions"])!==void 0)throw new Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}p(ih,"imageConfigToMldev");function oh(e,t){let r={},n=s(e,["aspectRatio"]);n!=null&&l(r,["aspectRatio"],n);let i=s(e,["imageSize"]);i!=null&&l(r,["imageSize"],i);let o=s(e,["personGeneration"]);o!=null&&l(r,["personGeneration"],o);let a=s(e,["outputMimeType"]);a!=null&&l(r,["imageOutputOptions","mimeType"],a);let c=s(e,["outputCompressionQuality"]);c!=null&&l(r,["imageOutputOptions","compressionQuality"],c);let u=s(e,["imageOutputOptions"]);u!=null&&l(r,["imageOutputOptions"],u);let d=s(e,["prominentPeople"]);return d!=null&&l(r,["prominentPeople"],d),r}p(oh,"imageConfigToVertex");function Bo(e,t){let r={},n=s(e,["gcsUri"]);n!=null&&l(r,["gcsUri"],n);let i=s(e,["bytesBase64Encoded"]);i!=null&&l(r,["imageBytes"],yt(i));let o=s(e,["mimeType"]);return o!=null&&l(r,["mimeType"],o),r}p(Bo,"imageFromVertex");function lr(e,t){let r={};if(s(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["imageBytes"]);n!=null&&l(r,["bytesBase64Encoded"],yt(n));let i=s(e,["mimeType"]);return i!=null&&l(r,["mimeType"],i),r}p(lr,"imageToMldev");function Xe(e,t){let r={},n=s(e,["gcsUri"]);n!=null&&l(r,["gcsUri"],n);let i=s(e,["imageBytes"]);i!=null&&l(r,["bytesBase64Encoded"],yt(i));let o=s(e,["mimeType"]);return o!=null&&l(r,["mimeType"],o),r}p(Xe,"imageToVertex");function sh(e,t,r,n){let i={},o=s(t,["pageSize"]);r!==void 0&&o!=null&&l(r,["_query","pageSize"],o);let a=s(t,["pageToken"]);r!==void 0&&a!=null&&l(r,["_query","pageToken"],a);let c=s(t,["filter"]);r!==void 0&&c!=null&&l(r,["_query","filter"],c);let u=s(t,["queryBase"]);return r!==void 0&&u!=null&&l(r,["_url","models_url"],Ao(e,u)),i}p(sh,"listModelsConfigToMldev");function ah(e,t,r,n){let i={},o=s(t,["pageSize"]);r!==void 0&&o!=null&&l(r,["_query","pageSize"],o);let a=s(t,["pageToken"]);r!==void 0&&a!=null&&l(r,["_query","pageToken"],a);let c=s(t,["filter"]);r!==void 0&&c!=null&&l(r,["_query","filter"],c);let u=s(t,["queryBase"]);return r!==void 0&&u!=null&&l(r,["_url","models_url"],Ao(e,u)),i}p(ah,"listModelsConfigToVertex");function lh(e,t,r){let n={},i=s(t,["config"]);return i!=null&&sh(e,i,n),n}p(lh,"listModelsParametersToMldev");function uh(e,t,r){let n={},i=s(t,["config"]);return i!=null&&ah(e,i,n),n}p(uh,"listModelsParametersToVertex");function dh(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["nextPageToken"]);i!=null&&l(r,["nextPageToken"],i);let o=s(e,["_self"]);if(o!=null){let a=Co(o);Array.isArray(a)&&(a=a.map(c=>br(c))),l(r,["models"],a)}return r}p(dh,"listModelsResponseFromMldev");function ch(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["nextPageToken"]);i!=null&&l(r,["nextPageToken"],i);let o=s(e,["_self"]);if(o!=null){let a=Co(o);Array.isArray(a)&&(a=a.map(c=>Ur(c))),l(r,["models"],a)}return r}p(ch,"listModelsResponseFromVertex");function ph(e,t){let r={},n=s(e,["maskMode"]);n!=null&&l(r,["maskMode"],n);let i=s(e,["segmentationClasses"]);i!=null&&l(r,["maskClasses"],i);let o=s(e,["maskDilation"]);return o!=null&&l(r,["dilation"],o),r}p(ph,"maskReferenceConfigToVertex");function hh(e,t){let r={};if(s(e,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p(hh,"mcpServerToVertex");function br(e,t){let r={},n=s(e,["name"]);n!=null&&l(r,["name"],n);let i=s(e,["displayName"]);i!=null&&l(r,["displayName"],i);let o=s(e,["description"]);o!=null&&l(r,["description"],o);let a=s(e,["version"]);a!=null&&l(r,["version"],a);let c=s(e,["_self"]);c!=null&&l(r,["tunedModelInfo"],bh(c));let u=s(e,["inputTokenLimit"]);u!=null&&l(r,["inputTokenLimit"],u);let d=s(e,["outputTokenLimit"]);d!=null&&l(r,["outputTokenLimit"],d);let h=s(e,["supportedGenerationMethods"]);h!=null&&l(r,["supportedActions"],h);let m=s(e,["temperature"]);m!=null&&l(r,["temperature"],m);let g=s(e,["maxTemperature"]);g!=null&&l(r,["maxTemperature"],g);let _=s(e,["topP"]);_!=null&&l(r,["topP"],_);let f=s(e,["topK"]);f!=null&&l(r,["topK"],f);let y=s(e,["thinking"]);return y!=null&&l(r,["thinking"],y),r}p(br,"modelFromMldev");function Ur(e,t){let r={},n=s(e,["name"]);n!=null&&l(r,["name"],n);let i=s(e,["displayName"]);i!=null&&l(r,["displayName"],i);let o=s(e,["description"]);o!=null&&l(r,["description"],o);let a=s(e,["versionId"]);a!=null&&l(r,["version"],a);let c=s(e,["deployedModels"]);if(c!=null){let g=c;Array.isArray(g)&&(g=g.map(_=>Dp(_))),l(r,["endpoints"],g)}let u=s(e,["labels"]);u!=null&&l(r,["labels"],u);let d=s(e,["_self"]);d!=null&&l(r,["tunedModelInfo"],Uh(d));let h=s(e,["defaultCheckpointId"]);h!=null&&l(r,["defaultCheckpointId"],h);let m=s(e,["checkpoints"]);if(m!=null){let g=m;Array.isArray(g)&&(g=g.map(_=>_)),l(r,["checkpoints"],g)}return r}p(Ur,"modelFromVertex");function fh(e,t){let r={},n=s(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>kh(o))),l(r,["speakerVoiceConfigs"],i)}return r}p(fh,"multiSpeakerVoiceConfigToVertex");function mh(e,t){let r={},n=s(e,["mediaResolution"]);n!=null&&l(r,["mediaResolution"],n);let i=s(e,["toolCall"]);i!=null&&l(r,["toolCall"],i);let o=s(e,["toolResponse"]);o!=null&&l(r,["toolResponse"],o);let a=s(e,["audioTranscription"]);a!=null&&l(r,["audioTranscription"],a);let c=s(e,["codeExecutionResult"]);c!=null&&l(r,["codeExecutionResult"],c);let u=s(e,["executableCode"]);u!=null&&l(r,["executableCode"],u);let d=s(e,["fileData"]);d!=null&&l(r,["fileData"],Mp(d));let h=s(e,["functionCall"]);h!=null&&l(r,["functionCall"],xp(h));let m=s(e,["functionResponse"]);m!=null&&l(r,["functionResponse"],m);let g=s(e,["inlineData"]);g!=null&&l(r,["inlineData"],np(g));let _=s(e,["text"]);_!=null&&l(r,["text"],_);let f=s(e,["thought"]);f!=null&&l(r,["thought"],f);let y=s(e,["thoughtSignature"]);y!=null&&l(r,["thoughtSignature"],y);let E=s(e,["videoMetadata"]);E!=null&&l(r,["videoMetadata"],E);let C=s(e,["partMetadata"]);C!=null&&l(r,["partMetadata"],C);let S=s(e,["mediaProcessing"]);return S!=null&&l(r,["mediaProcessing"],S),r}p(mh,"partToMldev$1");function gh(e,t){let r={},n=s(e,["mediaResolution"]);if(n!=null&&l(r,["mediaResolution"],n),s(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let i=s(e,["audioTranscription"]);i!=null&&l(r,["audioTranscription"],i);let o=s(e,["codeExecutionResult"]);o!=null&&l(r,["codeExecutionResult"],o);let a=s(e,["executableCode"]);a!=null&&l(r,["executableCode"],a);let c=s(e,["fileData"]);c!=null&&l(r,["fileData"],c);let u=s(e,["functionCall"]);u!=null&&l(r,["functionCall"],u);let d=s(e,["functionResponse"]);d!=null&&l(r,["functionResponse"],d);let h=s(e,["inlineData"]);h!=null&&l(r,["inlineData"],h);let m=s(e,["text"]);m!=null&&l(r,["text"],m);let g=s(e,["thought"]);g!=null&&l(r,["thought"],g);let _=s(e,["thoughtSignature"]);_!=null&&l(r,["thoughtSignature"],_);let f=s(e,["videoMetadata"]);if(f!=null&&l(r,["videoMetadata"],f),s(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let y=s(e,["mediaProcessing"]);return y!=null&&l(r,["mediaProcessing"],y),r}p(gh,"partToVertex$1");function _h(e,t){let r={},n=s(e,["productImage"]);return n!=null&&l(r,["image"],Xe(n)),r}p(_h,"productImageToVertex");function yh(e,t,r){let n={},i=s(e,["numberOfImages"]);t!==void 0&&i!=null&&l(t,["parameters","sampleCount"],i);let o=s(e,["baseSteps"]);t!==void 0&&o!=null&&l(t,["parameters","baseSteps"],o);let a=s(e,["outputGcsUri"]);t!==void 0&&a!=null&&l(t,["parameters","storageUri"],a);let c=s(e,["seed"]);t!==void 0&&c!=null&&l(t,["parameters","seed"],c);let u=s(e,["safetyFilterLevel"]);t!==void 0&&u!=null&&l(t,["parameters","safetySetting"],u);let d=s(e,["personGeneration"]);t!==void 0&&d!=null&&l(t,["parameters","personGeneration"],d);let h=s(e,["addWatermark"]);t!==void 0&&h!=null&&l(t,["parameters","addWatermark"],h);let m=s(e,["outputMimeType"]);t!==void 0&&m!=null&&l(t,["parameters","outputOptions","mimeType"],m);let g=s(e,["outputCompressionQuality"]);t!==void 0&&g!=null&&l(t,["parameters","outputOptions","compressionQuality"],g);let _=s(e,["enhancePrompt"]);t!==void 0&&_!=null&&l(t,["parameters","enhancePrompt"],_);let f=s(e,["labels"]);return t!==void 0&&f!=null&&l(t,["labels"],f),n}p(yh,"recontextImageConfigToVertex");function Eh(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["source"]);o!=null&&Th(o,n);let a=s(t,["config"]);return a!=null&&yh(a,n),n}p(Eh,"recontextImageParametersToVertex");function vh(e,t){let r={},n=s(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>ar(o))),l(r,["generatedImages"],i)}return r}p(vh,"recontextImageResponseFromVertex");function Th(e,t,r){let n={},i=s(e,["prompt"]);t!==void 0&&i!=null&&l(t,["instances[0]","prompt"],i);let o=s(e,["personImage"]);t!==void 0&&o!=null&&l(t,["instances[0]","personImage","image"],Xe(o));let a=s(e,["productImages"]);if(t!==void 0&&a!=null){let c=a;Array.isArray(c)&&(c=c.map(u=>_h(u))),l(t,["instances[0]","productImages"],c)}return n}p(Th,"recontextImageSourceToVertex");function Ah(e,t){let r={},n=s(e,["referenceImage"]);n!=null&&l(r,["referenceImage"],Xe(n));let i=s(e,["referenceId"]);i!=null&&l(r,["referenceId"],i);let o=s(e,["referenceType"]);o!=null&&l(r,["referenceType"],o);let a=s(e,["maskImageConfig"]);a!=null&&l(r,["maskImageConfig"],ph(a));let c=s(e,["controlImageConfig"]);c!=null&&l(r,["controlImageConfig"],cp(c));let u=s(e,["styleImageConfig"]);u!=null&&l(r,["styleImageConfig"],u);let d=s(e,["subjectImageConfig"]);return d!=null&&l(r,["subjectImageConfig"],d),r}p(Ah,"referenceImageAPIInternalToVertex");function Ch(e,t){let r={},n=s(e,["mimeType"]);n!=null&&l(r,["mimeType"],n);let i=s(e,["voiceSampleAudio"]);if(i!=null&&l(r,["voiceSampleAudio"],i),s(e,["consentAudio"])!==void 0)throw new Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["voiceConsentSignature"])!==void 0)throw new Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p(Ch,"replicatedVoiceConfigToVertex");function Ho(e,t){let r={},n=s(e,["safetyAttributes","categories"]);n!=null&&l(r,["categories"],n);let i=s(e,["safetyAttributes","scores"]);i!=null&&l(r,["scores"],i);let o=s(e,["contentType"]);return o!=null&&l(r,["contentType"],o),r}p(Ho,"safetyAttributesFromVertex");function Sh(e,t){let r={},n=s(e,["category"]);if(n!=null&&l(r,["category"],n),s(e,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let i=s(e,["threshold"]);return i!=null&&l(r,["threshold"],i),r}p(Sh,"safetySettingToMldev$1");function Ih(e,t){let r={},n=s(e,["image"]);return n!=null&&l(r,["image"],Xe(n)),r}p(Ih,"scribbleImageToVertex");function wh(e,t,r){let n={},i=s(e,["mode"]);t!==void 0&&i!=null&&l(t,["parameters","mode"],i);let o=s(e,["maxPredictions"]);t!==void 0&&o!=null&&l(t,["parameters","maxPredictions"],o);let a=s(e,["confidenceThreshold"]);t!==void 0&&a!=null&&l(t,["parameters","confidenceThreshold"],a);let c=s(e,["maskDilation"]);t!==void 0&&c!=null&&l(t,["parameters","maskDilation"],c);let u=s(e,["binaryColorThreshold"]);t!==void 0&&u!=null&&l(t,["parameters","binaryColorThreshold"],u);let d=s(e,["labels"]);return t!==void 0&&d!=null&&l(t,["labels"],d),n}p(wh,"segmentImageConfigToVertex");function Rh(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["source"]);o!=null&&Nh(o,n);let a=s(t,["config"]);return a!=null&&wh(a,n),n}p(Rh,"segmentImageParametersToVertex");function Ph(e,t){let r={},n=s(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>zp(o))),l(r,["generatedMasks"],i)}return r}p(Ph,"segmentImageResponseFromVertex");function Nh(e,t,r){let n={},i=s(e,["prompt"]);t!==void 0&&i!=null&&l(t,["instances[0]","prompt"],i);let o=s(e,["image"]);t!==void 0&&o!=null&&l(t,["instances[0]","image"],Xe(o));let a=s(e,["scribbleImage"]);return t!==void 0&&a!=null&&l(t,["instances[0]","scribble"],Ih(a)),n}p(Nh,"segmentImageSourceToVertex");function kh(e,t){let r={},n=s(e,["speaker"]);n!=null&&l(r,["speaker"],n);let i=s(e,["voiceConfig"]);return i!=null&&l(r,["voiceConfig"],Xo(i)),r}p(kh,"speakerVoiceConfigToVertex");function Vo(e,t){let r={},n=s(e,["voiceConfig"]);n!=null&&l(r,["voiceConfig"],Xo(n));let i=s(e,["languageCode"]);i!=null&&l(r,["languageCode"],i);let o=s(e,["multiSpeakerVoiceConfig"]);return o!=null&&l(r,["multiSpeakerVoiceConfig"],fh(o)),r}p(Vo,"speechConfigToVertex");function Dh(e,t){let r={},n=s(e,["functionCallingConfig"]);n!=null&&l(r,["functionCallingConfig"],bp(n));let i=s(e,["retrievalConfig"]);i!=null&&l(r,["retrievalConfig"],i);let o=s(e,["includeServerSideToolInvocations"]);return o!=null&&l(r,["includeServerSideToolInvocations"],o),r}p(Dh,"toolConfigToMldev");function Mh(e,t){let r={},n=s(e,["functionCallingConfig"]);n!=null&&l(r,["functionCallingConfig"],n);let i=s(e,["retrievalConfig"]);if(i!=null&&l(r,["retrievalConfig"],i),s(e,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p(Mh,"toolConfigToVertex");function xh(e,t){let r={};if(s(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["googleMaps"]);n!=null&&l(r,["googleMaps"],rh(n));let i=s(e,["mcpServers"]);if(i!=null){let g=i;Array.isArray(g)&&(g=g.map(_=>_)),l(r,["mcpServers"],g)}let o=s(e,["codeExecution"]);o!=null&&l(r,["codeExecution"],o);let a=s(e,["computerUse"]);if(a!=null&&l(r,["computerUse"],a),s(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=s(e,["functionDeclarations"]);if(c!=null){let g=c;Array.isArray(g)&&(g=g.map(_=>_)),l(r,["functionDeclarations"],g)}let u=s(e,["googleSearch"]);u!=null&&l(r,["googleSearch"],nh(u));let d=s(e,["googleSearchRetrieval"]);if(d!=null&&l(r,["googleSearchRetrieval"],d),s(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let h=s(e,["urlContext"]);h!=null&&l(r,["urlContext"],h);let m=s(e,["fileSearch"]);return m!=null&&l(r,["fileSearch"],m),r}p(xh,"toolToMldev$1");function $o(e,t){let r={},n=s(e,["retrieval"]);n!=null&&l(r,["retrieval"],n);let i=s(e,["googleMaps"]);i!=null&&l(r,["googleMaps"],i);let o=s(e,["mcpServers"]);if(o!=null){let y=o;Array.isArray(y)&&(y=y.map(E=>hh(E))),l(r,["mcpServers"],y)}let a=s(e,["codeExecution"]);a!=null&&l(r,["codeExecution"],a);let c=s(e,["computerUse"]);c!=null&&l(r,["computerUse"],lp(c));let u=s(e,["enterpriseWebSearch"]);u!=null&&l(r,["enterpriseWebSearch"],u);let d=s(e,["exaAiSearch"]);d!=null&&l(r,["exaAiSearch"],d);let h=s(e,["functionDeclarations"]);if(h!=null){let y=h;Array.isArray(y)&&(y=y.map(E=>E)),l(r,["functionDeclarations"],y)}let m=s(e,["googleSearch"]);m!=null&&l(r,["googleSearch"],m);let g=s(e,["googleSearchRetrieval"]);g!=null&&l(r,["googleSearchRetrieval"],g);let _=s(e,["parallelAiSearch"]);_!=null&&l(r,["parallelAiSearch"],_);let f=s(e,["urlContext"]);if(f!=null&&l(r,["urlContext"],f),s(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}p($o,"toolToVertex");function bh(e,t){let r={},n=s(e,["baseModel"]);n!=null&&l(r,["baseModel"],n);let i=s(e,["createTime"]);i!=null&&l(r,["createTime"],i);let o=s(e,["updateTime"]);return o!=null&&l(r,["updateTime"],o),r}p(bh,"tunedModelInfoFromMldev");function Uh(e,t){let r={},n=s(e,["labels","google-vertex-llm-tuning-base-model-id"]);n!=null&&l(r,["baseModel"],n);let i=s(e,["createTime"]);i!=null&&l(r,["createTime"],i);let o=s(e,["updateTime"]);return o!=null&&l(r,["updateTime"],o),r}p(Uh,"tunedModelInfoFromVertex");function Gh(e,t,r){let n={},i=s(e,["displayName"]);t!==void 0&&i!=null&&l(t,["displayName"],i);let o=s(e,["description"]);t!==void 0&&o!=null&&l(t,["description"],o);let a=s(e,["defaultCheckpointId"]);return t!==void 0&&a!=null&&l(t,["defaultCheckpointId"],a),n}p(Gh,"updateModelConfigToMldev");function Lh(e,t,r){let n={},i=s(e,["displayName"]);t!==void 0&&i!=null&&l(t,["displayName"],i);let o=s(e,["description"]);t!==void 0&&o!=null&&l(t,["description"],o);let a=s(e,["defaultCheckpointId"]);return t!==void 0&&a!=null&&l(t,["defaultCheckpointId"],a),n}p(Lh,"updateModelConfigToVertex");function Oh(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","name"],ue(e,i));let o=s(t,["config"]);return o!=null&&Gh(o,n),n}p(Oh,"updateModelParametersToMldev");function Fh(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["config"]);return o!=null&&Lh(o,n),n}p(Fh,"updateModelParametersToVertex");function qh(e,t,r){let n={},i=s(e,["outputGcsUri"]);t!==void 0&&i!=null&&l(t,["parameters","storageUri"],i);let o=s(e,["safetyFilterLevel"]);t!==void 0&&o!=null&&l(t,["parameters","safetySetting"],o);let a=s(e,["personGeneration"]);t!==void 0&&a!=null&&l(t,["parameters","personGeneration"],a);let c=s(e,["includeRaiReason"]);t!==void 0&&c!=null&&l(t,["parameters","includeRaiReason"],c);let u=s(e,["outputMimeType"]);t!==void 0&&u!=null&&l(t,["parameters","outputOptions","mimeType"],u);let d=s(e,["outputCompressionQuality"]);t!==void 0&&d!=null&&l(t,["parameters","outputOptions","compressionQuality"],d);let h=s(e,["enhanceInputImage"]);t!==void 0&&h!=null&&l(t,["parameters","upscaleConfig","enhanceInputImage"],h);let m=s(e,["imagePreservationFactor"]);t!==void 0&&m!=null&&l(t,["parameters","upscaleConfig","imagePreservationFactor"],m);let g=s(e,["labels"]);t!==void 0&&g!=null&&l(t,["labels"],g);let _=s(e,["numberOfImages"]);t!==void 0&&_!=null&&l(t,["parameters","sampleCount"],_);let f=s(e,["mode"]);return t!==void 0&&f!=null&&l(t,["parameters","mode"],f),n}p(qh,"upscaleImageAPIConfigInternalToVertex");function Bh(e,t,r){let n={},i=s(t,["model"]);i!=null&&l(n,["_url","model"],ue(e,i));let o=s(t,["image"]);o!=null&&l(n,["instances[0]","image"],Xe(o));let a=s(t,["upscaleFactor"]);a!=null&&l(n,["parameters","upscaleConfig","upscaleFactor"],a);let c=s(t,["config"]);return c!=null&&qh(c,n),n}p(Bh,"upscaleImageAPIParametersInternalToVertex");function Hh(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["predictions"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>ar(a))),l(r,["generatedImages"],o)}return r}p(Hh,"upscaleImageResponseFromVertex");function Vh(e,t){let r={},n=s(e,["uri"]);n!=null&&l(r,["uri"],n);let i=s(e,["encodedVideo"]);i!=null&&l(r,["videoBytes"],yt(i));let o=s(e,["encoding"]);return o!=null&&l(r,["mimeType"],o),r}p(Vh,"videoFromMldev");function $h(e,t){let r={},n=s(e,["gcsUri"]);n!=null&&l(r,["uri"],n);let i=s(e,["bytesBase64Encoded"]);i!=null&&l(r,["videoBytes"],yt(i));let o=s(e,["mimeType"]);return o!=null&&l(r,["mimeType"],o),r}p($h,"videoFromVertex");function Jh(e,t){let r={},n=s(e,["image"]);n!=null&&l(r,["_self"],Xe(n));let i=s(e,["maskMode"]);return i!=null&&l(r,["maskMode"],i),r}p(Jh,"videoGenerationMaskToVertex");function Wh(e,t){let r={},n=s(e,["image"]);n!=null&&l(r,["image"],lr(n));let i=s(e,["referenceType"]);return i!=null&&l(r,["referenceType"],i),r}p(Wh,"videoGenerationReferenceImageToMldev");function Xh(e,t){let r={},n=s(e,["image"]);n!=null&&l(r,["image"],Xe(n));let i=s(e,["referenceType"]);return i!=null&&l(r,["referenceType"],i),r}p(Xh,"videoGenerationReferenceImageToVertex");function Jo(e,t){let r={},n=s(e,["uri"]);n!=null&&l(r,["uri"],n);let i=s(e,["videoBytes"]);i!=null&&l(r,["encodedVideo"],yt(i));let o=s(e,["mimeType"]);return o!=null&&l(r,["encoding"],o),r}p(Jo,"videoToMldev");function Wo(e,t){let r={},n=s(e,["uri"]);n!=null&&l(r,["gcsUri"],n);let i=s(e,["videoBytes"]);i!=null&&l(r,["bytesBase64Encoded"],yt(i));let o=s(e,["mimeType"]);return o!=null&&l(r,["mimeType"],o),r}p(Wo,"videoToVertex");function Xo(e,t){let r={},n=s(e,["replicatedVoiceConfig"]);n!=null&&l(r,["replicatedVoiceConfig"],Ch(n));let i=s(e,["prebuiltVoiceConfig"]);return i!=null&&l(r,["prebuiltVoiceConfig"],i),r}p(Xo,"voiceConfigToVertex");function Kh(e,t,r){let n={},i=s(t,["displayName"]);r!==void 0&&i!=null&&l(r,["displayName"],i);let o=s(t,["embeddingModel"]);return r!==void 0&&o!=null&&l(r,["embeddingModel"],ue(e,o)),n}p(Kh,"createFileSearchStoreConfigToMldev");function Yh(e,t){let r={},n=s(t,["config"]);return n!=null&&Kh(e,n,r),r}p(Yh,"createFileSearchStoreParametersToMldev");function zh(e,t){let r={},n=s(e,["force"]);return t!==void 0&&n!=null&&l(t,["_query","force"],n),r}p(zh,"deleteFileSearchStoreConfigToMldev");function Qh(e){let t={},r=s(e,["name"]);r!=null&&l(t,["_url","name"],r);let n=s(e,["config"]);return n!=null&&zh(n,t),t}p(Qh,"deleteFileSearchStoreParametersToMldev");function Zh(e){let t={},r=s(e,["name"]);return r!=null&&l(t,["_url","name"],r),t}p(Zh,"getFileSearchStoreParametersToMldev");function jh(e,t){let r={},n=s(e,["customMetadata"]);if(t!==void 0&&n!=null){let o=n;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["customMetadata"],o)}let i=s(e,["chunkingConfig"]);return t!==void 0&&i!=null&&l(t,["chunkingConfig"],i),r}p(jh,"importFileConfigToMldev");function ef(e){let t={},r=s(e,["name"]);r!=null&&l(t,["name"],r);let n=s(e,["metadata"]);n!=null&&l(t,["metadata"],n);let i=s(e,["done"]);i!=null&&l(t,["done"],i);let o=s(e,["error"]);o!=null&&l(t,["error"],o);let a=s(e,["response"]);return a!=null&&l(t,["response"],rf(a)),t}p(ef,"importFileOperationFromMldev");function tf(e){let t={},r=s(e,["fileSearchStoreName"]);r!=null&&l(t,["_url","file_search_store_name"],r);let n=s(e,["fileName"]);n!=null&&l(t,["fileName"],n);let i=s(e,["config"]);return i!=null&&jh(i,t),t}p(tf,"importFileParametersToMldev");function rf(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["parent"]);n!=null&&l(t,["parent"],n);let i=s(e,["documentName"]);return i!=null&&l(t,["documentName"],i),t}p(rf,"importFileResponseFromMldev");function nf(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);return t!==void 0&&i!=null&&l(t,["_query","pageToken"],i),r}p(nf,"listFileSearchStoresConfigToMldev");function of(e){let t={},r=s(e,["config"]);return r!=null&&nf(r,t),t}p(of,"listFileSearchStoresParametersToMldev");function sf(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["fileSearchStores"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["fileSearchStores"],o)}return t}p(sf,"listFileSearchStoresResponseFromMldev");function Ko(e,t){let r={},n=s(e,["mimeType"]);t!==void 0&&n!=null&&l(t,["mimeType"],n);let i=s(e,["displayName"]);t!==void 0&&i!=null&&l(t,["displayName"],i);let o=s(e,["customMetadata"]);if(t!==void 0&&o!=null){let c=o;Array.isArray(c)&&(c=c.map(u=>u)),l(t,["customMetadata"],c)}let a=s(e,["chunkingConfig"]);return t!==void 0&&a!=null&&l(t,["chunkingConfig"],a),r}p(Ko,"uploadToFileSearchStoreConfigToMldev");function af(e){let t={},r=s(e,["fileSearchStoreName"]);r!=null&&l(t,["_url","file_search_store_name"],r);let n=s(e,["config"]);return n!=null&&Ko(n,t),t}p(af,"uploadToFileSearchStoreParametersToMldev");function lf(e){let t={},r=s(e,["sdkHttpResponse"]);return r!=null&&l(t,["sdkHttpResponse"],r),t}p(lf,"uploadToFileSearchStoreResumableResponseFromMldev");var uf="Content-Type",df="X-Server-Timeout",cf="User-Agent",Gr="x-goog-api-client",pf="2.21.0",hf=`google-genai-sdk/${pf}`,ff="v1beta1",mf="v1beta",gf=new Set(["us","eu"]);function _f(e){let t=globalThis[Symbol.for("undici.globalDispatcher.1")];if(t)for(let r of Object.getOwnPropertySymbols(t)){let n=r.description;if(n?.includes("headers timeout")||n?.includes("body timeout")){let i=t[r];typeof i=="number"&&(t[r]=Math.max(i,e))}}}p(_f,"raiseUndiciTimeouts");function yf(e,t){let r=p(()=>{},"noop");if(!(e&&e>0)&&!t)return{signal:void 0,dispose:r};let n=new AbortController,i;e&&e>0&&(i=setTimeout(()=>n.abort(),e),i&&typeof i.unref=="function"&&i.unref());let o=p(()=>n.abort(),"onCallerAbort");return t&&(t.aborted?n.abort():t.addEventListener("abort",o)),{signal:n.signal,dispose:p(()=>{i!==void 0&&clearTimeout(i),t?.removeEventListener("abort",o)},"dispose")}}p(yf,"createAttemptSignal");var Ef=5,vf=1,Tf=60,Af=2,Cf=1,Sf=[408,429,500,502,503,504],If=class{static{p(this,"ApiClient")}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 i={};if(this.clientOptions.vertexai){if(!this.clientOptions.location&&!this.clientOptions.apiKey&&!this.customBaseUrl&&(this.clientOptions.location="global"),!(this.clientOptions.project&&this.clientOptions.location||this.clientOptions.apiKey)&&!this.customBaseUrl)throw new Error("Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.");let o=e.project&&e.location||!!e.apiKey;this.customBaseUrl&&!o?(i.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey&&!this.clientOptions.project||this.clientOptions.location==="global"?i.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&gf.has(this.clientOptions.location)?i.baseUrl=`https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(i.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),i.apiVersion=(r=this.clientOptions.apiVersion)!==null&&r!==void 0?r:ff}else this.clientOptions.apiKey||console.warn("API key should be set when using the Gemini API."),i.apiVersion=(n=this.clientOptions.apiVersion)!==null&&n!==void 0?n:mf,i.baseUrl="https://generativelanguage.googleapis.com/";i.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=i,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(i,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 new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new 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;throw new Error("Headers are not set.")}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");let t=[e.baseUrl.endsWith("/")?e.baseUrl.slice(0,-1):e.baseUrl];return e.apiVersion&&e.apiVersion!==""&&t.push(e.apiVersion),t.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 new Error("HTTP options are not correctly set.")}constructUrl(e,t,r){let n=[this.getRequestUrlInternal(t)];return r&&n.push(this.getBaseResourcePath()),e!==""&&n.push(e),new URL(`${n.join("/")}`)}shouldPrependVertexProjectPath(e,t){return!(t.baseUrl&&t.baseUrlResourceScope===rr.COLLECTION||!this.clientOptions.vertexai||!this.clientOptions.project||!this.clientOptions.location||e.path.startsWith("projects/")||e.httpMethod==="GET"&&e.path.startsWith("publishers/google/models"))}async request(e){let t=this.clientOptions.httpOptions;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[o,a]of Object.entries(e.queryParams))n.searchParams.append(o,String(a));let i={};if(e.httpMethod==="GET"){if(e.body&&e.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else i.body=e.body;return i=await this.includeExtraHttpOptionsToRequestInit(i,t,n.toString()),this.unaryApiCall(n,i,e.httpMethod,t.retryOptions,t.timeout,e.abortSignal)}patchHttpOptions(e,t){let r=JSON.parse(JSON.stringify(e));for(let[n,i]of Object.entries(t))typeof i=="object"?r[n]=Object.assign(Object.assign({},r[n]),i):i!==void 0&&(r[n]=i);return r}async requestStream(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let r=this.shouldPrependVertexProjectPath(e,t),n=this.constructUrl(e.path,t,r);(!n.searchParams.has("alt")||n.searchParams.get("alt")!=="sse")&&n.searchParams.set("alt","sse");let i={};return i.body=e.body,i=await this.includeExtraHttpOptionsToRequestInit(i,t,n.toString()),this.streamApiCall(n,i,e.httpMethod,t.retryOptions,t.timeout,e.abortSignal)}async includeExtraHttpOptionsToRequestInit(e,t,r){return t?.timeout&&t.timeout>0&&_f(t.timeout),t&&t.extraBody!==null&&wf(e,t.extraBody),e.headers=await this.getHeadersInternal(t,r),e}async unaryApiCall(e,t,r,n,i,o){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:r}),n,i,o).then(async a=>(await Lr(a),new Rt(a))).catch(a=>{throw a instanceof Error?a:new Error(`exception ${a} sending request`,{cause:a})})}async streamApiCall(e,t,r,n,i,o){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:r}),n,i,o).then(async a=>(await Lr(a),this.processStreamResponse(a))).catch(a=>{throw a instanceof Error?a:new Error(`exception ${a} sending request`,{cause:a})})}processStreamResponse(e){return Mt(this,arguments,function*(){var t;let r=(t=e?.body)===null||t===void 0?void 0:t.getReader(),n=new TextDecoder("utf-8");if(!r)throw new Error("Response body is empty");try{let i="",o="data:",a=[`
|
|
37
|
+
|
|
38
|
+
`,"\r\r",`\r
|
|
39
|
+
\r
|
|
40
|
+
`];for(;;){let{done:c,value:u}=yield Ie(r.read());if(c){if(i.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}let d=n.decode(u,{stream:!0});try{let g=JSON.parse(d);if("error"in g){let _=JSON.parse(JSON.stringify(g.error)),f=_.status,y=_.code,E=`got status: ${f}. ${JSON.stringify(g)}`;if(y>=400&&y<600)throw new bo({message:E,status:y})}}catch(g){if(g.name==="ApiError")throw g}i+=d;let h=-1,m=0;for(;;){h=-1,m=0;for(let f of a){let y=i.indexOf(f);y!==-1&&(h===-1||y<h)&&(h=y,m=f.length)}if(h===-1)break;let g=i.substring(0,h);i=i.substring(h+m);let _=g.trim();if(_.startsWith(o)){let f=_.substring(o.length).trim();try{let y=new Response(f,{headers:e?.headers,status:e?.status,statusText:e?.statusText});yield yield Ie(new Rt(y))}catch(y){throw new Error(`exception parsing stream chunk ${f}. ${y}`)}}}}}finally{r.releaseLock()}})}async apiCall(e,t,r,n,i){var o,a,c,u,d,h;let m=(o=r?.httpStatusCodes)!==null&&o!==void 0?o:Sf,g=p(async()=>{let E=yf(n,i),C;try{C=await fetch(e,Object.assign(Object.assign({},t),{signal:E.signal}))}catch(S){throw E.dispose(),S}if(!r||C.ok||!m.includes(C.status))return C;try{await Lr(C)}finally{E.dispose()}return C},"runFetch");if(!r)return g();let _=Math.max(1,(a=r.attempts)!==null&&a!==void 0?a:Ef),f=Math.round(((c=r.initialDelay)!==null&&c!==void 0?c:vf)*1e3),y=Math.max(f,Math.round(((u=r.maxDelay)!==null&&u!==void 0?u:Tf)*1e3));return(0,Ul.default)(g,{retries:_-1,factor:(d=r.expBase)!==null&&d!==void 0?d:Af,minTimeout:f,maxTimeout:y,randomize:((h=r.jitter)!==null&&h!==void 0?h:Cf)>0,onFailedAttempt:p(E=>{var C;if(i?.aborted)throw(C=E.error)!==null&&C!==void 0?C:E},"onFailedAttempt")})}getDefaultHeaders(){let e={},t=hf+" "+this.clientOptions.userAgentExtra;return e[cf]=t,e[Gr]=t,e[uf]="application/json",e}async getHeadersInternal(e,t){let r=new Headers;if(e&&e.headers)for(let[n,i]of Object.entries(e.headers))r.append(n,i);return e?.timeout&&e.timeout>0&&r.append(df,String(Math.ceil(e.timeout/1e3))),await this.clientOptions.auth.addAuthHeaders(r,t),r}getFileName(e){var t;let r="";return typeof e=="string"&&(r=e.replace(/[/\\]+$/,""),r=(t=r.split(/[/\\]/).pop())!==null&&t!==void 0?t:""),r}async uploadFile(e,t){var r;let n={};t!=null&&(n.mimeType=t.mimeType,n.name=t.name,n.displayName=t.displayName),n.name&&!n.name.startsWith("files/")&&(n.name=`files/${n.name}`);let i=this.clientOptions.uploader,o=await i.stat(e);n.sizeBytes=String(o.size);let a=(r=t?.mimeType)!==null&&r!==void 0?r:o.type;if(a===void 0||a==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");n.mimeType=a;let c={file:n},u=this.getFileName(e),d=ee("upload/v1beta/files",c._url),h=await this.fetchUploadUrl(d,n.sizeBytes,n.mimeType,u,c,t?.httpOptions);return i.upload(e,h,this)}async uploadFileToFileSearchStore(e,t,r){var n;let i=this.clientOptions.uploader,o=await i.stat(t),a=String(o.size),c=(n=r?.mimeType)!==null&&n!==void 0?n:o.type;if(c===void 0||c==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");let u=`upload/v1beta/${e}:uploadToFileSearchStore`,d=this.getFileName(t),h={};r!=null&&Ko(r,h);let m=await this.fetchUploadUrl(u,a,c,d,h,r?.httpOptions);return i.uploadToFileSearchStore(t,m,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,t,r,n,i,o){var a;let c={};o?c=o:c={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 u=await this.request({path:e,body:JSON.stringify(i),httpMethod:"POST",httpOptions:c});if(!u||!u?.headers)throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");let d=(a=u?.headers)===null||a===void 0?void 0:a["x-goog-upload-url"];if(d===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return d}};async function Lr(e){var t;if(e===void 0)throw new Error("response is undefined");if(!e.ok){let r=e.status,n;!((t=e.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?n=await e.json():n={error:{message:await e.text(),code:e.status,status:e.statusText}};let i=JSON.stringify(n);throw r>=400&&r<600?new bo({message:i,status:r}):new Error(i)}}p(Lr,"throwErrorIfNotOK");function wf(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 o=JSON.parse(e.body);if(typeof o=="object"&&o!==null&&!Array.isArray(o))r=o;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{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function n(o,a){let c=Object.assign({},o);for(let u in a)if(Object.prototype.hasOwnProperty.call(a,u)){let d=a[u],h=c[u];d&&typeof d=="object"&&!Array.isArray(d)&&h&&typeof h=="object"&&!Array.isArray(h)?c[u]=n(h,d):(h&&d&&typeof h!=typeof d&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${u}". Original type: ${typeof h}, New type: ${typeof d}. Overwriting.`),c[u]=d)}return c}p(n,"deepMerge");let i=n(r,t);e.body=JSON.stringify(i)}p(wf,"includeExtraBodyToRequestInit");var Rf="mcp_used/unknown",Pf=!1;function Yo(e){for(let t of e)if(Nf(t)||typeof t=="object"&&"inputSchema"in t)return!0;return Pf}p(Yo,"hasMcpToolUsage");function zo(e){var t;let r=(t=e[Gr])!==null&&t!==void 0?t:"";e[Gr]=(r+` ${Rf}`).trimStart()}p(zo,"setMcpUsageHeader");function Nf(e){return e!==null&&typeof e=="object"&&e instanceof Df}p(Nf,"isMcpCallableTool");function kf(e){return Mt(this,arguments,function*(t,r=100){let n,i=0;for(;i<r;){let o=yield Ie(t.listTools({cursor:n}));for(let a of o.tools)yield yield Ie(a),i++;if(!o.nextCursor)break;n=o.nextCursor}})}p(kf,"listAllTools");var Df=class La{static{p(this,"_McpCallableTool")}constructor(t=[],r){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=t,this.config=r}static create(t,r){return new La(t,r)}async initialize(){var t,r,n,i;if(this.mcpTools.length>0)return;let o={},a=[];for(let h of this.mcpClients)try{for(var c=!0,u=(r=void 0,Jt(kf(h))),d;d=await u.next(),t=d.done,!t;c=!0){i=d.value,c=!1;let m=i;a.push(m);let g=m.name;if(o[g])throw new Error(`Duplicate function name ${g} found in MCP tools. Please ensure function names are unique.`);o[g]=h}}catch(m){r={error:m}}finally{try{!c&&!t&&(n=u.return)&&await n.call(u)}finally{if(r)throw r.error}}this.mcpTools=a,this.functionNameToMcpClient=o}async tool(){return await this.initialize(),Du(this.mcpTools,this.config)}async callTool(t){await this.initialize();let r=[];for(let n of t)if(n.name in this.functionNameToMcpClient){let i=this.functionNameToMcpClient[n.name],o;this.config.timeout&&(o={timeout:this.config.timeout});let a=await i.callTool({name:n.name,arguments:n.args},void 0,o);r.push({functionResponse:{name:n.name,response:a.isError?{error:a}:a}})}return r}};async function Mf(e,t,r){let n=new Iu,i;r.data instanceof Blob?i=JSON.parse(await r.data.text()):i=JSON.parse(r.data),Object.assign(n,i),t(n)}p(Mf,"handleWebSocketMessage$1");var xf=class{static{p(this,"LiveMusic")}constructor(e,t,r){this.apiClient=e,this.auth=t,this.webSocketFactory=r}async connect(e){var t,r;if(this.apiClient.isVertexAI())throw new 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(),i=this.apiClient.getApiVersion(),o=Gf(this.apiClient.getDefaultHeaders()),a=this.apiClient.getApiKey(),c=`${n}/ws/google.ai.generativelanguage.${i}.GenerativeService.BidiGenerateMusic?key=${a}`,u=p(()=>{},"onopenResolve"),d=new Promise(E=>{u=E}),h=e.callbacks,m=p(function(){u({})},"onopenAwaitedCallback"),g=this.apiClient,_={onopen:m,onmessage:p(E=>{Mf(g,h.onmessage,E)},"onmessage"),onerror:(t=h?.onerror)!==null&&t!==void 0?t:function(E){},onclose:(r=h?.onclose)!==null&&r!==void 0?r:function(E){}},f=this.webSocketFactory.create(c,Uf(o),_);f.connect(),await d;let y={setup:{model:ue(this.apiClient,e.model)}};return f.send(JSON.stringify(y)),new bf(f,this.apiClient)}},bf=class{static{p(this,"LiveMusicSession")}constructor(e,t){this.conn=e,this.apiClient=t}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");let t=qc(e);this.conn.send(JSON.stringify({clientContent:t}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});let t=Fc(e);this.conn.send(JSON.stringify(t))}sendPlaybackControl(e){let t={playbackControl:e};this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(wt.PLAY)}pause(){this.sendPlaybackControl(wt.PAUSE)}stop(){this.sendPlaybackControl(wt.STOP)}resetContext(){this.sendPlaybackControl(wt.RESET_CONTEXT)}close(){this.conn.close()}};function Uf(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}p(Uf,"headersToMap$1");function Gf(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}p(Gf,"mapToHeaders$1");var Lf="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function Of(e,t,r){let n=new Su,i;r.data instanceof Blob?i=await r.data.text():r.data instanceof ArrayBuffer?i=new TextDecoder().decode(r.data):i=r.data;let o=JSON.parse(i);if(e.isVertexAI()){let a=Vc(o);Object.assign(n,a)}else Object.assign(n,o);t(n)}p(Of,"handleWebSocketMessage");var Ff=class{static{p(this,"Live")}constructor(e,t,r){this.apiClient=e,this.auth=t,this.webSocketFactory=r,this.music=new xf(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var t,r,n,i,o,a;if(e.config&&e.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");let c=this.apiClient.getWebsocketBaseUrl(),u=this.apiClient.getApiVersion(),d,h=this.apiClient.getHeaders();e.config&&e.config.tools&&Yo(e.config.tools)&&zo(h);let m=Vf(h);if(this.apiClient.isVertexAI()){let O=this.apiClient.getProject(),L=this.apiClient.getLocation(),B=this.apiClient.getApiKey(),X=!!O&&!!L||!!B;this.apiClient.getCustomBaseUrl()&&!X?d=c:(d=`${c}/ws/google.cloud.aiplatform.${u}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(m,d))}else{let O=this.apiClient.getApiKey(),L="BidiGenerateContent",B="key";O?.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),u!=="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."),L="BidiGenerateContentConstrained",B="access_token"),d=`${c}/ws/google.ai.generativelanguage.${u}.GenerativeService.${L}?${B}=${O}`}let g=p(()=>{},"onopenResolve"),_=new Promise(O=>{g=O}),f=e.callbacks,y=p(function(){var O;(O=f?.onopen)===null||O===void 0||O.call(f),g({})},"onopenAwaitedCallback"),E=this.apiClient,C=!1,S=[],A=p(()=>{},"setupCompleteResolve"),v=new Promise(O=>{A=O}),T={onopen:y,onmessage:p(O=>{Of(E,L=>{L.setupComplete&&!J.setupComplete&&(J.setupComplete=L.setupComplete,A({})),C?f.onmessage(L):S.push(L)},O)},"onmessage"),onerror:(t=f?.onerror)!==null&&t!==void 0?t:function(O){},onclose:(r=f?.onclose)!==null&&r!==void 0?r:function(O){}},I=this.webSocketFactory.create(d,Hf(m),T);I.connect(),await _;let w=ue(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&w.startsWith("publishers/")){let O=this.apiClient.getProject(),L=this.apiClient.getLocation();O&&L&&(w=`projects/${O}/locations/${L}/`+w)}let k={};this.apiClient.isVertexAI()&&((n=e.config)===null||n===void 0?void 0:n.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[tr.AUDIO]}:e.config.responseModalities=[tr.AUDIO]),!((i=e.config)===null||i===void 0)&&i.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 R=(a=(o=e.config)===null||o===void 0?void 0:o.tools)!==null&&a!==void 0?a:[],M=[];for(let O of R)if(this.isCallableTool(O)){let L=O;M.push(await L.tool())}else M.push(O);M.length>0&&(e.config.tools=M);let D={model:w,config:e.config,callbacks:e.callbacks};this.apiClient.isVertexAI()?k=Oc(this.apiClient,D):k=Lc(this.apiClient,D),delete k.config;let J=new Bf(I,this.apiClient);I.send(JSON.stringify(k)),await v,C=!0;for(let O of S)f.onmessage(O);return J}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}},qf={turnComplete:!0},Bf=class{static{p(this,"Session")}constructor(e,t){this.conn=e,this.apiClient=t}tLiveClientContent(e,t){if(t.turns!==null&&t.turns!==void 0){let r=[];try{r=Be(t.turns),e.isVertexAI()||(r=r.map(n=>Wt(n)))}catch{throw new 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 new Error("functionResponses is required.");if(Array.isArray(t.functionResponses)?r=t.functionResponses:r=[t.functionResponses],r.length===0)throw new Error("functionResponses is required.");for(let n of r){if(typeof n!="object"||n===null||!("name"in n)||!("response"in n))throw new Error(`Could not parse function response, type '${typeof n}'.`);if(!e.isVertexAI()&&!("id"in n))throw new Error(Lf)}return{toolResponse:{functionResponses:r}}}sendClientContent(e){e=Object.assign(Object.assign({},qf),e);let t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};this.apiClient.isVertexAI()?t={realtimeInput:Hc(e)}:t={realtimeInput:Bc(e)},this.conn.send(JSON.stringify(t))}sendToolResponse(e){if(e.functionResponses==null)throw new Error("Tool response parameters are required.");let t=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(t))}close(){this.conn.close()}};function Hf(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}p(Hf,"headersToMap");function Vf(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}p(Vf,"mapToHeaders");var Qo=10;function Zo(e){var t,r,n;if(!((t=e?.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let i=!1;for(let a of(r=e?.tools)!==null&&r!==void 0?r:[])if(bt(a)){i=!0;break}if(!i)return!0;let o=(n=e?.automaticFunctionCalling)===null||n===void 0?void 0:n.maximumRemoteCalls;return o&&(o<0||!Number.isInteger(o))||o==0?(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:",o),!0):!1}p(Zo,"shouldDisableAfc");function bt(e){return"callTool"in e&&typeof e.callTool=="function"}p(bt,"isCallableTool");function $f(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(i=>bt(i)))!==null&&n!==void 0?n:!1}p($f,"hasCallableTools");function jo(e){var t;let r=[];return!((t=e?.config)===null||t===void 0)&&t.tools&&e.config.tools.forEach((n,i)=>{if(bt(n))return;let o=n;o.functionDeclarations&&o.functionDeclarations.length>0&&r.push(i)}),r}p(jo,"findAfcIncompatibleToolIndexes");function es(e){var t;return!(!((t=e?.automaticFunctionCalling)===null||t===void 0)&&t.ignoreCallHistory)}p(es,"shouldAppendAfcHistory");var ur=class At extends rt{static{p(this,"_Models")}constructor(t){super(),this.apiClient=t,this.embedContent=async r=>{if(!this.apiClient.isVertexAI())return r.model.includes("gemini-embedding-2")&&(r.contents=Be(r.contents)),await this.embedContentInternal(r);if(r.model.includes("gemini")&&r.model!=="gemini-embedding-001"||r.model.includes("maas")){let n=Be(r.contents);if(n.length>1)throw new Error("The embedContent API for this model only supports one content at a time.");let i=Object.assign(Object.assign({},r),{content:n[0],embeddingApiType:nr.EMBED_CONTENT});return await this.embedContentInternal(i)}else{let n=Object.assign(Object.assign({},r),{embeddingApiType:nr.PREDICT});return await this.embedContentInternal(n)}},this.generateContent=async r=>{var n,i,o,a,c;let u=await this.processParamsMaybeAddMcpUsage(r);if(this.maybeMoveToResponseJsonSchema(r),!$f(r)||Zo(r.config))return await this.generateContentInternal(u);let d=jo(r);if(d.length>0){let y=d.map(E=>`tools[${E}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${y}.`)}let h,m,g=Be(u.contents),_=(o=(i=(n=u.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&o!==void 0?o:Qo,f=0;for(;f<_&&(h=await this.generateContentInternal(u),!(!h.functionCalls||h.functionCalls.length===0));){let y=h.candidates[0].content,E=[];for(let C of(c=(a=r.config)===null||a===void 0?void 0:a.tools)!==null&&c!==void 0?c:[])if(bt(C)){let S=await C.callTool(h.functionCalls);E.push(...S)}f++,m={role:"user",parts:E},u.contents=Be(u.contents),u.contents.push(y),u.contents.push(m),es(u.config)&&(g.push(y),g.push(m))}return es(u.config)&&(h.automaticFunctionCallingHistory=g),h},this.generateContentStream=async r=>{var n,i,o,a,c;if(this.maybeMoveToResponseJsonSchema(r),Zo(r.config)){let m=await this.processParamsMaybeAddMcpUsage(r);return await this.generateContentStreamInternal(m)}let u=jo(r);if(u.length>0){let m=u.map(g=>`tools[${g}]`).join(", ");throw new Error(`Incompatible tools found at ${m}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let d=(o=(i=(n=r?.config)===null||n===void 0?void 0:n.toolConfig)===null||i===void 0?void 0:i.functionCallingConfig)===null||o===void 0?void 0:o.streamFunctionCallArguments,h=(c=(a=r?.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||c===void 0?void 0:c.disable;if(d&&!h)throw new 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=>(At.loggedGenerateImagesWarning||(At.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")),await this.generateImagesInternal(r).then(n=>{var i;let o,a=[];if(n?.generatedImages)for(let u of n.generatedImages)u&&u?.safetyAttributes&&((i=u?.safetyAttributes)===null||i===void 0?void 0:i.contentType)==="Positive Prompt"?o=u?.safetyAttributes:a.push(u);let c;return o?c={generatedImages:a,positivePromptSafetyAttributes:o,sdkHttpResponse:n.sdkHttpResponse}:c={generatedImages:a,sdkHttpResponse:n.sdkHttpResponse},c})),this.list=async r=>{var n;let i={config:Object.assign(Object.assign({},{queryBase:!0}),r?.config)};if(this.apiClient.isVertexAI()&&!i.config.queryBase){if(!((n=i.config)===null||n===void 0)&&n.filter)throw new Error("Filtering tuned models list is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");i.config.filter="labels.tune-type:*"}return new Et(it.PAGED_ITEM_MODELS,o=>this.listInternal(o),await this.listInternal(i),i)},this.editImage=async r=>{At.loggedEditImageWarning||(At.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};return r.referenceImages&&r.referenceImages&&(n.referenceImages=r.referenceImages.map(i=>i.toReferenceImageAPI())),await this.editImageInternal(n)},this.upscaleImage=async r=>{let n={numberOfImages:1,mode:"upscale"};r.config&&(n=Object.assign(Object.assign({},n),r.config));let i={model:r.model,image:r.image,upscaleFactor:r.upscaleFactor,config:n};return await this.upscaleImageInternal(i)},this.generateVideos=async r=>{var n,i,o,a,c,u;if((r.prompt||r.image||r.video)&&r.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return(r.prompt||r.image||r.video)&&(At.loggedGenerateVideosWarning||(At.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."))),this.apiClient.isVertexAI()||(!((n=r.video)===null||n===void 0)&&n.uri&&!((i=r.video)===null||i===void 0)&&i.videoBytes?r.video={uri:r.video.uri,mimeType:r.video.mimeType}:!((a=(o=r.source)===null||o===void 0?void 0:o.video)===null||a===void 0)&&a.uri&&!((u=(c=r.source)===null||c===void 0?void 0:c.video)===null||u===void 0)&&u.videoBytes&&(r.source.video={uri:r.source.video.uri,mimeType:r.source.video.mimeType})),await this.generateVideosInternal(r)}}maybeMoveToResponseJsonSchema(t){t.config&&t.config.responseSchema&&(t.config.responseJsonSchema||Object.keys(t.config.responseSchema).includes("$schema")&&(t.config.responseJsonSchema=t.config.responseSchema,delete t.config.responseSchema))}async processParamsMaybeAddMcpUsage(t){var r,n,i;let o=(r=t.config)===null||r===void 0?void 0:r.tools;if(!o)return t;let a=await Promise.all(o.map(async u=>bt(u)?await u.tool():u)),c={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:a})};if(c.config.tools=a,t.config&&t.config.tools&&Yo(t.config.tools)){let u=(i=(n=t.config.httpOptions)===null||n===void 0?void 0:n.headers)!==null&&i!==void 0?i:{},d=Object.assign({},u);Object.keys(d).length===0&&(d=this.apiClient.getDefaultHeaders()),zo(d),c.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:d})}return c}async initAfcToolsMap(t){var r,n,i;let o=new Map;for(let a of(n=(r=t.config)===null||r===void 0?void 0:r.tools)!==null&&n!==void 0?n:[])if(bt(a)){let c=a,u=await c.tool();for(let d of(i=u.functionDeclarations)!==null&&i!==void 0?i:[]){if(!d.name)throw new Error("Function declaration name is required.");if(o.has(d.name))throw new Error(`Duplicate tool declaration name: ${d.name}`);o.set(d.name,c)}}return o}async processAfcStream(t){var r,n,i;let o=(i=(n=(r=t.config)===null||r===void 0?void 0:r.automaticFunctionCalling)===null||n===void 0?void 0:n.maximumRemoteCalls)!==null&&i!==void 0?i:Qo,a=!1,c=0,u=await this.initAfcToolsMap(t);return(function(d,h,m){return Mt(this,arguments,function*(){for(var g,_,f,y,E,C;c<o;){a&&(c++,a=!1);let T=yield Ie(d.processParamsMaybeAddMcpUsage(m)),I=yield Ie(d.generateContentStreamInternal(T)),w=[],k=[];try{for(var S=!0,A=(_=void 0,Jt(I)),v;v=yield Ie(A.next()),g=v.done,!g;S=!0){y=v.value,S=!1;let R=y;if(yield yield Ie(R),R.candidates&&!((E=R.candidates[0])===null||E===void 0)&&E.content){k.push(R.candidates[0].content);for(let M of(C=R.candidates[0].content.parts)!==null&&C!==void 0?C:[])if(c<o&&M.functionCall){if(!M.functionCall.name)throw new Error("Function call name was not returned by the model.");if(h.has(M.functionCall.name)){let D=yield Ie(h.get(M.functionCall.name).callTool([M.functionCall]));w.push(...D)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${h.keys()}, missing tool: ${M.functionCall.name}`)}}}}catch(R){_={error:R}}finally{try{!S&&!g&&(f=A.return)&&(yield Ie(f.call(A)))}finally{if(_)throw _.error}}if(w.length>0){a=!0;let R=new $t;R.candidates=[{content:{role:"user",parts:w}}],yield yield Ie(R);let M=[];M.push(...k),M.push({role:"user",parts:w});let D=Be(m.contents).concat(M);m.contents=D}else break}})})(this,u,t)}async generateContentInternal(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=Oo(this.apiClient,t);return c=ee("{model}:generateContent",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=qo(h),g=new $t;return Object.assign(g,m),g})}else{let d=Lo(this.apiClient,t);return c=ee("{model}:generateContent",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=Fo(h),g=new $t;return Object.assign(g,m),g})}}async generateContentStreamInternal(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=Oo(this.apiClient,t);return c=ee("{model}:streamGenerateContent?alt=sse",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.requestStream({path:c,queryParams:u,body:JSON.stringify(d),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}),a.then(function(h){return Mt(this,arguments,function*(){var m,g,_,f;try{for(var y=!0,E=Jt(h),C;C=yield Ie(E.next()),m=C.done,!m;y=!0){f=C.value,y=!1;let S=f,A=qo(yield Ie(S.json()),t);A.sdkHttpResponse={headers:S.headers};let v=new $t;Object.assign(v,A),yield yield Ie(v)}}catch(S){g={error:S}}finally{try{!y&&!m&&(_=E.return)&&(yield Ie(_.call(E)))}finally{if(g)throw g.error}}})})}else{let d=Lo(this.apiClient,t);return c=ee("{model}:streamGenerateContent?alt=sse",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.requestStream({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}),a.then(function(h){return Mt(this,arguments,function*(){var m,g,_,f;try{for(var y=!0,E=Jt(h),C;C=yield Ie(E.next()),m=C.done,!m;y=!0){f=C.value,y=!1;let S=f,A=Fo(yield Ie(S.json()),t);A.sdkHttpResponse={headers:S.headers};let v=new $t;Object.assign(v,A),yield yield Ie(v)}}catch(S){g={error:S}}finally{try{!y&&!m&&(_=E.return)&&(yield Ie(_.call(E)))}finally{if(g)throw g.error}}})})}}async embedContentInternal(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=Pp(this.apiClient,t,t),h=xu(t.model)?"{model}:embedContent":"{model}:predict";return c=ee(h,d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(m=>m.json().then(g=>{let _=g;return _.sdkHttpResponse={headers:m.headers},_})),a.then(m=>{let g=kp(m,t),_=new eo;return Object.assign(_,g),_})}else{let d=Rp(this.apiClient,t);return c=ee("{model}:batchEmbedContents",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=Np(h),g=new eo;return Object.assign(g,m),g})}}async generateImagesInternal(t){var r,n;let i,o="",a={};if(this.apiClient.isVertexAI()){let c=Op(this.apiClient,t);return o=ee("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:o,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(d=>{let h=d;return h.sdkHttpResponse={headers:u.headers},h})),i.then(u=>{let d=Fp(u),h=new lu;return Object.assign(h,d),h})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async editImageInternal(t){var r,n;let i,o="",a={};if(this.apiClient.isVertexAI()){let c=Cp(this.apiClient,t);return o=ee("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:o,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(d=>{let h=d;return h.sdkHttpResponse={headers:u.headers},h})),i.then(u=>{let d=Sp(u),h=new uu;return Object.assign(h,d),h})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async upscaleImageInternal(t){var r,n;let i,o="",a={};if(this.apiClient.isVertexAI()){let c=Bh(this.apiClient,t);return o=ee("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:o,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(d=>{let h=d;return h.sdkHttpResponse={headers:u.headers},h})),i.then(u=>{let d=Hh(u),h=new du;return Object.assign(h,d),h})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async recontextImage(t){var r,n;let i,o="",a={};if(this.apiClient.isVertexAI()){let c=Eh(this.apiClient,t);return o=ee("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:o,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()),i.then(u=>{let d=vh(u),h=new cu;return Object.assign(h,d),h})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async segmentImage(t){var r,n;let i,o="",a={};if(this.apiClient.isVertexAI()){let c=Rh(this.apiClient,t);return o=ee("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:o,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()),i.then(u=>{let d=Ph(u),h=new pu;return Object.assign(h,d),h})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async get(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=th(this.apiClient,t);return c=ee("{name}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json()),a.then(h=>Ur(h))}else{let d=eh(this.apiClient,t);return c=ee("{name}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json()),a.then(h=>br(h))}}async listInternal(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=uh(this.apiClient,t);return c=ee("{models_url}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=ch(h),g=new to;return Object.assign(g,m),g})}else{let d=lh(this.apiClient,t);return c=ee("{models_url}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=dh(h),g=new to;return Object.assign(g,m),g})}}async update(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=Fh(this.apiClient,t);return c=ee("{model}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json()),a.then(h=>Ur(h))}else{let d=Oh(this.apiClient,t);return c=ee("{name}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"PATCH",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json()),a.then(h=>br(h))}}async delete(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=Ep(this.apiClient,t);return c=ee("{name}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=Tp(h),g=new ro;return Object.assign(g,m),g})}else{let d=yp(this.apiClient,t);return c=ee("{name}",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=vp(h),g=new ro;return Object.assign(g,m),g})}}async countTokens(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=mp(this.apiClient,t);return c=ee("{model}:countTokens",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=_p(h),g=new no;return Object.assign(g,m),g})}else{let d=fp(this.apiClient,t);return c=ee("{model}:countTokens",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json().then(m=>{let g=m;return g.sdkHttpResponse={headers:h.headers},g})),a.then(h=>{let m=gp(h),g=new no;return Object.assign(g,m),g})}}async computeTokens(t){var r,n;let i,o="",a={};if(this.apiClient.isVertexAI()){let c=sp(this.apiClient,t);return o=ee("{model}:computeTokens",c._url),a=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:o,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(d=>{let h=d;return h.sdkHttpResponse={headers:u.headers},h})),i.then(u=>{let d=ap(u),h=new hu;return Object.assign(h,d),h})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async generateVideosInternal(t){var r,n,i,o;let a,c="",u={};if(this.apiClient.isVertexAI()){let d=Jp(this.apiClient,t);return c=ee("{model}:predictLongRunning",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),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(h=>h.json()),a.then(h=>{let m=Vp(h),g=new io;return Object.assign(g,m),g})}else{let d=$p(this.apiClient,t);return c=ee("{model}:predictLongRunning",d._url),u=d._query,delete d._url,delete d._query,a=this.apiClient.request({path:c,queryParams:u,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(i=t.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(o=t.config)===null||o===void 0?void 0:o.abortSignal}).then(h=>h.json()),a.then(h=>{let m=Hp(h),g=new io;return Object.assign(g,m),g})}}};ur.loggedGenerateImagesWarning=!1,ur.loggedEditImageWarning=!1,ur.loggedGenerateVideosWarning=!1;var Jf=class extends rt{static{p(this,"Operations")}constructor(e){super(),this.apiClient=e}async getVideosOperation(e){let t=e.operation,r=e.config;if(t.name===void 0||t.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let n=t.name.split("/operations/")[0],i;r&&"httpOptions"in r&&(i=r.httpOptions);let o=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:n,config:{httpOptions:i}});return t._fromAPIResponse({apiResponse:o,_isVertexAI:!0})}else{let n=await this.getVideosOperationInternal({operationName:t.name,config:r});return t._fromAPIResponse({apiResponse:n,_isVertexAI:!1})}}async get(e){let t=e.operation,r=e.config;if(t.name===void 0||t.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let n=t.name.split("/operations/")[0],i;r&&"httpOptions"in r&&(i=r.httpOptions);let o=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:n,config:{httpOptions:i}});return t._fromAPIResponse({apiResponse:o,_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,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=ru(e);return a=ee("{operationName}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json()),o}else{let u=tu(e);return a=ee("{operationName}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o}}async fetchPredictVideosOperationInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI()){let a=Kl(e);return i=ee("{resourceName}:fetchPredictOperation",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}};function Wf(e){let t={},r=s(e,["apiKey"]);if(r!=null&&l(t,["apiKey"],r),s(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Wf,"authConfigToMldev");function Xf(e){let t={},r=s(e,["data"]);if(r!=null&&l(t,["data"],r),s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(Xf,"blobToMldev");function Kf(e){let t={},r=s(e,["parts"]);if(r!=null){let i=r;Array.isArray(i)&&(i=i.map(o=>nm(o))),l(t,["parts"],i)}let n=s(e,["role"]);return n!=null&&l(t,["role"],n),t}p(Kf,"contentToMldev");function Yf(e,t,r){let n={},i=s(t,["expireTime"]);r!==void 0&&i!=null&&l(r,["expireTime"],i);let o=s(t,["newSessionExpireTime"]);r!==void 0&&o!=null&&l(r,["newSessionExpireTime"],o);let a=s(t,["uses"]);r!==void 0&&a!=null&&l(r,["uses"],a);let c=s(t,["liveConnectConstraints"]);r!==void 0&&c!=null&&l(r,["bidiGenerateContentSetup"],rm(e,c));let u=s(t,["lockAdditionalFields"]);return r!==void 0&&u!=null&&l(r,["fieldMask"],u),n}p(Yf,"createAuthTokenConfigToMldev");function zf(e,t){let r={},n=s(t,["config"]);return n!=null&&l(r,["config"],Yf(e,n,r)),r}p(zf,"createAuthTokenParametersToMldev");function Qf(e){let t={};if(s(e,["displayName"])!==void 0)throw new Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["fileUri"]);r!=null&&l(t,["fileUri"],r);let n=s(e,["mimeType"]);return n!=null&&l(t,["mimeType"],n),t}p(Qf,"fileDataToMldev");function Zf(e){let t={},r=s(e,["args"]);r!=null&&l(t,["args"],r);let n=s(e,["id"]);n!=null&&l(t,["id"],n);let i=s(e,["name"]);if(i!=null&&l(t,["name"],i),s(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(Zf,"functionCallToMldev");function jf(e){let t={},r=s(e,["authConfig"]);r!=null&&l(t,["authConfig"],Wf(r));let n=s(e,["enableWidget"]);if(n!=null&&l(t,["enableWidget"],n),s(e,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(jf,"googleMapsToMldev");function em(e){let t={};if(s(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["searchTypes"]);r!=null&&l(t,["searchTypes"],r);let n=s(e,["timeRangeFilter"]);return n!=null&&l(t,["timeRangeFilter"],n),t}p(em,"googleSearchToMldev");function tm(e,t){let r={},n=s(e,["generationConfig"]);t!==void 0&&n!=null&&l(t,["setup","generationConfig"],n);let i=s(e,["responseModalities"]);t!==void 0&&i!=null&&l(t,["setup","generationConfig","responseModalities"],i);let o=s(e,["temperature"]);t!==void 0&&o!=null&&l(t,["setup","generationConfig","temperature"],o);let a=s(e,["topP"]);t!==void 0&&a!=null&&l(t,["setup","generationConfig","topP"],a);let c=s(e,["topK"]);t!==void 0&&c!=null&&l(t,["setup","generationConfig","topK"],c);let u=s(e,["maxOutputTokens"]);t!==void 0&&u!=null&&l(t,["setup","generationConfig","maxOutputTokens"],u);let d=s(e,["mediaResolution"]);t!==void 0&&d!=null&&l(t,["setup","generationConfig","mediaResolution"],d);let h=s(e,["seed"]);t!==void 0&&h!=null&&l(t,["setup","generationConfig","seed"],h);let m=s(e,["speechConfig"]);t!==void 0&&m!=null&&l(t,["setup","generationConfig","speechConfig"],Dr(m));let g=s(e,["thinkingConfig"]);t!==void 0&&g!=null&&l(t,["setup","generationConfig","thinkingConfig"],g);let _=s(e,["enableAffectiveDialog"]);t!==void 0&&_!=null&&l(t,["setup","generationConfig","enableAffectiveDialog"],_);let f=s(e,["systemInstruction"]);t!==void 0&&f!=null&&l(t,["setup","systemInstruction"],Kf(Ge(f)));let y=s(e,["tools"]);if(t!==void 0&&y!=null){let R=kt(y);Array.isArray(R)&&(R=R.map(M=>sm(Nt(M)))),l(t,["setup","tools"],R)}let E=s(e,["sessionResumption"]);t!==void 0&&E!=null&&l(t,["setup","sessionResumption"],om(E));let C=s(e,["inputAudioTranscription"]);t!==void 0&&C!=null&&l(t,["setup","inputAudioTranscription"],C);let S=s(e,["outputAudioTranscription"]);t!==void 0&&S!=null&&l(t,["setup","outputAudioTranscription"],S);let A=s(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&l(t,["setup","realtimeInputConfig"],A);let v=s(e,["contextWindowCompression"]);t!==void 0&&v!=null&&l(t,["setup","contextWindowCompression"],v);let T=s(e,["proactivity"]);if(t!==void 0&&T!=null&&l(t,["setup","proactivity"],T),s(e,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let I=s(e,["avatarConfig"]);t!==void 0&&I!=null&&l(t,["setup","avatarConfig"],I);let w=s(e,["safetySettings"]);if(t!==void 0&&w!=null){let R=w;Array.isArray(R)&&(R=R.map(M=>im(M))),l(t,["setup","safetySettings"],R)}let k=s(e,["translationConfig"]);return t!==void 0&&k!=null&&l(t,["setup","generationConfig","translationConfig"],k),r}p(tm,"liveConnectConfigToMldev");function rm(e,t){let r={},n=s(t,["model"]);n!=null&&l(r,["setup","model"],ue(e,n));let i=s(t,["config"]);return i!=null&&l(r,["config"],tm(i,r)),r}p(rm,"liveConnectConstraintsToMldev");function nm(e){let t={},r=s(e,["mediaResolution"]);r!=null&&l(t,["mediaResolution"],r);let n=s(e,["toolCall"]);n!=null&&l(t,["toolCall"],n);let i=s(e,["toolResponse"]);i!=null&&l(t,["toolResponse"],i);let o=s(e,["audioTranscription"]);o!=null&&l(t,["audioTranscription"],o);let a=s(e,["codeExecutionResult"]);a!=null&&l(t,["codeExecutionResult"],a);let c=s(e,["executableCode"]);c!=null&&l(t,["executableCode"],c);let u=s(e,["fileData"]);u!=null&&l(t,["fileData"],Qf(u));let d=s(e,["functionCall"]);d!=null&&l(t,["functionCall"],Zf(d));let h=s(e,["functionResponse"]);h!=null&&l(t,["functionResponse"],h);let m=s(e,["inlineData"]);m!=null&&l(t,["inlineData"],Xf(m));let g=s(e,["text"]);g!=null&&l(t,["text"],g);let _=s(e,["thought"]);_!=null&&l(t,["thought"],_);let f=s(e,["thoughtSignature"]);f!=null&&l(t,["thoughtSignature"],f);let y=s(e,["videoMetadata"]);y!=null&&l(t,["videoMetadata"],y);let E=s(e,["partMetadata"]);E!=null&&l(t,["partMetadata"],E);let C=s(e,["mediaProcessing"]);return C!=null&&l(t,["mediaProcessing"],C),t}p(nm,"partToMldev");function im(e){let t={},r=s(e,["category"]);if(r!=null&&l(t,["category"],r),s(e,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["threshold"]);return n!=null&&l(t,["threshold"],n),t}p(im,"safetySettingToMldev");function om(e){let t={},r=s(e,["handle"]);if(r!=null&&l(t,["handle"],r),s(e,["transparent"])!==void 0)throw new Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}p(om,"sessionResumptionConfigToMldev");function sm(e){let t={};if(s(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=s(e,["googleMaps"]);r!=null&&l(t,["googleMaps"],jf(r));let n=s(e,["mcpServers"]);if(n!=null){let m=n;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["mcpServers"],m)}let i=s(e,["codeExecution"]);i!=null&&l(t,["codeExecution"],i);let o=s(e,["computerUse"]);if(o!=null&&l(t,["computerUse"],o),s(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let a=s(e,["functionDeclarations"]);if(a!=null){let m=a;Array.isArray(m)&&(m=m.map(g=>g)),l(t,["functionDeclarations"],m)}let c=s(e,["googleSearch"]);c!=null&&l(t,["googleSearch"],em(c));let u=s(e,["googleSearchRetrieval"]);if(u!=null&&l(t,["googleSearchRetrieval"],u),s(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=s(e,["urlContext"]);d!=null&&l(t,["urlContext"],d);let h=s(e,["fileSearch"]);return h!=null&&l(t,["fileSearch"],h),t}p(sm,"toolToMldev");function am(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 i=Object.keys(n).map(o=>`${r}.${o}`);t.push(...i)}else t.push(r)}return t.join(",")}p(am,"getFieldMasks");function lm(e,t){let r=null,n=e.bidiGenerateContentSetup;if(typeof n=="object"&&n!==null&&"setup"in n){let o=n.setup;typeof o=="object"&&o!==null?(e.bidiGenerateContentSetup=o,r=o):delete e.bidiGenerateContentSetup}else n!==void 0&&delete e.bidiGenerateContentSetup;let i=e.fieldMask;if(r){let o=am(r);if(Array.isArray(t?.lockAdditionalFields)&&t?.lockAdditionalFields.length===0)o?e.fieldMask=o:delete e.fieldMask;else if(t?.lockAdditionalFields&&t.lockAdditionalFields.length>0&&i!==null&&Array.isArray(i)&&i.length>0){let a=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"],c=[];i.length>0&&(c=i.map(d=>a.includes(d)?`generationConfig.${d}`:d));let u=[];o&&u.push(o),c.length>0&&u.push(...c),u.length>0?e.fieldMask=u.join(","):delete e.fieldMask}else delete e.fieldMask}else i!==null&&Array.isArray(i)&&i.length>0?e.fieldMask=i.join(","):delete e.fieldMask;return e}p(lm,"convertBidiSetupToTokenSetup");var um=class extends rt{static{p(this,"Tokens")}constructor(e){super(),this.apiClient=e}async create(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{let a=zf(this.apiClient,e);i=ee("auth_tokens",a._url),o=a._query,delete a.config,delete a._url,delete a._query;let c=lm(a,e.config);return n=this.apiClient.request({path:i,queryParams:o,body:JSON.stringify(c),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(u=>u.json()),n.then(u=>u)}}};function dm(e,t){let r={},n=s(e,["force"]);return t!==void 0&&n!=null&&l(t,["_query","force"],n),r}p(dm,"deleteDocumentConfigToMldev");function cm(e){let t={},r=s(e,["name"]);r!=null&&l(t,["_url","name"],r);let n=s(e,["config"]);return n!=null&&dm(n,t),t}p(cm,"deleteDocumentParametersToMldev");function pm(e){let t={},r=s(e,["name"]);return r!=null&&l(t,["_url","name"],r),t}p(pm,"getDocumentParametersToMldev");function hm(e,t){let r={},n=s(e,["pageSize"]);t!==void 0&&n!=null&&l(t,["_query","pageSize"],n);let i=s(e,["pageToken"]);return t!==void 0&&i!=null&&l(t,["_query","pageToken"],i),r}p(hm,"listDocumentsConfigToMldev");function fm(e){let t={},r=s(e,["parent"]);r!=null&&l(t,["_url","parent"],r);let n=s(e,["config"]);return n!=null&&hm(n,t),t}p(fm,"listDocumentsParametersToMldev");function mm(e){let t={},r=s(e,["sdkHttpResponse"]);r!=null&&l(t,["sdkHttpResponse"],r);let n=s(e,["nextPageToken"]);n!=null&&l(t,["nextPageToken"],n);let i=s(e,["documents"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(a=>a)),l(t,["documents"],o)}return t}p(mm,"listDocumentsResponseFromMldev");var gm=class extends rt{static{p(this,"Documents")}constructor(e){super(),this.apiClient=e,this.list=async t=>new Et(it.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,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=pm(e);return i=ee("{name}",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>c)}}async delete(e){var t,r;let n="",i={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let o=cm(e);n=ee("{name}",o._url),i=o._query,delete o._url,delete o._query,await this.apiClient.request({path:n,queryParams:i,body:JSON.stringify(o),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,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=fm(e);return i=ee("{parent}/documents",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>{let u=mm(c),d=new gu;return Object.assign(d,u),d})}}},_m=class extends rt{static{p(this,"FileSearchStores")}constructor(e,t=new gm(e)){super(),this.apiClient=e,this.documents=t,this.list=async(r={})=>new Et(it.PAGED_ITEM_FILE_SEARCH_STORES,n=>this.listInternal(n),await this.listInternal(r),r)}async uploadToFileSearchStore(e){if(this.apiClient.isVertexAI())throw new 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 new 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)),!n.includes("/media/"))throw new Error(`Invalid uri format: ${e}. Expected to contain /media/`);let i={};r.searchParams.forEach((c,u)=>{i[u]=c}),i.alt="media";let o=Object.assign({},t?.httpOptions),a=await this.apiClient.request({path:n,httpMethod:"GET",queryParams:i,httpOptions:o});if(a instanceof Rt){let c=await a.responseInternal.arrayBuffer();return new Uint8Array(c)}else throw new Error("Unexpected response type from downloadMedia")}async create(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=Yh(this.apiClient,e);return i=ee("fileSearchStores",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>c)}}async get(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=Zh(e);return i=ee("{name}",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>c)}}async delete(e){var t,r;let n="",i={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let o=Qh(e);n=ee("{name}",o._url),i=o._query,delete o._url,delete o._query,await this.apiClient.request({path:n,queryParams:i,body:JSON.stringify(o),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,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=of(e);return i=ee("fileSearchStores",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>{let u=sf(c),d=new _u;return Object.assign(d,u),d})}}async uploadToFileSearchStoreInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=af(e);return i=ee("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>{let u=lf(c),d=new yu;return Object.assign(d,u),d})}}async importFile(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=tf(e);return i=ee("{file_search_store_name}:importFile",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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()),n.then(c=>{let u=ef(c),d=new Eu;return Object.assign(d,u),d})}}};function ym(){return"Deno"in globalThis}p(ym,"isDeno");var dr;function Xt(){var e,t,r,n,i,o;if(dr)return dr;let a=globalThis,c={};return ym()?c=(n=(r=(t=(e=a.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:{}:c=(o=(i=a.process)===null||i===void 0?void 0:i.env)!==null&&o!==void 0?o:{},dr=c,dr}p(Xt,"env");function Em(e){var t,r;let n=Object.assign({},e),i=Xt();return typeof i.GOOGLE_GENAI_API_VERSION<"u"&&((t=n.api_version)!==null&&t!==void 0||(n.api_version=i.GOOGLE_GENAI_API_VERSION)),typeof i.GOOGLE_GENAI_USER_PROJECT<"u"&&((r=n.user_project)!==null&&r!==void 0||(n.user_project=i.GOOGLE_GENAI_USER_PROJECT)),n}p(Em,"fillGlobals");var vm=class{static{p(this,"GoogleGenAISecurityProvider")}constructor(e){this.options=e}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(e){return Im(await this.options.getAuthHeaders(e))}},Tm=class{static{p(this,"GoogleGenAIAuthHook")}beforeCreateRequest(e,t){return Object.assign(Object.assign({},t),{url:Am(t.url)})}async beforeRequest(e,t){if(rs(t.headers,Sm(e.security_source)),wm(e,t.headers),Pm(t.headers))return t;let r=await Cm(e.security_source,t.url);return rs(t.headers,r?.default_headers),Rm(t.headers,r),t}};function Am(e){let[,t,...r]=e.pathname.split("/");if(!t)return e;let n=decodeURIComponent(t);if(!n.includes("/"))return e;let i=new URL(e);return i.pathname=`/${n}/${r.join("/")}`,i}p(Am,"decodeSDKLevelAPIVersionPath");async function Cm(e,t){if(is(e))return e.resolveGoogleGenAISecurity(t);let r=typeof e=="function"?await e():e;return ns(r)?ts(r):ts(void 0)}p(Cm,"resolveSecurity$1");function Sm(e){var t,r;if(is(e))return(r=(t=e.getDefaultHeaders)===null||t===void 0?void 0:t.call(e))!==null&&r!==void 0?r:e.defaultHeaders;if(ns(e))return e.default_headers}p(Sm,"getStaticDefaultHeaders");function ts(e){var t,r;let n=Xt(),i=Object.assign(Object.assign({},e),{api_key:(t=e?.api_key)!==null&&t!==void 0?t:n.GOOGLE_GENAI_API_KEY,access_token:(r=e?.access_token)!==null&&r!==void 0?r:n.GOOGLE_GENAI_ACCESS_TOKEN});return os(i)?i:void 0}p(ts,"withEnvSecurity");function Im(e){var t,r;let n={};for(let[o,a]of e){let c=o.toLowerCase();c!=="authorization"&&c!=="x-goog-api-key"&&(n[o]=a)}let i={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 os(i)?i:void 0}p(Im,"securityFromHeaders");function rs(e,t){if(t)for(let[r,n]of new Headers(t))e.get(r)===null&&e.set(r,n)}p(rs,"applyDefaultHeaders");function wm(e,t){e.options.user_project!==void 0&&t.get("x-goog-user-project")===null&&t.set("x-goog-user-project",e.options.user_project)}p(wm,"applyUserProject");function Rm(e,t){if(t){if(t.api_key){e.set("x-goog-api-key",t.api_key);return}t.access_token&&e.set("Authorization",Nm(t.access_token))}}p(Rm,"applyAuth");function Pm(e){return e.get("authorization")!==null||e.get("x-goog-api-key")!==null}p(Pm,"hasAuthHeaders");function Nm(e){return e.slice(0,7).toLowerCase()==="bearer "?e:`Bearer ${e}`}p(Nm,"bearer");function ns(e){return typeof e=="object"&&e!==null}p(ns,"isSecurity");function is(e){return typeof e=="object"&&e!==null&&"resolveGoogleGenAISecurity"in e&&typeof e.resolveGoogleGenAISecurity=="function"}p(is,"isSecurityResolver");function os(e){return e.api_key!==void 0||e.access_token!==void 0||e.default_headers!==void 0}p(os,"hasSecurityValue");var Ut=class extends Error{static{p(this,"HTTPClientError")}constructor(e,t){let r=e;t?.cause&&(r+=`: ${t.cause}`),super(r,t),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=t?.cause)}},ss=class extends Ut{static{p(this,"UnexpectedClientError")}constructor(){super(...arguments),this.name="UnexpectedClientError"}},cr=class extends Ut{static{p(this,"InvalidRequestError")}constructor(){super(...arguments),this.name="InvalidRequestError"}},as=class extends Ut{static{p(this,"RequestAbortedError")}constructor(){super(...arguments),this.name="RequestAbortedError"}},ls=class extends Ut{static{p(this,"RequestTimeoutError")}constructor(){super(...arguments),this.name="RequestTimeoutError"}},us=class extends Ut{static{p(this,"ConnectionError")}constructor(){super(...arguments),this.name="ConnectionError"}},Ze=class extends Error{static{p(this,"GoogleGenAiError")}constructor(e,t){var r,n,i,o;super(e),this.statusCode=(r=t?.response)===null||r===void 0?void 0:r.status,this.body=(n=t?.body)!==null&&n!==void 0?n:"",this.headers=(i=t?.response)===null||i===void 0?void 0:i.headers,this.contentType=((o=t?.response)===null||o===void 0?void 0:o.headers.get("content-type"))||"",this.rawResponse=t?.response,this.name="GoogleGenAiError"}},km=class extends Error{static{p(this,"GeminiNextGenAPIClientError")}},Ve=class Qr extends km{static{p(this,"_APIError")}constructor(t,r,n,i){super(Qr.makeMessage(t,r,n)),this.status=t,this.headers=i,this.error=r,this.statusCode=t,this.body=cs(r),this.contentType=i?.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 i;let o=r&&$m(r)&&typeof r.message=="string"?r.message:void 0,a=cs(r),c=(i=o??n)!==null&&i!==void 0?i:a||"An error occurred";return`${t?`${t} `:""}${c}`}static generate(t,r,n,i){return!t||!i?new pr({message:n,cause:r instanceof Error?r:void 0}):t===400?new xm(t,r,n,i):t===401?new bm(t,r,n,i):t===403?new Um(t,r,n,i):t===404?new Gm(t,r,n,i):t===409?new Lm(t,r,n,i):t===422?new Om(t,r,n,i):t===429?new Fm(t,r,n,i):t>=500?new qm(t,r,n,i):new Qr(t,r,n,i)}},Dm=class extends Ve{static{p(this,"APIUserAbortError")}constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},pr=class extends Ve{static{p(this,"APIConnectionError")}constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),this.cause=t}},Mm=class extends pr{static{p(this,"APIConnectionTimeoutError")}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."})}},xm=class extends Ve{static{p(this,"BadRequestError")}},bm=class extends Ve{static{p(this,"AuthenticationError")}},Um=class extends Ve{static{p(this,"PermissionDeniedError")}},Gm=class extends Ve{static{p(this,"NotFoundError")}},Lm=class extends Ve{static{p(this,"ConflictError")}},Om=class extends Ve{static{p(this,"UnprocessableEntityError")}},Fm=class extends Ve{static{p(this,"RateLimitError")}},qm=class extends Ve{static{p(this,"InternalServerError")}};function Gt(e){return Jm(e)?e:e instanceof Ze?Bm(e):e instanceof Ut?Hm(e):e}p(Gt,"wrapSDKError");function Bm(e){let t=Vm(e),r=Ve.generate(e.statusCode,t,e.message,e.headers);return Kt(r,"body",e.body),Kt(r,"contentType",e.contentType),Kt(r,"rawResponse",e.rawResponse),Kt(r,"statusCode",e.statusCode),Kt(r,"cause",e),r}p(Bm,"wrapAPIError");function Hm(e){return e instanceof ls?new Mm({message:e.message}):e instanceof as?new Dm({message:e.message}):e instanceof us?new pr({message:e.message,cause:e}):new pr({message:e.message,cause:e})}p(Hm,"wrapHTTPClientError");function Vm(e){let t=ds(e,"data$");if(t&&typeof t=="object")return t;try{let n=JSON.parse(e.body);if(n&&typeof n=="object")return n}catch{}let r=ds(e,"error");return r&&typeof r=="object"?r:void 0}p(Vm,"getErrorPayload");function ds(e,t){return e&&typeof e=="object"?e[t]:void 0}p(ds,"getObjectProperty");function cs(e){if(!e)return"";try{return JSON.stringify(e)}catch{return String(e)}}p(cs,"stringifyErrorBody");function $m(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}p($m,"isPlainObject$2");function Jm(e){return typeof e=="object"&&e!==null?Ve.prototype.isPrototypeOf(e):!1}p(Jm,"isCompatAPIErrorInstance");function Kt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!1})}p(Kt,"defineReadonly");function Wm(e){let t=new Tm;e.registerBeforeCreateRequestHook(t),e.registerBeforeRequestHook(t)}p(Wm,"initHooks");var ps=class{static{p(this,"SDKHooks")}constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let e=[];for(let t of e)"sdkInit"in t&&this.registerSDKInitHook(t),"beforeCreateRequest"in t&&this.registerBeforeCreateRequestHook(t),"beforeRequest"in t&&this.registerBeforeRequestHook(t),"afterSuccess"in t&&this.registerAfterSuccessHook(t),"afterError"in t&&this.registerAfterErrorHook(t);Wm(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,i=r;for(let o of this.afterErrorHooks){let a=await o.afterError(e,n,i);n=a.response,i=a.error}return{response:n,error:i}}};function hs(e){return{ok:!0,value:e}}p(hs,"OK");function ot(e){return{ok:!1,error:e}}p(ot,"ERR");function Or(e){return btoa(String.fromCodePoint(...e))}p(Or,"bytesToBase64");function Xm(e){return new TextEncoder().encode(e)}p(Xm,"stringToBytes");function Km(e){return Or(Xm(e))}p(Km,"stringToBase64");var Ym=Object.prototype.hasOwnProperty;function fe(e,t){let r=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(n={}){return e.replace(r,function(i,o){if(!Ym.call(n,o))throw new Error(`Parameter '${o}' is required`);let a=n[o];if(typeof a!="string"&&typeof a!="number")throw new Error(`Parameter '${o}' must be a string or number`);return`${a}`}).replace(/^\/+/,"")}}p(fe,"pathToFunc");var fs=["https://generativelanguage.googleapis.com"];function zm(e){var t;let r=e.server_url,n={};if(!r){let o=(t=e.server_idx)!==null&&t!==void 0?t:0;if(o<0||o>=fs.length)throw new Error(`Invalid server index ${o}`);r=fs[o]||""}let i=fe(r)(n);return new URL(i)}p(zm,"serverURLFromOptions");var Qm={userAgent:"speakeasy-sdk/typescript 2.4.1-preview.4 internal v1beta @google/genai"};function Zm(...e){let t=[];for(let r of e)r&&t.push(r);switch(t.length){case 0:case 1:return t[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.any=="function"?AbortSignal.any(t):jm(t)}}p(Zm,"combineSignals");function jm(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 a of e)if(a.aborted)return a;function n(){t.abort(this.reason),o()}p(n,"abort");let i=[];function o(){for(let a of i){let c=a.deref();c&&c.removeEventListener("abort",n)}}p(o,"clean");for(let a of e)i.push(new WeakRef(a)),a.addEventListener("abort",n);return r}p(jm,"abortSignalAny");function ge(e){let t={};for(let[r,n]of Object.entries(e))typeof n<"u"&&(t[r]=n);return t}p(ge,"compactMap");function ut(e){if(e===null||typeof e!="object"||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{return!1}}p(ut,"isPlainObject$1");function eg(e){return(t,r,n)=>{let i="",o=n?.explode?gs(t,r):[[t,r]];if(o.every(([d,h])=>h==null))return;let a=p(d=>n?.charEncoding==="percent"?encodeURIComponent(d):d,"encodeString"),c=p(d=>a(_s(d)),"encodeValue"),u=a(e);return o.forEach(([d,h])=>{var m,g;let _="",f=null;h!=null&&(Array.isArray(h)?f=(m=Es(h,y=>`${c(y)}`))===null||m===void 0?void 0:m.join(u):ut(h)?f=(g=vs(Object.entries(h),([y,E])=>`${a(y)}${u}${c(E)}`))===null||g===void 0?void 0:g.join(u):f=`${c(h)}`,f!=null&&(_=`${a(d)}=${f}`,!(!_||_==="=")&&(i+=`&${_}`)))}),i.slice(1)}}p(eg,"formEncoder");var ms=eg(",");function st(e,t,r){if(typeof t>"u")return;let n=p(o=>r?.charEncoding==="percent"?encodeURIComponent(o):o,"encodeString"),i=n(JSON.stringify(t,ys));return r?.explode?i:`${n(e)}=${i}`}p(st,"encodeJSON");var re=p((e,t,r)=>{let n="",i=r?.explode?gs(e,t):[[e,t]];if(i.every(([c,u])=>u==null))return;let o=p(c=>r?.charEncoding==="percent"?encodeURIComponent(c):c,"encodeString"),a=p(c=>o(_s(c)),"encodeValue");return i.forEach(([c,u])=>{var d;let h="";u!=null&&(Array.isArray(u)?h=(d=Es(u,m=>`${a(m)}`))===null||d===void 0?void 0:d.join(","):ut(u)?h=vs(Object.entries(u),([g,_])=>`,${o(g)},${a(_)}`)?.join("").slice(1):h=`${r?.explode&&ut(t)?`${c}=`:""}${a(u)}`,n+=h?`,${h}`:"")}),n.slice(1)},"encodeSimple");function gs(e,t){return Array.isArray(t)?t.map(r=>[e,r]):ut(t)?Object.entries(t??{}).map(([r,n])=>[r,n]):[[e,t]]}p(gs,"explode");function _s(e){return e==null?"":e instanceof Date?e.toISOString():e instanceof Uint8Array?Or(e):typeof e=="object"?JSON.stringify(e,ys):`${e}`}p(_s,"serializeValue");function ys(e,t){return t instanceof Uint8Array?Or(t):t}p(ys,"jsonReplacer");function Es(e,t){let r=e.reduce((n,i)=>{if(i==null)return n;let o=t(i);return o==null||n.push(o),n},[]);return r.length?r:null}p(Es,"mapDefined");function vs(e,t){let r=[];for(let[n,i]of e){if(i==null)continue;let o=t([n,i]);o!=null&&r.push(o)}return r.length?r:null}p(vs,"mapDefinedEntries");function tg(...e){return e.filter(Boolean).join("&")}p(tg,"queryJoin");function rg(e){return function(t,r){var n,i,o;let a=Object.assign(Object.assign({},r),{explode:(n=r?.explode)!==null&&n!==void 0?n:!0,charEncoding:(i=r?.charEncoding)!==null&&i!==void 0?i:"percent"}),c=new Set((o=r?.allowEmptyValue)!==null&&o!==void 0?o:[]),u=Object.entries(t).map(([d,h])=>c.has(d)&&(h==null||h===""||Array.isArray(h)&&h.length===0)?`${encodeURIComponent(d)}=`:e(d,h,a));return tg(...u)}}p(rg,"queryEncoder");var dt=rg(ms),ng=p((e,t)=>t==null?fetch(e):fetch(e,t),"DEFAULT_FETCHER"),ig=class Oa{static{p(this,"_HTTPClient")}constructor(t={}){this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.options=t,this.fetcher=t.fetcher||ng}async request(t){let r=t;for(let n of this.requestHooks){let i=await n(r);i&&(r=i)}try{let n=await this.fetcher(r);for(let i of this.responseHooks)await i(n,r);return n}catch(n){for(let i of this.requestErrorHooks)await i(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 new 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 new Error(`Invalid hook type: ${t[0]}`);let n=r.findIndex(i=>i===t[1]);return n>=0&&r.splice(n,1),this}clone(){let t=new Oa(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}},Ts=/\s*;\s*/g;function Lt(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 i=t.toLowerCase().trim().split(Ts),[o="",...a]=i;if(o.split("/").length!==2)return!1;let c=n.split(Ts),[u="",...d]=c,[h="",m=""]=u.split("/");if(!h||!m||o!=="*/*"&&u!==o&&`${h}/*`!==o&&`*/${m}`!==o||d.length<a.length)return!1;let g=new Set(d);for(let _ of a)if(!g.has(_))return!1;return!0}p(Lt,"matchContentType");var og=new RegExp("^[0-9]xx$","i");function pe(e,t){let r=`${e.status}`,n=Array.isArray(t)?t:[t];return n.length?n.some(i=>{let o=`${i}`;if(o==="default")return!0;if(!og.test(`${o}`))return o===r;let a=o.charAt(0);if(!a)throw new Error("Invalid status code range");let c=r.charAt(0);if(!c)throw new Error(`Invalid response status code: ${r}`);return c===a}):!1}p(pe,"matchStatusCode");function sg(e,t,r){return pe(e,t)&&Lt(e,r)}p(sg,"matchResponse");function As(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",i="code"in e&&typeof e.code=="string"&&e.code.toLowerCase()==="econnreset";return t||r||i||n}p(As,"isConnectionError");function Cs(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}p(Cs,"isTimeoutError");function ag(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}p(ag,"isAbortError");var Ss={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},Fr=class Fa extends Error{static{p(this,"_PermanentError")}constructor(t,r){let n=t;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,Fa.prototype)}},Ot=class qa extends Error{static{p(this,"_TemporaryError")}constructor(t,r){super(t),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,qa.prototype)}};async function lg(e,t){var r;switch(t.config.strategy){case"backoff":return cg(Is(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),(r=t.config.backoff)!==null&&r!==void 0?r:Ss);case"attempt-count-backoff":return pg(Is(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),Object.assign(Object.assign({},Ss),t.config.backoff),t.config);default:return await e(0)}}p(lg,"retry");function Is(e,t){return async r=>{try{let n=await e(r);if(dg(n,t.statusCodes))throw new Ot("Response failed with retryable status code",n);return n}catch(n){throw n instanceof Ot||t.retryConnectionErrors&&(Cs(n)||As(n))?n:new Fr("Permanent error",{cause:n})}}}p(Is,"wrapFetcher");var ug=new RegExp("^[0-9]xx$","i");function dg(e,t){let r=`${e.status}`;return t.some(n=>{if(!ug.test(n))return n===r;let i=n.charAt(0);if(!i)throw new Error("Invalid status code range");let o=r.charAt(0);if(!o)throw new Error(`Invalid response status code: ${r}`);return o===i})}p(dg,"isRetryableResponse");async function cg(e,t){let{maxElapsedTime:r,initialInterval:n,exponent:i,maxInterval:o}=t,a=Date.now(),c=0;for(;;)try{return await e(c)}catch(u){if(u instanceof Fr)throw u.cause;if(Date.now()-a>r){if(u instanceof Ot)return u.response;throw u}let d=0;u instanceof Ot&&(d=ws(u.response)),d<=0&&(d=n*Math.pow(c,i)+Math.random()*1e3);let h=Math.min(d,o);await Rs(h),c++}}p(cg,"retryBackoff");async function pg(e,t,r){let n=0;for(;;)try{return await e(n)}catch(i){if(i instanceof Fr)throw i.cause;if(n>=r.maxRetries){if(i instanceof Ot)return i.response;throw i}let o=0;i instanceof Ot&&(o=ws(i.response)),o<=0&&(o=t.initialInterval*Math.pow(t.exponent,n)*(1-Math.random()*.25));let a=Math.min(o,t.maxInterval);await Rs(a),n++}}p(pg,"retryAttemptCountBackoff");function ws(e){let t=e.headers.get("retry-after-ms");if(t){let o=Number(t);if(Number.isFinite(o)&&o>=0)return o}let r=e.headers.get("retry-after")||"";if(!r)return 0;let n=Number(r);if(Number.isInteger(n))return n*1e3;let i=Date.parse(r);if(Number.isInteger(i)){let o=i-Date.now();return o>0?Math.ceil(o):0}return 0}p(ws,"retryIntervalFromResponse");async function Rs(e){return new Promise(t=>setTimeout(t,e))}p(Rs,"delay");var hr=typeof globalThis>"u"?null:globalThis,hg=typeof hr=="object"&&hr!=null&&"importScripts"in hr&&typeof hr.importScripts=="function",fg=hg||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",vt=class{static{p(this,"ClientSDK")}constructor(e={}){let t=e;typeof t=="object"&&t!=null&&"hooks"in t&&t.hooks instanceof ps?this._hooks=t.hooks:this._hooks=new ps;let r=new ig;e.http_client=e.http_client||r,e=this._hooks.sdkInit(e);let n=zm(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/"),this._baseURL=n,this._httpClient=e.http_client||r,this._options=Object.assign(Object.assign({},Em(e)),{hooks:this._hooks}),this._logger=this._options.debug_logger,!this._logger&&Xt().GOOGLE_GENAI_DEBUG&&(this._logger=console)}_createRequest(e,t,r){var n,i,o,a,c;let{method:u,path:d,query:h,headers:m,security:g}=t,_=(n=t.baseURL)!==null&&n!==void 0?n:this._baseURL;if(!_)return ot(new cr("No base URL provided for operation"));let f=new URL(_),y;d?(f.pathname=f.pathname.replace(/\/+$/,"")+"/",y=new URL(d,f),!y.search&&f.search&&(y.search=f.search)):y=f,y.hash="";let E=p((O,L)=>{if(!L)return O;let B=new Set(L.split("&").filter(X=>X!=="").map(X=>{var Y;return(Y=X.split("=")[0])!==null&&Y!==void 0?Y:""}));return[...O.split("&").filter(X=>{var Y;return X!==""&&!B.has((Y=X.split("=")[0])!==null&&Y!==void 0?Y:"")}),L].join("&")},"mergeQuery"),C=p(O=>Object.entries(O).map(([L,B])=>{if(B==null)return;let X=ut(B)?JSON.stringify(B):B;return ms(L,X,{explode:Array.isArray(X),charEncoding:"percent"})}).filter(L=>typeof L<"u").join("&"),"encodeQueryRecord"),S=[h||"",C(r?.extra_query||{}),C(g?.queryParams||{})].reduce(E,y.search.slice(1));S&&(y.search=`?${S}`);let A=new Headers(m),v=g?.basic.username,T=g?.basic.password;if(v!=null||T!=null){let O=Km([v||"",T||""].join(":"));A.set("Authorization",`Basic ${O}`)}let I=new Headers(g?.headers||{});for(let[O,L]of I)A.set(O,L);let w=A.get("cookie")||"";for(let[O,L]of Object.entries(g?.cookies||{}))w+=`; ${O}=${L}`;w=w.startsWith("; ")?w.slice(2):w,A.set("cookie",w);let k=new Headers((i=r?.headers)!==null&&i!==void 0?i:(o=r?.fetch_options)===null||o===void 0?void 0:o.headers);for(let[O,L]of k)A.set(O,L);fg||A.set((a=t.uaHeader)!==null&&a!==void 0?a:"user-agent",(c=t.userAgent)!==null&&c!==void 0?c:Qm.userAgent);let R=t.body,M=Object.fromEntries(Object.entries(r?.extra_body||{}).filter(([,O])=>typeof O<"u"));if(Object.keys(M).length>0){let O=new Headers(m).get("content-type")||"";if(!/^(application|text)\/([^+]+\+)*json/.test(O)||typeof R!="string"&&R!=null)return ot(new cr("extra_body can only be merged into JSON object request bodies"));let L;try{L=R?JSON.parse(R):{}}catch(B){return ot(new cr("extra_body can only be merged into JSON object request bodies",{cause:B}))}if(!ut(L))return ot(new cr("extra_body can only be merged into JSON object request bodies"));R=JSON.stringify(Object.assign(Object.assign({},L),M)),A.delete("content-length")}let D=Object.assign(Object.assign({},r?.fetch_options),r);!D?.signal&&t.timeout_ms!=null&&t.timeout_ms>0&&(e.timeout_ms=t.timeout_ms),t.body instanceof ReadableStream&&Object.assign(D,{duplex:"half"});let J;try{J=this._hooks.beforeCreateRequest(e,{url:y,options:Object.assign(Object.assign({},D),{body:R??null,headers:A,method:u})})}catch(O){return ot(new ss("Create request hook failed to execute",{cause:O}))}return hs(new Request(J.url,J.options))}async _do(e,t){let{context:r,isErrorStatusCode:n}=t,i=r.timeout_ms;return lg(async()=>{var o;let a=e.clone(),c=a;if(i!=null&&i>0){let h=AbortSignal.timeout(i),m=(o=Zm(a.signal,h))!==null&&o!==void 0?o:h;c=new Request(a,{signal:m})}let u=await this._hooks.beforeRequest(r,c);await mg(this._logger,u).catch(h=>{var m;return(m=this._logger)===null||m===void 0?void 0:m.log("Failed to log request:",h)});let d=await this._httpClient.request(u);try{if(n(d.status)){let h=await this._hooks.afterError(r,d,null);if(h.error)throw h.error;d=h.response||d}else d=await this._hooks.afterSuccess(r,d)}finally{await gg(this._logger,d,u).catch(h=>{var m;return(m=this._logger)===null||m===void 0?void 0:m.log("Failed to log response:",h)})}return d},{config:t.retryConfig,statusCodes:t.retryCodes}).then(o=>hs(o),o=>{switch(!0){case ag(o):return ot(new as("Request aborted by client",{cause:o}));case Cs(o):return ot(new ls("Request timed out",{cause:o}));case As(o):return ot(new us("Unable to make request",{cause:o}));default:return ot(new ss("Unexpected HTTP client error",{cause:o}))}})}},Ps=/^(application|text)\/([^+]+\+)*json.*/,Ns=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function mg(e,t){if(!e)return;let r=t.headers.get("content-type"),n=r?.split(";")[0]||"";e.group(`> Request: ${t.method} ${t.url}`),e.group("Headers:");for(let[i,o]of t.headers.entries())e.log(`${i}: ${o}`);switch(e.groupEnd(),e.group("Body:"),!0){case Ps.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 i=await t.clone().formData();for(let[o,a]of i){let c=a instanceof Blob?"<Blob>":a;e.log(`${o}: ${c}`)}break}default:e.log(`<${r}>`);break}e.groupEnd(),e.groupEnd()}p(mg,"logRequest");async function gg(e,t,r){if(!e)return;let n=t.headers.get("content-type"),i=n?.split(";")[0]||"";e.group(`< Response: ${r.method} ${r.url}`),e.log("Status Code:",t.status,t.statusText),e.group("Headers:");for(let[o,a]of t.headers.entries())e.log(`${o}: ${a}`);switch(e.groupEnd(),e.group("Body:"),!0){case(Lt(t,"application/json")||Ps.test(i)&&!Ns.test(i)):e.log(await t.clone().json());break;case(Lt(t,"application/jsonl")||Ns.test(i)):case Lt(t,"text/event-stream"):e.log(`<${n}>`);break;case Lt(t,"text/*"):e.log(await t.clone().text());break;case Lt(t,"multipart/form-data"):{let o=await t.clone().formData();for(let[a,c]of o){let u=c instanceof Blob?"<Blob>":c;e.log(`${a}: ${u}`)}break}default:e.log(`<${n}>`);break}e.groupEnd(),e.groupEnd()}p(gg,"logResponse");var ks=class extends Ze{static{p(this,"GoogleGenAiDefaultError")}constructor(e,t){e&&(e+=": "),e+=`Status ${t.response.status}`;let r=t.response.headers.get("content-type")||'""';r!=="application/json"&&(e+=` Content-Type ${r.includes(" ")?`"${r}"`:r}`);let n=t.body||'""';e+=n.length>100?`
|
|
41
|
+
`:". ";let i=n;if(n.length>1e4){let o=n.substring(0,1e4),a=n.length-1e4;i=`${o}...and ${a} more chars`}e+=`Body: ${i}`,e=e.trim(),super(e,t),this.name="GoogleGenAiDefaultError"}};function Ds(e){try{return JSON.parse(e)}catch{return e}}p(Ds,"tryParseJson");function _g(e,t={}){var r,n;let i=t.flattened===!0,o=(r=t.sentinel)!==null&&r!==void 0?r:"";return new yg(e,a=>o!==""&&a.data===o?{done:!0,value:void 0}:i?{done:!1,value:a.data==null?void 0:Ds(a.data)}:{done:!1,value:Object.assign(Object.assign({},a),{data:a.data==null?a.data:Ds(a.data)})},{dataRequired:(n=t.dataRequired)!==null&&n!==void 0?n:!0})}p(_g,"wrapEventStreamResponse");var yg=class extends ReadableStream{static{p(this,"Stream")}constructor(e,t,r){var n;let i=e.getReader(),o=new Uint8Array(4096),a=0,c=0,u={eventId:void 0},d=(n=r?.dataRequired)!==null&&n!==void 0?n:!0;super({async pull(h){try{for(;;){let m=vg(o,a,c);if(!m){c=Math.max(0,a-Eg+1);let f=await i.read();if(f.done)return h.close();if(a+f.value.length>o.length){let y=new Uint8Array(Math.max(o.length*2,a+f.value.length));y.set(o.subarray(0,a)),o=y}o.set(f.value,a),a+=f.value.length;continue}let g=o.slice(0,m.index);if(o.copyWithin(0,m.index+m.length,a),a-=m.index+m.length,o.length>4096&&a<=o.length>>2){let f=new Uint8Array(Math.max(4096,a*2));f.set(o.subarray(0,a)),o=f}c=0;let _=Tg(g,t,u,d);if(_&&!_.done)return h.enqueue(_.value);if(_?.done)return await i.cancel("done"),h.close()}}catch(m){h.error(m),await i.cancel(m)}},cancel:p(h=>i.cancel(h),"cancel")})}[Symbol.asyncIterator](e){let t=ReadableStream.prototype[Symbol.asyncIterator];if(typeof t=="function")return t.call(this,e);let r=this.getReader(),n={next:p(async()=>{let o=await r.read();return o.done?(r.releaseLock(),{done:!0,value:void 0}):{done:!1,value:o.value}},"next"),throw:p(async o=>(await r.cancel(o),r.releaseLock(),{done:!0,value:void 0}),"throw"),return:p(async()=>(await r.cancel("done"),r.releaseLock(),{done:!0,value:void 0}),"return"),[Symbol.asyncIterator](){return this}},i=Symbol.asyncDispose;return i&&(n[i]=async()=>{var o;await((o=n.return)===null||o===void 0?void 0:o.call(n))}),n}values(e){return this[Symbol.asyncIterator](e)}},$e=13,Je=10,Ms=[[$e,Je,$e,Je],[$e,Je,$e],[$e,Je,Je],[$e,$e,Je],[Je,$e,Je],[$e,$e],[Je,$e],[Je,Je]],Eg=Ms.reduce((e,t)=>Math.max(e,t.length),0);function vg(e,t,r){for(let n=r;n<t;n++)if(!(e[n]!==$e&&e[n]!==Je))for(let i of Ms){if(n+i.length>t)continue;let o=!0;for(let a=0;a<i.length;a++)if(e[n+a]!==i[a]){o=!1;break}if(o)return{index:n,length:i.length}}return null}p(vg,"findBoundary");function Tg(e,t,r,n){let i=new TextDecoder().decode(e).split(/\r\n|\r|\n/),o=[],a={},c=!0;for(let u of i){if(!u||u.startsWith(":"))continue;c=!1;let d=u.indexOf(":"),h=u,m="";d>0&&(h=u.slice(0,d),m=u[d+1]===" "?u.slice(d+2):u.slice(d+1)),h==="data"?o.push(m):h==="event"?a.event=m:h==="id"&&!m.includes("\0")?r.eventId=m:h==="retry"&&/^\d+$/.test(m)&&(a.retry=Number(m))}if(!c){if(a.id=r.eventId,o.length)a.data=o.join(`
|
|
42
|
+
`);else if(n)return;return t(a)}}p(Tg,"parseMessage");var Ag={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function ct(e,t,r){return Object.assign(Object.assign({},r),{err:!0,enc:"json",codes:e,errorClass:t})}p(ct,"jsonErr");function Ae(e,t){return Object.assign(Object.assign({},t),{enc:"json",codes:e})}p(Ae,"json");function xs(e,t,r){return Object.assign(Object.assign(Object.assign({},r),{enc:"sse",codes:e}),t?{sse:t}:{})}p(xs,"sse");function Cg(e,t){return Object.assign(Object.assign({},t),{enc:"nil",codes:e})}p(Cg,"nil");function ne(e){return{enc:"fail",codes:e}}p(ne,"fail");function _e(...e){return async function(t,r,n){let i,o;for(let m of e){let{codes:g}=m,_="ctype"in m?m.ctype:Ag[m.enc];if(_&&sg(t,g,_)){o=m;break}else if(!_&&pe(t,g)){o=m;break}}if(!o)return[{ok:!1,error:new ks("Unexpected Status or Content-Type",{response:t,request:r,body:await t.text().catch(()=>"")})},i];let a=o.enc,c="";switch(a){case"json":c=await t.text();try{i=JSON.parse(c)}catch(m){if(!("err"in o))throw m;i=c}break;case"jsonl":i=t.body;break;case"bytes":i=new Uint8Array(await t.arrayBuffer());break;case"stream":i=t.body;break;case"text":c=await t.text(),i=c;break;case"sse":if(t.body){let m="sse"in o&&o.sse||{};i=_g(t.body,m)}else i=null;break;case"nil":c=await t.text(),i=void 0;break;case"fail":c=await t.text(),i=c;break;default:throw new Error(`Unsupported response type: ${a}`)}if(o.enc==="fail")return[{ok:!1,error:new ks("API error occurred",{request:r,response:t,body:c})},i];let u=o.key||n?.resultKey,d,h=o.hdrs?{headers:Ig(t.headers)}:null;return"err"in o?d=Object.assign(Object.assign(Object.assign({},n?.extraFields),h),ut(i)?i:null):u?d=Object.assign(Object.assign(Object.assign({},n?.extraFields),h),{[u]:i}):o.hdrs?d=Object.assign(Object.assign(Object.assign({},n?.extraFields),h),ut(i)?i:null):d=i,"err"in o?[{ok:!1,error:o.errorClass?new o.errorClass(d,{request:r,response:t,body:c}):d},i]:[{ok:!0,value:d},i]}}p(_e,"match");var Sg=/, */;function Ig(e){let t={};for(let[r,n]of e.entries())t[r]=n.split(Sg);return t}p(Ig,"unpackHeaders");var bs={Incomplete:"incomplete",UnrecognisedSecurityType:"unrecognized_security_type"},wg=class Zr extends Error{static{p(this,"_SecurityError")}constructor(t,r){super(r),this.code=t,this.name="SecurityError"}static incomplete(){return new Zr(bs.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(t){return new Zr(bs.UnrecognisedSecurityType,`Unrecognised security type: ${t}`)}};function Rg(...e){let t={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=e.find(n=>n.every(i=>{if(i.value==null)return!1;if(i.type==="http:basic")return i.value.username!=null||i.value.password!=null;if(i.type==="http:custom")return null;if(i.type==="oauth2:password")return typeof i.value=="string"&&!!i.value;if(i.type==="oauth2:client_credentials")return typeof i.value=="string"?!!i.value:i.value.client_id!=null||i.value.client_secret!=null;if(typeof i.value=="string")return!!i.value;throw new Error(`Unrecognized security type: ${i.type} (value type: ${typeof i.value})`)}));return r==null?null:(r.forEach(n=>{if(n.value==null)return;let{type:i}=n;switch(i){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":Pg(t,n);break;case"http:custom":break;case"http:bearer":fr(t,n);break;case"oauth2":fr(t,n);break;case"oauth2:password":fr(t,n);break;case"oauth2:client_credentials":break;case"openIdConnect":fr(t,n);break;default:throw wg.unrecognizedType(i)}}),t)}p(Rg,"resolveSecurity");function Pg(e,t){t.value!=null&&(e.basic=t.value)}p(Pg,"applyBasic");function fr(e,t){if(typeof t.value!="string"||!t.value)return;let r=t.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),t.fieldName!==void 0&&(e.headers[t.fieldName]=r)}p(fr,"applyBearer");function ye(e,t){var r,n;let i=[[{fieldName:"accessToken",type:"http:custom",value:(r=e?.access_token)!==null&&r!==void 0?r:Xt().GOOGLE_GENAI_ACCESS_TOKEN},{fieldName:"apiKey",type:"http:custom",value:(n=e?.api_key)!==null&&n!==void 0?n:Xt().GOOGLE_GENAI_API_KEY},{fieldName:"defaultHeaders",type:"http:custom",value:e?.default_headers}]];return Rg(...i)}p(ye,"resolveGlobalSecurity");async function Ee(e){if(e!=null)return typeof e=="function"?e():e}p(Ee,"extractSecurity");var Us,me=class Ba{static{p(this,"_APIPromise")}constructor(t,r){this[Us]="APIPromise",this._promise=t instanceof Promise?t:Promise.resolve(t),this._unwrapped=t instanceof Promise?null:Promise.resolve(t[0]),this._callSource=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(([,r])=>r)).then(r=>{if(!r.response)throw new Error("APIPromise.asResponse: response unavailable");return r.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(([i,o])=>[t(i),o]);return n.catch(()=>{}),new Ba(n,(r=this._callSource)!==null&&r!==void 0?r:void 0)}};Us=Symbol.toStringTag;function ve(e){let t=e.$inspect(),r=t.then(([i,o])=>{if(!i.ok)throw i.error;return[i.value,o]}),n=t.then(([i,o])=>{var a;if(!i.ok&&!(!((a=o.response)===null||a===void 0)&&a.ok))throw i.error;return o});return r.catch(()=>{}),n.catch(()=>{}),new me(r,n)}p(ve,"unwrapAsAPIPromise");function Gs(e,t,r,n){return new me(Ng(e,t,r,n))}p(Gs,"agentsCreate");async function Ng(e,t,r,n){var i,o,a;let c={body:t,api_version:r},u=st("body",c.body,{explode:!0}),d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/agents")(d),m=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"CreateAgent",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"POST",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(Ng,"$do$q");function Ls(e,t,r,n){return new me(kg(e,t,r,n))}p(Ls,"agentsDelete");async function kg(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/agents/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"DeleteAgent",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"DELETE",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(kg,"$do$p");function Os(e,t,r,n){return new me(Dg(e,t,r,n))}p(Os,"agentsGet");async function Dg(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/agents/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"GetAgent",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"GET",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(Dg,"$do$o");function Fs(e,t,r,n,i,o){return new me(Mg(e,t,r,n,i,o))}p(Fs,"agentsList");async function Mg(e,t,r,n,i,o){var a,c,u;let d={api_version:t,page_size:r,page_token:n,parent:i},h=null,m={api_version:re("api_version",(a=d?.api_version)!==null&&a!==void 0?a:e._options.api_version,{explode:!1,charEncoding:"percent"})},g=fe("/{api_version}/agents")(m),_=dt({page_size:d?.page_size,page_token:d?.page_token,parent:d?.parent}),f=new Headers(ge({Accept:"application/json"})),y=await Ee(e._options.security),E=ye(y),C={options:e._options,base_url:(u=(c=o?.server_url)!==null&&c!==void 0?c:e._baseURL)!==null&&u!==void 0?u:"",operation_id:"ListAgents",o_auth2_scopes:null,resolved_security:E,security_source:e._options.security,retry_config:o?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:o?.retry_codes||["408","409","429","5XX"]},S=e._createRequest(C,{security:E,method:"GET",baseURL:o?.server_url,path:g,headers:f,query:_,body:h,userAgent:e._options.user_agent,timeout_ms:o?.timeout_ms||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let A=S.value,v=await e._do(A,{context:C,isErrorStatusCode:p(w=>pe({status:w},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:C.retry_config,retryCodes:C.retry_codes});if(!v.ok)return[v,{status:"request-error",request:A}];let T=v.value,[I]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(T,A);return I.ok?[I,{status:"complete",request:A,response:T}]:[I,{status:"complete",request:A,response:T}]}p(Mg,"$do$n");var xg=class extends vt{static{p(this,"Agents")}list(e,t){return ve(Fs(this,e?.api_version,e?.page_size,e?.page_token,e?.parent,t))}create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return ve(Gs(this,n,r,t))}delete(e,t,r){return ve(Ls(this,e,t?.api_version,r))}get(e,t,r){return ve(Os(this,e,t?.api_version,r))}};function qs(e,t,r,n){return new me(bg(e,t,r,n))}p(qs,"environmentsCreateEnvironment");async function bg(e,t,r,n){var i,o,a;let c={body:t,api_version:r},u=st("body",c.body,{explode:!0}),d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/environments")(d),m=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"CreateEnvironment",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"POST",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(bg,"$do$m");function Bs(e,t,r,n){return new me(Ug(e,t,r,n))}p(Bs,"environmentsDeleteEnvironment");async function Ug(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/environments/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"DeleteEnvironment",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"DELETE",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(Ug,"$do$l");function Hs(e,t,r,n){return new me(Gg(e,t,r,n))}p(Hs,"environmentsGetEnvironment");async function Gg(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/environments/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"GetEnvironment",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"GET",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(Gg,"$do$k");function Vs(e,t,r,n,i){return new me(Lg(e,t,r,n,i))}p(Vs,"environmentsListEnvironments");async function Lg(e,t,r,n,i){var o,a,c;let u={api_version:t,page_size:r,page_token:n},d=null,h={api_version:re("api_version",(o=u?.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},m=fe("/{api_version}/environments")(h),g=dt({page_size:u?.page_size,page_token:u?.page_token}),_=new Headers(ge({Accept:"application/json"})),f=await Ee(e._options.security),y=ye(f),E={options:e._options,base_url:(c=(a=i?.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"ListEnvironments",o_auth2_scopes:null,resolved_security:y,security_source:e._options.security,retry_config:i?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:i?.retry_codes||["408","409","429","5XX"]},C=e._createRequest(E,{security:y,method:"GET",baseURL:i?.server_url,path:m,headers:_,query:g,body:d,userAgent:e._options.user_agent,timeout_ms:i?.timeout_ms||e._options.timeout_ms||-1},i);if(!C.ok)return[C,{status:"invalid"}];let S=C.value,A=await e._do(S,{context:E,isErrorStatusCode:p(I=>pe({status:I},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!A.ok)return[A,{status:"request-error",request:S}];let v=A.value,[T]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(v,S);return T.ok?[T,{status:"complete",request:S,response:v}]:[T,{status:"complete",request:S,response:v}]}p(Lg,"$do$j");function $s(e,t,r,n,i,o,a,c){return new me(Og(e,t,r,n,i,o,a,c))}p($s,"environmentsFilesList");async function Og(e,t,r,n,i,o,a,c){var u,d,h;let m={environment:t,path:r,api_version:n,page_size:i,page_token:o,recursive:a},g=null,_={api_version:re("api_version",(u=m.api_version)!==null&&u!==void 0?u:e._options.api_version,{explode:!1,charEncoding:"percent"}),environment:re("environment",m.environment,{explode:!1,charEncoding:"percent"}),path:re("path",m.path,{explode:!1,charEncoding:"percent"})},f=fe("/{api_version}/environments/{environment}/files/{path}")(_),y=dt({page_size:m.page_size,page_token:m.page_token,recursive:m.recursive}),E=new Headers(ge({Accept:"application/json"})),C=await Ee(e._options.security),S=ye(C),A={options:e._options,base_url:(h=(d=c?.server_url)!==null&&d!==void 0?d:e._baseURL)!==null&&h!==void 0?h:"",operation_id:"GetEnvironmentFiles",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:c?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:c?.retry_codes||["408","409","429","5XX"]},v=e._createRequest(A,{security:S,method:"GET",baseURL:c?.server_url,path:f,headers:E,query:y,body:g,userAgent:e._options.user_agent,timeout_ms:c?.timeout_ms||e._options.timeout_ms||-1},c);if(!v.ok)return[v,{status:"invalid"}];let T=v.value,I=await e._do(T,{context:A,isErrorStatusCode:p(R=>pe({status:R},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:A.retry_config,retryCodes:A.retry_codes});if(!I.ok)return[I,{status:"request-error",request:T}];let w=I.value,[k]=await _e(Ae(200),ne("4XX"),ne("5XX"))(w,T);return k.ok?[k,{status:"complete",request:T,response:w}]:[k,{status:"complete",request:T,response:w}]}p(Og,"$do$i");var Fg=class extends vt{static{p(this,"Files2")}list(e,t,r,n){return ve($s(this,e,t,r?.api_version,r?.page_size,r?.page_token,r?.recursive,n))}},qg=class extends vt{static{p(this,"Environments")}get files(){var e;return(e=this._files)!==null&&e!==void 0?e:this._files=new Fg(this._options)}listEnvironments(e,t){return ve(Vs(this,e?.api_version,e?.page_size,e?.page_token,t))}createEnvironment(e,t,r){return ve(qs(this,e,t,r))}deleteEnvironment(e,t,r){return ve(Bs(this,e,t?.api_version,r))}getEnvironment(e,t,r){return ve(Hs(this,e,t?.api_version,r))}},Bg=class extends Ze{static{p(this,"CancelInteractionByIdServerError")}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"}},Hg=class extends Ze{static{p(this,"CancelInteractionByIdClientError")}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"}},Vg=class extends Ze{static{p(this,"CreateInteractionServerError")}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"}},$g=class extends Ze{static{p(this,"CreateInteractionClientError")}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"}},Jg=class extends Ze{static{p(this,"DeleteInteractionServerError")}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"}},Wg=class extends Ze{static{p(this,"DeleteInteractionClientError")}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"}},Xg=class extends Ze{static{p(this,"GetInteractionByIdServerError")}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"}},Kg=class extends Ze{static{p(this,"GetInteractionByIdClientError")}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 Js(e,t,r,n){return new me(Yg(e,t,r,n))}p(Js,"interactionsCancel");async function Yg(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/interactions/{id}/cancel")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"cancelInteractionById",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"POST",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(T=>pe({status:T},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,A={httpMeta:{response:S,request:E}},[v]=await _e(Ae(200),ct("4XX",Hg),ct("5XX",Bg))(S,E,{extraFields:A});return v.ok?[v,{status:"complete",request:E,response:S}]:[v,{status:"complete",request:E,response:S}]}p(Yg,"$do$h");function Ws(e,t,r,n){return new me(zg(e,t,r,n))}p(Ws,"interactionsCreate");async function zg(e,t,r,n){var i,o,a,c;let u={body:t,api_version:r},d=u,h=st("body",d.body,{explode:!0}),m={api_version:re("api_version",(i=d.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},g=fe("/{api_version}/interactions")(m),_=new Headers(ge({"Content-Type":"application/json",Accept:!((o=u?.body)===null||o===void 0)&&o.stream?"text/event-stream":"application/json"})),f=await Ee(e._options.security),y=ye(f),E={options:e._options,base_url:(c=(a=n?.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"CreateInteraction",o_auth2_scopes:null,resolved_security:y,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},C=e._createRequest(E,{security:y,method:"POST",baseURL:n?.server_url,path:g,headers:_,body:h,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!C.ok)return[C,{status:"invalid"}];let S=C.value,A=await e._do(S,{context:E,isErrorStatusCode:p(w=>pe({status:w},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!A.ok)return[A,{status:"request-error",request:S}];let v=A.value,T={httpMeta:{response:v,request:S}},[I]=await _e(Ae(200),xs(200,{sentinel:"[DONE]",flattened:!0}),ct("4XX",$g),ct("5XX",Vg))(v,S,{extraFields:T});return I.ok?[I,{status:"complete",request:S,response:v}]:[I,{status:"complete",request:S,response:v}]}p(zg,"$do$g");function Qg(e,t,r,n){return new me(Zg(e,t,r,n))}p(Qg,"interactionsDelete");async function Zg(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/interactions/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"deleteInteraction",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"DELETE",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(T=>pe({status:T},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,A={httpMeta:{response:S,request:E}},[v]=await _e(Cg(200),ct("4XX",Wg),ct("5XX",Jg))(S,E,{extraFields:A});return v.ok?[v,{status:"complete",request:E,response:S}]:[v,{status:"complete",request:E,response:S}]}p(Zg,"$do$f");function Xs(e,t,r,n,i,o,a){return new me(jg(e,t,r,n,i,o,a))}p(Xs,"interactionsGet");async function jg(e,t,r,n,i,o,a){var c,u,d;let h={id:t,api_version:r,include_input:n,last_event_id:i,stream:o},m=h,g=null,_={api_version:re("api_version",(c=m.api_version)!==null&&c!==void 0?c:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",m.id,{explode:!1,charEncoding:"percent"})},f=fe("/{api_version}/interactions/{id}")(_),y=dt({include_input:m.include_input,last_event_id:m.last_event_id,stream:m.stream}),E=new Headers(ge({Accept:h?.stream?"text/event-stream":"application/json"})),C=await Ee(e._options.security),S=ye(C),A={options:e._options,base_url:(d=(u=a?.server_url)!==null&&u!==void 0?u:e._baseURL)!==null&&d!==void 0?d:"",operation_id:"getInteractionById",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:a?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:a?.retry_codes||["408","409","429","5XX"]},v=e._createRequest(A,{security:S,method:"GET",baseURL:a?.server_url,path:f,headers:E,query:y,body:g,userAgent:e._options.user_agent,timeout_ms:a?.timeout_ms||e._options.timeout_ms||-1},a);if(!v.ok)return[v,{status:"invalid"}];let T=v.value,I=await e._do(T,{context:A,isErrorStatusCode:p(M=>pe({status:M},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:A.retry_config,retryCodes:A.retry_codes});if(!I.ok)return[I,{status:"request-error",request:T}];let w=I.value,k={httpMeta:{response:w,request:T}},[R]=await _e(Ae(200),xs(200,{sentinel:"[DONE]",flattened:!0}),ct("4XX",Kg),ct("5XX",Xg))(w,T,{extraFields:k});return R.ok?[R,{status:"complete",request:T,response:w}]:[R,{status:"complete",request:T,response:w}]}p(jg,"$do$e");var e_=class extends vt{static{p(this,"Interactions")}create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return ve(Ws(this,n,r,t))}delete(e,t,r){return ve(Qg(this,e,t?.api_version,r))}get(e,t,r){return ve(Xs(this,e,t?.api_version,t?.include_input,t?.last_event_id,t?.stream,r))}cancel(e,t,r){return ve(Js(this,e,t?.api_version,r))}};function Ks(e,t,r,n){return new me(t_(e,t,r,n))}p(Ks,"triggersCreate");async function t_(e,t,r,n){var i,o,a;let c={body:t,api_version:r},u=st("body",c.body,{explode:!0}),d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/triggers")(d),m=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"CreateTrigger",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"POST",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(Ae(200),ne("4XX"),ne("5XX"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(t_,"$do$d");function Ys(e,t,r,n){return new me(r_(e,t,r,n))}p(Ys,"triggersDelete");async function r_(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/triggers/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"DeleteTrigger",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"DELETE",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(Ae(200),ne("4XX"),ne("5XX"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(r_,"$do$c");function zs(e,t,r,n){return new me(n_(e,t,r,n))}p(zs,"triggersGet");async function n_(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/triggers/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"GetTrigger",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"GET",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(Ae(200),ne("4XX"),ne("5XX"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(n_,"$do$b");function Qs(e,t,r,n,i,o){return new me(i_(e,t,r,n,i,o))}p(Qs,"triggersListExecutions");async function i_(e,t,r,n,i,o){var a,c,u;let d={trigger_id:t,api_version:r,page_size:n,page_token:i},h=null,m={api_version:re("api_version",(a=d.api_version)!==null&&a!==void 0?a:e._options.api_version,{explode:!1,charEncoding:"percent"}),trigger_id:re("trigger_id",d.trigger_id,{explode:!1,charEncoding:"percent"})},g=fe("/{api_version}/triggers/{trigger_id}/executions")(m),_=dt({page_size:d.page_size,page_token:d.page_token}),f=new Headers(ge({Accept:"application/json"})),y=await Ee(e._options.security),E=ye(y),C={options:e._options,base_url:(u=(c=o?.server_url)!==null&&c!==void 0?c:e._baseURL)!==null&&u!==void 0?u:"",operation_id:"ListTriggerExecutions",o_auth2_scopes:null,resolved_security:E,security_source:e._options.security,retry_config:o?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:o?.retry_codes||["408","409","429","5XX"]},S=e._createRequest(C,{security:E,method:"GET",baseURL:o?.server_url,path:g,headers:f,query:_,body:h,userAgent:e._options.user_agent,timeout_ms:o?.timeout_ms||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let A=S.value,v=await e._do(A,{context:C,isErrorStatusCode:p(w=>pe({status:w},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:C.retry_config,retryCodes:C.retry_codes});if(!v.ok)return[v,{status:"request-error",request:A}];let T=v.value,[I]=await _e(Ae(200),ne("4XX"),ne("5XX"))(T,A);return I.ok?[I,{status:"complete",request:A,response:T}]:[I,{status:"complete",request:A,response:T}]}p(i_,"$do$a");function Zs(e,t,r,n,i,o){return new me(o_(e,t,r,n,i,o))}p(Zs,"triggersList");async function o_(e,t,r,n,i,o){var a,c,u;let d={api_version:t,filter:r,page_size:n,page_token:i},h=null,m={api_version:re("api_version",(a=d?.api_version)!==null&&a!==void 0?a:e._options.api_version,{explode:!1,charEncoding:"percent"})},g=fe("/{api_version}/triggers")(m),_=dt({filter:d?.filter,page_size:d?.page_size,page_token:d?.page_token}),f=new Headers(ge({Accept:"application/json"})),y=await Ee(e._options.security),E=ye(y),C={options:e._options,base_url:(u=(c=o?.server_url)!==null&&c!==void 0?c:e._baseURL)!==null&&u!==void 0?u:"",operation_id:"ListTriggers",o_auth2_scopes:null,resolved_security:E,security_source:e._options.security,retry_config:o?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:o?.retry_codes||["408","409","429","5XX"]},S=e._createRequest(C,{security:E,method:"GET",baseURL:o?.server_url,path:g,headers:f,query:_,body:h,userAgent:e._options.user_agent,timeout_ms:o?.timeout_ms||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let A=S.value,v=await e._do(A,{context:C,isErrorStatusCode:p(w=>pe({status:w},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:C.retry_config,retryCodes:C.retry_codes});if(!v.ok)return[v,{status:"request-error",request:A}];let T=v.value,[I]=await _e(Ae(200),ne("4XX"),ne("5XX"))(T,A);return I.ok?[I,{status:"complete",request:A,response:T}]:[I,{status:"complete",request:A,response:T}]}p(o_,"$do$9");function js(e,t,r,n){return new me(s_(e,t,r,n))}p(js,"triggersRun");async function s_(e,t,r,n){var i,o,a;let c={trigger_id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),trigger_id:re("trigger_id",c.trigger_id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/triggers/{trigger_id}/executions")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"RunTrigger",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"POST",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(Ae(200),ne("4XX"),ne("5XX"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(s_,"$do$8");function ea(e,t,r,n,i){return new me(a_(e,t,r,n,i))}p(ea,"triggersUpdate");async function a_(e,t,r,n,i){var o,a,c;let u={id:t,body:r,api_version:n},d=st("body",u.body,{explode:!0}),h={api_version:re("api_version",(o=u.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",u.id,{explode:!1,charEncoding:"percent"})},m=fe("/{api_version}/triggers/{id}")(h),g=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),_=await Ee(e._options.security),f=ye(_),y={options:e._options,base_url:(c=(a=i?.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"UpdateTrigger",o_auth2_scopes:null,resolved_security:f,security_source:e._options.security,retry_config:i?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:i?.retry_codes||["408","409","429","5XX"]},E=e._createRequest(y,{security:f,method:"PATCH",baseURL:i?.server_url,path:m,headers:g,body:d,userAgent:e._options.user_agent,timeout_ms:i?.timeout_ms||e._options.timeout_ms||-1},i);if(!E.ok)return[E,{status:"invalid"}];let C=E.value,S=await e._do(C,{context:y,isErrorStatusCode:p(T=>pe({status:T},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!S.ok)return[S,{status:"request-error",request:C}];let A=S.value,[v]=await _e(Ae(200),ne("4XX"),ne("5XX"))(A,C);return v.ok?[v,{status:"complete",request:C,response:A}]:[v,{status:"complete",request:C,response:A}]}p(a_,"$do$7");var l_=class extends vt{static{p(this,"Triggers")}list(e,t){return ve(Zs(this,e?.api_version,e?.filter,e?.page_size,e?.page_token,t))}create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return ve(Ks(this,n,r,t))}delete(e,t,r){return ve(Ys(this,e,t?.api_version,r))}get(e,t,r){return ve(zs(this,e,t?.api_version,r))}update(e,t,r){let{api_version:n}=t,i=Oe(t,["api_version"]);return ve(ea(this,e,i,n,r))}listExecutions(e,t,r){return ve(Qs(this,e,t?.api_version,t?.page_size,t?.page_token,r))}run(e,t,r){return ve(js(this,e,t?.api_version,r))}};function ta(e,t,r,n){return new me(u_(e,t,r,n))}p(ta,"webhooksCreate");async function u_(e,t,r,n){var i,o,a;let c={body:t,api_version:r},u=st("body",c.body,{explode:!0}),d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/webhooks")(d),m=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"CreateWebhook",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"POST",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(u_,"$do$6");function ra(e,t,r,n){return new me(d_(e,t,r,n))}p(ra,"webhooksDelete");async function d_(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/webhooks/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"DeleteWebhook",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"DELETE",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(d_,"$do$5");function na(e,t,r,n){return new me(c_(e,t,r,n))}p(na,"webhooksGet");async function c_(e,t,r,n){var i,o,a;let c={id:t,api_version:r},u=null,d={api_version:re("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",c.id,{explode:!1,charEncoding:"percent"})},h=fe("/{api_version}/webhooks/{id}")(d),m=new Headers(ge({Accept:"application/json"})),g=await Ee(e._options.security),_=ye(g),f={options:e._options,base_url:(a=(o=n?.server_url)!==null&&o!==void 0?o:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"GetWebhook",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:n?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:n?.retry_codes||["408","409","429","5XX"]},y=e._createRequest(f,{security:_,method:"GET",baseURL:n?.server_url,path:h,headers:m,body:u,userAgent:e._options.user_agent,timeout_ms:n?.timeout_ms||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let E=y.value,C=await e._do(E,{context:f,isErrorStatusCode:p(v=>pe({status:v},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:f.retry_config,retryCodes:f.retry_codes});if(!C.ok)return[C,{status:"request-error",request:E}];let S=C.value,[A]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(S,E);return A.ok?[A,{status:"complete",request:E,response:S}]:[A,{status:"complete",request:E,response:S}]}p(c_,"$do$4");function ia(e,t,r,n,i){return new me(p_(e,t,r,n,i))}p(ia,"webhooksList");async function p_(e,t,r,n,i){var o,a,c;let u={api_version:t,page_size:r,page_token:n},d=null,h={api_version:re("api_version",(o=u?.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},m=fe("/{api_version}/webhooks")(h),g=dt({page_size:u?.page_size,page_token:u?.page_token}),_=new Headers(ge({Accept:"application/json"})),f=await Ee(e._options.security),y=ye(f),E={options:e._options,base_url:(c=(a=i?.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"ListWebhooks",o_auth2_scopes:null,resolved_security:y,security_source:e._options.security,retry_config:i?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:i?.retry_codes||["408","409","429","5XX"]},C=e._createRequest(E,{security:y,method:"GET",baseURL:i?.server_url,path:m,headers:_,query:g,body:d,userAgent:e._options.user_agent,timeout_ms:i?.timeout_ms||e._options.timeout_ms||-1},i);if(!C.ok)return[C,{status:"invalid"}];let S=C.value,A=await e._do(S,{context:E,isErrorStatusCode:p(I=>pe({status:I},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!A.ok)return[A,{status:"request-error",request:S}];let v=A.value,[T]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(v,S);return T.ok?[T,{status:"complete",request:S,response:v}]:[T,{status:"complete",request:S,response:v}]}p(p_,"$do$3");function oa(e,t,r,n,i){return new me(h_(e,t,r,n,i))}p(oa,"webhooksPing");async function h_(e,t,r,n,i){var o,a,c;let u={id:t,api_version:r,body:n},d=st("body",u.body,{explode:!0}),h={api_version:re("api_version",(o=u.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",u.id,{explode:!1,charEncoding:"percent"})},m=fe("/{api_version}/webhooks/{id}:ping")(h),g=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),_=await Ee(e._options.security),f=ye(_),y={options:e._options,base_url:(c=(a=i?.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"PingWebhook",o_auth2_scopes:null,resolved_security:f,security_source:e._options.security,retry_config:i?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:i?.retry_codes||["408","409","429","5XX"]},E=e._createRequest(y,{security:f,method:"POST",baseURL:i?.server_url,path:m,headers:g,body:d,userAgent:e._options.user_agent,timeout_ms:i?.timeout_ms||e._options.timeout_ms||-1},i);if(!E.ok)return[E,{status:"invalid"}];let C=E.value,S=await e._do(C,{context:y,isErrorStatusCode:p(T=>pe({status:T},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!S.ok)return[S,{status:"request-error",request:C}];let A=S.value,[v]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(A,C);return v.ok?[v,{status:"complete",request:C,response:A}]:[v,{status:"complete",request:C,response:A}]}p(h_,"$do$2");function sa(e,t,r,n,i){return new me(f_(e,t,r,n,i))}p(sa,"webhooksRotateSigningSecret");async function f_(e,t,r,n,i){var o,a,c;let u={id:t,api_version:r,body:n},d=st("body",u.body,{explode:!0}),h={api_version:re("api_version",(o=u.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",u.id,{explode:!1,charEncoding:"percent"})},m=fe("/{api_version}/webhooks/{id}:rotateSigningSecret")(h),g=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),_=await Ee(e._options.security),f=ye(_),y={options:e._options,base_url:(c=(a=i?.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"RotateSigningSecret",o_auth2_scopes:null,resolved_security:f,security_source:e._options.security,retry_config:i?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:i?.retry_codes||["408","409","429","5XX"]},E=e._createRequest(y,{security:f,method:"POST",baseURL:i?.server_url,path:m,headers:g,body:d,userAgent:e._options.user_agent,timeout_ms:i?.timeout_ms||e._options.timeout_ms||-1},i);if(!E.ok)return[E,{status:"invalid"}];let C=E.value,S=await e._do(C,{context:y,isErrorStatusCode:p(T=>pe({status:T},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!S.ok)return[S,{status:"request-error",request:C}];let A=S.value,[v]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(A,C);return v.ok?[v,{status:"complete",request:C,response:A}]:[v,{status:"complete",request:C,response:A}]}p(f_,"$do$1");function aa(e,t,r,n,i,o){return new me(m_(e,t,r,n,i,o))}p(aa,"webhooksUpdate");async function m_(e,t,r,n,i,o){var a,c,u;let d={id:t,api_version:r,update_mask:n,body:i},h=st("body",d.body,{explode:!0}),m={api_version:re("api_version",(a=d.api_version)!==null&&a!==void 0?a:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:re("id",d.id,{explode:!1,charEncoding:"percent"})},g=fe("/{api_version}/webhooks/{id}")(m),_=dt({update_mask:d.update_mask}),f=new Headers(ge({"Content-Type":"application/json",Accept:"application/json"})),y=await Ee(e._options.security),E=ye(y),C={options:e._options,base_url:(u=(c=o?.server_url)!==null&&c!==void 0?c:e._baseURL)!==null&&u!==void 0?u:"",operation_id:"UpdateWebhook",o_auth2_scopes:null,resolved_security:E,security_source:e._options.security,retry_config:o?.retries||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:o?.retry_codes||["408","409","429","5XX"]},S=e._createRequest(C,{security:E,method:"PATCH",baseURL:o?.server_url,path:g,headers:f,query:_,body:h,userAgent:e._options.user_agent,timeout_ms:o?.timeout_ms||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let A=S.value,v=await e._do(A,{context:C,isErrorStatusCode:p(w=>pe({status:w},["4XX","5XX"]),"isErrorStatusCode"),retryConfig:C.retry_config,retryCodes:C.retry_codes});if(!v.ok)return[v,{status:"request-error",request:A}];let T=v.value,[I]=await _e(ne("4XX"),ne("5XX"),Ae("default"))(T,A);return I.ok?[I,{status:"complete",request:A,response:T}]:[I,{status:"complete",request:A,response:T}]}p(m_,"$do");var g_=class extends vt{static{p(this,"Webhooks")}list(e,t){return ve(ia(this,e?.api_version,e?.page_size,e?.page_token,t))}create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return ve(ta(this,n,r,t))}delete(e,t,r){return ve(ra(this,e,t?.api_version,r))}get(e,t,r){return ve(na(this,e,t?.api_version,r))}update(e,t,r){let n=t??{},{api_version:i,update_mask:o}=n,a=Oe(n,["api_version","update_mask"]),c=t===void 0||Object.keys(a).length===0?void 0:a;return ve(aa(this,e,i,o,c,r))}ping(e,t,r,n){return ve(oa(this,e,t,r,n))}rotateSigningSecret(e,t,r,n){return ve(sa(this,e,t,r,n))}},__=class extends vt{static{p(this,"GoogleGenAI$1")}get agents(){var e;return(e=this._agents)!==null&&e!==void 0?e:this._agents=new xg(this._options)}get environments(){var e;return(e=this._environments)!==null&&e!==void 0?e:this._environments=new qg(this._options)}get interactions(){var e;return(e=this._interactions)!==null&&e!==void 0?e:this._interactions=new e_(this._options)}get triggers(){var e;return(e=this._triggers)!==null&&e!==void 0?e:this._triggers=new l_(this._options)}get webhooks(){var e;return(e=this._webhooks)!==null&&e!==void 0?e:this._webhooks=new g_(this._options)}},y_=new Set(["lyria-3-pro-preview","lyria-3-clip-preview"]);function E_(e){let t=e.getBaseUrl();if(!t)throw new Error("Base URL must be set.");return t.replace(/\/+$/,"")}p(E_,"getGoogleGenAIServerURL");function v_(e){let t=I_(e.getApiVersion()),r=e.getProject(),n=e.getLocation();return e.isVertexAI()&&t&&r&&n?`${t}/projects/${encodeURIComponent(r)}/locations/${encodeURIComponent(n)}`:t}p(v_,"getGoogleGenAIAPIVersion");function je(e,t={}){var r,n,i,o,a;return new __(Object.assign(Object.assign({},t),{api_version:(r=t.api_version)!==null&&r!==void 0?r:v_(e),security:(n=t.security)!==null&&n!==void 0?n:new vm({defaultHeaders:Object.assign(Object.assign({},(i=e.getDefaultHeaders)===null||i===void 0?void 0:i.call(e)),(o=e.getHeaders)===null||o===void 0?void 0:o.call(e)),getAuthHeaders:p(c=>e.getAuthHeaders(c),"getAuthHeaders")}),server_url:(a=t.server_url)!==null&&a!==void 0?a:E_(e)}))}p(je,"buildGoogleGenAIClient");var T_=class{static{p(this,"GeminiNextGenInteractions")}constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);if(n.stream===!0){let o=await qr(()=>this.getClient(r).interactions.create(Object.assign(Object.assign({},n),{stream:!0,api_version:r}),he(t,!0)));return ua(o)}let i=await Ce(Ws(this.getClient(r),n,r,he(t)));return Br(i)}async get(e,t={},r){let{api_version:n,stream:i=!1,last_event_id:o,include_input:a}=t??{};if(i===!0){let u=await qr(()=>this.getClient(n).interactions.get(e,{stream:i,last_event_id:o,include_input:a,api_version:n},he(r,!0)));return ua(u)}let c=await Ce(Xs(this.getClient(n),e,n,a,o,i,he(r)));return Br(c)}async delete(e,t={},r){return qr(()=>this.getClient(t?.api_version).interactions.delete(e,{api_version:t?.api_version},he(r)))}async cancel(e,t={},r){return Br(await Ce(Js(this.getClient(t?.api_version),e,t?.api_version,he(r))))}getClient(e){var t;return e?je(this.parentClient,{api_version:e}):((t=this.sdk)!==null&&t!==void 0||(this.sdk=je(this.parentClient)),this.sdk)}},A_=class{static{p(this,"GeminiNextGenAgents")}constructor(e){this.parentClient=e}async create(e={},t){let r=e??{},{api_version:n}=r,i=Oe(r,["api_version"]);return Ce(Gs(this.getClient(n),i,n,he(t)))}async list(e={},t){let{api_version:r,pageSize:n,pageToken:i,parent:o}=e??{};return Ce(Fs(this.getClient(r),r,n,i,o,he(t)))}async get(e,t={},r){return Ce(Os(this.getClient(t?.api_version),e,t?.api_version,he(r)))}async delete(e,t={},r){return Ce(Ls(this.getClient(t?.api_version),e,t?.api_version,he(r)))}getClient(e){var t;return e?je(this.parentClient,{api_version:e}):((t=this.sdk)!==null&&t!==void 0||(this.sdk=je(this.parentClient)),this.sdk)}},C_=class{static{p(this,"GeminiNextGenWebhooks")}constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return Ce(ta(this.getClient(),n,r,he(t)))}async list(e={},t){let{api_version:r,page_size:n,page_token:i}=e??{};return Ce(ia(this.getClient(),r,n,i,he(t)))}async get(e,t={},r){return Ce(na(this.getClient(),e,t?.api_version,he(r)))}async update(e,t={},r){let n=t??{},{api_version:i,update_mask:o}=n,a=Oe(n,["api_version","update_mask"]);return Ce(aa(this.getClient(),e,i,o,a,he(r)))}async delete(e,t={},r){return Ce(ra(this.getClient(),e,t?.api_version,he(r)))}async rotateSigningSecret(e,t={},r){let n=t??{},{api_version:i}=n,o=Oe(n,["api_version"]);return Ce(sa(this.getClient(),e,i,o,he(r)))}async ping(e,t=void 0,r){let{api_version:n,body:i}=t??{};return Ce(oa(this.getClient(),e,n,i,he(r)))}getClient(){var e;return(e=this.sdk)!==null&&e!==void 0||(this.sdk=je(this.parentClient)),this.sdk}},S_=class{static{p(this,"GeminiNextGenTriggers")}constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return Ce(Ks(this.getClient(r),n,r,he(t)))}async list(e={},t){let{api_version:r,filter:n,pageSize:i,pageToken:o}=e??{};return Ce(Zs(this.getClient(r),r,n,i,o,he(t)))}async get(e,t={},r){return Ce(zs(this.getClient(t?.api_version),e,t?.api_version,he(r)))}async update(e,t,r){let{api_version:n}=t,i=Oe(t,["api_version"]);return Ce(ea(this.getClient(n),e,i,n,he(r)))}async delete(e,t={},r){return Ce(Ys(this.getClient(t?.api_version),e,t?.api_version,he(r)))}async run(e,t={},r){return Ce(js(this.getClient(t?.api_version),e,t?.api_version,he(r)))}async listExecutions(e,t={},r){let{api_version:n,pageSize:i,pageToken:o}=t??{};return Ce(Qs(this.getClient(n),e,n,i,o,he(r)))}getClient(e){var t;return e?je(this.parentClient,{api_version:e}):((t=this.sdk)!==null&&t!==void 0||(this.sdk=je(this.parentClient)),this.sdk)}};function I_(e){return e.replace(/^\/+|\/+$/g,"")}p(I_,"trimSlashes");function he(e,t=!1){var r,n,i,o;if(!e&&!t)return;let a=e??{},{timeout:c,maxRetries:u,defaultBaseURL:d,query:h,body:m,fetchOptions:g}=a,_=Oe(a,["timeout","maxRetries","defaultBaseURL","query","body","fetchOptions"]),f=Object.assign({},_);mr(h)?f.extra_query=h:la("query",h),mr(m)?f.extra_body=m:la("body",m);let y=(r=_.fetch_options)!==null&&r!==void 0?r:g;y&&(f.fetch_options=y);let E=(n=_.server_url)!==null&&n!==void 0?n:d;E&&(f.server_url=E);let C=(i=_.timeout_ms)!==null&&i!==void 0?i:c;if(C!==void 0&&(f.timeout_ms=C),u!==void 0&&(f.retries={strategy:"attempt-count-backoff",retryConnectionErrors:!0,maxRetries:u}),t){let S=new Headers((o=f.headers)!==null&&o!==void 0?o:y?.headers);S.set("Accept","text/event-stream"),f.headers=S}return f}p(he,"toGoogleGenAIRequestOptions");function la(e,t){t!=null&&console.warn(`GoogleGenAI.interactions: request option ${e} is not supported by the Google GenAI interactions bridge and will be ignored.`)}p(la,"warnIgnoredOption");async function Ce(e){let[t,r]=await e.$inspect();if(!t.ok)throw Gt(t.error);return w_(t.value,r)}p(Ce,"unwrapWithSdkHttpResponse");async function qr(e){try{return await e()}catch(t){throw Gt(t)}}p(qr,"wrapSDKCall");function ua(e){let t=e;return new Proxy(e,{get(r,n){if(n!==Symbol.asyncIterator){let i=Reflect.get(r,n,r);return typeof i=="function"?i.bind(r):i}return function(){let i=t[Symbol.asyncIterator]();return{async next(...o){try{return await i.next(...o)}catch(a){throw Gt(a)}},async return(o){if(!i.return)return{done:!0,value:o};try{return await i.return(o)}catch(a){throw Gt(a)}},async throw(o){if(!i.throw)throw Gt(o);try{return await i.throw(o)}catch(a){throw Gt(a)}},[Symbol.asyncIterator](){return this}}}}})}p(ua,"wrapStreamErrors");function w_(e,t){return!mr(e)||t.status!=="complete"?e:Object.assign(Object.assign({},e),{sdkHttpResponse:R_(t.response,e)})}p(w_,"attachSdkHttpResponse");function R_(e,t){let r={};for(let[n,i]of e.headers.entries())r[n]=i;return{headers:r,responseInternal:e,json:p(async()=>t,"json")}}p(R_,"createSdkHttpResponse");function Br(e){let t=P_(e);return t?k_(t):e}p(Br,"addOutputPropertiesIfInteraction");function P_(e){if(mr(e)){if(Array.isArray(e.steps))return e;if(N_(e)){let t=e.outputs;if(Array.isArray(t)){let{outputs:r}=e,n=Oe(e,["outputs"]);return Object.assign(Object.assign({},n),{steps:[{type:"model_output",content:t}]})}}return Object.assign(Object.assign({},e),{steps:[]})}}p(P_,"normalizeInteractionShape");function N_(e){let t=e.model;return typeof t=="string"&&y_.has(t)}p(N_,"isLegacyLyriaInteraction");function mr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}p(mr,"isPlainObject");function k_(e){var t,r;let n=D_(e),i=(t=n.steps)!==null&&t!==void 0?t:[],o=[],a=!1;e:for(let m=i.length-1;m>=0;m--){let g=i[m];if(g.type==="user_input")break;if(g.type!=="model_output"||!g.content){if(a)break;continue}let _=g.content;for(let f=_.length-1;f>=0;f--){let y=_[f];if(y.type==="text")a=!0,o.push((r=y.text)!==null&&r!==void 0?r:"");else if(a)break e}}let c,u,d;for(let m=i.length-1;m>=0;m--){let g=i[m];if(g.type==="user_input")break;if(g.type==="model_output"&&g.content)for(let _=g.content.length-1;_>=0;_--){let f=g.content[_];f.type==="image"&&!c&&(c=f),f.type==="audio"&&!u&&(u=f),f.type==="video"&&!d&&(d=f)}}let h=o.reverse().join("");return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),h&&{output_text:h}),c?{output_image:c}:{}),u?{output_audio:u}:{}),d?{output_video:d}:{})}p(k_,"addOutputProperties");function D_(e){return Object.assign(Object.assign({},e),{created:da(e.created),updated:da(e.updated)})}p(D_,"normalizeInteractionDates");function da(e){return e instanceof Date?e.toISOString():e}p(da,"normalizeDateLike");var M_=class{static{p(this,"GeminiNextGenEnvironmentFiles")}constructor(e){this.resolveClient=e}async list(e,t){let{environment:r,path:n,page_size:i,page_token:o,recursive:a,api_version:c}=e;return Ce($s(this.resolveClient(c),r,n,c,i,o,a,he(t)))}},x_=class{static{p(this,"GeminiNextGenEnvironments")}constructor(e){this.parentClient=e,this.files=new M_(t=>this.getClient(t))}async create(e,t){let{api_version:r}=e,n=Oe(e,["api_version"]);return Ce(qs(this.getClient(r),n,r,he(t)))}async list(e={},t){let{api_version:r,page_size:n,page_token:i}=e??{};return Ce(Vs(this.getClient(r),r,n,i,he(t)))}async get(e,t={},r){return Ce(Hs(this.getClient(t?.api_version),e,t?.api_version,he(r)))}async delete(e,t={},r){return Ce(Bs(this.getClient(t?.api_version),e,t?.api_version,he(r)))}getClient(e){var t;return e?je(this.parentClient,{api_version:e}):((t=this.sdk)!==null&&t!==void 0||(this.sdk=je(this.parentClient)),this.sdk)}},ca="x-goog-api-key",Yt="https://www.googleapis.com/auth/cloud-platform",b_=class{static{p(this,"NodeAuth")}constructor(e){if(e.apiKey!==void 0){this.apiKey=e.apiKey;return}let t=U_(e.googleAuthOptions);this.googleAuth=new Gl.GoogleAuth(t)}async addAuthHeaders(e,t){if(this.apiKey!==void 0){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");this.addKeyHeader(e);return}return this.addGoogleAuthHeaders(e,t)}addKeyHeader(e){if(e.get(ca)===null){if(this.apiKey===void 0)throw new Error("Trying to set API key header but apiKey is not set");e.append(ca,this.apiKey)}}async addGoogleAuthHeaders(e,t){if(this.googleAuth===void 0)throw new Error("Trying to set google-auth headers but googleAuth is unset");let r=await this.googleAuth.getRequestHeaders(t);for(let[n,i]of r)e.get(n)===null&&e.append(n,i)}};function U_(e){let t;if(e){if(t=e,t.scopes){if(typeof t.scopes=="string"&&t.scopes!==Yt||Array.isArray(t.scopes)&&t.scopes.indexOf(Yt)<0)throw new Error(`Invalid auth scopes. Scopes must include: ${Yt}`)}else return t.scopes=[Yt],t;return t}else return t={scopes:[Yt]},t}p(U_,"buildGoogleAuthOptions");var G_=class{static{p(this,"NodeDownloader")}async download(e,t){if(e.downloadPath){let r=await L_(e,t);if(r instanceof Rt){let n=Ll(e.downloadPath);Fl.fromWeb(r.responseInternal.body).pipe(n),await ql(n)}else try{await Ol(e.downloadPath,r,{encoding:"base64"})}catch(n){throw new Error(`Failed to write file to ${e.downloadPath}: ${n}`)}}}};async function L_(e,t){var r,n,i;let o=Mr(e.file);if(o!==void 0)return await t.request({path:`files/${o}: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});if(vo(e.file)){let a=(i=e.file.video)===null||i===void 0?void 0:i.videoBytes;if(typeof a=="string")return a;throw new Error("Failed to download generated video, Uri or videoBytes not found.")}else if(To(e.file)){let a=e.file.videoBytes;if(typeof a=="string")return a;throw new Error("Failed to download video, Uri or videoBytes not found.")}else throw new Error("Unsupported file type")}p(L_,"downloadFile");var O_=class{static{p(this,"NodeWebSocketFactory")}create(e,t,r){return new F_(e,t,r)}},F_=class{static{p(this,"NodeWebSocket")}constructor(e,t,r){this.url=e,this.headers=t,this.callbacks=r}connect(){this.ws=new Bl.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 new Error("WebSocket is not connected");this.ws.send(e)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}};function q_(e,t){let r={},n=s(e,["name"]);return n!=null&&l(r,["_url","name"],n),r}p(q_,"cancelTuningJobParametersToMldev");function B_(e,t){let r={},n=s(e,["name"]);return n!=null&&l(r,["_url","name"],n),r}p(B_,"cancelTuningJobParametersToVertex");function H_(e,t){let r={},n=s(e,["sdkHttpResponse"]);return n!=null&&l(r,["sdkHttpResponse"],n),r}p(H_,"cancelTuningJobResponseFromMldev");function V_(e,t){let r={},n=s(e,["sdkHttpResponse"]);return n!=null&&l(r,["sdkHttpResponse"],n),r}p(V_,"cancelTuningJobResponseFromVertex");function Hr(e,t){let r={},n=s(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(a=>ry(a))),l(r,["parts"],o)}let i=s(e,["role"]);return i!=null&&l(r,["role"],i),r}p(Hr,"contentToVertex");function $_(e,t,r){let n={};if(s(e,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let i=s(e,["tunedModelDisplayName"]);if(t!==void 0&&i!=null&&l(t,["displayName"],i),s(e,["description"])!==void 0)throw new Error("description parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let o=s(e,["epochCount"]);t!==void 0&&o!=null&&l(t,["tuningTask","hyperparameters","epochCount"],o);let a=s(e,["learningRateMultiplier"]);if(a!=null&&l(n,["tuningTask","hyperparameters","learningRateMultiplier"],a),s(e,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["tuningMode"])!==void 0)throw new Error("tuningMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["customBaseModel"])!==void 0)throw new Error("customBaseModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=s(e,["batchSize"]);t!==void 0&&c!=null&&l(t,["tuningTask","hyperparameters","batchSize"],c);let u=s(e,["learningRate"]);if(t!==void 0&&u!=null&&l(t,["tuningTask","hyperparameters","learningRate"],u),s(e,["labels"])!==void 0)throw new Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["beta"])!==void 0)throw new Error("beta parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["baseTeacherModel"])!==void 0)throw new Error("baseTeacherModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["tunedTeacherModelSource"])!==void 0)throw new Error("tunedTeacherModelSource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["sftLossWeightMultiplier"])!==void 0)throw new Error("sftLossWeightMultiplier parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["outputUri"])!==void 0)throw new Error("outputUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["rewardConfig"])!==void 0)throw new Error("rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["compositeRewardConfig"])!==void 0)throw new Error("compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["samplesPerPrompt"])!==void 0)throw new Error("samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["evaluateInterval"])!==void 0)throw new Error("evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["checkpointInterval"])!==void 0)throw new Error("checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["maxOutputTokens"])!==void 0)throw new Error("maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["thinkingLevel"])!==void 0)throw new Error("thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["validationDatasetUri"])!==void 0)throw new Error("validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["encryptionSpec"])!==void 0)throw new Error("encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}p($_,"createTuningJobConfigToMldev");function J_(e,t,r){let n={},i=s(r,["config","method"]);if(i===void 0&&(i="SUPERVISED_FINE_TUNING"),i==="SUPERVISED_FINE_TUNING"){let L=s(e,["validationDataset"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec"],gr(L))}else if(i==="PREFERENCE_TUNING"){let L=s(e,["validationDataset"]);t!==void 0&&L!=null&&l(t,["preferenceOptimizationSpec"],gr(L))}else if(i==="DISTILLATION"){let L=s(e,["validationDataset"]);t!==void 0&&L!=null&&l(t,["distillationSpec"],gr(L))}else if(i==="REINFORCEMENT_TUNING"){let L=s(e,["validationDataset"]);t!==void 0&&L!=null&&l(t,["reinforcementTuningSpec"],gr(L))}let o=s(e,["tunedModelDisplayName"]);t!==void 0&&o!=null&&l(t,["tunedModelDisplayName"],o);let a=s(e,["description"]);t!==void 0&&a!=null&&l(t,["description"],a);let c=s(r,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){let L=s(e,["epochCount"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","hyperParameters","epochCount"],L)}else if(c==="PREFERENCE_TUNING"){let L=s(e,["epochCount"]);t!==void 0&&L!=null&&l(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],L)}else if(c==="DISTILLATION"){let L=s(e,["epochCount"]);t!==void 0&&L!=null&&l(t,["distillationSpec","hyperParameters","epochCount"],L)}else if(c==="REINFORCEMENT_TUNING"){let L=s(e,["epochCount"]);t!==void 0&&L!=null&&l(t,["reinforcementTuningSpec","hyperParameters","epochCount"],L)}let u=s(r,["config","method"]);if(u===void 0&&(u="SUPERVISED_FINE_TUNING"),u==="SUPERVISED_FINE_TUNING"){let L=s(e,["learningRateMultiplier"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],L)}else if(u==="PREFERENCE_TUNING"){let L=s(e,["learningRateMultiplier"]);t!==void 0&&L!=null&&l(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],L)}else if(u==="DISTILLATION"){let L=s(e,["learningRateMultiplier"]);t!==void 0&&L!=null&&l(t,["distillationSpec","hyperParameters","learningRateMultiplier"],L)}else if(u==="REINFORCEMENT_TUNING"){let L=s(e,["learningRateMultiplier"]);t!==void 0&&L!=null&&l(t,["reinforcementTuningSpec","hyperParameters","learningRateMultiplier"],L)}let d=s(r,["config","method"]);if(d===void 0&&(d="SUPERVISED_FINE_TUNING"),d==="SUPERVISED_FINE_TUNING"){let L=s(e,["exportLastCheckpointOnly"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","exportLastCheckpointOnly"],L)}else if(d==="PREFERENCE_TUNING"){let L=s(e,["exportLastCheckpointOnly"]);t!==void 0&&L!=null&&l(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],L)}else if(d==="DISTILLATION"){let L=s(e,["exportLastCheckpointOnly"]);t!==void 0&&L!=null&&l(t,["distillationSpec","exportLastCheckpointOnly"],L)}let h=s(r,["config","method"]);if(h===void 0&&(h="SUPERVISED_FINE_TUNING"),h==="SUPERVISED_FINE_TUNING"){let L=s(e,["adapterSize"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","hyperParameters","adapterSize"],L)}else if(h==="PREFERENCE_TUNING"){let L=s(e,["adapterSize"]);t!==void 0&&L!=null&&l(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],L)}else if(h==="DISTILLATION"){let L=s(e,["adapterSize"]);t!==void 0&&L!=null&&l(t,["distillationSpec","hyperParameters","adapterSize"],L)}else if(h==="REINFORCEMENT_TUNING"){let L=s(e,["adapterSize"]);t!==void 0&&L!=null&&l(t,["reinforcementTuningSpec","hyperParameters","adapterSize"],L)}let m=s(r,["config","method"]);if(m===void 0&&(m="SUPERVISED_FINE_TUNING"),m==="SUPERVISED_FINE_TUNING"){let L=s(e,["tuningMode"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","tuningMode"],L)}else if(m==="DISTILLATION"){let L=s(e,["tuningMode"]);t!==void 0&&L!=null&&l(t,["distillationSpec","tuningMode"],L)}let g=s(e,["customBaseModel"]);t!==void 0&&g!=null&&l(t,["customBaseModel"],g);let _=s(r,["config","method"]);if(_===void 0&&(_="SUPERVISED_FINE_TUNING"),_==="SUPERVISED_FINE_TUNING"){let L=s(e,["batchSize"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","hyperParameters","batchSize"],L)}else if(_==="DISTILLATION"){let L=s(e,["batchSize"]);t!==void 0&&L!=null&&l(t,["distillationSpec","hyperParameters","batchSize"],L)}else if(_==="REINFORCEMENT_TUNING"){let L=s(e,["batchSize"]);t!==void 0&&L!=null&&l(t,["reinforcementTuningSpec","hyperParameters","batchSize"],L)}let f=s(r,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){let L=s(e,["learningRate"]);t!==void 0&&L!=null&&l(t,["supervisedTuningSpec","hyperParameters","learningRate"],L)}else if(f==="DISTILLATION"){let L=s(e,["learningRate"]);t!==void 0&&L!=null&&l(t,["distillationSpec","hyperParameters","learningRate"],L)}let y=s(e,["labels"]);t!==void 0&&y!=null&&l(t,["labels"],y);let E=s(e,["beta"]);t!==void 0&&E!=null&&l(t,["preferenceOptimizationSpec","hyperParameters","beta"],E);let C=s(e,["baseTeacherModel"]);t!==void 0&&C!=null&&l(t,["distillationSpec","baseTeacherModel"],C);let S=s(e,["tunedTeacherModelSource"]);t!==void 0&&S!=null&&l(t,["distillationSpec","tunedTeacherModelSource"],S);let A=s(e,["sftLossWeightMultiplier"]);t!==void 0&&A!=null&&l(t,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],A);let v=s(e,["outputUri"]);t!==void 0&&v!=null&&l(t,["outputUri"],v);let T=s(e,["rewardConfig"]);t!==void 0&&T!=null&&l(t,["reinforcementTuningSpec","singleRewardConfig"],T);let I=s(e,["compositeRewardConfig"]);t!==void 0&&I!=null&&l(t,["reinforcementTuningSpec","compositeRewardConfig"],I);let w=s(e,["samplesPerPrompt"]);t!==void 0&&w!=null&&l(t,["reinforcementTuningSpec","hyperParameters","samplesPerPrompt"],w);let k=s(e,["evaluateInterval"]);t!==void 0&&k!=null&&l(t,["reinforcementTuningSpec","hyperParameters","evaluateInterval"],k);let R=s(e,["checkpointInterval"]);t!==void 0&&R!=null&&l(t,["reinforcementTuningSpec","hyperParameters","checkpointInterval"],R);let M=s(e,["maxOutputTokens"]);t!==void 0&&M!=null&&l(t,["reinforcementTuningSpec","hyperParameters","maxOutputTokens"],M);let D=s(e,["thinkingLevel"]);t!==void 0&&D!=null&&l(t,["reinforcementTuningSpec","hyperParameters","thinkingLevel"],D);let J=s(e,["validationDatasetUri"]);t!==void 0&&J!=null&&l(t,["reinforcementTuningSpec","validationDatasetUri"],J);let O=s(e,["encryptionSpec"]);return t!==void 0&&O!=null&&l(t,["encryptionSpec"],O),n}p(J_,"createTuningJobConfigToVertex");function W_(e,t){let r={},n=s(e,["baseModel"]);n!=null&&l(r,["baseModel"],n);let i=s(e,["preTunedModel"]);i!=null&&l(r,["preTunedModel"],i);let o=s(e,["trainingDataset"]);o!=null&&oy(o);let a=s(e,["config"]);return a!=null&&$_(a,r),r}p(W_,"createTuningJobParametersPrivateToMldev");function X_(e,t){let r={},n=s(e,["baseModel"]);n!=null&&l(r,["baseModel"],n);let i=s(e,["preTunedModel"]);i!=null&&l(r,["preTunedModel"],i);let o=s(e,["trainingDataset"]);o!=null&&sy(o,r,t);let a=s(e,["config"]);return a!=null&&J_(a,r,t),r}p(X_,"createTuningJobParametersPrivateToVertex");function pa(e,t){let r={},n=s(e,["epochCount"]);n!=null&&l(r,["epochCount"],n);let i=s(e,["learningRateMultiplier"]);i!=null&&l(r,["learningRateMultiplier"],i);let o=s(e,["adapterSize"]);o!=null&&l(r,["adapterSize"],o);let a=s(e,["batchSize"]);a!=null&&l(r,["batchSize"],a);let c=s(e,["learningRate"]);c!=null&&l(r,["learningRate"],c);let u=s(e,["generationConfig"]);return u!=null&&l(r,["generationConfig"],z_(u)),r}p(pa,"distillationHyperParametersFromVertex");function K_(e,t){let r={},n=s(e,["promptDatasetUri"]);n!=null&&l(r,["promptDatasetUri"],n);let i=s(e,["validationDatasetUri"]);i!=null&&l(r,["validationDatasetUri"],i);let o=s(e,["baseTeacherModel"]);o!=null&&l(r,["baseTeacherModel"],o);let a=s(e,["tunedTeacherModelSource"]);a!=null&&l(r,["tunedTeacherModelSource"],a);let c=s(e,["hyperparameters"]);return c!=null&&l(r,["hyperparameters"],pa(c)),r}p(K_,"distillationSamplingSpecFromVertex");function Y_(e,t){let r={},n=s(e,["baseTeacherModel"]);n!=null&&l(r,["baseTeacherModel"],n);let i=s(e,["hyperParameters"]);i!=null&&l(r,["hyperParameters"],pa(i));let o=s(e,["pipelineRootDirectory"]);o!=null&&l(r,["pipelineRootDirectory"],o);let a=s(e,["promptDatasetUri"]);a!=null&&l(r,["promptDatasetUri"],a);let c=s(e,["studentModel"]);c!=null&&l(r,["studentModel"],c);let u=s(e,["trainingDatasetUri"]);u!=null&&l(r,["trainingDatasetUri"],u);let d=s(e,["tunedTeacherModelSource"]);d!=null&&l(r,["tunedTeacherModelSource"],d);let h=s(e,["tuningMode"]);h!=null&&l(r,["tuningMode"],h);let m=s(e,["validationDatasetUri"]);return m!=null&&l(r,["validationDatasetUri"],m),r}p(Y_,"distillationSpecFromVertex");function z_(e,t){let r={},n=s(e,["modelConfig"]);n!=null&&l(r,["modelSelectionConfig"],n);let i=s(e,["responseJsonSchema"]);i!=null&&l(r,["responseJsonSchema"],i);let o=s(e,["audioTranscriptionConfig"]);o!=null&&l(r,["audioTranscriptionConfig"],o);let a=s(e,["audioTimestamp"]);a!=null&&l(r,["audioTimestamp"],a);let c=s(e,["candidateCount"]);c!=null&&l(r,["candidateCount"],c);let u=s(e,["enableAffectiveDialog"]);u!=null&&l(r,["enableAffectiveDialog"],u);let d=s(e,["frequencyPenalty"]);d!=null&&l(r,["frequencyPenalty"],d);let h=s(e,["logprobs"]);h!=null&&l(r,["logprobs"],h);let m=s(e,["maxOutputTokens"]);m!=null&&l(r,["maxOutputTokens"],m);let g=s(e,["mediaResolution"]);g!=null&&l(r,["mediaResolution"],g);let _=s(e,["presencePenalty"]);_!=null&&l(r,["presencePenalty"],_);let f=s(e,["responseFormat"]);if(f!=null){let D=f;Array.isArray(D)&&(D=D.map(J=>J)),l(r,["responseFormat"],D)}let y=s(e,["responseLogprobs"]);y!=null&&l(r,["responseLogprobs"],y);let E=s(e,["responseMimeType"]);E!=null&&l(r,["responseMimeType"],E);let C=s(e,["responseModalities"]);C!=null&&l(r,["responseModalities"],C);let S=s(e,["responseSchema"]);S!=null&&l(r,["responseSchema"],S);let A=s(e,["routingConfig"]);A!=null&&l(r,["routingConfig"],A);let v=s(e,["seed"]);v!=null&&l(r,["seed"],v);let T=s(e,["speechConfig"]);T!=null&&l(r,["speechConfig"],T);let I=s(e,["stopSequences"]);I!=null&&l(r,["stopSequences"],I);let w=s(e,["temperature"]);w!=null&&l(r,["temperature"],w);let k=s(e,["thinkingConfig"]);k!=null&&l(r,["thinkingConfig"],k);let R=s(e,["topK"]);R!=null&&l(r,["topK"],R);let M=s(e,["topP"]);return M!=null&&l(r,["topP"],M),r}p(z_,"generationConfigFromVertex");function Q_(e,t){let r={},n=s(e,["name"]);return n!=null&&l(r,["_url","name"],n),r}p(Q_,"getTuningJobParametersToMldev");function Z_(e,t){let r={},n=s(e,["name"]);return n!=null&&l(r,["_url","name"],n),r}p(Z_,"getTuningJobParametersToVertex");function j_(e,t,r){let n={},i=s(e,["pageSize"]);t!==void 0&&i!=null&&l(t,["_query","pageSize"],i);let o=s(e,["pageToken"]);t!==void 0&&o!=null&&l(t,["_query","pageToken"],o);let a=s(e,["filter"]);return t!==void 0&&a!=null&&l(t,["_query","filter"],a),n}p(j_,"listTuningJobsConfigToVertex");function ey(e,t){let r={},n=s(e,["config"]);return n!=null&&j_(n,r),r}p(ey,"listTuningJobsParametersToVertex");function ty(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["nextPageToken"]);i!=null&&l(r,["nextPageToken"],i);let o=s(e,["tuningJobs"]);if(o!=null){let a=o;Array.isArray(a)&&(a=a.map(c=>Vr(c))),l(r,["tuningJobs"],a)}return r}p(ty,"listTuningJobsResponseFromVertex");function ry(e,t){let r={},n=s(e,["mediaResolution"]);if(n!=null&&l(r,["mediaResolution"],n),s(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(s(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let i=s(e,["audioTranscription"]);i!=null&&l(r,["audioTranscription"],i);let o=s(e,["codeExecutionResult"]);o!=null&&l(r,["codeExecutionResult"],o);let a=s(e,["executableCode"]);a!=null&&l(r,["executableCode"],a);let c=s(e,["fileData"]);c!=null&&l(r,["fileData"],c);let u=s(e,["functionCall"]);u!=null&&l(r,["functionCall"],u);let d=s(e,["functionResponse"]);d!=null&&l(r,["functionResponse"],d);let h=s(e,["inlineData"]);h!=null&&l(r,["inlineData"],h);let m=s(e,["text"]);m!=null&&l(r,["text"],m);let g=s(e,["thought"]);g!=null&&l(r,["thought"],g);let _=s(e,["thoughtSignature"]);_!=null&&l(r,["thoughtSignature"],_);let f=s(e,["videoMetadata"]);if(f!=null&&l(r,["videoMetadata"],f),s(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let y=s(e,["mediaProcessing"]);return y!=null&&l(r,["mediaProcessing"],y),r}p(ry,"partToVertex");function ny(e,t){let r={},n=s(e,["references"]);n!=null&&l(r,["references"],n);let i=s(e,["contents"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(c=>Hr(c))),l(r,["contents"],a)}let o=s(e,["systemInstruction"]);return o!=null&&l(r,["systemInstruction"],Hr(o)),r}p(ny,"reinforcementTuningExampleToVertex");function iy(e,t){let r={},n=s(e,["name"]);n!=null&&l(r,["model"],n);let i=s(e,["name"]);return i!=null&&l(r,["endpoint"],i),r}p(iy,"tunedModelFromMldev");function oy(e,t){let r={};if(s(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(s(e,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=s(e,["examples"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),l(r,["examples","examples"],i)}return r}p(oy,"tuningDatasetToMldev");function sy(e,t,r){let n={},i=s(r,["config","method"]);if(i===void 0&&(i="SUPERVISED_FINE_TUNING"),i==="SUPERVISED_FINE_TUNING"){let a=s(e,["gcsUri"]);t!==void 0&&a!=null&&l(t,["supervisedTuningSpec","trainingDatasetUri"],a)}else if(i==="PREFERENCE_TUNING"){let a=s(e,["gcsUri"]);t!==void 0&&a!=null&&l(t,["preferenceOptimizationSpec","trainingDatasetUri"],a)}else if(i==="DISTILLATION"){let a=s(e,["gcsUri"]);t!==void 0&&a!=null&&l(t,["distillationSpec","promptDatasetUri"],a)}else if(i==="REINFORCEMENT_TUNING"){let a=s(e,["gcsUri"]);t!==void 0&&a!=null&&l(t,["reinforcementTuningSpec","trainingDatasetUri"],a)}let o=s(r,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){let a=s(e,["vertexDatasetResource"]);t!==void 0&&a!=null&&l(t,["supervisedTuningSpec","trainingDatasetUri"],a)}else if(o==="PREFERENCE_TUNING"){let a=s(e,["vertexDatasetResource"]);t!==void 0&&a!=null&&l(t,["preferenceOptimizationSpec","trainingDatasetUri"],a)}else if(o==="DISTILLATION"){let a=s(e,["vertexDatasetResource"]);t!==void 0&&a!=null&&l(t,["distillationSpec","promptDatasetUri"],a)}else if(o==="REINFORCEMENT_TUNING"){let a=s(e,["vertexDatasetResource"]);t!==void 0&&a!=null&&l(t,["reinforcementTuningSpec","trainingDatasetUri"],a)}if(s(e,["examples"])!==void 0)throw new Error("examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return n}p(sy,"tuningDatasetToVertex");function ay(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["name"]);i!=null&&l(r,["name"],i);let o=s(e,["state"]);o!=null&&l(r,["state"],Eo(o));let a=s(e,["createTime"]);a!=null&&l(r,["createTime"],a);let c=s(e,["tuningTask","startTime"]);c!=null&&l(r,["startTime"],c);let u=s(e,["tuningTask","completeTime"]);u!=null&&l(r,["endTime"],u);let d=s(e,["updateTime"]);d!=null&&l(r,["updateTime"],d);let h=s(e,["description"]);h!=null&&l(r,["description"],h);let m=s(e,["baseModel"]);m!=null&&l(r,["baseModel"],m);let g=s(e,["_self"]);return g!=null&&l(r,["tunedModel"],iy(g)),r}p(ay,"tuningJobFromMldev");function Vr(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["name"]);i!=null&&l(r,["name"],i);let o=s(e,["state"]);o!=null&&l(r,["state"],Eo(o));let a=s(e,["createTime"]);a!=null&&l(r,["createTime"],a);let c=s(e,["startTime"]);c!=null&&l(r,["startTime"],c);let u=s(e,["endTime"]);u!=null&&l(r,["endTime"],u);let d=s(e,["updateTime"]);d!=null&&l(r,["updateTime"],d);let h=s(e,["error"]);h!=null&&l(r,["error"],h);let m=s(e,["description"]);m!=null&&l(r,["description"],m);let g=s(e,["baseModel"]);g!=null&&l(r,["baseModel"],g);let _=s(e,["tunedModel"]);_!=null&&l(r,["tunedModel"],_);let f=s(e,["preTunedModel"]);f!=null&&l(r,["preTunedModel"],f);let y=s(e,["supervisedTuningSpec"]);y!=null&&l(r,["supervisedTuningSpec"],y);let E=s(e,["preferenceOptimizationSpec"]);E!=null&&l(r,["preferenceOptimizationSpec"],E);let C=s(e,["distillationSamplingSpec"]);C!=null&&l(r,["distillationSamplingSpec"],K_(C));let S=s(e,["distillationSpec"]);S!=null&&l(r,["distillationSpec"],Y_(S));let A=s(e,["reinforcementTuningSpec"]);A!=null&&l(r,["reinforcementTuningSpec"],A);let v=s(e,["tuningDataStats"]);v!=null&&l(r,["tuningDataStats"],v);let T=s(e,["encryptionSpec"]);T!=null&&l(r,["encryptionSpec"],T);let I=s(e,["partnerModelTuningSpec"]);I!=null&&l(r,["partnerModelTuningSpec"],I);let w=s(e,["customBaseModel"]);w!=null&&l(r,["customBaseModel"],w);let k=s(e,["evaluateDatasetRuns"]);if(k!=null){let oe=k;Array.isArray(oe)&&(oe=oe.map(Re=>Re)),l(r,["evaluateDatasetRuns"],oe)}let R=s(e,["experiment"]);R!=null&&l(r,["experiment"],R);let M=s(e,["fullFineTuningSpec"]);M!=null&&l(r,["fullFineTuningSpec"],M);let D=s(e,["labels"]);D!=null&&l(r,["labels"],D);let J=s(e,["outputUri"]);J!=null&&l(r,["outputUri"],J);let O=s(e,["pipelineJob"]);O!=null&&l(r,["pipelineJob"],O);let L=s(e,["serviceAccount"]);L!=null&&l(r,["serviceAccount"],L);let B=s(e,["tunedModelDisplayName"]);B!=null&&l(r,["tunedModelDisplayName"],B);let X=s(e,["tuningJobMetadata"]);X!=null&&l(r,["tuningJobMetadata"],X);let Y=s(e,["tuningJobState"]);Y!=null&&l(r,["tuningJobState"],Y);let j=s(e,["veoLoraTuningSpec"]);j!=null&&l(r,["veoLoraTuningSpec"],j);let ie=s(e,["veoTuningSpec"]);return ie!=null&&l(r,["veoTuningSpec"],ie),r}p(Vr,"tuningJobFromVertex");function ly(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["name"]);i!=null&&l(r,["name"],i);let o=s(e,["metadata"]);o!=null&&l(r,["metadata"],o);let a=s(e,["done"]);a!=null&&l(r,["done"],a);let c=s(e,["error"]);return c!=null&&l(r,["error"],c),r}p(ly,"tuningOperationFromMldev");function gr(e,t){let r={},n=s(e,["gcsUri"]);n!=null&&l(r,["validationDatasetUri"],n);let i=s(e,["vertexDatasetResource"]);return i!=null&&l(r,["validationDatasetUri"],i),r}p(gr,"tuningValidationDatasetToVertex");function uy(e,t){let r={},n=s(e,["parent"]);n!=null&&l(r,["_url","parent"],n);let i=s(e,["sampleResponse"]);i!=null&&l(r,["sampleResponse"],Hr(i));let o=s(e,["example"]);o!=null&&l(r,["example"],ny(o));let a=s(e,["singleRewardConfig"]);a!=null&&l(r,["singleRewardConfig"],a);let c=s(e,["compositeRewardConfig"]);return c!=null&&l(r,["compositeRewardConfig"],c),r}p(uy,"validateRewardParametersToVertex");function dy(e,t){let r={},n=s(e,["sdkHttpResponse"]);n!=null&&l(r,["sdkHttpResponse"],n);let i=s(e,["overallReward"]);i!=null&&l(r,["overallReward"],i);let o=s(e,["error"]);o!=null&&l(r,["error"],o);let a=s(e,["rewardInfoDetails"]);return a!=null&&l(r,["rewardInfoDetails"],a),r}p(dy,"validateRewardResponseFromVertex");var cy=class extends rt{static{p(this,"Tunings")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Et(it.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};!((r=t.config)===null||r===void 0)&&r.preTunedModelCheckpointId&&(n.checkpointId=t.config.preTunedModelCheckpointId);let i=Object.assign(Object.assign({},t),{preTunedModel:n});return i.baseModel=void 0,await this.tuneInternal(i)}else{let n=Object.assign({},t);return await this.tuneInternal(n)}else{let n=Object.assign({},t),i=await this.tuneMldevInternal(n),o="";return i.metadata!==void 0&&i.metadata.tunedModel!==void 0?o=i.metadata.tunedModel:i.name!==void 0&&i.name.includes("/operations/")&&(o=i.name.split("/operations/")[0]),{name:o,state:wr.JOB_STATE_QUEUED}}}}async getInternal(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=Z_(e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>Vr(d))}else{let u=Q_(e);return a=ee("{name}",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>ay(d))}}async listInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI()){let a=ey(e);return i=ee("tuningJobs",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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 d=u;return d.sdkHttpResponse={headers:c.headers},d})),n.then(c=>{let u=ty(c),d=new fu;return Object.assign(d,u),d})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(e){var t,r,n,i;let o,a="",c={};if(this.apiClient.isVertexAI()){let u=B_(e);return a=ee("{name}:cancel",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),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(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=V_(d),m=new oo;return Object.assign(m,h),m})}else{let u=q_(e);return a=ee("{name}:cancel",u._url),c=u._query,delete u._url,delete u._query,o=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json().then(h=>{let m=h;return m.sdkHttpResponse={headers:d.headers},m})),o.then(d=>{let h=H_(d),m=new oo;return Object.assign(m,h),m})}}async tuneInternal(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI()){let a=X_(e,e);return i=ee("tuningJobs",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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 d=u;return d.sdkHttpResponse={headers:c.headers},d})),n.then(c=>Vr(c))}else throw new 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,i="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let a=W_(e);return i=ee("tunedModels",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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 d=u;return d.sdkHttpResponse={headers:c.headers},d})),n.then(c=>ly(c))}}async validateReward(e){var t,r;let n,i="",o={};if(this.apiClient.isVertexAI()){let a=uy(e);return i=ee("{parent}/tuningJobs:validateReinforcementTuningReward",a._url),o=a._query,delete a._url,delete a._query,n=this.apiClient.request({path:i,queryParams:o,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 d=u;return d.sdkHttpResponse={headers:c.headers},d})),n.then(c=>{let u=dy(c),d=new mu;return Object.assign(d,u),d})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}},ha=1024*1024*8,fa=3,ma=1e3,ga=2,pt="x-goog-upload-status";async function py(e,t,r,n){var i;let o=await _a(e,t,r,n),a=await o?.json();if(((i=o?.headers)===null||i===void 0?void 0:i[pt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return a.file}p(py,"uploadBlob");async function hy(e,t,r,n){var i;let o=await _a(e,t,r,n),a=await o?.json();if(((i=o?.headers)===null||i===void 0?void 0:i[pt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");let c=Ir(a),u=new uo;return Object.assign(u,c),u}p(hy,"uploadBlobToFileSearchStore");async function _a(e,t,r,n){var i,o,a;let c=t,u=n?.baseUrl||((i=r.clientOptions.httpOptions)===null||i===void 0?void 0:i.baseUrl);if(u){let _=new URL(u),f=new URL(t);f.protocol=_.protocol,f.host=_.host,f.port=_.port,c=f.toString()}let d=0,h=0,m=new Rt(new Response),g="upload";for(d=e.size;h<d;){let _=Math.min(ha,d-h),f=e.slice(h,h+_);h+_>=d&&(g+=", finalize");let y=0,E=ma;for(;y<fa;){let C=Object.assign(Object.assign({},n?.headers||{}),{"X-Goog-Upload-Command":g,"X-Goog-Upload-Offset":String(h)});if(m=await r.request({path:"",body:f,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},n),{apiVersion:"",baseUrl:c,headers:C})}),!((o=m?.headers)===null||o===void 0)&&o[pt])break;y++,await ya(E),E=E*ga}if(h+=_,((a=m?.headers)===null||a===void 0?void 0:a[pt])!=="active")break;if(d<=h)throw new Error("All content has been uploaded, but the upload status is not finalized.")}return m}p(_a,"uploadBlobInternal");async function fy(e){return{size:e.size,type:e.type}}p(fy,"getBlobStat");function ya(e){return new Promise(t=>setTimeout(t,e))}p(ya,"sleep");var my=class{static{p(this,"NodeUploader")}async stat(e){let t={size:0,type:void 0};if(typeof e=="string"){let r=await On.stat(e);return t.size=r.size,t.type=this.inferMimeType(e),t}else return await fy(e)}async upload(e,t,r,n){return typeof e=="string"?await this.uploadFileFromPath(e,t,r,n):py(e,t,r,n)}async uploadToFileSearchStore(e,t,r,n){return typeof e=="string"?await this.uploadFileToFileSearchStoreFromPath(e,t,r,n):hy(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 i;let o=await this.uploadFileFromPathInternal(e,t,r,n),a=await o?.json();if(((i=o?.headers)===null||i===void 0?void 0:i[pt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return a.file}async uploadFileToFileSearchStoreFromPath(e,t,r,n){var i;let o=await this.uploadFileFromPathInternal(e,t,r,n),a=await o?.json();if(((i=o?.headers)===null||i===void 0?void 0:i[pt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");let c=Ir(a),u=new uo;return Object.assign(u,c),u}async uploadFileFromPathInternal(e,t,r,n){var i,o,a;let c=t,u=n?.baseUrl||((i=r.clientOptions.httpOptions)===null||i===void 0?void 0:i.baseUrl);if(u){let y=new URL(u),E=new URL(t);E.protocol=y.protocol,E.host=y.host,E.port=y.port,c=E.toString()}let d=0,h=0,m=new Rt(new Response),g="upload",_,f=Hl.basename(e);try{if(_=await On.open(e,"r"),!_)throw new Error("Failed to open file");for(d=(await _.stat()).size;h<d;){let y=Math.min(ha,d-h);h+y>=d&&(g+=", finalize");let E=new Uint8Array(y),{bytesRead:C}=await _.read(E,0,y,h);if(C!==y)throw new Error(`Failed to read ${y} bytes from file at offset ${h}. bytes actually read: ${C}`);let S=new Blob([E]),A=0,v=ma;for(;A<fa;){let T=Object.assign(Object.assign({},n?.headers||{}),{"X-Goog-Upload-Command":g,"X-Goog-Upload-Offset":String(h),"X-Goog-Upload-File-Name":f});if(m=await r.request({path:"",body:S,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},n),{apiVersion:"",baseUrl:c,headers:T})}),!((o=m?.headers)===null||o===void 0)&&o[pt])break;A++,await ya(v),v=v*ga}if(h+=C,((a=m?.headers)===null||a===void 0?void 0:a[pt])!=="active")break;if(d<=h)throw new Error("All content has been uploaded, but the upload status is not finalized.")}return m}finally{_&&await _.close()}}},gy=class extends Ic{static{p(this,"NodeFiles")}async registerFiles(e){if(typeof process>"u"||!process.versions||!process.versions.node)throw new Error("registerFiles is only supported in Node.js environments.");let t=await e.auth.getRequestHeaders(),r=e.config||{},n=r.httpOptions||{},i=Object.assign({},n.headers||{});if(t)if(typeof t[Symbol.iterator]=="function")for(let[o,a]of t)i[o]=a;else for(let[o,a]of Object.entries(t))i[o]=a;return this._registerFiles({uris:e.uris,config:Object.assign(Object.assign({},r),{httpOptions:Object.assign(Object.assign({},n),{headers:i})})})}},_y="gl-node/";function yy(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 new 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=ht("GOOGLE_GENAI_USE_ENTERPRISE"),n=ht("GOOGLE_GENAI_USE_VERTEXAI"),i=Ea(r),o=Ea(n);return r!==void 0&&n!==void 0&&i!==o&&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."),r!==void 0?i:n!==void 0?o:!1}p(yy,"resolveCloudFlag");var Ey=class{static{p(this,"GoogleGenAI2")}getNextGenClient(){let e=this.httpOptions;return this._nextGenClient===void 0&&(this._nextGenClient=je(this.apiClient,{timeout_ms:e?.timeout})),e?.extraBody&&console.warn("GoogleGenAI: Client level httpOptions.extraBody is not supported by the Gemini NextGen client and will be ignored."),this._nextGenClient}get interactions(){return this._interactions!==void 0?this._interactions:(this._interactions=new T_(this.apiClient),this._interactions)}get webhooks(){return this._webhooks!==void 0?this._webhooks:(this._webhooks=new C_(this.apiClient),this._webhooks)}get agents(){return this._agents!==void 0?this._agents:(console.warn("GoogleGenAI.agents: Agents usage is experimental and may change in future versions."),this._agents=new A_(this.apiClient),this._agents)}get triggers(){return this._triggers!==void 0?this._triggers:(console.warn("GoogleGenAI.triggers: Triggers usage is experimental and may change in future versions."),this._triggers=new S_(this.apiClient),this._triggers)}get environments(){return this._environments!==void 0?this._environments:(console.warn("GoogleGenAI.environments: Environments usage is experimental and may change in future versions."),this._environments=new x_(this.apiClient),this._environments)}constructor(e={}){var t,r,n,i;if(this.vertexai=yy(e),(e.project||e.location)&&!this.vertexai)throw new Error("Project and location are not supported for Gemini API backend.");let o=vy(),a=ht("GOOGLE_CLOUD_PROJECT"),c=ht("GOOGLE_CLOUD_LOCATION");this.apiKey=(t=e.apiKey)!==null&&t!==void 0?t:o,this.project=(r=e.project)!==null&&r!==void 0?r:a,this.location=(n=e.location)!==null&&n!==void 0?n:c,!this.vertexai&&!this.apiKey&&console.warn("API key should be set when using the Gemini API."),this.vertexai&&(!((i=e.googleAuthOptions)===null||i===void 0)&&i.credentials&&(console.debug("The user provided Google Cloud credentials will take precedence over the API key from the environment variable."),this.apiKey=void 0),!e.project&&!e.location&&(a||c)&&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):(e.project||e.location)&&!e.apiKey&&o?(console.debug("The user provided project/location will take precedence over the API key from the environment variables."),this.apiKey=void 0):!e.project&&!e.location&&!e.apiKey&&(a||c)&&o&&(console.debug("The project/location from the environment variables will take precedence over the API key from the environment variables."),this.apiKey=void 0),!this.location&&!this.apiKey&&(this.location="global"));let u=Wl(e.httpOptions,this.vertexai,ht("GOOGLE_VERTEX_BASE_URL"),ht("GOOGLE_GEMINI_BASE_URL"));u&&(e.httpOptions?e.httpOptions.baseUrl=u:e.httpOptions={baseUrl:u}),this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;let d=new b_({apiKey:this.apiKey,googleAuthOptions:e.googleAuthOptions});this.apiClient=new If({auth:d,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:_y+process.version,uploader:new my,downloader:new G_}),this.models=new ur(this.apiClient),this.live=new Ff(this.apiClient,d,new O_),this.batches=new Pd(this.apiClient),this.chats=new hc(this.models,this.apiClient),this.caches=new dc(this.apiClient),this.files=new gy(this.apiClient),this.operations=new Jf(this.apiClient),this.authTokens=new um(this.apiClient),this.tunings=new cy(this.apiClient),this.fileSearchStores=new _m(this.apiClient)}};function ht(e){var t,r,n;return(n=(r=(t=process==null?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}p(ht,"getEnv");function Ea(e){return e===void 0?!1:e.toLowerCase()==="true"}p(Ea,"stringToBoolean");function vy(){let e=ht("GOOGLE_API_KEY"),t=ht("GEMINI_API_KEY");return e&&t&&console.warn("Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY."),e||t||void 0}p(vy,"getApiKeyFromEnv");var Ty={THINKING_LEVEL_UNSPECIFIED:gt.THINKING_LEVEL_UNSPECIFIED,MINIMAL:gt.MINIMAL,LOW:gt.LOW,MEDIUM:gt.MEDIUM,HIGH:gt.HIGH};function va(e,t){let r=e.thinkingLevelMap?.[t],n=typeof r=="string"?r.toLowerCase():t;switch(n){case"minimal":case"low":case"medium":case"high":return n;default:throw new Error(`Unsupported Google thinking level mapping for ${e.provider}/${e.id}: ${t} -> ${String(r)}`)}}p(va,"resolveGoogleThinkingLevel");function Ta(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-(?:pro|flash)/.test(t)||/gemini-(?:[4-9]|[1-9]\d)/.test(t)||t==="gemini-flash-latest"||t==="gemini-flash-lite-latest"||/gemma-?4/.test(t)}p(Ta,"usesGoogleThinkingLevel");function Aa(e){switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}p(Aa,"toGoogleThinkingLevel");function Ca(e){return Ty[e]}p(Ca,"toGoogleSdkThinkingLevel");function Ay(e){if(!Ta(e))return{thinkingBudget:0};let t=Xa(e,"off");if(t==="off")return{thinkingBudget:0};let r=va(e,t),n=Aa(r);return{thinkingLevel:Ca(n)}}p(Ay,"getDisabledGoogleThinkingConfig");function Cy(e){return e.thought===!0}p(Cy,"isThinkingPart");function Sy(e,t){return typeof t=="string"&&t.length>0?t:e}p(Sy,"retainThoughtSignature");var Iy=/^[A-Za-z0-9+/]+={0,2}$/;function wy(e){return!e||e.length%4!==0?!1:Iy.test(e)}p(wy,"isValidThoughtSignature");function $r(e,t){return e&&wy(t)?t:void 0}p($r,"resolveThoughtSignature");function Jr(e){let t=Wr(e);return e.startsWith("claude-")||e.startsWith("gpt-oss-")||t!==void 0&&t>=3}p(Jr,"requiresToolCallId");function Wr(e){let t=e.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);if(t)return Number.parseInt(t[1],10)}p(Wr,"getGeminiMajorVersion");function Ry(e){let t=Wr(e);return t!==void 0?t>=3:!0}p(Ry,"supportsMultimodalFunctionResponse");function Py(e,t){let r=Ya(Ka(t).messages),n=[],i=Ja(r,e,o=>Jr(e.id)?o.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64):o);for(let o of i)if(o.role==="user")if(typeof o.content=="string")n.push({role:"user",parts:[{text:St(o.content)}]});else{let a=o.content.map(c=>c.type==="text"?{text:St(c.text)}:{inlineData:{mimeType:c.mimeType,data:c.data}});if(a.length===0)continue;n.push({role:"user",parts:a})}else if(o.role==="assistant"){let a=[],c=o.provider===e.provider&&o.model===e.id;for(let u of o.content)if(u.type==="text"){let d=$r(c,u.textSignature);if((!u.text||u.text.trim()==="")&&!d)continue;a.push({text:St(u.text),...d&&{thoughtSignature:d}})}else if(u.type==="thinking")if(c){let d=$r(c,u.thinkingSignature);if((!u.thinking||u.thinking.trim()==="")&&!d)continue;a.push({thought:!0,text:St(u.thinking),...d&&{thoughtSignature:d}})}else{if(!u.thinking||u.thinking.trim()==="")continue;a.push({text:St(u.thinking)})}else if(u.type==="toolCall"){let d=$r(c,u.thoughtSignature),h={functionCall:{name:u.name,args:u.arguments??{},...Jr(e.id)?{id:u.id}:{}},...d&&{thoughtSignature:d}};a.push(h)}if(a.length===0)continue;n.push({role:"model",parts:a})}else if(o.role==="toolResult"){let a=o.content.filter(E=>E.type==="text").map(E=>E.text).join(`
|
|
43
|
+
`),c=e.input.includes("image")?o.content.filter(E=>E.type==="image"):[],u=a.trim().length>0,d=c.length>0,h=Ry(e.id),m=u?St(a):d?"(see attached image)":"",g=c.map(E=>({inlineData:{mimeType:E.mimeType,data:E.data}})),_=Jr(e.id),f={functionResponse:{name:o.toolName,response:o.isError?{error:m}:{output:m},...d&&h&&{parts:g},..._?{id:o.toolCallId}:{}}},y=n[n.length-1];y?.role==="user"&&y.parts?.some(E=>E.functionResponse)?y.parts.push(f):n.push({role:"user",parts:[f]}),d&&!h&&n.push({role:"user",parts:[{text:"Tool result image:"},...g]})}return n}p(Py,"convertMessages");var Ny=new Set(["$schema","$id","$anchor","$dynamicAnchor","$vocabulary","$comment","$defs","definitions"]);function Sa(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t={};for(let[r,n]of Object.entries(e))Ny.has(r)||(t[r]=Sa(n));return t}p(Sa,"sanitizeForOpenApi");var ky=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]),Dy=new Set(["additionalProperties","unevaluatedProperties","propertyNames","items","prefixItems","additionalItems","unevaluatedItems","contains","allOf","anyOf","oneOf","not","if","then","else","contentSchema"]);function _r(e,t=!1){if(Array.isArray(e))return e.map(n=>_r(n));if(typeof e!="object"||e===null)return e;let r=Object.fromEntries(Object.entries(e).map(([n,i])=>t||Dy.has(n)?[n,_r(i)]:ky.has(n)?[n,_r(i,!0)]:[n,i]));if(!t&&"const"in r&&r.enum===void 0){let n=r.const;(typeof n=="string"||typeof n=="number")&&(delete r.const,r.enum=[n])}return r}p(_r,"rewriteConstAsEnum");function My(e,t=!1,r=!0){if(e.length!==0)return[{functionDeclarations:e.map(n=>{let i=tn(n,r),o=$a(n,i);return{name:n.name,description:n.description,...t?{parameters:Sa(o)}:{parametersJsonSchema:_r(o)}}})}]}p(My,"convertTools");function xy(e){let t=Wr(e);return t!==void 0&&t>=3}p(xy,"supportsGoogleStrictToolSampling");function Ia(e){switch(e){case"auto":return _t.AUTO;case"none":return _t.NONE;case"any":return _t.ANY;default:return _t.AUTO}}p(Ia,"mapToolChoice");function by(e,t,r){let n=e.some(i=>tn(i,r)===!0);return t==="none"||t==="any"?Ia(t):n?_t.VALIDATED:t?Ia(t):void 0}p(by,"resolveGoogleFunctionCallingMode");function Uy(e){switch(e){case xe.STOP:return"stop";case xe.MAX_TOKENS:return"length";case xe.BLOCKLIST:case xe.PROHIBITED_CONTENT:case xe.SPII:case xe.SAFETY:case xe.IMAGE_SAFETY:case xe.IMAGE_PROHIBITED_CONTENT:case xe.IMAGE_RECITATION:case xe.IMAGE_OTHER:case xe.RECITATION:case xe.FINISH_REASON_UNSPECIFIED:case xe.OTHER:case xe.LANGUAGE:case xe.MALFORMED_FUNCTION_CALL:case xe.UNEXPECTED_TOOL_CALL:case xe.TOO_MANY_TOOL_CALLS:case xe.NO_IMAGE:return"error";default:{let t=e;throw new Error(`Unhandled stop reason: ${t}`)}}}p(Uy,"mapStopReason");function Gy(e,t){return Wa(async()=>{try{return await e()}catch(r){throw r instanceof Error&&"status"in r&&!("headers"in r)&&(r.headers=void 0),r}},{maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,signal:t?.signal})}p(Gy,"retryGoogleRequest");export{Ey as GoogleGenAI,rr as ResourceScope,Py as convertMessages,My as convertTools,Ay as getDisabledGoogleThinkingConfig,Cy as isThinkingPart,Uy as mapStopReason,by as resolveGoogleFunctionCallingMode,va as resolveGoogleThinkingLevel,Sy as retainThoughtSignature,Gy as retryGoogleRequest,xy as supportsGoogleStrictToolSampling,Ca as toGoogleSdkThinkingLevel,Aa as toGoogleThinkingLevel,Ta as usesGoogleThinkingLevel};
|