sliccy 2.9.7 → 2.11.0
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/dist/ui/assets/{anthropic-MK42z37Q.js → anthropic-CoNHEHnG.js} +2 -2
- package/dist/ui/assets/{azure-openai-responses-6sx0CeiG.js → azure-openai-responses-D-r_AI6w.js} +1 -1
- package/dist/ui/assets/{dist-Sngeewv4.js → dist-B7V-aBlB.js} +1 -1
- package/dist/ui/assets/{dist-DPNMKo07.js → dist-BZOmMqub.js} +1 -1
- package/dist/ui/assets/{dist-BqCqxkrA.js → dist-BZxeNw0j.js} +1 -1
- package/dist/ui/assets/{dist-CxsgJFgV.js → dist-C1MjLlkt.js} +1 -1
- package/dist/ui/assets/{dist-BNEtmCAc2.js → dist-VQCt339k2.js} +2 -2
- package/dist/ui/assets/{es-CipkQKU_.js → es-NTO-FgDp.js} +1 -1
- package/dist/ui/assets/fs-CuJwg7sR.js +3 -0
- package/dist/ui/assets/{google-CZ8m9iXo.js → google-Xjlw1mio.js} +1 -1
- package/dist/ui/assets/{google-gemini-cli-sGthcgbS.js → google-gemini-cli-CvfYAGzv.js} +1 -1
- package/dist/ui/assets/{google-shared-CDmR0GpA.js → google-shared-FQyNXg85.js} +1 -1
- package/dist/ui/assets/{google-vertex-DN1wAqZn.js → google-vertex-DmvsouTy.js} +1 -1
- package/dist/ui/assets/{index-CS-Tbqyy.js → index-rXow4fNi.js} +910 -912
- package/dist/ui/assets/{magick-wasm-BtLTRPKb.js → magick-wasm-BuraEslY.js} +1 -1
- package/dist/ui/assets/{mistral-DJsZqDXM.js → mistral-BEnV1q_A.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-CV9PVGy1.js → openai-codex-responses-Bx-YqQVj.js} +1 -1
- package/dist/ui/assets/{openai-completions-CaZHHvas.js → openai-completions-Dt1jxVcM.js} +1 -1
- package/dist/ui/assets/{openai-responses-Cxl9Qt8B.js → openai-responses-D-TRs5HH.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-DDd_xmLk.js → openai-responses-shared-BG_6ysNb.js} +1 -1
- package/dist/ui/assets/provider-settings-YbBbsH3D.js +90 -0
- package/dist/ui/assets/{pyodide-JXDzDQlX.js → pyodide-ZBgukovK.js} +2 -2
- package/dist/ui/assets/{skills-GoXEY9ZL.js → skills-B1zKlleu.js} +1 -1
- package/dist/ui/assets/{slicc-editor-BXeXUUnd.js → slicc-editor-DRq182-r.js} +2 -2
- package/dist/ui/assets/{sql-wasm-DsCCg8Gn.js → sql-wasm-CNZ88Vcf.js} +1 -1
- package/dist/ui/index.html +9 -8
- package/dist/ui/packages/webapp/index.html +9 -8
- package/package.json +1 -1
- package/dist/ui/assets/provider-settings-0fVX3aJb.js +0 -90
- /package/dist/ui/assets/{__vite-browser-external-BotBUAC3.js → __vite-browser-external-MxCBxUMe.js} +0 -0
- /package/dist/ui/assets/{addon-fit-B0aHsvmX.js → addon-fit-CniRnSyE.js} +0 -0
- /package/dist/ui/assets/{bsh-watchdog-DYfdvOrR.js → bsh-watchdog-BofJVeV-.js} +0 -0
- /package/dist/ui/assets/{chat-fixture-BWvups7M.js → chat-fixture-CIjL7BDw.js} +0 -0
- /package/dist/ui/assets/{db-ybNEUfR8.js → db-CJnk7hWr.js} +0 -0
- /package/dist/ui/assets/{dist-CPYmBmyZ.js → dist-BreQU7P7.js} +0 -0
- /package/dist/ui/assets/{dist-Ct5XR8EU.js → dist-CEBWSFtw.js} +0 -0
- /package/dist/ui/assets/{github-copilot-headers-BxUvy78-.js → github-copilot-headers-BFowJEWi.js} +0 -0
- /package/dist/ui/assets/{hash-BwzabXYv.js → hash-B7CztTb_.js} +0 -0
- /package/dist/ui/assets/{headers-BCPSYYop.js → headers-CrRy8cka.js} +0 -0
- /package/dist/ui/assets/{lick-manager-proxy-BF0GrOv_.js → lick-manager-proxy-Dw3D3AzG.js} +0 -0
- /package/dist/ui/assets/{oauth-service-8Xax8Fjw.js → oauth-service-DUXASG7L.js} +0 -0
- /package/dist/ui/assets/{offscreen-client-DJYi05-D.js → offscreen-client-Dom7iV01.js} +0 -0
- /package/dist/ui/assets/{path-utils-CgbXfwyO.js → path-utils-DFPXxD-4.js} +0 -0
- /package/dist/ui/assets/{pdfjs-C_fzykJW.js → pdfjs-exDS4aMq.js} +0 -0
- /package/dist/ui/assets/{sanitize-unicode-ncMKN_SD.js → sanitize-unicode-6mS7gbvU.js} +0 -0
- /package/dist/ui/assets/{secret-masking-CXZkZ8rX.js → secret-masking-ZNVanUmG.js} +0 -0
- /package/dist/ui/assets/{src-Cu5WM_BM.js → src-BqF-C6jp.js} +0 -0
- /package/dist/ui/assets/{xterm-D5M9QCcR.js → xterm-BaLOnk9X.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-jRWAZmH_.js";import{i as n}from"./simple-options-CP_5aL7H.js";import{t as r}from"./sanitize-unicode-ncMKN_SD.js";var i=t(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),a=t((e=>{var t=i();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),o=t(((e,t)=>{t.exports=a()})),s=e(t(((e,t)=>{var n=o(),r=[`Failed to fetch`,`NetworkError when attempting to fetch resource.`,`The Internet connection appears to be offline.`,`Network request failed`],i=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=Error(e),this.originalError.stack=this.stack),this.name=`AbortError`,this.message=e}},a=(e,t,n)=>{let r=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=r,e},s=e=>r.includes(e),c=(e,t)=>new Promise((r,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};let c=n.operation(t);c.attempt(async n=>{try{r(await e(n))}catch(e){if(!(e instanceof Error)){o(TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));return}if(e instanceof i)c.stop(),o(e.originalError);else if(e instanceof TypeError&&!s(e.message))c.stop(),o(e);else{a(e,n,t);try{await t.onFailedAttempt(e)}catch(e){o(e);return}c.retry(e)||o(c.mainError())}}})});t.exports=c,t.exports.default=c,t.exports.AbortError=i}))(),1),c=void 0,l=void 0;function u(){return{geminiUrl:c,vertexUrl:l}}function d(e,t,n,r){if(!e?.baseUrl){let e=u();return t?e.vertexUrl??n:e.geminiUrl??r}return e.baseUrl}var f=class{};function p(e,t){return e.replace(/\{([^}]+)\}/g,(e,n)=>{if(Object.prototype.hasOwnProperty.call(t,n)){let e=t[n];return e==null?``:String(e)}else throw Error(`Key '${n}' not found in valueMap.`)})}function m(e,t,n){for(let r=0;r<t.length-1;r++){let i=t[r];if(i.endsWith(`[]`)){let a=i.slice(0,-2);if(!(a in e))if(Array.isArray(n))e[a]=Array.from({length:n.length},()=>({}));else throw Error(`Value must be a list given an array path ${i}`);if(Array.isArray(e[a])){let i=e[a];if(Array.isArray(n))for(let e=0;e<i.length;e++){let a=i[e];m(a,t.slice(r+1),n[e])}else for(let e of i)m(e,t.slice(r+1),n)}return}else if(i.endsWith(`[0]`)){let a=i.slice(0,-3);a in e||(e[a]=[{}]);let o=e[a];m(o[0],t.slice(r+1),n);return}(!e[i]||typeof e[i]!=`object`)&&(e[i]={}),e=e[i]}let r=t[t.length-1],i=e[r];if(i!==void 0){if(!n||typeof n==`object`&&Object.keys(n).length===0||n===i)return;if(typeof i==`object`&&typeof n==`object`&&i!==null&&n!==null)Object.assign(i,n);else throw Error(`Cannot set value for an existing key. Key: ${r}`)}else r===`_self`&&typeof n==`object`&&n&&!Array.isArray(n)?Object.assign(e,n):e[r]=n}function h(e,t,n=void 0){try{if(t.length===1&&t[0]===`_self`)return e;for(let r=0;r<t.length;r++){if(typeof e!=`object`||!e)return n;let i=t[r];if(i.endsWith(`[]`)){let a=i.slice(0,-2);if(a in e){let i=e[a];return Array.isArray(i)?i.map(e=>h(e,t.slice(r+1),n)):n}else return n}else e=e[i]}return e}catch(e){if(e instanceof TypeError)return n;throw e}}function g(e,t){for(let[n,r]of Object.entries(t)){let t=n.split(`.`),i=r.split(`.`),a=new Set,o=-1;for(let e=0;e<t.length;e++)if(t[e]===`*`){o=e;break}if(o!==-1&&i.length>o)for(let e=o;e<i.length;e++){let t=i[e];t!==`*`&&!t.endsWith(`[]`)&&!t.endsWith(`[0]`)&&a.add(t)}_(e,t,i,0,a)}}function _(e,t,n,r,i){if(r>=t.length||typeof e!=`object`||!e)return;let a=t[r];if(a.endsWith(`[]`)){let o=a.slice(0,-2),s=e;if(o in s&&Array.isArray(s[o]))for(let e of s[o])_(e,t,n,r+1,i)}else if(a===`*`){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,a=Object.keys(t).filter(e=>!e.startsWith(`_`)&&!i.has(e)),o={};for(let e of a)o[e]=t[e];for(let[e,i]of Object.entries(o)){let a=[];for(let t of n.slice(r))t===`*`?a.push(e):a.push(t);m(t,a,i)}for(let e of a)delete t[e]}}else{let o=e;a in o&&_(o[a],t,n,r+1,i)}}function v(e){if(typeof e!=`string`)throw Error(`fromImageBytes must be a string`);return e}function y(e){let t={},n=h(e,[`operationName`]);n!=null&&m(t,[`operationName`],n);let r=h(e,[`resourceName`]);return r!=null&&m(t,[`_url`,`resourceName`],r),t}function b(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`,`generateVideoResponse`]);return o!=null&&m(t,[`response`],S(o)),t}function x(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],C(o)),t}function S(e){let t={},n=h(e,[`generatedSamples`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>w(e))),m(t,[`generatedVideos`],e)}let r=h(e,[`raiMediaFilteredCount`]);r!=null&&m(t,[`raiMediaFilteredCount`],r);let i=h(e,[`raiMediaFilteredReasons`]);return i!=null&&m(t,[`raiMediaFilteredReasons`],i),t}function C(e){let t={},n=h(e,[`videos`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>T(e))),m(t,[`generatedVideos`],e)}let r=h(e,[`raiMediaFilteredCount`]);r!=null&&m(t,[`raiMediaFilteredCount`],r);let i=h(e,[`raiMediaFilteredReasons`]);return i!=null&&m(t,[`raiMediaFilteredReasons`],i),t}function w(e){let t={},n=h(e,[`video`]);return n!=null&&m(t,[`video`],te(n)),t}function T(e){let t={},n=h(e,[`_self`]);return n!=null&&m(t,[`video`],ne(n)),t}function E(e){let t={},n=h(e,[`operationName`]);return n!=null&&m(t,[`_url`,`operationName`],n),t}function D(e){let t={},n=h(e,[`operationName`]);return n!=null&&m(t,[`_url`,`operationName`],n),t}function O(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],k(o)),t}function k(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`parent`]);r!=null&&m(t,[`parent`],r);let i=h(e,[`documentName`]);return i!=null&&m(t,[`documentName`],i),t}function A(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],ee(o)),t}function ee(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`parent`]);r!=null&&m(t,[`parent`],r);let i=h(e,[`documentName`]);return i!=null&&m(t,[`documentName`],i),t}function te(e){let t={},n=h(e,[`uri`]);n!=null&&m(t,[`uri`],n);let r=h(e,[`encodedVideo`]);r!=null&&m(t,[`videoBytes`],v(r));let i=h(e,[`encoding`]);return i!=null&&m(t,[`mimeType`],i),t}function ne(e){let t={},n=h(e,[`gcsUri`]);n!=null&&m(t,[`uri`],n);let r=h(e,[`bytesBase64Encoded`]);r!=null&&m(t,[`videoBytes`],v(r));let i=h(e,[`mimeType`]);return i!=null&&m(t,[`mimeType`],i),t}var re;(function(e){e.OUTCOME_UNSPECIFIED=`OUTCOME_UNSPECIFIED`,e.OUTCOME_OK=`OUTCOME_OK`,e.OUTCOME_FAILED=`OUTCOME_FAILED`,e.OUTCOME_DEADLINE_EXCEEDED=`OUTCOME_DEADLINE_EXCEEDED`})(re||={});var ie;(function(e){e.LANGUAGE_UNSPECIFIED=`LANGUAGE_UNSPECIFIED`,e.PYTHON=`PYTHON`})(ie||={});var ae;(function(e){e.SCHEDULING_UNSPECIFIED=`SCHEDULING_UNSPECIFIED`,e.SILENT=`SILENT`,e.WHEN_IDLE=`WHEN_IDLE`,e.INTERRUPT=`INTERRUPT`})(ae||={});var j;(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`})(j||={});var oe;(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`})(oe||={});var se;(function(e){e.API_SPEC_UNSPECIFIED=`API_SPEC_UNSPECIFIED`,e.SIMPLE_SEARCH=`SIMPLE_SEARCH`,e.ELASTIC_SEARCH=`ELASTIC_SEARCH`})(se||={});var ce;(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`})(ce||={});var le;(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`})(le||={});var ue;(function(e){e.UNSPECIFIED=`UNSPECIFIED`,e.BLOCKING=`BLOCKING`,e.NON_BLOCKING=`NON_BLOCKING`})(ue||={});var de;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.MODE_DYNAMIC=`MODE_DYNAMIC`})(de||={});var fe;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.AUTO=`AUTO`,e.ANY=`ANY`,e.NONE=`NONE`,e.VALIDATED=`VALIDATED`})(fe||={});var pe;(function(e){e.THINKING_LEVEL_UNSPECIFIED=`THINKING_LEVEL_UNSPECIFIED`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`,e.MINIMAL=`MINIMAL`})(pe||={});var me;(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_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`,e.HARM_CATEGORY_JAILBREAK=`HARM_CATEGORY_JAILBREAK`})(me||={});var he;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED=`HARM_BLOCK_METHOD_UNSPECIFIED`,e.SEVERITY=`SEVERITY`,e.PROBABILITY=`PROBABILITY`})(he||={});var ge;(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`})(ge||={});var M;(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.IMAGE_PROHIBITED_CONTENT=`IMAGE_PROHIBITED_CONTENT`,e.NO_IMAGE=`NO_IMAGE`,e.IMAGE_RECITATION=`IMAGE_RECITATION`,e.IMAGE_OTHER=`IMAGE_OTHER`})(M||={});var _e;(function(e){e.HARM_PROBABILITY_UNSPECIFIED=`HARM_PROBABILITY_UNSPECIFIED`,e.NEGLIGIBLE=`NEGLIGIBLE`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`})(_e||={});var ve;(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`})(ve||={});var ye;(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`})(ye||={});var be;(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`})(be||={});var xe;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED=`TRAFFIC_TYPE_UNSPECIFIED`,e.ON_DEMAND=`ON_DEMAND`,e.PROVISIONED_THROUGHPUT=`PROVISIONED_THROUGHPUT`})(xe||={});var Se;(function(e){e.MODALITY_UNSPECIFIED=`MODALITY_UNSPECIFIED`,e.TEXT=`TEXT`,e.IMAGE=`IMAGE`,e.AUDIO=`AUDIO`})(Se||={});var Ce;(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`})(Ce||={});var we;(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`})(we||={});var Te;(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`})(Te||={});var Ee;(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`})(Ee||={});var De;(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`})(De||={});var Oe;(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`})(Oe||={});var ke;(function(e){e.COLLECTION=`COLLECTION`})(ke||={});var Ae;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED=`FEATURE_SELECTION_PREFERENCE_UNSPECIFIED`,e.PRIORITIZE_QUALITY=`PRIORITIZE_QUALITY`,e.BALANCED=`BALANCED`,e.PRIORITIZE_COST=`PRIORITIZE_COST`})(Ae||={});var je;(function(e){e.ENVIRONMENT_UNSPECIFIED=`ENVIRONMENT_UNSPECIFIED`,e.ENVIRONMENT_BROWSER=`ENVIRONMENT_BROWSER`})(je||={});var Me;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED=`PROMINENT_PEOPLE_UNSPECIFIED`,e.ALLOW_PROMINENT_PEOPLE=`ALLOW_PROMINENT_PEOPLE`,e.BLOCK_PROMINENT_PEOPLE=`BLOCK_PROMINENT_PEOPLE`})(Me||={});var Ne;(function(e){e.PREDICT=`PREDICT`,e.EMBED_CONTENT=`EMBED_CONTENT`})(Ne||={});var Pe;(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`})(Pe||={});var Fe;(function(e){e.DONT_ALLOW=`DONT_ALLOW`,e.ALLOW_ADULT=`ALLOW_ADULT`,e.ALLOW_ALL=`ALLOW_ALL`})(Fe||={});var Ie;(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`})(Ie||={});var Le;(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`})(Le||={});var Re;(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`})(Re||={});var ze;(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`})(ze||={});var Be;(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`})(Be||={});var Ve;(function(e){e.FOREGROUND=`FOREGROUND`,e.BACKGROUND=`BACKGROUND`,e.PROMPT=`PROMPT`,e.SEMANTIC=`SEMANTIC`,e.INTERACTIVE=`INTERACTIVE`})(Ve||={});var He;(function(e){e.ASSET=`ASSET`,e.STYLE=`STYLE`})(He||={});var Ue;(function(e){e.INSERT=`INSERT`,e.REMOVE=`REMOVE`,e.REMOVE_STATIC=`REMOVE_STATIC`,e.OUTPAINT=`OUTPAINT`})(Ue||={});var We;(function(e){e.OPTIMIZED=`OPTIMIZED`,e.LOSSLESS=`LOSSLESS`})(We||={});var Ge;(function(e){e.SUPERVISED_FINE_TUNING=`SUPERVISED_FINE_TUNING`,e.PREFERENCE_TUNING=`PREFERENCE_TUNING`,e.DISTILLATION=`DISTILLATION`})(Ge||={});var Ke;(function(e){e.STATE_UNSPECIFIED=`STATE_UNSPECIFIED`,e.STATE_PENDING=`STATE_PENDING`,e.STATE_ACTIVE=`STATE_ACTIVE`,e.STATE_FAILED=`STATE_FAILED`})(Ke||={});var qe;(function(e){e.STATE_UNSPECIFIED=`STATE_UNSPECIFIED`,e.PROCESSING=`PROCESSING`,e.ACTIVE=`ACTIVE`,e.FAILED=`FAILED`})(qe||={});var Je;(function(e){e.SOURCE_UNSPECIFIED=`SOURCE_UNSPECIFIED`,e.UPLOADED=`UPLOADED`,e.GENERATED=`GENERATED`,e.REGISTERED=`REGISTERED`})(Je||={});var Ye;(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`})(Ye||={});var Xe;(function(e){e.MODALITY_UNSPECIFIED=`MODALITY_UNSPECIFIED`,e.TEXT=`TEXT`,e.IMAGE=`IMAGE`,e.VIDEO=`VIDEO`,e.AUDIO=`AUDIO`,e.DOCUMENT=`DOCUMENT`})(Xe||={});var Ze;(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`})(Ze||={});var Qe;(function(e){e.TYPE_UNSPECIFIED=`TYPE_UNSPECIFIED`,e.ACTIVITY_START=`ACTIVITY_START`,e.ACTIVITY_END=`ACTIVITY_END`})(Qe||={});var $e;(function(e){e.START_SENSITIVITY_UNSPECIFIED=`START_SENSITIVITY_UNSPECIFIED`,e.START_SENSITIVITY_HIGH=`START_SENSITIVITY_HIGH`,e.START_SENSITIVITY_LOW=`START_SENSITIVITY_LOW`})($e||={});var et;(function(e){e.END_SENSITIVITY_UNSPECIFIED=`END_SENSITIVITY_UNSPECIFIED`,e.END_SENSITIVITY_HIGH=`END_SENSITIVITY_HIGH`,e.END_SENSITIVITY_LOW=`END_SENSITIVITY_LOW`})(et||={});var tt;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED=`ACTIVITY_HANDLING_UNSPECIFIED`,e.START_OF_ACTIVITY_INTERRUPTS=`START_OF_ACTIVITY_INTERRUPTS`,e.NO_INTERRUPTION=`NO_INTERRUPTION`})(tt||={});var nt;(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`})(nt||={});var rt;(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`})(rt||={});var it;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED=`MUSIC_GENERATION_MODE_UNSPECIFIED`,e.QUALITY=`QUALITY`,e.DIVERSITY=`DIVERSITY`,e.VOCALIZATION=`VOCALIZATION`})(it||={});var at;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED=`PLAYBACK_CONTROL_UNSPECIFIED`,e.PLAY=`PLAY`,e.PAUSE=`PAUSE`,e.STOP=`STOP`,e.RESET_CONTEXT=`RESET_CONTEXT`})(at||={});var ot=class{constructor(e){let t={};for(let n of e.headers.entries())t[n[0]]=n[1];this.headers=t,this.responseInternal=e}json(){return this.responseInternal.json()}},st=class{get text(){if(this.candidates?.[0]?.content?.parts?.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 e=``,t=!1,n=[];for(let r of this.candidates?.[0]?.content?.parts??[]){for(let[e,t]of Object.entries(r))e!==`text`&&e!==`thought`&&e!==`thoughtSignature`&&(t!==null||t!==void 0)&&n.push(e);if(typeof r.text==`string`){if(typeof r.thought==`boolean`&&r.thought)continue;t=!0,e+=r.text}}return n.length>0&&console.warn(`there are non-text parts ${n} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),t?e:void 0}get data(){if(this.candidates?.[0]?.content?.parts?.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 e=``,t=[];for(let n of this.candidates?.[0]?.content?.parts??[]){for(let[e,r]of Object.entries(n))e!==`inlineData`&&(r!==null||r!==void 0)&&t.push(e);n.inlineData&&typeof n.inlineData.data==`string`&&(e+=atob(n.inlineData.data))}return t.length>0&&console.warn(`there are non-data parts ${t} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),e.length>0?btoa(e):void 0}get functionCalls(){if(this.candidates?.[0]?.content?.parts?.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 e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.functionCall).map(e=>e.functionCall).filter(e=>e!==void 0);if(e?.length!==0)return e}get executableCode(){if(this.candidates?.[0]?.content?.parts?.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 e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.executableCode).map(e=>e.executableCode).filter(e=>e!==void 0);if(e?.length!==0)return e?.[0]?.code}get codeExecutionResult(){if(this.candidates?.[0]?.content?.parts?.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 e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.codeExecutionResult).map(e=>e.codeExecutionResult).filter(e=>e!==void 0);if(e?.length!==0)return e?.[0]?.output}},ct=class{},lt=class{},ut=class{},dt=class{},ft=class{},pt=class{},mt=class{},ht=class{},gt=class{},_t=class{},vt=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i,a=t;return i=n?x(a):b(a),Object.assign(r,i),r}},yt=class{},bt=class{},xt=class{},St=class{},Ct=class{},wt=class{},Tt=class{},Et=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i=O(t);return Object.assign(r,i),r}},Dt=class{},Ot=class{},kt=class{},At=class{},jt=class{},Mt=class{get text(){let e=``,t=!1,n=[];for(let r of this.serverContent?.modelTurn?.parts??[]){for(let[e,t]of Object.entries(r))e!==`text`&&e!==`thought`&&t!==null&&n.push(e);if(typeof r.text==`string`){if(typeof r.thought==`boolean`&&r.thought)continue;t=!0,e+=r.text}}return n.length>0&&console.warn(`there are non-text parts ${n} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),t?e:void 0}get data(){let e=``,t=[];for(let n of this.serverContent?.modelTurn?.parts??[]){for(let[e,r]of Object.entries(n))e!==`inlineData`&&r!==null&&t.push(e);n.inlineData&&typeof n.inlineData.data==`string`&&(e+=atob(n.inlineData.data))}return t.length>0&&console.warn(`there are non-data parts ${t} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),e.length>0?btoa(e):void 0}},Nt=class{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}},Pt=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i=A(t);return Object.assign(r,i),r}};function N(e,t){if(!t||typeof t!=`string`)throw Error(`model is required and must be a string`);if(t.includes(`..`)||t.includes(`?`)||t.includes(`&`))throw Error(`invalid model parameter`);if(e.isVertexAI()){if(t.startsWith(`publishers/`)||t.startsWith(`projects/`)||t.startsWith(`models/`))return t;if(t.indexOf(`/`)>=0){let e=t.split(`/`,2);return`publishers/${e[0]}/models/${e[1]}`}else return`publishers/google/models/${t}`}else if(t.startsWith(`models/`)||t.startsWith(`tunedModels/`))return t;else return`models/${t}`}function Ft(e,t){let n=N(e,t);return n?n.startsWith(`publishers/`)&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}`:n.startsWith(`models/`)&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/publishers/google/${n}`:n:``}function It(e){return Array.isArray(e)?e.map(e=>Lt(e)):[Lt(e)]}function Lt(e){if(typeof e==`object`&&e)return e;throw Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function Rt(e){let t=Lt(e);if(t.mimeType&&t.mimeType.startsWith(`image/`))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function zt(e){let t=Lt(e);if(t.mimeType&&t.mimeType.startsWith(`audio/`))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function Bt(e){if(e==null)throw Error(`PartUnion is required`);if(typeof e==`object`)return e;if(typeof e==`string`)return{text:e};throw Error(`Unsupported part type: ${typeof e}`)}function Vt(e){if(e==null||Array.isArray(e)&&e.length===0)throw Error(`PartListUnion is required`);return Array.isArray(e)?e.map(e=>Bt(e)):[Bt(e)]}function Ht(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)}function Ut(e){return typeof e==`object`&&!!e&&`functionCall`in e}function Wt(e){return typeof e==`object`&&!!e&&`functionResponse`in e}function P(e){if(e==null)throw Error(`ContentUnion is required`);return Ht(e)?e:{role:`user`,parts:Vt(e)}}function Gt(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap(e=>{let t=P(e);return t.parts&&t.parts.length>0&&t.parts[0].text!==void 0?[t.parts[0].text]:[]});if(e.isVertexAI()){let e=P(t);return e.parts&&e.parts.length>0&&e.parts[0].text!==void 0?[e.parts[0].text]:[]}return Array.isArray(t)?t.map(e=>P(e)):[P(t)]}function F(e){if(e==null||Array.isArray(e)&&e.length===0)throw Error(`contents are required`);if(!Array.isArray(e)){if(Ut(e)||Wt(e))throw Error(`To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them`);return[P(e)]}let t=[],n=[],r=Ht(e[0]);for(let i of e){let e=Ht(i);if(e!=r)throw Error(`Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them`);if(e)t.push(i);else if(Ut(i)||Wt(i))throw Error(`To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them`);else n.push(i)}return r||t.push({role:`user`,parts:Vt(n)}),t}function Kt(e,t){e.includes(`null`)&&(t.nullable=!0);let n=e.filter(e=>e!==`null`);if(n.length===1)t.type=Object.values(j).includes(n[0].toUpperCase())?n[0].toUpperCase():j.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let e of n)t.anyOf.push({type:Object.values(j).includes(e.toUpperCase())?e.toUpperCase():j.TYPE_UNSPECIFIED})}}function qt(e){let t={},n=[`items`],r=[`anyOf`],i=[`properties`];if(e.type&&e.anyOf)throw Error(`type and anyOf cannot be both populated.`);let a=e.anyOf;a!=null&&a.length==2&&(a[0].type===`null`?(t.nullable=!0,e=a[1]):a[1].type===`null`&&(t.nullable=!0,e=a[0])),e.type instanceof Array&&Kt(e.type,t);for(let[a,o]of Object.entries(e))if(o!=null)if(a==`type`){if(o===`null`)throw Error(`type: null can not be the only possible type for the field.`);if(o instanceof Array)continue;t.type=Object.values(j).includes(o.toUpperCase())?o.toUpperCase():j.TYPE_UNSPECIFIED}else if(n.includes(a))t[a]=qt(o);else if(r.includes(a)){let e=[];for(let n of o){if(n.type==`null`){t.nullable=!0;continue}e.push(qt(n))}t[a]=e}else if(i.includes(a)){let e={};for(let[t,n]of Object.entries(o))e[t]=qt(n);t[a]=e}else{if(a===`additionalProperties`)continue;t[a]=o}return t}function Jt(e){return qt(e)}function Yt(e){if(typeof e==`object`)return e;if(typeof e==`string`)return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};throw Error(`Unsupported speechConfig type: ${typeof e}`)}function Xt(e){if(`multiSpeakerVoiceConfig`in e)throw Error(`multiSpeakerVoiceConfig is not supported in the live API.`);return e}function I(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=qt(t.parameters)),t.response&&(Object.keys(t.response).includes(`$schema`)?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=qt(t.response));return e}function L(e){if(e==null)throw Error(`tools is required`);if(!Array.isArray(e))throw Error(`tools is required and must be an array of Tools`);let t=[];for(let n of e)t.push(n);return t}function Zt(e,t,n,r=1){let i=!t.startsWith(`${n}/`)&&t.split(`/`).length===r;return e.isVertexAI()?t.startsWith(`projects/`)?t:t.startsWith(`locations/`)?`projects/${e.getProject()}/${t}`:t.startsWith(`${n}/`)?`projects/${e.getProject()}/locations/${e.getLocation()}/${t}`:i?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}/${t}`:t:i?`${n}/${t}`:t}function R(e,t){if(typeof t!=`string`)throw Error(`name must be a string`);return Zt(e,t,`cachedContents`)}function Qt(e){switch(e){case`STATE_UNSPECIFIED`:return`JOB_STATE_UNSPECIFIED`;case`CREATING`:return`JOB_STATE_RUNNING`;case`ACTIVE`:return`JOB_STATE_SUCCEEDED`;case`FAILED`:return`JOB_STATE_FAILED`;default:return e}}function z(e){return v(e)}function $t(e){return typeof e==`object`&&!!e&&`name`in e}function en(e){return typeof e==`object`&&!!e&&`video`in e}function tn(e){return typeof e==`object`&&!!e&&`uri`in e}function nn(e){let t;if($t(e)&&(t=e.name),!(tn(e)&&(t=e.uri,t===void 0))&&!(en(e)&&(t=e.video?.uri,t===void 0))){if(typeof e==`string`&&(t=e),t===void 0)throw Error(`Could not extract file name from the provided input.`);if(t.startsWith(`https://`)){let e=t.split(`files/`)[1].match(/[a-z0-9]+/);if(e===null)throw Error(`Could not extract file name from URI ${t}`);t=e[0]}else t.startsWith(`files/`)&&(t=t.split(`files/`)[1]);return t}}function rn(e,t){let n;return n=e.isVertexAI()?t?`publishers/google/models`:`models`:t?`models`:`tunedModels`,n}function an(e){for(let t of[`models`,`tunedModels`,`publisherModels`])if(on(e,t))return e[t];return[]}function on(e,t){return typeof e==`object`&&!!e&&t in e}function sn(e,t={}){let n=e,r={name:n.name,description:n.description,parametersJsonSchema:n.inputSchema};return n.outputSchema&&(r.responseJsonSchema=n.outputSchema),t.behavior&&(r.behavior=t.behavior),{functionDeclarations:[r]}}function cn(e,t={}){let n=[],r=new Set;for(let i of e){let e=i.name;if(r.has(e))throw Error(`Duplicate function name ${e} found in MCP tools. Please ensure function names are unique.`);r.add(e);let a=sn(i,t);a.functionDeclarations&&n.push(...a.functionDeclarations)}return{functionDeclarations:n}}function ln(e,t){let n;if(typeof t==`string`)if(e.isVertexAI())if(t.startsWith(`gs://`))n={format:`jsonl`,gcsUri:[t]};else if(t.startsWith(`bq://`))n={format:`bigquery`,bigqueryUri:t};else throw Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith(`files/`))n={fileName:t};else throw Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(e.isVertexAI())throw Error(`InlinedRequest[] is not supported in Vertex AI.`);n={inlinedRequests:t}}else n=t;let r=[n.gcsUri,n.bigqueryUri].filter(Boolean).length,i=[n.inlinedRequests,n.fileName].filter(Boolean).length;if(e.isVertexAI()){if(i>0||r!==1)throw Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(r>0||i!==1)throw Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return n}function un(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 Error(`Unsupported destination: ${t}`)}function dn(e){if(typeof e!=`object`||!e)return{};let t=e,n=t.inlinedResponses;if(typeof n!=`object`||!n)return e;let r=n.inlinedResponses;if(!Array.isArray(r)||r.length===0)return e;let i=!1;for(let e of r){if(typeof e!=`object`||!e)continue;let t=e.response;if(!(typeof t!=`object`||!t)&&t.embedding!==void 0){i=!0;break}}return i&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),e}function B(e,t){let n=t;if(!e.isVertexAI()){if(/batches\/[^/]+$/.test(n))return n.split(`/`).pop();throw Error(`Invalid batch job name: ${n}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(n))return n.split(`/`).pop();if(/^\d+$/.test(n))return n;throw Error(`Invalid batch job name: ${n}.`)}function fn(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}function pn(e){return e.includes(`gemini`)&&e!==`gemini-embedding-001`||e.includes(`maas`)}function mn(e){let t={},n=h(e,[`responsesFile`]);n!=null&&m(t,[`fileName`],n);let r=h(e,[`inlinedResponses`,`inlinedResponses`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Qn(e))),m(t,[`inlinedResponses`],e)}let i=h(e,[`inlinedEmbedContentResponses`,`inlinedResponses`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`inlinedEmbedContentResponses`],e)}return t}function hn(e){let t={},n=h(e,[`predictionsFormat`]);n!=null&&m(t,[`format`],n);let r=h(e,[`gcsDestination`,`outputUriPrefix`]);r!=null&&m(t,[`gcsUri`],r);let i=h(e,[`bigqueryDestination`,`outputUri`]);return i!=null&&m(t,[`bigqueryUri`],i),t}function gn(e){let t={},n=h(e,[`format`]);n!=null&&m(t,[`predictionsFormat`],n);let r=h(e,[`gcsUri`]);r!=null&&m(t,[`gcsDestination`,`outputUriPrefix`],r);let i=h(e,[`bigqueryUri`]);if(i!=null&&m(t,[`bigqueryDestination`,`outputUri`],i),h(e,[`fileName`])!==void 0)throw Error(`fileName parameter is not supported in Vertex AI.`);if(h(e,[`inlinedResponses`])!==void 0)throw Error(`inlinedResponses parameter is not supported in Vertex AI.`);if(h(e,[`inlinedEmbedContentResponses`])!==void 0)throw Error(`inlinedEmbedContentResponses parameter is not supported in Vertex AI.`);return t}function _n(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`,`displayName`]);r!=null&&m(t,[`displayName`],r);let i=h(e,[`metadata`,`state`]);i!=null&&m(t,[`state`],fn(i));let a=h(e,[`metadata`,`createTime`]);a!=null&&m(t,[`createTime`],a);let o=h(e,[`metadata`,`endTime`]);o!=null&&m(t,[`endTime`],o);let s=h(e,[`metadata`,`updateTime`]);s!=null&&m(t,[`updateTime`],s);let c=h(e,[`metadata`,`model`]);c!=null&&m(t,[`model`],c);let l=h(e,[`metadata`,`output`]);return l!=null&&m(t,[`dest`],mn(dn(l))),t}function vn(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`displayName`]);r!=null&&m(t,[`displayName`],r);let i=h(e,[`state`]);i!=null&&m(t,[`state`],fn(i));let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`createTime`]);o!=null&&m(t,[`createTime`],o);let s=h(e,[`startTime`]);s!=null&&m(t,[`startTime`],s);let c=h(e,[`endTime`]);c!=null&&m(t,[`endTime`],c);let l=h(e,[`updateTime`]);l!=null&&m(t,[`updateTime`],l);let u=h(e,[`model`]);u!=null&&m(t,[`model`],u);let d=h(e,[`inputConfig`]);d!=null&&m(t,[`src`],yn(d));let f=h(e,[`outputConfig`]);f!=null&&m(t,[`dest`],hn(dn(f)));let p=h(e,[`completionStats`]);return p!=null&&m(t,[`completionStats`],p),t}function yn(e){let t={},n=h(e,[`instancesFormat`]);n!=null&&m(t,[`format`],n);let r=h(e,[`gcsSource`,`uris`]);r!=null&&m(t,[`gcsUri`],r);let i=h(e,[`bigquerySource`,`inputUri`]);return i!=null&&m(t,[`bigqueryUri`],i),t}function bn(e,t){let n={};if(h(t,[`format`])!==void 0)throw Error(`format parameter is not supported in Gemini API.`);if(h(t,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);if(h(t,[`bigqueryUri`])!==void 0)throw Error(`bigqueryUri parameter is not supported in Gemini API.`);let r=h(t,[`fileName`]);r!=null&&m(n,[`fileName`],r);let i=h(t,[`inlinedRequests`]);if(i!=null){let t=i;Array.isArray(t)&&(t=t.map(t=>Zn(e,t))),m(n,[`requests`,`requests`],t)}return n}function xn(e){let t={},n=h(e,[`format`]);n!=null&&m(t,[`instancesFormat`],n);let r=h(e,[`gcsUri`]);r!=null&&m(t,[`gcsSource`,`uris`],r);let i=h(e,[`bigqueryUri`]);if(i!=null&&m(t,[`bigquerySource`,`inputUri`],i),h(e,[`fileName`])!==void 0)throw Error(`fileName parameter is not supported in Vertex AI.`);if(h(e,[`inlinedRequests`])!==void 0)throw Error(`inlinedRequests parameter is not supported in Vertex AI.`);return t}function Sn(e){let t={},n=h(e,[`data`]);if(n!=null&&m(t,[`data`],n),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function Cn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function wn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function Tn(e){let t={},n=h(e,[`content`]);n!=null&&m(t,[`content`],n);let r=h(e,[`citationMetadata`]);r!=null&&m(t,[`citationMetadata`],En(r));let i=h(e,[`tokenCount`]);i!=null&&m(t,[`tokenCount`],i);let a=h(e,[`finishReason`]);a!=null&&m(t,[`finishReason`],a);let o=h(e,[`groundingMetadata`]);o!=null&&m(t,[`groundingMetadata`],o);let s=h(e,[`avgLogprobs`]);s!=null&&m(t,[`avgLogprobs`],s);let c=h(e,[`index`]);c!=null&&m(t,[`index`],c);let l=h(e,[`logprobsResult`]);l!=null&&m(t,[`logprobsResult`],l);let u=h(e,[`safetyRatings`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`safetyRatings`],e)}let d=h(e,[`urlContextMetadata`]);return d!=null&&m(t,[`urlContextMetadata`],d),t}function En(e){let t={},n=h(e,[`citationSources`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`citations`],e)}return t}function Dn(e){let t={},n=h(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>ar(e))),m(t,[`parts`],e)}let r=h(e,[`role`]);return r!=null&&m(t,[`role`],r),t}function On(e,t){let n={},r=h(e,[`displayName`]);if(t!==void 0&&r!=null&&m(t,[`batch`,`displayName`],r),h(e,[`dest`])!==void 0)throw Error(`dest parameter is not supported in Gemini API.`);return n}function kn(e,t){let n={},r=h(e,[`displayName`]);t!==void 0&&r!=null&&m(t,[`displayName`],r);let i=h(e,[`dest`]);return t!==void 0&&i!=null&&m(t,[`outputConfig`],gn(un(i))),n}function An(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`_url`,`model`],N(e,r));let i=h(t,[`src`]);i!=null&&m(n,[`batch`,`inputConfig`],bn(e,ln(e,i)));let a=h(t,[`config`]);return a!=null&&On(a,n),n}function jn(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`model`],N(e,r));let i=h(t,[`src`]);i!=null&&m(n,[`inputConfig`],xn(ln(e,i)));let a=h(t,[`config`]);return a!=null&&kn(a,n),n}function Mn(e,t){let n={},r=h(e,[`displayName`]);return t!==void 0&&r!=null&&m(t,[`batch`,`displayName`],r),n}function Nn(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`_url`,`model`],N(e,r));let i=h(t,[`src`]);i!=null&&m(n,[`batch`,`inputConfig`],Bn(e,i));let a=h(t,[`config`]);return a!=null&&Mn(a,n),n}function Pn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function Fn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function In(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);return a!=null&&m(t,[`error`],a),t}function Ln(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);return a!=null&&m(t,[`error`],a),t}function Rn(e,t){let n={},r=h(t,[`contents`]);if(r!=null){let t=Gt(e,r);Array.isArray(t)&&(t=t.map(e=>e)),m(n,[`requests[]`,`request`,`content`],t)}let i=h(t,[`config`]);return i!=null&&(m(n,[`_self`],zn(i,n)),g(n,{"requests[].*":`requests[].request.*`})),n}function zn(e,t){let n={},r=h(e,[`taskType`]);t!==void 0&&r!=null&&m(t,[`requests[]`,`taskType`],r);let i=h(e,[`title`]);t!==void 0&&i!=null&&m(t,[`requests[]`,`title`],i);let a=h(e,[`outputDimensionality`]);if(t!==void 0&&a!=null&&m(t,[`requests[]`,`outputDimensionality`],a),h(e,[`mimeType`])!==void 0)throw Error(`mimeType parameter is not supported in Gemini API.`);if(h(e,[`autoTruncate`])!==void 0)throw Error(`autoTruncate parameter is not supported in Gemini API.`);return n}function Bn(e,t){let n={},r=h(t,[`fileName`]);r!=null&&m(n,[`file_name`],r);let i=h(t,[`inlinedRequests`]);return i!=null&&m(n,[`requests`],Rn(e,i)),n}function Vn(e){let t={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=h(e,[`fileUri`]);n!=null&&m(t,[`fileUri`],n);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function Hn(e){let t={},n=h(e,[`id`]);n!=null&&m(t,[`id`],n);let r=h(e,[`args`]);r!=null&&m(t,[`args`],r);let i=h(e,[`name`]);if(i!=null&&m(t,[`name`],i),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function Un(e){let t={},n=h(e,[`allowedFunctionNames`]);n!=null&&m(t,[`allowedFunctionNames`],n);let r=h(e,[`mode`]);if(r!=null&&m(t,[`mode`],r),h(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return t}function Wn(e,t,n){let r={},i=h(t,[`systemInstruction`]);n!==void 0&&i!=null&&m(n,[`systemInstruction`],Dn(P(i)));let a=h(t,[`temperature`]);a!=null&&m(r,[`temperature`],a);let o=h(t,[`topP`]);o!=null&&m(r,[`topP`],o);let s=h(t,[`topK`]);s!=null&&m(r,[`topK`],s);let c=h(t,[`candidateCount`]);c!=null&&m(r,[`candidateCount`],c);let l=h(t,[`maxOutputTokens`]);l!=null&&m(r,[`maxOutputTokens`],l);let u=h(t,[`stopSequences`]);u!=null&&m(r,[`stopSequences`],u);let d=h(t,[`responseLogprobs`]);d!=null&&m(r,[`responseLogprobs`],d);let f=h(t,[`logprobs`]);f!=null&&m(r,[`logprobs`],f);let p=h(t,[`presencePenalty`]);p!=null&&m(r,[`presencePenalty`],p);let g=h(t,[`frequencyPenalty`]);g!=null&&m(r,[`frequencyPenalty`],g);let _=h(t,[`seed`]);_!=null&&m(r,[`seed`],_);let v=h(t,[`responseMimeType`]);v!=null&&m(r,[`responseMimeType`],v);let y=h(t,[`responseSchema`]);y!=null&&m(r,[`responseSchema`],Jt(y));let b=h(t,[`responseJsonSchema`]);if(b!=null&&m(r,[`responseJsonSchema`],b),h(t,[`routingConfig`])!==void 0)throw Error(`routingConfig parameter is not supported in Gemini API.`);if(h(t,[`modelSelectionConfig`])!==void 0)throw Error(`modelSelectionConfig parameter is not supported in Gemini API.`);let x=h(t,[`safetySettings`]);if(n!==void 0&&x!=null){let e=x;Array.isArray(e)&&(e=e.map(e=>or(e))),m(n,[`safetySettings`],e)}let S=h(t,[`tools`]);if(n!==void 0&&S!=null){let e=L(S);Array.isArray(e)&&(e=e.map(e=>cr(I(e)))),m(n,[`tools`],e)}let C=h(t,[`toolConfig`]);if(n!==void 0&&C!=null&&m(n,[`toolConfig`],sr(C)),h(t,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let w=h(t,[`cachedContent`]);n!==void 0&&w!=null&&m(n,[`cachedContent`],R(e,w));let T=h(t,[`responseModalities`]);T!=null&&m(r,[`responseModalities`],T);let E=h(t,[`mediaResolution`]);E!=null&&m(r,[`mediaResolution`],E);let D=h(t,[`speechConfig`]);if(D!=null&&m(r,[`speechConfig`],Yt(D)),h(t,[`audioTimestamp`])!==void 0)throw Error(`audioTimestamp parameter is not supported in Gemini API.`);let O=h(t,[`thinkingConfig`]);O!=null&&m(r,[`thinkingConfig`],O);let k=h(t,[`imageConfig`]);k!=null&&m(r,[`imageConfig`],Xn(k));let A=h(t,[`enableEnhancedCivicAnswers`]);if(A!=null&&m(r,[`enableEnhancedCivicAnswers`],A),h(t,[`modelArmorConfig`])!==void 0)throw Error(`modelArmorConfig parameter is not supported in Gemini API.`);return r}function Gn(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`candidates`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Tn(e))),m(t,[`candidates`],e)}let i=h(e,[`modelVersion`]);i!=null&&m(t,[`modelVersion`],i);let a=h(e,[`promptFeedback`]);a!=null&&m(t,[`promptFeedback`],a);let o=h(e,[`responseId`]);o!=null&&m(t,[`responseId`],o);let s=h(e,[`usageMetadata`]);return s!=null&&m(t,[`usageMetadata`],s),t}function Kn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function qn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function Jn(e){let t={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let n=h(e,[`enableWidget`]);return n!=null&&m(t,[`enableWidget`],n),t}function Yn(e){let t={},n=h(e,[`searchTypes`]);if(n!=null&&m(t,[`searchTypes`],n),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let r=h(e,[`timeRangeFilter`]);return r!=null&&m(t,[`timeRangeFilter`],r),t}function Xn(e){let t={},n=h(e,[`aspectRatio`]);n!=null&&m(t,[`aspectRatio`],n);let r=h(e,[`imageSize`]);if(r!=null&&m(t,[`imageSize`],r),h(e,[`personGeneration`])!==void 0)throw Error(`personGeneration parameter is not supported in Gemini API.`);if(h(e,[`prominentPeople`])!==void 0)throw Error(`prominentPeople parameter is not supported in Gemini API.`);if(h(e,[`outputMimeType`])!==void 0)throw Error(`outputMimeType parameter is not supported in Gemini API.`);if(h(e,[`outputCompressionQuality`])!==void 0)throw Error(`outputCompressionQuality parameter is not supported in Gemini API.`);return t}function Zn(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`request`,`model`],N(e,r));let i=h(t,[`contents`]);if(i!=null){let e=F(i);Array.isArray(e)&&(e=e.map(e=>Dn(e))),m(n,[`request`,`contents`],e)}let a=h(t,[`metadata`]);a!=null&&m(n,[`metadata`],a);let o=h(t,[`config`]);return o!=null&&m(n,[`request`,`generationConfig`],Wn(e,o,h(n,[`request`],{}))),n}function Qn(e){let t={},n=h(e,[`response`]);n!=null&&m(t,[`response`],Gn(n));let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`error`]);return i!=null&&m(t,[`error`],i),t}function $n(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);if(t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),h(e,[`filter`])!==void 0)throw Error(`filter parameter is not supported in Gemini API.`);return n}function er(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i);let a=h(e,[`filter`]);return t!==void 0&&a!=null&&m(t,[`_query`,`filter`],a),n}function tr(e){let t={},n=h(e,[`config`]);return n!=null&&$n(n,t),t}function nr(e){let t={},n=h(e,[`config`]);return n!=null&&er(n,t),t}function rr(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`operations`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>_n(e))),m(t,[`batchJobs`],e)}return t}function ir(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`batchPredictionJobs`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>vn(e))),m(t,[`batchJobs`],e)}return t}function ar(e){let t={},n=h(e,[`mediaResolution`]);n!=null&&m(t,[`mediaResolution`],n);let r=h(e,[`codeExecutionResult`]);r!=null&&m(t,[`codeExecutionResult`],r);let i=h(e,[`executableCode`]);i!=null&&m(t,[`executableCode`],i);let a=h(e,[`fileData`]);a!=null&&m(t,[`fileData`],Vn(a));let o=h(e,[`functionCall`]);o!=null&&m(t,[`functionCall`],Hn(o));let s=h(e,[`functionResponse`]);s!=null&&m(t,[`functionResponse`],s);let c=h(e,[`inlineData`]);c!=null&&m(t,[`inlineData`],Sn(c));let l=h(e,[`text`]);l!=null&&m(t,[`text`],l);let u=h(e,[`thought`]);u!=null&&m(t,[`thought`],u);let d=h(e,[`thoughtSignature`]);d!=null&&m(t,[`thoughtSignature`],d);let f=h(e,[`videoMetadata`]);return f!=null&&m(t,[`videoMetadata`],f),t}function or(e){let t={},n=h(e,[`category`]);if(n!=null&&m(t,[`category`],n),h(e,[`method`])!==void 0)throw Error(`method parameter is not supported in Gemini API.`);let r=h(e,[`threshold`]);return r!=null&&m(t,[`threshold`],r),t}function sr(e){let t={},n=h(e,[`retrievalConfig`]);n!=null&&m(t,[`retrievalConfig`],n);let r=h(e,[`functionCallingConfig`]);return r!=null&&m(t,[`functionCallingConfig`],Un(r)),t}function cr(e){let t={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=h(e,[`computerUse`]);n!=null&&m(t,[`computerUse`],n);let r=h(e,[`fileSearch`]);r!=null&&m(t,[`fileSearch`],r);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],Yn(i));let a=h(e,[`codeExecution`]);if(a!=null&&m(t,[`codeExecution`],a),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let o=h(e,[`functionDeclarations`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`functionDeclarations`],e)}let s=h(e,[`googleMaps`]);s!=null&&m(t,[`googleMaps`],Jn(s));let c=h(e,[`googleSearchRetrieval`]);c!=null&&m(t,[`googleSearchRetrieval`],c);let l=h(e,[`urlContext`]);l!=null&&m(t,[`urlContext`],l);let u=h(e,[`mcpServers`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mcpServers`],e)}return t}var V;(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`})(V||={});var H=class{constructor(e,t,n,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,n,r)}init(e,t,n){this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.sdkHttpResponseInternal=t?.sdkHttpResponse,this.idxInternal=0;let r={config:{}};r=!n||Object.keys(n).length===0?{config:{}}:typeof n==`object`?Object.assign({},n):n,r.config&&(r.config.pageToken=t.nextPageToken),this.paramsInternal=r,this.pageInternalSize=r.config?.pageSize??this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw Error(`No more pages to fetch.`);let e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){return this.params.config?.pageToken!==void 0}},lr=class extends f{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new H(V.PAGED_ITEM_BATCH_JOBS,e=>this.listInternal(e),await this.listInternal(e),e),this.create=async e=>(this.apiClient.isVertexAI()&&(e.config=this.formatDestination(e.src,e.config)),this.createInternal(e)),this.createEmbeddings=async e=>{if(console.warn(`batches.createEmbeddings() is experimental and may change without notice.`),this.apiClient.isVertexAI())throw Error(`Vertex AI does not support batches.createEmbeddings.`);return this.createEmbeddingsInternal(e)}}createInlinedGenerateContentRequest(e){let t=An(this.apiClient,e),n=t._url,r=p(`{model}:batchGenerateContent`,n),i=t.batch.inputConfig.requests,a=i.requests,o=[];for(let e of a){let t=Object.assign({},e);if(t.systemInstruction){let e=t.systemInstruction;delete t.systemInstruction;let n=t.request;n.systemInstruction=e,t.request=n}o.push(t)}return i.requests=o,delete t.config,delete t._url,delete t._query,{path:r,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 n=t?Object.assign({},t):{},r=Date.now().toString();if(n.displayName||=`genaiBatchJob_${r}`,n.dest===void 0){let t=this.getGcsUri(e),i=this.getBigqueryUri(e);if(t)t.endsWith(`.jsonl`)?n.dest=`${t.slice(0,-6)}/dest`:n.dest=`${t}_dest_${r}`;else if(i)n.dest=`${i}_dest_${r}`;else throw Error(`Unsupported source for Vertex AI: No GCS or BigQuery URI found.`)}return n}async createInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=jn(this.apiClient,e);return n=p(`batchPredictionJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}else{let i=An(this.apiClient,e);return n=p(`{model}:batchGenerateContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_n(e))}}async createEmbeddingsInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Nn(this.apiClient,e);return n=p(`{model}:asyncBatchEmbedContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_n(e))}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=qn(this.apiClient,e);return n=p(`batchPredictionJobs/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}else{let i=Kn(this.apiClient,e);return n=p(`batches/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_n(e))}}async cancel(e){let t=``,n={};if(this.apiClient.isVertexAI()){let r=wn(this.apiClient,e);t=p(`batchPredictionJobs/{name}:cancel`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}else{let r=Cn(this.apiClient,e);t=p(`batches/{name}:cancel`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=nr(e);return n=p(`batchPredictionJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ir(e),n=new jt;return Object.assign(n,t),n})}else{let i=tr(e);return n=p(`batches`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=rr(e),n=new jt;return Object.assign(n,t),n})}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Fn(this.apiClient,e);return n=p(`batchPredictionJobs/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>Ln(e))}else{let i=Pn(this.apiClient,e);return n=p(`batches/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>In(e))}}};function ur(e){let t={},n=h(e,[`data`]);if(n!=null&&m(t,[`data`],n),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function dr(e){let t={},n=h(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Pr(e))),m(t,[`parts`],e)}let r=h(e,[`role`]);return r!=null&&m(t,[`role`],r),t}function fr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);t!==void 0&&i!=null&&m(t,[`expireTime`],i);let a=h(e,[`displayName`]);t!==void 0&&a!=null&&m(t,[`displayName`],a);let o=h(e,[`contents`]);if(t!==void 0&&o!=null){let e=F(o);Array.isArray(e)&&(e=e.map(e=>dr(e))),m(t,[`contents`],e)}let s=h(e,[`systemInstruction`]);t!==void 0&&s!=null&&m(t,[`systemInstruction`],dr(P(s)));let c=h(e,[`tools`]);if(t!==void 0&&c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Ir(e))),m(t,[`tools`],e)}let l=h(e,[`toolConfig`]);if(t!==void 0&&l!=null&&m(t,[`toolConfig`],Fr(l)),h(e,[`kmsKeyName`])!==void 0)throw Error(`kmsKeyName parameter is not supported in Gemini API.`);return n}function pr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);t!==void 0&&i!=null&&m(t,[`expireTime`],i);let a=h(e,[`displayName`]);t!==void 0&&a!=null&&m(t,[`displayName`],a);let o=h(e,[`contents`]);if(t!==void 0&&o!=null){let e=F(o);Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`contents`],e)}let s=h(e,[`systemInstruction`]);t!==void 0&&s!=null&&m(t,[`systemInstruction`],P(s));let c=h(e,[`tools`]);if(t!==void 0&&c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Lr(e))),m(t,[`tools`],e)}let l=h(e,[`toolConfig`]);t!==void 0&&l!=null&&m(t,[`toolConfig`],l);let u=h(e,[`kmsKeyName`]);return t!==void 0&&u!=null&&m(t,[`encryption_spec`,`kmsKeyName`],u),n}function mr(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`model`],Ft(e,r));let i=h(t,[`config`]);return i!=null&&fr(i,n),n}function hr(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`model`],Ft(e,r));let i=h(t,[`config`]);return i!=null&&pr(i,n),n}function gr(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function _r(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function vr(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function yr(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function br(e){let t={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=h(e,[`fileUri`]);n!=null&&m(t,[`fileUri`],n);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function xr(e){let t={},n=h(e,[`id`]);n!=null&&m(t,[`id`],n);let r=h(e,[`args`]);r!=null&&m(t,[`args`],r);let i=h(e,[`name`]);if(i!=null&&m(t,[`name`],i),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function Sr(e){let t={},n=h(e,[`allowedFunctionNames`]);n!=null&&m(t,[`allowedFunctionNames`],n);let r=h(e,[`mode`]);if(r!=null&&m(t,[`mode`],r),h(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return t}function Cr(e){let t={},n=h(e,[`description`]);n!=null&&m(t,[`description`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`parameters`]);i!=null&&m(t,[`parameters`],i);let a=h(e,[`parametersJsonSchema`]);a!=null&&m(t,[`parametersJsonSchema`],a);let o=h(e,[`response`]);o!=null&&m(t,[`response`],o);let s=h(e,[`responseJsonSchema`]);if(s!=null&&m(t,[`responseJsonSchema`],s),h(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return t}function wr(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function Tr(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function Er(e){let t={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let n=h(e,[`enableWidget`]);return n!=null&&m(t,[`enableWidget`],n),t}function Dr(e){let t={},n=h(e,[`searchTypes`]);if(n!=null&&m(t,[`searchTypes`],n),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let r=h(e,[`timeRangeFilter`]);return r!=null&&m(t,[`timeRangeFilter`],r),t}function Or(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function kr(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function Ar(e){let t={},n=h(e,[`config`]);return n!=null&&Or(n,t),t}function jr(e){let t={},n=h(e,[`config`]);return n!=null&&kr(n,t),t}function Mr(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`cachedContents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`cachedContents`],e)}return t}function Nr(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`cachedContents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`cachedContents`],e)}return t}function Pr(e){let t={},n=h(e,[`mediaResolution`]);n!=null&&m(t,[`mediaResolution`],n);let r=h(e,[`codeExecutionResult`]);r!=null&&m(t,[`codeExecutionResult`],r);let i=h(e,[`executableCode`]);i!=null&&m(t,[`executableCode`],i);let a=h(e,[`fileData`]);a!=null&&m(t,[`fileData`],br(a));let o=h(e,[`functionCall`]);o!=null&&m(t,[`functionCall`],xr(o));let s=h(e,[`functionResponse`]);s!=null&&m(t,[`functionResponse`],s);let c=h(e,[`inlineData`]);c!=null&&m(t,[`inlineData`],ur(c));let l=h(e,[`text`]);l!=null&&m(t,[`text`],l);let u=h(e,[`thought`]);u!=null&&m(t,[`thought`],u);let d=h(e,[`thoughtSignature`]);d!=null&&m(t,[`thoughtSignature`],d);let f=h(e,[`videoMetadata`]);return f!=null&&m(t,[`videoMetadata`],f),t}function Fr(e){let t={},n=h(e,[`retrievalConfig`]);n!=null&&m(t,[`retrievalConfig`],n);let r=h(e,[`functionCallingConfig`]);return r!=null&&m(t,[`functionCallingConfig`],Sr(r)),t}function Ir(e){let t={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=h(e,[`computerUse`]);n!=null&&m(t,[`computerUse`],n);let r=h(e,[`fileSearch`]);r!=null&&m(t,[`fileSearch`],r);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],Dr(i));let a=h(e,[`codeExecution`]);if(a!=null&&m(t,[`codeExecution`],a),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let o=h(e,[`functionDeclarations`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`functionDeclarations`],e)}let s=h(e,[`googleMaps`]);s!=null&&m(t,[`googleMaps`],Er(s));let c=h(e,[`googleSearchRetrieval`]);c!=null&&m(t,[`googleSearchRetrieval`],c);let l=h(e,[`urlContext`]);l!=null&&m(t,[`urlContext`],l);let u=h(e,[`mcpServers`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mcpServers`],e)}return t}function Lr(e){let t={},n=h(e,[`retrieval`]);n!=null&&m(t,[`retrieval`],n);let r=h(e,[`computerUse`]);if(r!=null&&m(t,[`computerUse`],r),h(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],i);let a=h(e,[`codeExecution`]);a!=null&&m(t,[`codeExecution`],a);let o=h(e,[`enterpriseWebSearch`]);o!=null&&m(t,[`enterpriseWebSearch`],o);let s=h(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>Cr(e))),m(t,[`functionDeclarations`],e)}let c=h(e,[`googleMaps`]);c!=null&&m(t,[`googleMaps`],c);let l=h(e,[`googleSearchRetrieval`]);l!=null&&m(t,[`googleSearchRetrieval`],l);let u=h(e,[`urlContext`]);if(u!=null&&m(t,[`urlContext`],u),h(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return t}function Rr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);return t!==void 0&&i!=null&&m(t,[`expireTime`],i),n}function zr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);return t!==void 0&&i!=null&&m(t,[`expireTime`],i),n}function Br(e,t){let n={},r=h(t,[`name`]);r!=null&&m(n,[`_url`,`name`],R(e,r));let i=h(t,[`config`]);return i!=null&&Rr(i,n),n}function Vr(e,t){let n={},r=h(t,[`name`]);r!=null&&m(n,[`_url`,`name`],R(e,r));let i=h(t,[`config`]);return i!=null&&zr(i,n),n}var Hr=class extends f{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new H(V.PAGED_ITEM_CACHED_CONTENTS,e=>this.listInternal(e),await this.listInternal(e),e)}async create(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=hr(this.apiClient,e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=mr(this.apiClient,e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Tr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=wr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=_r(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=yr(e),n=new xt;return Object.assign(n,t),n})}else{let i=gr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=vr(e),n=new xt;return Object.assign(n,t),n})}}async update(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Vr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=Br(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=jr(e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Nr(e),n=new St;return Object.assign(n,t),n})}else{let i=Ar(e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Mr(e),n=new St;return Object.assign(n,t),n})}}};function Ur(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Wr(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function U(e){return this instanceof U?(this.v=e,this):new U(e)}function W(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof U?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function G(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Wr==`function`?Wr(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Gr(e){if(e.candidates==null||e.candidates.length===0)return!1;let t=e.candidates[0]?.content;return t===void 0?!1:Kr(t)}function Kr(e){if(e.parts===void 0||e.parts.length===0)return!1;for(let t of e.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function qr(e){if(e.length!==0){for(let t of e)if(t.role!==`user`&&t.role!==`model`)throw Error(`Role must be user or model, but got ${t.role}.`)}}function Jr(e){if(e===void 0||e.length===0)return[];let t=[],n=e.length,r=0;for(;r<n;)if(e[r].role===`user`)t.push(e[r]),r++;else{let i=[],a=!0;for(;r<n&&e[r].role===`model`;)i.push(e[r]),a&&!Kr(e[r])&&(a=!1),r++;a?t.push(...i):t.pop()}return t}var Yr=class{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new Xr(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},Xr=class{constructor(e,t,n,r={},i=[]){this.apiClient=e,this.modelsModule=t,this.model=n,this.config=r,this.history=i,this.sendPromise=Promise.resolve(),qr(i)}async sendMessage(e){await this.sendPromise;let t=P(e.message),n=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(t),config:e.config??this.config});return this.sendPromise=(async()=>{let e=await n,r=e.candidates?.[0]?.content,i=e.automaticFunctionCallingHistory,a=this.getHistory(!0).length,o=[];i!=null&&(o=i.slice(a)??[]);let s=r?[r]:[];this.recordHistory(t,s,o)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),n}async sendMessageStream(e){await this.sendPromise;let t=P(e.message),n=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(t),config:e.config??this.config});this.sendPromise=n.then(()=>void 0).catch(()=>void 0);let r=await n;return this.processStreamResponse(r,t)}getHistory(e=!1){let t=e?Jr(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return W(this,arguments,function*(){var n,r,i,a;let o=[];try{for(var s=!0,c=G(e),l;l=yield U(c.next()),n=l.done,!n;s=!0){a=l.value,s=!1;let e=a;if(Gr(e)){let t=e.candidates?.[0]?.content;t!==void 0&&o.push(t)}yield yield U(e)}}catch(e){r={error:e}}finally{try{!s&&!n&&(i=c.return)&&(yield U(i.call(c)))}finally{if(r)throw r.error}}this.recordHistory(t,o)})}recordHistory(e,t,n){let r=[];t.length>0&&t.every(e=>e.role!==void 0)?r=t:r.push({role:`model`,parts:[]}),n&&n.length>0?this.history.push(...Jr(n)):this.history.push(e),this.history.push(...r)}},Zr=class e extends Error{constructor(t){super(t.message),this.name=`ApiError`,this.status=t.status,Object.setPrototypeOf(this,e.prototype)}};function Qr(e){let t={},n=h(e,[`file`]);return n!=null&&m(t,[`file`],n),t}function $r(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function ei(e){let t={},n=h(e,[`name`]);return n!=null&&m(t,[`_url`,`file`],nn(n)),t}function ti(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function ni(e){let t={},n=h(e,[`name`]);return n!=null&&m(t,[`_url`,`file`],nn(n)),t}function ri(e){let t={},n=h(e,[`uris`]);return n!=null&&m(t,[`uris`],n),t}function ii(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function ai(e){let t={},n=h(e,[`config`]);return n!=null&&ii(n,t),t}function oi(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`files`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`files`],e)}return t}function si(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`files`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`files`],e)}return t}var ci=class extends f{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new H(V.PAGED_ITEM_FILES,e=>this.listInternal(e),await this.listInternal(e),e)}async upload(e){if(this.apiClient.isVertexAI())throw Error(`Vertex AI does not support uploading files. You can share files through a GCS bucket.`);return this.apiClient.uploadFile(e.file,e.config).then(e=>e)}async download(e){await this.apiClient.downloadFile(e)}async registerFiles(e){throw Error(`registerFiles is only supported in Node.js environments.`)}async _registerFiles(e){return this.registerFilesInternal(e)}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ai(e);return n=p(`files`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=oi(e),n=new Dt;return Object.assign(n,t),n})}}async createInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Qr(e);return n=p(`upload/v1beta/files`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=$r(e),n=new Ot;return Object.assign(n,t),n})}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ni(e);return n=p(`files/{file}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ei(e);return n=p(`files/{file}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ti(e),n=new kt;return Object.assign(n,t),n})}}async registerFilesInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ri(e);return n=p(`files:register`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=si(e),n=new At;return Object.assign(n,t),n})}}};function li(e){let t={},n=h(e,[`data`]);if(n!=null&&m(t,[`data`],n),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function ui(e){let t={},n=h(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Ei(e))),m(t,[`parts`],e)}let r=h(e,[`role`]);return r!=null&&m(t,[`role`],r),t}function di(e){let t={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=h(e,[`fileUri`]);n!=null&&m(t,[`fileUri`],n);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function fi(e){let t={},n=h(e,[`id`]);n!=null&&m(t,[`id`],n);let r=h(e,[`args`]);r!=null&&m(t,[`args`],r);let i=h(e,[`name`]);if(i!=null&&m(t,[`name`],i),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function pi(e){let t={},n=h(e,[`description`]);n!=null&&m(t,[`description`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`parameters`]);i!=null&&m(t,[`parameters`],i);let a=h(e,[`parametersJsonSchema`]);a!=null&&m(t,[`parametersJsonSchema`],a);let o=h(e,[`response`]);o!=null&&m(t,[`response`],o);let s=h(e,[`responseJsonSchema`]);if(s!=null&&m(t,[`responseJsonSchema`],s),h(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return t}function mi(e){let t={},n=h(e,[`modelSelectionConfig`]);n!=null&&m(t,[`modelConfig`],n);let r=h(e,[`responseJsonSchema`]);r!=null&&m(t,[`responseJsonSchema`],r);let i=h(e,[`audioTimestamp`]);i!=null&&m(t,[`audioTimestamp`],i);let a=h(e,[`candidateCount`]);a!=null&&m(t,[`candidateCount`],a);let o=h(e,[`enableAffectiveDialog`]);o!=null&&m(t,[`enableAffectiveDialog`],o);let s=h(e,[`frequencyPenalty`]);s!=null&&m(t,[`frequencyPenalty`],s);let c=h(e,[`logprobs`]);c!=null&&m(t,[`logprobs`],c);let l=h(e,[`maxOutputTokens`]);l!=null&&m(t,[`maxOutputTokens`],l);let u=h(e,[`mediaResolution`]);u!=null&&m(t,[`mediaResolution`],u);let d=h(e,[`presencePenalty`]);d!=null&&m(t,[`presencePenalty`],d);let f=h(e,[`responseLogprobs`]);f!=null&&m(t,[`responseLogprobs`],f);let p=h(e,[`responseMimeType`]);p!=null&&m(t,[`responseMimeType`],p);let g=h(e,[`responseModalities`]);g!=null&&m(t,[`responseModalities`],g);let _=h(e,[`responseSchema`]);_!=null&&m(t,[`responseSchema`],_);let v=h(e,[`routingConfig`]);v!=null&&m(t,[`routingConfig`],v);let y=h(e,[`seed`]);y!=null&&m(t,[`seed`],y);let b=h(e,[`speechConfig`]);b!=null&&m(t,[`speechConfig`],b);let x=h(e,[`stopSequences`]);x!=null&&m(t,[`stopSequences`],x);let S=h(e,[`temperature`]);S!=null&&m(t,[`temperature`],S);let C=h(e,[`thinkingConfig`]);C!=null&&m(t,[`thinkingConfig`],C);let w=h(e,[`topK`]);w!=null&&m(t,[`topK`],w);let T=h(e,[`topP`]);if(T!=null&&m(t,[`topP`],T),h(e,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);return t}function hi(e){let t={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let n=h(e,[`enableWidget`]);return n!=null&&m(t,[`enableWidget`],n),t}function gi(e){let t={},n=h(e,[`searchTypes`]);if(n!=null&&m(t,[`searchTypes`],n),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let r=h(e,[`timeRangeFilter`]);return r!=null&&m(t,[`timeRangeFilter`],r),t}function _i(e,t){let n={},r=h(e,[`generationConfig`]);t!==void 0&&r!=null&&m(t,[`setup`,`generationConfig`],r);let i=h(e,[`responseModalities`]);t!==void 0&&i!=null&&m(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=h(e,[`temperature`]);t!==void 0&&a!=null&&m(t,[`setup`,`generationConfig`,`temperature`],a);let o=h(e,[`topP`]);t!==void 0&&o!=null&&m(t,[`setup`,`generationConfig`,`topP`],o);let s=h(e,[`topK`]);t!==void 0&&s!=null&&m(t,[`setup`,`generationConfig`,`topK`],s);let c=h(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&m(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let l=h(e,[`mediaResolution`]);t!==void 0&&l!=null&&m(t,[`setup`,`generationConfig`,`mediaResolution`],l);let u=h(e,[`seed`]);t!==void 0&&u!=null&&m(t,[`setup`,`generationConfig`,`seed`],u);let d=h(e,[`speechConfig`]);t!==void 0&&d!=null&&m(t,[`setup`,`generationConfig`,`speechConfig`],Xt(d));let f=h(e,[`thinkingConfig`]);t!==void 0&&f!=null&&m(t,[`setup`,`generationConfig`,`thinkingConfig`],f);let p=h(e,[`enableAffectiveDialog`]);t!==void 0&&p!=null&&m(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],p);let g=h(e,[`systemInstruction`]);t!==void 0&&g!=null&&m(t,[`setup`,`systemInstruction`],ui(P(g)));let _=h(e,[`tools`]);if(t!==void 0&&_!=null){let e=L(_);Array.isArray(e)&&(e=e.map(e=>Oi(I(e)))),m(t,[`setup`,`tools`],e)}let v=h(e,[`sessionResumption`]);t!==void 0&&v!=null&&m(t,[`setup`,`sessionResumption`],Di(v));let y=h(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&m(t,[`setup`,`inputAudioTranscription`],y);let b=h(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&m(t,[`setup`,`outputAudioTranscription`],b);let x=h(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&m(t,[`setup`,`realtimeInputConfig`],x);let S=h(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&m(t,[`setup`,`contextWindowCompression`],S);let C=h(e,[`proactivity`]);if(t!==void 0&&C!=null&&m(t,[`setup`,`proactivity`],C),h(e,[`explicitVadSignal`])!==void 0)throw Error(`explicitVadSignal parameter is not supported in Gemini API.`);return n}function vi(e,t){let n={},r=h(e,[`generationConfig`]);t!==void 0&&r!=null&&m(t,[`setup`,`generationConfig`],mi(r));let i=h(e,[`responseModalities`]);t!==void 0&&i!=null&&m(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=h(e,[`temperature`]);t!==void 0&&a!=null&&m(t,[`setup`,`generationConfig`,`temperature`],a);let o=h(e,[`topP`]);t!==void 0&&o!=null&&m(t,[`setup`,`generationConfig`,`topP`],o);let s=h(e,[`topK`]);t!==void 0&&s!=null&&m(t,[`setup`,`generationConfig`,`topK`],s);let c=h(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&m(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let l=h(e,[`mediaResolution`]);t!==void 0&&l!=null&&m(t,[`setup`,`generationConfig`,`mediaResolution`],l);let u=h(e,[`seed`]);t!==void 0&&u!=null&&m(t,[`setup`,`generationConfig`,`seed`],u);let d=h(e,[`speechConfig`]);t!==void 0&&d!=null&&m(t,[`setup`,`generationConfig`,`speechConfig`],Xt(d));let f=h(e,[`thinkingConfig`]);t!==void 0&&f!=null&&m(t,[`setup`,`generationConfig`,`thinkingConfig`],f);let p=h(e,[`enableAffectiveDialog`]);t!==void 0&&p!=null&&m(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],p);let g=h(e,[`systemInstruction`]);t!==void 0&&g!=null&&m(t,[`setup`,`systemInstruction`],P(g));let _=h(e,[`tools`]);if(t!==void 0&&_!=null){let e=L(_);Array.isArray(e)&&(e=e.map(e=>ki(I(e)))),m(t,[`setup`,`tools`],e)}let v=h(e,[`sessionResumption`]);t!==void 0&&v!=null&&m(t,[`setup`,`sessionResumption`],v);let y=h(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&m(t,[`setup`,`inputAudioTranscription`],y);let b=h(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&m(t,[`setup`,`outputAudioTranscription`],b);let x=h(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&m(t,[`setup`,`realtimeInputConfig`],x);let S=h(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&m(t,[`setup`,`contextWindowCompression`],S);let C=h(e,[`proactivity`]);t!==void 0&&C!=null&&m(t,[`setup`,`proactivity`],C);let w=h(e,[`explicitVadSignal`]);return t!==void 0&&w!=null&&m(t,[`setup`,`explicitVadSignal`],w),n}function yi(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`setup`,`model`],N(e,r));let i=h(t,[`config`]);return i!=null&&m(n,[`config`],_i(i,n)),n}function bi(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`setup`,`model`],N(e,r));let i=h(t,[`config`]);return i!=null&&m(n,[`config`],vi(i,n)),n}function xi(e){let t={},n=h(e,[`musicGenerationConfig`]);return n!=null&&m(t,[`musicGenerationConfig`],n),t}function Si(e){let t={},n=h(e,[`weightedPrompts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`weightedPrompts`],e)}return t}function Ci(e){let t={},n=h(e,[`media`]);if(n!=null){let e=It(n);Array.isArray(e)&&(e=e.map(e=>li(e))),m(t,[`mediaChunks`],e)}let r=h(e,[`audio`]);r!=null&&m(t,[`audio`],li(zt(r)));let i=h(e,[`audioStreamEnd`]);i!=null&&m(t,[`audioStreamEnd`],i);let a=h(e,[`video`]);a!=null&&m(t,[`video`],li(Rt(a)));let o=h(e,[`text`]);o!=null&&m(t,[`text`],o);let s=h(e,[`activityStart`]);s!=null&&m(t,[`activityStart`],s);let c=h(e,[`activityEnd`]);return c!=null&&m(t,[`activityEnd`],c),t}function wi(e){let t={},n=h(e,[`media`]);if(n!=null){let e=It(n);Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mediaChunks`],e)}let r=h(e,[`audio`]);r!=null&&m(t,[`audio`],zt(r));let i=h(e,[`audioStreamEnd`]);i!=null&&m(t,[`audioStreamEnd`],i);let a=h(e,[`video`]);a!=null&&m(t,[`video`],Rt(a));let o=h(e,[`text`]);o!=null&&m(t,[`text`],o);let s=h(e,[`activityStart`]);s!=null&&m(t,[`activityStart`],s);let c=h(e,[`activityEnd`]);return c!=null&&m(t,[`activityEnd`],c),t}function Ti(e){let t={},n=h(e,[`setupComplete`]);n!=null&&m(t,[`setupComplete`],n);let r=h(e,[`serverContent`]);r!=null&&m(t,[`serverContent`],r);let i=h(e,[`toolCall`]);i!=null&&m(t,[`toolCall`],i);let a=h(e,[`toolCallCancellation`]);a!=null&&m(t,[`toolCallCancellation`],a);let o=h(e,[`usageMetadata`]);o!=null&&m(t,[`usageMetadata`],Ai(o));let s=h(e,[`goAway`]);s!=null&&m(t,[`goAway`],s);let c=h(e,[`sessionResumptionUpdate`]);c!=null&&m(t,[`sessionResumptionUpdate`],c);let l=h(e,[`voiceActivityDetectionSignal`]);l!=null&&m(t,[`voiceActivityDetectionSignal`],l);let u=h(e,[`voiceActivity`]);return u!=null&&m(t,[`voiceActivity`],ji(u)),t}function Ei(e){let t={},n=h(e,[`mediaResolution`]);n!=null&&m(t,[`mediaResolution`],n);let r=h(e,[`codeExecutionResult`]);r!=null&&m(t,[`codeExecutionResult`],r);let i=h(e,[`executableCode`]);i!=null&&m(t,[`executableCode`],i);let a=h(e,[`fileData`]);a!=null&&m(t,[`fileData`],di(a));let o=h(e,[`functionCall`]);o!=null&&m(t,[`functionCall`],fi(o));let s=h(e,[`functionResponse`]);s!=null&&m(t,[`functionResponse`],s);let c=h(e,[`inlineData`]);c!=null&&m(t,[`inlineData`],li(c));let l=h(e,[`text`]);l!=null&&m(t,[`text`],l);let u=h(e,[`thought`]);u!=null&&m(t,[`thought`],u);let d=h(e,[`thoughtSignature`]);d!=null&&m(t,[`thoughtSignature`],d);let f=h(e,[`videoMetadata`]);return f!=null&&m(t,[`videoMetadata`],f),t}function Di(e){let t={},n=h(e,[`handle`]);if(n!=null&&m(t,[`handle`],n),h(e,[`transparent`])!==void 0)throw Error(`transparent parameter is not supported in Gemini API.`);return t}function Oi(e){let t={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=h(e,[`computerUse`]);n!=null&&m(t,[`computerUse`],n);let r=h(e,[`fileSearch`]);r!=null&&m(t,[`fileSearch`],r);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],gi(i));let a=h(e,[`codeExecution`]);if(a!=null&&m(t,[`codeExecution`],a),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let o=h(e,[`functionDeclarations`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`functionDeclarations`],e)}let s=h(e,[`googleMaps`]);s!=null&&m(t,[`googleMaps`],hi(s));let c=h(e,[`googleSearchRetrieval`]);c!=null&&m(t,[`googleSearchRetrieval`],c);let l=h(e,[`urlContext`]);l!=null&&m(t,[`urlContext`],l);let u=h(e,[`mcpServers`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mcpServers`],e)}return t}function ki(e){let t={},n=h(e,[`retrieval`]);n!=null&&m(t,[`retrieval`],n);let r=h(e,[`computerUse`]);if(r!=null&&m(t,[`computerUse`],r),h(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],i);let a=h(e,[`codeExecution`]);a!=null&&m(t,[`codeExecution`],a);let o=h(e,[`enterpriseWebSearch`]);o!=null&&m(t,[`enterpriseWebSearch`],o);let s=h(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>pi(e))),m(t,[`functionDeclarations`],e)}let c=h(e,[`googleMaps`]);c!=null&&m(t,[`googleMaps`],c);let l=h(e,[`googleSearchRetrieval`]);l!=null&&m(t,[`googleSearchRetrieval`],l);let u=h(e,[`urlContext`]);if(u!=null&&m(t,[`urlContext`],u),h(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return t}function Ai(e){let t={},n=h(e,[`promptTokenCount`]);n!=null&&m(t,[`promptTokenCount`],n);let r=h(e,[`cachedContentTokenCount`]);r!=null&&m(t,[`cachedContentTokenCount`],r);let i=h(e,[`candidatesTokenCount`]);i!=null&&m(t,[`responseTokenCount`],i);let a=h(e,[`toolUsePromptTokenCount`]);a!=null&&m(t,[`toolUsePromptTokenCount`],a);let o=h(e,[`thoughtsTokenCount`]);o!=null&&m(t,[`thoughtsTokenCount`],o);let s=h(e,[`totalTokenCount`]);s!=null&&m(t,[`totalTokenCount`],s);let c=h(e,[`promptTokensDetails`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`promptTokensDetails`],e)}let l=h(e,[`cacheTokensDetails`]);if(l!=null){let e=l;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`cacheTokensDetails`],e)}let u=h(e,[`candidatesTokensDetails`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`responseTokensDetails`],e)}let d=h(e,[`toolUsePromptTokensDetails`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`toolUsePromptTokensDetails`],e)}let f=h(e,[`trafficType`]);return f!=null&&m(t,[`trafficType`],f),t}function ji(e){let t={},n=h(e,[`type`]);return n!=null&&m(t,[`voiceActivityType`],n),t}function Mi(e,t){let n={},r=h(e,[`data`]);if(r!=null&&m(n,[`data`],r),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function Ni(e,t){let n={},r=h(e,[`content`]);r!=null&&m(n,[`content`],r);let i=h(e,[`citationMetadata`]);i!=null&&m(n,[`citationMetadata`],Pi(i));let a=h(e,[`tokenCount`]);a!=null&&m(n,[`tokenCount`],a);let o=h(e,[`finishReason`]);o!=null&&m(n,[`finishReason`],o);let s=h(e,[`groundingMetadata`]);s!=null&&m(n,[`groundingMetadata`],s);let c=h(e,[`avgLogprobs`]);c!=null&&m(n,[`avgLogprobs`],c);let l=h(e,[`index`]);l!=null&&m(n,[`index`],l);let u=h(e,[`logprobsResult`]);u!=null&&m(n,[`logprobsResult`],u);let d=h(e,[`safetyRatings`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`safetyRatings`],e)}let f=h(e,[`urlContextMetadata`]);return f!=null&&m(n,[`urlContextMetadata`],f),n}function Pi(e,t){let n={},r=h(e,[`citationSources`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`citations`],e)}return n}function Fi(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>e)),m(r,[`contents`],e)}return r}function Ii(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`tokensInfo`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`tokensInfo`],e)}return n}function Li(e,t){let n={},r=h(e,[`values`]);r!=null&&m(n,[`values`],r);let i=h(e,[`statistics`]);return i!=null&&m(n,[`statistics`],Ri(i)),n}function Ri(e,t){let n={},r=h(e,[`truncated`]);r!=null&&m(n,[`truncated`],r);let i=h(e,[`token_count`]);return i!=null&&m(n,[`tokenCount`],i),n}function zi(e,t){let n={},r=h(e,[`parts`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>ro(e))),m(n,[`parts`],e)}let i=h(e,[`role`]);return i!=null&&m(n,[`role`],i),n}function Bi(e,t){let n={},r=h(e,[`controlType`]);r!=null&&m(n,[`controlType`],r);let i=h(e,[`enableControlImageComputation`]);return i!=null&&m(n,[`computeControl`],i),n}function Vi(e,t){let n={};if(h(e,[`systemInstruction`])!==void 0)throw Error(`systemInstruction parameter is not supported in Gemini API.`);if(h(e,[`tools`])!==void 0)throw Error(`tools parameter is not supported in Gemini API.`);if(h(e,[`generationConfig`])!==void 0)throw Error(`generationConfig parameter is not supported in Gemini API.`);return n}function Hi(e,t,n){let r={},i=h(e,[`systemInstruction`]);t!==void 0&&i!=null&&m(t,[`systemInstruction`],P(i));let a=h(e,[`tools`]);if(t!==void 0&&a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>xo(e))),m(t,[`tools`],e)}let o=h(e,[`generationConfig`]);return t!==void 0&&o!=null&&m(t,[`generationConfig`],Ra(o)),r}function Ui(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>zi(e))),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&Vi(o),r}function Wi(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>e)),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&Hi(o,r),r}function Gi(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`totalTokens`]);i!=null&&m(n,[`totalTokens`],i);let a=h(e,[`cachedContentTokenCount`]);return a!=null&&m(n,[`cachedContentTokenCount`],a),n}function Ki(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`totalTokens`]);return i!=null&&m(n,[`totalTokens`],i),n}function qi(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Ji(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Yi(e,t){let n={},r=h(e,[`sdkHttpResponse`]);return r!=null&&m(n,[`sdkHttpResponse`],r),n}function Xi(e,t){let n={},r=h(e,[`sdkHttpResponse`]);return r!=null&&m(n,[`sdkHttpResponse`],r),n}function Zi(e,t,n){let r={},i=h(e,[`outputGcsUri`]);t!==void 0&&i!=null&&m(t,[`parameters`,`storageUri`],i);let a=h(e,[`negativePrompt`]);t!==void 0&&a!=null&&m(t,[`parameters`,`negativePrompt`],a);let o=h(e,[`numberOfImages`]);t!==void 0&&o!=null&&m(t,[`parameters`,`sampleCount`],o);let s=h(e,[`aspectRatio`]);t!==void 0&&s!=null&&m(t,[`parameters`,`aspectRatio`],s);let c=h(e,[`guidanceScale`]);t!==void 0&&c!=null&&m(t,[`parameters`,`guidanceScale`],c);let l=h(e,[`seed`]);t!==void 0&&l!=null&&m(t,[`parameters`,`seed`],l);let u=h(e,[`safetyFilterLevel`]);t!==void 0&&u!=null&&m(t,[`parameters`,`safetySetting`],u);let d=h(e,[`personGeneration`]);t!==void 0&&d!=null&&m(t,[`parameters`,`personGeneration`],d);let f=h(e,[`includeSafetyAttributes`]);t!==void 0&&f!=null&&m(t,[`parameters`,`includeSafetyAttributes`],f);let p=h(e,[`includeRaiReason`]);t!==void 0&&p!=null&&m(t,[`parameters`,`includeRaiReason`],p);let g=h(e,[`language`]);t!==void 0&&g!=null&&m(t,[`parameters`,`language`],g);let _=h(e,[`outputMimeType`]);t!==void 0&&_!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],_);let v=h(e,[`outputCompressionQuality`]);t!==void 0&&v!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],v);let y=h(e,[`addWatermark`]);t!==void 0&&y!=null&&m(t,[`parameters`,`addWatermark`],y);let b=h(e,[`labels`]);t!==void 0&&b!=null&&m(t,[`labels`],b);let x=h(e,[`editMode`]);t!==void 0&&x!=null&&m(t,[`parameters`,`editMode`],x);let S=h(e,[`baseSteps`]);return t!==void 0&&S!=null&&m(t,[`parameters`,`editConfig`,`baseSteps`],S),r}function Qi(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`referenceImages`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>lo(e))),m(r,[`instances[0]`,`referenceImages`],e)}let s=h(t,[`config`]);return s!=null&&Zi(s,r),r}function $i(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}return n}function ea(e,t,n){let r={},i=h(e,[`taskType`]);t!==void 0&&i!=null&&m(t,[`requests[]`,`taskType`],i);let a=h(e,[`title`]);t!==void 0&&a!=null&&m(t,[`requests[]`,`title`],a);let o=h(e,[`outputDimensionality`]);if(t!==void 0&&o!=null&&m(t,[`requests[]`,`outputDimensionality`],o),h(e,[`mimeType`])!==void 0)throw Error(`mimeType parameter is not supported in Gemini API.`);if(h(e,[`autoTruncate`])!==void 0)throw Error(`autoTruncate parameter is not supported in Gemini API.`);return r}function ta(e,t,n){let r={},i=h(n,[`embeddingApiType`]);if(i===void 0&&(i=`PREDICT`),i===`PREDICT`){let n=h(e,[`taskType`]);t!==void 0&&n!=null&&m(t,[`instances[]`,`task_type`],n)}else if(i===`EMBED_CONTENT`){let n=h(e,[`taskType`]);t!==void 0&&n!=null&&m(t,[`taskType`],n)}let a=h(n,[`embeddingApiType`]);if(a===void 0&&(a=`PREDICT`),a===`PREDICT`){let n=h(e,[`title`]);t!==void 0&&n!=null&&m(t,[`instances[]`,`title`],n)}else if(a===`EMBED_CONTENT`){let n=h(e,[`title`]);t!==void 0&&n!=null&&m(t,[`title`],n)}let o=h(n,[`embeddingApiType`]);if(o===void 0&&(o=`PREDICT`),o===`PREDICT`){let n=h(e,[`outputDimensionality`]);t!==void 0&&n!=null&&m(t,[`parameters`,`outputDimensionality`],n)}else if(o===`EMBED_CONTENT`){let n=h(e,[`outputDimensionality`]);t!==void 0&&n!=null&&m(t,[`outputDimensionality`],n)}let s=h(n,[`embeddingApiType`]);if(s===void 0&&(s=`PREDICT`),s===`PREDICT`){let n=h(e,[`mimeType`]);t!==void 0&&n!=null&&m(t,[`instances[]`,`mimeType`],n)}let c=h(n,[`embeddingApiType`]);if(c===void 0&&(c=`PREDICT`),c===`PREDICT`){let n=h(e,[`autoTruncate`]);t!==void 0&&n!=null&&m(t,[`parameters`,`autoTruncate`],n)}else if(c===`EMBED_CONTENT`){let n=h(e,[`autoTruncate`]);t!==void 0&&n!=null&&m(t,[`autoTruncate`],n)}return r}function na(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let t=Gt(e,a);Array.isArray(t)&&(t=t.map(e=>e)),m(r,[`requests[]`,`content`],t)}let o=h(t,[`content`]);o!=null&&zi(P(o));let s=h(t,[`config`]);s!=null&&ea(s,r);let c=h(t,[`model`]);return c!==void 0&&m(r,[`requests[]`,`model`],N(e,c)),r}function ra(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(n,[`embeddingApiType`]);if(a===void 0&&(a=`PREDICT`),a===`PREDICT`){let n=h(t,[`contents`]);if(n!=null){let t=Gt(e,n);Array.isArray(t)&&(t=t.map(e=>e)),m(r,[`instances[]`,`content`],t)}}let o=h(n,[`embeddingApiType`]);if(o===void 0&&(o=`PREDICT`),o===`EMBED_CONTENT`){let e=h(t,[`content`]);e!=null&&m(r,[`content`],P(e))}let s=h(t,[`config`]);return s!=null&&ta(s,r,n),r}function ia(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`embeddings`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`embeddings`],e)}let a=h(e,[`metadata`]);return a!=null&&m(n,[`metadata`],a),n}function aa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions[]`,`embeddings`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Li(e))),m(n,[`embeddings`],e)}let a=h(e,[`metadata`]);if(a!=null&&m(n,[`metadata`],a),t&&h(t,[`embeddingApiType`])===`EMBED_CONTENT`){let t=h(e,[`embedding`]),r=h(e,[`usageMetadata`]),i=h(e,[`truncated`]);if(t){let e={};r&&r.promptTokenCount&&(e.tokenCount=r.promptTokenCount),i&&(e.truncated=i),t.statistics=e,m(n,[`embeddings`],[t])}}return n}function oa(e,t){let n={},r=h(e,[`endpoint`]);r!=null&&m(n,[`name`],r);let i=h(e,[`deployedModelId`]);return i!=null&&m(n,[`deployedModelId`],i),n}function sa(e,t){let n={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`fileUri`]);r!=null&&m(n,[`fileUri`],r);let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function ca(e,t){let n={},r=h(e,[`id`]);r!=null&&m(n,[`id`],r);let i=h(e,[`args`]);i!=null&&m(n,[`args`],i);let a=h(e,[`name`]);if(a!=null&&m(n,[`name`],a),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return n}function la(e,t){let n={},r=h(e,[`allowedFunctionNames`]);r!=null&&m(n,[`allowedFunctionNames`],r);let i=h(e,[`mode`]);if(i!=null&&m(n,[`mode`],i),h(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return n}function ua(e,t){let n={},r=h(e,[`description`]);r!=null&&m(n,[`description`],r);let i=h(e,[`name`]);i!=null&&m(n,[`name`],i);let a=h(e,[`parameters`]);a!=null&&m(n,[`parameters`],a);let o=h(e,[`parametersJsonSchema`]);o!=null&&m(n,[`parametersJsonSchema`],o);let s=h(e,[`response`]);s!=null&&m(n,[`response`],s);let c=h(e,[`responseJsonSchema`]);if(c!=null&&m(n,[`responseJsonSchema`],c),h(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return n}function da(e,t,n,r){let i={},a=h(t,[`systemInstruction`]);n!==void 0&&a!=null&&m(n,[`systemInstruction`],zi(P(a)));let o=h(t,[`temperature`]);o!=null&&m(i,[`temperature`],o);let s=h(t,[`topP`]);s!=null&&m(i,[`topP`],s);let c=h(t,[`topK`]);c!=null&&m(i,[`topK`],c);let l=h(t,[`candidateCount`]);l!=null&&m(i,[`candidateCount`],l);let u=h(t,[`maxOutputTokens`]);u!=null&&m(i,[`maxOutputTokens`],u);let d=h(t,[`stopSequences`]);d!=null&&m(i,[`stopSequences`],d);let f=h(t,[`responseLogprobs`]);f!=null&&m(i,[`responseLogprobs`],f);let p=h(t,[`logprobs`]);p!=null&&m(i,[`logprobs`],p);let g=h(t,[`presencePenalty`]);g!=null&&m(i,[`presencePenalty`],g);let _=h(t,[`frequencyPenalty`]);_!=null&&m(i,[`frequencyPenalty`],_);let v=h(t,[`seed`]);v!=null&&m(i,[`seed`],v);let y=h(t,[`responseMimeType`]);y!=null&&m(i,[`responseMimeType`],y);let b=h(t,[`responseSchema`]);b!=null&&m(i,[`responseSchema`],Jt(b));let x=h(t,[`responseJsonSchema`]);if(x!=null&&m(i,[`responseJsonSchema`],x),h(t,[`routingConfig`])!==void 0)throw Error(`routingConfig parameter is not supported in Gemini API.`);if(h(t,[`modelSelectionConfig`])!==void 0)throw Error(`modelSelectionConfig parameter is not supported in Gemini API.`);let S=h(t,[`safetySettings`]);if(n!==void 0&&S!=null){let e=S;Array.isArray(e)&&(e=e.map(e=>po(e))),m(n,[`safetySettings`],e)}let C=h(t,[`tools`]);if(n!==void 0&&C!=null){let e=L(C);Array.isArray(e)&&(e=e.map(e=>bo(I(e)))),m(n,[`tools`],e)}let w=h(t,[`toolConfig`]);if(n!==void 0&&w!=null&&m(n,[`toolConfig`],yo(w)),h(t,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let T=h(t,[`cachedContent`]);n!==void 0&&T!=null&&m(n,[`cachedContent`],R(e,T));let E=h(t,[`responseModalities`]);E!=null&&m(i,[`responseModalities`],E);let D=h(t,[`mediaResolution`]);D!=null&&m(i,[`mediaResolution`],D);let O=h(t,[`speechConfig`]);if(O!=null&&m(i,[`speechConfig`],Yt(O)),h(t,[`audioTimestamp`])!==void 0)throw Error(`audioTimestamp parameter is not supported in Gemini API.`);let k=h(t,[`thinkingConfig`]);k!=null&&m(i,[`thinkingConfig`],k);let A=h(t,[`imageConfig`]);A!=null&&m(i,[`imageConfig`],Ua(A));let ee=h(t,[`enableEnhancedCivicAnswers`]);if(ee!=null&&m(i,[`enableEnhancedCivicAnswers`],ee),h(t,[`modelArmorConfig`])!==void 0)throw Error(`modelArmorConfig parameter is not supported in Gemini API.`);return i}function fa(e,t,n,r){let i={},a=h(t,[`systemInstruction`]);n!==void 0&&a!=null&&m(n,[`systemInstruction`],P(a));let o=h(t,[`temperature`]);o!=null&&m(i,[`temperature`],o);let s=h(t,[`topP`]);s!=null&&m(i,[`topP`],s);let c=h(t,[`topK`]);c!=null&&m(i,[`topK`],c);let l=h(t,[`candidateCount`]);l!=null&&m(i,[`candidateCount`],l);let u=h(t,[`maxOutputTokens`]);u!=null&&m(i,[`maxOutputTokens`],u);let d=h(t,[`stopSequences`]);d!=null&&m(i,[`stopSequences`],d);let f=h(t,[`responseLogprobs`]);f!=null&&m(i,[`responseLogprobs`],f);let p=h(t,[`logprobs`]);p!=null&&m(i,[`logprobs`],p);let g=h(t,[`presencePenalty`]);g!=null&&m(i,[`presencePenalty`],g);let _=h(t,[`frequencyPenalty`]);_!=null&&m(i,[`frequencyPenalty`],_);let v=h(t,[`seed`]);v!=null&&m(i,[`seed`],v);let y=h(t,[`responseMimeType`]);y!=null&&m(i,[`responseMimeType`],y);let b=h(t,[`responseSchema`]);b!=null&&m(i,[`responseSchema`],Jt(b));let x=h(t,[`responseJsonSchema`]);x!=null&&m(i,[`responseJsonSchema`],x);let S=h(t,[`routingConfig`]);S!=null&&m(i,[`routingConfig`],S);let C=h(t,[`modelSelectionConfig`]);C!=null&&m(i,[`modelConfig`],C);let w=h(t,[`safetySettings`]);if(n!==void 0&&w!=null){let e=w;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`safetySettings`],e)}let T=h(t,[`tools`]);if(n!==void 0&&T!=null){let e=L(T);Array.isArray(e)&&(e=e.map(e=>xo(I(e)))),m(n,[`tools`],e)}let E=h(t,[`toolConfig`]);n!==void 0&&E!=null&&m(n,[`toolConfig`],E);let D=h(t,[`labels`]);n!==void 0&&D!=null&&m(n,[`labels`],D);let O=h(t,[`cachedContent`]);n!==void 0&&O!=null&&m(n,[`cachedContent`],R(e,O));let k=h(t,[`responseModalities`]);k!=null&&m(i,[`responseModalities`],k);let A=h(t,[`mediaResolution`]);A!=null&&m(i,[`mediaResolution`],A);let ee=h(t,[`speechConfig`]);ee!=null&&m(i,[`speechConfig`],Yt(ee));let te=h(t,[`audioTimestamp`]);te!=null&&m(i,[`audioTimestamp`],te);let ne=h(t,[`thinkingConfig`]);ne!=null&&m(i,[`thinkingConfig`],ne);let re=h(t,[`imageConfig`]);if(re!=null&&m(i,[`imageConfig`],Wa(re)),h(t,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);let ie=h(t,[`modelArmorConfig`]);return n!==void 0&&ie!=null&&m(n,[`modelArmorConfig`],ie),i}function pa(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>zi(e))),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&m(r,[`generationConfig`],da(e,o,r)),r}function ma(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>e)),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&m(r,[`generationConfig`],fa(e,o,r)),r}function ha(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`candidates`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ni(e))),m(n,[`candidates`],e)}let a=h(e,[`modelVersion`]);a!=null&&m(n,[`modelVersion`],a);let o=h(e,[`promptFeedback`]);o!=null&&m(n,[`promptFeedback`],o);let s=h(e,[`responseId`]);s!=null&&m(n,[`responseId`],s);let c=h(e,[`usageMetadata`]);return c!=null&&m(n,[`usageMetadata`],c),n}function ga(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`candidates`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`candidates`],e)}let a=h(e,[`createTime`]);a!=null&&m(n,[`createTime`],a);let o=h(e,[`modelVersion`]);o!=null&&m(n,[`modelVersion`],o);let s=h(e,[`promptFeedback`]);s!=null&&m(n,[`promptFeedback`],s);let c=h(e,[`responseId`]);c!=null&&m(n,[`responseId`],c);let l=h(e,[`usageMetadata`]);return l!=null&&m(n,[`usageMetadata`],l),n}function _a(e,t,n){let r={};if(h(e,[`outputGcsUri`])!==void 0)throw Error(`outputGcsUri parameter is not supported in Gemini API.`);if(h(e,[`negativePrompt`])!==void 0)throw Error(`negativePrompt parameter is not supported in Gemini API.`);let i=h(e,[`numberOfImages`]);t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i);let a=h(e,[`aspectRatio`]);t!==void 0&&a!=null&&m(t,[`parameters`,`aspectRatio`],a);let o=h(e,[`guidanceScale`]);if(t!==void 0&&o!=null&&m(t,[`parameters`,`guidanceScale`],o),h(e,[`seed`])!==void 0)throw Error(`seed parameter is not supported in Gemini API.`);let s=h(e,[`safetyFilterLevel`]);t!==void 0&&s!=null&&m(t,[`parameters`,`safetySetting`],s);let c=h(e,[`personGeneration`]);t!==void 0&&c!=null&&m(t,[`parameters`,`personGeneration`],c);let l=h(e,[`includeSafetyAttributes`]);t!==void 0&&l!=null&&m(t,[`parameters`,`includeSafetyAttributes`],l);let u=h(e,[`includeRaiReason`]);t!==void 0&&u!=null&&m(t,[`parameters`,`includeRaiReason`],u);let d=h(e,[`language`]);t!==void 0&&d!=null&&m(t,[`parameters`,`language`],d);let f=h(e,[`outputMimeType`]);t!==void 0&&f!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],f);let p=h(e,[`outputCompressionQuality`]);if(t!==void 0&&p!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],p),h(e,[`addWatermark`])!==void 0)throw Error(`addWatermark parameter is not supported in Gemini API.`);if(h(e,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let g=h(e,[`imageSize`]);if(t!==void 0&&g!=null&&m(t,[`parameters`,`sampleImageSize`],g),h(e,[`enhancePrompt`])!==void 0)throw Error(`enhancePrompt parameter is not supported in Gemini API.`);return r}function va(e,t,n){let r={},i=h(e,[`outputGcsUri`]);t!==void 0&&i!=null&&m(t,[`parameters`,`storageUri`],i);let a=h(e,[`negativePrompt`]);t!==void 0&&a!=null&&m(t,[`parameters`,`negativePrompt`],a);let o=h(e,[`numberOfImages`]);t!==void 0&&o!=null&&m(t,[`parameters`,`sampleCount`],o);let s=h(e,[`aspectRatio`]);t!==void 0&&s!=null&&m(t,[`parameters`,`aspectRatio`],s);let c=h(e,[`guidanceScale`]);t!==void 0&&c!=null&&m(t,[`parameters`,`guidanceScale`],c);let l=h(e,[`seed`]);t!==void 0&&l!=null&&m(t,[`parameters`,`seed`],l);let u=h(e,[`safetyFilterLevel`]);t!==void 0&&u!=null&&m(t,[`parameters`,`safetySetting`],u);let d=h(e,[`personGeneration`]);t!==void 0&&d!=null&&m(t,[`parameters`,`personGeneration`],d);let f=h(e,[`includeSafetyAttributes`]);t!==void 0&&f!=null&&m(t,[`parameters`,`includeSafetyAttributes`],f);let p=h(e,[`includeRaiReason`]);t!==void 0&&p!=null&&m(t,[`parameters`,`includeRaiReason`],p);let g=h(e,[`language`]);t!==void 0&&g!=null&&m(t,[`parameters`,`language`],g);let _=h(e,[`outputMimeType`]);t!==void 0&&_!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],_);let v=h(e,[`outputCompressionQuality`]);t!==void 0&&v!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],v);let y=h(e,[`addWatermark`]);t!==void 0&&y!=null&&m(t,[`parameters`,`addWatermark`],y);let b=h(e,[`labels`]);t!==void 0&&b!=null&&m(t,[`labels`],b);let x=h(e,[`imageSize`]);t!==void 0&&x!=null&&m(t,[`parameters`,`sampleImageSize`],x);let S=h(e,[`enhancePrompt`]);return t!==void 0&&S!=null&&m(t,[`parameters`,`enhancePrompt`],S),r}function ya(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`config`]);return o!=null&&_a(o,r),r}function ba(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`config`]);return o!=null&&va(o,r),r}function xa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Na(e))),m(n,[`generatedImages`],e)}let a=h(e,[`positivePromptSafetyAttributes`]);return a!=null&&m(n,[`positivePromptSafetyAttributes`],uo(a)),n}function Sa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}let a=h(e,[`positivePromptSafetyAttributes`]);return a!=null&&m(n,[`positivePromptSafetyAttributes`],fo(a)),n}function Ca(e,t,n){let r={},i=h(e,[`numberOfVideos`]);if(t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i),h(e,[`outputGcsUri`])!==void 0)throw Error(`outputGcsUri parameter is not supported in Gemini API.`);if(h(e,[`fps`])!==void 0)throw Error(`fps parameter is not supported in Gemini API.`);let a=h(e,[`durationSeconds`]);if(t!==void 0&&a!=null&&m(t,[`parameters`,`durationSeconds`],a),h(e,[`seed`])!==void 0)throw Error(`seed parameter is not supported in Gemini API.`);let o=h(e,[`aspectRatio`]);t!==void 0&&o!=null&&m(t,[`parameters`,`aspectRatio`],o);let s=h(e,[`resolution`]);t!==void 0&&s!=null&&m(t,[`parameters`,`resolution`],s);let c=h(e,[`personGeneration`]);if(t!==void 0&&c!=null&&m(t,[`parameters`,`personGeneration`],c),h(e,[`pubsubTopic`])!==void 0)throw Error(`pubsubTopic parameter is not supported in Gemini API.`);let l=h(e,[`negativePrompt`]);t!==void 0&&l!=null&&m(t,[`parameters`,`negativePrompt`],l);let u=h(e,[`enhancePrompt`]);if(t!==void 0&&u!=null&&m(t,[`parameters`,`enhancePrompt`],u),h(e,[`generateAudio`])!==void 0)throw Error(`generateAudio parameter is not supported in Gemini API.`);let d=h(e,[`lastFrame`]);t!==void 0&&d!=null&&m(t,[`instances[0]`,`lastFrame`],qa(d));let f=h(e,[`referenceImages`]);if(t!==void 0&&f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>Po(e))),m(t,[`instances[0]`,`referenceImages`],e)}if(h(e,[`mask`])!==void 0)throw Error(`mask parameter is not supported in Gemini API.`);if(h(e,[`compressionQuality`])!==void 0)throw Error(`compressionQuality parameter is not supported in Gemini API.`);return r}function wa(e,t,n){let r={},i=h(e,[`numberOfVideos`]);t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i);let a=h(e,[`outputGcsUri`]);t!==void 0&&a!=null&&m(t,[`parameters`,`storageUri`],a);let o=h(e,[`fps`]);t!==void 0&&o!=null&&m(t,[`parameters`,`fps`],o);let s=h(e,[`durationSeconds`]);t!==void 0&&s!=null&&m(t,[`parameters`,`durationSeconds`],s);let c=h(e,[`seed`]);t!==void 0&&c!=null&&m(t,[`parameters`,`seed`],c);let l=h(e,[`aspectRatio`]);t!==void 0&&l!=null&&m(t,[`parameters`,`aspectRatio`],l);let u=h(e,[`resolution`]);t!==void 0&&u!=null&&m(t,[`parameters`,`resolution`],u);let d=h(e,[`personGeneration`]);t!==void 0&&d!=null&&m(t,[`parameters`,`personGeneration`],d);let f=h(e,[`pubsubTopic`]);t!==void 0&&f!=null&&m(t,[`parameters`,`pubsubTopic`],f);let p=h(e,[`negativePrompt`]);t!==void 0&&p!=null&&m(t,[`parameters`,`negativePrompt`],p);let g=h(e,[`enhancePrompt`]);t!==void 0&&g!=null&&m(t,[`parameters`,`enhancePrompt`],g);let _=h(e,[`generateAudio`]);t!==void 0&&_!=null&&m(t,[`parameters`,`generateAudio`],_);let v=h(e,[`lastFrame`]);t!==void 0&&v!=null&&m(t,[`instances[0]`,`lastFrame`],K(v));let y=h(e,[`referenceImages`]);if(t!==void 0&&y!=null){let e=y;Array.isArray(e)&&(e=e.map(e=>Fo(e))),m(t,[`instances[0]`,`referenceImages`],e)}let b=h(e,[`mask`]);t!==void 0&&b!=null&&m(t,[`instances[0]`,`mask`],No(b));let x=h(e,[`compressionQuality`]);return t!==void 0&&x!=null&&m(t,[`parameters`,`compressionQuality`],x),r}function Ta(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`metadata`]);i!=null&&m(n,[`metadata`],i);let a=h(e,[`done`]);a!=null&&m(n,[`done`],a);let o=h(e,[`error`]);o!=null&&m(n,[`error`],o);let s=h(e,[`response`,`generateVideoResponse`]);return s!=null&&m(n,[`response`],ka(s)),n}function Ea(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`metadata`]);i!=null&&m(n,[`metadata`],i);let a=h(e,[`done`]);a!=null&&m(n,[`done`],a);let o=h(e,[`error`]);o!=null&&m(n,[`error`],o);let s=h(e,[`response`]);return s!=null&&m(n,[`response`],Aa(s)),n}function Da(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`image`]);o!=null&&m(r,[`instances[0]`,`image`],qa(o));let s=h(t,[`video`]);s!=null&&m(r,[`instances[0]`,`video`],Io(s));let c=h(t,[`source`]);c!=null&&ja(c,r);let l=h(t,[`config`]);return l!=null&&Ca(l,r),r}function Oa(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`image`]);o!=null&&m(r,[`instances[0]`,`image`],K(o));let s=h(t,[`video`]);s!=null&&m(r,[`instances[0]`,`video`],Lo(s));let c=h(t,[`source`]);c!=null&&Ma(c,r);let l=h(t,[`config`]);return l!=null&&wa(l,r),r}function ka(e,t){let n={},r=h(e,[`generatedSamples`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Ia(e))),m(n,[`generatedVideos`],e)}let i=h(e,[`raiMediaFilteredCount`]);i!=null&&m(n,[`raiMediaFilteredCount`],i);let a=h(e,[`raiMediaFilteredReasons`]);return a!=null&&m(n,[`raiMediaFilteredReasons`],a),n}function Aa(e,t){let n={},r=h(e,[`videos`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>La(e))),m(n,[`generatedVideos`],e)}let i=h(e,[`raiMediaFilteredCount`]);i!=null&&m(n,[`raiMediaFilteredCount`],i);let a=h(e,[`raiMediaFilteredReasons`]);return a!=null&&m(n,[`raiMediaFilteredReasons`],a),n}function ja(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`image`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`image`],qa(a));let o=h(e,[`video`]);return t!==void 0&&o!=null&&m(t,[`instances[0]`,`video`],Io(o)),r}function Ma(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`image`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`image`],K(a));let o=h(e,[`video`]);return t!==void 0&&o!=null&&m(t,[`instances[0]`,`video`],Lo(o)),r}function Na(e,t){let n={},r=h(e,[`_self`]);r!=null&&m(n,[`image`],Ga(r));let i=h(e,[`raiFilteredReason`]);i!=null&&m(n,[`raiFilteredReason`],i);let a=h(e,[`_self`]);return a!=null&&m(n,[`safetyAttributes`],uo(a)),n}function Pa(e,t){let n={},r=h(e,[`_self`]);r!=null&&m(n,[`image`],Ka(r));let i=h(e,[`raiFilteredReason`]);i!=null&&m(n,[`raiFilteredReason`],i);let a=h(e,[`_self`]);a!=null&&m(n,[`safetyAttributes`],fo(a));let o=h(e,[`prompt`]);return o!=null&&m(n,[`enhancedPrompt`],o),n}function Fa(e,t){let n={},r=h(e,[`_self`]);r!=null&&m(n,[`mask`],Ka(r));let i=h(e,[`labels`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`labels`],e)}return n}function Ia(e,t){let n={},r=h(e,[`video`]);return r!=null&&m(n,[`video`],jo(r)),n}function La(e,t){let n={},r=h(e,[`_self`]);return r!=null&&m(n,[`video`],Mo(r)),n}function Ra(e,t){let n={},r=h(e,[`modelSelectionConfig`]);r!=null&&m(n,[`modelConfig`],r);let i=h(e,[`responseJsonSchema`]);i!=null&&m(n,[`responseJsonSchema`],i);let a=h(e,[`audioTimestamp`]);a!=null&&m(n,[`audioTimestamp`],a);let o=h(e,[`candidateCount`]);o!=null&&m(n,[`candidateCount`],o);let s=h(e,[`enableAffectiveDialog`]);s!=null&&m(n,[`enableAffectiveDialog`],s);let c=h(e,[`frequencyPenalty`]);c!=null&&m(n,[`frequencyPenalty`],c);let l=h(e,[`logprobs`]);l!=null&&m(n,[`logprobs`],l);let u=h(e,[`maxOutputTokens`]);u!=null&&m(n,[`maxOutputTokens`],u);let d=h(e,[`mediaResolution`]);d!=null&&m(n,[`mediaResolution`],d);let f=h(e,[`presencePenalty`]);f!=null&&m(n,[`presencePenalty`],f);let p=h(e,[`responseLogprobs`]);p!=null&&m(n,[`responseLogprobs`],p);let g=h(e,[`responseMimeType`]);g!=null&&m(n,[`responseMimeType`],g);let _=h(e,[`responseModalities`]);_!=null&&m(n,[`responseModalities`],_);let v=h(e,[`responseSchema`]);v!=null&&m(n,[`responseSchema`],v);let y=h(e,[`routingConfig`]);y!=null&&m(n,[`routingConfig`],y);let b=h(e,[`seed`]);b!=null&&m(n,[`seed`],b);let x=h(e,[`speechConfig`]);x!=null&&m(n,[`speechConfig`],x);let S=h(e,[`stopSequences`]);S!=null&&m(n,[`stopSequences`],S);let C=h(e,[`temperature`]);C!=null&&m(n,[`temperature`],C);let w=h(e,[`thinkingConfig`]);w!=null&&m(n,[`thinkingConfig`],w);let T=h(e,[`topK`]);T!=null&&m(n,[`topK`],T);let E=h(e,[`topP`]);if(E!=null&&m(n,[`topP`],E),h(e,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);return n}function za(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Ba(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Va(e,t){let n={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let r=h(e,[`enableWidget`]);return r!=null&&m(n,[`enableWidget`],r),n}function Ha(e,t){let n={},r=h(e,[`searchTypes`]);if(r!=null&&m(n,[`searchTypes`],r),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let i=h(e,[`timeRangeFilter`]);return i!=null&&m(n,[`timeRangeFilter`],i),n}function Ua(e,t){let n={},r=h(e,[`aspectRatio`]);r!=null&&m(n,[`aspectRatio`],r);let i=h(e,[`imageSize`]);if(i!=null&&m(n,[`imageSize`],i),h(e,[`personGeneration`])!==void 0)throw Error(`personGeneration parameter is not supported in Gemini API.`);if(h(e,[`prominentPeople`])!==void 0)throw Error(`prominentPeople parameter is not supported in Gemini API.`);if(h(e,[`outputMimeType`])!==void 0)throw Error(`outputMimeType parameter is not supported in Gemini API.`);if(h(e,[`outputCompressionQuality`])!==void 0)throw Error(`outputCompressionQuality parameter is not supported in Gemini API.`);return n}function Wa(e,t){let n={},r=h(e,[`aspectRatio`]);r!=null&&m(n,[`aspectRatio`],r);let i=h(e,[`imageSize`]);i!=null&&m(n,[`imageSize`],i);let a=h(e,[`personGeneration`]);a!=null&&m(n,[`personGeneration`],a);let o=h(e,[`prominentPeople`]);o!=null&&m(n,[`prominentPeople`],o);let s=h(e,[`outputMimeType`]);s!=null&&m(n,[`imageOutputOptions`,`mimeType`],s);let c=h(e,[`outputCompressionQuality`]);return c!=null&&m(n,[`imageOutputOptions`,`compressionQuality`],c),n}function Ga(e,t){let n={},r=h(e,[`bytesBase64Encoded`]);r!=null&&m(n,[`imageBytes`],z(r));let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function Ka(e,t){let n={},r=h(e,[`gcsUri`]);r!=null&&m(n,[`gcsUri`],r);let i=h(e,[`bytesBase64Encoded`]);i!=null&&m(n,[`imageBytes`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function qa(e,t){let n={};if(h(e,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);let r=h(e,[`imageBytes`]);r!=null&&m(n,[`bytesBase64Encoded`],z(r));let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function K(e,t){let n={},r=h(e,[`gcsUri`]);r!=null&&m(n,[`gcsUri`],r);let i=h(e,[`imageBytes`]);i!=null&&m(n,[`bytesBase64Encoded`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function Ja(e,t,n,r){let i={},a=h(t,[`pageSize`]);n!==void 0&&a!=null&&m(n,[`_query`,`pageSize`],a);let o=h(t,[`pageToken`]);n!==void 0&&o!=null&&m(n,[`_query`,`pageToken`],o);let s=h(t,[`filter`]);n!==void 0&&s!=null&&m(n,[`_query`,`filter`],s);let c=h(t,[`queryBase`]);return n!==void 0&&c!=null&&m(n,[`_url`,`models_url`],rn(e,c)),i}function Ya(e,t,n,r){let i={},a=h(t,[`pageSize`]);n!==void 0&&a!=null&&m(n,[`_query`,`pageSize`],a);let o=h(t,[`pageToken`]);n!==void 0&&o!=null&&m(n,[`_query`,`pageToken`],o);let s=h(t,[`filter`]);n!==void 0&&s!=null&&m(n,[`_query`,`filter`],s);let c=h(t,[`queryBase`]);return n!==void 0&&c!=null&&m(n,[`_url`,`models_url`],rn(e,c)),i}function Xa(e,t,n){let r={},i=h(t,[`config`]);return i!=null&&Ja(e,i,r),r}function Za(e,t,n){let r={},i=h(t,[`config`]);return i!=null&&Ya(e,i,r),r}function Qa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`nextPageToken`]);i!=null&&m(n,[`nextPageToken`],i);let a=h(e,[`_self`]);if(a!=null){let e=an(a);Array.isArray(e)&&(e=e.map(e=>to(e))),m(n,[`models`],e)}return n}function $a(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`nextPageToken`]);i!=null&&m(n,[`nextPageToken`],i);let a=h(e,[`_self`]);if(a!=null){let e=an(a);Array.isArray(e)&&(e=e.map(e=>no(e))),m(n,[`models`],e)}return n}function eo(e,t){let n={},r=h(e,[`maskMode`]);r!=null&&m(n,[`maskMode`],r);let i=h(e,[`segmentationClasses`]);i!=null&&m(n,[`maskClasses`],i);let a=h(e,[`maskDilation`]);return a!=null&&m(n,[`dilation`],a),n}function to(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`displayName`]);i!=null&&m(n,[`displayName`],i);let a=h(e,[`description`]);a!=null&&m(n,[`description`],a);let o=h(e,[`version`]);o!=null&&m(n,[`version`],o);let s=h(e,[`_self`]);s!=null&&m(n,[`tunedModelInfo`],So(s));let c=h(e,[`inputTokenLimit`]);c!=null&&m(n,[`inputTokenLimit`],c);let l=h(e,[`outputTokenLimit`]);l!=null&&m(n,[`outputTokenLimit`],l);let u=h(e,[`supportedGenerationMethods`]);u!=null&&m(n,[`supportedActions`],u);let d=h(e,[`temperature`]);d!=null&&m(n,[`temperature`],d);let f=h(e,[`maxTemperature`]);f!=null&&m(n,[`maxTemperature`],f);let p=h(e,[`topP`]);p!=null&&m(n,[`topP`],p);let g=h(e,[`topK`]);g!=null&&m(n,[`topK`],g);let _=h(e,[`thinking`]);return _!=null&&m(n,[`thinking`],_),n}function no(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`displayName`]);i!=null&&m(n,[`displayName`],i);let a=h(e,[`description`]);a!=null&&m(n,[`description`],a);let o=h(e,[`versionId`]);o!=null&&m(n,[`version`],o);let s=h(e,[`deployedModels`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>oa(e))),m(n,[`endpoints`],e)}let c=h(e,[`labels`]);c!=null&&m(n,[`labels`],c);let l=h(e,[`_self`]);l!=null&&m(n,[`tunedModelInfo`],Co(l));let u=h(e,[`defaultCheckpointId`]);u!=null&&m(n,[`defaultCheckpointId`],u);let d=h(e,[`checkpoints`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`checkpoints`],e)}return n}function ro(e,t){let n={},r=h(e,[`mediaResolution`]);r!=null&&m(n,[`mediaResolution`],r);let i=h(e,[`codeExecutionResult`]);i!=null&&m(n,[`codeExecutionResult`],i);let a=h(e,[`executableCode`]);a!=null&&m(n,[`executableCode`],a);let o=h(e,[`fileData`]);o!=null&&m(n,[`fileData`],sa(o));let s=h(e,[`functionCall`]);s!=null&&m(n,[`functionCall`],ca(s));let c=h(e,[`functionResponse`]);c!=null&&m(n,[`functionResponse`],c);let l=h(e,[`inlineData`]);l!=null&&m(n,[`inlineData`],Mi(l));let u=h(e,[`text`]);u!=null&&m(n,[`text`],u);let d=h(e,[`thought`]);d!=null&&m(n,[`thought`],d);let f=h(e,[`thoughtSignature`]);f!=null&&m(n,[`thoughtSignature`],f);let p=h(e,[`videoMetadata`]);return p!=null&&m(n,[`videoMetadata`],p),n}function io(e,t){let n={},r=h(e,[`productImage`]);return r!=null&&m(n,[`image`],K(r)),n}function ao(e,t,n){let r={},i=h(e,[`numberOfImages`]);t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i);let a=h(e,[`baseSteps`]);t!==void 0&&a!=null&&m(t,[`parameters`,`baseSteps`],a);let o=h(e,[`outputGcsUri`]);t!==void 0&&o!=null&&m(t,[`parameters`,`storageUri`],o);let s=h(e,[`seed`]);t!==void 0&&s!=null&&m(t,[`parameters`,`seed`],s);let c=h(e,[`safetyFilterLevel`]);t!==void 0&&c!=null&&m(t,[`parameters`,`safetySetting`],c);let l=h(e,[`personGeneration`]);t!==void 0&&l!=null&&m(t,[`parameters`,`personGeneration`],l);let u=h(e,[`addWatermark`]);t!==void 0&&u!=null&&m(t,[`parameters`,`addWatermark`],u);let d=h(e,[`outputMimeType`]);t!==void 0&&d!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],d);let f=h(e,[`outputCompressionQuality`]);t!==void 0&&f!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],f);let p=h(e,[`enhancePrompt`]);t!==void 0&&p!=null&&m(t,[`parameters`,`enhancePrompt`],p);let g=h(e,[`labels`]);return t!==void 0&&g!=null&&m(t,[`labels`],g),r}function oo(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`source`]);a!=null&&co(a,r);let o=h(t,[`config`]);return o!=null&&ao(o,r),r}function so(e,t){let n={},r=h(e,[`predictions`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}return n}function co(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`personImage`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`personImage`,`image`],K(a));let o=h(e,[`productImages`]);if(t!==void 0&&o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>io(e))),m(t,[`instances[0]`,`productImages`],e)}return r}function lo(e,t){let n={},r=h(e,[`referenceImage`]);r!=null&&m(n,[`referenceImage`],K(r));let i=h(e,[`referenceId`]);i!=null&&m(n,[`referenceId`],i);let a=h(e,[`referenceType`]);a!=null&&m(n,[`referenceType`],a);let o=h(e,[`maskImageConfig`]);o!=null&&m(n,[`maskImageConfig`],eo(o));let s=h(e,[`controlImageConfig`]);s!=null&&m(n,[`controlImageConfig`],Bi(s));let c=h(e,[`styleImageConfig`]);c!=null&&m(n,[`styleImageConfig`],c);let l=h(e,[`subjectImageConfig`]);return l!=null&&m(n,[`subjectImageConfig`],l),n}function uo(e,t){let n={},r=h(e,[`safetyAttributes`,`categories`]);r!=null&&m(n,[`categories`],r);let i=h(e,[`safetyAttributes`,`scores`]);i!=null&&m(n,[`scores`],i);let a=h(e,[`contentType`]);return a!=null&&m(n,[`contentType`],a),n}function fo(e,t){let n={},r=h(e,[`safetyAttributes`,`categories`]);r!=null&&m(n,[`categories`],r);let i=h(e,[`safetyAttributes`,`scores`]);i!=null&&m(n,[`scores`],i);let a=h(e,[`contentType`]);return a!=null&&m(n,[`contentType`],a),n}function po(e,t){let n={},r=h(e,[`category`]);if(r!=null&&m(n,[`category`],r),h(e,[`method`])!==void 0)throw Error(`method parameter is not supported in Gemini API.`);let i=h(e,[`threshold`]);return i!=null&&m(n,[`threshold`],i),n}function mo(e,t){let n={},r=h(e,[`image`]);return r!=null&&m(n,[`image`],K(r)),n}function ho(e,t,n){let r={},i=h(e,[`mode`]);t!==void 0&&i!=null&&m(t,[`parameters`,`mode`],i);let a=h(e,[`maxPredictions`]);t!==void 0&&a!=null&&m(t,[`parameters`,`maxPredictions`],a);let o=h(e,[`confidenceThreshold`]);t!==void 0&&o!=null&&m(t,[`parameters`,`confidenceThreshold`],o);let s=h(e,[`maskDilation`]);t!==void 0&&s!=null&&m(t,[`parameters`,`maskDilation`],s);let c=h(e,[`binaryColorThreshold`]);t!==void 0&&c!=null&&m(t,[`parameters`,`binaryColorThreshold`],c);let l=h(e,[`labels`]);return t!==void 0&&l!=null&&m(t,[`labels`],l),r}function go(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`source`]);a!=null&&vo(a,r);let o=h(t,[`config`]);return o!=null&&ho(o,r),r}function _o(e,t){let n={},r=h(e,[`predictions`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Fa(e))),m(n,[`generatedMasks`],e)}return n}function vo(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`image`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`image`],K(a));let o=h(e,[`scribbleImage`]);return t!==void 0&&o!=null&&m(t,[`instances[0]`,`scribble`],mo(o)),r}function yo(e,t){let n={},r=h(e,[`retrievalConfig`]);r!=null&&m(n,[`retrievalConfig`],r);let i=h(e,[`functionCallingConfig`]);return i!=null&&m(n,[`functionCallingConfig`],la(i)),n}function bo(e,t){let n={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let r=h(e,[`computerUse`]);r!=null&&m(n,[`computerUse`],r);let i=h(e,[`fileSearch`]);i!=null&&m(n,[`fileSearch`],i);let a=h(e,[`googleSearch`]);a!=null&&m(n,[`googleSearch`],Ha(a));let o=h(e,[`codeExecution`]);if(o!=null&&m(n,[`codeExecution`],o),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let s=h(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`functionDeclarations`],e)}let c=h(e,[`googleMaps`]);c!=null&&m(n,[`googleMaps`],Va(c));let l=h(e,[`googleSearchRetrieval`]);l!=null&&m(n,[`googleSearchRetrieval`],l);let u=h(e,[`urlContext`]);u!=null&&m(n,[`urlContext`],u);let d=h(e,[`mcpServers`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`mcpServers`],e)}return n}function xo(e,t){let n={},r=h(e,[`retrieval`]);r!=null&&m(n,[`retrieval`],r);let i=h(e,[`computerUse`]);if(i!=null&&m(n,[`computerUse`],i),h(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let a=h(e,[`googleSearch`]);a!=null&&m(n,[`googleSearch`],a);let o=h(e,[`codeExecution`]);o!=null&&m(n,[`codeExecution`],o);let s=h(e,[`enterpriseWebSearch`]);s!=null&&m(n,[`enterpriseWebSearch`],s);let c=h(e,[`functionDeclarations`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>ua(e))),m(n,[`functionDeclarations`],e)}let l=h(e,[`googleMaps`]);l!=null&&m(n,[`googleMaps`],l);let u=h(e,[`googleSearchRetrieval`]);u!=null&&m(n,[`googleSearchRetrieval`],u);let d=h(e,[`urlContext`]);if(d!=null&&m(n,[`urlContext`],d),h(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return n}function So(e,t){let n={},r=h(e,[`baseModel`]);r!=null&&m(n,[`baseModel`],r);let i=h(e,[`createTime`]);i!=null&&m(n,[`createTime`],i);let a=h(e,[`updateTime`]);return a!=null&&m(n,[`updateTime`],a),n}function Co(e,t){let n={},r=h(e,[`labels`,`google-vertex-llm-tuning-base-model-id`]);r!=null&&m(n,[`baseModel`],r);let i=h(e,[`createTime`]);i!=null&&m(n,[`createTime`],i);let a=h(e,[`updateTime`]);return a!=null&&m(n,[`updateTime`],a),n}function wo(e,t,n){let r={},i=h(e,[`displayName`]);t!==void 0&&i!=null&&m(t,[`displayName`],i);let a=h(e,[`description`]);t!==void 0&&a!=null&&m(t,[`description`],a);let o=h(e,[`defaultCheckpointId`]);return t!==void 0&&o!=null&&m(t,[`defaultCheckpointId`],o),r}function To(e,t,n){let r={},i=h(e,[`displayName`]);t!==void 0&&i!=null&&m(t,[`displayName`],i);let a=h(e,[`description`]);t!==void 0&&a!=null&&m(t,[`description`],a);let o=h(e,[`defaultCheckpointId`]);return t!==void 0&&o!=null&&m(t,[`defaultCheckpointId`],o),r}function Eo(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`name`],N(e,i));let a=h(t,[`config`]);return a!=null&&wo(a,r),r}function Do(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`config`]);return a!=null&&To(a,r),r}function Oo(e,t,n){let r={},i=h(e,[`outputGcsUri`]);t!==void 0&&i!=null&&m(t,[`parameters`,`storageUri`],i);let a=h(e,[`safetyFilterLevel`]);t!==void 0&&a!=null&&m(t,[`parameters`,`safetySetting`],a);let o=h(e,[`personGeneration`]);t!==void 0&&o!=null&&m(t,[`parameters`,`personGeneration`],o);let s=h(e,[`includeRaiReason`]);t!==void 0&&s!=null&&m(t,[`parameters`,`includeRaiReason`],s);let c=h(e,[`outputMimeType`]);t!==void 0&&c!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],c);let l=h(e,[`outputCompressionQuality`]);t!==void 0&&l!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],l);let u=h(e,[`enhanceInputImage`]);t!==void 0&&u!=null&&m(t,[`parameters`,`upscaleConfig`,`enhanceInputImage`],u);let d=h(e,[`imagePreservationFactor`]);t!==void 0&&d!=null&&m(t,[`parameters`,`upscaleConfig`,`imagePreservationFactor`],d);let f=h(e,[`labels`]);t!==void 0&&f!=null&&m(t,[`labels`],f);let p=h(e,[`numberOfImages`]);t!==void 0&&p!=null&&m(t,[`parameters`,`sampleCount`],p);let g=h(e,[`mode`]);return t!==void 0&&g!=null&&m(t,[`parameters`,`mode`],g),r}function ko(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`image`]);a!=null&&m(r,[`instances[0]`,`image`],K(a));let o=h(t,[`upscaleFactor`]);o!=null&&m(r,[`parameters`,`upscaleConfig`,`upscaleFactor`],o);let s=h(t,[`config`]);return s!=null&&Oo(s,r),r}function Ao(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}return n}function jo(e,t){let n={},r=h(e,[`uri`]);r!=null&&m(n,[`uri`],r);let i=h(e,[`encodedVideo`]);i!=null&&m(n,[`videoBytes`],z(i));let a=h(e,[`encoding`]);return a!=null&&m(n,[`mimeType`],a),n}function Mo(e,t){let n={},r=h(e,[`gcsUri`]);r!=null&&m(n,[`uri`],r);let i=h(e,[`bytesBase64Encoded`]);i!=null&&m(n,[`videoBytes`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function No(e,t){let n={},r=h(e,[`image`]);r!=null&&m(n,[`_self`],K(r));let i=h(e,[`maskMode`]);return i!=null&&m(n,[`maskMode`],i),n}function Po(e,t){let n={},r=h(e,[`image`]);r!=null&&m(n,[`image`],qa(r));let i=h(e,[`referenceType`]);return i!=null&&m(n,[`referenceType`],i),n}function Fo(e,t){let n={},r=h(e,[`image`]);r!=null&&m(n,[`image`],K(r));let i=h(e,[`referenceType`]);return i!=null&&m(n,[`referenceType`],i),n}function Io(e,t){let n={},r=h(e,[`uri`]);r!=null&&m(n,[`uri`],r);let i=h(e,[`videoBytes`]);i!=null&&m(n,[`encodedVideo`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`encoding`],a),n}function Lo(e,t){let n={},r=h(e,[`uri`]);r!=null&&m(n,[`gcsUri`],r);let i=h(e,[`videoBytes`]);i!=null&&m(n,[`bytesBase64Encoded`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function Ro(e,t){let n={},r=h(e,[`displayName`]);return t!==void 0&&r!=null&&m(t,[`displayName`],r),n}function zo(e){let t={},n=h(e,[`config`]);return n!=null&&Ro(n,t),t}function Bo(e,t){let n={},r=h(e,[`force`]);return t!==void 0&&r!=null&&m(t,[`_query`,`force`],r),n}function Vo(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`_url`,`name`],n);let r=h(e,[`config`]);return r!=null&&Bo(r,t),t}function Ho(e){let t={},n=h(e,[`name`]);return n!=null&&m(t,[`_url`,`name`],n),t}function Uo(e,t){let n={},r=h(e,[`customMetadata`]);if(t!==void 0&&r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`customMetadata`],e)}let i=h(e,[`chunkingConfig`]);return t!==void 0&&i!=null&&m(t,[`chunkingConfig`],i),n}function Wo(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],Ko(o)),t}function Go(e){let t={},n=h(e,[`fileSearchStoreName`]);n!=null&&m(t,[`_url`,`file_search_store_name`],n);let r=h(e,[`fileName`]);r!=null&&m(t,[`fileName`],r);let i=h(e,[`config`]);return i!=null&&Uo(i,t),t}function Ko(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`parent`]);r!=null&&m(t,[`parent`],r);let i=h(e,[`documentName`]);return i!=null&&m(t,[`documentName`],i),t}function qo(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function Jo(e){let t={},n=h(e,[`config`]);return n!=null&&qo(n,t),t}function Yo(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`fileSearchStores`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`fileSearchStores`],e)}return t}function Xo(e,t){let n={},r=h(e,[`mimeType`]);t!==void 0&&r!=null&&m(t,[`mimeType`],r);let i=h(e,[`displayName`]);t!==void 0&&i!=null&&m(t,[`displayName`],i);let a=h(e,[`customMetadata`]);if(t!==void 0&&a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`customMetadata`],e)}let o=h(e,[`chunkingConfig`]);return t!==void 0&&o!=null&&m(t,[`chunkingConfig`],o),n}function Zo(e){let t={},n=h(e,[`fileSearchStoreName`]);n!=null&&m(t,[`_url`,`file_search_store_name`],n);let r=h(e,[`config`]);return r!=null&&Xo(r,t),t}function Qo(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}var $o=`Content-Type`,es=`X-Server-Timeout`,ts=`User-Agent`,ns=`x-goog-api-client`,rs=`google-genai-sdk/1.43.0`,is=`v1beta1`,as=`v1beta`,os=5,ss=[408,429,500,502,503,504],cs=class{constructor(e){this.clientOptions=Object.assign({},e),this.customBaseUrl=e.httpOptions?.baseUrl,this.clientOptions.vertexai&&(this.clientOptions.project&&this.clientOptions.location?this.clientOptions.apiKey=void 0:this.clientOptions.apiKey&&(this.clientOptions.project=void 0,this.clientOptions.location=void 0));let t={};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 Error(`Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.`);let n=e.project&&e.location||!!e.apiKey;this.customBaseUrl&&!n?(t.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||this.clientOptions.location===`global`?t.baseUrl=`https://aiplatform.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(t.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),t.apiVersion=this.clientOptions.apiVersion??is}else{if(!this.clientOptions.apiKey)throw new Zr({message:`API key must be set when using the Gemini API.`,status:403});t.apiVersion=this.clientOptions.apiVersion??as,t.baseUrl=`https://generativelanguage.googleapis.com/`}t.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=t,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(t,e.httpOptions))}isVertexAI(){return this.clientOptions.vertexai??!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){let e=new Headers;return await this.clientOptions.auth.addAuthHeaders(e),e}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw Error(`API version is not set.`)}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw Error(`Base URL is not set.`)}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw Error(`Headers are not set.`)}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw 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 Error(`HTTP options are not correctly set.`)}constructUrl(e,t,n){let r=[this.getRequestUrlInternal(t)];return n&&r.push(this.getBaseResourcePath()),e!==``&&r.push(e),new URL(`${r.join(`/`)}`)}shouldPrependVertexProjectPath(e,t){return!(t.baseUrl&&t.baseUrlResourceScope===ke.COLLECTION||this.clientOptions.apiKey||!this.clientOptions.vertexai||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 n=this.shouldPrependVertexProjectPath(e,t),r=this.constructUrl(e.path,t,n);if(e.queryParams)for(let[t,n]of Object.entries(e.queryParams))r.searchParams.append(t,String(n));let i={};if(e.httpMethod===`GET`){if(e.body&&e.body!==`{}`)throw Error(`Request body should be empty for GET request, but got non empty request body`)}else i.body=e.body;return i=await this.includeExtraHttpOptionsToRequestInit(i,t,r.toString(),e.abortSignal),this.unaryApiCall(r,i,e.httpMethod)}patchHttpOptions(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of Object.entries(t))typeof r==`object`?n[e]=Object.assign(Object.assign({},n[e]),r):r!==void 0&&(n[e]=r);return n}async requestStream(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let n=this.shouldPrependVertexProjectPath(e,t),r=this.constructUrl(e.path,t,n);(!r.searchParams.has(`alt`)||r.searchParams.get(`alt`)!==`sse`)&&r.searchParams.set(`alt`,`sse`);let i={};return i.body=e.body,i=await this.includeExtraHttpOptionsToRequestInit(i,t,r.toString(),e.abortSignal),this.streamApiCall(r,i,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,n,r){if(t&&t.timeout||r){let n=new AbortController,i=n.signal;if(t.timeout&&t?.timeout>0){let e=setTimeout(()=>n.abort(),t.timeout);e&&typeof e.unref==`function`&&e.unref()}r&&r.addEventListener(`abort`,()=>{n.abort()}),e.signal=i}return t&&t.extraBody!==null&&us(e,t.extraBody),e.headers=await this.getHeadersInternal(t,n),e}async unaryApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async e=>(await ls(e),new ot(e))).catch(e=>{throw e instanceof Error?e:Error(JSON.stringify(e))})}async streamApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async e=>(await ls(e),this.processStreamResponse(e))).catch(e=>{throw e instanceof Error?e:Error(JSON.stringify(e))})}processStreamResponse(e){return W(this,arguments,function*(){let t=(e?.body)?.getReader(),n=new TextDecoder(`utf-8`);if(!t)throw Error(`Response body is empty`);try{let r=``,i=[`
|
|
1
|
+
import{o as e,t}from"./chunk-jRWAZmH_.js";import{i as n}from"./simple-options-CP_5aL7H.js";import{t as r}from"./sanitize-unicode-6mS7gbvU.js";var i=t(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),a=t((e=>{var t=i();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),o=t(((e,t)=>{t.exports=a()})),s=e(t(((e,t)=>{var n=o(),r=[`Failed to fetch`,`NetworkError when attempting to fetch resource.`,`The Internet connection appears to be offline.`,`Network request failed`],i=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=Error(e),this.originalError.stack=this.stack),this.name=`AbortError`,this.message=e}},a=(e,t,n)=>{let r=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=r,e},s=e=>r.includes(e),c=(e,t)=>new Promise((r,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};let c=n.operation(t);c.attempt(async n=>{try{r(await e(n))}catch(e){if(!(e instanceof Error)){o(TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));return}if(e instanceof i)c.stop(),o(e.originalError);else if(e instanceof TypeError&&!s(e.message))c.stop(),o(e);else{a(e,n,t);try{await t.onFailedAttempt(e)}catch(e){o(e);return}c.retry(e)||o(c.mainError())}}})});t.exports=c,t.exports.default=c,t.exports.AbortError=i}))(),1),c=void 0,l=void 0;function u(){return{geminiUrl:c,vertexUrl:l}}function d(e,t,n,r){if(!e?.baseUrl){let e=u();return t?e.vertexUrl??n:e.geminiUrl??r}return e.baseUrl}var f=class{};function p(e,t){return e.replace(/\{([^}]+)\}/g,(e,n)=>{if(Object.prototype.hasOwnProperty.call(t,n)){let e=t[n];return e==null?``:String(e)}else throw Error(`Key '${n}' not found in valueMap.`)})}function m(e,t,n){for(let r=0;r<t.length-1;r++){let i=t[r];if(i.endsWith(`[]`)){let a=i.slice(0,-2);if(!(a in e))if(Array.isArray(n))e[a]=Array.from({length:n.length},()=>({}));else throw Error(`Value must be a list given an array path ${i}`);if(Array.isArray(e[a])){let i=e[a];if(Array.isArray(n))for(let e=0;e<i.length;e++){let a=i[e];m(a,t.slice(r+1),n[e])}else for(let e of i)m(e,t.slice(r+1),n)}return}else if(i.endsWith(`[0]`)){let a=i.slice(0,-3);a in e||(e[a]=[{}]);let o=e[a];m(o[0],t.slice(r+1),n);return}(!e[i]||typeof e[i]!=`object`)&&(e[i]={}),e=e[i]}let r=t[t.length-1],i=e[r];if(i!==void 0){if(!n||typeof n==`object`&&Object.keys(n).length===0||n===i)return;if(typeof i==`object`&&typeof n==`object`&&i!==null&&n!==null)Object.assign(i,n);else throw Error(`Cannot set value for an existing key. Key: ${r}`)}else r===`_self`&&typeof n==`object`&&n&&!Array.isArray(n)?Object.assign(e,n):e[r]=n}function h(e,t,n=void 0){try{if(t.length===1&&t[0]===`_self`)return e;for(let r=0;r<t.length;r++){if(typeof e!=`object`||!e)return n;let i=t[r];if(i.endsWith(`[]`)){let a=i.slice(0,-2);if(a in e){let i=e[a];return Array.isArray(i)?i.map(e=>h(e,t.slice(r+1),n)):n}else return n}else e=e[i]}return e}catch(e){if(e instanceof TypeError)return n;throw e}}function g(e,t){for(let[n,r]of Object.entries(t)){let t=n.split(`.`),i=r.split(`.`),a=new Set,o=-1;for(let e=0;e<t.length;e++)if(t[e]===`*`){o=e;break}if(o!==-1&&i.length>o)for(let e=o;e<i.length;e++){let t=i[e];t!==`*`&&!t.endsWith(`[]`)&&!t.endsWith(`[0]`)&&a.add(t)}_(e,t,i,0,a)}}function _(e,t,n,r,i){if(r>=t.length||typeof e!=`object`||!e)return;let a=t[r];if(a.endsWith(`[]`)){let o=a.slice(0,-2),s=e;if(o in s&&Array.isArray(s[o]))for(let e of s[o])_(e,t,n,r+1,i)}else if(a===`*`){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,a=Object.keys(t).filter(e=>!e.startsWith(`_`)&&!i.has(e)),o={};for(let e of a)o[e]=t[e];for(let[e,i]of Object.entries(o)){let a=[];for(let t of n.slice(r))t===`*`?a.push(e):a.push(t);m(t,a,i)}for(let e of a)delete t[e]}}else{let o=e;a in o&&_(o[a],t,n,r+1,i)}}function v(e){if(typeof e!=`string`)throw Error(`fromImageBytes must be a string`);return e}function y(e){let t={},n=h(e,[`operationName`]);n!=null&&m(t,[`operationName`],n);let r=h(e,[`resourceName`]);return r!=null&&m(t,[`_url`,`resourceName`],r),t}function b(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`,`generateVideoResponse`]);return o!=null&&m(t,[`response`],S(o)),t}function x(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],C(o)),t}function S(e){let t={},n=h(e,[`generatedSamples`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>w(e))),m(t,[`generatedVideos`],e)}let r=h(e,[`raiMediaFilteredCount`]);r!=null&&m(t,[`raiMediaFilteredCount`],r);let i=h(e,[`raiMediaFilteredReasons`]);return i!=null&&m(t,[`raiMediaFilteredReasons`],i),t}function C(e){let t={},n=h(e,[`videos`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>T(e))),m(t,[`generatedVideos`],e)}let r=h(e,[`raiMediaFilteredCount`]);r!=null&&m(t,[`raiMediaFilteredCount`],r);let i=h(e,[`raiMediaFilteredReasons`]);return i!=null&&m(t,[`raiMediaFilteredReasons`],i),t}function w(e){let t={},n=h(e,[`video`]);return n!=null&&m(t,[`video`],te(n)),t}function T(e){let t={},n=h(e,[`_self`]);return n!=null&&m(t,[`video`],ne(n)),t}function E(e){let t={},n=h(e,[`operationName`]);return n!=null&&m(t,[`_url`,`operationName`],n),t}function D(e){let t={},n=h(e,[`operationName`]);return n!=null&&m(t,[`_url`,`operationName`],n),t}function O(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],k(o)),t}function k(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`parent`]);r!=null&&m(t,[`parent`],r);let i=h(e,[`documentName`]);return i!=null&&m(t,[`documentName`],i),t}function A(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],ee(o)),t}function ee(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`parent`]);r!=null&&m(t,[`parent`],r);let i=h(e,[`documentName`]);return i!=null&&m(t,[`documentName`],i),t}function te(e){let t={},n=h(e,[`uri`]);n!=null&&m(t,[`uri`],n);let r=h(e,[`encodedVideo`]);r!=null&&m(t,[`videoBytes`],v(r));let i=h(e,[`encoding`]);return i!=null&&m(t,[`mimeType`],i),t}function ne(e){let t={},n=h(e,[`gcsUri`]);n!=null&&m(t,[`uri`],n);let r=h(e,[`bytesBase64Encoded`]);r!=null&&m(t,[`videoBytes`],v(r));let i=h(e,[`mimeType`]);return i!=null&&m(t,[`mimeType`],i),t}var re;(function(e){e.OUTCOME_UNSPECIFIED=`OUTCOME_UNSPECIFIED`,e.OUTCOME_OK=`OUTCOME_OK`,e.OUTCOME_FAILED=`OUTCOME_FAILED`,e.OUTCOME_DEADLINE_EXCEEDED=`OUTCOME_DEADLINE_EXCEEDED`})(re||={});var ie;(function(e){e.LANGUAGE_UNSPECIFIED=`LANGUAGE_UNSPECIFIED`,e.PYTHON=`PYTHON`})(ie||={});var ae;(function(e){e.SCHEDULING_UNSPECIFIED=`SCHEDULING_UNSPECIFIED`,e.SILENT=`SILENT`,e.WHEN_IDLE=`WHEN_IDLE`,e.INTERRUPT=`INTERRUPT`})(ae||={});var j;(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`})(j||={});var oe;(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`})(oe||={});var se;(function(e){e.API_SPEC_UNSPECIFIED=`API_SPEC_UNSPECIFIED`,e.SIMPLE_SEARCH=`SIMPLE_SEARCH`,e.ELASTIC_SEARCH=`ELASTIC_SEARCH`})(se||={});var ce;(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`})(ce||={});var le;(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`})(le||={});var ue;(function(e){e.UNSPECIFIED=`UNSPECIFIED`,e.BLOCKING=`BLOCKING`,e.NON_BLOCKING=`NON_BLOCKING`})(ue||={});var de;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.MODE_DYNAMIC=`MODE_DYNAMIC`})(de||={});var fe;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.AUTO=`AUTO`,e.ANY=`ANY`,e.NONE=`NONE`,e.VALIDATED=`VALIDATED`})(fe||={});var pe;(function(e){e.THINKING_LEVEL_UNSPECIFIED=`THINKING_LEVEL_UNSPECIFIED`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`,e.MINIMAL=`MINIMAL`})(pe||={});var me;(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_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`,e.HARM_CATEGORY_JAILBREAK=`HARM_CATEGORY_JAILBREAK`})(me||={});var he;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED=`HARM_BLOCK_METHOD_UNSPECIFIED`,e.SEVERITY=`SEVERITY`,e.PROBABILITY=`PROBABILITY`})(he||={});var ge;(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`})(ge||={});var M;(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.IMAGE_PROHIBITED_CONTENT=`IMAGE_PROHIBITED_CONTENT`,e.NO_IMAGE=`NO_IMAGE`,e.IMAGE_RECITATION=`IMAGE_RECITATION`,e.IMAGE_OTHER=`IMAGE_OTHER`})(M||={});var _e;(function(e){e.HARM_PROBABILITY_UNSPECIFIED=`HARM_PROBABILITY_UNSPECIFIED`,e.NEGLIGIBLE=`NEGLIGIBLE`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`})(_e||={});var ve;(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`})(ve||={});var ye;(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`})(ye||={});var be;(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`})(be||={});var xe;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED=`TRAFFIC_TYPE_UNSPECIFIED`,e.ON_DEMAND=`ON_DEMAND`,e.PROVISIONED_THROUGHPUT=`PROVISIONED_THROUGHPUT`})(xe||={});var Se;(function(e){e.MODALITY_UNSPECIFIED=`MODALITY_UNSPECIFIED`,e.TEXT=`TEXT`,e.IMAGE=`IMAGE`,e.AUDIO=`AUDIO`})(Se||={});var Ce;(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`})(Ce||={});var we;(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`})(we||={});var Te;(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`})(Te||={});var Ee;(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`})(Ee||={});var De;(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`})(De||={});var Oe;(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`})(Oe||={});var ke;(function(e){e.COLLECTION=`COLLECTION`})(ke||={});var Ae;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED=`FEATURE_SELECTION_PREFERENCE_UNSPECIFIED`,e.PRIORITIZE_QUALITY=`PRIORITIZE_QUALITY`,e.BALANCED=`BALANCED`,e.PRIORITIZE_COST=`PRIORITIZE_COST`})(Ae||={});var je;(function(e){e.ENVIRONMENT_UNSPECIFIED=`ENVIRONMENT_UNSPECIFIED`,e.ENVIRONMENT_BROWSER=`ENVIRONMENT_BROWSER`})(je||={});var Me;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED=`PROMINENT_PEOPLE_UNSPECIFIED`,e.ALLOW_PROMINENT_PEOPLE=`ALLOW_PROMINENT_PEOPLE`,e.BLOCK_PROMINENT_PEOPLE=`BLOCK_PROMINENT_PEOPLE`})(Me||={});var Ne;(function(e){e.PREDICT=`PREDICT`,e.EMBED_CONTENT=`EMBED_CONTENT`})(Ne||={});var Pe;(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`})(Pe||={});var Fe;(function(e){e.DONT_ALLOW=`DONT_ALLOW`,e.ALLOW_ADULT=`ALLOW_ADULT`,e.ALLOW_ALL=`ALLOW_ALL`})(Fe||={});var Ie;(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`})(Ie||={});var Le;(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`})(Le||={});var Re;(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`})(Re||={});var ze;(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`})(ze||={});var Be;(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`})(Be||={});var Ve;(function(e){e.FOREGROUND=`FOREGROUND`,e.BACKGROUND=`BACKGROUND`,e.PROMPT=`PROMPT`,e.SEMANTIC=`SEMANTIC`,e.INTERACTIVE=`INTERACTIVE`})(Ve||={});var He;(function(e){e.ASSET=`ASSET`,e.STYLE=`STYLE`})(He||={});var Ue;(function(e){e.INSERT=`INSERT`,e.REMOVE=`REMOVE`,e.REMOVE_STATIC=`REMOVE_STATIC`,e.OUTPAINT=`OUTPAINT`})(Ue||={});var We;(function(e){e.OPTIMIZED=`OPTIMIZED`,e.LOSSLESS=`LOSSLESS`})(We||={});var Ge;(function(e){e.SUPERVISED_FINE_TUNING=`SUPERVISED_FINE_TUNING`,e.PREFERENCE_TUNING=`PREFERENCE_TUNING`,e.DISTILLATION=`DISTILLATION`})(Ge||={});var Ke;(function(e){e.STATE_UNSPECIFIED=`STATE_UNSPECIFIED`,e.STATE_PENDING=`STATE_PENDING`,e.STATE_ACTIVE=`STATE_ACTIVE`,e.STATE_FAILED=`STATE_FAILED`})(Ke||={});var qe;(function(e){e.STATE_UNSPECIFIED=`STATE_UNSPECIFIED`,e.PROCESSING=`PROCESSING`,e.ACTIVE=`ACTIVE`,e.FAILED=`FAILED`})(qe||={});var Je;(function(e){e.SOURCE_UNSPECIFIED=`SOURCE_UNSPECIFIED`,e.UPLOADED=`UPLOADED`,e.GENERATED=`GENERATED`,e.REGISTERED=`REGISTERED`})(Je||={});var Ye;(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`})(Ye||={});var Xe;(function(e){e.MODALITY_UNSPECIFIED=`MODALITY_UNSPECIFIED`,e.TEXT=`TEXT`,e.IMAGE=`IMAGE`,e.VIDEO=`VIDEO`,e.AUDIO=`AUDIO`,e.DOCUMENT=`DOCUMENT`})(Xe||={});var Ze;(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`})(Ze||={});var Qe;(function(e){e.TYPE_UNSPECIFIED=`TYPE_UNSPECIFIED`,e.ACTIVITY_START=`ACTIVITY_START`,e.ACTIVITY_END=`ACTIVITY_END`})(Qe||={});var $e;(function(e){e.START_SENSITIVITY_UNSPECIFIED=`START_SENSITIVITY_UNSPECIFIED`,e.START_SENSITIVITY_HIGH=`START_SENSITIVITY_HIGH`,e.START_SENSITIVITY_LOW=`START_SENSITIVITY_LOW`})($e||={});var et;(function(e){e.END_SENSITIVITY_UNSPECIFIED=`END_SENSITIVITY_UNSPECIFIED`,e.END_SENSITIVITY_HIGH=`END_SENSITIVITY_HIGH`,e.END_SENSITIVITY_LOW=`END_SENSITIVITY_LOW`})(et||={});var tt;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED=`ACTIVITY_HANDLING_UNSPECIFIED`,e.START_OF_ACTIVITY_INTERRUPTS=`START_OF_ACTIVITY_INTERRUPTS`,e.NO_INTERRUPTION=`NO_INTERRUPTION`})(tt||={});var nt;(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`})(nt||={});var rt;(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`})(rt||={});var it;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED=`MUSIC_GENERATION_MODE_UNSPECIFIED`,e.QUALITY=`QUALITY`,e.DIVERSITY=`DIVERSITY`,e.VOCALIZATION=`VOCALIZATION`})(it||={});var at;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED=`PLAYBACK_CONTROL_UNSPECIFIED`,e.PLAY=`PLAY`,e.PAUSE=`PAUSE`,e.STOP=`STOP`,e.RESET_CONTEXT=`RESET_CONTEXT`})(at||={});var ot=class{constructor(e){let t={};for(let n of e.headers.entries())t[n[0]]=n[1];this.headers=t,this.responseInternal=e}json(){return this.responseInternal.json()}},st=class{get text(){if(this.candidates?.[0]?.content?.parts?.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 e=``,t=!1,n=[];for(let r of this.candidates?.[0]?.content?.parts??[]){for(let[e,t]of Object.entries(r))e!==`text`&&e!==`thought`&&e!==`thoughtSignature`&&(t!==null||t!==void 0)&&n.push(e);if(typeof r.text==`string`){if(typeof r.thought==`boolean`&&r.thought)continue;t=!0,e+=r.text}}return n.length>0&&console.warn(`there are non-text parts ${n} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),t?e:void 0}get data(){if(this.candidates?.[0]?.content?.parts?.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 e=``,t=[];for(let n of this.candidates?.[0]?.content?.parts??[]){for(let[e,r]of Object.entries(n))e!==`inlineData`&&(r!==null||r!==void 0)&&t.push(e);n.inlineData&&typeof n.inlineData.data==`string`&&(e+=atob(n.inlineData.data))}return t.length>0&&console.warn(`there are non-data parts ${t} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),e.length>0?btoa(e):void 0}get functionCalls(){if(this.candidates?.[0]?.content?.parts?.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 e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.functionCall).map(e=>e.functionCall).filter(e=>e!==void 0);if(e?.length!==0)return e}get executableCode(){if(this.candidates?.[0]?.content?.parts?.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 e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.executableCode).map(e=>e.executableCode).filter(e=>e!==void 0);if(e?.length!==0)return e?.[0]?.code}get codeExecutionResult(){if(this.candidates?.[0]?.content?.parts?.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 e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.codeExecutionResult).map(e=>e.codeExecutionResult).filter(e=>e!==void 0);if(e?.length!==0)return e?.[0]?.output}},ct=class{},lt=class{},ut=class{},dt=class{},ft=class{},pt=class{},mt=class{},ht=class{},gt=class{},_t=class{},vt=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i,a=t;return i=n?x(a):b(a),Object.assign(r,i),r}},yt=class{},bt=class{},xt=class{},St=class{},Ct=class{},wt=class{},Tt=class{},Et=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i=O(t);return Object.assign(r,i),r}},Dt=class{},Ot=class{},kt=class{},At=class{},jt=class{},Mt=class{get text(){let e=``,t=!1,n=[];for(let r of this.serverContent?.modelTurn?.parts??[]){for(let[e,t]of Object.entries(r))e!==`text`&&e!==`thought`&&t!==null&&n.push(e);if(typeof r.text==`string`){if(typeof r.thought==`boolean`&&r.thought)continue;t=!0,e+=r.text}}return n.length>0&&console.warn(`there are non-text parts ${n} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),t?e:void 0}get data(){let e=``,t=[];for(let n of this.serverContent?.modelTurn?.parts??[]){for(let[e,r]of Object.entries(n))e!==`inlineData`&&r!==null&&t.push(e);n.inlineData&&typeof n.inlineData.data==`string`&&(e+=atob(n.inlineData.data))}return t.length>0&&console.warn(`there are non-data parts ${t} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),e.length>0?btoa(e):void 0}},Nt=class{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}},Pt=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i=A(t);return Object.assign(r,i),r}};function N(e,t){if(!t||typeof t!=`string`)throw Error(`model is required and must be a string`);if(t.includes(`..`)||t.includes(`?`)||t.includes(`&`))throw Error(`invalid model parameter`);if(e.isVertexAI()){if(t.startsWith(`publishers/`)||t.startsWith(`projects/`)||t.startsWith(`models/`))return t;if(t.indexOf(`/`)>=0){let e=t.split(`/`,2);return`publishers/${e[0]}/models/${e[1]}`}else return`publishers/google/models/${t}`}else if(t.startsWith(`models/`)||t.startsWith(`tunedModels/`))return t;else return`models/${t}`}function Ft(e,t){let n=N(e,t);return n?n.startsWith(`publishers/`)&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}`:n.startsWith(`models/`)&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/publishers/google/${n}`:n:``}function It(e){return Array.isArray(e)?e.map(e=>Lt(e)):[Lt(e)]}function Lt(e){if(typeof e==`object`&&e)return e;throw Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function Rt(e){let t=Lt(e);if(t.mimeType&&t.mimeType.startsWith(`image/`))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function zt(e){let t=Lt(e);if(t.mimeType&&t.mimeType.startsWith(`audio/`))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function Bt(e){if(e==null)throw Error(`PartUnion is required`);if(typeof e==`object`)return e;if(typeof e==`string`)return{text:e};throw Error(`Unsupported part type: ${typeof e}`)}function Vt(e){if(e==null||Array.isArray(e)&&e.length===0)throw Error(`PartListUnion is required`);return Array.isArray(e)?e.map(e=>Bt(e)):[Bt(e)]}function Ht(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)}function Ut(e){return typeof e==`object`&&!!e&&`functionCall`in e}function Wt(e){return typeof e==`object`&&!!e&&`functionResponse`in e}function P(e){if(e==null)throw Error(`ContentUnion is required`);return Ht(e)?e:{role:`user`,parts:Vt(e)}}function Gt(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap(e=>{let t=P(e);return t.parts&&t.parts.length>0&&t.parts[0].text!==void 0?[t.parts[0].text]:[]});if(e.isVertexAI()){let e=P(t);return e.parts&&e.parts.length>0&&e.parts[0].text!==void 0?[e.parts[0].text]:[]}return Array.isArray(t)?t.map(e=>P(e)):[P(t)]}function F(e){if(e==null||Array.isArray(e)&&e.length===0)throw Error(`contents are required`);if(!Array.isArray(e)){if(Ut(e)||Wt(e))throw Error(`To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them`);return[P(e)]}let t=[],n=[],r=Ht(e[0]);for(let i of e){let e=Ht(i);if(e!=r)throw Error(`Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them`);if(e)t.push(i);else if(Ut(i)||Wt(i))throw Error(`To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them`);else n.push(i)}return r||t.push({role:`user`,parts:Vt(n)}),t}function Kt(e,t){e.includes(`null`)&&(t.nullable=!0);let n=e.filter(e=>e!==`null`);if(n.length===1)t.type=Object.values(j).includes(n[0].toUpperCase())?n[0].toUpperCase():j.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let e of n)t.anyOf.push({type:Object.values(j).includes(e.toUpperCase())?e.toUpperCase():j.TYPE_UNSPECIFIED})}}function qt(e){let t={},n=[`items`],r=[`anyOf`],i=[`properties`];if(e.type&&e.anyOf)throw Error(`type and anyOf cannot be both populated.`);let a=e.anyOf;a!=null&&a.length==2&&(a[0].type===`null`?(t.nullable=!0,e=a[1]):a[1].type===`null`&&(t.nullable=!0,e=a[0])),e.type instanceof Array&&Kt(e.type,t);for(let[a,o]of Object.entries(e))if(o!=null)if(a==`type`){if(o===`null`)throw Error(`type: null can not be the only possible type for the field.`);if(o instanceof Array)continue;t.type=Object.values(j).includes(o.toUpperCase())?o.toUpperCase():j.TYPE_UNSPECIFIED}else if(n.includes(a))t[a]=qt(o);else if(r.includes(a)){let e=[];for(let n of o){if(n.type==`null`){t.nullable=!0;continue}e.push(qt(n))}t[a]=e}else if(i.includes(a)){let e={};for(let[t,n]of Object.entries(o))e[t]=qt(n);t[a]=e}else{if(a===`additionalProperties`)continue;t[a]=o}return t}function Jt(e){return qt(e)}function Yt(e){if(typeof e==`object`)return e;if(typeof e==`string`)return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};throw Error(`Unsupported speechConfig type: ${typeof e}`)}function Xt(e){if(`multiSpeakerVoiceConfig`in e)throw Error(`multiSpeakerVoiceConfig is not supported in the live API.`);return e}function I(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=qt(t.parameters)),t.response&&(Object.keys(t.response).includes(`$schema`)?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=qt(t.response));return e}function L(e){if(e==null)throw Error(`tools is required`);if(!Array.isArray(e))throw Error(`tools is required and must be an array of Tools`);let t=[];for(let n of e)t.push(n);return t}function Zt(e,t,n,r=1){let i=!t.startsWith(`${n}/`)&&t.split(`/`).length===r;return e.isVertexAI()?t.startsWith(`projects/`)?t:t.startsWith(`locations/`)?`projects/${e.getProject()}/${t}`:t.startsWith(`${n}/`)?`projects/${e.getProject()}/locations/${e.getLocation()}/${t}`:i?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}/${t}`:t:i?`${n}/${t}`:t}function R(e,t){if(typeof t!=`string`)throw Error(`name must be a string`);return Zt(e,t,`cachedContents`)}function Qt(e){switch(e){case`STATE_UNSPECIFIED`:return`JOB_STATE_UNSPECIFIED`;case`CREATING`:return`JOB_STATE_RUNNING`;case`ACTIVE`:return`JOB_STATE_SUCCEEDED`;case`FAILED`:return`JOB_STATE_FAILED`;default:return e}}function z(e){return v(e)}function $t(e){return typeof e==`object`&&!!e&&`name`in e}function en(e){return typeof e==`object`&&!!e&&`video`in e}function tn(e){return typeof e==`object`&&!!e&&`uri`in e}function nn(e){let t;if($t(e)&&(t=e.name),!(tn(e)&&(t=e.uri,t===void 0))&&!(en(e)&&(t=e.video?.uri,t===void 0))){if(typeof e==`string`&&(t=e),t===void 0)throw Error(`Could not extract file name from the provided input.`);if(t.startsWith(`https://`)){let e=t.split(`files/`)[1].match(/[a-z0-9]+/);if(e===null)throw Error(`Could not extract file name from URI ${t}`);t=e[0]}else t.startsWith(`files/`)&&(t=t.split(`files/`)[1]);return t}}function rn(e,t){let n;return n=e.isVertexAI()?t?`publishers/google/models`:`models`:t?`models`:`tunedModels`,n}function an(e){for(let t of[`models`,`tunedModels`,`publisherModels`])if(on(e,t))return e[t];return[]}function on(e,t){return typeof e==`object`&&!!e&&t in e}function sn(e,t={}){let n=e,r={name:n.name,description:n.description,parametersJsonSchema:n.inputSchema};return n.outputSchema&&(r.responseJsonSchema=n.outputSchema),t.behavior&&(r.behavior=t.behavior),{functionDeclarations:[r]}}function cn(e,t={}){let n=[],r=new Set;for(let i of e){let e=i.name;if(r.has(e))throw Error(`Duplicate function name ${e} found in MCP tools. Please ensure function names are unique.`);r.add(e);let a=sn(i,t);a.functionDeclarations&&n.push(...a.functionDeclarations)}return{functionDeclarations:n}}function ln(e,t){let n;if(typeof t==`string`)if(e.isVertexAI())if(t.startsWith(`gs://`))n={format:`jsonl`,gcsUri:[t]};else if(t.startsWith(`bq://`))n={format:`bigquery`,bigqueryUri:t};else throw Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith(`files/`))n={fileName:t};else throw Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(e.isVertexAI())throw Error(`InlinedRequest[] is not supported in Vertex AI.`);n={inlinedRequests:t}}else n=t;let r=[n.gcsUri,n.bigqueryUri].filter(Boolean).length,i=[n.inlinedRequests,n.fileName].filter(Boolean).length;if(e.isVertexAI()){if(i>0||r!==1)throw Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(r>0||i!==1)throw Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return n}function un(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 Error(`Unsupported destination: ${t}`)}function dn(e){if(typeof e!=`object`||!e)return{};let t=e,n=t.inlinedResponses;if(typeof n!=`object`||!n)return e;let r=n.inlinedResponses;if(!Array.isArray(r)||r.length===0)return e;let i=!1;for(let e of r){if(typeof e!=`object`||!e)continue;let t=e.response;if(!(typeof t!=`object`||!t)&&t.embedding!==void 0){i=!0;break}}return i&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),e}function B(e,t){let n=t;if(!e.isVertexAI()){if(/batches\/[^/]+$/.test(n))return n.split(`/`).pop();throw Error(`Invalid batch job name: ${n}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(n))return n.split(`/`).pop();if(/^\d+$/.test(n))return n;throw Error(`Invalid batch job name: ${n}.`)}function fn(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}function pn(e){return e.includes(`gemini`)&&e!==`gemini-embedding-001`||e.includes(`maas`)}function mn(e){let t={},n=h(e,[`responsesFile`]);n!=null&&m(t,[`fileName`],n);let r=h(e,[`inlinedResponses`,`inlinedResponses`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Qn(e))),m(t,[`inlinedResponses`],e)}let i=h(e,[`inlinedEmbedContentResponses`,`inlinedResponses`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`inlinedEmbedContentResponses`],e)}return t}function hn(e){let t={},n=h(e,[`predictionsFormat`]);n!=null&&m(t,[`format`],n);let r=h(e,[`gcsDestination`,`outputUriPrefix`]);r!=null&&m(t,[`gcsUri`],r);let i=h(e,[`bigqueryDestination`,`outputUri`]);return i!=null&&m(t,[`bigqueryUri`],i),t}function gn(e){let t={},n=h(e,[`format`]);n!=null&&m(t,[`predictionsFormat`],n);let r=h(e,[`gcsUri`]);r!=null&&m(t,[`gcsDestination`,`outputUriPrefix`],r);let i=h(e,[`bigqueryUri`]);if(i!=null&&m(t,[`bigqueryDestination`,`outputUri`],i),h(e,[`fileName`])!==void 0)throw Error(`fileName parameter is not supported in Vertex AI.`);if(h(e,[`inlinedResponses`])!==void 0)throw Error(`inlinedResponses parameter is not supported in Vertex AI.`);if(h(e,[`inlinedEmbedContentResponses`])!==void 0)throw Error(`inlinedEmbedContentResponses parameter is not supported in Vertex AI.`);return t}function _n(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`,`displayName`]);r!=null&&m(t,[`displayName`],r);let i=h(e,[`metadata`,`state`]);i!=null&&m(t,[`state`],fn(i));let a=h(e,[`metadata`,`createTime`]);a!=null&&m(t,[`createTime`],a);let o=h(e,[`metadata`,`endTime`]);o!=null&&m(t,[`endTime`],o);let s=h(e,[`metadata`,`updateTime`]);s!=null&&m(t,[`updateTime`],s);let c=h(e,[`metadata`,`model`]);c!=null&&m(t,[`model`],c);let l=h(e,[`metadata`,`output`]);return l!=null&&m(t,[`dest`],mn(dn(l))),t}function vn(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`displayName`]);r!=null&&m(t,[`displayName`],r);let i=h(e,[`state`]);i!=null&&m(t,[`state`],fn(i));let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`createTime`]);o!=null&&m(t,[`createTime`],o);let s=h(e,[`startTime`]);s!=null&&m(t,[`startTime`],s);let c=h(e,[`endTime`]);c!=null&&m(t,[`endTime`],c);let l=h(e,[`updateTime`]);l!=null&&m(t,[`updateTime`],l);let u=h(e,[`model`]);u!=null&&m(t,[`model`],u);let d=h(e,[`inputConfig`]);d!=null&&m(t,[`src`],yn(d));let f=h(e,[`outputConfig`]);f!=null&&m(t,[`dest`],hn(dn(f)));let p=h(e,[`completionStats`]);return p!=null&&m(t,[`completionStats`],p),t}function yn(e){let t={},n=h(e,[`instancesFormat`]);n!=null&&m(t,[`format`],n);let r=h(e,[`gcsSource`,`uris`]);r!=null&&m(t,[`gcsUri`],r);let i=h(e,[`bigquerySource`,`inputUri`]);return i!=null&&m(t,[`bigqueryUri`],i),t}function bn(e,t){let n={};if(h(t,[`format`])!==void 0)throw Error(`format parameter is not supported in Gemini API.`);if(h(t,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);if(h(t,[`bigqueryUri`])!==void 0)throw Error(`bigqueryUri parameter is not supported in Gemini API.`);let r=h(t,[`fileName`]);r!=null&&m(n,[`fileName`],r);let i=h(t,[`inlinedRequests`]);if(i!=null){let t=i;Array.isArray(t)&&(t=t.map(t=>Zn(e,t))),m(n,[`requests`,`requests`],t)}return n}function xn(e){let t={},n=h(e,[`format`]);n!=null&&m(t,[`instancesFormat`],n);let r=h(e,[`gcsUri`]);r!=null&&m(t,[`gcsSource`,`uris`],r);let i=h(e,[`bigqueryUri`]);if(i!=null&&m(t,[`bigquerySource`,`inputUri`],i),h(e,[`fileName`])!==void 0)throw Error(`fileName parameter is not supported in Vertex AI.`);if(h(e,[`inlinedRequests`])!==void 0)throw Error(`inlinedRequests parameter is not supported in Vertex AI.`);return t}function Sn(e){let t={},n=h(e,[`data`]);if(n!=null&&m(t,[`data`],n),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function Cn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function wn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function Tn(e){let t={},n=h(e,[`content`]);n!=null&&m(t,[`content`],n);let r=h(e,[`citationMetadata`]);r!=null&&m(t,[`citationMetadata`],En(r));let i=h(e,[`tokenCount`]);i!=null&&m(t,[`tokenCount`],i);let a=h(e,[`finishReason`]);a!=null&&m(t,[`finishReason`],a);let o=h(e,[`groundingMetadata`]);o!=null&&m(t,[`groundingMetadata`],o);let s=h(e,[`avgLogprobs`]);s!=null&&m(t,[`avgLogprobs`],s);let c=h(e,[`index`]);c!=null&&m(t,[`index`],c);let l=h(e,[`logprobsResult`]);l!=null&&m(t,[`logprobsResult`],l);let u=h(e,[`safetyRatings`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`safetyRatings`],e)}let d=h(e,[`urlContextMetadata`]);return d!=null&&m(t,[`urlContextMetadata`],d),t}function En(e){let t={},n=h(e,[`citationSources`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`citations`],e)}return t}function Dn(e){let t={},n=h(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>ar(e))),m(t,[`parts`],e)}let r=h(e,[`role`]);return r!=null&&m(t,[`role`],r),t}function On(e,t){let n={},r=h(e,[`displayName`]);if(t!==void 0&&r!=null&&m(t,[`batch`,`displayName`],r),h(e,[`dest`])!==void 0)throw Error(`dest parameter is not supported in Gemini API.`);return n}function kn(e,t){let n={},r=h(e,[`displayName`]);t!==void 0&&r!=null&&m(t,[`displayName`],r);let i=h(e,[`dest`]);return t!==void 0&&i!=null&&m(t,[`outputConfig`],gn(un(i))),n}function An(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`_url`,`model`],N(e,r));let i=h(t,[`src`]);i!=null&&m(n,[`batch`,`inputConfig`],bn(e,ln(e,i)));let a=h(t,[`config`]);return a!=null&&On(a,n),n}function jn(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`model`],N(e,r));let i=h(t,[`src`]);i!=null&&m(n,[`inputConfig`],xn(ln(e,i)));let a=h(t,[`config`]);return a!=null&&kn(a,n),n}function Mn(e,t){let n={},r=h(e,[`displayName`]);return t!==void 0&&r!=null&&m(t,[`batch`,`displayName`],r),n}function Nn(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`_url`,`model`],N(e,r));let i=h(t,[`src`]);i!=null&&m(n,[`batch`,`inputConfig`],Bn(e,i));let a=h(t,[`config`]);return a!=null&&Mn(a,n),n}function Pn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function Fn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function In(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);return a!=null&&m(t,[`error`],a),t}function Ln(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);return a!=null&&m(t,[`error`],a),t}function Rn(e,t){let n={},r=h(t,[`contents`]);if(r!=null){let t=Gt(e,r);Array.isArray(t)&&(t=t.map(e=>e)),m(n,[`requests[]`,`request`,`content`],t)}let i=h(t,[`config`]);return i!=null&&(m(n,[`_self`],zn(i,n)),g(n,{"requests[].*":`requests[].request.*`})),n}function zn(e,t){let n={},r=h(e,[`taskType`]);t!==void 0&&r!=null&&m(t,[`requests[]`,`taskType`],r);let i=h(e,[`title`]);t!==void 0&&i!=null&&m(t,[`requests[]`,`title`],i);let a=h(e,[`outputDimensionality`]);if(t!==void 0&&a!=null&&m(t,[`requests[]`,`outputDimensionality`],a),h(e,[`mimeType`])!==void 0)throw Error(`mimeType parameter is not supported in Gemini API.`);if(h(e,[`autoTruncate`])!==void 0)throw Error(`autoTruncate parameter is not supported in Gemini API.`);return n}function Bn(e,t){let n={},r=h(t,[`fileName`]);r!=null&&m(n,[`file_name`],r);let i=h(t,[`inlinedRequests`]);return i!=null&&m(n,[`requests`],Rn(e,i)),n}function Vn(e){let t={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=h(e,[`fileUri`]);n!=null&&m(t,[`fileUri`],n);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function Hn(e){let t={},n=h(e,[`id`]);n!=null&&m(t,[`id`],n);let r=h(e,[`args`]);r!=null&&m(t,[`args`],r);let i=h(e,[`name`]);if(i!=null&&m(t,[`name`],i),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function Un(e){let t={},n=h(e,[`allowedFunctionNames`]);n!=null&&m(t,[`allowedFunctionNames`],n);let r=h(e,[`mode`]);if(r!=null&&m(t,[`mode`],r),h(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return t}function Wn(e,t,n){let r={},i=h(t,[`systemInstruction`]);n!==void 0&&i!=null&&m(n,[`systemInstruction`],Dn(P(i)));let a=h(t,[`temperature`]);a!=null&&m(r,[`temperature`],a);let o=h(t,[`topP`]);o!=null&&m(r,[`topP`],o);let s=h(t,[`topK`]);s!=null&&m(r,[`topK`],s);let c=h(t,[`candidateCount`]);c!=null&&m(r,[`candidateCount`],c);let l=h(t,[`maxOutputTokens`]);l!=null&&m(r,[`maxOutputTokens`],l);let u=h(t,[`stopSequences`]);u!=null&&m(r,[`stopSequences`],u);let d=h(t,[`responseLogprobs`]);d!=null&&m(r,[`responseLogprobs`],d);let f=h(t,[`logprobs`]);f!=null&&m(r,[`logprobs`],f);let p=h(t,[`presencePenalty`]);p!=null&&m(r,[`presencePenalty`],p);let g=h(t,[`frequencyPenalty`]);g!=null&&m(r,[`frequencyPenalty`],g);let _=h(t,[`seed`]);_!=null&&m(r,[`seed`],_);let v=h(t,[`responseMimeType`]);v!=null&&m(r,[`responseMimeType`],v);let y=h(t,[`responseSchema`]);y!=null&&m(r,[`responseSchema`],Jt(y));let b=h(t,[`responseJsonSchema`]);if(b!=null&&m(r,[`responseJsonSchema`],b),h(t,[`routingConfig`])!==void 0)throw Error(`routingConfig parameter is not supported in Gemini API.`);if(h(t,[`modelSelectionConfig`])!==void 0)throw Error(`modelSelectionConfig parameter is not supported in Gemini API.`);let x=h(t,[`safetySettings`]);if(n!==void 0&&x!=null){let e=x;Array.isArray(e)&&(e=e.map(e=>or(e))),m(n,[`safetySettings`],e)}let S=h(t,[`tools`]);if(n!==void 0&&S!=null){let e=L(S);Array.isArray(e)&&(e=e.map(e=>cr(I(e)))),m(n,[`tools`],e)}let C=h(t,[`toolConfig`]);if(n!==void 0&&C!=null&&m(n,[`toolConfig`],sr(C)),h(t,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let w=h(t,[`cachedContent`]);n!==void 0&&w!=null&&m(n,[`cachedContent`],R(e,w));let T=h(t,[`responseModalities`]);T!=null&&m(r,[`responseModalities`],T);let E=h(t,[`mediaResolution`]);E!=null&&m(r,[`mediaResolution`],E);let D=h(t,[`speechConfig`]);if(D!=null&&m(r,[`speechConfig`],Yt(D)),h(t,[`audioTimestamp`])!==void 0)throw Error(`audioTimestamp parameter is not supported in Gemini API.`);let O=h(t,[`thinkingConfig`]);O!=null&&m(r,[`thinkingConfig`],O);let k=h(t,[`imageConfig`]);k!=null&&m(r,[`imageConfig`],Xn(k));let A=h(t,[`enableEnhancedCivicAnswers`]);if(A!=null&&m(r,[`enableEnhancedCivicAnswers`],A),h(t,[`modelArmorConfig`])!==void 0)throw Error(`modelArmorConfig parameter is not supported in Gemini API.`);return r}function Gn(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`candidates`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Tn(e))),m(t,[`candidates`],e)}let i=h(e,[`modelVersion`]);i!=null&&m(t,[`modelVersion`],i);let a=h(e,[`promptFeedback`]);a!=null&&m(t,[`promptFeedback`],a);let o=h(e,[`responseId`]);o!=null&&m(t,[`responseId`],o);let s=h(e,[`usageMetadata`]);return s!=null&&m(t,[`usageMetadata`],s),t}function Kn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function qn(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],B(e,r)),n}function Jn(e){let t={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let n=h(e,[`enableWidget`]);return n!=null&&m(t,[`enableWidget`],n),t}function Yn(e){let t={},n=h(e,[`searchTypes`]);if(n!=null&&m(t,[`searchTypes`],n),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let r=h(e,[`timeRangeFilter`]);return r!=null&&m(t,[`timeRangeFilter`],r),t}function Xn(e){let t={},n=h(e,[`aspectRatio`]);n!=null&&m(t,[`aspectRatio`],n);let r=h(e,[`imageSize`]);if(r!=null&&m(t,[`imageSize`],r),h(e,[`personGeneration`])!==void 0)throw Error(`personGeneration parameter is not supported in Gemini API.`);if(h(e,[`prominentPeople`])!==void 0)throw Error(`prominentPeople parameter is not supported in Gemini API.`);if(h(e,[`outputMimeType`])!==void 0)throw Error(`outputMimeType parameter is not supported in Gemini API.`);if(h(e,[`outputCompressionQuality`])!==void 0)throw Error(`outputCompressionQuality parameter is not supported in Gemini API.`);return t}function Zn(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`request`,`model`],N(e,r));let i=h(t,[`contents`]);if(i!=null){let e=F(i);Array.isArray(e)&&(e=e.map(e=>Dn(e))),m(n,[`request`,`contents`],e)}let a=h(t,[`metadata`]);a!=null&&m(n,[`metadata`],a);let o=h(t,[`config`]);return o!=null&&m(n,[`request`,`generationConfig`],Wn(e,o,h(n,[`request`],{}))),n}function Qn(e){let t={},n=h(e,[`response`]);n!=null&&m(t,[`response`],Gn(n));let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`error`]);return i!=null&&m(t,[`error`],i),t}function $n(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);if(t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),h(e,[`filter`])!==void 0)throw Error(`filter parameter is not supported in Gemini API.`);return n}function er(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i);let a=h(e,[`filter`]);return t!==void 0&&a!=null&&m(t,[`_query`,`filter`],a),n}function tr(e){let t={},n=h(e,[`config`]);return n!=null&&$n(n,t),t}function nr(e){let t={},n=h(e,[`config`]);return n!=null&&er(n,t),t}function rr(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`operations`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>_n(e))),m(t,[`batchJobs`],e)}return t}function ir(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`batchPredictionJobs`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>vn(e))),m(t,[`batchJobs`],e)}return t}function ar(e){let t={},n=h(e,[`mediaResolution`]);n!=null&&m(t,[`mediaResolution`],n);let r=h(e,[`codeExecutionResult`]);r!=null&&m(t,[`codeExecutionResult`],r);let i=h(e,[`executableCode`]);i!=null&&m(t,[`executableCode`],i);let a=h(e,[`fileData`]);a!=null&&m(t,[`fileData`],Vn(a));let o=h(e,[`functionCall`]);o!=null&&m(t,[`functionCall`],Hn(o));let s=h(e,[`functionResponse`]);s!=null&&m(t,[`functionResponse`],s);let c=h(e,[`inlineData`]);c!=null&&m(t,[`inlineData`],Sn(c));let l=h(e,[`text`]);l!=null&&m(t,[`text`],l);let u=h(e,[`thought`]);u!=null&&m(t,[`thought`],u);let d=h(e,[`thoughtSignature`]);d!=null&&m(t,[`thoughtSignature`],d);let f=h(e,[`videoMetadata`]);return f!=null&&m(t,[`videoMetadata`],f),t}function or(e){let t={},n=h(e,[`category`]);if(n!=null&&m(t,[`category`],n),h(e,[`method`])!==void 0)throw Error(`method parameter is not supported in Gemini API.`);let r=h(e,[`threshold`]);return r!=null&&m(t,[`threshold`],r),t}function sr(e){let t={},n=h(e,[`retrievalConfig`]);n!=null&&m(t,[`retrievalConfig`],n);let r=h(e,[`functionCallingConfig`]);return r!=null&&m(t,[`functionCallingConfig`],Un(r)),t}function cr(e){let t={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=h(e,[`computerUse`]);n!=null&&m(t,[`computerUse`],n);let r=h(e,[`fileSearch`]);r!=null&&m(t,[`fileSearch`],r);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],Yn(i));let a=h(e,[`codeExecution`]);if(a!=null&&m(t,[`codeExecution`],a),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let o=h(e,[`functionDeclarations`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`functionDeclarations`],e)}let s=h(e,[`googleMaps`]);s!=null&&m(t,[`googleMaps`],Jn(s));let c=h(e,[`googleSearchRetrieval`]);c!=null&&m(t,[`googleSearchRetrieval`],c);let l=h(e,[`urlContext`]);l!=null&&m(t,[`urlContext`],l);let u=h(e,[`mcpServers`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mcpServers`],e)}return t}var V;(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`})(V||={});var H=class{constructor(e,t,n,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,n,r)}init(e,t,n){this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.sdkHttpResponseInternal=t?.sdkHttpResponse,this.idxInternal=0;let r={config:{}};r=!n||Object.keys(n).length===0?{config:{}}:typeof n==`object`?Object.assign({},n):n,r.config&&(r.config.pageToken=t.nextPageToken),this.paramsInternal=r,this.pageInternalSize=r.config?.pageSize??this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw Error(`No more pages to fetch.`);let e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){return this.params.config?.pageToken!==void 0}},lr=class extends f{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new H(V.PAGED_ITEM_BATCH_JOBS,e=>this.listInternal(e),await this.listInternal(e),e),this.create=async e=>(this.apiClient.isVertexAI()&&(e.config=this.formatDestination(e.src,e.config)),this.createInternal(e)),this.createEmbeddings=async e=>{if(console.warn(`batches.createEmbeddings() is experimental and may change without notice.`),this.apiClient.isVertexAI())throw Error(`Vertex AI does not support batches.createEmbeddings.`);return this.createEmbeddingsInternal(e)}}createInlinedGenerateContentRequest(e){let t=An(this.apiClient,e),n=t._url,r=p(`{model}:batchGenerateContent`,n),i=t.batch.inputConfig.requests,a=i.requests,o=[];for(let e of a){let t=Object.assign({},e);if(t.systemInstruction){let e=t.systemInstruction;delete t.systemInstruction;let n=t.request;n.systemInstruction=e,t.request=n}o.push(t)}return i.requests=o,delete t.config,delete t._url,delete t._query,{path:r,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 n=t?Object.assign({},t):{},r=Date.now().toString();if(n.displayName||=`genaiBatchJob_${r}`,n.dest===void 0){let t=this.getGcsUri(e),i=this.getBigqueryUri(e);if(t)t.endsWith(`.jsonl`)?n.dest=`${t.slice(0,-6)}/dest`:n.dest=`${t}_dest_${r}`;else if(i)n.dest=`${i}_dest_${r}`;else throw Error(`Unsupported source for Vertex AI: No GCS or BigQuery URI found.`)}return n}async createInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=jn(this.apiClient,e);return n=p(`batchPredictionJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}else{let i=An(this.apiClient,e);return n=p(`{model}:batchGenerateContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_n(e))}}async createEmbeddingsInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Nn(this.apiClient,e);return n=p(`{model}:asyncBatchEmbedContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_n(e))}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=qn(this.apiClient,e);return n=p(`batchPredictionJobs/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}else{let i=Kn(this.apiClient,e);return n=p(`batches/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_n(e))}}async cancel(e){let t=``,n={};if(this.apiClient.isVertexAI()){let r=wn(this.apiClient,e);t=p(`batchPredictionJobs/{name}:cancel`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}else{let r=Cn(this.apiClient,e);t=p(`batches/{name}:cancel`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=nr(e);return n=p(`batchPredictionJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ir(e),n=new jt;return Object.assign(n,t),n})}else{let i=tr(e);return n=p(`batches`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=rr(e),n=new jt;return Object.assign(n,t),n})}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Fn(this.apiClient,e);return n=p(`batchPredictionJobs/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>Ln(e))}else{let i=Pn(this.apiClient,e);return n=p(`batches/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>In(e))}}};function ur(e){let t={},n=h(e,[`data`]);if(n!=null&&m(t,[`data`],n),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function dr(e){let t={},n=h(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Pr(e))),m(t,[`parts`],e)}let r=h(e,[`role`]);return r!=null&&m(t,[`role`],r),t}function fr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);t!==void 0&&i!=null&&m(t,[`expireTime`],i);let a=h(e,[`displayName`]);t!==void 0&&a!=null&&m(t,[`displayName`],a);let o=h(e,[`contents`]);if(t!==void 0&&o!=null){let e=F(o);Array.isArray(e)&&(e=e.map(e=>dr(e))),m(t,[`contents`],e)}let s=h(e,[`systemInstruction`]);t!==void 0&&s!=null&&m(t,[`systemInstruction`],dr(P(s)));let c=h(e,[`tools`]);if(t!==void 0&&c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Ir(e))),m(t,[`tools`],e)}let l=h(e,[`toolConfig`]);if(t!==void 0&&l!=null&&m(t,[`toolConfig`],Fr(l)),h(e,[`kmsKeyName`])!==void 0)throw Error(`kmsKeyName parameter is not supported in Gemini API.`);return n}function pr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);t!==void 0&&i!=null&&m(t,[`expireTime`],i);let a=h(e,[`displayName`]);t!==void 0&&a!=null&&m(t,[`displayName`],a);let o=h(e,[`contents`]);if(t!==void 0&&o!=null){let e=F(o);Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`contents`],e)}let s=h(e,[`systemInstruction`]);t!==void 0&&s!=null&&m(t,[`systemInstruction`],P(s));let c=h(e,[`tools`]);if(t!==void 0&&c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Lr(e))),m(t,[`tools`],e)}let l=h(e,[`toolConfig`]);t!==void 0&&l!=null&&m(t,[`toolConfig`],l);let u=h(e,[`kmsKeyName`]);return t!==void 0&&u!=null&&m(t,[`encryption_spec`,`kmsKeyName`],u),n}function mr(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`model`],Ft(e,r));let i=h(t,[`config`]);return i!=null&&fr(i,n),n}function hr(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`model`],Ft(e,r));let i=h(t,[`config`]);return i!=null&&pr(i,n),n}function gr(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function _r(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function vr(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function yr(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function br(e){let t={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=h(e,[`fileUri`]);n!=null&&m(t,[`fileUri`],n);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function xr(e){let t={},n=h(e,[`id`]);n!=null&&m(t,[`id`],n);let r=h(e,[`args`]);r!=null&&m(t,[`args`],r);let i=h(e,[`name`]);if(i!=null&&m(t,[`name`],i),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function Sr(e){let t={},n=h(e,[`allowedFunctionNames`]);n!=null&&m(t,[`allowedFunctionNames`],n);let r=h(e,[`mode`]);if(r!=null&&m(t,[`mode`],r),h(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return t}function Cr(e){let t={},n=h(e,[`description`]);n!=null&&m(t,[`description`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`parameters`]);i!=null&&m(t,[`parameters`],i);let a=h(e,[`parametersJsonSchema`]);a!=null&&m(t,[`parametersJsonSchema`],a);let o=h(e,[`response`]);o!=null&&m(t,[`response`],o);let s=h(e,[`responseJsonSchema`]);if(s!=null&&m(t,[`responseJsonSchema`],s),h(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return t}function wr(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function Tr(e,t){let n={},r=h(t,[`name`]);return r!=null&&m(n,[`_url`,`name`],R(e,r)),n}function Er(e){let t={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let n=h(e,[`enableWidget`]);return n!=null&&m(t,[`enableWidget`],n),t}function Dr(e){let t={},n=h(e,[`searchTypes`]);if(n!=null&&m(t,[`searchTypes`],n),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let r=h(e,[`timeRangeFilter`]);return r!=null&&m(t,[`timeRangeFilter`],r),t}function Or(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function kr(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function Ar(e){let t={},n=h(e,[`config`]);return n!=null&&Or(n,t),t}function jr(e){let t={},n=h(e,[`config`]);return n!=null&&kr(n,t),t}function Mr(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`cachedContents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`cachedContents`],e)}return t}function Nr(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`cachedContents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`cachedContents`],e)}return t}function Pr(e){let t={},n=h(e,[`mediaResolution`]);n!=null&&m(t,[`mediaResolution`],n);let r=h(e,[`codeExecutionResult`]);r!=null&&m(t,[`codeExecutionResult`],r);let i=h(e,[`executableCode`]);i!=null&&m(t,[`executableCode`],i);let a=h(e,[`fileData`]);a!=null&&m(t,[`fileData`],br(a));let o=h(e,[`functionCall`]);o!=null&&m(t,[`functionCall`],xr(o));let s=h(e,[`functionResponse`]);s!=null&&m(t,[`functionResponse`],s);let c=h(e,[`inlineData`]);c!=null&&m(t,[`inlineData`],ur(c));let l=h(e,[`text`]);l!=null&&m(t,[`text`],l);let u=h(e,[`thought`]);u!=null&&m(t,[`thought`],u);let d=h(e,[`thoughtSignature`]);d!=null&&m(t,[`thoughtSignature`],d);let f=h(e,[`videoMetadata`]);return f!=null&&m(t,[`videoMetadata`],f),t}function Fr(e){let t={},n=h(e,[`retrievalConfig`]);n!=null&&m(t,[`retrievalConfig`],n);let r=h(e,[`functionCallingConfig`]);return r!=null&&m(t,[`functionCallingConfig`],Sr(r)),t}function Ir(e){let t={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=h(e,[`computerUse`]);n!=null&&m(t,[`computerUse`],n);let r=h(e,[`fileSearch`]);r!=null&&m(t,[`fileSearch`],r);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],Dr(i));let a=h(e,[`codeExecution`]);if(a!=null&&m(t,[`codeExecution`],a),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let o=h(e,[`functionDeclarations`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`functionDeclarations`],e)}let s=h(e,[`googleMaps`]);s!=null&&m(t,[`googleMaps`],Er(s));let c=h(e,[`googleSearchRetrieval`]);c!=null&&m(t,[`googleSearchRetrieval`],c);let l=h(e,[`urlContext`]);l!=null&&m(t,[`urlContext`],l);let u=h(e,[`mcpServers`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mcpServers`],e)}return t}function Lr(e){let t={},n=h(e,[`retrieval`]);n!=null&&m(t,[`retrieval`],n);let r=h(e,[`computerUse`]);if(r!=null&&m(t,[`computerUse`],r),h(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],i);let a=h(e,[`codeExecution`]);a!=null&&m(t,[`codeExecution`],a);let o=h(e,[`enterpriseWebSearch`]);o!=null&&m(t,[`enterpriseWebSearch`],o);let s=h(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>Cr(e))),m(t,[`functionDeclarations`],e)}let c=h(e,[`googleMaps`]);c!=null&&m(t,[`googleMaps`],c);let l=h(e,[`googleSearchRetrieval`]);l!=null&&m(t,[`googleSearchRetrieval`],l);let u=h(e,[`urlContext`]);if(u!=null&&m(t,[`urlContext`],u),h(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return t}function Rr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);return t!==void 0&&i!=null&&m(t,[`expireTime`],i),n}function zr(e,t){let n={},r=h(e,[`ttl`]);t!==void 0&&r!=null&&m(t,[`ttl`],r);let i=h(e,[`expireTime`]);return t!==void 0&&i!=null&&m(t,[`expireTime`],i),n}function Br(e,t){let n={},r=h(t,[`name`]);r!=null&&m(n,[`_url`,`name`],R(e,r));let i=h(t,[`config`]);return i!=null&&Rr(i,n),n}function Vr(e,t){let n={},r=h(t,[`name`]);r!=null&&m(n,[`_url`,`name`],R(e,r));let i=h(t,[`config`]);return i!=null&&zr(i,n),n}var Hr=class extends f{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new H(V.PAGED_ITEM_CACHED_CONTENTS,e=>this.listInternal(e),await this.listInternal(e),e)}async create(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=hr(this.apiClient,e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=mr(this.apiClient,e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Tr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=wr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=_r(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=yr(e),n=new xt;return Object.assign(n,t),n})}else{let i=gr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=vr(e),n=new xt;return Object.assign(n,t),n})}}async update(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Vr(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=Br(this.apiClient,e);return n=p(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=jr(e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Nr(e),n=new St;return Object.assign(n,t),n})}else{let i=Ar(e);return n=p(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Mr(e),n=new St;return Object.assign(n,t),n})}}};function Ur(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Wr(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function U(e){return this instanceof U?(this.v=e,this):new U(e)}function W(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof U?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function G(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Wr==`function`?Wr(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Gr(e){if(e.candidates==null||e.candidates.length===0)return!1;let t=e.candidates[0]?.content;return t===void 0?!1:Kr(t)}function Kr(e){if(e.parts===void 0||e.parts.length===0)return!1;for(let t of e.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function qr(e){if(e.length!==0){for(let t of e)if(t.role!==`user`&&t.role!==`model`)throw Error(`Role must be user or model, but got ${t.role}.`)}}function Jr(e){if(e===void 0||e.length===0)return[];let t=[],n=e.length,r=0;for(;r<n;)if(e[r].role===`user`)t.push(e[r]),r++;else{let i=[],a=!0;for(;r<n&&e[r].role===`model`;)i.push(e[r]),a&&!Kr(e[r])&&(a=!1),r++;a?t.push(...i):t.pop()}return t}var Yr=class{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new Xr(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},Xr=class{constructor(e,t,n,r={},i=[]){this.apiClient=e,this.modelsModule=t,this.model=n,this.config=r,this.history=i,this.sendPromise=Promise.resolve(),qr(i)}async sendMessage(e){await this.sendPromise;let t=P(e.message),n=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(t),config:e.config??this.config});return this.sendPromise=(async()=>{let e=await n,r=e.candidates?.[0]?.content,i=e.automaticFunctionCallingHistory,a=this.getHistory(!0).length,o=[];i!=null&&(o=i.slice(a)??[]);let s=r?[r]:[];this.recordHistory(t,s,o)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),n}async sendMessageStream(e){await this.sendPromise;let t=P(e.message),n=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(t),config:e.config??this.config});this.sendPromise=n.then(()=>void 0).catch(()=>void 0);let r=await n;return this.processStreamResponse(r,t)}getHistory(e=!1){let t=e?Jr(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return W(this,arguments,function*(){var n,r,i,a;let o=[];try{for(var s=!0,c=G(e),l;l=yield U(c.next()),n=l.done,!n;s=!0){a=l.value,s=!1;let e=a;if(Gr(e)){let t=e.candidates?.[0]?.content;t!==void 0&&o.push(t)}yield yield U(e)}}catch(e){r={error:e}}finally{try{!s&&!n&&(i=c.return)&&(yield U(i.call(c)))}finally{if(r)throw r.error}}this.recordHistory(t,o)})}recordHistory(e,t,n){let r=[];t.length>0&&t.every(e=>e.role!==void 0)?r=t:r.push({role:`model`,parts:[]}),n&&n.length>0?this.history.push(...Jr(n)):this.history.push(e),this.history.push(...r)}},Zr=class e extends Error{constructor(t){super(t.message),this.name=`ApiError`,this.status=t.status,Object.setPrototypeOf(this,e.prototype)}};function Qr(e){let t={},n=h(e,[`file`]);return n!=null&&m(t,[`file`],n),t}function $r(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function ei(e){let t={},n=h(e,[`name`]);return n!=null&&m(t,[`_url`,`file`],nn(n)),t}function ti(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}function ni(e){let t={},n=h(e,[`name`]);return n!=null&&m(t,[`_url`,`file`],nn(n)),t}function ri(e){let t={},n=h(e,[`uris`]);return n!=null&&m(t,[`uris`],n),t}function ii(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function ai(e){let t={},n=h(e,[`config`]);return n!=null&&ii(n,t),t}function oi(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`files`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`files`],e)}return t}function si(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`files`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`files`],e)}return t}var ci=class extends f{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new H(V.PAGED_ITEM_FILES,e=>this.listInternal(e),await this.listInternal(e),e)}async upload(e){if(this.apiClient.isVertexAI())throw Error(`Vertex AI does not support uploading files. You can share files through a GCS bucket.`);return this.apiClient.uploadFile(e.file,e.config).then(e=>e)}async download(e){await this.apiClient.downloadFile(e)}async registerFiles(e){throw Error(`registerFiles is only supported in Node.js environments.`)}async _registerFiles(e){return this.registerFilesInternal(e)}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ai(e);return n=p(`files`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=oi(e),n=new Dt;return Object.assign(n,t),n})}}async createInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Qr(e);return n=p(`upload/v1beta/files`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=$r(e),n=new Ot;return Object.assign(n,t),n})}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ni(e);return n=p(`files/{file}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ei(e);return n=p(`files/{file}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ti(e),n=new kt;return Object.assign(n,t),n})}}async registerFilesInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ri(e);return n=p(`files:register`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=si(e),n=new At;return Object.assign(n,t),n})}}};function li(e){let t={},n=h(e,[`data`]);if(n!=null&&m(t,[`data`],n),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function ui(e){let t={},n=h(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Ei(e))),m(t,[`parts`],e)}let r=h(e,[`role`]);return r!=null&&m(t,[`role`],r),t}function di(e){let t={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=h(e,[`fileUri`]);n!=null&&m(t,[`fileUri`],n);let r=h(e,[`mimeType`]);return r!=null&&m(t,[`mimeType`],r),t}function fi(e){let t={},n=h(e,[`id`]);n!=null&&m(t,[`id`],n);let r=h(e,[`args`]);r!=null&&m(t,[`args`],r);let i=h(e,[`name`]);if(i!=null&&m(t,[`name`],i),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function pi(e){let t={},n=h(e,[`description`]);n!=null&&m(t,[`description`],n);let r=h(e,[`name`]);r!=null&&m(t,[`name`],r);let i=h(e,[`parameters`]);i!=null&&m(t,[`parameters`],i);let a=h(e,[`parametersJsonSchema`]);a!=null&&m(t,[`parametersJsonSchema`],a);let o=h(e,[`response`]);o!=null&&m(t,[`response`],o);let s=h(e,[`responseJsonSchema`]);if(s!=null&&m(t,[`responseJsonSchema`],s),h(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return t}function mi(e){let t={},n=h(e,[`modelSelectionConfig`]);n!=null&&m(t,[`modelConfig`],n);let r=h(e,[`responseJsonSchema`]);r!=null&&m(t,[`responseJsonSchema`],r);let i=h(e,[`audioTimestamp`]);i!=null&&m(t,[`audioTimestamp`],i);let a=h(e,[`candidateCount`]);a!=null&&m(t,[`candidateCount`],a);let o=h(e,[`enableAffectiveDialog`]);o!=null&&m(t,[`enableAffectiveDialog`],o);let s=h(e,[`frequencyPenalty`]);s!=null&&m(t,[`frequencyPenalty`],s);let c=h(e,[`logprobs`]);c!=null&&m(t,[`logprobs`],c);let l=h(e,[`maxOutputTokens`]);l!=null&&m(t,[`maxOutputTokens`],l);let u=h(e,[`mediaResolution`]);u!=null&&m(t,[`mediaResolution`],u);let d=h(e,[`presencePenalty`]);d!=null&&m(t,[`presencePenalty`],d);let f=h(e,[`responseLogprobs`]);f!=null&&m(t,[`responseLogprobs`],f);let p=h(e,[`responseMimeType`]);p!=null&&m(t,[`responseMimeType`],p);let g=h(e,[`responseModalities`]);g!=null&&m(t,[`responseModalities`],g);let _=h(e,[`responseSchema`]);_!=null&&m(t,[`responseSchema`],_);let v=h(e,[`routingConfig`]);v!=null&&m(t,[`routingConfig`],v);let y=h(e,[`seed`]);y!=null&&m(t,[`seed`],y);let b=h(e,[`speechConfig`]);b!=null&&m(t,[`speechConfig`],b);let x=h(e,[`stopSequences`]);x!=null&&m(t,[`stopSequences`],x);let S=h(e,[`temperature`]);S!=null&&m(t,[`temperature`],S);let C=h(e,[`thinkingConfig`]);C!=null&&m(t,[`thinkingConfig`],C);let w=h(e,[`topK`]);w!=null&&m(t,[`topK`],w);let T=h(e,[`topP`]);if(T!=null&&m(t,[`topP`],T),h(e,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);return t}function hi(e){let t={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let n=h(e,[`enableWidget`]);return n!=null&&m(t,[`enableWidget`],n),t}function gi(e){let t={},n=h(e,[`searchTypes`]);if(n!=null&&m(t,[`searchTypes`],n),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let r=h(e,[`timeRangeFilter`]);return r!=null&&m(t,[`timeRangeFilter`],r),t}function _i(e,t){let n={},r=h(e,[`generationConfig`]);t!==void 0&&r!=null&&m(t,[`setup`,`generationConfig`],r);let i=h(e,[`responseModalities`]);t!==void 0&&i!=null&&m(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=h(e,[`temperature`]);t!==void 0&&a!=null&&m(t,[`setup`,`generationConfig`,`temperature`],a);let o=h(e,[`topP`]);t!==void 0&&o!=null&&m(t,[`setup`,`generationConfig`,`topP`],o);let s=h(e,[`topK`]);t!==void 0&&s!=null&&m(t,[`setup`,`generationConfig`,`topK`],s);let c=h(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&m(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let l=h(e,[`mediaResolution`]);t!==void 0&&l!=null&&m(t,[`setup`,`generationConfig`,`mediaResolution`],l);let u=h(e,[`seed`]);t!==void 0&&u!=null&&m(t,[`setup`,`generationConfig`,`seed`],u);let d=h(e,[`speechConfig`]);t!==void 0&&d!=null&&m(t,[`setup`,`generationConfig`,`speechConfig`],Xt(d));let f=h(e,[`thinkingConfig`]);t!==void 0&&f!=null&&m(t,[`setup`,`generationConfig`,`thinkingConfig`],f);let p=h(e,[`enableAffectiveDialog`]);t!==void 0&&p!=null&&m(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],p);let g=h(e,[`systemInstruction`]);t!==void 0&&g!=null&&m(t,[`setup`,`systemInstruction`],ui(P(g)));let _=h(e,[`tools`]);if(t!==void 0&&_!=null){let e=L(_);Array.isArray(e)&&(e=e.map(e=>Oi(I(e)))),m(t,[`setup`,`tools`],e)}let v=h(e,[`sessionResumption`]);t!==void 0&&v!=null&&m(t,[`setup`,`sessionResumption`],Di(v));let y=h(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&m(t,[`setup`,`inputAudioTranscription`],y);let b=h(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&m(t,[`setup`,`outputAudioTranscription`],b);let x=h(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&m(t,[`setup`,`realtimeInputConfig`],x);let S=h(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&m(t,[`setup`,`contextWindowCompression`],S);let C=h(e,[`proactivity`]);if(t!==void 0&&C!=null&&m(t,[`setup`,`proactivity`],C),h(e,[`explicitVadSignal`])!==void 0)throw Error(`explicitVadSignal parameter is not supported in Gemini API.`);return n}function vi(e,t){let n={},r=h(e,[`generationConfig`]);t!==void 0&&r!=null&&m(t,[`setup`,`generationConfig`],mi(r));let i=h(e,[`responseModalities`]);t!==void 0&&i!=null&&m(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=h(e,[`temperature`]);t!==void 0&&a!=null&&m(t,[`setup`,`generationConfig`,`temperature`],a);let o=h(e,[`topP`]);t!==void 0&&o!=null&&m(t,[`setup`,`generationConfig`,`topP`],o);let s=h(e,[`topK`]);t!==void 0&&s!=null&&m(t,[`setup`,`generationConfig`,`topK`],s);let c=h(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&m(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let l=h(e,[`mediaResolution`]);t!==void 0&&l!=null&&m(t,[`setup`,`generationConfig`,`mediaResolution`],l);let u=h(e,[`seed`]);t!==void 0&&u!=null&&m(t,[`setup`,`generationConfig`,`seed`],u);let d=h(e,[`speechConfig`]);t!==void 0&&d!=null&&m(t,[`setup`,`generationConfig`,`speechConfig`],Xt(d));let f=h(e,[`thinkingConfig`]);t!==void 0&&f!=null&&m(t,[`setup`,`generationConfig`,`thinkingConfig`],f);let p=h(e,[`enableAffectiveDialog`]);t!==void 0&&p!=null&&m(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],p);let g=h(e,[`systemInstruction`]);t!==void 0&&g!=null&&m(t,[`setup`,`systemInstruction`],P(g));let _=h(e,[`tools`]);if(t!==void 0&&_!=null){let e=L(_);Array.isArray(e)&&(e=e.map(e=>ki(I(e)))),m(t,[`setup`,`tools`],e)}let v=h(e,[`sessionResumption`]);t!==void 0&&v!=null&&m(t,[`setup`,`sessionResumption`],v);let y=h(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&m(t,[`setup`,`inputAudioTranscription`],y);let b=h(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&m(t,[`setup`,`outputAudioTranscription`],b);let x=h(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&m(t,[`setup`,`realtimeInputConfig`],x);let S=h(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&m(t,[`setup`,`contextWindowCompression`],S);let C=h(e,[`proactivity`]);t!==void 0&&C!=null&&m(t,[`setup`,`proactivity`],C);let w=h(e,[`explicitVadSignal`]);return t!==void 0&&w!=null&&m(t,[`setup`,`explicitVadSignal`],w),n}function yi(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`setup`,`model`],N(e,r));let i=h(t,[`config`]);return i!=null&&m(n,[`config`],_i(i,n)),n}function bi(e,t){let n={},r=h(t,[`model`]);r!=null&&m(n,[`setup`,`model`],N(e,r));let i=h(t,[`config`]);return i!=null&&m(n,[`config`],vi(i,n)),n}function xi(e){let t={},n=h(e,[`musicGenerationConfig`]);return n!=null&&m(t,[`musicGenerationConfig`],n),t}function Si(e){let t={},n=h(e,[`weightedPrompts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`weightedPrompts`],e)}return t}function Ci(e){let t={},n=h(e,[`media`]);if(n!=null){let e=It(n);Array.isArray(e)&&(e=e.map(e=>li(e))),m(t,[`mediaChunks`],e)}let r=h(e,[`audio`]);r!=null&&m(t,[`audio`],li(zt(r)));let i=h(e,[`audioStreamEnd`]);i!=null&&m(t,[`audioStreamEnd`],i);let a=h(e,[`video`]);a!=null&&m(t,[`video`],li(Rt(a)));let o=h(e,[`text`]);o!=null&&m(t,[`text`],o);let s=h(e,[`activityStart`]);s!=null&&m(t,[`activityStart`],s);let c=h(e,[`activityEnd`]);return c!=null&&m(t,[`activityEnd`],c),t}function wi(e){let t={},n=h(e,[`media`]);if(n!=null){let e=It(n);Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mediaChunks`],e)}let r=h(e,[`audio`]);r!=null&&m(t,[`audio`],zt(r));let i=h(e,[`audioStreamEnd`]);i!=null&&m(t,[`audioStreamEnd`],i);let a=h(e,[`video`]);a!=null&&m(t,[`video`],Rt(a));let o=h(e,[`text`]);o!=null&&m(t,[`text`],o);let s=h(e,[`activityStart`]);s!=null&&m(t,[`activityStart`],s);let c=h(e,[`activityEnd`]);return c!=null&&m(t,[`activityEnd`],c),t}function Ti(e){let t={},n=h(e,[`setupComplete`]);n!=null&&m(t,[`setupComplete`],n);let r=h(e,[`serverContent`]);r!=null&&m(t,[`serverContent`],r);let i=h(e,[`toolCall`]);i!=null&&m(t,[`toolCall`],i);let a=h(e,[`toolCallCancellation`]);a!=null&&m(t,[`toolCallCancellation`],a);let o=h(e,[`usageMetadata`]);o!=null&&m(t,[`usageMetadata`],Ai(o));let s=h(e,[`goAway`]);s!=null&&m(t,[`goAway`],s);let c=h(e,[`sessionResumptionUpdate`]);c!=null&&m(t,[`sessionResumptionUpdate`],c);let l=h(e,[`voiceActivityDetectionSignal`]);l!=null&&m(t,[`voiceActivityDetectionSignal`],l);let u=h(e,[`voiceActivity`]);return u!=null&&m(t,[`voiceActivity`],ji(u)),t}function Ei(e){let t={},n=h(e,[`mediaResolution`]);n!=null&&m(t,[`mediaResolution`],n);let r=h(e,[`codeExecutionResult`]);r!=null&&m(t,[`codeExecutionResult`],r);let i=h(e,[`executableCode`]);i!=null&&m(t,[`executableCode`],i);let a=h(e,[`fileData`]);a!=null&&m(t,[`fileData`],di(a));let o=h(e,[`functionCall`]);o!=null&&m(t,[`functionCall`],fi(o));let s=h(e,[`functionResponse`]);s!=null&&m(t,[`functionResponse`],s);let c=h(e,[`inlineData`]);c!=null&&m(t,[`inlineData`],li(c));let l=h(e,[`text`]);l!=null&&m(t,[`text`],l);let u=h(e,[`thought`]);u!=null&&m(t,[`thought`],u);let d=h(e,[`thoughtSignature`]);d!=null&&m(t,[`thoughtSignature`],d);let f=h(e,[`videoMetadata`]);return f!=null&&m(t,[`videoMetadata`],f),t}function Di(e){let t={},n=h(e,[`handle`]);if(n!=null&&m(t,[`handle`],n),h(e,[`transparent`])!==void 0)throw Error(`transparent parameter is not supported in Gemini API.`);return t}function Oi(e){let t={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=h(e,[`computerUse`]);n!=null&&m(t,[`computerUse`],n);let r=h(e,[`fileSearch`]);r!=null&&m(t,[`fileSearch`],r);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],gi(i));let a=h(e,[`codeExecution`]);if(a!=null&&m(t,[`codeExecution`],a),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let o=h(e,[`functionDeclarations`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`functionDeclarations`],e)}let s=h(e,[`googleMaps`]);s!=null&&m(t,[`googleMaps`],hi(s));let c=h(e,[`googleSearchRetrieval`]);c!=null&&m(t,[`googleSearchRetrieval`],c);let l=h(e,[`urlContext`]);l!=null&&m(t,[`urlContext`],l);let u=h(e,[`mcpServers`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`mcpServers`],e)}return t}function ki(e){let t={},n=h(e,[`retrieval`]);n!=null&&m(t,[`retrieval`],n);let r=h(e,[`computerUse`]);if(r!=null&&m(t,[`computerUse`],r),h(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let i=h(e,[`googleSearch`]);i!=null&&m(t,[`googleSearch`],i);let a=h(e,[`codeExecution`]);a!=null&&m(t,[`codeExecution`],a);let o=h(e,[`enterpriseWebSearch`]);o!=null&&m(t,[`enterpriseWebSearch`],o);let s=h(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>pi(e))),m(t,[`functionDeclarations`],e)}let c=h(e,[`googleMaps`]);c!=null&&m(t,[`googleMaps`],c);let l=h(e,[`googleSearchRetrieval`]);l!=null&&m(t,[`googleSearchRetrieval`],l);let u=h(e,[`urlContext`]);if(u!=null&&m(t,[`urlContext`],u),h(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return t}function Ai(e){let t={},n=h(e,[`promptTokenCount`]);n!=null&&m(t,[`promptTokenCount`],n);let r=h(e,[`cachedContentTokenCount`]);r!=null&&m(t,[`cachedContentTokenCount`],r);let i=h(e,[`candidatesTokenCount`]);i!=null&&m(t,[`responseTokenCount`],i);let a=h(e,[`toolUsePromptTokenCount`]);a!=null&&m(t,[`toolUsePromptTokenCount`],a);let o=h(e,[`thoughtsTokenCount`]);o!=null&&m(t,[`thoughtsTokenCount`],o);let s=h(e,[`totalTokenCount`]);s!=null&&m(t,[`totalTokenCount`],s);let c=h(e,[`promptTokensDetails`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`promptTokensDetails`],e)}let l=h(e,[`cacheTokensDetails`]);if(l!=null){let e=l;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`cacheTokensDetails`],e)}let u=h(e,[`candidatesTokensDetails`]);if(u!=null){let e=u;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`responseTokensDetails`],e)}let d=h(e,[`toolUsePromptTokensDetails`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`toolUsePromptTokensDetails`],e)}let f=h(e,[`trafficType`]);return f!=null&&m(t,[`trafficType`],f),t}function ji(e){let t={},n=h(e,[`type`]);return n!=null&&m(t,[`voiceActivityType`],n),t}function Mi(e,t){let n={},r=h(e,[`data`]);if(r!=null&&m(n,[`data`],r),h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function Ni(e,t){let n={},r=h(e,[`content`]);r!=null&&m(n,[`content`],r);let i=h(e,[`citationMetadata`]);i!=null&&m(n,[`citationMetadata`],Pi(i));let a=h(e,[`tokenCount`]);a!=null&&m(n,[`tokenCount`],a);let o=h(e,[`finishReason`]);o!=null&&m(n,[`finishReason`],o);let s=h(e,[`groundingMetadata`]);s!=null&&m(n,[`groundingMetadata`],s);let c=h(e,[`avgLogprobs`]);c!=null&&m(n,[`avgLogprobs`],c);let l=h(e,[`index`]);l!=null&&m(n,[`index`],l);let u=h(e,[`logprobsResult`]);u!=null&&m(n,[`logprobsResult`],u);let d=h(e,[`safetyRatings`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`safetyRatings`],e)}let f=h(e,[`urlContextMetadata`]);return f!=null&&m(n,[`urlContextMetadata`],f),n}function Pi(e,t){let n={},r=h(e,[`citationSources`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`citations`],e)}return n}function Fi(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>e)),m(r,[`contents`],e)}return r}function Ii(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`tokensInfo`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`tokensInfo`],e)}return n}function Li(e,t){let n={},r=h(e,[`values`]);r!=null&&m(n,[`values`],r);let i=h(e,[`statistics`]);return i!=null&&m(n,[`statistics`],Ri(i)),n}function Ri(e,t){let n={},r=h(e,[`truncated`]);r!=null&&m(n,[`truncated`],r);let i=h(e,[`token_count`]);return i!=null&&m(n,[`tokenCount`],i),n}function zi(e,t){let n={},r=h(e,[`parts`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>ro(e))),m(n,[`parts`],e)}let i=h(e,[`role`]);return i!=null&&m(n,[`role`],i),n}function Bi(e,t){let n={},r=h(e,[`controlType`]);r!=null&&m(n,[`controlType`],r);let i=h(e,[`enableControlImageComputation`]);return i!=null&&m(n,[`computeControl`],i),n}function Vi(e,t){let n={};if(h(e,[`systemInstruction`])!==void 0)throw Error(`systemInstruction parameter is not supported in Gemini API.`);if(h(e,[`tools`])!==void 0)throw Error(`tools parameter is not supported in Gemini API.`);if(h(e,[`generationConfig`])!==void 0)throw Error(`generationConfig parameter is not supported in Gemini API.`);return n}function Hi(e,t,n){let r={},i=h(e,[`systemInstruction`]);t!==void 0&&i!=null&&m(t,[`systemInstruction`],P(i));let a=h(e,[`tools`]);if(t!==void 0&&a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>xo(e))),m(t,[`tools`],e)}let o=h(e,[`generationConfig`]);return t!==void 0&&o!=null&&m(t,[`generationConfig`],Ra(o)),r}function Ui(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>zi(e))),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&Vi(o),r}function Wi(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>e)),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&Hi(o,r),r}function Gi(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`totalTokens`]);i!=null&&m(n,[`totalTokens`],i);let a=h(e,[`cachedContentTokenCount`]);return a!=null&&m(n,[`cachedContentTokenCount`],a),n}function Ki(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`totalTokens`]);return i!=null&&m(n,[`totalTokens`],i),n}function qi(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Ji(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Yi(e,t){let n={},r=h(e,[`sdkHttpResponse`]);return r!=null&&m(n,[`sdkHttpResponse`],r),n}function Xi(e,t){let n={},r=h(e,[`sdkHttpResponse`]);return r!=null&&m(n,[`sdkHttpResponse`],r),n}function Zi(e,t,n){let r={},i=h(e,[`outputGcsUri`]);t!==void 0&&i!=null&&m(t,[`parameters`,`storageUri`],i);let a=h(e,[`negativePrompt`]);t!==void 0&&a!=null&&m(t,[`parameters`,`negativePrompt`],a);let o=h(e,[`numberOfImages`]);t!==void 0&&o!=null&&m(t,[`parameters`,`sampleCount`],o);let s=h(e,[`aspectRatio`]);t!==void 0&&s!=null&&m(t,[`parameters`,`aspectRatio`],s);let c=h(e,[`guidanceScale`]);t!==void 0&&c!=null&&m(t,[`parameters`,`guidanceScale`],c);let l=h(e,[`seed`]);t!==void 0&&l!=null&&m(t,[`parameters`,`seed`],l);let u=h(e,[`safetyFilterLevel`]);t!==void 0&&u!=null&&m(t,[`parameters`,`safetySetting`],u);let d=h(e,[`personGeneration`]);t!==void 0&&d!=null&&m(t,[`parameters`,`personGeneration`],d);let f=h(e,[`includeSafetyAttributes`]);t!==void 0&&f!=null&&m(t,[`parameters`,`includeSafetyAttributes`],f);let p=h(e,[`includeRaiReason`]);t!==void 0&&p!=null&&m(t,[`parameters`,`includeRaiReason`],p);let g=h(e,[`language`]);t!==void 0&&g!=null&&m(t,[`parameters`,`language`],g);let _=h(e,[`outputMimeType`]);t!==void 0&&_!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],_);let v=h(e,[`outputCompressionQuality`]);t!==void 0&&v!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],v);let y=h(e,[`addWatermark`]);t!==void 0&&y!=null&&m(t,[`parameters`,`addWatermark`],y);let b=h(e,[`labels`]);t!==void 0&&b!=null&&m(t,[`labels`],b);let x=h(e,[`editMode`]);t!==void 0&&x!=null&&m(t,[`parameters`,`editMode`],x);let S=h(e,[`baseSteps`]);return t!==void 0&&S!=null&&m(t,[`parameters`,`editConfig`,`baseSteps`],S),r}function Qi(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`referenceImages`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>lo(e))),m(r,[`instances[0]`,`referenceImages`],e)}let s=h(t,[`config`]);return s!=null&&Zi(s,r),r}function $i(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}return n}function ea(e,t,n){let r={},i=h(e,[`taskType`]);t!==void 0&&i!=null&&m(t,[`requests[]`,`taskType`],i);let a=h(e,[`title`]);t!==void 0&&a!=null&&m(t,[`requests[]`,`title`],a);let o=h(e,[`outputDimensionality`]);if(t!==void 0&&o!=null&&m(t,[`requests[]`,`outputDimensionality`],o),h(e,[`mimeType`])!==void 0)throw Error(`mimeType parameter is not supported in Gemini API.`);if(h(e,[`autoTruncate`])!==void 0)throw Error(`autoTruncate parameter is not supported in Gemini API.`);return r}function ta(e,t,n){let r={},i=h(n,[`embeddingApiType`]);if(i===void 0&&(i=`PREDICT`),i===`PREDICT`){let n=h(e,[`taskType`]);t!==void 0&&n!=null&&m(t,[`instances[]`,`task_type`],n)}else if(i===`EMBED_CONTENT`){let n=h(e,[`taskType`]);t!==void 0&&n!=null&&m(t,[`taskType`],n)}let a=h(n,[`embeddingApiType`]);if(a===void 0&&(a=`PREDICT`),a===`PREDICT`){let n=h(e,[`title`]);t!==void 0&&n!=null&&m(t,[`instances[]`,`title`],n)}else if(a===`EMBED_CONTENT`){let n=h(e,[`title`]);t!==void 0&&n!=null&&m(t,[`title`],n)}let o=h(n,[`embeddingApiType`]);if(o===void 0&&(o=`PREDICT`),o===`PREDICT`){let n=h(e,[`outputDimensionality`]);t!==void 0&&n!=null&&m(t,[`parameters`,`outputDimensionality`],n)}else if(o===`EMBED_CONTENT`){let n=h(e,[`outputDimensionality`]);t!==void 0&&n!=null&&m(t,[`outputDimensionality`],n)}let s=h(n,[`embeddingApiType`]);if(s===void 0&&(s=`PREDICT`),s===`PREDICT`){let n=h(e,[`mimeType`]);t!==void 0&&n!=null&&m(t,[`instances[]`,`mimeType`],n)}let c=h(n,[`embeddingApiType`]);if(c===void 0&&(c=`PREDICT`),c===`PREDICT`){let n=h(e,[`autoTruncate`]);t!==void 0&&n!=null&&m(t,[`parameters`,`autoTruncate`],n)}else if(c===`EMBED_CONTENT`){let n=h(e,[`autoTruncate`]);t!==void 0&&n!=null&&m(t,[`autoTruncate`],n)}return r}function na(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let t=Gt(e,a);Array.isArray(t)&&(t=t.map(e=>e)),m(r,[`requests[]`,`content`],t)}let o=h(t,[`content`]);o!=null&&zi(P(o));let s=h(t,[`config`]);s!=null&&ea(s,r);let c=h(t,[`model`]);return c!==void 0&&m(r,[`requests[]`,`model`],N(e,c)),r}function ra(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(n,[`embeddingApiType`]);if(a===void 0&&(a=`PREDICT`),a===`PREDICT`){let n=h(t,[`contents`]);if(n!=null){let t=Gt(e,n);Array.isArray(t)&&(t=t.map(e=>e)),m(r,[`instances[]`,`content`],t)}}let o=h(n,[`embeddingApiType`]);if(o===void 0&&(o=`PREDICT`),o===`EMBED_CONTENT`){let e=h(t,[`content`]);e!=null&&m(r,[`content`],P(e))}let s=h(t,[`config`]);return s!=null&&ta(s,r,n),r}function ia(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`embeddings`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`embeddings`],e)}let a=h(e,[`metadata`]);return a!=null&&m(n,[`metadata`],a),n}function aa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions[]`,`embeddings`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Li(e))),m(n,[`embeddings`],e)}let a=h(e,[`metadata`]);if(a!=null&&m(n,[`metadata`],a),t&&h(t,[`embeddingApiType`])===`EMBED_CONTENT`){let t=h(e,[`embedding`]),r=h(e,[`usageMetadata`]),i=h(e,[`truncated`]);if(t){let e={};r&&r.promptTokenCount&&(e.tokenCount=r.promptTokenCount),i&&(e.truncated=i),t.statistics=e,m(n,[`embeddings`],[t])}}return n}function oa(e,t){let n={},r=h(e,[`endpoint`]);r!=null&&m(n,[`name`],r);let i=h(e,[`deployedModelId`]);return i!=null&&m(n,[`deployedModelId`],i),n}function sa(e,t){let n={};if(h(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=h(e,[`fileUri`]);r!=null&&m(n,[`fileUri`],r);let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function ca(e,t){let n={},r=h(e,[`id`]);r!=null&&m(n,[`id`],r);let i=h(e,[`args`]);i!=null&&m(n,[`args`],i);let a=h(e,[`name`]);if(a!=null&&m(n,[`name`],a),h(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(h(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return n}function la(e,t){let n={},r=h(e,[`allowedFunctionNames`]);r!=null&&m(n,[`allowedFunctionNames`],r);let i=h(e,[`mode`]);if(i!=null&&m(n,[`mode`],i),h(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return n}function ua(e,t){let n={},r=h(e,[`description`]);r!=null&&m(n,[`description`],r);let i=h(e,[`name`]);i!=null&&m(n,[`name`],i);let a=h(e,[`parameters`]);a!=null&&m(n,[`parameters`],a);let o=h(e,[`parametersJsonSchema`]);o!=null&&m(n,[`parametersJsonSchema`],o);let s=h(e,[`response`]);s!=null&&m(n,[`response`],s);let c=h(e,[`responseJsonSchema`]);if(c!=null&&m(n,[`responseJsonSchema`],c),h(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return n}function da(e,t,n,r){let i={},a=h(t,[`systemInstruction`]);n!==void 0&&a!=null&&m(n,[`systemInstruction`],zi(P(a)));let o=h(t,[`temperature`]);o!=null&&m(i,[`temperature`],o);let s=h(t,[`topP`]);s!=null&&m(i,[`topP`],s);let c=h(t,[`topK`]);c!=null&&m(i,[`topK`],c);let l=h(t,[`candidateCount`]);l!=null&&m(i,[`candidateCount`],l);let u=h(t,[`maxOutputTokens`]);u!=null&&m(i,[`maxOutputTokens`],u);let d=h(t,[`stopSequences`]);d!=null&&m(i,[`stopSequences`],d);let f=h(t,[`responseLogprobs`]);f!=null&&m(i,[`responseLogprobs`],f);let p=h(t,[`logprobs`]);p!=null&&m(i,[`logprobs`],p);let g=h(t,[`presencePenalty`]);g!=null&&m(i,[`presencePenalty`],g);let _=h(t,[`frequencyPenalty`]);_!=null&&m(i,[`frequencyPenalty`],_);let v=h(t,[`seed`]);v!=null&&m(i,[`seed`],v);let y=h(t,[`responseMimeType`]);y!=null&&m(i,[`responseMimeType`],y);let b=h(t,[`responseSchema`]);b!=null&&m(i,[`responseSchema`],Jt(b));let x=h(t,[`responseJsonSchema`]);if(x!=null&&m(i,[`responseJsonSchema`],x),h(t,[`routingConfig`])!==void 0)throw Error(`routingConfig parameter is not supported in Gemini API.`);if(h(t,[`modelSelectionConfig`])!==void 0)throw Error(`modelSelectionConfig parameter is not supported in Gemini API.`);let S=h(t,[`safetySettings`]);if(n!==void 0&&S!=null){let e=S;Array.isArray(e)&&(e=e.map(e=>po(e))),m(n,[`safetySettings`],e)}let C=h(t,[`tools`]);if(n!==void 0&&C!=null){let e=L(C);Array.isArray(e)&&(e=e.map(e=>bo(I(e)))),m(n,[`tools`],e)}let w=h(t,[`toolConfig`]);if(n!==void 0&&w!=null&&m(n,[`toolConfig`],yo(w)),h(t,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let T=h(t,[`cachedContent`]);n!==void 0&&T!=null&&m(n,[`cachedContent`],R(e,T));let E=h(t,[`responseModalities`]);E!=null&&m(i,[`responseModalities`],E);let D=h(t,[`mediaResolution`]);D!=null&&m(i,[`mediaResolution`],D);let O=h(t,[`speechConfig`]);if(O!=null&&m(i,[`speechConfig`],Yt(O)),h(t,[`audioTimestamp`])!==void 0)throw Error(`audioTimestamp parameter is not supported in Gemini API.`);let k=h(t,[`thinkingConfig`]);k!=null&&m(i,[`thinkingConfig`],k);let A=h(t,[`imageConfig`]);A!=null&&m(i,[`imageConfig`],Ua(A));let ee=h(t,[`enableEnhancedCivicAnswers`]);if(ee!=null&&m(i,[`enableEnhancedCivicAnswers`],ee),h(t,[`modelArmorConfig`])!==void 0)throw Error(`modelArmorConfig parameter is not supported in Gemini API.`);return i}function fa(e,t,n,r){let i={},a=h(t,[`systemInstruction`]);n!==void 0&&a!=null&&m(n,[`systemInstruction`],P(a));let o=h(t,[`temperature`]);o!=null&&m(i,[`temperature`],o);let s=h(t,[`topP`]);s!=null&&m(i,[`topP`],s);let c=h(t,[`topK`]);c!=null&&m(i,[`topK`],c);let l=h(t,[`candidateCount`]);l!=null&&m(i,[`candidateCount`],l);let u=h(t,[`maxOutputTokens`]);u!=null&&m(i,[`maxOutputTokens`],u);let d=h(t,[`stopSequences`]);d!=null&&m(i,[`stopSequences`],d);let f=h(t,[`responseLogprobs`]);f!=null&&m(i,[`responseLogprobs`],f);let p=h(t,[`logprobs`]);p!=null&&m(i,[`logprobs`],p);let g=h(t,[`presencePenalty`]);g!=null&&m(i,[`presencePenalty`],g);let _=h(t,[`frequencyPenalty`]);_!=null&&m(i,[`frequencyPenalty`],_);let v=h(t,[`seed`]);v!=null&&m(i,[`seed`],v);let y=h(t,[`responseMimeType`]);y!=null&&m(i,[`responseMimeType`],y);let b=h(t,[`responseSchema`]);b!=null&&m(i,[`responseSchema`],Jt(b));let x=h(t,[`responseJsonSchema`]);x!=null&&m(i,[`responseJsonSchema`],x);let S=h(t,[`routingConfig`]);S!=null&&m(i,[`routingConfig`],S);let C=h(t,[`modelSelectionConfig`]);C!=null&&m(i,[`modelConfig`],C);let w=h(t,[`safetySettings`]);if(n!==void 0&&w!=null){let e=w;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`safetySettings`],e)}let T=h(t,[`tools`]);if(n!==void 0&&T!=null){let e=L(T);Array.isArray(e)&&(e=e.map(e=>xo(I(e)))),m(n,[`tools`],e)}let E=h(t,[`toolConfig`]);n!==void 0&&E!=null&&m(n,[`toolConfig`],E);let D=h(t,[`labels`]);n!==void 0&&D!=null&&m(n,[`labels`],D);let O=h(t,[`cachedContent`]);n!==void 0&&O!=null&&m(n,[`cachedContent`],R(e,O));let k=h(t,[`responseModalities`]);k!=null&&m(i,[`responseModalities`],k);let A=h(t,[`mediaResolution`]);A!=null&&m(i,[`mediaResolution`],A);let ee=h(t,[`speechConfig`]);ee!=null&&m(i,[`speechConfig`],Yt(ee));let te=h(t,[`audioTimestamp`]);te!=null&&m(i,[`audioTimestamp`],te);let ne=h(t,[`thinkingConfig`]);ne!=null&&m(i,[`thinkingConfig`],ne);let re=h(t,[`imageConfig`]);if(re!=null&&m(i,[`imageConfig`],Wa(re)),h(t,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);let ie=h(t,[`modelArmorConfig`]);return n!==void 0&&ie!=null&&m(n,[`modelArmorConfig`],ie),i}function pa(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>zi(e))),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&m(r,[`generationConfig`],da(e,o,r)),r}function ma(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>e)),m(r,[`contents`],e)}let o=h(t,[`config`]);return o!=null&&m(r,[`generationConfig`],fa(e,o,r)),r}function ha(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`candidates`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ni(e))),m(n,[`candidates`],e)}let a=h(e,[`modelVersion`]);a!=null&&m(n,[`modelVersion`],a);let o=h(e,[`promptFeedback`]);o!=null&&m(n,[`promptFeedback`],o);let s=h(e,[`responseId`]);s!=null&&m(n,[`responseId`],s);let c=h(e,[`usageMetadata`]);return c!=null&&m(n,[`usageMetadata`],c),n}function ga(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`candidates`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`candidates`],e)}let a=h(e,[`createTime`]);a!=null&&m(n,[`createTime`],a);let o=h(e,[`modelVersion`]);o!=null&&m(n,[`modelVersion`],o);let s=h(e,[`promptFeedback`]);s!=null&&m(n,[`promptFeedback`],s);let c=h(e,[`responseId`]);c!=null&&m(n,[`responseId`],c);let l=h(e,[`usageMetadata`]);return l!=null&&m(n,[`usageMetadata`],l),n}function _a(e,t,n){let r={};if(h(e,[`outputGcsUri`])!==void 0)throw Error(`outputGcsUri parameter is not supported in Gemini API.`);if(h(e,[`negativePrompt`])!==void 0)throw Error(`negativePrompt parameter is not supported in Gemini API.`);let i=h(e,[`numberOfImages`]);t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i);let a=h(e,[`aspectRatio`]);t!==void 0&&a!=null&&m(t,[`parameters`,`aspectRatio`],a);let o=h(e,[`guidanceScale`]);if(t!==void 0&&o!=null&&m(t,[`parameters`,`guidanceScale`],o),h(e,[`seed`])!==void 0)throw Error(`seed parameter is not supported in Gemini API.`);let s=h(e,[`safetyFilterLevel`]);t!==void 0&&s!=null&&m(t,[`parameters`,`safetySetting`],s);let c=h(e,[`personGeneration`]);t!==void 0&&c!=null&&m(t,[`parameters`,`personGeneration`],c);let l=h(e,[`includeSafetyAttributes`]);t!==void 0&&l!=null&&m(t,[`parameters`,`includeSafetyAttributes`],l);let u=h(e,[`includeRaiReason`]);t!==void 0&&u!=null&&m(t,[`parameters`,`includeRaiReason`],u);let d=h(e,[`language`]);t!==void 0&&d!=null&&m(t,[`parameters`,`language`],d);let f=h(e,[`outputMimeType`]);t!==void 0&&f!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],f);let p=h(e,[`outputCompressionQuality`]);if(t!==void 0&&p!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],p),h(e,[`addWatermark`])!==void 0)throw Error(`addWatermark parameter is not supported in Gemini API.`);if(h(e,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let g=h(e,[`imageSize`]);if(t!==void 0&&g!=null&&m(t,[`parameters`,`sampleImageSize`],g),h(e,[`enhancePrompt`])!==void 0)throw Error(`enhancePrompt parameter is not supported in Gemini API.`);return r}function va(e,t,n){let r={},i=h(e,[`outputGcsUri`]);t!==void 0&&i!=null&&m(t,[`parameters`,`storageUri`],i);let a=h(e,[`negativePrompt`]);t!==void 0&&a!=null&&m(t,[`parameters`,`negativePrompt`],a);let o=h(e,[`numberOfImages`]);t!==void 0&&o!=null&&m(t,[`parameters`,`sampleCount`],o);let s=h(e,[`aspectRatio`]);t!==void 0&&s!=null&&m(t,[`parameters`,`aspectRatio`],s);let c=h(e,[`guidanceScale`]);t!==void 0&&c!=null&&m(t,[`parameters`,`guidanceScale`],c);let l=h(e,[`seed`]);t!==void 0&&l!=null&&m(t,[`parameters`,`seed`],l);let u=h(e,[`safetyFilterLevel`]);t!==void 0&&u!=null&&m(t,[`parameters`,`safetySetting`],u);let d=h(e,[`personGeneration`]);t!==void 0&&d!=null&&m(t,[`parameters`,`personGeneration`],d);let f=h(e,[`includeSafetyAttributes`]);t!==void 0&&f!=null&&m(t,[`parameters`,`includeSafetyAttributes`],f);let p=h(e,[`includeRaiReason`]);t!==void 0&&p!=null&&m(t,[`parameters`,`includeRaiReason`],p);let g=h(e,[`language`]);t!==void 0&&g!=null&&m(t,[`parameters`,`language`],g);let _=h(e,[`outputMimeType`]);t!==void 0&&_!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],_);let v=h(e,[`outputCompressionQuality`]);t!==void 0&&v!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],v);let y=h(e,[`addWatermark`]);t!==void 0&&y!=null&&m(t,[`parameters`,`addWatermark`],y);let b=h(e,[`labels`]);t!==void 0&&b!=null&&m(t,[`labels`],b);let x=h(e,[`imageSize`]);t!==void 0&&x!=null&&m(t,[`parameters`,`sampleImageSize`],x);let S=h(e,[`enhancePrompt`]);return t!==void 0&&S!=null&&m(t,[`parameters`,`enhancePrompt`],S),r}function ya(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`config`]);return o!=null&&_a(o,r),r}function ba(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`config`]);return o!=null&&va(o,r),r}function xa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Na(e))),m(n,[`generatedImages`],e)}let a=h(e,[`positivePromptSafetyAttributes`]);return a!=null&&m(n,[`positivePromptSafetyAttributes`],uo(a)),n}function Sa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}let a=h(e,[`positivePromptSafetyAttributes`]);return a!=null&&m(n,[`positivePromptSafetyAttributes`],fo(a)),n}function Ca(e,t,n){let r={},i=h(e,[`numberOfVideos`]);if(t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i),h(e,[`outputGcsUri`])!==void 0)throw Error(`outputGcsUri parameter is not supported in Gemini API.`);if(h(e,[`fps`])!==void 0)throw Error(`fps parameter is not supported in Gemini API.`);let a=h(e,[`durationSeconds`]);if(t!==void 0&&a!=null&&m(t,[`parameters`,`durationSeconds`],a),h(e,[`seed`])!==void 0)throw Error(`seed parameter is not supported in Gemini API.`);let o=h(e,[`aspectRatio`]);t!==void 0&&o!=null&&m(t,[`parameters`,`aspectRatio`],o);let s=h(e,[`resolution`]);t!==void 0&&s!=null&&m(t,[`parameters`,`resolution`],s);let c=h(e,[`personGeneration`]);if(t!==void 0&&c!=null&&m(t,[`parameters`,`personGeneration`],c),h(e,[`pubsubTopic`])!==void 0)throw Error(`pubsubTopic parameter is not supported in Gemini API.`);let l=h(e,[`negativePrompt`]);t!==void 0&&l!=null&&m(t,[`parameters`,`negativePrompt`],l);let u=h(e,[`enhancePrompt`]);if(t!==void 0&&u!=null&&m(t,[`parameters`,`enhancePrompt`],u),h(e,[`generateAudio`])!==void 0)throw Error(`generateAudio parameter is not supported in Gemini API.`);let d=h(e,[`lastFrame`]);t!==void 0&&d!=null&&m(t,[`instances[0]`,`lastFrame`],qa(d));let f=h(e,[`referenceImages`]);if(t!==void 0&&f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>Po(e))),m(t,[`instances[0]`,`referenceImages`],e)}if(h(e,[`mask`])!==void 0)throw Error(`mask parameter is not supported in Gemini API.`);if(h(e,[`compressionQuality`])!==void 0)throw Error(`compressionQuality parameter is not supported in Gemini API.`);return r}function wa(e,t,n){let r={},i=h(e,[`numberOfVideos`]);t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i);let a=h(e,[`outputGcsUri`]);t!==void 0&&a!=null&&m(t,[`parameters`,`storageUri`],a);let o=h(e,[`fps`]);t!==void 0&&o!=null&&m(t,[`parameters`,`fps`],o);let s=h(e,[`durationSeconds`]);t!==void 0&&s!=null&&m(t,[`parameters`,`durationSeconds`],s);let c=h(e,[`seed`]);t!==void 0&&c!=null&&m(t,[`parameters`,`seed`],c);let l=h(e,[`aspectRatio`]);t!==void 0&&l!=null&&m(t,[`parameters`,`aspectRatio`],l);let u=h(e,[`resolution`]);t!==void 0&&u!=null&&m(t,[`parameters`,`resolution`],u);let d=h(e,[`personGeneration`]);t!==void 0&&d!=null&&m(t,[`parameters`,`personGeneration`],d);let f=h(e,[`pubsubTopic`]);t!==void 0&&f!=null&&m(t,[`parameters`,`pubsubTopic`],f);let p=h(e,[`negativePrompt`]);t!==void 0&&p!=null&&m(t,[`parameters`,`negativePrompt`],p);let g=h(e,[`enhancePrompt`]);t!==void 0&&g!=null&&m(t,[`parameters`,`enhancePrompt`],g);let _=h(e,[`generateAudio`]);t!==void 0&&_!=null&&m(t,[`parameters`,`generateAudio`],_);let v=h(e,[`lastFrame`]);t!==void 0&&v!=null&&m(t,[`instances[0]`,`lastFrame`],K(v));let y=h(e,[`referenceImages`]);if(t!==void 0&&y!=null){let e=y;Array.isArray(e)&&(e=e.map(e=>Fo(e))),m(t,[`instances[0]`,`referenceImages`],e)}let b=h(e,[`mask`]);t!==void 0&&b!=null&&m(t,[`instances[0]`,`mask`],No(b));let x=h(e,[`compressionQuality`]);return t!==void 0&&x!=null&&m(t,[`parameters`,`compressionQuality`],x),r}function Ta(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`metadata`]);i!=null&&m(n,[`metadata`],i);let a=h(e,[`done`]);a!=null&&m(n,[`done`],a);let o=h(e,[`error`]);o!=null&&m(n,[`error`],o);let s=h(e,[`response`,`generateVideoResponse`]);return s!=null&&m(n,[`response`],ka(s)),n}function Ea(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`metadata`]);i!=null&&m(n,[`metadata`],i);let a=h(e,[`done`]);a!=null&&m(n,[`done`],a);let o=h(e,[`error`]);o!=null&&m(n,[`error`],o);let s=h(e,[`response`]);return s!=null&&m(n,[`response`],Aa(s)),n}function Da(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`image`]);o!=null&&m(r,[`instances[0]`,`image`],qa(o));let s=h(t,[`video`]);s!=null&&m(r,[`instances[0]`,`video`],Io(s));let c=h(t,[`source`]);c!=null&&ja(c,r);let l=h(t,[`config`]);return l!=null&&Ca(l,r),r}function Oa(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`prompt`]);a!=null&&m(r,[`instances[0]`,`prompt`],a);let o=h(t,[`image`]);o!=null&&m(r,[`instances[0]`,`image`],K(o));let s=h(t,[`video`]);s!=null&&m(r,[`instances[0]`,`video`],Lo(s));let c=h(t,[`source`]);c!=null&&Ma(c,r);let l=h(t,[`config`]);return l!=null&&wa(l,r),r}function ka(e,t){let n={},r=h(e,[`generatedSamples`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Ia(e))),m(n,[`generatedVideos`],e)}let i=h(e,[`raiMediaFilteredCount`]);i!=null&&m(n,[`raiMediaFilteredCount`],i);let a=h(e,[`raiMediaFilteredReasons`]);return a!=null&&m(n,[`raiMediaFilteredReasons`],a),n}function Aa(e,t){let n={},r=h(e,[`videos`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>La(e))),m(n,[`generatedVideos`],e)}let i=h(e,[`raiMediaFilteredCount`]);i!=null&&m(n,[`raiMediaFilteredCount`],i);let a=h(e,[`raiMediaFilteredReasons`]);return a!=null&&m(n,[`raiMediaFilteredReasons`],a),n}function ja(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`image`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`image`],qa(a));let o=h(e,[`video`]);return t!==void 0&&o!=null&&m(t,[`instances[0]`,`video`],Io(o)),r}function Ma(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`image`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`image`],K(a));let o=h(e,[`video`]);return t!==void 0&&o!=null&&m(t,[`instances[0]`,`video`],Lo(o)),r}function Na(e,t){let n={},r=h(e,[`_self`]);r!=null&&m(n,[`image`],Ga(r));let i=h(e,[`raiFilteredReason`]);i!=null&&m(n,[`raiFilteredReason`],i);let a=h(e,[`_self`]);return a!=null&&m(n,[`safetyAttributes`],uo(a)),n}function Pa(e,t){let n={},r=h(e,[`_self`]);r!=null&&m(n,[`image`],Ka(r));let i=h(e,[`raiFilteredReason`]);i!=null&&m(n,[`raiFilteredReason`],i);let a=h(e,[`_self`]);a!=null&&m(n,[`safetyAttributes`],fo(a));let o=h(e,[`prompt`]);return o!=null&&m(n,[`enhancedPrompt`],o),n}function Fa(e,t){let n={},r=h(e,[`_self`]);r!=null&&m(n,[`mask`],Ka(r));let i=h(e,[`labels`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`labels`],e)}return n}function Ia(e,t){let n={},r=h(e,[`video`]);return r!=null&&m(n,[`video`],jo(r)),n}function La(e,t){let n={},r=h(e,[`_self`]);return r!=null&&m(n,[`video`],Mo(r)),n}function Ra(e,t){let n={},r=h(e,[`modelSelectionConfig`]);r!=null&&m(n,[`modelConfig`],r);let i=h(e,[`responseJsonSchema`]);i!=null&&m(n,[`responseJsonSchema`],i);let a=h(e,[`audioTimestamp`]);a!=null&&m(n,[`audioTimestamp`],a);let o=h(e,[`candidateCount`]);o!=null&&m(n,[`candidateCount`],o);let s=h(e,[`enableAffectiveDialog`]);s!=null&&m(n,[`enableAffectiveDialog`],s);let c=h(e,[`frequencyPenalty`]);c!=null&&m(n,[`frequencyPenalty`],c);let l=h(e,[`logprobs`]);l!=null&&m(n,[`logprobs`],l);let u=h(e,[`maxOutputTokens`]);u!=null&&m(n,[`maxOutputTokens`],u);let d=h(e,[`mediaResolution`]);d!=null&&m(n,[`mediaResolution`],d);let f=h(e,[`presencePenalty`]);f!=null&&m(n,[`presencePenalty`],f);let p=h(e,[`responseLogprobs`]);p!=null&&m(n,[`responseLogprobs`],p);let g=h(e,[`responseMimeType`]);g!=null&&m(n,[`responseMimeType`],g);let _=h(e,[`responseModalities`]);_!=null&&m(n,[`responseModalities`],_);let v=h(e,[`responseSchema`]);v!=null&&m(n,[`responseSchema`],v);let y=h(e,[`routingConfig`]);y!=null&&m(n,[`routingConfig`],y);let b=h(e,[`seed`]);b!=null&&m(n,[`seed`],b);let x=h(e,[`speechConfig`]);x!=null&&m(n,[`speechConfig`],x);let S=h(e,[`stopSequences`]);S!=null&&m(n,[`stopSequences`],S);let C=h(e,[`temperature`]);C!=null&&m(n,[`temperature`],C);let w=h(e,[`thinkingConfig`]);w!=null&&m(n,[`thinkingConfig`],w);let T=h(e,[`topK`]);T!=null&&m(n,[`topK`],T);let E=h(e,[`topP`]);if(E!=null&&m(n,[`topP`],E),h(e,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);return n}function za(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Ba(e,t,n){let r={},i=h(t,[`model`]);return i!=null&&m(r,[`_url`,`name`],N(e,i)),r}function Va(e,t){let n={};if(h(e,[`authConfig`])!==void 0)throw Error(`authConfig parameter is not supported in Gemini API.`);let r=h(e,[`enableWidget`]);return r!=null&&m(n,[`enableWidget`],r),n}function Ha(e,t){let n={},r=h(e,[`searchTypes`]);if(r!=null&&m(n,[`searchTypes`],r),h(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);if(h(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);let i=h(e,[`timeRangeFilter`]);return i!=null&&m(n,[`timeRangeFilter`],i),n}function Ua(e,t){let n={},r=h(e,[`aspectRatio`]);r!=null&&m(n,[`aspectRatio`],r);let i=h(e,[`imageSize`]);if(i!=null&&m(n,[`imageSize`],i),h(e,[`personGeneration`])!==void 0)throw Error(`personGeneration parameter is not supported in Gemini API.`);if(h(e,[`prominentPeople`])!==void 0)throw Error(`prominentPeople parameter is not supported in Gemini API.`);if(h(e,[`outputMimeType`])!==void 0)throw Error(`outputMimeType parameter is not supported in Gemini API.`);if(h(e,[`outputCompressionQuality`])!==void 0)throw Error(`outputCompressionQuality parameter is not supported in Gemini API.`);return n}function Wa(e,t){let n={},r=h(e,[`aspectRatio`]);r!=null&&m(n,[`aspectRatio`],r);let i=h(e,[`imageSize`]);i!=null&&m(n,[`imageSize`],i);let a=h(e,[`personGeneration`]);a!=null&&m(n,[`personGeneration`],a);let o=h(e,[`prominentPeople`]);o!=null&&m(n,[`prominentPeople`],o);let s=h(e,[`outputMimeType`]);s!=null&&m(n,[`imageOutputOptions`,`mimeType`],s);let c=h(e,[`outputCompressionQuality`]);return c!=null&&m(n,[`imageOutputOptions`,`compressionQuality`],c),n}function Ga(e,t){let n={},r=h(e,[`bytesBase64Encoded`]);r!=null&&m(n,[`imageBytes`],z(r));let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function Ka(e,t){let n={},r=h(e,[`gcsUri`]);r!=null&&m(n,[`gcsUri`],r);let i=h(e,[`bytesBase64Encoded`]);i!=null&&m(n,[`imageBytes`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function qa(e,t){let n={};if(h(e,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);let r=h(e,[`imageBytes`]);r!=null&&m(n,[`bytesBase64Encoded`],z(r));let i=h(e,[`mimeType`]);return i!=null&&m(n,[`mimeType`],i),n}function K(e,t){let n={},r=h(e,[`gcsUri`]);r!=null&&m(n,[`gcsUri`],r);let i=h(e,[`imageBytes`]);i!=null&&m(n,[`bytesBase64Encoded`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function Ja(e,t,n,r){let i={},a=h(t,[`pageSize`]);n!==void 0&&a!=null&&m(n,[`_query`,`pageSize`],a);let o=h(t,[`pageToken`]);n!==void 0&&o!=null&&m(n,[`_query`,`pageToken`],o);let s=h(t,[`filter`]);n!==void 0&&s!=null&&m(n,[`_query`,`filter`],s);let c=h(t,[`queryBase`]);return n!==void 0&&c!=null&&m(n,[`_url`,`models_url`],rn(e,c)),i}function Ya(e,t,n,r){let i={},a=h(t,[`pageSize`]);n!==void 0&&a!=null&&m(n,[`_query`,`pageSize`],a);let o=h(t,[`pageToken`]);n!==void 0&&o!=null&&m(n,[`_query`,`pageToken`],o);let s=h(t,[`filter`]);n!==void 0&&s!=null&&m(n,[`_query`,`filter`],s);let c=h(t,[`queryBase`]);return n!==void 0&&c!=null&&m(n,[`_url`,`models_url`],rn(e,c)),i}function Xa(e,t,n){let r={},i=h(t,[`config`]);return i!=null&&Ja(e,i,r),r}function Za(e,t,n){let r={},i=h(t,[`config`]);return i!=null&&Ya(e,i,r),r}function Qa(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`nextPageToken`]);i!=null&&m(n,[`nextPageToken`],i);let a=h(e,[`_self`]);if(a!=null){let e=an(a);Array.isArray(e)&&(e=e.map(e=>to(e))),m(n,[`models`],e)}return n}function $a(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`nextPageToken`]);i!=null&&m(n,[`nextPageToken`],i);let a=h(e,[`_self`]);if(a!=null){let e=an(a);Array.isArray(e)&&(e=e.map(e=>no(e))),m(n,[`models`],e)}return n}function eo(e,t){let n={},r=h(e,[`maskMode`]);r!=null&&m(n,[`maskMode`],r);let i=h(e,[`segmentationClasses`]);i!=null&&m(n,[`maskClasses`],i);let a=h(e,[`maskDilation`]);return a!=null&&m(n,[`dilation`],a),n}function to(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`displayName`]);i!=null&&m(n,[`displayName`],i);let a=h(e,[`description`]);a!=null&&m(n,[`description`],a);let o=h(e,[`version`]);o!=null&&m(n,[`version`],o);let s=h(e,[`_self`]);s!=null&&m(n,[`tunedModelInfo`],So(s));let c=h(e,[`inputTokenLimit`]);c!=null&&m(n,[`inputTokenLimit`],c);let l=h(e,[`outputTokenLimit`]);l!=null&&m(n,[`outputTokenLimit`],l);let u=h(e,[`supportedGenerationMethods`]);u!=null&&m(n,[`supportedActions`],u);let d=h(e,[`temperature`]);d!=null&&m(n,[`temperature`],d);let f=h(e,[`maxTemperature`]);f!=null&&m(n,[`maxTemperature`],f);let p=h(e,[`topP`]);p!=null&&m(n,[`topP`],p);let g=h(e,[`topK`]);g!=null&&m(n,[`topK`],g);let _=h(e,[`thinking`]);return _!=null&&m(n,[`thinking`],_),n}function no(e,t){let n={},r=h(e,[`name`]);r!=null&&m(n,[`name`],r);let i=h(e,[`displayName`]);i!=null&&m(n,[`displayName`],i);let a=h(e,[`description`]);a!=null&&m(n,[`description`],a);let o=h(e,[`versionId`]);o!=null&&m(n,[`version`],o);let s=h(e,[`deployedModels`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>oa(e))),m(n,[`endpoints`],e)}let c=h(e,[`labels`]);c!=null&&m(n,[`labels`],c);let l=h(e,[`_self`]);l!=null&&m(n,[`tunedModelInfo`],Co(l));let u=h(e,[`defaultCheckpointId`]);u!=null&&m(n,[`defaultCheckpointId`],u);let d=h(e,[`checkpoints`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`checkpoints`],e)}return n}function ro(e,t){let n={},r=h(e,[`mediaResolution`]);r!=null&&m(n,[`mediaResolution`],r);let i=h(e,[`codeExecutionResult`]);i!=null&&m(n,[`codeExecutionResult`],i);let a=h(e,[`executableCode`]);a!=null&&m(n,[`executableCode`],a);let o=h(e,[`fileData`]);o!=null&&m(n,[`fileData`],sa(o));let s=h(e,[`functionCall`]);s!=null&&m(n,[`functionCall`],ca(s));let c=h(e,[`functionResponse`]);c!=null&&m(n,[`functionResponse`],c);let l=h(e,[`inlineData`]);l!=null&&m(n,[`inlineData`],Mi(l));let u=h(e,[`text`]);u!=null&&m(n,[`text`],u);let d=h(e,[`thought`]);d!=null&&m(n,[`thought`],d);let f=h(e,[`thoughtSignature`]);f!=null&&m(n,[`thoughtSignature`],f);let p=h(e,[`videoMetadata`]);return p!=null&&m(n,[`videoMetadata`],p),n}function io(e,t){let n={},r=h(e,[`productImage`]);return r!=null&&m(n,[`image`],K(r)),n}function ao(e,t,n){let r={},i=h(e,[`numberOfImages`]);t!==void 0&&i!=null&&m(t,[`parameters`,`sampleCount`],i);let a=h(e,[`baseSteps`]);t!==void 0&&a!=null&&m(t,[`parameters`,`baseSteps`],a);let o=h(e,[`outputGcsUri`]);t!==void 0&&o!=null&&m(t,[`parameters`,`storageUri`],o);let s=h(e,[`seed`]);t!==void 0&&s!=null&&m(t,[`parameters`,`seed`],s);let c=h(e,[`safetyFilterLevel`]);t!==void 0&&c!=null&&m(t,[`parameters`,`safetySetting`],c);let l=h(e,[`personGeneration`]);t!==void 0&&l!=null&&m(t,[`parameters`,`personGeneration`],l);let u=h(e,[`addWatermark`]);t!==void 0&&u!=null&&m(t,[`parameters`,`addWatermark`],u);let d=h(e,[`outputMimeType`]);t!==void 0&&d!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],d);let f=h(e,[`outputCompressionQuality`]);t!==void 0&&f!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],f);let p=h(e,[`enhancePrompt`]);t!==void 0&&p!=null&&m(t,[`parameters`,`enhancePrompt`],p);let g=h(e,[`labels`]);return t!==void 0&&g!=null&&m(t,[`labels`],g),r}function oo(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`source`]);a!=null&&co(a,r);let o=h(t,[`config`]);return o!=null&&ao(o,r),r}function so(e,t){let n={},r=h(e,[`predictions`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}return n}function co(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`personImage`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`personImage`,`image`],K(a));let o=h(e,[`productImages`]);if(t!==void 0&&o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>io(e))),m(t,[`instances[0]`,`productImages`],e)}return r}function lo(e,t){let n={},r=h(e,[`referenceImage`]);r!=null&&m(n,[`referenceImage`],K(r));let i=h(e,[`referenceId`]);i!=null&&m(n,[`referenceId`],i);let a=h(e,[`referenceType`]);a!=null&&m(n,[`referenceType`],a);let o=h(e,[`maskImageConfig`]);o!=null&&m(n,[`maskImageConfig`],eo(o));let s=h(e,[`controlImageConfig`]);s!=null&&m(n,[`controlImageConfig`],Bi(s));let c=h(e,[`styleImageConfig`]);c!=null&&m(n,[`styleImageConfig`],c);let l=h(e,[`subjectImageConfig`]);return l!=null&&m(n,[`subjectImageConfig`],l),n}function uo(e,t){let n={},r=h(e,[`safetyAttributes`,`categories`]);r!=null&&m(n,[`categories`],r);let i=h(e,[`safetyAttributes`,`scores`]);i!=null&&m(n,[`scores`],i);let a=h(e,[`contentType`]);return a!=null&&m(n,[`contentType`],a),n}function fo(e,t){let n={},r=h(e,[`safetyAttributes`,`categories`]);r!=null&&m(n,[`categories`],r);let i=h(e,[`safetyAttributes`,`scores`]);i!=null&&m(n,[`scores`],i);let a=h(e,[`contentType`]);return a!=null&&m(n,[`contentType`],a),n}function po(e,t){let n={},r=h(e,[`category`]);if(r!=null&&m(n,[`category`],r),h(e,[`method`])!==void 0)throw Error(`method parameter is not supported in Gemini API.`);let i=h(e,[`threshold`]);return i!=null&&m(n,[`threshold`],i),n}function mo(e,t){let n={},r=h(e,[`image`]);return r!=null&&m(n,[`image`],K(r)),n}function ho(e,t,n){let r={},i=h(e,[`mode`]);t!==void 0&&i!=null&&m(t,[`parameters`,`mode`],i);let a=h(e,[`maxPredictions`]);t!==void 0&&a!=null&&m(t,[`parameters`,`maxPredictions`],a);let o=h(e,[`confidenceThreshold`]);t!==void 0&&o!=null&&m(t,[`parameters`,`confidenceThreshold`],o);let s=h(e,[`maskDilation`]);t!==void 0&&s!=null&&m(t,[`parameters`,`maskDilation`],s);let c=h(e,[`binaryColorThreshold`]);t!==void 0&&c!=null&&m(t,[`parameters`,`binaryColorThreshold`],c);let l=h(e,[`labels`]);return t!==void 0&&l!=null&&m(t,[`labels`],l),r}function go(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`source`]);a!=null&&vo(a,r);let o=h(t,[`config`]);return o!=null&&ho(o,r),r}function _o(e,t){let n={},r=h(e,[`predictions`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Fa(e))),m(n,[`generatedMasks`],e)}return n}function vo(e,t,n){let r={},i=h(e,[`prompt`]);t!==void 0&&i!=null&&m(t,[`instances[0]`,`prompt`],i);let a=h(e,[`image`]);t!==void 0&&a!=null&&m(t,[`instances[0]`,`image`],K(a));let o=h(e,[`scribbleImage`]);return t!==void 0&&o!=null&&m(t,[`instances[0]`,`scribble`],mo(o)),r}function yo(e,t){let n={},r=h(e,[`retrievalConfig`]);r!=null&&m(n,[`retrievalConfig`],r);let i=h(e,[`functionCallingConfig`]);return i!=null&&m(n,[`functionCallingConfig`],la(i)),n}function bo(e,t){let n={};if(h(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let r=h(e,[`computerUse`]);r!=null&&m(n,[`computerUse`],r);let i=h(e,[`fileSearch`]);i!=null&&m(n,[`fileSearch`],i);let a=h(e,[`googleSearch`]);a!=null&&m(n,[`googleSearch`],Ha(a));let o=h(e,[`codeExecution`]);if(o!=null&&m(n,[`codeExecution`],o),h(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let s=h(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`functionDeclarations`],e)}let c=h(e,[`googleMaps`]);c!=null&&m(n,[`googleMaps`],Va(c));let l=h(e,[`googleSearchRetrieval`]);l!=null&&m(n,[`googleSearchRetrieval`],l);let u=h(e,[`urlContext`]);u!=null&&m(n,[`urlContext`],u);let d=h(e,[`mcpServers`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),m(n,[`mcpServers`],e)}return n}function xo(e,t){let n={},r=h(e,[`retrieval`]);r!=null&&m(n,[`retrieval`],r);let i=h(e,[`computerUse`]);if(i!=null&&m(n,[`computerUse`],i),h(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let a=h(e,[`googleSearch`]);a!=null&&m(n,[`googleSearch`],a);let o=h(e,[`codeExecution`]);o!=null&&m(n,[`codeExecution`],o);let s=h(e,[`enterpriseWebSearch`]);s!=null&&m(n,[`enterpriseWebSearch`],s);let c=h(e,[`functionDeclarations`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>ua(e))),m(n,[`functionDeclarations`],e)}let l=h(e,[`googleMaps`]);l!=null&&m(n,[`googleMaps`],l);let u=h(e,[`googleSearchRetrieval`]);u!=null&&m(n,[`googleSearchRetrieval`],u);let d=h(e,[`urlContext`]);if(d!=null&&m(n,[`urlContext`],d),h(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return n}function So(e,t){let n={},r=h(e,[`baseModel`]);r!=null&&m(n,[`baseModel`],r);let i=h(e,[`createTime`]);i!=null&&m(n,[`createTime`],i);let a=h(e,[`updateTime`]);return a!=null&&m(n,[`updateTime`],a),n}function Co(e,t){let n={},r=h(e,[`labels`,`google-vertex-llm-tuning-base-model-id`]);r!=null&&m(n,[`baseModel`],r);let i=h(e,[`createTime`]);i!=null&&m(n,[`createTime`],i);let a=h(e,[`updateTime`]);return a!=null&&m(n,[`updateTime`],a),n}function wo(e,t,n){let r={},i=h(e,[`displayName`]);t!==void 0&&i!=null&&m(t,[`displayName`],i);let a=h(e,[`description`]);t!==void 0&&a!=null&&m(t,[`description`],a);let o=h(e,[`defaultCheckpointId`]);return t!==void 0&&o!=null&&m(t,[`defaultCheckpointId`],o),r}function To(e,t,n){let r={},i=h(e,[`displayName`]);t!==void 0&&i!=null&&m(t,[`displayName`],i);let a=h(e,[`description`]);t!==void 0&&a!=null&&m(t,[`description`],a);let o=h(e,[`defaultCheckpointId`]);return t!==void 0&&o!=null&&m(t,[`defaultCheckpointId`],o),r}function Eo(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`name`],N(e,i));let a=h(t,[`config`]);return a!=null&&wo(a,r),r}function Do(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`config`]);return a!=null&&To(a,r),r}function Oo(e,t,n){let r={},i=h(e,[`outputGcsUri`]);t!==void 0&&i!=null&&m(t,[`parameters`,`storageUri`],i);let a=h(e,[`safetyFilterLevel`]);t!==void 0&&a!=null&&m(t,[`parameters`,`safetySetting`],a);let o=h(e,[`personGeneration`]);t!==void 0&&o!=null&&m(t,[`parameters`,`personGeneration`],o);let s=h(e,[`includeRaiReason`]);t!==void 0&&s!=null&&m(t,[`parameters`,`includeRaiReason`],s);let c=h(e,[`outputMimeType`]);t!==void 0&&c!=null&&m(t,[`parameters`,`outputOptions`,`mimeType`],c);let l=h(e,[`outputCompressionQuality`]);t!==void 0&&l!=null&&m(t,[`parameters`,`outputOptions`,`compressionQuality`],l);let u=h(e,[`enhanceInputImage`]);t!==void 0&&u!=null&&m(t,[`parameters`,`upscaleConfig`,`enhanceInputImage`],u);let d=h(e,[`imagePreservationFactor`]);t!==void 0&&d!=null&&m(t,[`parameters`,`upscaleConfig`,`imagePreservationFactor`],d);let f=h(e,[`labels`]);t!==void 0&&f!=null&&m(t,[`labels`],f);let p=h(e,[`numberOfImages`]);t!==void 0&&p!=null&&m(t,[`parameters`,`sampleCount`],p);let g=h(e,[`mode`]);return t!==void 0&&g!=null&&m(t,[`parameters`,`mode`],g),r}function ko(e,t,n){let r={},i=h(t,[`model`]);i!=null&&m(r,[`_url`,`model`],N(e,i));let a=h(t,[`image`]);a!=null&&m(r,[`instances[0]`,`image`],K(a));let o=h(t,[`upscaleFactor`]);o!=null&&m(r,[`parameters`,`upscaleConfig`,`upscaleFactor`],o);let s=h(t,[`config`]);return s!=null&&Oo(s,r),r}function Ao(e,t){let n={},r=h(e,[`sdkHttpResponse`]);r!=null&&m(n,[`sdkHttpResponse`],r);let i=h(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Pa(e))),m(n,[`generatedImages`],e)}return n}function jo(e,t){let n={},r=h(e,[`uri`]);r!=null&&m(n,[`uri`],r);let i=h(e,[`encodedVideo`]);i!=null&&m(n,[`videoBytes`],z(i));let a=h(e,[`encoding`]);return a!=null&&m(n,[`mimeType`],a),n}function Mo(e,t){let n={},r=h(e,[`gcsUri`]);r!=null&&m(n,[`uri`],r);let i=h(e,[`bytesBase64Encoded`]);i!=null&&m(n,[`videoBytes`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function No(e,t){let n={},r=h(e,[`image`]);r!=null&&m(n,[`_self`],K(r));let i=h(e,[`maskMode`]);return i!=null&&m(n,[`maskMode`],i),n}function Po(e,t){let n={},r=h(e,[`image`]);r!=null&&m(n,[`image`],qa(r));let i=h(e,[`referenceType`]);return i!=null&&m(n,[`referenceType`],i),n}function Fo(e,t){let n={},r=h(e,[`image`]);r!=null&&m(n,[`image`],K(r));let i=h(e,[`referenceType`]);return i!=null&&m(n,[`referenceType`],i),n}function Io(e,t){let n={},r=h(e,[`uri`]);r!=null&&m(n,[`uri`],r);let i=h(e,[`videoBytes`]);i!=null&&m(n,[`encodedVideo`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`encoding`],a),n}function Lo(e,t){let n={},r=h(e,[`uri`]);r!=null&&m(n,[`gcsUri`],r);let i=h(e,[`videoBytes`]);i!=null&&m(n,[`bytesBase64Encoded`],z(i));let a=h(e,[`mimeType`]);return a!=null&&m(n,[`mimeType`],a),n}function Ro(e,t){let n={},r=h(e,[`displayName`]);return t!==void 0&&r!=null&&m(t,[`displayName`],r),n}function zo(e){let t={},n=h(e,[`config`]);return n!=null&&Ro(n,t),t}function Bo(e,t){let n={},r=h(e,[`force`]);return t!==void 0&&r!=null&&m(t,[`_query`,`force`],r),n}function Vo(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`_url`,`name`],n);let r=h(e,[`config`]);return r!=null&&Bo(r,t),t}function Ho(e){let t={},n=h(e,[`name`]);return n!=null&&m(t,[`_url`,`name`],n),t}function Uo(e,t){let n={},r=h(e,[`customMetadata`]);if(t!==void 0&&r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`customMetadata`],e)}let i=h(e,[`chunkingConfig`]);return t!==void 0&&i!=null&&m(t,[`chunkingConfig`],i),n}function Wo(e){let t={},n=h(e,[`name`]);n!=null&&m(t,[`name`],n);let r=h(e,[`metadata`]);r!=null&&m(t,[`metadata`],r);let i=h(e,[`done`]);i!=null&&m(t,[`done`],i);let a=h(e,[`error`]);a!=null&&m(t,[`error`],a);let o=h(e,[`response`]);return o!=null&&m(t,[`response`],Ko(o)),t}function Go(e){let t={},n=h(e,[`fileSearchStoreName`]);n!=null&&m(t,[`_url`,`file_search_store_name`],n);let r=h(e,[`fileName`]);r!=null&&m(t,[`fileName`],r);let i=h(e,[`config`]);return i!=null&&Uo(i,t),t}function Ko(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`parent`]);r!=null&&m(t,[`parent`],r);let i=h(e,[`documentName`]);return i!=null&&m(t,[`documentName`],i),t}function qo(e,t){let n={},r=h(e,[`pageSize`]);t!==void 0&&r!=null&&m(t,[`_query`,`pageSize`],r);let i=h(e,[`pageToken`]);return t!==void 0&&i!=null&&m(t,[`_query`,`pageToken`],i),n}function Jo(e){let t={},n=h(e,[`config`]);return n!=null&&qo(n,t),t}function Yo(e){let t={},n=h(e,[`sdkHttpResponse`]);n!=null&&m(t,[`sdkHttpResponse`],n);let r=h(e,[`nextPageToken`]);r!=null&&m(t,[`nextPageToken`],r);let i=h(e,[`fileSearchStores`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`fileSearchStores`],e)}return t}function Xo(e,t){let n={},r=h(e,[`mimeType`]);t!==void 0&&r!=null&&m(t,[`mimeType`],r);let i=h(e,[`displayName`]);t!==void 0&&i!=null&&m(t,[`displayName`],i);let a=h(e,[`customMetadata`]);if(t!==void 0&&a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>e)),m(t,[`customMetadata`],e)}let o=h(e,[`chunkingConfig`]);return t!==void 0&&o!=null&&m(t,[`chunkingConfig`],o),n}function Zo(e){let t={},n=h(e,[`fileSearchStoreName`]);n!=null&&m(t,[`_url`,`file_search_store_name`],n);let r=h(e,[`config`]);return r!=null&&Xo(r,t),t}function Qo(e){let t={},n=h(e,[`sdkHttpResponse`]);return n!=null&&m(t,[`sdkHttpResponse`],n),t}var $o=`Content-Type`,es=`X-Server-Timeout`,ts=`User-Agent`,ns=`x-goog-api-client`,rs=`google-genai-sdk/1.43.0`,is=`v1beta1`,as=`v1beta`,os=5,ss=[408,429,500,502,503,504],cs=class{constructor(e){this.clientOptions=Object.assign({},e),this.customBaseUrl=e.httpOptions?.baseUrl,this.clientOptions.vertexai&&(this.clientOptions.project&&this.clientOptions.location?this.clientOptions.apiKey=void 0:this.clientOptions.apiKey&&(this.clientOptions.project=void 0,this.clientOptions.location=void 0));let t={};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 Error(`Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.`);let n=e.project&&e.location||!!e.apiKey;this.customBaseUrl&&!n?(t.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||this.clientOptions.location===`global`?t.baseUrl=`https://aiplatform.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(t.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),t.apiVersion=this.clientOptions.apiVersion??is}else{if(!this.clientOptions.apiKey)throw new Zr({message:`API key must be set when using the Gemini API.`,status:403});t.apiVersion=this.clientOptions.apiVersion??as,t.baseUrl=`https://generativelanguage.googleapis.com/`}t.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=t,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(t,e.httpOptions))}isVertexAI(){return this.clientOptions.vertexai??!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){let e=new Headers;return await this.clientOptions.auth.addAuthHeaders(e),e}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw Error(`API version is not set.`)}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw Error(`Base URL is not set.`)}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw Error(`Headers are not set.`)}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw 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 Error(`HTTP options are not correctly set.`)}constructUrl(e,t,n){let r=[this.getRequestUrlInternal(t)];return n&&r.push(this.getBaseResourcePath()),e!==``&&r.push(e),new URL(`${r.join(`/`)}`)}shouldPrependVertexProjectPath(e,t){return!(t.baseUrl&&t.baseUrlResourceScope===ke.COLLECTION||this.clientOptions.apiKey||!this.clientOptions.vertexai||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 n=this.shouldPrependVertexProjectPath(e,t),r=this.constructUrl(e.path,t,n);if(e.queryParams)for(let[t,n]of Object.entries(e.queryParams))r.searchParams.append(t,String(n));let i={};if(e.httpMethod===`GET`){if(e.body&&e.body!==`{}`)throw Error(`Request body should be empty for GET request, but got non empty request body`)}else i.body=e.body;return i=await this.includeExtraHttpOptionsToRequestInit(i,t,r.toString(),e.abortSignal),this.unaryApiCall(r,i,e.httpMethod)}patchHttpOptions(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of Object.entries(t))typeof r==`object`?n[e]=Object.assign(Object.assign({},n[e]),r):r!==void 0&&(n[e]=r);return n}async requestStream(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let n=this.shouldPrependVertexProjectPath(e,t),r=this.constructUrl(e.path,t,n);(!r.searchParams.has(`alt`)||r.searchParams.get(`alt`)!==`sse`)&&r.searchParams.set(`alt`,`sse`);let i={};return i.body=e.body,i=await this.includeExtraHttpOptionsToRequestInit(i,t,r.toString(),e.abortSignal),this.streamApiCall(r,i,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,n,r){if(t&&t.timeout||r){let n=new AbortController,i=n.signal;if(t.timeout&&t?.timeout>0){let e=setTimeout(()=>n.abort(),t.timeout);e&&typeof e.unref==`function`&&e.unref()}r&&r.addEventListener(`abort`,()=>{n.abort()}),e.signal=i}return t&&t.extraBody!==null&&us(e,t.extraBody),e.headers=await this.getHeadersInternal(t,n),e}async unaryApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async e=>(await ls(e),new ot(e))).catch(e=>{throw e instanceof Error?e:Error(JSON.stringify(e))})}async streamApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async e=>(await ls(e),this.processStreamResponse(e))).catch(e=>{throw e instanceof Error?e:Error(JSON.stringify(e))})}processStreamResponse(e){return W(this,arguments,function*(){let t=(e?.body)?.getReader(),n=new TextDecoder(`utf-8`);if(!t)throw Error(`Response body is empty`);try{let r=``,i=[`
|
|
2
2
|
|
|
3
3
|
`,`\r\r`,`\r
|
|
4
4
|
\r
|