From 1e7dd0b58d9895adbffef96fe8bb98ad0eb469d3 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Thu, 18 Dec 2025 16:15:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0h5/create=E5=92=8Ch5/?= =?UTF-8?q?build=E7=9B=AE=E5=BD=95=E4=B8=8B=E7=9A=84index.html=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- h5/build/assets/index-CD0azml1.js | 372 ++++++++++++++++++++++++++ h5/build/index.html | 46 ++++ h5/create/assets/index-DiVLKNL_.js | 330 +++++++++++++++++++++++ h5/create/index.html | 41 +++ h5/thousands.html | 0 h5/together/assets/index-B7cc8JVP.js | 379 +++++++++++++++++++++++++++ h5/together/assets/index-CketmARB.js | 374 ++++++++++++++++++++++++++ h5/together/assets/index-DrkVVizK.js | 374 ++++++++++++++++++++++++++ h5/together/index.html | 163 ++++++++++++ 9 files changed, 2079 insertions(+) create mode 100755 h5/build/assets/index-CD0azml1.js create mode 100755 h5/build/index.html create mode 100755 h5/create/assets/index-DiVLKNL_.js create mode 100755 h5/create/index.html mode change 100644 => 100755 h5/thousands.html create mode 100755 h5/together/assets/index-B7cc8JVP.js create mode 100755 h5/together/assets/index-CketmARB.js create mode 100755 h5/together/assets/index-DrkVVizK.js create mode 100755 h5/together/index.html diff --git a/h5/build/assets/index-CD0azml1.js b/h5/build/assets/index-CD0azml1.js new file mode 100755 index 0000000..18c0ef7 --- /dev/null +++ b/h5/build/assets/index-CD0azml1.js @@ -0,0 +1,372 @@ +(function(){const _=document.createElement("link").relList;if(_&&_.supports&&_.supports("modulepreload"))return;for(const w of document.querySelectorAll('link[rel="modulepreload"]'))r(w);new MutationObserver(w=>{for(const A of w)if(A.type==="childList")for(const k of A.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&r(k)}).observe(document,{childList:!0,subtree:!0});function M(w){const A={};return w.integrity&&(A.integrity=w.integrity),w.referrerPolicy&&(A.referrerPolicy=w.referrerPolicy),w.crossOrigin==="use-credentials"?A.credentials="include":w.crossOrigin==="anonymous"?A.credentials="omit":A.credentials="same-origin",A}function r(w){if(w.ep)return;w.ep=!0;const A=M(w);fetch(w.href,A)}})();function F0(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var gs={exports:{}},Cn={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var w0;function Th(){if(w0)return Cn;w0=1;var d=Symbol.for("react.transitional.element"),_=Symbol.for("react.fragment");function M(r,w,A){var k=null;if(A!==void 0&&(k=""+A),w.key!==void 0&&(k=""+w.key),"key"in w){A={};for(var Z in w)Z!=="key"&&(A[Z]=w[Z])}else A=w;return w=A.ref,{$$typeof:d,type:r,key:k,ref:w!==void 0?w:null,props:A}}return Cn.Fragment=_,Cn.jsx=M,Cn.jsxs=M,Cn}var H0;function Oh(){return H0||(H0=1,gs.exports=Th()),gs.exports}var i=Oh(),vs={exports:{}},I={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var R0;function Dh(){if(R0)return I;R0=1;var d=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),k=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),R=Symbol.iterator;function se(m){return m===null||typeof m!="object"?null:(m=R&&m[R]||m["@@iterator"],typeof m=="function"?m:null)}var Se={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ge=Object.assign,Ue={};function be(m,z,U){this.props=m,this.context=z,this.refs=Ue,this.updater=U||Se}be.prototype.isReactComponent={},be.prototype.setState=function(m,z){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,z,"setState")},be.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function $(){}$.prototype=be.prototype;function ue(m,z,U){this.props=m,this.context=z,this.refs=Ue,this.updater=U||Se}var L=ue.prototype=new $;L.constructor=ue,ge(L,be.prototype),L.isPureReactComponent=!0;var me=Array.isArray;function V(){}var P={H:null,A:null,T:null,S:null},Je=Object.prototype.hasOwnProperty;function al(m,z,U){var q=U.ref;return{$$typeof:d,type:m,key:z,ref:q!==void 0?q:null,props:U}}function Ml(m,z){return al(m.type,z,m.props)}function qe(m){return typeof m=="object"&&m!==null&&m.$$typeof===d}function W(m){var z={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(U){return z[U]})}var pe=/\/+/g;function te(m,z){return typeof m=="object"&&m!==null&&m.key!=null?W(""+m.key):z.toString(36)}function oe(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(V,V):(m.status="pending",m.then(function(z){m.status==="pending"&&(m.status="fulfilled",m.value=z)},function(z){m.status==="pending"&&(m.status="rejected",m.reason=z)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function b(m,z,U,q,F){var ae=typeof m;(ae==="undefined"||ae==="boolean")&&(m=null);var he=!1;if(m===null)he=!0;else switch(ae){case"bigint":case"string":case"number":he=!0;break;case"object":switch(m.$$typeof){case d:case _:he=!0;break;case Y:return he=m._init,b(he(m._payload),z,U,q,F)}}if(he)return F=F(m),he=q===""?"."+te(m,0):q,me(F)?(U="",he!=null&&(U=he.replace(pe,"$&/")+"/"),b(F,z,U,"",function(Ct){return Ct})):F!=null&&(qe(F)&&(F=Ml(F,U+(F.key==null||m&&m.key===F.key?"":(""+F.key).replace(pe,"$&/")+"/")+he)),z.push(F)),1;he=0;var Be=q===""?".":q+":";if(me(m))for(var Ee=0;Ee>>1,Ne=b[je];if(0>>1;jew(U,J))qw(F,U)?(b[je]=F,b[q]=J,je=q):(b[je]=U,b[z]=J,je=z);else if(qw(F,J))b[je]=F,b[q]=J,je=q;else break e}}return T}function w(b,T){var J=b.sortIndex-T.sortIndex;return J!==0?J:b.id-T.id}if(d.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var A=performance;d.unstable_now=function(){return A.now()}}else{var k=Date,Z=k.now();d.unstable_now=function(){return k.now()-Z}}var E=[],p=[],Y=1,D=null,R=3,se=!1,Se=!1,ge=!1,Ue=!1,be=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,ue=typeof setImmediate<"u"?setImmediate:null;function L(b){for(var T=M(p);T!==null;){if(T.callback===null)r(p);else if(T.startTime<=b)r(p),T.sortIndex=T.expirationTime,_(E,T);else break;T=M(p)}}function me(b){if(ge=!1,L(b),!Se)if(M(E)!==null)Se=!0,V||(V=!0,W());else{var T=M(p);T!==null&&oe(me,T.startTime-b)}}var V=!1,P=-1,Je=5,al=-1;function Ml(){return Ue?!0:!(d.unstable_now()-alb&&Ml());){var je=D.callback;if(typeof je=="function"){D.callback=null,R=D.priorityLevel;var Ne=je(D.expirationTime<=b);if(b=d.unstable_now(),typeof Ne=="function"){D.callback=Ne,L(b),T=!0;break l}D===M(E)&&r(E),L(b)}else r(E);D=M(E)}if(D!==null)T=!0;else{var m=M(p);m!==null&&oe(me,m.startTime-b),T=!1}}break e}finally{D=null,R=J,se=!1}T=void 0}}finally{T?W():V=!1}}}var W;if(typeof ue=="function")W=function(){ue(qe)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,te=pe.port2;pe.port1.onmessage=qe,W=function(){te.postMessage(null)}}else W=function(){be(qe,0)};function oe(b,T){P=be(function(){b(d.unstable_now())},T)}d.unstable_IdlePriority=5,d.unstable_ImmediatePriority=1,d.unstable_LowPriority=4,d.unstable_NormalPriority=3,d.unstable_Profiling=null,d.unstable_UserBlockingPriority=2,d.unstable_cancelCallback=function(b){b.callback=null},d.unstable_forceFrameRate=function(b){0>b||125je?(b.sortIndex=J,_(p,b),M(E)===null&&b===M(p)&&(ge?($(P),P=-1):ge=!0,oe(me,J-je))):(b.sortIndex=Ne,_(E,b),Se||se||(Se=!0,V||(V=!0,W()))),b},d.unstable_shouldYield=Ml,d.unstable_wrapCallback=function(b){var T=R;return function(){var J=R;R=T;try{return b.apply(this,arguments)}finally{R=J}}}})(js)),js}var G0;function wh(){return G0||(G0=1,ps.exports=Ch()),ps.exports}var Ns={exports:{}},tl={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Y0;function Hh(){if(Y0)return tl;Y0=1;var d=Ds();function _(E){var p="https://react.dev/errors/"+E;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d)}catch(_){console.error(_)}}return d(),Ns.exports=Hh(),Ns.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var X0;function qh(){if(X0)return wn;X0=1;var d=wh(),_=Ds(),M=Rh();function r(e){var l="https://react.dev/errors/"+e;if(1Ne||(e.current=je[Ne],je[Ne]=null,Ne--)}function U(e,l){Ne++,je[Ne]=e.current,e.current=l}var q=m(null),F=m(null),ae=m(null),he=m(null);function Be(e,l){switch(U(ae,l),U(F,e),U(q,null),l.nodeType){case 9:case 11:e=(e=l.documentElement)&&(e=e.namespaceURI)?a0(e):0;break;default:if(e=l.tagName,l=l.namespaceURI)l=a0(l),e=n0(l,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(q),U(q,e)}function Ee(){z(q),z(F),z(ae)}function Ct(e){e.memoizedState!==null&&U(he,e);var l=q.current,t=n0(l,e.type);l!==t&&(U(F,e),U(q,t))}function O(e){F.current===e&&(z(q),z(F)),he.current===e&&(z(he),Tn._currentValue=J)}var ne,Ce;function _e(e){if(ne===void 0)try{throw Error()}catch(t){var l=t.stack.trim().match(/\n( *(at )?)/);ne=l&&l[1]||"",Ce=-1)":-1n||f[a]!==x[n]){var j=` +`+f[a].replace(" at new "," at ");return e.displayName&&j.includes("")&&(j=j.replace("",e.displayName)),j}while(1<=a&&0<=n);break}}}finally{ul=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?_e(t):""}function ct(e,l){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e("Lazy");case 13:return e.child!==l&&l!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return ml(e.type,!1);case 11:return ml(e.type.render,!1);case 1:return ml(e.type,!0);case 31:return _e("Activity");default:return""}}function Pt(e){try{var l="",t=null;do l+=ct(e,t),t=e,e=e.return;while(e);return l}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ti=Object.prototype.hasOwnProperty,ai=d.unstable_scheduleCallback,ni=d.unstable_cancelCallback,cd=d.unstable_shouldYield,sd=d.unstable_requestPaint,hl=d.unstable_now,fd=d.unstable_getCurrentPriorityLevel,Cs=d.unstable_ImmediatePriority,ws=d.unstable_UserBlockingPriority,Bn=d.unstable_NormalPriority,rd=d.unstable_LowPriority,Hs=d.unstable_IdlePriority,od=d.log,dd=d.unstable_setDisableYieldValue,Ya=null,yl=null;function st(e){if(typeof od=="function"&&dd(e),yl&&typeof yl.setStrictMode=="function")try{yl.setStrictMode(Ya,e)}catch{}}var xl=Math.clz32?Math.clz32:yd,md=Math.log,hd=Math.LN2;function yd(e){return e>>>=0,e===0?32:31-(md(e)/hd|0)|0}var Gn=256,Yn=262144,Vn=4194304;function wt(e){var l=e&42;if(l!==0)return l;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Xn(e,l,t){var a=e.pendingLanes;if(a===0)return 0;var n=0,u=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var s=a&134217727;return s!==0?(a=s&~u,a!==0?n=wt(a):(c&=s,c!==0?n=wt(c):t||(t=s&~e,t!==0&&(n=wt(t))))):(s=a&~u,s!==0?n=wt(s):c!==0?n=wt(c):t||(t=a&~e,t!==0&&(n=wt(t)))),n===0?0:l!==0&&l!==n&&(l&u)===0&&(u=n&-n,t=l&-l,u>=t||u===32&&(t&4194048)!==0)?l:n}function Va(e,l){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&l)===0}function xd(e,l){switch(e){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rs(){var e=Vn;return Vn<<=1,(Vn&62914560)===0&&(Vn=4194304),e}function ui(e){for(var l=[],t=0;31>t;t++)l.push(e);return l}function Xa(e,l){e.pendingLanes|=l,l!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gd(e,l,t,a,n,u){var c=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var s=e.entanglements,f=e.expirationTimes,x=e.hiddenUpdates;for(t=c&~t;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Sd=/[\n"\\]/g;function _l(e){return e.replace(Sd,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function oi(e,l,t,a,n,u,c,s){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),l!=null?c==="number"?(l===0&&e.value===""||e.value!=l)&&(e.value=""+El(l)):e.value!==""+El(l)&&(e.value=""+El(l)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),l!=null?di(e,c,El(l)):t!=null?di(e,c,El(t)):a!=null&&e.removeAttribute("value"),n==null&&u!=null&&(e.defaultChecked=!!u),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+El(s):e.removeAttribute("name")}function $s(e,l,t,a,n,u,c,s){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),l!=null||t!=null){if(!(u!=="submit"&&u!=="reset"||l!=null)){ri(e);return}t=t!=null?""+El(t):"",l=l!=null?""+El(l):t,s||l===e.value||(e.value=l),e.defaultValue=l}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=s?e.checked:!!a,e.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),ri(e)}function di(e,l,t){l==="number"&&Zn(e.ownerDocument)===e||e.defaultValue===""+t||(e.defaultValue=""+t)}function ua(e,l,t,a){if(e=e.options,l){l={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gi=!1;if(Zl)try{var Ka={};Object.defineProperty(Ka,"passive",{get:function(){gi=!0}}),window.addEventListener("test",Ka,Ka),window.removeEventListener("test",Ka,Ka)}catch{gi=!1}var rt=null,vi=null,Jn=null;function tf(){if(Jn)return Jn;var e,l=vi,t=l.length,a,n="value"in rt?rt.value:rt.textContent,u=n.length;for(e=0;e=$a),ff=" ",rf=!1;function of(e,l){switch(e){case"keyup":return Fd.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function df(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fa=!1;function Pd(e,l){switch(e){case"compositionend":return df(l);case"keypress":return l.which!==32?null:(rf=!0,ff);case"textInput":return e=l.data,e===ff&&rf?null:e;default:return null}}function em(e,l){if(fa)return e==="compositionend"||!Si&&of(e,l)?(e=tf(),Jn=vi=rt=null,fa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:t,offset:l-e};e=a}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=pf(t)}}function Nf(e,l){return e&&l?e===l?!0:e&&e.nodeType===3?!1:l&&l.nodeType===3?Nf(e,l.parentNode):"contains"in e?e.contains(l):e.compareDocumentPosition?!!(e.compareDocumentPosition(l)&16):!1:!1}function Sf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var l=Zn(e.document);l instanceof e.HTMLIFrameElement;){try{var t=typeof l.contentWindow.location.href=="string"}catch{t=!1}if(t)e=l.contentWindow;else break;l=Zn(e.document)}return l}function Ei(e){var l=e&&e.nodeName&&e.nodeName.toLowerCase();return l&&(l==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||l==="textarea"||e.contentEditable==="true")}var sm=Zl&&"documentMode"in document&&11>=document.documentMode,ra=null,_i=null,Pa=null,Ai=!1;function zf(e,l,t){var a=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Ai||ra==null||ra!==Zn(a)||(a=ra,"selectionStart"in a&&Ei(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Pa&&Ia(Pa,a)||(Pa=a,a=Yu(_i,"onSelect"),0>=c,n-=c,Gl=1<<32-xl(l)+n|t<le?(re=B,B=null):re=B.sibling;var xe=g(h,B,y[le],N);if(xe===null){B===null&&(B=re);break}e&&B&&xe.alternate===null&&l(h,B),o=u(xe,o,le),ye===null?X=xe:ye.sibling=xe,ye=xe,B=re}if(le===y.length)return t(h,B),de&&Jl(h,le),X;if(B===null){for(;lele?(re=B,B=null):re=B.sibling;var Ut=g(h,B,xe.value,N);if(Ut===null){B===null&&(B=re);break}e&&B&&Ut.alternate===null&&l(h,B),o=u(Ut,o,le),ye===null?X=Ut:ye.sibling=Ut,ye=Ut,B=re}if(xe.done)return t(h,B),de&&Jl(h,le),X;if(B===null){for(;!xe.done;le++,xe=y.next())xe=S(h,xe.value,N),xe!==null&&(o=u(xe,o,le),ye===null?X=xe:ye.sibling=xe,ye=xe);return de&&Jl(h,le),X}for(B=a(B);!xe.done;le++,xe=y.next())xe=v(B,h,le,xe.value,N),xe!==null&&(e&&xe.alternate!==null&&B.delete(xe.key===null?le:xe.key),o=u(xe,o,le),ye===null?X=xe:ye.sibling=xe,ye=xe);return e&&B.forEach(function(Ah){return l(h,Ah)}),de&&Jl(h,le),X}function Oe(h,o,y,N){if(typeof y=="object"&&y!==null&&y.type===ge&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case se:e:{for(var X=y.key;o!==null;){if(o.key===X){if(X=y.type,X===ge){if(o.tag===7){t(h,o.sibling),N=n(o,y.props.children),N.return=h,h=N;break e}}else if(o.elementType===X||typeof X=="object"&&X!==null&&X.$$typeof===Je&&Zt(X)===o.type){t(h,o.sibling),N=n(o,y.props),un(N,y),N.return=h,h=N;break e}t(h,o);break}else l(h,o);o=o.sibling}y.type===ge?(N=Yt(y.props.children,h.mode,N,y.key),N.return=h,h=N):(N=au(y.type,y.key,y.props,null,h.mode,N),un(N,y),N.return=h,h=N)}return c(h);case Se:e:{for(X=y.key;o!==null;){if(o.key===X)if(o.tag===4&&o.stateNode.containerInfo===y.containerInfo&&o.stateNode.implementation===y.implementation){t(h,o.sibling),N=n(o,y.children||[]),N.return=h,h=N;break e}else{t(h,o);break}else l(h,o);o=o.sibling}N=Hi(y,h.mode,N),N.return=h,h=N}return c(h);case Je:return y=Zt(y),Oe(h,o,y,N)}if(oe(y))return H(h,o,y,N);if(W(y)){if(X=W(y),typeof X!="function")throw Error(r(150));return y=X.call(y),K(h,o,y,N)}if(typeof y.then=="function")return Oe(h,o,ru(y),N);if(y.$$typeof===ue)return Oe(h,o,iu(h,y),N);ou(h,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,o!==null&&o.tag===6?(t(h,o.sibling),N=n(o,y),N.return=h,h=N):(t(h,o),N=wi(y,h.mode,N),N.return=h,h=N),c(h)):t(h,o)}return function(h,o,y,N){try{nn=0;var X=Oe(h,o,y,N);return ja=null,X}catch(B){if(B===pa||B===su)throw B;var ye=vl(29,B,null,h.mode);return ye.lanes=N,ye.return=h,ye}finally{}}}var Jt=Jf(!0),kf=Jf(!1),yt=!1;function Ji(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ki(e,l){e=e.updateQueue,l.updateQueue===e&&(l.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function xt(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function gt(e,l,t){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(ve&2)!==0){var n=a.pending;return n===null?l.next=l:(l.next=n.next,n.next=l),a.pending=l,l=tu(e),Df(e,null,t),l}return lu(e,a,l,t),tu(e)}function cn(e,l,t){if(l=l.updateQueue,l!==null&&(l=l.shared,(t&4194048)!==0)){var a=l.lanes;a&=e.pendingLanes,t|=a,l.lanes=t,Bs(e,t)}}function $i(e,l){var t=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,t===a)){var n=null,u=null;if(t=t.firstBaseUpdate,t!==null){do{var c={lane:t.lane,tag:t.tag,payload:t.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,t=t.next}while(t!==null);u===null?n=u=l:u=u.next=l}else n=u=l;t={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},e.updateQueue=t;return}e=t.lastBaseUpdate,e===null?t.firstBaseUpdate=l:e.next=l,t.lastBaseUpdate=l}var Wi=!1;function sn(){if(Wi){var e=ba;if(e!==null)throw e}}function fn(e,l,t,a){Wi=!1;var n=e.updateQueue;yt=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,s=n.shared.pending;if(s!==null){n.shared.pending=null;var f=s,x=f.next;f.next=null,c===null?u=x:c.next=x,c=f;var j=e.alternate;j!==null&&(j=j.updateQueue,s=j.lastBaseUpdate,s!==c&&(s===null?j.firstBaseUpdate=x:s.next=x,j.lastBaseUpdate=f))}if(u!==null){var S=n.baseState;c=0,j=x=f=null,s=u;do{var g=s.lane&-536870913,v=g!==s.lane;if(v?(fe&g)===g:(a&g)===g){g!==0&&g===va&&(Wi=!0),j!==null&&(j=j.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var H=e,K=s;g=l;var Oe=t;switch(K.tag){case 1:if(H=K.payload,typeof H=="function"){S=H.call(Oe,S,g);break e}S=H;break e;case 3:H.flags=H.flags&-65537|128;case 0:if(H=K.payload,g=typeof H=="function"?H.call(Oe,S,g):H,g==null)break e;S=D({},S,g);break e;case 2:yt=!0}}g=s.callback,g!==null&&(e.flags|=64,v&&(e.flags|=8192),v=n.callbacks,v===null?n.callbacks=[g]:v.push(g))}else v={lane:g,tag:s.tag,payload:s.payload,callback:s.callback,next:null},j===null?(x=j=v,f=S):j=j.next=v,c|=g;if(s=s.next,s===null){if(s=n.shared.pending,s===null)break;v=s,s=v.next,v.next=null,n.lastBaseUpdate=v,n.shared.pending=null}}while(!0);j===null&&(f=S),n.baseState=f,n.firstBaseUpdate=x,n.lastBaseUpdate=j,u===null&&(n.shared.lanes=0),Nt|=c,e.lanes=c,e.memoizedState=S}}function $f(e,l){if(typeof e!="function")throw Error(r(191,e));e.call(l)}function Wf(e,l){var t=e.callbacks;if(t!==null)for(e.callbacks=null,e=0;eu?u:8;var c=b.T,s={};b.T=s,yc(e,!1,l,t);try{var f=n(),x=b.S;if(x!==null&&x(s,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var j=gm(f,a);dn(e,l,j,Sl(e))}else dn(e,l,a,Sl(e))}catch(S){dn(e,l,{then:function(){},status:"rejected",reason:S},Sl())}finally{T.p=u,c!==null&&s.types!==null&&(c.types=s.types),b.T=c}}function Sm(){}function mc(e,l,t,a){if(e.tag!==5)throw Error(r(476));var n=Ar(e).queue;_r(e,n,l,J,t===null?Sm:function(){return Tr(e),t(a)})}function Ar(e){var l=e.memoizedState;if(l!==null)return l;l={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fl,lastRenderedState:J},next:null};var t={};return l.next={memoizedState:t,baseState:t,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fl,lastRenderedState:t},next:null},e.memoizedState=l,e=e.alternate,e!==null&&(e.memoizedState=l),l}function Tr(e){var l=Ar(e);l.next===null&&(l=e.alternate.memoizedState),dn(e,l.next.queue,{},Sl())}function hc(){return Pe(Tn)}function Or(){return Xe().memoizedState}function Dr(){return Xe().memoizedState}function zm(e){for(var l=e.return;l!==null;){switch(l.tag){case 24:case 3:var t=Sl();e=xt(t);var a=gt(l,e,t);a!==null&&(dl(a,l,t),cn(a,l,t)),l={cache:Qi()},e.payload=l;return}l=l.return}}function Mm(e,l,t){var a=Sl();t={lane:a,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null},ju(e)?Cr(l,t):(t=Ui(e,l,t,a),t!==null&&(dl(t,e,a),wr(t,l,a)))}function Ur(e,l,t){var a=Sl();dn(e,l,t,a)}function dn(e,l,t,a){var n={lane:a,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null};if(ju(e))Cr(l,n);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var c=l.lastRenderedState,s=u(c,t);if(n.hasEagerState=!0,n.eagerState=s,gl(s,c))return lu(e,l,n,0),De===null&&eu(),!1}catch{}finally{}if(t=Ui(e,l,n,a),t!==null)return dl(t,e,a),wr(t,l,a),!0}return!1}function yc(e,l,t,a){if(a={lane:2,revertLane:Jc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ju(e)){if(l)throw Error(r(479))}else l=Ui(e,t,a,2),l!==null&&dl(l,e,2)}function ju(e){var l=e.alternate;return e===ee||l!==null&&l===ee}function Cr(e,l){Sa=hu=!0;var t=e.pending;t===null?l.next=l:(l.next=t.next,t.next=l),e.pending=l}function wr(e,l,t){if((t&4194048)!==0){var a=l.lanes;a&=e.pendingLanes,t|=a,l.lanes=t,Bs(e,t)}}var mn={readContext:Pe,use:gu,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useLayoutEffect:Ge,useInsertionEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useSyncExternalStore:Ge,useId:Ge,useHostTransitionStatus:Ge,useFormState:Ge,useActionState:Ge,useOptimistic:Ge,useMemoCache:Ge,useCacheRefresh:Ge};mn.useEffectEvent=Ge;var Hr={readContext:Pe,use:gu,useCallback:function(e,l){return nl().memoizedState=[e,l===void 0?null:l],e},useContext:Pe,useEffect:vr,useImperativeHandle:function(e,l,t){t=t!=null?t.concat([e]):null,bu(4194308,4,Nr.bind(null,l,e),t)},useLayoutEffect:function(e,l){return bu(4194308,4,e,l)},useInsertionEffect:function(e,l){bu(4,2,e,l)},useMemo:function(e,l){var t=nl();l=l===void 0?null:l;var a=e();if(kt){st(!0);try{e()}finally{st(!1)}}return t.memoizedState=[a,l],a},useReducer:function(e,l,t){var a=nl();if(t!==void 0){var n=t(l);if(kt){st(!0);try{t(l)}finally{st(!1)}}}else n=l;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=Mm.bind(null,ee,e),[a.memoizedState,e]},useRef:function(e){var l=nl();return e={current:e},l.memoizedState=e},useState:function(e){e=sc(e);var l=e.queue,t=Ur.bind(null,ee,l);return l.dispatch=t,[e.memoizedState,t]},useDebugValue:oc,useDeferredValue:function(e,l){var t=nl();return dc(t,e,l)},useTransition:function(){var e=sc(!1);return e=_r.bind(null,ee,e.queue,!0,!1),nl().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,l,t){var a=ee,n=nl();if(de){if(t===void 0)throw Error(r(407));t=t()}else{if(t=l(),De===null)throw Error(r(349));(fe&127)!==0||tr(a,l,t)}n.memoizedState=t;var u={value:t,getSnapshot:l};return n.queue=u,vr(nr.bind(null,a,u,e),[e]),a.flags|=2048,Ma(9,{destroy:void 0},ar.bind(null,a,u,t,l),null),t},useId:function(){var e=nl(),l=De.identifierPrefix;if(de){var t=Yl,a=Gl;t=(a&~(1<<32-xl(a)-1)).toString(32)+t,l="_"+l+"R_"+t,t=yu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}u[Fe]=l,u[il]=a;e:for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break e;for(;c.sibling===null;){if(c.return===null||c.return===l)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}l.stateNode=u;e:switch(ll(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Pl(l)}}return He(l),Tc(l,l.type,e===null?null:e.memoizedProps,l.pendingProps,t),null;case 6:if(e&&l.stateNode!=null)e.memoizedProps!==a&&Pl(l);else{if(typeof a!="string"&&l.stateNode===null)throw Error(r(166));if(e=ae.current,xa(l)){if(e=l.stateNode,t=l.memoizedProps,a=null,n=Ie,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}e[Fe]=l,e=!!(e.nodeValue===t||a!==null&&a.suppressHydrationWarning===!0||l0(e.nodeValue,t)),e||mt(l,!0)}else e=Vu(e).createTextNode(a),e[Fe]=l,l.stateNode=e}return He(l),null;case 31:if(t=l.memoizedState,e===null||e.memoizedState!==null){if(a=xa(l),t!==null){if(e===null){if(!a)throw Error(r(318));if(e=l.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Fe]=l}else Vt(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;He(l),e=!1}else t=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=t),e=!0;if(!e)return l.flags&256?(pl(l),l):(pl(l),null);if((l.flags&128)!==0)throw Error(r(558))}return He(l),null;case 13:if(a=l.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=xa(l),a!==null&&a.dehydrated!==null){if(e===null){if(!n)throw Error(r(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));n[Fe]=l}else Vt(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;He(l),n=!1}else n=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return l.flags&256?(pl(l),l):(pl(l),null)}return pl(l),(l.flags&128)!==0?(l.lanes=t,l):(t=a!==null,e=e!==null&&e.memoizedState!==null,t&&(a=l.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),t!==e&&t&&(l.child.flags|=8192),Eu(l,l.updateQueue),He(l),null);case 4:return Ee(),e===null&&Fc(l.stateNode.containerInfo),He(l),null;case 10:return $l(l.type),He(l),null;case 19:if(z(Ve),a=l.memoizedState,a===null)return He(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)yn(a,!1);else{if(Ye!==0||e!==null&&(e.flags&128)!==0)for(e=l.child;e!==null;){if(u=mu(e),u!==null){for(l.flags|=128,yn(a,!1),e=u.updateQueue,l.updateQueue=e,Eu(l,e),l.subtreeFlags=0,e=t,t=l.child;t!==null;)Uf(t,e),t=t.sibling;return U(Ve,Ve.current&1|2),de&&Jl(l,a.treeForkCount),l.child}e=e.sibling}a.tail!==null&&hl()>Du&&(l.flags|=128,n=!0,yn(a,!1),l.lanes=4194304)}else{if(!n)if(e=mu(u),e!==null){if(l.flags|=128,n=!0,e=e.updateQueue,l.updateQueue=e,Eu(l,e),yn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!de)return He(l),null}else 2*hl()-a.renderingStartTime>Du&&t!==536870912&&(l.flags|=128,n=!0,yn(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(e=a.last,e!==null?e.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=hl(),e.sibling=null,t=Ve.current,U(Ve,n?t&1|2:t&1),de&&Jl(l,a.treeForkCount),e):(He(l),null);case 22:case 23:return pl(l),Ii(),a=l.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(l.flags|=8192):a&&(l.flags|=8192),a?(t&536870912)!==0&&(l.flags&128)===0&&(He(l),l.subtreeFlags&6&&(l.flags|=8192)):He(l),t=l.updateQueue,t!==null&&Eu(l,t.retryQueue),t=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==t&&(l.flags|=2048),e!==null&&z(Lt),null;case 24:return t=null,e!==null&&(t=e.memoizedState.cache),l.memoizedState.cache!==t&&(l.flags|=2048),$l(Qe),He(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function Om(e,l){switch(qi(l),l.tag){case 1:return e=l.flags,e&65536?(l.flags=e&-65537|128,l):null;case 3:return $l(Qe),Ee(),e=l.flags,(e&65536)!==0&&(e&128)===0?(l.flags=e&-65537|128,l):null;case 26:case 27:case 5:return O(l),null;case 31:if(l.memoizedState!==null){if(pl(l),l.alternate===null)throw Error(r(340));Vt()}return e=l.flags,e&65536?(l.flags=e&-65537|128,l):null;case 13:if(pl(l),e=l.memoizedState,e!==null&&e.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Vt()}return e=l.flags,e&65536?(l.flags=e&-65537|128,l):null;case 19:return z(Ve),null;case 4:return Ee(),null;case 10:return $l(l.type),null;case 22:case 23:return pl(l),Ii(),e!==null&&z(Lt),e=l.flags,e&65536?(l.flags=e&-65537|128,l):null;case 24:return $l(Qe),null;case 25:return null;default:return null}}function uo(e,l){switch(qi(l),l.tag){case 3:$l(Qe),Ee();break;case 26:case 27:case 5:O(l);break;case 4:Ee();break;case 31:l.memoizedState!==null&&pl(l);break;case 13:pl(l);break;case 19:z(Ve);break;case 10:$l(l.type);break;case 22:case 23:pl(l),Ii(),e!==null&&z(Lt);break;case 24:$l(Qe)}}function xn(e,l){try{var t=l.updateQueue,a=t!==null?t.lastEffect:null;if(a!==null){var n=a.next;t=n;do{if((t.tag&e)===e){a=void 0;var u=t.create,c=t.inst;a=u(),c.destroy=a}t=t.next}while(t!==n)}}catch(s){Me(l,l.return,s)}}function pt(e,l,t){try{var a=l.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&e)===e){var c=a.inst,s=c.destroy;if(s!==void 0){c.destroy=void 0,n=l;var f=t,x=s;try{x()}catch(j){Me(n,f,j)}}}a=a.next}while(a!==u)}}catch(j){Me(l,l.return,j)}}function io(e){var l=e.updateQueue;if(l!==null){var t=e.stateNode;try{Wf(l,t)}catch(a){Me(e,e.return,a)}}}function co(e,l,t){t.props=$t(e.type,e.memoizedProps),t.state=e.memoizedState;try{t.componentWillUnmount()}catch(a){Me(e,l,a)}}function gn(e,l){try{var t=e.ref;if(t!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof t=="function"?e.refCleanup=t(a):t.current=a}}catch(n){Me(e,l,n)}}function Vl(e,l){var t=e.ref,a=e.refCleanup;if(t!==null)if(typeof a=="function")try{a()}catch(n){Me(e,l,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof t=="function")try{t(null)}catch(n){Me(e,l,n)}else t.current=null}function so(e){var l=e.type,t=e.memoizedProps,a=e.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":t.autoFocus&&a.focus();break e;case"img":t.src?a.src=t.src:t.srcSet&&(a.srcset=t.srcSet)}}catch(n){Me(e,e.return,n)}}function Oc(e,l,t){try{var a=e.stateNode;Im(a,e.type,t,l),a[il]=l}catch(n){Me(e,e.return,n)}}function fo(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_t(e.type)||e.tag===4}function Dc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fo(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&_t(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Uc(e,l,t){var a=e.tag;if(a===5||a===6)e=e.stateNode,l?(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t).insertBefore(e,l):(l=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.appendChild(e),t=t._reactRootContainer,t!=null||l.onclick!==null||(l.onclick=Ll));else if(a!==4&&(a===27&&_t(e.type)&&(t=e.stateNode,l=null),e=e.child,e!==null))for(Uc(e,l,t),e=e.sibling;e!==null;)Uc(e,l,t),e=e.sibling}function _u(e,l,t){var a=e.tag;if(a===5||a===6)e=e.stateNode,l?t.insertBefore(e,l):t.appendChild(e);else if(a!==4&&(a===27&&_t(e.type)&&(t=e.stateNode),e=e.child,e!==null))for(_u(e,l,t),e=e.sibling;e!==null;)_u(e,l,t),e=e.sibling}function ro(e){var l=e.stateNode,t=e.memoizedProps;try{for(var a=e.type,n=l.attributes;n.length;)l.removeAttributeNode(n[0]);ll(l,a,t),l[Fe]=e,l[il]=t}catch(u){Me(e,e.return,u)}}var et=!1,Ke=!1,Cc=!1,oo=typeof WeakSet=="function"?WeakSet:Set,We=null;function Dm(e,l){if(e=e.containerInfo,es=ku,e=Sf(e),Ei(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var a=t.getSelection&&t.getSelection();if(a&&a.rangeCount!==0){t=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{t.nodeType,u.nodeType}catch{t=null;break e}var c=0,s=-1,f=-1,x=0,j=0,S=e,g=null;l:for(;;){for(var v;S!==t||n!==0&&S.nodeType!==3||(s=c+n),S!==u||a!==0&&S.nodeType!==3||(f=c+a),S.nodeType===3&&(c+=S.nodeValue.length),(v=S.firstChild)!==null;)g=S,S=v;for(;;){if(S===e)break l;if(g===t&&++x===n&&(s=c),g===u&&++j===a&&(f=c),(v=S.nextSibling)!==null)break;S=g,g=S.parentNode}S=v}t=s===-1||f===-1?null:{start:s,end:f}}else t=null}t=t||{start:0,end:0}}else t=null;for(ls={focusedElem:e,selectionRange:t},ku=!1,We=l;We!==null;)if(l=We,e=l.child,(l.subtreeFlags&1028)!==0&&e!==null)e.return=l,We=e;else for(;We!==null;){switch(l=We,u=l.alternate,e=l.flags,l.tag){case 0:if((e&4)!==0&&(e=l.updateQueue,e=e!==null?e.events:null,e!==null))for(t=0;t title"))),ll(u,a,t),u[Fe]=e,$e(u),a=u;break e;case"link":var c=v0("link","href",n).get(a+(t.href||""));if(c){for(var s=0;sOe&&(c=Oe,Oe=K,K=c);var h=jf(s,K),o=jf(s,Oe);if(h&&o&&(v.rangeCount!==1||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==o.node||v.focusOffset!==o.offset)){var y=S.createRange();y.setStart(h.node,h.offset),v.removeAllRanges(),K>Oe?(v.addRange(y),v.extend(o.node,o.offset)):(y.setEnd(o.node,o.offset),v.addRange(y))}}}}for(S=[],v=s;v=v.parentNode;)v.nodeType===1&&S.push({element:v,left:v.scrollLeft,top:v.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;st?32:t,b.T=null,t=Yc,Yc=null;var u=zt,c=ut;if(ke=0,Oa=zt=null,ut=0,(ve&6)!==0)throw Error(r(331));var s=ve;if(ve|=4,So(u.current),po(u,u.current,c,t),ve=s,Sn(0,!1),yl&&typeof yl.onPostCommitFiberRoot=="function")try{yl.onPostCommitFiberRoot(Ya,u)}catch{}return!0}finally{T.p=n,b.T=a,Vo(e,l)}}function Qo(e,l,t){l=Tl(t,l),l=bc(e.stateNode,l,2),e=gt(e,l,2),e!==null&&(Xa(e,2),Xl(e))}function Me(e,l,t){if(e.tag===3)Qo(e,e,t);else for(;l!==null;){if(l.tag===3){Qo(l,e,t);break}else if(l.tag===1){var a=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(St===null||!St.has(a))){e=Tl(t,e),t=Qr(2),a=gt(l,t,2),a!==null&&(Lr(t,a,l,e),Xa(a,2),Xl(a));break}}l=l.return}}function Lc(e,l,t){var a=e.pingCache;if(a===null){a=e.pingCache=new wm;var n=new Set;a.set(l,n)}else n=a.get(l),n===void 0&&(n=new Set,a.set(l,n));n.has(t)||(Rc=!0,n.add(t),e=Gm.bind(null,e,l,t),l.then(e,e))}function Gm(e,l,t){var a=e.pingCache;a!==null&&a.delete(l),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,De===e&&(fe&t)===t&&(Ye===4||Ye===3&&(fe&62914560)===fe&&300>hl()-Ou?(ve&2)===0&&Da(e,0):qc|=t,Ta===fe&&(Ta=0)),Xl(e)}function Lo(e,l){l===0&&(l=Rs()),e=Gt(e,l),e!==null&&(Xa(e,l),Xl(e))}function Ym(e){var l=e.memoizedState,t=0;l!==null&&(t=l.retryLane),Lo(e,t)}function Vm(e,l){var t=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;n!==null&&(t=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(l),Lo(e,t)}function Xm(e,l){return ai(e,l)}var qu=null,Ca=null,Zc=!1,Bu=!1,Kc=!1,Et=0;function Xl(e){e!==Ca&&e.next===null&&(Ca===null?qu=Ca=e:Ca=Ca.next=e),Bu=!0,Zc||(Zc=!0,Lm())}function Sn(e,l){if(!Kc&&Bu){Kc=!0;do for(var t=!1,a=qu;a!==null;){if(e!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var c=a.suspendedLanes,s=a.pingedLanes;u=(1<<31-xl(42|e)+1)-1,u&=n&~(c&~s),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(t=!0,ko(a,u))}else u=fe,u=Xn(a,a===De?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Va(a,u)||(t=!0,ko(a,u));a=a.next}while(t);Kc=!1}}function Qm(){Zo()}function Zo(){Bu=Zc=!1;var e=0;Et!==0&&eh()&&(e=Et);for(var l=hl(),t=null,a=qu;a!==null;){var n=a.next,u=Ko(a,l);u===0?(a.next=null,t===null?qu=n:t.next=n,n===null&&(Ca=t)):(t=a,(e!==0||(u&3)!==0)&&(Bu=!0)),a=n}ke!==0&&ke!==5||Sn(e),Et!==0&&(Et=0)}function Ko(e,l){for(var t=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,u=e.pendingLanes&-62914561;0s)break;var j=f.transferSize,S=f.initiatorType;j&&t0(S)&&(f=f.responseEnd,c+=j*(f"u"?null:document;function h0(e,l,t){var a=wa;if(a&&typeof l=="string"&&l){var n=_l(l);n='link[rel="'+e+'"][href="'+n+'"]',typeof t=="string"&&(n+='[crossorigin="'+t+'"]'),m0.has(n)||(m0.add(n),e={rel:e,crossOrigin:t,href:l},a.querySelector(n)===null&&(l=a.createElement("link"),ll(l,"link",e),$e(l),a.head.appendChild(l)))}}function fh(e){it.D(e),h0("dns-prefetch",e,null)}function rh(e,l){it.C(e,l),h0("preconnect",e,l)}function oh(e,l,t){it.L(e,l,t);var a=wa;if(a&&e&&l){var n='link[rel="preload"][as="'+_l(l)+'"]';l==="image"&&t&&t.imageSrcSet?(n+='[imagesrcset="'+_l(t.imageSrcSet)+'"]',typeof t.imageSizes=="string"&&(n+='[imagesizes="'+_l(t.imageSizes)+'"]')):n+='[href="'+_l(e)+'"]';var u=n;switch(l){case"style":u=Ha(e);break;case"script":u=Ra(e)}Hl.has(u)||(e=D({rel:"preload",href:l==="image"&&t&&t.imageSrcSet?void 0:e,as:l},t),Hl.set(u,e),a.querySelector(n)!==null||l==="style"&&a.querySelector(_n(u))||l==="script"&&a.querySelector(An(u))||(l=a.createElement("link"),ll(l,"link",e),$e(l),a.head.appendChild(l)))}}function dh(e,l){it.m(e,l);var t=wa;if(t&&e){var a=l&&typeof l.as=="string"?l.as:"script",n='link[rel="modulepreload"][as="'+_l(a)+'"][href="'+_l(e)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ra(e)}if(!Hl.has(u)&&(e=D({rel:"modulepreload",href:e},l),Hl.set(u,e),t.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(t.querySelector(An(u)))return}a=t.createElement("link"),ll(a,"link",e),$e(a),t.head.appendChild(a)}}}function mh(e,l,t){it.S(e,l,t);var a=wa;if(a&&e){var n=aa(a).hoistableStyles,u=Ha(e);l=l||"default";var c=n.get(u);if(!c){var s={loading:0,preload:null};if(c=a.querySelector(_n(u)))s.loading=5;else{e=D({rel:"stylesheet",href:e,"data-precedence":l},t),(t=Hl.get(u))&&ss(e,t);var f=c=a.createElement("link");$e(f),ll(f,"link",e),f._p=new Promise(function(x,j){f.onload=x,f.onerror=j}),f.addEventListener("load",function(){s.loading|=1}),f.addEventListener("error",function(){s.loading|=2}),s.loading|=4,Qu(c,l,a)}c={type:"stylesheet",instance:c,count:1,state:s},n.set(u,c)}}}function hh(e,l){it.X(e,l);var t=wa;if(t&&e){var a=aa(t).hoistableScripts,n=Ra(e),u=a.get(n);u||(u=t.querySelector(An(n)),u||(e=D({src:e,async:!0},l),(l=Hl.get(n))&&fs(e,l),u=t.createElement("script"),$e(u),ll(u,"link",e),t.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function yh(e,l){it.M(e,l);var t=wa;if(t&&e){var a=aa(t).hoistableScripts,n=Ra(e),u=a.get(n);u||(u=t.querySelector(An(n)),u||(e=D({src:e,async:!0,type:"module"},l),(l=Hl.get(n))&&fs(e,l),u=t.createElement("script"),$e(u),ll(u,"link",e),t.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function y0(e,l,t,a){var n=(n=ae.current)?Xu(n):null;if(!n)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof t.precedence=="string"&&typeof t.href=="string"?(l=Ha(t.href),t=aa(n).hoistableStyles,a=t.get(l),a||(a={type:"style",instance:null,count:0,state:null},t.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(t.rel==="stylesheet"&&typeof t.href=="string"&&typeof t.precedence=="string"){e=Ha(t.href);var u=aa(n).hoistableStyles,c=u.get(e);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,c),(u=n.querySelector(_n(e)))&&!u._p&&(c.instance=u,c.state.loading=5),Hl.has(e)||(t={rel:"preload",as:"style",href:t.href,crossOrigin:t.crossOrigin,integrity:t.integrity,media:t.media,hrefLang:t.hrefLang,referrerPolicy:t.referrerPolicy},Hl.set(e,t),u||xh(n,e,t,c.state))),l&&a===null)throw Error(r(528,""));return c}if(l&&a!==null)throw Error(r(529,""));return null;case"script":return l=t.async,t=t.src,typeof t=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ra(t),t=aa(n).hoistableScripts,a=t.get(l),a||(a={type:"script",instance:null,count:0,state:null},t.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ha(e){return'href="'+_l(e)+'"'}function _n(e){return'link[rel="stylesheet"]['+e+"]"}function x0(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function xh(e,l,t,a){e.querySelector('link[rel="preload"][as="style"]['+l+"]")?a.loading=1:(l=e.createElement("link"),a.preload=l,l.addEventListener("load",function(){return a.loading|=1}),l.addEventListener("error",function(){return a.loading|=2}),ll(l,"link",t),$e(l),e.head.appendChild(l))}function Ra(e){return'[src="'+_l(e)+'"]'}function An(e){return"script[async]"+e}function g0(e,l,t){if(l.count++,l.instance===null)switch(l.type){case"style":var a=e.querySelector('style[data-href~="'+_l(t.href)+'"]');if(a)return l.instance=a,$e(a),a;var n=D({},t,{"data-href":t.href,"data-precedence":t.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),$e(a),ll(a,"style",n),Qu(a,t.precedence,e),l.instance=a;case"stylesheet":n=Ha(t.href);var u=e.querySelector(_n(n));if(u)return l.state.loading|=4,l.instance=u,$e(u),u;a=x0(t),(n=Hl.get(n))&&ss(a,n),u=(e.ownerDocument||e).createElement("link"),$e(u);var c=u;return c._p=new Promise(function(s,f){c.onload=s,c.onerror=f}),ll(u,"link",a),l.state.loading|=4,Qu(u,t.precedence,e),l.instance=u;case"script":return u=Ra(t.src),(n=e.querySelector(An(u)))?(l.instance=n,$e(n),n):(a=t,(n=Hl.get(u))&&(a=D({},t),fs(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),$e(n),ll(n,"link",a),e.head.appendChild(n),l.instance=n);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(a=l.instance,l.state.loading|=4,Qu(a,t.precedence,e));return l.instance}function Qu(e,l,t){for(var a=t.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,c=0;c title"):null)}function gh(e,l,t){if(t===1||l.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return e=l.disabled,typeof l.precedence=="string"&&e==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function p0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function vh(e,l,t,a){if(t.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(t.state.loading&4)===0){if(t.instance===null){var n=Ha(a.href),u=l.querySelector(_n(n));if(u){l=u._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(e.count++,e=Zu.bind(e),l.then(e,e)),t.state.loading|=4,t.instance=u,$e(u);return}u=l.ownerDocument||l,a=x0(a),(n=Hl.get(n))&&ss(a,n),u=u.createElement("link"),$e(u);var c=u;c._p=new Promise(function(s,f){c.onload=s,c.onerror=f}),ll(u,"link",a),t.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(t,l),(l=t.state.preload)&&(t.state.loading&3)===0&&(e.count++,t=Zu.bind(e),l.addEventListener("load",t),l.addEventListener("error",t))}}var rs=0;function bh(e,l){return e.stylesheets&&e.count===0&&Ju(e,e.stylesheets),0rs?50:800)+l);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ju(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ku=null;function Ju(e,l){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ku=new Map,l.forEach(ph,e),Ku=null,Zu.call(e))}function ph(e,l){if(!(l.state.loading&4)){var t=Ku.get(e);if(t)var a=t.get(null);else{t=new Map,Ku.set(e,t);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d)}catch(_){console.error(_)}}return d(),bs.exports=qh(),bs.exports}var Gh=Bh();const Yh=F0(Gh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vh=d=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xh=d=>d.replace(/^([A-Z])|[\s-_]+(\w)/g,(_,M,r)=>r?r.toUpperCase():M.toLowerCase()),L0=d=>{const _=Xh(d);return _.charAt(0).toUpperCase()+_.slice(1)},I0=(...d)=>d.filter((_,M,r)=>!!_&&_.trim()!==""&&r.indexOf(_)===M).join(" ").trim(),Qh=d=>{for(const _ in d)if(_.startsWith("aria-")||_==="role"||_==="title")return!0};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var Lh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Zh=G.forwardRef(({color:d="currentColor",size:_=24,strokeWidth:M=2,absoluteStrokeWidth:r,className:w="",children:A,iconNode:k,...Z},E)=>G.createElement("svg",{ref:E,...Lh,width:_,height:_,stroke:d,strokeWidth:r?Number(M)*24/Number(_):M,className:I0("lucide",w),...!A&&!Qh(Z)&&{"aria-hidden":"true"},...Z},[...k.map(([p,Y])=>G.createElement(p,Y)),...Array.isArray(A)?A:[A]]));/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q=(d,_)=>{const M=G.forwardRef(({className:r,...w},A)=>G.createElement(Zh,{ref:A,iconNode:_,className:I0(`lucide-${Vh(L0(d))}`,`lucide-${d}`,r),...w}));return M.displayName=L0(d),M};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kh=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Jh=Q("bot",Kh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kh=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Es=Q("box",kh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $h=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ss=Q("check",$h);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wh=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_s=Q("chevron-down",Wh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fh=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ih=Q("chevron-left",Fh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ph=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],e1=Q("circle-alert",Ph);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Z0=Q("circle-x",l1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const t1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],a1=Q("copy",t1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n1=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],u1=Q("credit-card",n1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],As=Q("download",i1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],s1=Q("ellipsis",c1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],r1=Q("external-link",f1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ts=Q("file-text",o1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],K0=Q("history",d1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],P0=Q("image",m1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],y1=Q("info",h1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],g1=Q("key-round",x1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v1=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],b1=Q("languages",v1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],j1=Q("laptop",p1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],S1=Q("layers",N1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z1=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],ed=Q("lightbulb",z1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M1=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],E1=Q("link",M1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],J0=Q("loader-circle",_1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A1=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],ld=Q("log-in",A1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],O1=Q("log-out",T1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],U1=Q("maximize-2",D1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],w1=Q("message-square-text",C1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H1=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],R1=Q("mic",H1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],B1=Q("monitor",q1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G1=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],li=Q("music",G1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Os=Q("pause",Y1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V1=[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]],X1=Q("pen-tool",V1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],It=Q("play",Q1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rn=Q("plus",L1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],K1=Q("refresh-cw",Z1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],k1=Q("send",J1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $1=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],zs=Q("share-2",$1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],F1=Q("shield",W1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I1=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],P1=Q("skip-back",I1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ey=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],ly=Q("skip-forward",ey);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ty=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ay=Q("smartphone",ty);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ny=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],qn=Q("sparkles",ny);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uy=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],k0=Q("star",uy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iy=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],cy=Q("tag",iy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sy=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],$0=Q("trash-2",sy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fy=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],ry=Q("type",fy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oy=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],dy=Q("upload",oy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const my=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],hy=Q("user",my);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yy=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Us=Q("video",yy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xy=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],gy=Q("volume-2",xy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vy=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],by=Q("wallet",vy);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const py=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],td=Q("wand-sparkles",py);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ba=Q("x",jy);var C=(d=>(d.VIDEO="video",d.IMAGE="image",d.TEXT="text",d.MUSIC="music",d))(C||{}),zl=(d=>(d.IDLE="idle",d.WAITING="waiting",d.GENERATING="generating",d.COMPLETED="completed",d.FAILED="failed",d))(zl||{});const Ny=15,Sy=({activeTab:d,setActiveTab:_,onOpenUserModal:M})=>{const r=w=>` + flex items-center gap-3 px-4 py-3 cursor-pointer transition-colors duration-200 text-sm font-medium rounded-lg mx-2 + ${d===w?"bg-blue-600 text-white shadow-md":"text-gray-600 hover:bg-gray-100"} + `;return i.jsxs("div",{className:"w-64 bg-white h-screen flex flex-col border-r border-gray-200 flex-shrink-0 z-20 font-sans",children:[i.jsx("div",{className:"h-16 flex items-center px-6 border-b border-gray-100",children:i.jsxs("div",{className:"flex items-center gap-2 font-bold text-xl text-gray-800 tracking-tight",children:[i.jsx(S1,{className:"text-blue-600",size:24}),i.jsx("span",{children:"朴见潮音"})]})}),i.jsxs("nav",{className:"flex-1 py-4 flex flex-col gap-1",children:[i.jsxs("div",{className:r(C.VIDEO),onClick:()=>_(C.VIDEO),children:[i.jsx(Us,{size:18}),i.jsx("span",{children:"Sora2 视频"})]}),i.jsxs("div",{className:r(C.MUSIC),onClick:()=>_(C.MUSIC),children:[i.jsx(li,{size:18}),i.jsx("span",{children:"Suno 音乐"})]}),i.jsxs("div",{className:r(C.IMAGE),onClick:()=>_(C.IMAGE),children:[i.jsx(P0,{size:18}),i.jsx("span",{children:"Nano Banana 图片"})]}),i.jsxs("div",{className:r(C.TEXT),onClick:()=>_(C.TEXT),children:[i.jsx(w1,{size:18}),i.jsx("span",{children:"Gemini 文本"})]}),i.jsxs("div",{className:"mt-12 flex flex-col items-center justify-center text-gray-300 gap-2",children:[i.jsx(Es,{size:48,strokeWidth:1}),i.jsx("span",{className:"text-xs",children:"暂无创作记录"})]})]}),i.jsx("div",{className:"p-4 border-t border-gray-200 bg-gray-50",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>M("recharge"),children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-xs font-bold",children:"用"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs font-bold text-gray-700",children:"用户0666"}),i.jsx("span",{className:"text-[10px] text-blue-500 font-semibold",children:"4980 积分"})]})]}),i.jsx(O1,{size:16,className:"text-gray-400 cursor-pointer hover:text-red-500 transition-colors",onClick:()=>M("login")})]})})]})},Hn=async()=>!0,Ga=async()=>{const d=window;d.aistudio&&d.aistudio.openSelectKey?await d.aistudio.openSelectKey():console.log("API Key selection skipped for simulation.")},ad=async(d,_,M)=>(console.log("Simulating Video Generation...",{prompt:d,config:_}),await new Promise(r=>setTimeout(r,3e3)),"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"),nd=async(d,_,M)=>(console.log("Simulating Image Generation...",{prompt:d,config:_}),await new Promise(w=>setTimeout(w,2e3)),`https://picsum.photos/seed/${Math.floor(Math.random()*1e3)}/1024/1024`),zy=async d=>(await new Promise(_=>setTimeout(_,1500)),`(Verse 1) +Neon lights are calling my name +In the city of digital rain +Walking through the static noise +Searching for a brand new voice + +(Chorus) +Cyber heart, electric soul +Programming the rock and roll +System glitch in the melody +This is our virtual destiny`),ud=async(d,_,M,r)=>{console.log("Simulating Music Generation...",{lyrics:d,style:_,isInstrumental:M,title:r}),await new Promise(A=>setTimeout(A,3e3));const w=[{id:Date.now(),title:r?`${r} (Ver 1)`:"Untitled Song (Ver 1)",style:_||"Pop",url:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",cover:`https://picsum.photos/seed/${Math.random()}/200/200`,lyrics:d||"[Instrumental]"},{id:Date.now()+1,title:r?`${r} (Ver 2)`:"Untitled Song (Ver 2)",style:_||"Pop",url:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",cover:`https://picsum.photos/seed/${Math.random()+1}/200/200`,lyrics:d||"[Instrumental]"}];return JSON.stringify(w)},My=async function*(d,_,M){const A=((k,Z)=>{const E=[];for(let p=0;psetTimeout(Z,100)),yield k},Ey=({config:d,setConfig:_,onBatchGenerate:M,onDelete:r,generating:w,viewMode:A,setViewMode:k,activeTab:Z,onNewChat:E,onOpenDigitalManager:p})=>Z===C.TEXT?i.jsxs("div",{className:"bg-white px-6 py-4 border-b border-gray-200 flex items-center justify-between shadow-sm sticky top-0 z-10 min-h-[72px]",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2 font-bold text-lg text-gray-800",children:[i.jsx(qn,{className:"text-gray-700",size:20}),i.jsx("span",{children:"Gemini"})]}),i.jsxs("div",{className:"relative group",children:[i.jsxs("select",{className:"appearance-none bg-gray-50 border border-gray-200 text-gray-700 text-sm rounded-lg pl-4 pr-10 py-2 focus:outline-none focus:ring-1 focus:ring-blue-500 hover:bg-gray-100 transition-colors cursor-pointer min-w-[220px]",value:d.textModel,onChange:Y=>_({...d,textModel:Y.target.value}),children:[i.jsx("option",{value:"gemini-flash-lite",children:"Gemini 2.5 Flash Lite (快速)"}),i.jsx("option",{value:"gemini-flash",children:"Gemini 2.5 Flash (均衡)"}),i.jsx("option",{value:"gemini-pro",children:"Gemini 2.0 Pro (强大)"})]}),i.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-gray-500",children:i.jsx(_s,{size:14})})]})]}),i.jsxs("button",{onClick:E,className:"bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors shadow-sm flex items-center gap-2",children:[i.jsx(Rn,{size:16}),"新建对话"]})]}):i.jsxs("div",{className:"bg-white px-6 py-4 border-b border-gray-200 flex items-center justify-between shadow-sm sticky top-0 z-10 min-h-[72px]",children:[i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[i.jsx("button",{onClick:()=>k("efficiency"),className:`px-3 py-1 rounded text-xs font-medium transition-all ${A==="efficiency"?"bg-gray-800 text-white shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:"效率"}),i.jsx("button",{onClick:()=>k("simple"),className:`px-3 py-1 rounded text-xs font-medium transition-all ${A==="simple"?"bg-gray-800 text-white shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:"简约"})]}),Z===C.VIDEO&&i.jsxs("button",{onClick:p,className:"px-3 py-1.5 rounded-full bg-purple-100 text-purple-700 text-xs font-bold flex items-center gap-1 border border-purple-200 hover:bg-purple-200 transition-colors cursor-pointer",title:"管理数字人物",children:[i.jsx(td,{size:12})," 数字对象"]}),A==="efficiency"&&Z!==C.MUSIC&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 animate-in fade-in slide-in-from-left-4 duration-300",children:[i.jsx("label",{children:"比例"}),i.jsxs("select",{className:"border border-gray-300 rounded px-2 py-1.5 bg-white text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500 min-w-[120px]",value:d.aspectRatio,onChange:Y=>_({...d,aspectRatio:Y.target.value}),children:[i.jsx("option",{value:"9:16",children:"9:16 竖屏"}),i.jsx("option",{value:"16:9",children:"16:9 横屏"}),i.jsx("option",{value:"1:1",children:"1:1 方形"})]})]}),Z===C.VIDEO&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 animate-in fade-in slide-in-from-left-4 duration-300 delay-75",children:[i.jsx("label",{children:"时长"}),i.jsxs("select",{className:"border border-gray-300 rounded px-2 py-1.5 bg-white text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500",value:d.duration,onChange:Y=>_({...d,duration:Y.target.value}),children:[i.jsx("option",{value:"5s",children:"5s"}),i.jsx("option",{value:"10s",children:"10s"}),i.jsx("option",{value:"15s",children:"15s"})]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 animate-in fade-in slide-in-from-left-4 duration-300 delay-100",children:[i.jsx("label",{children:"清晰度"}),i.jsxs("select",{className:"border border-gray-300 rounded px-2 py-1.5 bg-white text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500",value:d.resolution,onChange:Y=>_({...d,resolution:Y.target.value}),children:[i.jsx("option",{value:"HD",children:"高清"}),i.jsx("option",{value:"4K",children:"4K 超清"}),Z===C.IMAGE&&i.jsx("option",{value:"2K",children:"2K 高清"})]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("button",{onClick:Ga,className:"text-xs text-gray-500 hover:text-blue-600 flex items-center gap-1 underline",children:[i.jsx(g1,{size:12})," API Key"]}),A==="efficiency"&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:M,disabled:w,className:`px-5 py-1.5 rounded-full text-sm font-medium transition-colors shadow-sm animate-in fade-in zoom-in-95 + ${w?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-gray-200 text-gray-700 hover:bg-gray-300 hover:text-gray-900"}`,children:w?"生成中...":"批量生成"}),i.jsx("button",{onClick:r,className:"px-5 py-1.5 bg-gray-100 text-gray-500 rounded-full text-sm font-medium hover:bg-red-50 hover:text-red-600 transition-colors animate-in fade-in zoom-in-95",children:"删除"})]})]})]}),_y=()=>i.jsxs("div",{className:"bg-blue-50 border-b border-blue-100 px-6 py-2 flex items-center justify-between text-xs text-blue-700",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(y1,{size:14,className:"text-blue-500"}),i.jsxs("span",{children:[i.jsx("span",{className:"font-bold",children:"快捷键:"})," 选中单行或多行后使用",i.jsx("span",{className:"mx-1 px-1.5 py-0.5 bg-white border border-blue-200 rounded text-[10px] font-mono shadow-sm",children:"Ctrl+C"})," 复制,",i.jsx("span",{className:"mx-1 px-1.5 py-0.5 bg-white border border-blue-200 rounded text-[10px] font-mono shadow-sm",children:"Ctrl+V"})," 粘贴. 如需粘贴到指定行,请先选中目标行。(支持外部图片复制粘贴)"]})]}),i.jsx("button",{className:"text-blue-400 hover:text-blue-600",children:i.jsx(Ba,{size:14})})]}),Ay=({task:d,activeTab:_,onChange:M,onGenerate:r,onClear:w})=>{const A=G.useRef(null),k=E=>{var Y;const p=(Y=E.target.files)==null?void 0:Y[0];if(p){const D=new FileReader;D.onloadend=()=>{M(d.id,"referenceImage",D.result)},D.readAsDataURL(p)}},Z=()=>{switch(d.status){case zl.GENERATING:return i.jsxs("span",{className:"text-blue-600 animate-pulse flex items-center gap-1 text-xs",children:[i.jsx(K1,{size:12,className:"animate-spin"})," 生成中"]});case zl.COMPLETED:return i.jsx("span",{className:"text-green-600 font-medium text-xs",children:"完成"});case zl.FAILED:return i.jsxs("span",{className:"text-red-500 flex items-center gap-1 text-xs",children:[i.jsx(Z0,{size:12})," 失败"]});default:return i.jsx("span",{className:"text-gray-400 text-xs",children:"等待"})}};return i.jsxs("div",{className:`flex items-center border-b border-gray-100 hover:bg-gray-50 transition-colors group h-14 text-sm ${d.selected?"bg-blue-50/30":""}`,children:[i.jsx("div",{className:"w-12 flex justify-center flex-shrink-0 border-r border-gray-100 h-full items-center",children:i.jsx("input",{type:"checkbox",checked:d.selected,onChange:E=>M(d.id,"selected",E.target.checked),className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})}),i.jsx("div",{className:"w-12 flex justify-center flex-shrink-0 border-r border-gray-100 h-full items-center text-gray-400 text-xs",children:d.id}),_===C.MUSIC?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 border-r border-gray-100 h-full",children:i.jsx("input",{type:"text",value:d.prompt,onChange:E=>M(d.id,"prompt",E.target.value),placeholder:"输入歌词或描述...",className:"w-full h-full px-3 bg-transparent focus:outline-none focus:bg-white focus:ring-2 focus:ring-inset focus:ring-blue-100 text-gray-700 placeholder-gray-400 text-xs"})}),i.jsx("div",{className:"w-32 border-r border-gray-100 h-full",children:i.jsx("input",{type:"text",value:d.musicStyle||"",onChange:E=>M(d.id,"musicStyle",E.target.value),placeholder:"风格 (Pop...)",className:"w-full h-full px-3 bg-transparent focus:outline-none focus:bg-white focus:ring-2 focus:ring-inset focus:ring-blue-100 text-gray-700 placeholder-gray-400 text-xs"})}),i.jsx("div",{className:"w-32 border-r border-gray-100 h-full",children:i.jsx("input",{type:"text",value:d.musicTitle||"",onChange:E=>M(d.id,"musicTitle",E.target.value),placeholder:"标题...",className:"w-full h-full px-3 bg-transparent focus:outline-none focus:bg-white focus:ring-2 focus:ring-inset focus:ring-blue-100 text-gray-700 placeholder-gray-400 text-xs"})}),i.jsx("div",{className:"w-16 border-r border-gray-100 h-full flex items-center justify-center",children:i.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 cursor-pointer",onClick:()=>M(d.id,"isInstrumental",!d.isInstrumental),children:[i.jsx("div",{className:`w-4 h-4 border rounded flex items-center justify-center transition-colors ${d.isInstrumental?"bg-blue-600 border-blue-600":"border-gray-300 bg-white"}`,children:d.isInstrumental&&i.jsx(li,{size:10,className:"text-white"})}),i.jsx("span",{className:"text-[10px] text-gray-500",children:"纯音"})]})})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 border-r border-gray-100 h-full",children:i.jsx("input",{type:"text",value:d.prompt,onChange:E=>M(d.id,"prompt",E.target.value),placeholder:"请输入提示词...",className:"w-full h-full px-4 bg-transparent focus:outline-none focus:bg-white focus:ring-2 focus:ring-inset focus:ring-blue-100 transition-all text-gray-700 placeholder-gray-400"})}),i.jsx("div",{className:"w-32 border-r border-gray-100 h-full flex items-center justify-center p-2",children:i.jsxs("div",{onClick:()=>{var E;return(E=A.current)==null?void 0:E.click()},className:"w-full h-full border border-dashed border-gray-300 rounded hover:border-blue-400 hover:bg-blue-50 cursor-pointer flex items-center justify-center overflow-hidden relative transition-colors",children:[d.referenceImage?i.jsx("img",{src:d.referenceImage,alt:"Ref",className:"w-full h-full object-cover"}):i.jsx(Rn,{size:16,className:"text-gray-400"}),i.jsx("input",{type:"file",ref:A,className:"hidden",accept:"image/*",onChange:k})]})})]}),i.jsx("div",{className:"w-24 border-r border-gray-100 h-full flex items-center justify-center px-2",children:Z()}),i.jsxs("div",{className:"w-20 border-r border-gray-100 h-full flex items-center justify-center gap-1",children:[i.jsx("button",{className:"text-gray-400 hover:text-gray-600 px-1",onClick:()=>{d.count>1&&M(d.id,"count",d.count-1)},children:"-"}),i.jsx("span",{className:"text-gray-600 text-xs w-4 text-center",children:d.count}),i.jsx("button",{className:"text-gray-400 hover:text-gray-600 px-1",onClick:()=>{M(d.id,"count",d.count+1)},children:"+"})]}),i.jsxs("div",{className:"w-28 h-full flex items-center justify-center gap-2 px-2",children:[d.status===zl.COMPLETED&&d.resultUrl?i.jsx("button",{onClick:()=>{alert("批量模式下请在生成记录或详细视图查看结果")},className:"px-3 py-1 bg-green-100 text-green-700 text-xs rounded hover:bg-green-200",children:"查看结果"}):i.jsx("button",{onClick:()=>r(d.id),disabled:d.status===zl.GENERATING||!d.prompt,className:`px-3 py-1 rounded text-xs font-medium transition-colors + ${d.status===zl.GENERATING||!d.prompt?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-gray-200 text-gray-600 hover:bg-blue-500 hover:text-white"}`,children:"生成"}),i.jsx("button",{onClick:()=>w(d.id),className:"text-xs text-gray-400 hover:text-red-500",children:i.jsx(Z0,{size:14})})]})]})},Ty=({config:d,setConfig:_,activeTab:M})=>{const[r,w]=G.useState(""),[A,k]=G.useState(""),[Z,E]=G.useState(""),[p,Y]=G.useState(!1),[D,R]=G.useState(1),[se,Se]=G.useState(null),[ge,Ue]=G.useState(!1),[be,$]=G.useState([]),[ue,L]=G.useState(null),[me,V]=G.useState(!1),[P,Je]=G.useState(null),[al,Ml]=G.useState(null),[qe,W]=G.useState(null),[pe,te]=G.useState(!1),oe=G.useRef(null),[b,T]=G.useState(!1),[J,je]=G.useState(""),Ne=G.useRef(null);G.useEffect(()=>()=>{oe.current&&(oe.current.pause(),oe.current=null)},[]),G.useEffect(()=>{oe.current&&(oe.current.playbackRate=D)},[D]);const m=O=>{var Ce;const ne=(Ce=O.target.files)==null?void 0:Ce[0];if(ne){const _e=new FileReader;_e.onloadend=()=>{L(_e.result)},_e.readAsDataURL(ne)}},z=async()=>{if(!Z&&!A){alert("请输入标题或风格以便AI生成歌词");return}Ue(!0);try{const O=await zy(Z+" "+A);w(O)}catch(O){console.error(O)}finally{Ue(!1)}},U=async()=>{if(M===C.MUSIC&&!p&&!r||M===C.MUSIC&&p&&!A||M!==C.MUSIC&&!r)return;if(!await Hn()){await Ga();return}if(V(!0),Ml(null),Je(null),M===C.MUSIC){const ne=Date.now().toString(),Ce=(Date.now()+1).toString(),_e=[{id:ne,title:Z||"Generating...",style:A,url:"",cover:"",lyrics:r,duration:"--:--",status:"generating",createdAt:Date.now(),isExtension:!!se},{id:Ce,title:Z||"Generating...",style:A,url:"",cover:"",lyrics:r,duration:"--:--",status:"generating",createdAt:Date.now(),isExtension:!!se}];$(ul=>[..._e,...ul]);try{const ul=await ud(r,A,p,Z),ml=JSON.parse(ul);$(ct=>ct.map(Pt=>Pt.id===ne&&ml[0]?{...ml[0],status:"completed",duration:"3:45",createdAt:Date.now(),isExtension:!!se,parentTrackId:se==null?void 0:se.id}:Pt.id===Ce&&ml[1]?{...ml[1],status:"completed",duration:"3:45",createdAt:Date.now(),isExtension:!!se,parentTrackId:se==null?void 0:se.id}:Pt)),Se(null)}catch(ul){$(ml=>ml.map(ct=>ct.id===ne||ct.id===Ce?{...ct,status:"failed"}:ct)),Ml(ul.message)}finally{V(!1)}return}try{let ne="";M===C.VIDEO?ne=await ad(r,d,ue):M===C.IMAGE&&(ne=await nd(r,d,ue)),Je(ne)}catch(ne){Ml(ne.message||"生成失败")}finally{V(!1)}},q=O=>{var ne,Ce;if(O.status==="completed")if((qe==null?void 0:qe.id)===O.id)if(pe)(ne=oe.current)==null||ne.pause(),te(!1);else{const _e=(Ce=oe.current)==null?void 0:Ce.play();_e!==void 0&&_e.then(()=>te(!0)).catch(ul=>{console.error("Playback error:",ul),te(!1)})}else{oe.current&&oe.current.pause(),W(O),te(!0);const _e=new Audio(O.url);_e.playbackRate=D,oe.current=_e,_e.onended=()=>te(!1);const ul=_e.play();ul!==void 0&&ul.catch(ml=>{ml.name!=="AbortError"&&console.error("Playback error:",ml),oe.current===_e&&te(!1)})}},F=O=>{je(O),T(!0)},ae=({track:O})=>{const ne=(qe==null?void 0:qe.id)===O.id;return i.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg border transition-all ${ne?"bg-blue-50 border-blue-200":"bg-white border-gray-100 hover:bg-gray-50"}`,children:[i.jsx("div",{className:"w-14 h-14 md:w-16 md:h-16 rounded-md bg-gray-200 flex-shrink-0 relative overflow-hidden group",children:O.status==="generating"?i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100",children:i.jsx(J0,{size:24,className:"text-blue-500 animate-spin"})}):O.status==="failed"?i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-red-50 text-red-400",children:i.jsx(Ba,{size:24})}):i.jsxs(i.Fragment,{children:[i.jsx("img",{src:O.cover,alt:"cover",className:"w-full h-full object-cover"}),i.jsx("div",{className:"absolute inset-0 bg-black/30 hidden group-hover:flex items-center justify-center cursor-pointer transition-colors",onClick:()=>q(O),children:ne&&pe?i.jsx(Os,{size:24,className:"text-white fill-white"}):i.jsx(It,{size:24,className:"text-white fill-white"})})]})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("h3",{className:`font-bold text-sm truncate ${ne?"text-blue-700":"text-gray-800"}`,children:O.title}),O.isExtension&&i.jsx("span",{className:"px-1.5 py-0.5 rounded bg-purple-100 text-purple-600 text-[10px] font-bold border border-purple-200 flex-shrink-0",children:"续写"}),O.status==="generating"&&i.jsx("span",{className:"text-xs text-blue-500 animate-pulse font-medium flex-shrink-0",children:"生成中..."})]}),i.jsxs("div",{className:"text-xs text-gray-500 truncate flex items-center gap-2",children:[i.jsx("span",{className:"truncate max-w-[80px] md:max-w-none",children:O.style||"Unknown Style"}),i.jsx("span",{children:"•"}),i.jsx("span",{className:"font-mono",children:O.duration}),O.createdAt&&i.jsxs("span",{className:"hidden md:inline",children:["• ",new Date(O.createdAt).toLocaleTimeString()]})]})]}),O.status==="completed"&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>{Se(O),k(O.style),E(O.title+" (Part 2)")},className:"p-2 text-gray-400 hover:text-purple-600 hover:bg-purple-50 rounded-full transition-colors hidden md:block",title:"续写 (Extend)",children:i.jsx(E1,{size:18})}),i.jsx("button",{onClick:()=>F(O.lyrics),className:"p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors hidden md:block",title:"歌词",children:i.jsx(Ts,{size:18})}),i.jsx("button",{className:"p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors",title:"下载视频",children:i.jsx(Us,{size:18})}),i.jsx("button",{className:"p-2 text-gray-400 hover:text-gray-600 rounded-full md:hidden",children:i.jsx(s1,{size:18})})]})]})},he=({value:O,label:ne,icon:Ce})=>i.jsxs("button",{onClick:()=>_({...d,aspectRatio:O}),className:`flex items-center gap-2 px-4 py-2 rounded-lg border text-sm font-medium transition-all + ${d.aspectRatio===O?"border-blue-500 text-blue-600 bg-blue-50":"border-gray-200 text-gray-600 hover:border-gray-300 bg-white"}`,children:[i.jsx(Ce,{size:16}),ne]}),Be=({type:O,value:ne,label:Ce})=>i.jsx("button",{onClick:()=>_({...d,[O]:ne}),className:`px-4 py-2 rounded-lg border text-sm font-medium transition-all min-w-[80px] + ${d[O]===ne?"border-blue-500 text-blue-600 bg-blue-50":"border-gray-200 text-gray-600 hover:border-gray-300 bg-white"}`,children:Ce}),Ee=({name:O,credits:ne,value:Ce,type:_e="image"})=>i.jsxs("button",{onClick:()=>_(_e==="music"?{...d,musicModel:Ce}:{...d,imageModel:Ce}),className:`flex flex-col items-start p-3 rounded-lg border text-sm transition-all text-left + ${(_e==="music"?d.musicModel:d.imageModel)===Ce?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300 bg-white"}`,children:[i.jsx("span",{className:`font-medium ${(_e==="music"?d.musicModel:d.imageModel)===Ce?"text-blue-700":"text-gray-700"}`,children:O}),ne&&i.jsx("span",{className:"text-xs text-gray-400 mt-1",children:ne})]}),Ct=({checked:O,onChange:ne,label:Ce})=>i.jsxs("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>ne(!O),children:[i.jsx("span",{className:"text-sm font-medium text-gray-700",children:Ce}),i.jsx("div",{className:`w-10 h-5 rounded-full relative transition-colors ${O?"bg-blue-600":"bg-gray-300"}`,children:i.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow-sm ${O?"left-[22px]":"left-0.5"}`})})]});return i.jsxs("div",{className:"flex w-full h-full bg-white font-sans relative flex-col-reverse md:flex-row",children:[i.jsxs("div",{className:"w-full md:w-[420px] flex-shrink-0 flex flex-col border-t md:border-t-0 md:border-r border-gray-100 h-1/2 md:h-full overflow-y-auto custom-scrollbar p-6 gap-6 z-20 bg-white pb-32",children:[M===C.IMAGE&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"模型版本"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Ee,{name:"Nano Banana Pro",credits:"1800积分",value:"Nano Banana Pro"}),i.jsx(Ee,{name:"Nano Banana Pro VT",credits:"1800积分",value:"Nano Banana Pro VT"}),i.jsx(Ee,{name:"Nano Banana",credits:"1400积分",value:"Nano Banana"}),i.jsx(Ee,{name:"Nano Banana Fast",credits:"440积分",value:"Nano Banana Fast"})]})]}),M===C.MUSIC&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"模型版本"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Ee,{type:"music",name:"Suno v3.5",value:"suno-v3.5"}),i.jsx(Ee,{type:"music",name:"Suno v3",value:"suno-v3"})]})]}),se&&M===C.MUSIC&&i.jsxs("div",{className:"bg-purple-50 border border-purple-100 rounded-xl p-3 flex items-center justify-between animate-in fade-in zoom-in-95",children:[i.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[i.jsx("div",{className:"w-10 h-10 bg-gray-200 rounded-md overflow-hidden flex-shrink-0",children:i.jsx("img",{src:se.cover,alt:"cover",className:"w-full h-full object-cover"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-xs text-purple-600 font-bold mb-0.5",children:"正在续写 (Extending)"}),i.jsx("div",{className:"text-sm font-bold text-gray-800 truncate",children:se.title})]})]}),i.jsx("button",{onClick:()=>Se(null),className:"p-1 hover:bg-purple-100 rounded-full text-purple-400",children:i.jsx(Ba,{size:16})})]}),M===C.VIDEO&&i.jsxs("div",{className:"bg-purple-50 border border-purple-100 rounded-xl p-4 flex gap-3",children:[i.jsx("div",{className:"mt-1",children:i.jsx(ed,{size:18,className:"text-purple-500 fill-purple-500"})}),i.jsxs("div",{className:"text-xs text-purple-700 leading-relaxed",children:[i.jsx("span",{className:"font-bold",children:"提示:"})," 创建数字人物时请先通过视频生成数字人物的特征,视频生成完成后即可使用数字人物进行二次创作。"]})]}),M!==C.MUSIC&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-sm font-medium text-gray-700 flex justify-between",children:["参考图",i.jsx("span",{className:"text-gray-400 text-xs font-normal",children:"(单张不超过10MB)"})]}),i.jsxs("div",{onClick:()=>{var O;return(O=Ne.current)==null?void 0:O.click()},className:"w-24 h-24 border-2 border-dashed border-gray-300 rounded-lg hover:border-blue-400 hover:bg-blue-50 cursor-pointer flex flex-col items-center justify-center transition-colors overflow-hidden relative group",children:[ue?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:ue,alt:"ref",className:"w-full h-full object-cover"}),i.jsx("div",{className:"absolute inset-0 bg-black/40 hidden group-hover:flex items-center justify-center text-white",children:i.jsx(Rn,{size:24})})]}):i.jsx(Rn,{size:24,className:"text-gray-400"}),i.jsx("input",{type:"file",ref:Ne,className:"hidden",accept:"image/*",onChange:m})]})]}),M===C.VIDEO&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"视频比例"}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(he,{value:"9:16",label:"9:16 竖屏",icon:ay}),i.jsx(he,{value:"16:9",label:"16:9 横屏",icon:B1})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"视频时长"}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(Be,{type:"duration",value:"15s",label:"15秒"}),i.jsx(Be,{type:"duration",value:"10s",label:"10秒"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"清晰度"}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(Be,{type:"resolution",value:"HD",label:"高清"}),i.jsx(Be,{type:"resolution",value:"4K",label:"默认"})]})]})]}),M===C.IMAGE&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"图片比例"}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{className:"w-full appearance-none bg-white border border-gray-200 text-gray-700 py-2.5 px-4 pr-8 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm",value:d.aspectRatio,onChange:O=>_({...d,aspectRatio:O.target.value}),children:[i.jsx("option",{value:"1:1",children:"自动"}),i.jsx("option",{value:"9:16",children:"9:16 竖屏"}),i.jsx("option",{value:"16:9",children:"16:9 横屏"}),i.jsx("option",{value:"4:3",children:"4:3 标准"})]}),i.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-500",children:i.jsx(_s,{size:16})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"图片清晰度"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Be,{type:"resolution",value:"2K",label:"2K 高清"}),i.jsx(Be,{type:"resolution",value:"4K",label:"4K 超清"}),i.jsx(Be,{type:"resolution",value:"1K",label:"1K 标准"})]})]})]}),M===C.MUSIC&&i.jsx(i.Fragment,{children:i.jsxs("div",{className:"bg-gray-50 rounded-xl p-4 space-y-4 border border-gray-100",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("label",{className:"text-sm font-bold text-gray-800 flex items-center gap-2",children:[i.jsx(ry,{size:14,className:"text-blue-600"})," 歌词 (Lyrics)"]}),i.jsxs("div",{className:"flex items-center gap-3",children:[!p&&i.jsxs("button",{onClick:z,disabled:ge,className:"text-xs bg-gradient-to-r from-blue-500 to-purple-500 text-white px-2 py-1 rounded-md flex items-center gap-1 shadow-sm hover:opacity-90 transition-opacity",children:[i.jsx(td,{size:10})," ",ge?"生成中...":"AI 写词"]}),i.jsx(Ct,{checked:p,onChange:Y,label:"纯音乐"})]})]}),!p&&i.jsx("textarea",{value:r,onChange:O=>w(O.target.value),placeholder:"输入歌词...",className:"w-full h-32 p-3 bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500 text-sm resize-none"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-sm font-bold text-gray-800 flex items-center gap-2",children:[i.jsx(R1,{size:14,className:"text-purple-600"})," 音乐风格 (Style of Music)"]}),i.jsx("textarea",{value:A,onChange:O=>k(O.target.value),placeholder:"例如:Pop, Upbeat, Female Vocals...",className:"w-full h-20 p-3 bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-1 focus:ring-purple-500 text-sm resize-none"}),i.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:["Pop","Rock","Electronic","Jazz","Piano","Guitar"].map(O=>i.jsx("button",{onClick:()=>k(ne=>ne?`${ne}, ${O}`:O),className:"px-2 py-1 text-xs bg-white border border-gray-200 rounded hover:bg-gray-100 text-gray-600",children:O},O))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-sm font-bold text-gray-800 flex items-center gap-2",children:[i.jsx(cy,{size:14,className:"text-green-600"})," 标题 (Title)"]}),i.jsx("input",{type:"text",value:Z,onChange:O=>E(O.target.value),placeholder:"输入歌曲标题...",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-1 focus:ring-green-500 text-sm"})]})]})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:"生成数量"}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{className:"w-full appearance-none bg-white border border-gray-200 text-gray-700 py-2.5 px-4 pr-8 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm",children:[i.jsx("option",{children:"1 个"}),i.jsx("option",{children:"2 个"}),i.jsx("option",{children:"3 个"})]}),i.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-500",children:i.jsx(_s,{size:16})})]})]}),M!==C.MUSIC&&i.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-[120px]",children:[i.jsx("label",{className:"text-sm font-medium text-gray-700",children:M===C.VIDEO?"提示词":"图片描述"}),i.jsx("textarea",{value:r,onChange:O=>w(O.target.value),placeholder:M===C.VIDEO?"请输入您想要生成的视频描述...":"请输入您想要生成的图片描述...",className:"w-full flex-1 p-3 bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-100 focus:border-blue-400 resize-none text-sm leading-relaxed"})]}),i.jsx("div",{className:"pt-2",children:i.jsxs("button",{onClick:U,disabled:me||(M===C.MUSIC?!p&&!r:!r),className:`w-full py-3 rounded-full text-sm font-bold tracking-wide transition-all shadow-md flex items-center justify-center + ${me||(M===C.MUSIC?!p&&!r&&!A:!r)?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gradient-to-r from-blue-600 to-blue-500 text-white hover:shadow-lg hover:-translate-y-0.5 active:scale-95 active:shadow-inner"}`,children:[me&&i.jsx(J0,{size:16,className:"animate-spin mr-2"}),me?(M===C.VIDEO||M===C.MUSIC,"生成中..."):M===C.VIDEO?"生成视频":M===C.MUSIC?"生成音乐":"生成图片"]})})]}),i.jsxs("div",{className:"flex-1 bg-gradient-to-br from-gray-50 via-gray-100/50 to-blue-50/20 p-4 md:p-8 flex flex-col relative overflow-hidden pb-24 h-1/2 md:h-full",children:[i.jsxs("div",{className:"absolute inset-0 pointer-events-none z-0",children:[i.jsx("div",{className:"absolute inset-0 opacity-[0.03] bg-[radial-gradient(#3b82f6_1px,transparent_1px)] [background-size:16px_16px]"}),i.jsx("div",{className:"absolute -inset-[100%] top-0 block h-full w-[200%] -skew-x-12 bg-gradient-to-r from-transparent via-white/40 to-transparent opacity-30 animate-shimmer"})]}),i.jsx("style",{children:` + @keyframes shimmer { + 0% { transform: translateX(-100%); } + 100% { transform: translateX(100%); } + } + .animate-shimmer { + animation: shimmer 8s infinite linear; + } + `}),i.jsxs("h2",{className:"text-lg font-bold text-gray-800 mb-4 z-10 flex items-center gap-2",children:[i.jsx(qn,{size:16,className:"text-blue-500 fill-blue-500"})," 生成结果"]}),i.jsx("div",{className:"flex-1 z-10 w-full min-h-0 relative flex flex-col",children:M===C.MUSIC?i.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar space-y-3 pb-20",children:be.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center text-gray-300 h-full",children:[i.jsx(li,{size:48,className:"text-gray-200 mb-4"}),i.jsx("p",{className:"text-sm font-medium text-gray-400",children:"暂无生成的音乐"})]}):be.map(O=>i.jsx(ae,{track:O},O.id))}):i.jsx("div",{className:"flex-1 flex items-center justify-center",children:me?i.jsxs("div",{className:"flex flex-col items-center justify-center z-10",children:[i.jsxs("div",{className:"relative w-20 h-20 mb-6",children:[i.jsx("div",{className:"absolute inset-0 border-4 border-gray-200/50 rounded-full"}),i.jsx("div",{className:"absolute inset-0 border-4 border-blue-500 rounded-full border-t-transparent animate-spin"}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i.jsx(qn,{size:24,className:"text-blue-500 animate-pulse"})})]}),i.jsx("div",{className:"text-gray-500 font-medium text-sm animate-pulse tracking-wide",children:M===C.VIDEO?"正在渲染视频...":"正在绘制图片..."})]}):P?i.jsxs("div",{className:"w-full h-full bg-black/5 rounded-2xl overflow-hidden shadow-2xl ring-1 ring-black/5 flex items-center justify-center backdrop-blur-sm relative group animate-in fade-in zoom-in-95 duration-500",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-white/10 to-transparent pointer-events-none z-20"}),i.jsxs("div",{className:"absolute top-4 right-4 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity z-30 transform translate-y-2 group-hover:translate-y-0 duration-300",children:[i.jsx("button",{className:"p-2 bg-black/40 text-white rounded-full hover:bg-black/60 backdrop-blur-md transition-colors shadow-lg",title:"下载",children:i.jsx(As,{size:18})}),i.jsx("button",{className:"p-2 bg-black/40 text-white rounded-full hover:bg-black/60 backdrop-blur-md transition-colors shadow-lg",title:"全屏",children:i.jsx(U1,{size:18})})]}),M===C.VIDEO?i.jsx("video",{src:P,controls:!0,autoPlay:!0,loop:!0,className:"w-full h-full object-contain max-h-full shadow-lg"}):i.jsx("img",{src:P,alt:"Result",className:"w-full h-full object-contain max-h-full shadow-lg transition-transform duration-700 hover:scale-[1.02]"})]}):al?i.jsxs("div",{className:"text-center p-8 bg-white/80 backdrop-blur-md rounded-2xl shadow-sm border border-red-100 max-w-md z-10 animate-in fade-in zoom-in-95",children:[i.jsx("div",{className:"text-red-500 font-bold mb-2",children:"生成失败"}),i.jsx("div",{className:"text-gray-500 text-sm",children:al})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center text-gray-300 z-10 h-full",children:[i.jsxs("div",{className:"w-64 h-48 mb-6 relative opacity-80 animate-[pulse_4s_ease-in-out_infinite]",children:[i.jsx("div",{className:"absolute inset-0 border-4 border-gray-200/50 rounded-lg transform rotate-[-6deg] bg-white/50 backdrop-blur-sm"}),i.jsx("div",{className:"absolute inset-0 border-4 border-gray-200 rounded-lg transform rotate-[6deg] bg-white/80 flex items-center justify-center shadow-sm",children:M===C.VIDEO?i.jsx(It,{size:48,className:"text-gray-200 fill-gray-100"}):i.jsx(P0,{size:48,className:"text-gray-200"})}),i.jsx("div",{className:"absolute bottom-4 left-4 bg-gray-300 px-2 py-0.5 rounded text-[10px] text-white font-bold shadow-sm",children:"Al View"})]}),i.jsx("p",{className:"text-sm font-medium text-gray-400",children:"请输入内容并点击生成以查看魔法"})]})})})]}),qe&&i.jsxs("div",{className:"absolute bottom-16 md:bottom-0 left-0 right-0 bg-white/95 backdrop-blur-lg border-t border-gray-200 shadow-[0_-4px_20px_rgba(0,0,0,0.1)] p-3 z-40 animate-in slide-in-from-bottom-full duration-300 flex items-center gap-4 px-4 md:px-6 h-20",children:[i.jsxs("div",{className:"w-12 h-12 rounded-lg overflow-hidden bg-gray-200 flex-shrink-0 relative group",children:[i.jsx("img",{src:qe.cover,alt:"Cover",className:"w-full h-full object-cover"}),i.jsx("div",{className:"absolute inset-0 bg-black/10"})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"font-bold text-gray-800 text-sm truncate",children:qe.title}),i.jsx("div",{className:"text-xs text-gray-500 truncate",children:qe.style})]}),i.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[i.jsx("button",{className:"text-gray-400 hover:text-gray-600 transition-colors hidden md:block",children:i.jsx(P1,{size:20})}),i.jsx("button",{onClick:()=>{var O,ne;if(pe)(O=oe.current)==null||O.pause(),te(!1);else{const Ce=(ne=oe.current)==null?void 0:ne.play();Ce!==void 0&&Ce.then(()=>te(!0)).catch(_e=>{console.error("Play error:",_e),te(!1)})}},className:"w-10 h-10 rounded-full bg-blue-600 text-white flex items-center justify-center hover:scale-105 transition-transform shadow-md flex-shrink-0",children:pe?i.jsx(Os,{size:20,fill:"currentColor"}):i.jsx(It,{size:20,fill:"currentColor",className:"ml-0.5"})}),i.jsx("button",{className:"text-gray-400 hover:text-gray-600 transition-colors hidden md:block",children:i.jsx(ly,{size:20})})]}),i.jsxs("div",{className:"relative group",children:[i.jsxs("button",{className:"flex items-center justify-center w-10 h-8 rounded border border-gray-200 bg-gray-50 text-xs font-bold text-gray-700 hover:bg-gray-100 transition-colors",children:[D,"x"]}),i.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 bg-white border border-gray-200 rounded-lg shadow-xl overflow-hidden hidden group-hover:flex flex-col w-16 animate-in fade-in zoom-in-95 duration-150",children:[2,1.5,1.25,1,.8,.5].map(O=>i.jsxs("button",{onClick:()=>R(O),className:`py-2 text-xs font-medium hover:bg-gray-100 ${D===O?"bg-blue-50 text-blue-600":"text-gray-700"}`,children:[O,"x"]},O))})]}),i.jsxs("div",{className:"w-24 hidden lg:flex items-center gap-2",children:[i.jsx(gy,{size:16,className:"text-gray-400"}),i.jsx("div",{className:"h-1 flex-1 bg-gray-200 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full w-2/3 bg-blue-500 rounded-full"})})]}),i.jsx("button",{onClick:()=>{oe.current&&oe.current.pause(),W(null),te(!1)},className:"text-gray-400 hover:text-red-500 transition-colors ml-2",children:i.jsx(Ba,{size:20})})]}),b&&i.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",onClick:()=>T(!1),children:i.jsxs("div",{className:"bg-white rounded-2xl max-w-lg w-full max-h-[80vh] flex flex-col shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200",onClick:O=>O.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-100 bg-gray-50/50",children:[i.jsxs("h3",{className:"font-bold text-gray-800 flex items-center gap-2",children:[i.jsx(Ts,{size:18,className:"text-blue-500"}),"歌词"]}),i.jsx("button",{onClick:()=>T(!1),className:"p-1 rounded-full hover:bg-gray-100 text-gray-400 hover:text-gray-600 transition-colors",children:i.jsx(Ba,{size:20})})]}),i.jsx("div",{className:"p-8 overflow-y-auto whitespace-pre-wrap text-gray-600 leading-relaxed text-center font-medium bg-white custom-scrollbar",children:J||"无歌词内容"}),i.jsx("div",{className:"p-4 border-t border-gray-100 bg-gray-50/50 flex justify-center",children:i.jsx("button",{onClick:()=>T(!1),className:"px-6 py-2 bg-gray-900 text-white rounded-lg text-sm font-medium hover:bg-gray-800 transition-colors",children:"关闭"})})]})})]})},Oy=({config:d})=>{const[_,M]=G.useState([]),[r,w]=G.useState(""),[A,k]=G.useState(!1),Z=G.useRef(null),E=()=>{var R;(R=Z.current)==null||R.scrollIntoView({behavior:"smooth"})};G.useEffect(()=>{E()},[_,A]);const p=async(R=r)=>{if(!R.trim()||A)return;if(!await Hn()){await Ga();return}const Se={id:Date.now().toString(),role:"user",text:R,timestamp:Date.now()};M(Ue=>[...Ue,Se]),w(""),k(!0);const ge=(Date.now()+1).toString();M(Ue=>[...Ue,{id:ge,role:"model",text:"",timestamp:Date.now()}]);try{const Ue=My(d.textModel,_,R);let be="";for await(const $ of Ue)be+=$,M(ue=>ue.map(L=>L.id===ge?{...L,text:be}:L))}catch(Ue){console.error("Chat error:",Ue),M(be=>be.map($=>$.id===ge?{...$,text:"抱歉,遇到了一些问题,请稍后再试。"}:$))}finally{k(!1)}},Y=R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),p())},D=({icon:R,title:se,desc:Se,prompt:ge})=>i.jsxs("div",{onClick:()=>p(ge),className:"bg-white border border-gray-100 p-4 rounded-xl hover:shadow-md hover:border-blue-200 cursor-pointer transition-all flex items-start gap-3 group",children:[i.jsx("div",{className:"p-2 bg-gray-50 rounded-lg group-hover:bg-blue-50 transition-colors text-gray-600 group-hover:text-blue-600",children:i.jsx(R,{size:18})}),i.jsxs("div",{children:[i.jsx("div",{className:"font-bold text-gray-800 text-sm mb-1",children:se}),i.jsx("div",{className:"text-xs text-gray-500",children:Se})]})]});return i.jsxs("div",{className:"flex flex-col h-full bg-gray-50/50 relative",children:[i.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 pb-32",children:_.length===0?i.jsxs("div",{className:"h-full flex flex-col items-center justify-center max-w-3xl mx-auto -mt-16 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[i.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-blue-500 to-purple-600 rounded-2xl flex items-center justify-center mb-6 shadow-lg shadow-blue-200",children:i.jsx(qn,{className:"text-white",size:32})}),i.jsx("h1",{className:"text-2xl font-bold text-gray-800 mb-2",children:"开始对话"}),i.jsx("p",{className:"text-gray-500 mb-10 text-center max-w-lg",children:"我是 Gemini,一个强大的 AI 助手。我可以帮助你回答问题、写作、编程、分析等各种任务。"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 w-full",children:[i.jsx(D,{icon:X1,title:"写作助手",desc:"帮我写一篇文章、邮件或文案",prompt:"请帮我写一篇关于人工智能未来发展的短文,风格轻松活泼。"}),i.jsx(D,{icon:ed,title:"知识问答",desc:"解释复杂的概念或回答问题",prompt:"请用通俗易懂的语言解释量子计算的基本原理。"}),i.jsx(D,{icon:j1,title:"编程辅助",desc:"生成代码、调试或解释代码",prompt:"请写一个Python脚本,用于读取CSV文件并绘制数据图表。"}),i.jsx(D,{icon:b1,title:"翻译助手",desc:"多语言互译与润色",prompt:"请将以下中文翻译成地道的英文:'千里之行,始于足下'。"})]})]}):i.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[_.map(R=>i.jsxs("div",{className:`flex gap-4 ${R.role==="user"?"flex-row-reverse":""}`,children:[i.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 mt-1 + ${R.role==="user"?"bg-blue-600 text-white":"bg-gradient-to-br from-blue-500 to-purple-600 text-white"}`,children:R.role==="user"?i.jsx(hy,{size:14}):i.jsx(Jh,{size:14})}),i.jsx("div",{className:`max-w-[80%] rounded-2xl px-5 py-3 text-sm leading-relaxed shadow-sm + ${R.role==="user"?"bg-blue-600 text-white rounded-tr-sm":"bg-white text-gray-700 border border-gray-100 rounded-tl-sm"}`,children:i.jsx("div",{className:"whitespace-pre-wrap",children:R.text})})]},R.id)),A&&i.jsxs("div",{className:"flex gap-4",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center flex-shrink-0 mt-1",children:i.jsx(qn,{size:14,className:"text-white animate-pulse"})}),i.jsx("div",{className:"bg-white border border-gray-100 rounded-2xl rounded-tl-sm px-5 py-3 flex items-center",children:i.jsxs("div",{className:"flex gap-1",children:[i.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce"}),i.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce delay-75"}),i.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce delay-150"})]})})]}),i.jsx("div",{ref:Z})]})}),i.jsx("div",{className:"absolute bottom-6 left-0 right-0 px-6",children:i.jsxs("div",{className:"max-w-3xl mx-auto bg-white rounded-2xl shadow-xl border border-blue-100 p-2 flex flex-col focus-within:ring-2 focus-within:ring-blue-500/20 focus-within:border-blue-500 transition-all",children:[i.jsx("textarea",{value:r,onChange:R=>w(R.target.value),onKeyDown:Y,placeholder:"问问Gemini...",className:"w-full max-h-40 min-h-[60px] p-3 resize-none focus:outline-none text-gray-700 placeholder-gray-400 text-sm bg-transparent"}),i.jsxs("div",{className:"flex justify-between items-center px-2 pb-1",children:[i.jsx("div",{className:"text-xs text-gray-400",children:"Shift + Enter 换行"}),i.jsx("button",{onClick:()=>p(),disabled:!r.trim()||A,className:`p-2 rounded-lg transition-colors + ${!r.trim()||A?"text-gray-300 cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700 shadow-md"}`,children:i.jsx(k1,{size:18})})]})]})})]})},W0=[{id:1,type:C.VIDEO,title:"赛博朋克城市的霓虹夜景",date:"2023-10-24 14:30",url:"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",duration:"5s",width:1080,height:1920},{id:2,type:C.IMAGE,title:"可爱的卡通3D猫咪",date:"2023-10-24 12:15",url:"https://picsum.photos/seed/cat/300/300",duration:null,width:1024,height:1024},{id:3,type:C.MUSIC,title:"Summer Vibes (Pop) - Ver 1",date:"2023-10-23 09:45",url:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",duration:"3:20",width:0,height:0},{id:33,type:C.MUSIC,title:"Summer Vibes (Pop) - Ver 2",date:"2023-10-23 09:45",url:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",duration:"3:15",width:0,height:0},{id:4,type:C.VIDEO,title:"海浪拍打礁石的慢动作",date:"2023-10-23 08:20",url:"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",duration:"10s",width:1920,height:1080},{id:5,type:C.IMAGE,title:"未来主义建筑设计图",date:"2023-10-22 18:10",url:"https://picsum.photos/seed/arch/300/300",duration:null,width:1024,height:1024},{id:6,type:C.MUSIC,title:"Cinematic Orchestra",date:"2023-10-21 22:00",url:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",duration:"2:15",width:0,height:0},{id:7,type:C.IMAGE,title:"水墨山水画风格",date:"2023-10-21 11:30",url:"https://picsum.photos/seed/art/300/300",duration:null,width:1024,height:1024},{id:8,type:C.VIDEO,title:"宇航员在火星行走",date:"2023-10-20 15:45",url:"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",duration:"5s",width:1080,height:1920},{id:9,type:C.IMAGE,title:"极简主义Logo设计",date:"2023-10-20 10:20",url:"https://picsum.photos/seed/logo/300/300",duration:null,width:1024,height:1024}],Dy=({isOpen:d,onClose:_,initialPage:M="recharge"})=>{const[r,w]=G.useState(M),[A,k]=G.useState(!0),[Z,E]=G.useState("all"),[p,Y]=G.useState(null),D=G.useRef(null);if(!d)return null;const R=({page:L,icon:me,label:V})=>i.jsxs("button",{onClick:()=>{w(L),(L==="login"||L==="register")&&k(L==="login")},className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors + ${r===L?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-50"}`,children:[i.jsx(me,{size:18}),i.jsx("span",{children:V})]}),se=(L,me)=>{var V;p===L?((V=D.current)==null||V.pause(),Y(null)):(D.current&&D.current.pause(),D.current=new Audio(me),D.current.play(),D.current.onended=()=>Y(null),Y(L))},Se=()=>i.jsxs("div",{className:"max-w-md mx-auto pt-10",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("h2",{className:"text-2xl font-bold text-gray-800",children:A?"欢迎回来":"创建账号"}),i.jsx("p",{className:"text-gray-500 text-sm mt-2",children:A?"登录以继续您的创作之旅":"注册即送 100 积分体验"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"手机号 / 邮箱"}),i.jsx("input",{type:"text",className:"w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",placeholder:"请输入您的账号"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"密码"}),i.jsx("input",{type:"password",className:"w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",placeholder:"请输入密码"})]}),!A&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"邀请码 (选填)"}),i.jsx("input",{type:"text",className:"w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",placeholder:"请输入邀请码"})]}),i.jsx("button",{className:"w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 rounded-lg transition-all shadow-sm mt-4",children:A?"立即登录":"立即注册"}),i.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500 mt-4",children:[i.jsx("button",{onClick:()=>k(!A),className:"hover:text-blue-600",children:A?"没有账号? 去注册":"已有账号? 去登录"}),A&&i.jsx("button",{className:"hover:text-blue-600",children:"忘记密码?"})]})]})]}),ge=()=>i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsx("h2",{className:"text-xl font-bold text-gray-800",children:"积分充值"}),i.jsxs("span",{className:"text-sm text-gray-500",children:["当前余额: ",i.jsx("span",{className:"text-blue-600 font-bold text-lg",children:"4,980"})," 积分"]})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[{price:"9.9",points:"1,000",tag:"体验",color:"blue"},{price:"29.9",points:"3,500",tag:"超值",color:"purple"},{price:"99.9",points:"12,000",tag:"专业",color:"orange"}].map((L,me)=>i.jsxs("div",{className:`border rounded-xl p-6 relative cursor-pointer hover:shadow-lg transition-all + ${me===1?"border-purple-500 ring-1 ring-purple-500 bg-purple-50/10":"border-gray-200 hover:border-blue-300 bg-white"}`,children:[me===1&&i.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-xs px-3 py-1 rounded-full font-bold shadow-sm",children:"MOST POPULAR"}),i.jsxs("div",{className:"text-center",children:[i.jsxs("div",{className:"text-sm text-gray-500 mb-1",children:[L.tag,"包"]}),i.jsxs("div",{className:"text-3xl font-bold text-gray-800 mb-2",children:[i.jsx("span",{className:"text-sm align-top",children:"¥"}),L.price]}),i.jsxs("div",{className:"text-blue-600 font-bold mb-4",children:[L.points," 积分"]}),i.jsxs("ul",{className:"text-xs text-gray-500 space-y-2 text-left bg-gray-50 p-3 rounded-lg mb-4",children:[i.jsxs("li",{className:"flex gap-2",children:[i.jsx(Ss,{size:14,className:"text-green-500"})," 生成约 ",parseInt(L.points.replace(",",""))/10," 张图片"]}),i.jsxs("li",{className:"flex gap-2",children:[i.jsx(Ss,{size:14,className:"text-green-500"})," 高速通道优先生成"]}),i.jsxs("li",{className:"flex gap-2",children:[i.jsx(Ss,{size:14,className:"text-green-500"})," 积分永久有效"]})]}),i.jsx("button",{className:`w-full py-2 rounded-lg text-sm font-bold transition-colors + ${me===1?"bg-purple-600 text-white hover:bg-purple-700":"bg-gray-900 text-white hover:bg-gray-800"}`,children:"立即充值"})]})]},me))}),i.jsxs("div",{className:"mt-8 bg-gray-50 rounded-xl p-4 text-xs text-gray-500 leading-relaxed",children:[i.jsxs("p",{className:"font-bold mb-2 flex items-center gap-1",children:[i.jsx(F1,{size:14})," 充值说明"]}),"1. 积分主要用于视频生成、图片生成及高级对话模型消耗。",i.jsx("br",{}),"2. 充值成功后系统自动到账,如遇网络延迟请耐心等待或联系客服。",i.jsx("br",{}),"3. 虚拟商品一经售出,不支持退款,请确认后购买。"]})]}),Ue=()=>i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold text-gray-800 mb-6",children:"积分记录"}),i.jsx("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm text-left",children:[i.jsx("thead",{className:"bg-gray-50 text-gray-500",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-6 py-3 font-medium",children:"时间"}),i.jsx("th",{className:"px-6 py-3 font-medium",children:"行为"}),i.jsx("th",{className:"px-6 py-3 font-medium text-right",children:"变动"}),i.jsx("th",{className:"px-6 py-3 font-medium text-right",children:"余额"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-100",children:[{date:"2023-10-24 14:20",action:"生成视频 (Veo)",change:-120,balance:4980},{date:"2023-10-24 10:05",action:"签到奖励",change:50,balance:5100},{date:"2023-10-23 18:30",action:"生成图片 (Nano Banana)",change:-10,balance:5050},{date:"2023-10-22 09:15",action:"充值套餐 (体验包)",change:1e3,balance:5060},{date:"2023-10-21 16:45",action:"邀请好友奖励",change:200,balance:4060}].map((L,me)=>i.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[i.jsx("td",{className:"px-6 py-4 text-gray-600",children:L.date}),i.jsx("td",{className:"px-6 py-4 text-gray-800 font-medium",children:L.action}),i.jsxs("td",{className:`px-6 py-4 text-right font-bold ${L.change>0?"text-green-600":"text-red-500"}`,children:[L.change>0?"+":"",L.change]}),i.jsx("td",{className:"px-6 py-4 text-right text-gray-600",children:L.balance})]},me))})]})})]}),be=()=>{const L=Z==="all"?W0:W0.filter(V=>V.type===Z),me=({type:V,label:P})=>i.jsx("button",{onClick:()=>E(V),className:`px-3 py-1 rounded-full text-xs font-medium transition-colors + ${Z===V?"bg-gray-900 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:P});return i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsx("h2",{className:"text-xl font-bold text-gray-800",children:"创作记录"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(me,{type:"all",label:"全部"}),i.jsx(me,{type:C.VIDEO,label:"视频"}),i.jsx(me,{type:C.IMAGE,label:"图片"}),i.jsx(me,{type:C.MUSIC,label:"音乐"})]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar pr-2 space-y-3 pb-6",children:[L.map(V=>i.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-xl border border-gray-100 bg-gray-50 hover:bg-white hover:shadow-md transition-all group",children:[i.jsx("div",{className:"w-20 h-20 flex-shrink-0 bg-gray-200 rounded-lg overflow-hidden relative shadow-sm",children:V.type===C.MUSIC?i.jsxs("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-purple-100 to-blue-100 relative group/music",children:[i.jsx(li,{className:"text-purple-500",size:24}),p===V.id&&i.jsx("div",{className:"absolute inset-0 bg-black/10 flex items-center justify-center",children:i.jsx("div",{className:"w-2 h-2 bg-purple-600 rounded-full animate-ping"})}),i.jsx("div",{className:"absolute inset-0 bg-black/20 hidden group-hover/music:flex items-center justify-center transition-all cursor-pointer",onClick:()=>se(V.id,V.url),children:p===V.id?i.jsx(Os,{size:24,fill:"white",className:"text-white"}):i.jsx(It,{size:24,fill:"white",className:"text-white"})})]}):V.type===C.VIDEO?i.jsxs("div",{className:"relative w-full h-full group/preview",children:[i.jsx("video",{src:V.url,className:"w-full h-full object-cover",muted:!0}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 group-hover/preview:bg-black/0 transition-colors",children:i.jsx(It,{size:20,className:"text-white fill-white"})})]}):i.jsx("img",{src:V.url,alt:"thumbnail",className:"w-full h-full object-cover"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("h3",{className:"font-bold text-gray-800 truncate",children:V.title}),i.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-medium uppercase + ${V.type===C.VIDEO?"bg-purple-100 text-purple-600":V.type===C.MUSIC?"bg-blue-100 text-blue-600":"bg-green-100 text-green-600"}`,children:V.type===C.VIDEO?"Video":V.type===C.MUSIC?"Music":"Image"})]}),i.jsxs("div",{className:"text-xs text-gray-500 flex items-center gap-3",children:[i.jsx("span",{children:V.date}),V.duration&&i.jsxs("span",{children:["• ",V.duration]}),V.width&&V.width>0&&i.jsxs("span",{children:["• ",V.width,"x",V.height]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[V.type===C.MUSIC&&i.jsxs("div",{className:"flex items-center gap-2 mr-2 border-r border-gray-200 pr-2",children:[i.jsx("button",{className:"p-2 rounded-full hover:bg-gray-100 text-gray-500 hover:text-blue-600 transition-colors",title:"查看歌词",children:i.jsx(Ts,{size:16})}),i.jsx("button",{className:"p-2 rounded-full hover:bg-gray-100 text-gray-500 hover:text-blue-600 transition-colors",title:"下载 WAV",children:i.jsx(As,{size:16})}),i.jsx("button",{className:"p-2 rounded-full hover:bg-gray-100 text-gray-500 hover:text-blue-600 transition-colors",title:"下载视频",children:i.jsx(Us,{size:16})}),i.jsx("button",{className:"p-2 rounded-full hover:bg-gray-100 text-gray-500 hover:text-blue-600 transition-colors",title:"分享",children:i.jsx(zs,{size:16})})]}),i.jsx("a",{href:V.url,target:"_blank",rel:"noreferrer",className:"p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200 transition-colors",title:"打开链接",children:i.jsx(r1,{size:18})}),i.jsx("a",{href:V.url,download:!0,className:"p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200 transition-colors",title:"下载",children:i.jsx(As,{size:18})})]})]},V.id)),L.length===0&&i.jsxs("div",{className:"flex flex-col items-center justify-center text-gray-400 py-16",children:[i.jsx(K0,{size:32,className:"mb-2 opacity-50"}),i.jsx("p",{className:"text-sm",children:"暂无该类型的创作记录"})]})]})]})},$=()=>i.jsxs("div",{className:"text-center pt-8",children:[i.jsx("div",{className:"w-20 h-20 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center mx-auto mb-6",children:i.jsx(zs,{size:32})}),i.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:"邀请好友,共享积分"}),i.jsxs("p",{className:"text-gray-500 mb-8",children:["每邀请一位好友注册,双方各得 ",i.jsx("span",{className:"text-orange-500 font-bold",children:"200"})," 积分奖励"]}),i.jsxs("div",{className:"max-w-sm mx-auto bg-gray-50 border-2 border-dashed border-gray-300 rounded-xl p-6 mb-8",children:[i.jsx("div",{className:"text-sm text-gray-500 mb-2",children:"您的专属邀请码"}),i.jsx("div",{className:"text-3xl font-mono font-bold text-gray-800 tracking-wider mb-4 select-all",children:"AIV888"}),i.jsxs("button",{className:"flex items-center justify-center gap-2 w-full py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 text-sm font-medium transition-colors",children:[i.jsx(a1,{size:14})," 复制链接与邀请码"]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-sm mx-auto",children:[i.jsxs("div",{className:"bg-blue-50 rounded-lg p-4",children:[i.jsx("div",{className:"text-2xl font-bold text-blue-600",children:"12"}),i.jsx("div",{className:"text-xs text-blue-400",children:"已邀请人数"})]}),i.jsxs("div",{className:"bg-orange-50 rounded-lg p-4",children:[i.jsx("div",{className:"text-2xl font-bold text-orange-600",children:"2,400"}),i.jsx("div",{className:"text-xs text-orange-400",children:"获得奖励积分"})]})]})]}),ue=()=>{switch(r){case"recharge":return i.jsx(ge,{});case"points":return i.jsx(Ue,{});case"history":return i.jsx(be,{});case"invite":return i.jsx($,{});case"login":case"register":return i.jsx(Se,{});default:return i.jsx(ge,{})}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm animate-in fade-in duration-200",children:i.jsxs("div",{className:"bg-white w-[900px] h-[600px] rounded-2xl shadow-2xl flex overflow-hidden animate-in zoom-in-95 duration-200 relative",children:[i.jsx("button",{onClick:_,className:"absolute top-4 right-4 p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors z-10",children:i.jsx(Ba,{size:20})}),i.jsxs("div",{className:"w-64 bg-gray-50/80 border-r border-gray-100 p-6 flex flex-col justify-between flex-shrink-0",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-3 px-2",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-600 flex items-center justify-center text-white font-bold",children:"用"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-bold text-gray-800 text-sm",children:"用户0666"}),i.jsx("div",{className:"text-xs text-gray-400",children:"ID: 8839201"})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"px-4 pb-2 text-xs font-bold text-gray-400 uppercase tracking-wider",children:"资产"}),i.jsx(R,{page:"recharge",icon:by,label:"充值中心"}),i.jsx(R,{page:"points",icon:u1,label:"积分记录"}),i.jsx("div",{className:"px-4 pb-2 pt-4 text-xs font-bold text-gray-400 uppercase tracking-wider",children:"创作"}),i.jsx(R,{page:"history",icon:K0,label:"创作记录"}),i.jsx(R,{page:"invite",icon:zs,label:"邀请有礼"})]})]}),i.jsx("div",{className:"space-y-1",children:A?i.jsx(R,{page:"login",icon:Uy,label:"退出登录"}):i.jsx(R,{page:"login",icon:ld,label:"登录/注册"})})]}),i.jsx("div",{className:"flex-1 p-8 overflow-y-auto custom-scrollbar relative bg-white flex flex-col",children:ue()})]})})},Uy=d=>i.jsx(ld,{...d,className:"transform rotate-180"}),Cy=({onBack:d})=>{const[_,M]=G.useState("create"),[r,w]=G.useState([{id:"1",name:"@DemoTest",date:"2025-12-17 18:25:15",status:"failed",error:`The upload of the 1 character failed +tag:PendingUploadCharacter: Upload may...`}]),[A,k]=G.useState(null),[Z,E]=G.useState(null),[p,Y]=G.useState(""),[D,R]=G.useState(""),[se,Se]=G.useState([0,20]),ge=$=>{var L;const ue=(L=$.target.files)==null?void 0:L[0];ue&&(k(ue),E(URL.createObjectURL(ue)),M("create"))},Ue=()=>{if(!p)return alert("请输入名称");const $={id:Date.now().toString(),name:`@${p}`,date:new Date().toLocaleString(),status:"processing"};w([$,...r]),M("manage"),k(null),E(null),Y(""),R("")},be=$=>{w(r.filter(ue=>ue.id!==$))};return i.jsxs("div",{className:"flex flex-col h-full bg-[#f9fafb] overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-8 py-6 flex-shrink-0",children:[i.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-gray-600 hover:text-gray-900 transition-colors font-medium",children:[i.jsx(Ih,{size:20}),"返回视频生成"]}),i.jsxs("div",{className:"flex bg-white rounded-full p-1 shadow-sm border border-gray-100",children:[i.jsxs("button",{onClick:()=>M("create"),className:`flex items-center gap-2 px-6 py-2 rounded-full text-sm font-medium transition-all + ${_==="create"?"bg-blue-600 text-white shadow-md":"text-gray-600 hover:bg-gray-50"}`,children:[i.jsx(Rn,{size:16}),"新建数字对象"]}),i.jsxs("button",{onClick:()=>M("manage"),className:`flex items-center gap-2 px-6 py-2 rounded-full text-sm font-medium transition-all + ${_==="manage"?"bg-blue-600 text-white shadow-md":"text-gray-600 hover:bg-gray-50"}`,children:[i.jsx(Es,{size:16}),"数字对象管理",r.length>0&&i.jsx("span",{className:`ml-1 text-xs px-1.5 rounded-full ${_==="manage"?"bg-white/20":"bg-gray-200"}`,children:r.length})]})]}),i.jsx("div",{className:"w-24"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-8 pb-10",children:i.jsxs("div",{className:"max-w-4xl mx-auto",children:[_==="create"&&i.jsxs("div",{className:"bg-white rounded-2xl p-8 shadow-sm border border-gray-100 animate-in fade-in zoom-in-95 duration-300",children:[i.jsxs("div",{className:"flex justify-between items-start mb-6",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xl font-bold text-gray-800",children:[i.jsx(k0,{className:"text-blue-600 fill-blue-600",size:24}),"创建数字对象"]}),i.jsx("div",{className:"px-3 py-1 bg-[#d946ef] text-white text-xs font-bold rounded",children:"创建数字人物"})]}),i.jsxs("p",{className:"text-gray-500 text-sm mb-8 leading-relaxed",children:["上传视频并选取1-3秒的片段来创建您的专属数字对象,视频内不能出现任何包含人物的任何部位,",i.jsx("br",{}),"比如脸部、手部等等"]}),i.jsxs("div",{className:"mb-2 text-sm font-bold text-gray-700",children:["上传视频 ",i.jsx("span",{className:"text-gray-400 font-normal",children:"(仅支持MP4格式,最大50MB)"})]}),Z?i.jsxs("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2 text-sm text-gray-500",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(It,{size:14,className:"text-blue-600"}),A==null?void 0:A.name," ",i.jsxs("span",{className:"text-gray-400",children:["(",(A.size/1024/1024).toFixed(2)," MB)"]})]}),i.jsx("button",{onClick:()=>E(null),className:"text-red-500 hover:text-red-600 hover:bg-red-50 p-1 rounded",children:i.jsx($0,{size:16})})]}),i.jsx("div",{className:"aspect-video bg-black rounded-lg overflow-hidden relative mb-4 group",children:i.jsx("video",{src:Z,className:"w-full h-full object-contain",controls:!0})}),i.jsxs("div",{className:"mb-4",children:[i.jsx("div",{className:"flex justify-between text-xs text-gray-500 mb-2",children:i.jsx("span",{children:"选择片段 (创建数字对象需要1-3秒)"})}),i.jsx("div",{className:"h-12 bg-gray-200 rounded overflow-hidden flex mb-2 opacity-60",children:[...Array(10)].map(($,ue)=>i.jsx("div",{className:"flex-1 border-r border-white/20 bg-gray-300"},ue))}),i.jsxs("div",{className:"relative h-6 bg-gray-100 rounded-full",children:[i.jsx("div",{className:"absolute top-1 bottom-1 left-0 bg-blue-600 rounded-full opacity-30 w-1/4"}),i.jsx("div",{className:"absolute top-0 bottom-0 left-0 w-4 h-6 bg-blue-600 rounded-full cursor-ew-resize border-2 border-white shadow-sm"}),i.jsx("div",{className:"absolute top-0 bottom-0 left-[25%] w-4 h-6 bg-blue-600 rounded-full cursor-ew-resize border-2 border-white shadow-sm"})]}),i.jsxs("div",{className:"flex items-center justify-between mt-2 text-xs font-mono text-gray-600",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsx("span",{children:"开始: 0:00"}),i.jsx("span",{children:"结束: 0:03.0"}),i.jsx("span",{className:"text-green-600 font-bold",children:"时长: 3.0秒"})]}),i.jsxs("button",{className:"flex items-center gap-1 bg-blue-600 text-white px-3 py-1 rounded hover:bg-blue-700",children:[i.jsx(It,{size:12})," 预览片段"]})]})]})]}):i.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-xl bg-gray-50 h-64 flex flex-col items-center justify-center text-gray-400 gap-4 hover:border-blue-400 hover:bg-blue-50/30 transition-all cursor-pointer relative group",children:[i.jsx("input",{type:"file",accept:"video/mp4",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:ge}),i.jsx("div",{className:"w-16 h-16 rounded-full bg-white shadow-sm flex items-center justify-center group-hover:scale-110 transition-transform",children:i.jsx(dy,{size:32,className:"text-gray-400 group-hover:text-blue-500"})}),i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"font-bold text-gray-600 mb-1",children:"点击或拖拽上传视频"}),i.jsx("div",{className:"text-xs",children:"支持 MP4 格式,大小不超过 50MB"})]})]}),i.jsxs("div",{className:"mt-8 space-y-6",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["名称 ",i.jsx("span",{className:"text-red-500",children:"*"})," ",i.jsx("span",{className:"text-gray-400 font-normal text-xs",children:"(至少6个英文字母或数字)"})]}),i.jsx("input",{type:"text",value:p,onChange:$=>Y($.target.value),placeholder:"请输入名称,如: MarryJK123",className:"w-full border border-gray-300 rounded-lg px-4 py-3 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all text-sm"})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["描述 ",i.jsx("span",{className:"text-gray-400 font-normal text-xs",children:"(选填,最多500字)"})]}),i.jsx("textarea",{value:D,onChange:$=>R($.target.value),placeholder:"描述一下这个数字对象的特点...",className:"w-full border border-gray-300 rounded-lg px-4 py-3 h-32 resize-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all text-sm"}),i.jsx("div",{className:"text-right text-xs text-gray-400 mt-1",children:"0/500"})]})]}),i.jsx("div",{className:"mt-8",children:i.jsxs("button",{onClick:Ue,className:"w-full bg-[#8b9cff] hover:bg-blue-600 text-white font-bold py-3.5 rounded-lg transition-colors flex items-center justify-center gap-2 shadow-sm",children:[i.jsx(k0,{size:18,className:"fill-white"}),"创建数字对象"]})})]}),_==="manage"&&i.jsx("div",{className:"animate-in fade-in slide-in-from-right-4 duration-300",children:r.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[i.jsx("div",{className:"w-48 h-48 bg-gray-100 rounded-full flex items-center justify-center mb-6 opacity-50",children:i.jsx(Es,{size:64,className:"text-gray-400",strokeWidth:1})}),i.jsx("div",{className:"text-gray-400 text-lg",children:"暂无创作记录"})]}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:r.map($=>i.jsxs("div",{className:"bg-white rounded-xl overflow-hidden shadow-sm border border-gray-200 group hover:shadow-md transition-shadow",children:[i.jsxs("div",{className:"aspect-square bg-gray-200 relative",children:[$.status==="failed"?i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100",children:i.jsx(e1,{size:48,className:"text-gray-300"})}):i.jsx("img",{src:`https://picsum.photos/seed/${$.id}/400/400`,className:"w-full h-full object-cover",alt:"preview"}),i.jsxs("div",{className:"absolute top-3 right-3",children:[$.status==="failed"&&i.jsx("span",{className:"bg-red-500 text-white text-xs px-2 py-1 rounded font-bold",children:"失败"}),$.status==="processing"&&i.jsx("span",{className:"bg-blue-500 text-white text-xs px-2 py-1 rounded font-bold animate-pulse",children:"处理中"}),$.status==="completed"&&i.jsx("span",{className:"bg-green-500 text-white text-xs px-2 py-1 rounded font-bold",children:"完成"})]}),i.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"})]}),i.jsxs("div",{className:"p-4",children:[i.jsx("h3",{className:"font-bold text-gray-800 text-lg mb-1",children:$.name}),i.jsx("div",{className:"text-xs text-gray-400 mb-3",children:$.date}),$.status==="failed"&&$.error&&i.jsxs("div",{className:"bg-red-50 border border-red-100 rounded p-2 mb-4",children:[i.jsx("div",{className:"text-xs text-red-500 font-bold mb-1",children:"error"}),i.jsx("div",{className:"text-[10px] text-red-400 leading-tight line-clamp-2",children:$.error})]}),i.jsxs("button",{onClick:()=>be($.id),className:"w-full py-2 bg-red-50 text-red-500 rounded-lg text-sm font-medium hover:bg-red-100 transition-colors flex items-center justify-center gap-2",children:[i.jsx($0,{size:16})," 删除"]})]})]},$.id))})})]})})]})},Ms=()=>Array.from({length:Ny}).map((d,_)=>({id:_+1,selected:!1,prompt:"",referenceImage:null,status:zl.IDLE,resultUrl:null,count:1})),wy=()=>{const[d,_]=G.useState(C.VIDEO),[M,r]=G.useState("simple"),[w,A]=G.useState(0),[k,Z]=G.useState(!1),[E,p]=G.useState("recharge"),[Y,D]=G.useState(!1),[R,se]=G.useState({aspectRatio:"9:16",duration:"15s",resolution:"HD",imageModel:"Nano Banana",textModel:"gemini-flash-lite",musicModel:"suno-v3.5"}),[Se,ge]=G.useState({[C.VIDEO]:Ms(),[C.IMAGE]:Ms(),[C.MUSIC]:Ms(),[C.TEXT]:[]}),[Ue,be]=G.useState(!1),$=Se[d]||[],ue=W=>{ge(pe=>({...pe,[d]:W(pe[d])}))};G.useEffect(()=>{D(!1)},[d]),G.useEffect(()=>{(async()=>{await Hn()||setTimeout(()=>Ga(),1e3)})()},[]);const L=G.useCallback((W,pe,te)=>{ue(oe=>oe.map(b=>b.id===W?{...b,[pe]:te}:b))},[d]),me=G.useCallback(W=>{ue(pe=>pe.map(te=>te.id===W?{...te,prompt:"",referenceImage:null,musicStyle:"",musicTitle:"",isInstrumental:!1,status:zl.IDLE,resultUrl:null,error:void 0}:te))},[d]),V=async W=>{const te=Se[d].find(b=>b.id===W);if(!te||!te.prompt)return;if(!await Hn()){await Ga();return}L(W,"status",zl.GENERATING),be(!0);try{let b="";d===C.VIDEO?b=await ad(te.prompt,R,te.referenceImage):d===C.IMAGE?b=await nd(te.prompt,R,te.referenceImage):d===C.MUSIC?b=await ud(te.prompt,te.musicStyle||"",te.isInstrumental||!1,te.musicTitle||""):b="",L(W,"resultUrl",b),L(W,"status",zl.COMPLETED)}catch(b){L(W,"status",zl.FAILED),L(W,"error",b.message||"Unknown error")}finally{be(!1)}},P=async()=>{const pe=Se[d].filter(oe=>oe.selected&&oe.prompt);if(pe.length===0){alert("请选择已输入提示词的行。");return}if(!await Hn()){await Ga();return}be(!0);for(const oe of pe)await V(oe.id);be(!1)},Je=()=>{ue(W=>W.map(pe=>pe.selected?{...pe,prompt:"",referenceImage:null,musicStyle:"",musicTitle:"",isInstrumental:!1,status:zl.IDLE,resultUrl:null,selected:!1}:pe))},al=W=>{ue(pe=>pe.map(te=>({...te,selected:W})))},Ml=()=>{A(W=>W+1)},qe=(W="recharge")=>{p(W),Z(!0)};return i.jsxs("div",{className:"flex w-full h-screen overflow-hidden bg-white text-gray-800 font-sans",children:[i.jsx(Sy,{activeTab:d,setActiveTab:_,onOpenUserModal:qe}),i.jsx("main",{className:"flex-1 flex flex-col h-full overflow-hidden relative",children:Y?i.jsx(Cy,{onBack:()=>D(!1)}):i.jsxs(i.Fragment,{children:[i.jsx(Ey,{config:R,setConfig:se,onBatchGenerate:P,onDelete:Je,generating:Ue,viewMode:M,setViewMode:r,activeTab:d,onNewChat:Ml,onOpenDigitalManager:()=>D(!0)}),i.jsx("div",{className:"flex-1 min-h-0 relative flex flex-col",children:d===C.TEXT?i.jsx(Oy,{config:R},w):i.jsx(i.Fragment,{children:M==="efficiency"?i.jsxs(i.Fragment,{children:[i.jsx(_y,{}),i.jsxs("div",{className:"flex items-center h-10 bg-gray-50 border-b border-gray-200 text-xs font-bold text-gray-600 flex-shrink-0",children:[i.jsx("div",{className:"w-12 flex justify-center border-r border-gray-200",children:i.jsx("input",{type:"checkbox",onChange:W=>al(W.target.checked),className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})}),i.jsx("div",{className:"w-12 flex justify-center border-r border-gray-200",children:"#"}),d===C.MUSIC?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 px-4 border-r border-gray-200",children:"歌词描述"}),i.jsx("div",{className:"w-32 px-2 border-r border-gray-200",children:"风格"}),i.jsx("div",{className:"w-32 px-2 border-r border-gray-200",children:"标题"}),i.jsx("div",{className:"w-16 text-center border-r border-gray-200",children:"模式"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 px-4 border-r border-gray-200",children:"提示词"}),i.jsx("div",{className:"w-32 text-center border-r border-gray-200",children:"参考图"})]}),i.jsx("div",{className:"w-24 text-center px-2 border-r border-gray-200",children:"状态"}),i.jsx("div",{className:"w-20 text-center border-r border-gray-200",children:"数量"}),i.jsx("div",{className:"w-28 text-center",children:"操作"})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar pb-20",children:[$.map(W=>i.jsx(Ay,{task:W,activeTab:d,onChange:L,onGenerate:V,onClear:me},W.id)),i.jsx("div",{className:"h-10"})]})]}):i.jsx(Ty,{config:R,setConfig:se,activeTab:d},d)})})]})}),i.jsx(Dy,{isOpen:k,onClose:()=>Z(!1),initialPage:E})]})},id=document.getElementById("root");if(!id)throw new Error("Could not find root element to mount to");const Hy=Yh.createRoot(id);Hy.render(i.jsx(Uh.StrictMode,{children:i.jsx(wy,{})})); diff --git a/h5/build/index.html b/h5/build/index.html new file mode 100755 index 0000000..4538040 --- /dev/null +++ b/h5/build/index.html @@ -0,0 +1,46 @@ + + + + + + 朴见潮音 + + + + + + + +
+ + \ No newline at end of file diff --git a/h5/create/assets/index-DiVLKNL_.js b/h5/create/assets/index-DiVLKNL_.js new file mode 100755 index 0000000..6afb558 --- /dev/null +++ b/h5/create/assets/index-DiVLKNL_.js @@ -0,0 +1,330 @@ +(function(){const j=document.createElement("link").relList;if(j&&j.supports&&j.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))d(A);new MutationObserver(A=>{for(const w of A)if(w.type==="childList")for(const O of w.addedNodes)O.tagName==="LINK"&&O.rel==="modulepreload"&&d(O)}).observe(document,{childList:!0,subtree:!0});function _(A){const w={};return A.integrity&&(w.integrity=A.integrity),A.referrerPolicy&&(w.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?w.credentials="include":A.crossOrigin==="anonymous"?w.credentials="omit":w.credentials="same-origin",w}function d(A){if(A.ep)return;A.ep=!0;const w=_(A);fetch(A.href,w)}})();function Zr(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var hs={exports:{}},_n={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Mr;function jh(){if(Mr)return _n;Mr=1;var o=Symbol.for("react.transitional.element"),j=Symbol.for("react.fragment");function _(d,A,w){var O=null;if(w!==void 0&&(O=""+w),A.key!==void 0&&(O=""+A.key),"key"in A){w={};for(var M in A)M!=="key"&&(w[M]=A[M])}else w=A;return A=w.ref,{$$typeof:o,type:d,key:O,ref:A!==void 0?A:null,props:w}}return _n.Fragment=j,_n.jsx=_,_n.jsxs=_,_n}var wr;function Nh(){return wr||(wr=1,hs.exports=jh()),hs.exports}var u=Nh(),vs={exports:{}},J={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Or;function Sh(){if(Or)return J;Or=1;var o=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),O=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),V=Symbol.iterator;function fl(m){return m===null||typeof m!="object"?null:(m=V&&m[V]||m["@@iterator"],typeof m=="function"?m:null)}var pl={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xl=Object.assign,$l={};function wl(m,E,C){this.props=m,this.context=E,this.refs=$l,this.updater=C||pl}wl.prototype.isReactComponent={},wl.prototype.setState=function(m,E){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,E,"setState")},wl.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function Gl(){}Gl.prototype=wl.prototype;function yl(m,E,C){this.props=m,this.context=E,this.refs=$l,this.updater=C||pl}var _l=yl.prototype=new Gl;_l.constructor=yl,xl(_l,wl.prototype),_l.isPureReactComponent=!0;var Cl=Array.isArray;function zl(){}var K={H:null,A:null,T:null,S:null},Al=Object.prototype.hasOwnProperty;function Wl(m,E,C){var R=C.ref;return{$$typeof:o,type:m,key:E,ref:R!==void 0?R:null,props:C}}function Y(m,E){return Wl(m.type,E,m.props)}function I(m){return typeof m=="object"&&m!==null&&m.$$typeof===o}function G(m){var E={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(C){return E[C]})}var jl=/\/+/g;function Hl(m,E){return typeof m=="object"&&m!==null&&m.key!=null?G(""+m.key):E.toString(36)}function Il(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(zl,zl):(m.status="pending",m.then(function(E){m.status==="pending"&&(m.status="fulfilled",m.value=E)},function(E){m.status==="pending"&&(m.status="rejected",m.reason=E)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function p(m,E,C,R,$){var P=typeof m;(P==="undefined"||P==="boolean")&&(m=null);var sl=!1;if(m===null)sl=!0;else switch(P){case"bigint":case"string":case"number":sl=!0;break;case"object":switch(m.$$typeof){case o:case j:sl=!0;break;case B:return sl=m._init,p(sl(m._payload),E,C,R,$)}}if(sl)return $=$(m),sl=R===""?"."+Hl(m,0):R,Cl($)?(C="",sl!=null&&(C=sl.replace(jl,"$&/")+"/"),p($,E,C,"",function(Oa){return Oa})):$!=null&&(I($)&&($=Y($,C+($.key==null||m&&m.key===$.key?"":(""+$.key).replace(jl,"$&/")+"/")+sl)),E.push($)),1;sl=0;var Pl=R===""?".":R+":";if(Cl(m))for(var Ol=0;Ol>>1,gl=p[rl];if(0>>1;rlA(C,k))RA($,C)?(p[rl]=$,p[R]=k,rl=R):(p[rl]=C,p[E]=k,rl=E);else if(RA($,k))p[rl]=$,p[R]=k,rl=R;else break l}}return D}function A(p,D){var k=p.sortIndex-D.sortIndex;return k!==0?k:p.id-D.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var w=performance;o.unstable_now=function(){return w.now()}}else{var O=Date,M=O.now();o.unstable_now=function(){return O.now()-M}}var T=[],y=[],B=1,U=null,V=3,fl=!1,pl=!1,xl=!1,$l=!1,wl=typeof setTimeout=="function"?setTimeout:null,Gl=typeof clearTimeout=="function"?clearTimeout:null,yl=typeof setImmediate<"u"?setImmediate:null;function _l(p){for(var D=_(y);D!==null;){if(D.callback===null)d(y);else if(D.startTime<=p)d(y),D.sortIndex=D.expirationTime,j(T,D);else break;D=_(y)}}function Cl(p){if(xl=!1,_l(p),!pl)if(_(T)!==null)pl=!0,zl||(zl=!0,G());else{var D=_(y);D!==null&&Il(Cl,D.startTime-p)}}var zl=!1,K=-1,Al=5,Wl=-1;function Y(){return $l?!0:!(o.unstable_now()-Wlp&&Y());){var rl=U.callback;if(typeof rl=="function"){U.callback=null,V=U.priorityLevel;var gl=rl(U.expirationTime<=p);if(p=o.unstable_now(),typeof gl=="function"){U.callback=gl,_l(p),D=!0;break e}U===_(T)&&d(T),_l(p)}else d(T);U=_(T)}if(U!==null)D=!0;else{var m=_(y);m!==null&&Il(Cl,m.startTime-p),D=!1}}break l}finally{U=null,V=k,fl=!1}D=void 0}}finally{D?G():zl=!1}}}var G;if(typeof yl=="function")G=function(){yl(I)};else if(typeof MessageChannel<"u"){var jl=new MessageChannel,Hl=jl.port2;jl.port1.onmessage=I,G=function(){Hl.postMessage(null)}}else G=function(){wl(I,0)};function Il(p,D){K=wl(function(){p(o.unstable_now())},D)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125rl?(p.sortIndex=k,j(y,p),_(T)===null&&p===_(y)&&(xl?(Gl(K),K=-1):xl=!0,Il(Cl,k-rl))):(p.sortIndex=gl,j(T,p),pl||fl||(pl=!0,zl||(zl=!0,G()))),p},o.unstable_shouldYield=Y,o.unstable_wrapCallback=function(p){var D=V;return function(){var k=V;V=D;try{return p.apply(this,arguments)}finally{V=k}}}})(gs)),gs}var Cr;function Ah(){return Cr||(Cr=1,ys.exports=Eh()),ys.exports}var bs={exports:{}},Fl={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Hr;function Th(){if(Hr)return Fl;Hr=1;var o=Ns();function j(T){var y="https://react.dev/errors/"+T;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(j){console.error(j)}}return o(),bs.exports=Th(),bs.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var qr;function wh(){if(qr)return En;qr=1;var o=Ah(),j=Ns(),_=Mh();function d(l){var e="https://react.dev/errors/"+l;if(1gl||(l.current=rl[gl],rl[gl]=null,gl--)}function C(l,e){gl++,rl[gl]=l.current,l.current=e}var R=m(null),$=m(null),P=m(null),sl=m(null);function Pl(l,e){switch(C(P,e),C($,l),C(R,null),e.nodeType){case 9:case 11:l=(l=e.documentElement)&&(l=l.namespaceURI)?Id(l):0;break;default:if(l=e.tagName,e=e.namespaceURI)e=Id(e),l=Pd(e,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}E(R),C(R,l)}function Ol(){E(R),E($),E(P)}function Oa(l){l.memoizedState!==null&&C(sl,l);var e=R.current,t=Pd(e,l.type);e!==t&&(C($,l),C(R,t))}function Mn(l){$.current===l&&(E(R),E($)),sl.current===l&&(E(sl),zn._currentValue=k)}var Wi,Es;function At(l){if(Wi===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);Wi=e&&e[1]||"",Es=-1)":-1n||f[a]!==x[n]){var z=` +`+f[a].replace(" at new "," at ");return l.displayName&&z.includes("")&&(z=z.replace("",l.displayName)),z}while(1<=a&&0<=n);break}}}finally{Fi=!1,Error.prepareStackTrace=t}return(t=l?l.displayName||l.name:"")?At(t):""}function Pr(l,e){switch(l.tag){case 26:case 27:case 5:return At(l.type);case 16:return At("Lazy");case 13:return l.child!==e&&e!==null?At("Suspense Fallback"):At("Suspense");case 19:return At("SuspenseList");case 0:case 15:return Ii(l.type,!1);case 11:return Ii(l.type.render,!1);case 1:return Ii(l.type,!0);case 31:return At("Activity");default:return""}}function As(l){try{var e="",t=null;do e+=Pr(l,t),t=l,l=l.return;while(l);return e}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var Pi=Object.prototype.hasOwnProperty,lu=o.unstable_scheduleCallback,eu=o.unstable_cancelCallback,l0=o.unstable_shouldYield,e0=o.unstable_requestPaint,fe=o.unstable_now,t0=o.unstable_getCurrentPriorityLevel,Ts=o.unstable_ImmediatePriority,Ms=o.unstable_UserBlockingPriority,wn=o.unstable_NormalPriority,a0=o.unstable_LowPriority,ws=o.unstable_IdlePriority,n0=o.log,i0=o.unstable_setDisableYieldValue,Ua=null,oe=null;function et(l){if(typeof n0=="function"&&i0(l),oe&&typeof oe.setStrictMode=="function")try{oe.setStrictMode(Ua,l)}catch{}}var de=Math.clz32?Math.clz32:s0,u0=Math.log,c0=Math.LN2;function s0(l){return l>>>=0,l===0?32:31-(u0(l)/c0|0)|0}var On=256,Un=262144,Dn=4194304;function Tt(l){var e=l&42;if(e!==0)return e;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Cn(l,e,t){var a=l.pendingLanes;if(a===0)return 0;var n=0,i=l.suspendedLanes,c=l.pingedLanes;l=l.warmLanes;var s=a&134217727;return s!==0?(a=s&~i,a!==0?n=Tt(a):(c&=s,c!==0?n=Tt(c):t||(t=s&~l,t!==0&&(n=Tt(t))))):(s=a&~i,s!==0?n=Tt(s):c!==0?n=Tt(c):t||(t=a&~l,t!==0&&(n=Tt(t)))),n===0?0:e!==0&&e!==n&&(e&i)===0&&(i=n&-n,t=e&-e,i>=t||i===32&&(t&4194048)!==0)?e:n}function Da(l,e){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&e)===0}function f0(l,e){switch(l){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Os(){var l=Dn;return Dn<<=1,(Dn&62914560)===0&&(Dn=4194304),l}function tu(l){for(var e=[],t=0;31>t;t++)e.push(l);return e}function Ca(l,e){l.pendingLanes|=e,e!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function o0(l,e,t,a,n,i){var c=l.pendingLanes;l.pendingLanes=t,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=t,l.entangledLanes&=t,l.errorRecoveryDisabledLanes&=t,l.shellSuspendCounter=0;var s=l.entanglements,f=l.expirationTimes,x=l.hiddenUpdates;for(t=c&~t;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var x0=/[\n"\\]/g;function pe(l){return l.replace(x0,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function su(l,e,t,a,n,i,c,s){l.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.type=c:l.removeAttribute("type"),e!=null?c==="number"?(e===0&&l.value===""||l.value!=e)&&(l.value=""+be(e)):l.value!==""+be(e)&&(l.value=""+be(e)):c!=="submit"&&c!=="reset"||l.removeAttribute("value"),e!=null?fu(l,c,be(e)):t!=null?fu(l,c,be(t)):a!=null&&l.removeAttribute("value"),n==null&&i!=null&&(l.defaultChecked=!!i),n!=null&&(l.checked=n&&typeof n!="function"&&typeof n!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?l.name=""+be(s):l.removeAttribute("name")}function Zs(l,e,t,a,n,i,c,s){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.type=i),e!=null||t!=null){if(!(i!=="submit"&&i!=="reset"||e!=null)){cu(l);return}t=t!=null?""+be(t):"",e=e!=null?""+be(e):t,s||e===l.value||(l.value=e),l.defaultValue=e}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=s?l.checked:!!a,l.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(l.name=c),cu(l)}function fu(l,e,t){e==="number"&&qn(l.ownerDocument)===l||l.defaultValue===""+t||(l.defaultValue=""+t)}function It(l,e,t,a){if(l=l.options,e){e={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hu=!1;if(Ye)try{var Ba={};Object.defineProperty(Ba,"passive",{get:function(){hu=!0}}),window.addEventListener("test",Ba,Ba),window.removeEventListener("test",Ba,Ba)}catch{hu=!1}var at=null,vu=null,Yn=null;function Fs(){if(Yn)return Yn;var l,e=vu,t=e.length,a,n="value"in at?at.value:at.textContent,i=n.length;for(l=0;l=Qa),af=" ",nf=!1;function uf(l,e){switch(l){case"keyup":return Z0.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cf(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ta=!1;function k0(l,e){switch(l){case"compositionend":return cf(e);case"keypress":return e.which!==32?null:(nf=!0,af);case"textInput":return l=e.data,l===af&&nf?null:l;default:return null}}function K0(l,e){if(ta)return l==="compositionend"||!pu&&uf(l,e)?(l=Fs(),Yn=vu=at=null,ta=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-l};l=a}l:{for(;t;){if(t.nextSibling){t=t.nextSibling;break l}t=t.parentNode}t=void 0}t=vf(t)}}function yf(l,e){return l&&e?l===e?!0:l&&l.nodeType===3?!1:e&&e.nodeType===3?yf(l,e.parentNode):"contains"in l?l.contains(e):l.compareDocumentPosition?!!(l.compareDocumentPosition(e)&16):!1:!1}function gf(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var e=qn(l.document);e instanceof l.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)l=e.contentWindow;else break;e=qn(l.document)}return e}function Nu(l){var e=l&&l.nodeName&&l.nodeName.toLowerCase();return e&&(e==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||e==="textarea"||l.contentEditable==="true")}var em=Ye&&"documentMode"in document&&11>=document.documentMode,aa=null,Su=null,Va=null,_u=!1;function bf(l,e,t){var a=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;_u||aa==null||aa!==qn(a)||(a=aa,"selectionStart"in a&&Nu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Va&&Za(Va,a)||(Va=a,a=Ui(Su,"onSelect"),0>=c,n-=c,De=1<<32-de(e)+n|t<F?(al=q,q=null):al=q.sibling;var ul=g(h,q,v[F],N);if(ul===null){q===null&&(q=al);break}l&&q&&ul.alternate===null&&e(h,q),r=i(ul,r,F),il===null?Q=ul:il.sibling=ul,il=ul,q=al}if(F===v.length)return t(h,q),nl&&Qe(h,F),Q;if(q===null){for(;FF?(al=q,q=null):al=q.sibling;var _t=g(h,q,ul.value,N);if(_t===null){q===null&&(q=al);break}l&&q&&_t.alternate===null&&e(h,q),r=i(_t,r,F),il===null?Q=_t:il.sibling=_t,il=_t,q=al}if(ul.done)return t(h,q),nl&&Qe(h,F),Q;if(q===null){for(;!ul.done;F++,ul=v.next())ul=S(h,ul.value,N),ul!==null&&(r=i(ul,r,F),il===null?Q=ul:il.sibling=ul,il=ul);return nl&&Qe(h,F),Q}for(q=a(q);!ul.done;F++,ul=v.next())ul=b(q,h,F,ul.value,N),ul!==null&&(l&&ul.alternate!==null&&q.delete(ul.key===null?F:ul.key),r=i(ul,r,F),il===null?Q=ul:il.sibling=ul,il=ul);return l&&q.forEach(function(zh){return e(h,zh)}),nl&&Qe(h,F),Q}function vl(h,r,v,N){if(typeof v=="object"&&v!==null&&v.type===xl&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case fl:l:{for(var Q=v.key;r!==null;){if(r.key===Q){if(Q=v.type,Q===xl){if(r.tag===7){t(h,r.sibling),N=n(r,v.props.children),N.return=h,h=N;break l}}else if(r.elementType===Q||typeof Q=="object"&&Q!==null&&Q.$$typeof===Al&&Yt(Q)===r.type){t(h,r.sibling),N=n(r,v.props),Fa(N,v),N.return=h,h=N;break l}t(h,r);break}else e(h,r);r=r.sibling}v.type===xl?(N=Ct(v.props.children,h.mode,N,v.key),N.return=h,h=N):(N=$n(v.type,v.key,v.props,null,h.mode,N),Fa(N,v),N.return=h,h=N)}return c(h);case pl:l:{for(Q=v.key;r!==null;){if(r.key===Q)if(r.tag===4&&r.stateNode.containerInfo===v.containerInfo&&r.stateNode.implementation===v.implementation){t(h,r.sibling),N=n(r,v.children||[]),N.return=h,h=N;break l}else{t(h,r);break}else e(h,r);r=r.sibling}N=Uu(v,h.mode,N),N.return=h,h=N}return c(h);case Al:return v=Yt(v),vl(h,r,v,N)}if(Il(v))return H(h,r,v,N);if(G(v)){if(Q=G(v),typeof Q!="function")throw Error(d(150));return v=Q.call(v),L(h,r,v,N)}if(typeof v.then=="function")return vl(h,r,ti(v),N);if(v.$$typeof===yl)return vl(h,r,In(h,v),N);ai(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,r!==null&&r.tag===6?(t(h,r.sibling),N=n(r,v),N.return=h,h=N):(t(h,r),N=Ou(v,h.mode,N),N.return=h,h=N),c(h)):t(h,r)}return function(h,r,v,N){try{Wa=0;var Q=vl(h,r,v,N);return ha=null,Q}catch(q){if(q===ma||q===li)throw q;var il=me(29,q,null,h.mode);return il.lanes=N,il.return=h,il}finally{}}}var Qt=Xf(!0),Lf=Xf(!1),st=!1;function Zu(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vu(l,e){l=l.updateQueue,e.updateQueue===l&&(e.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ft(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function ot(l,e,t){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(cl&2)!==0){var n=a.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),a.pending=e,e=Jn(l),Ef(l,null,t),e}return Kn(l,a,e,t),Jn(l)}function Ia(l,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194048)!==0)){var a=e.lanes;a&=l.pendingLanes,t|=a,e.lanes=t,Ds(l,t)}}function ku(l,e){var t=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,t===a)){var n=null,i=null;if(t=t.firstBaseUpdate,t!==null){do{var c={lane:t.lane,tag:t.tag,payload:t.payload,callback:null,next:null};i===null?n=i=c:i=i.next=c,t=t.next}while(t!==null);i===null?n=i=e:i=i.next=e}else n=i=e;t={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:i,shared:a.shared,callbacks:a.callbacks},l.updateQueue=t;return}l=t.lastBaseUpdate,l===null?t.firstBaseUpdate=e:l.next=e,t.lastBaseUpdate=e}var Ku=!1;function Pa(){if(Ku){var l=ra;if(l!==null)throw l}}function ln(l,e,t,a){Ku=!1;var n=l.updateQueue;st=!1;var i=n.firstBaseUpdate,c=n.lastBaseUpdate,s=n.shared.pending;if(s!==null){n.shared.pending=null;var f=s,x=f.next;f.next=null,c===null?i=x:c.next=x,c=f;var z=l.alternate;z!==null&&(z=z.updateQueue,s=z.lastBaseUpdate,s!==c&&(s===null?z.firstBaseUpdate=x:s.next=x,z.lastBaseUpdate=f))}if(i!==null){var S=n.baseState;c=0,z=x=f=null,s=i;do{var g=s.lane&-536870913,b=g!==s.lane;if(b?(tl&g)===g:(a&g)===g){g!==0&&g===da&&(Ku=!0),z!==null&&(z=z.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});l:{var H=l,L=s;g=e;var vl=t;switch(L.tag){case 1:if(H=L.payload,typeof H=="function"){S=H.call(vl,S,g);break l}S=H;break l;case 3:H.flags=H.flags&-65537|128;case 0:if(H=L.payload,g=typeof H=="function"?H.call(vl,S,g):H,g==null)break l;S=U({},S,g);break l;case 2:st=!0}}g=s.callback,g!==null&&(l.flags|=64,b&&(l.flags|=8192),b=n.callbacks,b===null?n.callbacks=[g]:b.push(g))}else b={lane:g,tag:s.tag,payload:s.payload,callback:s.callback,next:null},z===null?(x=z=b,f=S):z=z.next=b,c|=g;if(s=s.next,s===null){if(s=n.shared.pending,s===null)break;b=s,s=b.next,b.next=null,n.lastBaseUpdate=b,n.shared.pending=null}}while(!0);z===null&&(f=S),n.baseState=f,n.firstBaseUpdate=x,n.lastBaseUpdate=z,i===null&&(n.shared.lanes=0),vt|=c,l.lanes=c,l.memoizedState=S}}function Zf(l,e){if(typeof l!="function")throw Error(d(191,l));l.call(e)}function Vf(l,e){var t=l.callbacks;if(t!==null)for(l.callbacks=null,l=0;li?i:8;var c=p.T,s={};p.T=s,rc(l,!1,e,t);try{var f=n(),x=p.S;if(x!==null&&x(s,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var z=om(f,a);an(l,e,z,ge(l))}else an(l,e,a,ge(l))}catch(S){an(l,e,{then:function(){},status:"rejected",reason:S},ge())}finally{D.p=i,c!==null&&s.types!==null&&(c.types=s.types),p.T=c}}function xm(){}function oc(l,e,t,a){if(l.tag!==5)throw Error(d(476));var n=So(l).queue;No(l,n,e,k,t===null?xm:function(){return _o(l),t(a)})}function So(l){var e=l.memoizedState;if(e!==null)return e;e={memoizedState:k,baseState:k,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ve,lastRenderedState:k},next:null};var t={};return e.next={memoizedState:t,baseState:t,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ve,lastRenderedState:t},next:null},l.memoizedState=e,l=l.alternate,l!==null&&(l.memoizedState=e),e}function _o(l){var e=So(l);e.next===null&&(e=l.alternate.memoizedState),an(l,e.next.queue,{},ge())}function dc(){return kl(zn)}function Eo(){return Dl().memoizedState}function Ao(){return Dl().memoizedState}function ym(l){for(var e=l.return;e!==null;){switch(e.tag){case 24:case 3:var t=ge();l=ft(t);var a=ot(e,l,t);a!==null&&(ce(a,e,t),Ia(a,e,t)),e={cache:Gu()},l.payload=e;return}e=e.return}}function gm(l,e,t){var a=ge();t={lane:a,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null},mi(l)?Mo(e,t):(t=Mu(l,e,t,a),t!==null&&(ce(t,l,a),wo(t,e,a)))}function To(l,e,t){var a=ge();an(l,e,t,a)}function an(l,e,t,a){var n={lane:a,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null};if(mi(l))Mo(e,n);else{var i=l.alternate;if(l.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var c=e.lastRenderedState,s=i(c,t);if(n.hasEagerState=!0,n.eagerState=s,re(s,c))return Kn(l,e,n,0),bl===null&&kn(),!1}catch{}finally{}if(t=Mu(l,e,n,a),t!==null)return ce(t,l,a),wo(t,e,a),!0}return!1}function rc(l,e,t,a){if(a={lane:2,revertLane:Zc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},mi(l)){if(e)throw Error(d(479))}else e=Mu(l,t,a,2),e!==null&&ce(e,l,2)}function mi(l){var e=l.alternate;return l===W||e!==null&&e===W}function Mo(l,e){xa=ui=!0;var t=l.pending;t===null?e.next=e:(e.next=t.next,t.next=e),l.pending=e}function wo(l,e,t){if((t&4194048)!==0){var a=e.lanes;a&=l.pendingLanes,t|=a,e.lanes=t,Ds(l,t)}}var nn={readContext:kl,use:fi,useCallback:Tl,useContext:Tl,useEffect:Tl,useImperativeHandle:Tl,useLayoutEffect:Tl,useInsertionEffect:Tl,useMemo:Tl,useReducer:Tl,useRef:Tl,useState:Tl,useDebugValue:Tl,useDeferredValue:Tl,useTransition:Tl,useSyncExternalStore:Tl,useId:Tl,useHostTransitionStatus:Tl,useFormState:Tl,useActionState:Tl,useOptimistic:Tl,useMemoCache:Tl,useCacheRefresh:Tl};nn.useEffectEvent=Tl;var Oo={readContext:kl,use:fi,useCallback:function(l,e){return le().memoizedState=[l,e===void 0?null:e],l},useContext:kl,useEffect:ho,useImperativeHandle:function(l,e,t){t=t!=null?t.concat([l]):null,di(4194308,4,go.bind(null,e,l),t)},useLayoutEffect:function(l,e){return di(4194308,4,l,e)},useInsertionEffect:function(l,e){di(4,2,l,e)},useMemo:function(l,e){var t=le();e=e===void 0?null:e;var a=l();if(Xt){et(!0);try{l()}finally{et(!1)}}return t.memoizedState=[a,e],a},useReducer:function(l,e,t){var a=le();if(t!==void 0){var n=t(e);if(Xt){et(!0);try{t(e)}finally{et(!1)}}}else n=e;return a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:n},a.queue=l,l=l.dispatch=gm.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var e=le();return l={current:l},e.memoizedState=l},useState:function(l){l=ic(l);var e=l.queue,t=To.bind(null,W,e);return e.dispatch=t,[l.memoizedState,t]},useDebugValue:sc,useDeferredValue:function(l,e){var t=le();return fc(t,l,e)},useTransition:function(){var l=ic(!1);return l=No.bind(null,W,l.queue,!0,!1),le().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,e,t){var a=W,n=le();if(nl){if(t===void 0)throw Error(d(407));t=t()}else{if(t=e(),bl===null)throw Error(d(349));(tl&127)!==0||Ff(a,e,t)}n.memoizedState=t;var i={value:t,getSnapshot:e};return n.queue=i,ho(Pf.bind(null,a,i,l),[l]),a.flags|=2048,ga(9,{destroy:void 0},If.bind(null,a,i,t,e),null),t},useId:function(){var l=le(),e=bl.identifierPrefix;if(nl){var t=Ce,a=De;t=(a&~(1<<32-de(a)-1)).toString(32)+t,e="_"+e+"R_"+t,t=ci++,0<\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?i.multiple=!0:a.size&&(i.size=a.size);break;default:i=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}i[Zl]=e,i[ee]=a;l:for(c=e.child;c!==null;){if(c.tag===5||c.tag===6)i.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break l;for(;c.sibling===null;){if(c.return===null||c.return===e)break l;c=c.return}c.sibling.return=c.return,c=c.sibling}e.stateNode=i;l:switch(Jl(i,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&Ke(e)}}return Sl(e),Ec(e,e.type,l===null?null:l.memoizedProps,e.pendingProps,t),null;case 6:if(l&&e.stateNode!=null)l.memoizedProps!==a&&Ke(e);else{if(typeof a!="string"&&e.stateNode===null)throw Error(d(166));if(l=P.current,fa(e)){if(l=e.stateNode,t=e.memoizedProps,a=null,n=Vl,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}l[Zl]=e,l=!!(l.nodeValue===t||a!==null&&a.suppressHydrationWarning===!0||Wd(l.nodeValue,t)),l||ut(e,!0)}else l=Di(l).createTextNode(a),l[Zl]=e,e.stateNode=l}return Sl(e),null;case 31:if(t=e.memoizedState,l===null||l.memoizedState!==null){if(a=fa(e),t!==null){if(l===null){if(!a)throw Error(d(318));if(l=e.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(d(557));l[Zl]=e}else Ht(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Sl(e),l=!1}else t=Ru(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=t),l=!0;if(!l)return e.flags&256?(ve(e),e):(ve(e),null);if((e.flags&128)!==0)throw Error(d(558))}return Sl(e),null;case 13:if(a=e.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(n=fa(e),a!==null&&a.dehydrated!==null){if(l===null){if(!n)throw Error(d(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(d(317));n[Zl]=e}else Ht(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Sl(e),n=!1}else n=Ru(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=n),n=!0;if(!n)return e.flags&256?(ve(e),e):(ve(e),null)}return ve(e),(e.flags&128)!==0?(e.lanes=t,e):(t=a!==null,l=l!==null&&l.memoizedState!==null,t&&(a=e.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==n&&(a.flags|=2048)),t!==l&&t&&(e.child.flags|=8192),gi(e,e.updateQueue),Sl(e),null);case 4:return Ol(),l===null&&Jc(e.stateNode.containerInfo),Sl(e),null;case 10:return Le(e.type),Sl(e),null;case 19:if(E(Ul),a=e.memoizedState,a===null)return Sl(e),null;if(n=(e.flags&128)!==0,i=a.rendering,i===null)if(n)cn(a,!1);else{if(Ml!==0||l!==null&&(l.flags&128)!==0)for(l=e.child;l!==null;){if(i=ii(l),i!==null){for(e.flags|=128,cn(a,!1),l=i.updateQueue,e.updateQueue=l,gi(e,l),e.subtreeFlags=0,l=t,t=e.child;t!==null;)Af(t,l),t=t.sibling;return C(Ul,Ul.current&1|2),nl&&Qe(e,a.treeForkCount),e.child}l=l.sibling}a.tail!==null&&fe()>Ni&&(e.flags|=128,n=!0,cn(a,!1),e.lanes=4194304)}else{if(!n)if(l=ii(i),l!==null){if(e.flags|=128,n=!0,l=l.updateQueue,e.updateQueue=l,gi(e,l),cn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!nl)return Sl(e),null}else 2*fe()-a.renderingStartTime>Ni&&t!==536870912&&(e.flags|=128,n=!0,cn(a,!1),e.lanes=4194304);a.isBackwards?(i.sibling=e.child,e.child=i):(l=a.last,l!==null?l.sibling=i:e.child=i,a.last=i)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=fe(),l.sibling=null,t=Ul.current,C(Ul,n?t&1|2:t&1),nl&&Qe(e,a.treeForkCount),l):(Sl(e),null);case 22:case 23:return ve(e),$u(),a=e.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(e.flags|=8192):a&&(e.flags|=8192),a?(t&536870912)!==0&&(e.flags&128)===0&&(Sl(e),e.subtreeFlags&6&&(e.flags|=8192)):Sl(e),t=e.updateQueue,t!==null&&gi(e,t.retryQueue),t=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(t=l.memoizedState.cachePool.pool),a=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),a!==t&&(e.flags|=2048),l!==null&&E(Bt),null;case 24:return t=null,l!==null&&(t=l.memoizedState.cache),e.memoizedState.cache!==t&&(e.flags|=2048),Le(Rl),Sl(e),null;case 25:return null;case 30:return null}throw Error(d(156,e.tag))}function Nm(l,e){switch(Cu(e),e.tag){case 1:return l=e.flags,l&65536?(e.flags=l&-65537|128,e):null;case 3:return Le(Rl),Ol(),l=e.flags,(l&65536)!==0&&(l&128)===0?(e.flags=l&-65537|128,e):null;case 26:case 27:case 5:return Mn(e),null;case 31:if(e.memoizedState!==null){if(ve(e),e.alternate===null)throw Error(d(340));Ht()}return l=e.flags,l&65536?(e.flags=l&-65537|128,e):null;case 13:if(ve(e),l=e.memoizedState,l!==null&&l.dehydrated!==null){if(e.alternate===null)throw Error(d(340));Ht()}return l=e.flags,l&65536?(e.flags=l&-65537|128,e):null;case 19:return E(Ul),null;case 4:return Ol(),null;case 10:return Le(e.type),null;case 22:case 23:return ve(e),$u(),l!==null&&E(Bt),l=e.flags,l&65536?(e.flags=l&-65537|128,e):null;case 24:return Le(Rl),null;case 25:return null;default:return null}}function ed(l,e){switch(Cu(e),e.tag){case 3:Le(Rl),Ol();break;case 26:case 27:case 5:Mn(e);break;case 4:Ol();break;case 31:e.memoizedState!==null&&ve(e);break;case 13:ve(e);break;case 19:E(Ul);break;case 10:Le(e.type);break;case 22:case 23:ve(e),$u(),l!==null&&E(Bt);break;case 24:Le(Rl)}}function sn(l,e){try{var t=e.updateQueue,a=t!==null?t.lastEffect:null;if(a!==null){var n=a.next;t=n;do{if((t.tag&l)===l){a=void 0;var i=t.create,c=t.inst;a=i(),c.destroy=a}t=t.next}while(t!==n)}}catch(s){dl(e,e.return,s)}}function mt(l,e,t){try{var a=e.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var i=n.next;a=i;do{if((a.tag&l)===l){var c=a.inst,s=c.destroy;if(s!==void 0){c.destroy=void 0,n=e;var f=t,x=s;try{x()}catch(z){dl(n,f,z)}}}a=a.next}while(a!==i)}}catch(z){dl(e,e.return,z)}}function td(l){var e=l.updateQueue;if(e!==null){var t=l.stateNode;try{Vf(e,t)}catch(a){dl(l,l.return,a)}}}function ad(l,e,t){t.props=Lt(l.type,l.memoizedProps),t.state=l.memoizedState;try{t.componentWillUnmount()}catch(a){dl(l,e,a)}}function fn(l,e){try{var t=l.ref;if(t!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof t=="function"?l.refCleanup=t(a):t.current=a}}catch(n){dl(l,e,n)}}function He(l,e){var t=l.ref,a=l.refCleanup;if(t!==null)if(typeof a=="function")try{a()}catch(n){dl(l,e,n)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof t=="function")try{t(null)}catch(n){dl(l,e,n)}else t.current=null}function nd(l){var e=l.type,t=l.memoizedProps,a=l.stateNode;try{l:switch(e){case"button":case"input":case"select":case"textarea":t.autoFocus&&a.focus();break l;case"img":t.src?a.src=t.src:t.srcSet&&(a.srcset=t.srcSet)}}catch(n){dl(l,l.return,n)}}function Ac(l,e,t){try{var a=l.stateNode;Vm(a,l.type,t,e),a[ee]=e}catch(n){dl(l,l.return,n)}}function id(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&pt(l.type)||l.tag===4}function Tc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||id(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&pt(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Mc(l,e,t){var a=l.tag;if(a===5||a===6)l=l.stateNode,e?(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t).insertBefore(l,e):(e=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,e.appendChild(l),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Be));else if(a!==4&&(a===27&&pt(l.type)&&(t=l.stateNode,e=null),l=l.child,l!==null))for(Mc(l,e,t),l=l.sibling;l!==null;)Mc(l,e,t),l=l.sibling}function bi(l,e,t){var a=l.tag;if(a===5||a===6)l=l.stateNode,e?t.insertBefore(l,e):t.appendChild(l);else if(a!==4&&(a===27&&pt(l.type)&&(t=l.stateNode),l=l.child,l!==null))for(bi(l,e,t),l=l.sibling;l!==null;)bi(l,e,t),l=l.sibling}function ud(l){var e=l.stateNode,t=l.memoizedProps;try{for(var a=l.type,n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Jl(e,a,t),e[Zl]=l,e[ee]=t}catch(i){dl(l,l.return,i)}}var Je=!1,Yl=!1,wc=!1,cd=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function Sm(l,e){if(l=l.containerInfo,Fc=Gi,l=gf(l),Nu(l)){if("selectionStart"in l)var t={start:l.selectionStart,end:l.selectionEnd};else l:{t=(t=l.ownerDocument)&&t.defaultView||window;var a=t.getSelection&&t.getSelection();if(a&&a.rangeCount!==0){t=a.anchorNode;var n=a.anchorOffset,i=a.focusNode;a=a.focusOffset;try{t.nodeType,i.nodeType}catch{t=null;break l}var c=0,s=-1,f=-1,x=0,z=0,S=l,g=null;e:for(;;){for(var b;S!==t||n!==0&&S.nodeType!==3||(s=c+n),S!==i||a!==0&&S.nodeType!==3||(f=c+a),S.nodeType===3&&(c+=S.nodeValue.length),(b=S.firstChild)!==null;)g=S,S=b;for(;;){if(S===l)break e;if(g===t&&++x===n&&(s=c),g===i&&++z===a&&(f=c),(b=S.nextSibling)!==null)break;S=g,g=S.parentNode}S=b}t=s===-1||f===-1?null:{start:s,end:f}}else t=null}t=t||{start:0,end:0}}else t=null;for(Ic={focusedElem:l,selectionRange:t},Gi=!1,Ll=e;Ll!==null;)if(e=Ll,l=e.child,(e.subtreeFlags&1028)!==0&&l!==null)l.return=e,Ll=l;else for(;Ll!==null;){switch(e=Ll,i=e.alternate,l=e.flags,e.tag){case 0:if((l&4)!==0&&(l=e.updateQueue,l=l!==null?l.events:null,l!==null))for(t=0;t title"))),Jl(i,a,t),i[Zl]=l,Xl(i),a=i;break l;case"link":var c=mr("link","href",n).get(a+(t.href||""));if(c){for(var s=0;svl&&(c=vl,vl=L,L=c);var h=xf(s,L),r=xf(s,vl);if(h&&r&&(b.rangeCount!==1||b.anchorNode!==h.node||b.anchorOffset!==h.offset||b.focusNode!==r.node||b.focusOffset!==r.offset)){var v=S.createRange();v.setStart(h.node,h.offset),b.removeAllRanges(),L>vl?(b.addRange(v),b.extend(r.node,r.offset)):(v.setEnd(r.node,r.offset),b.addRange(v))}}}}for(S=[],b=s;b=b.parentNode;)b.nodeType===1&&S.push({element:b,left:b.scrollLeft,top:b.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;st?32:t,p.T=null,t=qc,qc=null;var i=yt,c=Pe;if(Ql=0,Na=yt=null,Pe=0,(cl&6)!==0)throw Error(d(331));var s=cl;if(cl|=4,gd(i.current),vd(i,i.current,c,t),cl=s,vn(0,!1),oe&&typeof oe.onPostCommitFiberRoot=="function")try{oe.onPostCommitFiberRoot(Ua,i)}catch{}return!0}finally{D.p=n,p.T=a,Rd(l,e)}}function Bd(l,e,t){e=je(t,e),e=xc(l.stateNode,e,2),l=ot(l,e,2),l!==null&&(Ca(l,2),Re(l))}function dl(l,e,t){if(l.tag===3)Bd(l,l,t);else for(;e!==null;){if(e.tag===3){Bd(e,l,t);break}else if(e.tag===1){var a=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(xt===null||!xt.has(a))){l=je(t,l),t=Yo(2),a=ot(e,t,2),a!==null&&(Go(t,a,e,l),Ca(a,2),Re(a));break}}e=e.return}}function Qc(l,e,t){var a=l.pingCache;if(a===null){a=l.pingCache=new Am;var n=new Set;a.set(e,n)}else n=a.get(e),n===void 0&&(n=new Set,a.set(e,n));n.has(t)||(Dc=!0,n.add(t),l=Um.bind(null,l,e,t),e.then(l,l))}function Um(l,e,t){var a=l.pingCache;a!==null&&a.delete(e),l.pingedLanes|=l.suspendedLanes&t,l.warmLanes&=~t,bl===l&&(tl&t)===t&&(Ml===4||Ml===3&&(tl&62914560)===tl&&300>fe()-ji?(cl&2)===0&&Sa(l,0):Cc|=t,ja===tl&&(ja=0)),Re(l)}function Yd(l,e){e===0&&(e=Os()),l=Dt(l,e),l!==null&&(Ca(l,e),Re(l))}function Dm(l){var e=l.memoizedState,t=0;e!==null&&(t=e.retryLane),Yd(l,t)}function Cm(l,e){var t=0;switch(l.tag){case 31:case 13:var a=l.stateNode,n=l.memoizedState;n!==null&&(t=n.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(d(314))}a!==null&&a.delete(e),Yd(l,t)}function Hm(l,e){return lu(l,e)}var Mi=null,Ea=null,Xc=!1,wi=!1,Lc=!1,bt=0;function Re(l){l!==Ea&&l.next===null&&(Ea===null?Mi=Ea=l:Ea=Ea.next=l),wi=!0,Xc||(Xc=!0,qm())}function vn(l,e){if(!Lc&&wi){Lc=!0;do for(var t=!1,a=Mi;a!==null;){if(l!==0){var n=a.pendingLanes;if(n===0)var i=0;else{var c=a.suspendedLanes,s=a.pingedLanes;i=(1<<31-de(42|l)+1)-1,i&=n&~(c&~s),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(t=!0,Ld(a,i))}else i=tl,i=Cn(a,a===bl?i:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(i&3)===0||Da(a,i)||(t=!0,Ld(a,i));a=a.next}while(t);Lc=!1}}function Rm(){Gd()}function Gd(){wi=Xc=!1;var l=0;bt!==0&&Km()&&(l=bt);for(var e=fe(),t=null,a=Mi;a!==null;){var n=a.next,i=Qd(a,e);i===0?(a.next=null,t===null?Mi=n:t.next=n,n===null&&(Ea=t)):(t=a,(l!==0||(i&3)!==0)&&(wi=!0)),a=n}Ql!==0&&Ql!==5||vn(l),bt!==0&&(bt=0)}function Qd(l,e){for(var t=l.suspendedLanes,a=l.pingedLanes,n=l.expirationTimes,i=l.pendingLanes&-62914561;0s)break;var z=f.transferSize,S=f.initiatorType;z&&Fd(S)&&(f=f.responseEnd,c+=z*(f"u"?null:document;function fr(l,e,t){var a=Aa;if(a&&typeof e=="string"&&e){var n=pe(e);n='link[rel="'+l+'"][href="'+n+'"]',typeof t=="string"&&(n+='[crossorigin="'+t+'"]'),sr.has(n)||(sr.add(n),l={rel:l,crossOrigin:t,href:e},a.querySelector(n)===null&&(e=a.createElement("link"),Jl(e,"link",l),Xl(e),a.head.appendChild(e)))}}function th(l){lt.D(l),fr("dns-prefetch",l,null)}function ah(l,e){lt.C(l,e),fr("preconnect",l,e)}function nh(l,e,t){lt.L(l,e,t);var a=Aa;if(a&&l&&e){var n='link[rel="preload"][as="'+pe(e)+'"]';e==="image"&&t&&t.imageSrcSet?(n+='[imagesrcset="'+pe(t.imageSrcSet)+'"]',typeof t.imageSizes=="string"&&(n+='[imagesizes="'+pe(t.imageSizes)+'"]')):n+='[href="'+pe(l)+'"]';var i=n;switch(e){case"style":i=Ta(l);break;case"script":i=Ma(l)}Te.has(i)||(l=U({rel:"preload",href:e==="image"&&t&&t.imageSrcSet?void 0:l,as:e},t),Te.set(i,l),a.querySelector(n)!==null||e==="style"&&a.querySelector(bn(i))||e==="script"&&a.querySelector(pn(i))||(e=a.createElement("link"),Jl(e,"link",l),Xl(e),a.head.appendChild(e)))}}function ih(l,e){lt.m(l,e);var t=Aa;if(t&&l){var a=e&&typeof e.as=="string"?e.as:"script",n='link[rel="modulepreload"][as="'+pe(a)+'"][href="'+pe(l)+'"]',i=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Ma(l)}if(!Te.has(i)&&(l=U({rel:"modulepreload",href:l},e),Te.set(i,l),t.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(t.querySelector(pn(i)))return}a=t.createElement("link"),Jl(a,"link",l),Xl(a),t.head.appendChild(a)}}}function uh(l,e,t){lt.S(l,e,t);var a=Aa;if(a&&l){var n=Wt(a).hoistableStyles,i=Ta(l);e=e||"default";var c=n.get(i);if(!c){var s={loading:0,preload:null};if(c=a.querySelector(bn(i)))s.loading=5;else{l=U({rel:"stylesheet",href:l,"data-precedence":e},t),(t=Te.get(i))&&is(l,t);var f=c=a.createElement("link");Xl(f),Jl(f,"link",l),f._p=new Promise(function(x,z){f.onload=x,f.onerror=z}),f.addEventListener("load",function(){s.loading|=1}),f.addEventListener("error",function(){s.loading|=2}),s.loading|=4,Hi(c,e,a)}c={type:"stylesheet",instance:c,count:1,state:s},n.set(i,c)}}}function ch(l,e){lt.X(l,e);var t=Aa;if(t&&l){var a=Wt(t).hoistableScripts,n=Ma(l),i=a.get(n);i||(i=t.querySelector(pn(n)),i||(l=U({src:l,async:!0},e),(e=Te.get(n))&&us(l,e),i=t.createElement("script"),Xl(i),Jl(i,"link",l),t.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function sh(l,e){lt.M(l,e);var t=Aa;if(t&&l){var a=Wt(t).hoistableScripts,n=Ma(l),i=a.get(n);i||(i=t.querySelector(pn(n)),i||(l=U({src:l,async:!0,type:"module"},e),(e=Te.get(n))&&us(l,e),i=t.createElement("script"),Xl(i),Jl(i,"link",l),t.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function or(l,e,t,a){var n=(n=P.current)?Ci(n):null;if(!n)throw Error(d(446));switch(l){case"meta":case"title":return null;case"style":return typeof t.precedence=="string"&&typeof t.href=="string"?(e=Ta(t.href),t=Wt(n).hoistableStyles,a=t.get(e),a||(a={type:"style",instance:null,count:0,state:null},t.set(e,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(t.rel==="stylesheet"&&typeof t.href=="string"&&typeof t.precedence=="string"){l=Ta(t.href);var i=Wt(n).hoistableStyles,c=i.get(l);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(l,c),(i=n.querySelector(bn(l)))&&!i._p&&(c.instance=i,c.state.loading=5),Te.has(l)||(t={rel:"preload",as:"style",href:t.href,crossOrigin:t.crossOrigin,integrity:t.integrity,media:t.media,hrefLang:t.hrefLang,referrerPolicy:t.referrerPolicy},Te.set(l,t),i||fh(n,l,t,c.state))),e&&a===null)throw Error(d(528,""));return c}if(e&&a!==null)throw Error(d(529,""));return null;case"script":return e=t.async,t=t.src,typeof t=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Ma(t),t=Wt(n).hoistableScripts,a=t.get(e),a||(a={type:"script",instance:null,count:0,state:null},t.set(e,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(d(444,l))}}function Ta(l){return'href="'+pe(l)+'"'}function bn(l){return'link[rel="stylesheet"]['+l+"]"}function dr(l){return U({},l,{"data-precedence":l.precedence,precedence:null})}function fh(l,e,t,a){l.querySelector('link[rel="preload"][as="style"]['+e+"]")?a.loading=1:(e=l.createElement("link"),a.preload=e,e.addEventListener("load",function(){return a.loading|=1}),e.addEventListener("error",function(){return a.loading|=2}),Jl(e,"link",t),Xl(e),l.head.appendChild(e))}function Ma(l){return'[src="'+pe(l)+'"]'}function pn(l){return"script[async]"+l}function rr(l,e,t){if(e.count++,e.instance===null)switch(e.type){case"style":var a=l.querySelector('style[data-href~="'+pe(t.href)+'"]');if(a)return e.instance=a,Xl(a),a;var n=U({},t,{"data-href":t.href,"data-precedence":t.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Xl(a),Jl(a,"style",n),Hi(a,t.precedence,l),e.instance=a;case"stylesheet":n=Ta(t.href);var i=l.querySelector(bn(n));if(i)return e.state.loading|=4,e.instance=i,Xl(i),i;a=dr(t),(n=Te.get(n))&&is(a,n),i=(l.ownerDocument||l).createElement("link"),Xl(i);var c=i;return c._p=new Promise(function(s,f){c.onload=s,c.onerror=f}),Jl(i,"link",a),e.state.loading|=4,Hi(i,t.precedence,l),e.instance=i;case"script":return i=Ma(t.src),(n=l.querySelector(pn(i)))?(e.instance=n,Xl(n),n):(a=t,(n=Te.get(i))&&(a=U({},t),us(a,n)),l=l.ownerDocument||l,n=l.createElement("script"),Xl(n),Jl(n,"link",a),l.head.appendChild(n),e.instance=n);case"void":return null;default:throw Error(d(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(a=e.instance,e.state.loading|=4,Hi(a,t.precedence,l));return e.instance}function Hi(l,e,t){for(var a=t.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,i=n,c=0;c title"):null)}function oh(l,e,t){if(t===1||e.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return l=e.disabled,typeof e.precedence=="string"&&l==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function vr(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function dh(l,e,t,a){if(t.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(t.state.loading&4)===0){if(t.instance===null){var n=Ta(a.href),i=e.querySelector(bn(n));if(i){e=i._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(l.count++,l=qi.bind(l),e.then(l,l)),t.state.loading|=4,t.instance=i,Xl(i);return}i=e.ownerDocument||e,a=dr(a),(n=Te.get(n))&&is(a,n),i=i.createElement("link"),Xl(i);var c=i;c._p=new Promise(function(s,f){c.onload=s,c.onerror=f}),Jl(i,"link",a),t.instance=i}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(t,e),(e=t.state.preload)&&(t.state.loading&3)===0&&(l.count++,t=qi.bind(l),e.addEventListener("load",t),e.addEventListener("error",t))}}var cs=0;function rh(l,e){return l.stylesheets&&l.count===0&&Yi(l,l.stylesheets),0cs?50:800)+e);return l.unsuspend=t,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function qi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yi(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Bi=null;function Yi(l,e){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Bi=new Map,e.forEach(mh,l),Bi=null,qi.call(l))}function mh(l,e){if(!(e.state.loading&4)){var t=Bi.get(l);if(t)var a=t.get(null);else{t=new Map,Bi.set(l,t);for(var n=l.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(j){console.error(j)}}return o(),xs.exports=wh(),xs.exports}var Uh=Oh();const Dh=Zr(Uh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ch=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Hh=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(j,_,d)=>d?d.toUpperCase():_.toLowerCase()),Yr=o=>{const j=Hh(o);return j.charAt(0).toUpperCase()+j.slice(1)},Vr=(...o)=>o.filter((j,_,d)=>!!j&&j.trim()!==""&&d.indexOf(j)===_).join(" ").trim(),Rh=o=>{for(const j in o)if(j.startsWith("aria-")||j==="role"||j==="title")return!0};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var qh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bh=X.forwardRef(({color:o="currentColor",size:j=24,strokeWidth:_=2,absoluteStrokeWidth:d,className:A="",children:w,iconNode:O,...M},T)=>X.createElement("svg",{ref:T,...qh,width:j,height:j,stroke:o,strokeWidth:d?Number(_)*24/Number(j):_,className:Vr("lucide",A),...!w&&!Rh(M)&&{"aria-hidden":"true"},...M},[...O.map(([y,B])=>X.createElement(y,B)),...Array.isArray(w)?w:[w]]));/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z=(o,j)=>{const _=X.forwardRef(({className:d,...A},w)=>X.createElement(Bh,{ref:w,iconNode:j,className:Vr(`lucide-${Ch(Yr(o))}`,`lucide-${o}`,d),...A}));return _.displayName=Yr(o),_};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yh=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Gh=Z("activity",Yh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qh=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Tn=Z("arrow-left",Qh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xh=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kr=Z("arrow-right",Xh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lh=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Zh=Z("bell",Lh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vh=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],kh=Z("chevron-down",Vh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kh=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Jh=Z("chevron-up",Kh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $h=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ji=Z("clock",$h);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wh=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Fh=Z("cloud-upload",Wh);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ih=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Ph=Z("credit-card",Ih);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l1=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],e1=Z("crown",l1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const t1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],$i=Z("disc",t1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Gr=Z("download",a1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],i1=Z("ellipsis",n1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u1=[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]],c1=Z("facebook",u1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s1=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],Ss=Z("file-headphone",s1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f1=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],o1=Z("flame",f1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],r1=Z("heart",d1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Kr=Z("house",m1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h1=[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]],v1=Z("instagram",h1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],_s=Z("layers",x1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y1=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Jr=Z("library",y1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g1=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Qr=Z("link",g1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],p1=Z("lock",b1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z1=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],$r=Z("log-in",z1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],N1=Z("log-out",j1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],_1=Z("mail",S1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],A1=Z("menu",E1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T1=[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]],M1=Z("mic-vocal",T1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w1=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],O1=Z("mic",w1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U1=[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]],D1=Z("music-2",U1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C1=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],An=Z("music",C1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ki=Z("pause",H1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Et=Z("play",R1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q1=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],B1=Z("repeat",q1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y1=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],G1=Z("scissors",Y1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],X1=Z("settings-2",Q1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Z1=Z("settings",L1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V1=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],k1=Z("share-2",V1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],J1=Z("shield",K1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $1=[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]],W1=Z("shuffle",$1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F1=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],I1=Z("skip-back",F1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],lv=Z("skip-forward",P1);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ev=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ps=Z("sparkles",ev);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tv=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],av=Z("trending-up",tv);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nv=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],iv=Z("twitter",nv);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uv=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],cv=Z("upload",uv);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sv=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Wr=Z("user",sv);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fv=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],zs=Z("video",fv);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ov=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],dv=Z("volume-2",ov);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rv=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],mv=Z("wand-sparkles",rv);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],js=Z("x",hv),vv=({activeTab:o,setActiveTab:j,user:_,onLoginClick:d})=>{const A=[{id:"home",icon:Kr,label:"首页 (Home)"},{id:"create",icon:An,label:"创作 (Create)"},{id:"library",icon:Jr,label:"曲库 (Library)"},{id:"tools",icon:_s,label:"工具箱 (Tools)"}];return u.jsxs("div",{className:"w-full md:w-64 bg-black/40 backdrop-blur-xl border-r border-white/5 flex flex-col h-full",children:[u.jsx("div",{className:"p-6",children:u.jsxs("h1",{className:"text-2xl font-bold bg-gradient-to-br from-white to-zinc-500 bg-clip-text text-transparent flex items-center gap-3 tracking-tight",children:[u.jsxs("div",{className:"relative",children:[u.jsx($i,{className:"text-indigo-500 relative z-10"}),u.jsx("div",{className:"absolute inset-0 bg-indigo-500 blur-lg opacity-40"})]}),"朴见潮音"]})}),u.jsx("nav",{className:"flex-1 px-4 space-y-2 mt-4",children:A.map(w=>u.jsxs("button",{onClick:()=>j(w.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 font-medium group relative overflow-hidden ${o===w.id?"bg-gradient-to-r from-indigo-600/20 to-purple-600/10 text-white border border-indigo-500/30 shadow-[0_0_15px_rgba(79,70,229,0.15)]":"text-zinc-400 hover:text-white hover:bg-white/5"}`,children:[u.jsx(w.icon,{size:20,className:`transition-colors ${o===w.id?"text-indigo-400":"group-hover:text-white"}`}),u.jsx("span",{className:"relative z-10",children:w.label}),o===w.id&&u.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-indigo-500 rounded-full"})]},w.id))}),u.jsx("div",{className:"p-4 border-t border-white/5",children:_?u.jsxs("div",{onClick:()=>j("user"),className:`bg-gradient-to-br from-zinc-900 to-zinc-950 rounded-xl p-4 border border-white/5 shadow-lg relative overflow-hidden group cursor-pointer transition-all ${o==="user"?"ring-1 ring-indigo-500":"hover:bg-zinc-900"}`,children:[u.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-indigo-500/10 rounded-full blur-2xl -translate-y-1/2 translate-x-1/2 group-hover:bg-indigo-500/20 transition-colors"}),u.jsxs("div",{className:"flex items-center gap-3 mb-3 relative z-10",children:[u.jsx("img",{src:_.avatarUrl,alt:"Avatar",className:"w-10 h-10 rounded-full bg-zinc-800 border border-white/10"}),u.jsxs("div",{className:"overflow-hidden",children:[u.jsx("p",{className:"text-white font-bold text-sm truncate",children:_.name}),u.jsxs("p",{className:"text-zinc-500 text-xs truncate uppercase",children:[_.plan," Plan"]})]})]}),u.jsxs("div",{className:"relative z-10",children:[u.jsxs("div",{className:"flex justify-between items-end mb-1",children:[u.jsx("span",{className:"text-xs text-zinc-400",children:"剩余积分"}),u.jsx("span",{className:"text-sm font-bold text-white",children:_.credits})]}),u.jsx("div",{className:"w-full bg-zinc-800/50 h-1.5 rounded-full overflow-hidden",children:u.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-purple-500 h-full rounded-full shadow-[0_0_10px_rgba(99,102,241,0.5)]",style:{width:`${_.credits/500*100}%`}})})]})]}):u.jsxs("button",{onClick:d,className:"w-full py-3 bg-zinc-900 hover:bg-zinc-800 border border-zinc-800 rounded-xl flex items-center justify-center gap-2 text-white font-medium transition-colors",children:[u.jsx($r,{size:18}),u.jsx("span",{children:"登录 / 注册"})]})})]})},xv=({isOpen:o,onClose:j,activeTab:_,setActiveTab:d,user:A,onLoginClick:w})=>{const O=[{id:"home",icon:Kr,label:"首页 (Home)"},{id:"create",icon:An,label:"创作 (Create)"},{id:"library",icon:Jr,label:"曲库 (Library)"},{id:"tools",icon:_s,label:"工具箱 (Tools)"}];return o?u.jsxs("div",{className:"fixed inset-0 z-[60] md:hidden",children:[u.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm animate-in fade-in duration-200",onClick:j}),u.jsxs("div",{className:"absolute top-0 right-0 bottom-0 w-64 bg-zinc-950 border-l border-zinc-800 shadow-2xl animate-in slide-in-from-right duration-300 flex flex-col",children:[u.jsxs("div",{className:"p-6 flex items-center justify-between border-b border-zinc-800",children:[u.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[u.jsx($i,{className:"text-indigo-500"}),"朴见潮音"]}),u.jsx("button",{onClick:j,className:"text-zinc-400 hover:text-white",children:u.jsx(js,{size:24})})]}),u.jsx("nav",{className:"flex-1 p-4 space-y-2 overflow-y-auto",children:O.map(M=>u.jsxs("button",{onClick:()=>{d(M.id),j()},className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all font-medium ${_===M.id?"bg-indigo-600/10 text-indigo-400 border border-indigo-500/20":"text-zinc-400 hover:text-white hover:bg-zinc-900"}`,children:[u.jsx(M.icon,{size:20}),M.label]},M.id))}),u.jsx("div",{className:"p-6 border-t border-zinc-800 bg-zinc-900/50",children:A?u.jsxs("button",{onClick:()=>{d("user"),j()},className:"w-full flex items-center gap-3 p-2 rounded-lg hover:bg-zinc-800 transition-colors",children:[u.jsx("img",{src:A.avatarUrl,alt:"Avatar",className:"w-10 h-10 rounded-full bg-zinc-800"}),u.jsxs("div",{className:"text-left overflow-hidden flex-1",children:[u.jsx("p",{className:"text-white font-medium text-sm truncate",children:A.name}),u.jsx("p",{className:"text-zinc-500 text-xs truncate",children:"点击查看个人中心"})]})]}):u.jsxs("button",{onClick:()=>{w(),j()},className:"w-full py-3 bg-indigo-600 text-white rounded-xl font-medium flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/20",children:[u.jsx($r,{size:18}),"登录 / 注册"]})})]})]}):null};var se=(o=>(o.SUBMITTED="submitted",o.QUEUEING="queueing",o.PROCESSING="processing",o.COMPLETED="completed",o.ERROR="error",o))(se||{});const Fr=[{id:"s1",title:"赛博朋克夜雨",imageUrl:"https://picsum.photos/400/400?random=1",audioUrl:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",duration:120,tags:"electronic, synthwave, dark",status:se.COMPLETED,createdAt:new Date(Date.now()-36e5).toISOString(),isInstrumental:!1,model:"v3.5"},{id:"s2",title:"古风·长相思",imageUrl:"https://picsum.photos/400/400?random=2",audioUrl:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3",duration:185,tags:"chinese traditional, guzheng, emotional",status:se.COMPLETED,createdAt:new Date(Date.now()-72e5).toISOString(),isInstrumental:!1,model:"v3.5"}],Xr=["v3.5","v3","v2"],kt=o=>new Promise(j=>setTimeout(j,o)),Ue={async generateAuto(o){return console.log("Calling API: Music (Auto)",o),await kt(1500),[Math.random().toString(36).substr(2,9),Math.random().toString(36).substr(2,9)].map(_=>({id:_,title:o.prompt.slice(0,20)||"Generated Song",imageUrl:"https://picsum.photos/400/400?grayscale",audioUrl:"",duration:0,tags:"generated, pop",status:se.QUEUEING,createdAt:new Date().toISOString(),isInstrumental:o.make_instrumental,model:o.mv}))},async generateCustom(o){return console.log("Calling API: Generate (Custom/Extend)",o),await kt(1500),[Math.random().toString(36).substr(2,9),Math.random().toString(36).substr(2,9)].map(_=>({id:_,title:o.title||(o.continue_clip_id?"Extended Song":"Custom Song"),imageUrl:"https://picsum.photos/400/400?blur",audioUrl:"",duration:0,tags:o.tags,status:se.QUEUEING,createdAt:new Date().toISOString(),isInstrumental:o.make_instrumental,model:o.mv,lyrics:o.prompt,isExtension:!!o.continue_clip_id,parentId:o.continue_clip_id}))},async generateLyrics(o){return await kt(1e3),{title:"AI Generated Title",text:`[Verse 1] +Here is some generated lyrics based on: ${o} +Neon lights flashing in the rain... + +[Chorus] +Fly away, to the moon...`}},async fetchIds(o){return o.map(j=>{const _=Fr.find(d=>d.id===j);return _||{id:j,title:"处理完成 (Processed)",imageUrl:"https://picsum.photos/400/400?random="+j,audioUrl:"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3",duration:120,tags:"processing",status:se.COMPLETED,createdAt:new Date().toISOString(),isInstrumental:!1,model:"v3.5"}})},async getWavUrl(o){return await kt(500),"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"},async getVideoUrl(o){return await kt(500),"https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4"},async uploadAudio(o){return console.log("Uploading file:",o.name),await kt(2e3),"uploaded-audio-id-"+Date.now()},async processAudio(o){return console.log(`Processing Audio: ${o.operation}`,o),await kt(2e3),{id:"proc-"+Date.now(),title:`Processed (${o.operation})`,imageUrl:"https://picsum.photos/400/400?sepia",audioUrl:"",duration:100,tags:o.operation,status:se.QUEUEING,createdAt:new Date().toISOString(),isInstrumental:o.operation==="instrumental",model:"audio-v1"}}},yv=({onTasksCreated:o,extendSong:j,onClearExtend:_})=>{const[d,A]=X.useState("simple"),[w,O]=X.useState(!1),[M,T]=X.useState(!1),[y,B]=X.useState(Xr[0]),[U,V]=X.useState(null),[fl,pl]=X.useState(null),[xl,$l]=X.useState(""),[wl,Gl]=X.useState(""),[yl,_l]=X.useState(""),[Cl,zl]=X.useState(""),[K,Al]=X.useState(0);X.useEffect(()=>{j&&(A("custom"),zl(`Extend: ${j.title}`),_l(j.tags),Al(Math.floor(j.duration)),T(j.isInstrumental))},[j]);const Wl=async G=>{if(G.target.files&&G.target.files[0]){const jl=G.target.files[0];V(jl);try{const Hl=await Ue.uploadAudio(jl);pl(Hl)}catch{alert("Upload failed"),V(null)}}},Y=async()=>{const G=xl||yl||"About a journey";O(!0);try{const jl=await Ue.generateLyrics(G);Gl(jl.text),Cl||zl(jl.title)}catch(jl){console.error(jl)}finally{O(!1)}},I=async()=>{O(!0);try{let G=[];const jl={make_instrumental:M,mv:y,audio_upload_id:fl||void 0};if(d==="simple"&&!j){const Hl={...jl,prompt:xl};G=await Ue.generateAuto(Hl)}else{const Hl={...jl,prompt:wl,tags:yl,title:Cl,continue_at:j?K:void 0,continue_clip_id:j?j.id:void 0};G=await Ue.generateCustom(Hl)}o(G),j&&_&&_()}catch{alert("Creation failed. Please try again.")}finally{O(!1)}};return u.jsxs("div",{className:"max-w-3xl mx-auto w-full p-4 md:p-8 pb-32",children:[j&&u.jsxs("div",{className:"bg-indigo-900/30 border border-indigo-500/50 rounded-xl p-4 mb-6 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"bg-indigo-600 p-2 rounded-lg",children:u.jsx(X1,{className:"text-white",size:20})}),u.jsxs("div",{children:[u.jsxs("h3",{className:"font-bold text-white",children:["正在续写: ",j.title]}),u.jsxs("div",{className:"flex items-center gap-2 text-xs text-indigo-300",children:[u.jsx("span",{children:"从"}),u.jsx("input",{type:"number",value:K,onChange:G=>Al(Number(G.target.value)),className:"w-16 bg-black/30 border border-indigo-500/30 rounded px-1"}),u.jsxs("span",{children:["秒处开始 (总时长 ",j.duration,"s)"]})]})]})]}),u.jsx("button",{onClick:_,className:"text-zinc-400 hover:text-white",children:u.jsx(js,{size:20})})]}),u.jsxs("div",{className:"flex items-center justify-between mb-8",children:[u.jsx("h2",{className:"text-3xl font-bold text-white",children:j?"续写模式 (Extend)":"创作音乐 (Create)"}),u.jsxs("div",{className:"flex bg-zinc-800 p-1 rounded-lg",children:[u.jsx("button",{onClick:()=>A("simple"),disabled:!!j,className:`px-4 py-2 rounded-md text-sm font-medium transition-all ${d==="simple"?"bg-zinc-600 text-white shadow-sm":"text-zinc-400 hover:text-white disabled:opacity-30"}`,children:"全自动"}),u.jsx("button",{onClick:()=>A("custom"),className:`px-4 py-2 rounded-md text-sm font-medium transition-all ${d==="custom"?"bg-zinc-600 text-white shadow-sm":"text-zinc-400 hover:text-white"}`,children:"自定义"})]})]}),u.jsxs("div",{className:"space-y-6",children:[!j&&u.jsx("div",{className:"border border-dashed border-zinc-700 rounded-xl p-4 bg-zinc-900/30 hover:bg-zinc-900/50 transition-colors",children:u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("div",{className:"bg-zinc-800 p-3 rounded-full",children:u.jsx(Fh,{size:20,className:"text-zinc-400"})}),u.jsx("div",{className:"flex-1",children:U?u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-sm text-indigo-400 font-medium",children:U.name}),u.jsx("button",{onClick:()=>{V(null),pl(null)},className:"text-zinc-500 hover:text-red-400",children:u.jsx(js,{size:16})})]}):u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-medium text-white",children:"上传参考音频 (Upload Audio)"}),u.jsx("p",{className:"text-xs text-zinc-500",children:"用作生成的灵感素材 (MP3/WAV)"})]})}),!U&&u.jsxs("label",{className:"px-3 py-1.5 bg-zinc-700 hover:bg-zinc-600 rounded text-xs cursor-pointer text-white",children:["选择文件",u.jsx("input",{type:"file",accept:"audio/*",className:"hidden",onChange:Wl})]})]})}),u.jsxs("div",{className:"flex items-center justify-between bg-zinc-900/50 p-4 rounded-xl border border-zinc-800",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(O1,{className:`size-5 ${M?"text-zinc-500":"text-indigo-400"}`}),u.jsxs("div",{children:[u.jsx("p",{className:"text-white font-medium",children:"纯音乐 (Instrumental)"}),u.jsx("p",{className:"text-xs text-zinc-500",children:"不包含人声歌词"})]})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:M,onChange:G=>T(G.target.checked),className:"sr-only peer"}),u.jsx("div",{className:"w-11 h-6 bg-zinc-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"})]})]}),d==="simple"?u.jsxs("div",{className:"space-y-3",children:[u.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"歌曲描述 (Song Description)"}),u.jsx("textarea",{value:xl,onChange:G=>$l(G.target.value),placeholder:"例如:一首关于在东京雨夜漫步的慢节奏爵士乐,带有忧郁的女声...",className:"w-full h-32 bg-zinc-900 border border-zinc-700 rounded-xl p-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none resize-none"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"歌词 (Lyrics)"}),!M&&u.jsxs("button",{onClick:Y,disabled:w,className:"flex items-center gap-1 text-xs text-indigo-400 hover:text-indigo-300 disabled:opacity-50",children:[u.jsx(mv,{size:12}),"AI 生成歌词"]})]}),u.jsx("textarea",{value:wl,onChange:G=>Gl(G.target.value),disabled:M,placeholder:M?"纯音乐模式下无需歌词":`[Verse] +输入你的歌词...`,className:`w-full h-40 bg-zinc-900 border border-zinc-700 rounded-xl p-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none resize-none font-mono text-sm ${M?"opacity-50 cursor-not-allowed":""}`})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"音乐风格 (Style of Music)"}),u.jsx("textarea",{value:yl,onChange:G=>_l(G.target.value),placeholder:"例如:Pop, Rock, Male Vocals, Upbeat",className:"w-full h-20 bg-zinc-900 border border-zinc-700 rounded-xl p-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none resize-none"})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"标题 (Title)"}),u.jsx("input",{type:"text",value:Cl,onChange:G=>zl(G.target.value),placeholder:"给这首歌起个名字",className:"w-full bg-zinc-900 border border-zinc-700 rounded-xl p-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none"})]})]}),u.jsxs("div",{className:"flex items-end gap-4 pt-6 border-t border-zinc-800/50",children:[u.jsxs("div",{className:"w-1/3 min-w-[140px]",children:[u.jsx("label",{className:"text-xs text-zinc-500 block mb-2 font-medium",children:"模型版本 (Model)"}),u.jsxs("div",{className:"relative",children:[u.jsx("select",{value:y,onChange:G=>B(G.target.value),className:"bg-zinc-900 border border-zinc-700 text-zinc-200 text-sm rounded-xl block w-full p-3 pr-10 appearance-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none transition-all",children:Xr.map(G=>u.jsx("option",{value:G,children:G},G))}),u.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-zinc-500",children:u.jsx(kh,{size:16})})]})]}),u.jsx("div",{className:"flex-1",children:u.jsxs("button",{onClick:I,disabled:w||fl===null&&U!==null,className:"w-full py-3 px-6 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-800 disabled:text-zinc-500 disabled:cursor-not-allowed text-white font-bold rounded-xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-indigo-600/20 active:scale-[0.98]",children:[w?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-2 border-white border-t-transparent"}),"生成中..."]}):u.jsxs(u.Fragment,{children:[u.jsx(ps,{size:20,className:"fill-white"}),j?"生成续写 (Extend)":"立即生成 (Create)"]}),u.jsx("span",{className:"text-indigo-200 text-xs font-normal ml-1 hidden sm:inline",children:" (10 积分)"})]})})]})]})]})},gv=({songs:o,currentSong:j,isPlaying:_,onPlay:d,onExtend:A,onDetail:w})=>{const[O,M]=X.useState(null),T=async(y,B)=>{M(y);try{const U=B==="wav"?await Ue.getWavUrl(y):await Ue.getVideoUrl(y),V=document.createElement("a");V.href=U,V.download=`suno_${B}_${y}.${B==="wav"?"mp3":"mp4"}`,document.body.appendChild(V),V.click(),document.body.removeChild(V)}catch{alert("Download failed")}finally{M(null)}};return o.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-zinc-500",children:[u.jsx(Ji,{size:48,className:"mb-4 opacity-50"}),u.jsx("p",{children:"暂无创作记录,快去生成第一首歌吧!"})]}):u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-5 p-4 md:p-8 overflow-y-auto pb-48",children:o.map(y=>{const B=(j==null?void 0:j.id)===y.id;return u.jsxs("div",{onClick:()=>w(y),className:`group relative bg-zinc-900/40 backdrop-blur-md rounded-2xl overflow-hidden border transition-all duration-300 hover:-translate-y-1 cursor-pointer hover:shadow-xl ${B?"border-indigo-500/50 bg-indigo-900/10 shadow-[0_0_20px_rgba(99,102,241,0.15)]":"border-white/5 hover:border-white/10 hover:bg-zinc-800/60"}`,children:[u.jsxs("div",{className:"flex p-4 gap-4",children:[u.jsxs("div",{className:"relative w-24 h-24 flex-shrink-0 bg-zinc-950 rounded-xl overflow-hidden shadow-lg border border-white/5",onClick:U=>{U.stopPropagation(),d(y)},children:[u.jsx("img",{src:y.imageUrl,alt:y.title,className:"w-full h-full object-cover opacity-90 group-hover:opacity-100 transition-opacity"}),u.jsx("div",{className:`absolute inset-0 flex items-center justify-center bg-black/40 transition-opacity ${B?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:B&&_?u.jsx(Ki,{className:"text-white fill-white drop-shadow-lg",size:24}):u.jsx(Et,{className:"text-white fill-white drop-shadow-lg",size:24})}),y.status===se.QUEUEING&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80 backdrop-blur-sm z-10",children:u.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-indigo-500 border-t-transparent"})})]}),u.jsxs("div",{className:"flex flex-col justify-between flex-1 min-w-0",children:[u.jsxs("div",{children:[u.jsx("h3",{className:`font-bold truncate text-lg transition-colors ${B?"text-indigo-400":"text-zinc-100 group-hover:text-indigo-300"}`,title:y.title,children:y.title}),u.jsxs("div",{className:"flex gap-2 text-xs mb-1.5 mt-1",children:[u.jsxs("span",{className:"text-zinc-400 bg-white/5 border border-white/5 px-1.5 py-0.5 rounded",children:[y.duration,"s"]}),y.isExtension&&u.jsx("span",{className:"text-amber-400 bg-amber-500/10 border border-amber-500/20 px-1.5 py-0.5 rounded",children:"续写"})]}),u.jsx("p",{className:"text-zinc-500 text-xs truncate font-medium",children:y.tags||"自动风格"})]}),u.jsxs("div",{className:"flex items-center justify-between mt-2 pt-2 border-t border-white/5",children:[u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("span",{className:"text-[10px] text-zinc-500 border border-zinc-700/50 px-1.5 py-0.5 rounded uppercase tracking-wider",children:y.model})}),u.jsxs("div",{className:"flex gap-1 opacity-80 group-hover:opacity-100 transition-opacity",children:[u.jsx("button",{onClick:U=>{U.stopPropagation(),A(y)},className:"p-1.5 hover:bg-indigo-500/20 hover:text-indigo-400 rounded-lg text-zinc-400 transition-colors",title:"续写 (Extend)",children:u.jsx(_s,{size:16})}),u.jsx("button",{onClick:U=>{U.stopPropagation(),T(y.id,"wav")},className:"p-1.5 hover:bg-white/10 rounded-lg text-zinc-400 hover:text-white transition-colors",title:"下载 WAV",disabled:!!O,children:u.jsx(Ss,{size:16})}),u.jsx("button",{onClick:U=>{U.stopPropagation(),T(y.id,"video")},className:"p-1.5 hover:bg-white/10 rounded-lg text-zinc-400 hover:text-white transition-colors",title:"下载视频",disabled:!!O,children:u.jsx(zs,{size:16})})]})]})]})]}),y.status!==se.COMPLETED&&u.jsx("div",{className:"absolute bottom-0 left-0 right-0",children:u.jsx("div",{className:"w-full bg-zinc-800 h-0.5",children:u.jsx("div",{className:"bg-indigo-500 h-full w-1/2 animate-pulse"})})})]},y.id)})})},bv=({currentSong:o,isPlaying:j,setIsPlaying:_,onSongClick:d})=>{const A=X.useRef(null),[w,O]=X.useState(0),[M,T]=X.useState(0);X.useEffect(()=>{o&&A.current&&(o.audioUrl?(A.current.src=o.audioUrl,j&&A.current.play()):_(!1))},[o]),X.useEffect(()=>{A.current&&(j?A.current.play():A.current.pause())},[j]);const y=()=>{A.current&&(O(A.current.currentTime),T(A.current.duration||0))},B=V=>{const fl=parseFloat(V.target.value);A.current&&(A.current.currentTime=fl,O(fl))},U=V=>{if(!V)return"0:00";const fl=Math.floor(V/60),pl=Math.floor(V%60);return`${fl}:${pl<10?"0":""}${pl}`};return o?u.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-black/80 backdrop-blur-xl border-t border-white/10 px-4 py-3 z-40 flex items-center justify-between shadow-[0_-10px_40px_rgba(0,0,0,0.5)] transition-all animate-in slide-in-from-bottom-full duration-500",children:[u.jsx("audio",{ref:A,onTimeUpdate:y,onEnded:()=>_(!1)}),u.jsxs("div",{className:"flex items-center gap-4 w-1/3 cursor-pointer hover:opacity-80 transition-opacity group",onClick:()=>d&&d(o),children:[u.jsxs("div",{className:"relative overflow-hidden rounded-md w-12 h-12 bg-zinc-800 shadow-md border border-white/10",children:[o.imageUrl?u.jsx("img",{src:o.imageUrl,alt:"",className:"w-full h-full object-cover"}):u.jsx("div",{className:"w-full h-full flex items-center justify-center text-zinc-500",children:u.jsx(D1,{size:20})}),u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-all backdrop-blur-[2px]",children:u.jsx(Jh,{size:20,className:"text-white"})})]}),u.jsxs("div",{className:"hidden sm:block overflow-hidden",children:[u.jsx("h4",{className:"text-white font-bold text-sm truncate",children:o.title}),u.jsx("p",{className:"text-zinc-400 text-xs truncate",children:o.tags})]})]}),u.jsxs("div",{className:"flex flex-col items-center gap-2 flex-1 max-w-lg",children:[u.jsxs("div",{className:"flex items-center gap-6",children:[u.jsx("button",{className:"text-zinc-500 hover:text-white transition-colors",children:u.jsx(W1,{size:16})}),u.jsx("button",{className:"text-zinc-300 hover:text-white transition-colors",children:u.jsx(I1,{size:20})}),u.jsx("button",{className:"w-10 h-10 bg-white rounded-full flex items-center justify-center hover:scale-110 active:scale-95 transition-all shadow-lg shadow-white/10",onClick:()=>_(!j),children:j?u.jsx(Ki,{size:20,className:"fill-black text-black"}):u.jsx(Et,{size:20,className:"fill-black text-black ml-1"})}),u.jsx("button",{className:"text-zinc-300 hover:text-white transition-colors",children:u.jsx(lv,{size:20})}),u.jsx("button",{className:"text-zinc-500 hover:text-white transition-colors",children:u.jsx(B1,{size:16})})]}),u.jsxs("div",{className:"w-full flex items-center gap-3 text-xs text-zinc-500 font-mono hidden md:flex",children:[u.jsx("span",{className:"w-8 text-right",children:U(w)}),u.jsxs("div",{className:"relative flex-1 h-4 flex items-center group/slider",children:[u.jsx("div",{className:"absolute left-0 right-0 h-1 bg-zinc-800 rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${w/(M||100)*100}%`}})}),u.jsx("input",{type:"range",min:0,max:M||100,value:w,onChange:B,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"}),u.jsx("div",{className:"w-3 h-3 bg-white rounded-full absolute pointer-events-none opacity-0 group-hover/slider:opacity-100 transition-opacity shadow-sm",style:{left:`${w/(M||100)*100}%`,transform:"translateX(-50%)"}})]}),u.jsx("span",{className:"w-8",children:U(M)})]})]}),u.jsxs("div",{className:"w-1/3 flex justify-end items-center gap-3 hidden md:flex",children:[u.jsx(dv,{size:18,className:"text-zinc-400"}),u.jsx("div",{className:"w-20 h-1 bg-zinc-800 rounded-full overflow-hidden cursor-pointer group hover:h-1.5 transition-all",children:u.jsx("div",{className:"bg-zinc-500 group-hover:bg-indigo-400 w-2/3 h-full rounded-full transition-colors"})})]})]}):null},pv=({songs:o,onBack:j,onSubmit:_})=>{const[d,A]=X.useState(""),[w,O]=X.useState(1.2);return u.jsxs("div",{className:"animate-in slide-in-from-right duration-300",children:[u.jsxs("button",{onClick:j,className:"flex items-center text-zinc-400 hover:text-white mb-6 gap-2",children:[u.jsx(Tn,{size:16})," 返回工具箱"]}),u.jsx("h3",{className:"text-2xl font-bold mb-6",children:"调整速度 (Speed)"}),u.jsxs("div",{className:"space-y-6 max-w-xl",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-zinc-400 mb-2",children:"选择歌曲"}),u.jsxs("select",{className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg p-3",value:d,onChange:M=>A(M.target.value),children:[u.jsx("option",{value:"",children:"请选择..."}),o.map(M=>u.jsx("option",{value:M.id,children:M.title},M.id))]})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-sm text-zinc-400 mb-2",children:["速度系数: ",w,"x"]}),u.jsx("input",{type:"range",min:"0.5",max:"2.0",step:"0.1",value:w,onChange:M=>O(parseFloat(M.target.value)),className:"w-full"}),u.jsxs("div",{className:"flex justify-between text-xs text-zinc-500 mt-1",children:[u.jsx("span",{children:"0.5x"}),u.jsx("span",{children:"1.0x"}),u.jsx("span",{children:"2.0x"})]})]}),u.jsx("button",{onClick:()=>_("speed",{songId:d,speed:w}),className:"w-full bg-indigo-600 py-3 rounded-lg font-bold hover:bg-indigo-500",children:"确认调整"})]})]})},zv=({songs:o,onBack:j,onSubmit:_})=>{const[d,A]=X.useState(""),[w,O]=X.useState(0),[M,T]=X.useState(30);return u.jsxs("div",{className:"animate-in slide-in-from-right duration-300",children:[u.jsxs("button",{onClick:j,className:"flex items-center text-zinc-400 hover:text-white mb-6 gap-2",children:[u.jsx(Tn,{size:16})," 返回工具箱"]}),u.jsx("h3",{className:"text-2xl font-bold mb-6",children:"裁剪音乐 (Crop)"}),u.jsxs("div",{className:"space-y-6 max-w-xl",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-zinc-400 mb-2",children:"选择歌曲"}),u.jsxs("select",{className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg p-3",value:d,onChange:y=>A(y.target.value),children:[u.jsx("option",{value:"",children:"请选择..."}),o.map(y=>u.jsx("option",{value:y.id,children:y.title},y.id))]})]}),u.jsxs("div",{className:"flex gap-4",children:[u.jsxs("div",{className:"flex-1",children:[u.jsx("label",{className:"block text-sm text-zinc-400 mb-2",children:"开始时间 (s)"}),u.jsx("input",{type:"number",value:w,onChange:y=>O(Number(y.target.value)),className:"w-full bg-zinc-900 border border-zinc-700 rounded p-2"})]}),u.jsxs("div",{className:"flex-1",children:[u.jsx("label",{className:"block text-sm text-zinc-400 mb-2",children:"结束时间 (s)"}),u.jsx("input",{type:"number",value:M,onChange:y=>T(Number(y.target.value)),className:"w-full bg-zinc-900 border border-zinc-700 rounded p-2"})]})]}),u.jsx("button",{onClick:()=>_("crop",{songId:d,start:w,end:M}),className:"w-full bg-indigo-600 py-3 rounded-lg font-bold hover:bg-indigo-500",children:"确认裁剪"})]})]})},Lr=({songs:o,onBack:j,mode:_,onSubmit:d})=>{const[A,w]=X.useState(""),O=_==="vocals"?"纯音乐配人声 (Add Vocals)":"清唱配乐 (Add Instrumental)";return u.jsxs("div",{className:"animate-in slide-in-from-right duration-300",children:[u.jsxs("button",{onClick:j,className:"flex items-center text-zinc-400 hover:text-white mb-6 gap-2",children:[u.jsx(Tn,{size:16})," 返回工具箱"]}),u.jsx("h3",{className:"text-2xl font-bold mb-6",children:O}),u.jsx("div",{className:"p-4 bg-zinc-900 rounded-xl mb-6 border border-zinc-800",children:u.jsx("p",{className:"text-sm text-zinc-300",children:_==="vocals"?"该工具将提取所选歌曲的伴奏,并允许你叠加新的人声。":"该工具将提取所选歌曲的人声,并重新生成背景音乐。"})}),u.jsxs("div",{className:"space-y-6 max-w-xl",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-zinc-400 mb-2",children:"选择源文件 (Select Source)"}),u.jsxs("select",{className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg p-3",value:A,onChange:M=>w(M.target.value),children:[u.jsx("option",{value:"",children:"请选择库中歌曲..."}),o.map(M=>u.jsx("option",{value:M.id,children:M.title},M.id))]})]}),u.jsx("button",{onClick:()=>d(_,{songId:A}),className:"w-full bg-indigo-600 py-3 rounded-lg font-bold hover:bg-indigo-500",children:"开始处理"})]})]})},jv=({songs:o,onBack:j})=>{const[_,d]=X.useState("");return u.jsxs("div",{className:"animate-in slide-in-from-right duration-300 h-full flex flex-col",children:[u.jsxs("div",{className:"flex-none",children:[u.jsxs("button",{onClick:j,className:"flex items-center text-zinc-400 hover:text-white mb-6 gap-2",children:[u.jsx(Tn,{size:16})," 返回工具箱"]}),u.jsx("h3",{className:"text-2xl font-bold mb-6",children:"歌词时间线 (Timing Editor)"})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 flex-1 min-h-0",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsx("label",{className:"block text-sm text-zinc-400",children:"选择歌曲"}),u.jsxs("select",{className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg p-3",value:_,onChange:A=>d(A.target.value),children:[u.jsx("option",{value:"",children:"请选择..."}),o.map(A=>u.jsx("option",{value:A.id,children:A.title},A.id))]}),u.jsxs("div",{className:"bg-zinc-900 rounded-xl p-4 h-64 md:h-96 overflow-y-auto border border-zinc-800 font-mono text-sm",children:[u.jsxs("div",{className:"flex gap-4 py-2 border-b border-zinc-800 items-center",children:[u.jsx("span",{className:"text-indigo-400",children:"[00:12.5]"}),u.jsx("span",{className:"text-white",children:"Neon lights in the rain..."})]}),u.jsxs("div",{className:"flex gap-4 py-2 border-b border-zinc-800 items-center",children:[u.jsx("span",{className:"text-indigo-400",children:"[00:18.2]"}),u.jsx("span",{className:"text-white",children:"Walking down the street alone..."})]})]})]}),u.jsx("div",{className:"bg-zinc-900 rounded-xl p-8 flex items-center justify-center border border-zinc-800 border-dashed",children:u.jsxs("div",{className:"text-center text-zinc-500",children:[u.jsx(Ji,{size:48,className:"mx-auto mb-4 opacity-50"}),u.jsx("p",{children:"在左侧选择歌曲以加载歌词"}),u.jsx("p",{className:"text-xs mt-2",children:"支持拖拽波形调整时间点 (Preview)"})]})})]})]})},Nv=({songs:o,onTaskCreated:j})=>{const[_,d]=X.useState(null),A=async(M,T)=>{if(!T.songId){alert("请先选择一首歌曲");return}try{const y=await Ue.processAudio({songId:T.songId,operation:M,params:T});j(y),d(null),alert("任务已提交!请在列表查看进度。")}catch{alert("Error processing")}},w=[{id:"upload",icon:cv,label:"上传素材 (Upload)",desc:"上传音频到库",action:()=>{var M;return(M=document.getElementById("global-upload"))==null?void 0:M.click()}},{id:"remix-vocals",icon:M1,label:"纯音乐配人声 (Add Vocals)",desc:"为伴奏添加AI演唱"},{id:"remix-inst",icon:Ss,label:"清唱配乐 (Add Instrumental)",desc:"为人声添加背景音乐"},{id:"crop",icon:G1,label:"裁剪音乐 (Crop)",desc:"剪辑最精彩的片段"},{id:"speed",icon:Gh,label:"调整速度 (Speed)",desc:"更改BPM和播放速度"},{id:"timing",icon:Ji,label:"歌词时间线 (Timing)",desc:"精确调整歌词同步"}],O=async M=>{var T;(T=M.target.files)!=null&&T[0]&&(await Ue.uploadAudio(M.target.files[0]),alert("上传成功!"))};return _==="speed"?u.jsx(pv,{songs:o,onBack:()=>d(null),onSubmit:A}):_==="crop"?u.jsx(zv,{songs:o,onBack:()=>d(null),onSubmit:A}):_==="remix-vocals"?u.jsx(Lr,{mode:"vocals",songs:o,onBack:()=>d(null),onSubmit:A}):_==="remix-inst"?u.jsx(Lr,{mode:"instrumental",songs:o,onBack:()=>d(null),onSubmit:A}):_==="timing"?u.jsx(jv,{songs:o,onBack:()=>d(null)}):u.jsxs("div",{className:"p-8 max-w-6xl mx-auto",children:[u.jsx("h2",{className:"text-3xl font-bold text-white mb-8",children:"工具箱 (Tools)"}),u.jsx("input",{type:"file",id:"global-upload",className:"hidden",onChange:O}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[w.map(M=>u.jsxs("button",{className:"flex flex-col items-start p-6 bg-zinc-900 border border-zinc-800 hover:border-indigo-500 hover:bg-zinc-800 rounded-xl transition-all group text-left relative overflow-hidden",onClick:()=>M.action?M.action():d(M.id),children:[u.jsx("div",{className:"bg-zinc-800 p-3 rounded-lg mb-4 group-hover:bg-indigo-600 transition-colors relative z-10",children:u.jsx(M.icon,{className:"text-white",size:24})}),u.jsx("h3",{className:"text-lg font-bold text-white mb-2 relative z-10",children:M.label}),u.jsx("p",{className:"text-sm text-zinc-400 relative z-10",children:M.desc}),u.jsx("div",{className:"absolute -bottom-4 -right-4 w-24 h-24 bg-white/5 rounded-full group-hover:scale-150 transition-transform"})]},M.id)),u.jsx("div",{className:"p-6 border border-dashed border-zinc-800 rounded-xl flex items-center justify-center text-center",children:u.jsx("p",{className:"text-zinc-500 text-sm",children:'提示: 歌曲续写功能请在"我的曲库"中点击具体歌曲的 "Extend" 按钮。'})})]})]})},Sv=({songs:o,onPlay:j,onNavigateToCreate:_,onNavigateToDetail:d})=>{const A=o.slice(0,3),w=o;return u.jsxs("div",{className:"p-6 md:p-10 space-y-12 max-w-7xl mx-auto",children:[u.jsxs("div",{className:"relative rounded-3xl overflow-hidden bg-black p-8 md:p-16 border border-white/10 shadow-2xl group",children:[u.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-purple-900/40 via-zinc-900 to-black z-0"}),u.jsx("div",{className:"absolute -top-24 -left-24 w-96 h-96 bg-indigo-600/20 rounded-full blur-3xl opacity-50 animate-pulse"}),u.jsx("div",{className:"absolute -bottom-24 -right-24 w-96 h-96 bg-pink-600/20 rounded-full blur-3xl opacity-50 animate-pulse delay-700"}),u.jsxs("div",{className:"relative z-10 max-w-3xl",children:[u.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/5 border border-white/10 backdrop-blur-md mb-6 animate-in slide-in-from-bottom-2 duration-700",children:[u.jsx(ps,{size:14,className:"text-indigo-400"}),u.jsx("span",{className:"text-xs font-medium text-indigo-200",children:"朴见潮音 V3.5 现已上线"})]}),u.jsxs("h1",{className:"text-4xl md:text-6xl font-bold text-white mb-6 leading-tight tracking-tight",children:["用 AI 释放你的 ",u.jsx("br",{}),u.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-indigo-400 via-purple-400 to-pink-400 drop-shadow-sm",children:"无限音乐创造力"})]}),u.jsx("p",{className:"text-zinc-400 text-lg mb-10 max-w-lg leading-relaxed",children:"无需乐理知识,只需一段文字描述,即可生成广播级音质的完整歌曲。探索 AI 音乐的无限可能。"}),u.jsxs("div",{className:"flex flex-wrap gap-4",children:[u.jsxs("button",{onClick:_,className:"px-8 py-4 bg-white text-black font-bold rounded-2xl hover:bg-zinc-200 transition-all shadow-[0_0_20px_rgba(255,255,255,0.15)] hover:shadow-[0_0_30px_rgba(255,255,255,0.25)] flex items-center gap-2 transform hover:-translate-y-1 active:scale-95",children:[u.jsx(ps,{size:20}),"开始创作"]}),u.jsxs("button",{className:"px-8 py-4 bg-white/5 text-white font-bold rounded-2xl hover:bg-white/10 backdrop-blur-md border border-white/10 transition-all flex items-center gap-2 group/btn",children:["浏览广场",u.jsx(kr,{size:18,className:"group-hover/btn:translate-x-1 transition-transform"})]})]})]})]}),u.jsxs("section",{children:[u.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[u.jsx("div",{className:"p-2 bg-orange-500/10 rounded-lg",children:u.jsx(o1,{className:"text-orange-500",size:24})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-2xl font-bold text-white",children:"热门趋势 (Trending)"}),u.jsx("p",{className:"text-sm text-zinc-500",children:"社区最受欢迎的作品"})]})]}),u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:A.map((O,M)=>u.jsx("div",{onClick:()=>d(O),className:"group relative bg-zinc-900/40 backdrop-blur-sm rounded-2xl overflow-hidden cursor-pointer border border-white/5 hover:border-indigo-500/30 hover:bg-zinc-800/60 transition-all duration-300 hover:shadow-2xl hover:shadow-indigo-500/10",children:u.jsxs("div",{className:"flex items-center p-4 gap-4",children:[u.jsxs("div",{className:"relative w-24 h-24 flex-shrink-0 rounded-xl overflow-hidden shadow-lg",children:[u.jsx("img",{src:O.imageUrl,alt:O.title,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-110"}),u.jsx("div",{className:"absolute inset-0 bg-black/30 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:u.jsx("button",{onClick:T=>{T.stopPropagation(),j(O)},className:"w-10 h-10 bg-white/90 rounded-full flex items-center justify-center hover:scale-110 transition-transform shadow-lg",children:u.jsx(Et,{className:"fill-black text-black ml-1",size:16})})}),u.jsxs("div",{className:"absolute top-1 left-1 bg-black/60 backdrop-blur-sm px-1.5 py-0.5 rounded text-[10px] text-white font-bold border border-white/10",children:["#",M+1]})]}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("h3",{className:"text-white font-bold truncate text-lg mb-1 group-hover:text-indigo-400 transition-colors",children:O.title}),u.jsx("p",{className:"text-zinc-500 text-sm truncate mb-2",children:O.tags}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("div",{className:"flex items-center gap-1 text-xs text-zinc-400",children:[u.jsx(Et,{size:12})," 12.5k"]}),u.jsx("div",{className:"h-3 w-[1px] bg-zinc-800"}),u.jsx("span",{className:"text-xs text-indigo-400 bg-indigo-500/10 px-2 py-0.5 rounded border border-indigo-500/20",children:O.model})]})]})]})},O.id))})]}),u.jsxs("section",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-8",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg",children:u.jsx(av,{className:"text-indigo-400",size:24})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-2xl font-bold text-white",children:"最新发布 (New Arrivals)"}),u.jsx("p",{className:"text-sm text-zinc-500",children:"刚刚生成的作品"})]})]}),u.jsx("button",{className:"text-sm font-medium text-zinc-400 hover:text-white transition-colors",onClick:_,children:"查看更多"})]}),u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-5",children:w.slice(0,10).map(O=>u.jsxs("div",{onClick:()=>d(O),className:"group bg-zinc-900/30 hover:bg-zinc-800/60 p-3 rounded-2xl border border-white/5 hover:border-white/10 transition-all cursor-pointer",children:[u.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden mb-3 shadow-lg bg-zinc-800",children:[u.jsx("img",{src:O.imageUrl,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),u.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-60"}),u.jsx("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-all translate-y-2 group-hover:translate-y-0 duration-300",children:u.jsx("button",{onClick:M=>{M.stopPropagation(),j(O)},className:"w-8 h-8 bg-white rounded-full flex items-center justify-center hover:scale-110 transition-transform shadow-lg",children:u.jsx(Et,{className:"fill-black text-black ml-0.5",size:14})})})]}),u.jsx("h4",{className:"text-zinc-100 font-bold truncate text-sm mb-1 group-hover:text-indigo-300 transition-colors",children:O.title}),u.jsx("p",{className:"text-zinc-500 text-xs truncate",children:O.tags})]},O.id))})]})]})},_v=({song:o,currentPlayingSong:j,isPlaying:_,relatedSongs:d,onPlayPause:A,onBack:w,onExtend:O,onNavigateToSong:M})=>{const[T,y]=X.useState(!1),[B,U]=X.useState(!1),[V,fl]=X.useState(!1),[pl,xl]=X.useState(!1),[$l,wl]=X.useState(null),Gl=X.useRef(null),yl=X.useRef(null),_l=X.useRef(null),Cl=_&&(j==null?void 0:j.id)===o.id;X.useEffect(()=>{const Y=I=>{Gl.current&&!Gl.current.contains(I.target)&&U(!1),yl.current&&!yl.current.contains(I.target)&&fl(!1),_l.current&&!_l.current.contains(I.target)&&xl(!1)};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[]);const zl=async Y=>{wl(Y),fl(!1),U(!1);try{const I=Y==="wav"?await Ue.getWavUrl(o.id):await Ue.getVideoUrl(o.id),G=document.createElement("a");G.href=I,G.download=`suno_${Y}_${o.id}.${Y==="wav"?"mp3":"mp4"}`,document.body.appendChild(G),G.click(),document.body.removeChild(G)}catch{alert("Download failed")}finally{wl(null)}},K=()=>{navigator.clipboard.writeText(window.location.href),alert("链接已复制到剪贴板!"),U(!1),xl(!1)},Al=Y=>{const I=encodeURIComponent(window.location.href),G=encodeURIComponent(`Check out this song I generated on Suno AI: ${o.title}`);let jl="";if(Y==="twitter")jl=`https://twitter.com/intent/tweet?text=${G}&url=${I}`;else if(Y==="facebook")jl=`https://www.facebook.com/sharer/sharer.php?u=${I}`;else if(Y==="instagram"){K();return}jl&&window.open(jl,"_blank","width=600,height=400"),xl(!1)},Wl=()=>{y(!T)};return u.jsxs("div",{className:"relative min-h-full pb-32 animate-in slide-in-from-right duration-300",children:[u.jsxs("div",{className:"absolute top-0 left-0 right-0 h-[500px] overflow-hidden -z-10",children:[u.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent to-zinc-950 z-10"}),u.jsx("img",{src:o.imageUrl,className:"w-full h-full object-cover blur-3xl opacity-30"})]}),u.jsxs("div",{className:"p-4 md:p-8 max-w-[1600px] mx-auto",children:[u.jsxs("button",{onClick:w,className:"flex items-center gap-2 text-zinc-300 hover:text-white mb-8 bg-black/20 backdrop-blur-md px-4 py-2 rounded-full transition-colors w-fit border border-white/5",children:[u.jsx(Tn,{size:18}),u.jsx("span",{children:"返回库 (Back)"})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[320px_1fr] xl:grid-cols-[320px_1fr_350px] gap-8 xl:gap-12",children:[u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs("div",{className:"aspect-square rounded-2xl overflow-hidden shadow-2xl border border-white/10 relative group bg-black",children:[u.jsx("img",{src:o.imageUrl,className:"w-full h-full object-cover"}),u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 group-hover:bg-black/40 transition-colors",children:u.jsx("button",{onClick:()=>A(o),className:"w-16 h-16 bg-white/20 backdrop-blur-md rounded-full flex items-center justify-center hover:scale-110 transition-transform cursor-pointer",children:Cl?u.jsx(Ki,{className:"fill-white text-white",size:32}):u.jsx(Et,{className:"fill-white text-white ml-1",size:32})})})]}),u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("button",{onClick:()=>A(o),className:"w-full py-4 bg-indigo-600 hover:bg-indigo-500 text-white font-bold rounded-xl flex items-center justify-center gap-2 text-lg shadow-lg shadow-indigo-600/20 transition-all active:scale-[0.98]",children:[Cl?u.jsx(Ki,{className:"fill-white"}):u.jsx(Et,{className:"fill-white"}),Cl?"暂停播放":"立即播放"]}),u.jsxs("div",{className:"flex gap-3",children:[u.jsxs("button",{onClick:O,className:"flex-1 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-medium rounded-xl flex items-center justify-center gap-2 transition-colors border border-zinc-700",children:[u.jsx(An,{size:18}),"续写"]}),u.jsxs("div",{className:"relative flex-1",ref:yl,children:[u.jsxs("button",{onClick:()=>fl(!V),className:"w-full py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-medium rounded-xl flex items-center justify-center gap-2 transition-colors border border-zinc-700",disabled:!!$l,children:[$l?u.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"}):u.jsx(Gr,{size:18}),"下载"]}),V&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-zinc-900 border border-zinc-700 rounded-xl shadow-xl overflow-hidden z-20 animate-in fade-in slide-in-from-bottom-2 duration-200",children:[u.jsxs("button",{onClick:()=>zl("video"),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-zinc-800 transition-colors text-left text-sm text-zinc-200",children:[u.jsx(zs,{size:16,className:"text-indigo-400"}),u.jsx("span",{children:"下载视频 (MP4)"})]}),u.jsx("div",{className:"h-[1px] bg-zinc-800 mx-2"}),u.jsxs("button",{onClick:()=>zl("wav"),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-zinc-800 transition-colors text-left text-sm text-zinc-200",children:[u.jsx(Ss,{size:16,className:"text-pink-400"}),u.jsx("span",{children:"下载音频 (WAV)"})]})]})]})]})]}),u.jsxs("div",{className:"bg-zinc-900/50 rounded-xl p-4 border border-zinc-800 space-y-4 backdrop-blur-md",children:[u.jsxs("div",{className:"flex justify-between items-center text-sm",children:[u.jsx("span",{className:"text-zinc-400",children:"时长"}),u.jsxs("span",{className:"text-white",children:[Math.floor(o.duration/60),":",(o.duration%60).toString().padStart(2,"0")]})]}),u.jsxs("div",{className:"flex justify-between items-center text-sm",children:[u.jsx("span",{className:"text-zinc-400",children:"模型"}),u.jsx("span",{className:"text-white uppercase",children:o.model})]}),u.jsxs("div",{className:"flex justify-between items-center text-sm",children:[u.jsx("span",{className:"text-zinc-400",children:"创建时间"}),u.jsx("span",{className:"text-white",children:new Date(o.createdAt).toLocaleDateString()})]}),u.jsxs("div",{className:"flex justify-between items-center text-sm",children:[u.jsx("span",{className:"text-zinc-400",children:"状态"}),u.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold ${o.status===se.COMPLETED?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:o.status.toUpperCase()})]})]})]}),u.jsxs("div",{className:"space-y-8 min-w-0",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-start justify-between gap-4",children:[u.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-white mb-4 leading-tight",children:o.title}),u.jsxs("div",{className:"flex items-center gap-2 bg-zinc-900/80 backdrop-blur-md p-1.5 rounded-xl border border-zinc-800 shrink-0",children:[u.jsx("button",{onClick:Wl,className:`p-2 rounded-lg transition-all ${T?"text-pink-500 bg-pink-500/10":"text-zinc-400 hover:text-white hover:bg-white/5"}`,title:"收藏",children:u.jsx(r1,{size:20,className:T?"fill-current":""})}),u.jsxs("div",{className:"relative",ref:_l,children:[u.jsx("button",{onClick:()=>xl(!pl),className:`p-2 rounded-lg transition-all ${pl?"text-white bg-white/10":"text-zinc-400 hover:text-white hover:bg-white/5"}`,title:"分享",children:u.jsx(k1,{size:20})}),pl&&u.jsxs("div",{className:"absolute top-full right-0 mt-2 w-60 bg-zinc-900 border border-zinc-700 rounded-xl shadow-xl overflow-hidden z-20 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"p-3 border-b border-zinc-800",children:[u.jsx("p",{className:"text-xs text-zinc-500 font-medium mb-2",children:"分享到社交媒体"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>Al("twitter"),className:"p-2 bg-[#1DA1F2]/10 text-[#1DA1F2] hover:bg-[#1DA1F2]/20 rounded-lg transition-colors flex-1 flex justify-center items-center",title:"Twitter / X",children:u.jsx(iv,{size:18})}),u.jsx("button",{onClick:()=>Al("facebook"),className:"p-2 bg-[#4267B2]/10 text-[#4267B2] hover:bg-[#4267B2]/20 rounded-lg transition-colors flex-1 flex justify-center items-center",title:"Facebook",children:u.jsx(c1,{size:18})}),u.jsx("button",{onClick:()=>Al("instagram"),className:"p-2 bg-gradient-to-tr from-[#f9ce34] via-[#ee2a7b] to-[#6228d7] text-white hover:opacity-90 rounded-lg transition-opacity flex-1 flex justify-center items-center relative overflow-hidden",title:"Instagram (复制链接)",children:u.jsx(v1,{size:18})})]})]}),u.jsxs("button",{onClick:K,className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-zinc-800 transition-colors text-left text-sm text-zinc-300 hover:text-white",children:[u.jsx(Qr,{size:16})," 复制链接"]})]})]}),u.jsxs("div",{className:"relative",ref:Gl,children:[u.jsx("button",{onClick:()=>U(!B),className:`p-2 rounded-lg transition-all ${B?"text-white bg-white/10":"text-zinc-400 hover:text-white hover:bg-white/5"}`,children:u.jsx(i1,{size:20})}),B&&u.jsxs("div",{className:"absolute top-full right-0 mt-2 w-48 bg-zinc-900 border border-zinc-700 rounded-xl shadow-xl overflow-hidden z-20 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("button",{onClick:K,className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-zinc-800 transition-colors text-left text-sm text-zinc-300 hover:text-white",children:[u.jsx(Qr,{size:16})," 复制链接"]}),u.jsxs("button",{onClick:()=>zl("wav"),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-zinc-800 transition-colors text-left text-sm text-zinc-300 hover:text-white",children:[u.jsx(Gr,{size:16})," 下载音频"]}),u.jsxs("button",{onClick:()=>zl("video"),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-zinc-800 transition-colors text-left text-sm text-zinc-300 hover:text-white",children:[u.jsx(zs,{size:16})," 下载视频"]})]})]})]})]}),u.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:o.tags.split(",").map((Y,I)=>u.jsxs("span",{className:"px-3 py-1 rounded-full bg-zinc-800 text-zinc-300 text-sm border border-zinc-700 hover:border-indigo-500/50 transition-colors cursor-default",children:["#",Y.trim()]},I))})]}),u.jsxs("div",{className:"bg-zinc-900/30 border border-zinc-800 rounded-2xl p-6 md:p-8 backdrop-blur-sm relative",children:[u.jsx("div",{className:"absolute top-4 right-4",children:u.jsx("div",{className:"p-2 bg-black/20 rounded-lg",children:u.jsx(Ji,{size:20,className:"text-zinc-500"})})}),u.jsxs("h3",{className:"text-xl font-bold text-white mb-6 flex items-center gap-2",children:[u.jsx("span",{className:"text-indigo-400",children:"///"}),"歌词 (Lyrics)"]}),o.isInstrumental?u.jsxs("div",{className:"text-zinc-500 italic text-center py-10 flex flex-col items-center gap-2",children:[u.jsx(An,{size:40,className:"opacity-20 mb-2"}),u.jsx("p",{children:"此曲目为纯音乐 (Instrumental)"}),u.jsx("p",{className:"text-xs",children:"无歌词内容"})]}):u.jsx("div",{className:"space-y-6 font-mono text-zinc-300 leading-relaxed whitespace-pre-wrap text-base",children:o.lyrics||(o.prompt?`Prompt used: ${o.prompt}`:"暂无歌词内容...")})]})]}),u.jsxs("div",{className:"hidden xl:flex flex-col h-[calc(100vh-140px)] sticky top-0",children:[u.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2 px-1",children:[u.jsx(An,{size:18,className:"text-indigo-500"}),"播放列表"]}),u.jsx("div",{className:"flex-1 overflow-y-auto pr-2 space-y-3 custom-scrollbar",children:d.map(Y=>{const I=Y.id===o.id;return _&&(j==null||j.id,Y.id),u.jsxs("div",{onClick:()=>M(Y),className:`flex items-center gap-3 p-2 rounded-xl transition-all cursor-pointer group border ${I?"bg-zinc-800 border-indigo-500/50":"hover:bg-zinc-900 border-transparent hover:border-zinc-800"}`,children:[u.jsxs("div",{className:"relative w-12 h-12 rounded-lg overflow-hidden shrink-0 bg-black",children:[u.jsx("img",{src:Y.imageUrl,className:`w-full h-full object-cover ${I?"opacity-50":""}`}),I&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:u.jsx("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"})}),u.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",children:u.jsx(Et,{size:16,className:"fill-white text-white"})})]}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("h4",{className:`text-sm font-bold truncate ${I?"text-indigo-400":"text-zinc-200"}`,children:Y.title}),u.jsxs("div",{className:"flex items-center justify-between mt-1",children:[u.jsx("p",{className:"text-xs text-zinc-500 truncate max-w-[80px]",children:Y.tags}),u.jsxs("span",{className:"text-[10px] text-zinc-600 font-mono",children:[Math.floor(Y.duration/60),":",(Y.duration%60).toString().padStart(2,"0")]})]})]})]},Y.id)})})]})]})]})]})},Ev=({onLogin:o,onCancel:j})=>{const[_,d]=X.useState(!1),[A,w]=X.useState(!1),[O,M]=X.useState({email:"",password:"",name:""}),T=async y=>{y.preventDefault(),w(!0),setTimeout(()=>{w(!1);const B={id:"u_"+Date.now(),name:_?O.name:"朴见音乐人",email:O.email,avatarUrl:`https://api.dicebear.com/7.x/avataaars/svg?seed=${O.email}`,credits:500,plan:"free",memberSince:new Date().toISOString()};o(B)},1500)};return u.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md bg-zinc-900/50 backdrop-blur-xl border border-white/10 rounded-3xl p-8 shadow-2xl animate-in fade-in zoom-in-95 duration-300",children:[u.jsxs("div",{className:"text-center mb-8",children:[u.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-indigo-500/10 mb-4",children:u.jsx($i,{className:"text-indigo-500 w-8 h-8"})}),u.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:_?"加入朴见潮音":"欢迎回来"}),u.jsx("p",{className:"text-zinc-400 text-sm",children:_?"释放无限音乐创造力":"登录以继续您的创作之旅"})]}),u.jsxs("form",{onSubmit:T,className:"space-y-4",children:[_&&u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{className:"text-xs font-medium text-zinc-400 ml-1",children:"昵称 (Nickname)"}),u.jsxs("div",{className:"relative",children:[u.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-500",children:u.jsx(Wr,{size:18})}),u.jsx("input",{type:"text",required:!0,value:O.name,onChange:y=>M({...O,name:y.target.value}),className:"w-full bg-black/40 border border-zinc-700 rounded-xl py-3 pl-10 pr-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none transition-all",placeholder:"您的称呼"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{className:"text-xs font-medium text-zinc-400 ml-1",children:"邮箱 (Email)"}),u.jsxs("div",{className:"relative",children:[u.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-500",children:u.jsx(_1,{size:18})}),u.jsx("input",{type:"email",required:!0,value:O.email,onChange:y=>M({...O,email:y.target.value}),className:"w-full bg-black/40 border border-zinc-700 rounded-xl py-3 pl-10 pr-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none transition-all",placeholder:"name@example.com"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{className:"text-xs font-medium text-zinc-400 ml-1",children:"密码 (Password)"}),u.jsxs("div",{className:"relative",children:[u.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-500",children:u.jsx(p1,{size:18})}),u.jsx("input",{type:"password",required:!0,value:O.password,onChange:y=>M({...O,password:y.target.value}),className:"w-full bg-black/40 border border-zinc-700 rounded-xl py-3 pl-10 pr-4 text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none transition-all",placeholder:"••••••••"})]})]}),!_&&u.jsx("div",{className:"flex justify-end",children:u.jsx("button",{type:"button",className:"text-xs text-indigo-400 hover:text-indigo-300",children:"忘记密码?"})}),u.jsx("button",{type:"submit",disabled:A,className:"w-full py-3 bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-500 hover:to-purple-500 text-white font-bold rounded-xl shadow-lg shadow-indigo-500/20 flex items-center justify-center gap-2 transition-all mt-4",children:A?u.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):u.jsxs(u.Fragment,{children:[_?"立即注册":"登录",u.jsx(kr,{size:18})]})})]}),u.jsx("div",{className:"mt-8 text-center",children:u.jsxs("p",{className:"text-zinc-500 text-sm",children:[_?"已有账号? ":"还没有账号? ",u.jsx("button",{onClick:()=>d(!_),className:"text-white font-medium hover:underline decoration-indigo-500 underline-offset-4",children:_?"去登录":"立即注册"})]})})]})})},Av=({user:o,onLogout:j})=>u.jsxs("div",{className:"max-w-4xl mx-auto p-6 md:p-10 space-y-8 animate-in slide-in-from-bottom-4 duration-500",children:[u.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-6 p-8 bg-zinc-900/50 border border-zinc-800 rounded-3xl backdrop-blur-sm",children:[u.jsxs("div",{className:"relative",children:[u.jsx("img",{src:o.avatarUrl,alt:o.name,className:"w-24 h-24 rounded-full border-4 border-zinc-800 shadow-xl"}),o.plan!=="free"&&u.jsx("div",{className:"absolute -top-1 -right-1 bg-yellow-500 text-black p-1.5 rounded-full border-2 border-zinc-900",children:u.jsx(e1,{size:14,fill:"black"})})]}),u.jsxs("div",{className:"text-center md:text-left flex-1",children:[u.jsx("h2",{className:"text-3xl font-bold text-white mb-1",children:o.name}),u.jsx("p",{className:"text-zinc-400 mb-3",children:o.email}),u.jsxs("div",{className:"flex items-center justify-center md:justify-start gap-2 text-xs",children:[u.jsxs("span",{className:"px-3 py-1 bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 rounded-full font-medium uppercase tracking-wider",children:[o.plan," Plan"]}),u.jsxs("span",{className:"text-zinc-500",children:["注册于 ",new Date(o.memberSince).toLocaleDateString()]})]})]}),u.jsxs("button",{onClick:j,className:"px-4 py-2 bg-red-500/10 text-red-400 hover:bg-red-500/20 rounded-xl border border-red-500/20 flex items-center gap-2 transition-colors text-sm font-medium",children:[u.jsx(N1,{size:16}),"退出登录"]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[u.jsxs("div",{className:"p-6 bg-gradient-to-br from-indigo-900/40 to-purple-900/40 border border-indigo-500/30 rounded-3xl relative overflow-hidden group",children:[u.jsx("div",{className:"absolute top-0 right-0 p-32 bg-indigo-500/20 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),u.jsxs("div",{className:"relative z-10",children:[u.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[u.jsx("div",{className:"p-2 bg-indigo-500 rounded-lg text-white shadow-lg shadow-indigo-500/40",children:u.jsx(Ph,{size:20})}),u.jsx("h3",{className:"text-lg font-bold text-white",children:"积分余额 (Credits)"})]}),u.jsxs("div",{className:"flex items-baseline gap-1 mb-4",children:[u.jsx("span",{className:"text-4xl font-bold text-white tracking-tight",children:o.credits}),u.jsx("span",{className:"text-zinc-400 text-sm",children:"/ 500 (月度)"})]}),u.jsx("div",{className:"w-full bg-black/30 h-2 rounded-full overflow-hidden mb-4 border border-white/5",children:u.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-purple-500 h-full w-[80%]"})}),u.jsx("button",{className:"w-full py-3 bg-white text-indigo-950 font-bold rounded-xl hover:bg-indigo-50 transition-colors shadow-lg",children:"立即充值"})]})]}),u.jsxs("div",{className:"p-6 bg-zinc-900/30 border border-zinc-800 rounded-3xl",children:[u.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[u.jsx("div",{className:"p-2 bg-zinc-800 rounded-lg text-zinc-300",children:u.jsx(Z1,{size:20})}),u.jsx("h3",{className:"text-lg font-bold text-white",children:"账号设置 (Settings)"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsxs("button",{className:"w-full flex items-center justify-between p-3 hover:bg-zinc-800 rounded-xl transition-colors group",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Wr,{size:18,className:"text-zinc-500 group-hover:text-white"}),u.jsx("span",{className:"text-zinc-300 group-hover:text-white",children:"编辑资料"})]}),u.jsx("span",{className:"text-zinc-600 text-xs",children:"修改"})]}),u.jsxs("button",{className:"w-full flex items-center justify-between p-3 hover:bg-zinc-800 rounded-xl transition-colors group",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Zh,{size:18,className:"text-zinc-500 group-hover:text-white"}),u.jsx("span",{className:"text-zinc-300 group-hover:text-white",children:"通知偏好"})]}),u.jsx("span",{className:"text-zinc-600 text-xs",children:"开启"})]}),u.jsx("button",{className:"w-full flex items-center justify-between p-3 hover:bg-zinc-800 rounded-xl transition-colors group",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(J1,{size:18,className:"text-zinc-500 group-hover:text-white"}),u.jsx("span",{className:"text-zinc-300 group-hover:text-white",children:"隐私安全"})]})})]})]})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsx("h3",{className:"text-xl font-bold text-white",children:"订阅计划 (Subscription)"}),u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:["Free","Pro","Premier"].map((_,d)=>u.jsxs("div",{className:`p-6 rounded-2xl border flex flex-col ${o.plan===_.toLowerCase()?"bg-zinc-800 border-indigo-500":"bg-zinc-900/30 border-zinc-800"}`,children:[u.jsxs("div",{className:"mb-4",children:[u.jsx("span",{className:"text-lg font-bold text-white",children:_}),o.plan===_.toLowerCase()&&u.jsx("span",{className:"ml-2 text-xs bg-indigo-500 text-white px-2 py-0.5 rounded-full",children:"当前"})]}),u.jsxs("div",{className:"text-3xl font-bold text-white mb-6",children:[d===0?"$0":d===1?"$8":"$24",u.jsx("span",{className:"text-sm text-zinc-500 font-normal",children:"/mo"})]}),u.jsx("ul",{className:"space-y-3 mb-8 flex-1",children:[1,2,3].map(A=>u.jsxs("li",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[u.jsx("div",{className:"w-1.5 h-1.5 bg-zinc-600 rounded-full"}),"Feature item description"]},A))}),u.jsx("button",{className:`w-full py-2.5 rounded-lg text-sm font-bold transition-colors ${o.plan===_.toLowerCase()?"bg-zinc-700 text-zinc-400 cursor-default":"bg-white text-black hover:bg-zinc-200"}`,disabled:o.plan===_.toLowerCase(),children:o.plan===_.toLowerCase()?"当前计划":"升级"})]},_))})]})]}),Tv=()=>{const[o,j]=X.useState("home"),[_,d]=X.useState(Fr),[A,w]=X.useState(!1),[O,M]=X.useState(null),[T,y]=X.useState(null),[B,U]=X.useState(!1),[V,fl]=X.useState(null),[pl,xl]=X.useState(null);X.useEffect(()=>{const Y=setInterval(async()=>{const I=_.filter(G=>G.status===se.QUEUEING||G.status===se.PROCESSING);if(I.length>0){const G=I.map(Hl=>Hl.id),jl=await Ue.fetchIds(G);d(Hl=>Hl.map(Il=>{const p=jl.find(D=>D.id===Il.id);return p&&p.status===se.COMPLETED&&Il.status!==se.COMPLETED?p:Il}))}},5e3);return()=>clearInterval(Y)},[_]);const $l=Y=>{Array.isArray(Y)?d(I=>[...Y,...I]):d(I=>[Y,...I]),j("library")},wl=Y=>{d(I=>[Y,...I]),j("library")},Gl=Y=>{(T==null?void 0:T.id)===Y.id?U(!B):(y(Y),U(!0))},yl=Y=>{xl(Y),j("create"),fl(null)},_l=Y=>{fl(Y),j("detail")},Cl=()=>{xl(null)},zl=Y=>{j(Y),Y!=="detail"&&fl(null),w(!1)},K=Y=>{M(Y),j("home")},Al=()=>{M(null),j("home")},Wl=()=>o==="auth"?u.jsx("div",{className:"h-full animate-in fade-in zoom-in-95 duration-500",children:u.jsx(Ev,{onLogin:K,onCancel:()=>j("home")})}):o==="user"?O?u.jsx(Av,{user:O,onLogout:Al}):(j("auth"),null):o==="home"?u.jsx("div",{className:"animate-in fade-in zoom-in-95 duration-500",children:u.jsx(Sv,{songs:_,onPlay:Gl,onNavigateToCreate:()=>j("create"),onNavigateToDetail:_l})}):o==="create"?u.jsx("div",{className:"animate-in fade-in zoom-in-95 duration-500",children:u.jsx(yv,{onTasksCreated:$l,extendSong:pl,onClearExtend:Cl})}):o==="library"?u.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-4 duration-500",children:[u.jsx("div",{className:"p-6 md:p-8 pb-0",children:u.jsx("h2",{className:"text-3xl font-bold text-white tracking-tight",children:"我的曲库 (Library)"})}),u.jsx(gv,{songs:_,currentSong:T,isPlaying:B,onPlay:Gl,onExtend:yl,onDetail:_l})]}):o==="tools"?u.jsx("div",{className:"animate-in fade-in duration-500",children:u.jsx(Nv,{songs:_,onTaskCreated:wl})}):o==="detail"&&V?u.jsx(_v,{song:V,currentPlayingSong:T,isPlaying:B,relatedSongs:_,onPlayPause:Y=>Gl(Y||V),onBack:()=>j("library"),onExtend:()=>yl(V),onNavigateToSong:_l}):null;return u.jsxs("div",{className:"flex h-screen bg-[#050505] text-white font-sans overflow-hidden bg-[radial-gradient(circle_at_top,_var(--tw-gradient-stops))] from-zinc-900 via-[#050505] to-[#000000]",children:[u.jsxs("div",{className:"md:hidden fixed top-0 left-0 right-0 h-16 bg-black/80 backdrop-blur-md border-b border-white/5 z-50 flex items-center justify-between px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 font-bold text-lg",children:[u.jsx($i,{className:"text-indigo-500"}),"朴见潮音"]}),u.jsx("button",{onClick:()=>w(!0),className:"p-2 text-zinc-300",children:u.jsx(A1,{})})]}),u.jsx(xv,{isOpen:A,onClose:()=>w(!1),activeTab:o==="detail"?"library":o,setActiveTab:zl,user:O,onLoginClick:()=>j("auth")}),u.jsx("div",{className:"hidden md:block h-full z-50 relative shrink-0",children:u.jsx(vv,{activeTab:o==="detail"?"library":o,setActiveTab:zl,user:O,onLoginClick:()=>j("auth")})}),u.jsxs("main",{className:"flex-1 flex flex-col h-full relative overflow-hidden pt-16 md:pt-0",children:[u.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide pb-20 scroll-smooth",children:Wl()}),u.jsx(bv,{currentSong:T,isPlaying:B,setIsPlaying:U,onSongClick:Y=>_l(Y)})]})]})},Ir=document.getElementById("root");if(!Ir)throw new Error("Could not find root element to mount to");const Mv=Dh.createRoot(Ir);Mv.render(u.jsx(_h.StrictMode,{children:u.jsx(Tv,{})})); diff --git a/h5/create/index.html b/h5/create/index.html new file mode 100755 index 0000000..68565f1 --- /dev/null +++ b/h5/create/index.html @@ -0,0 +1,41 @@ + + + + + + Suno AI Music Generator + + + + + + + + +
+ + diff --git a/h5/thousands.html b/h5/thousands.html old mode 100644 new mode 100755 diff --git a/h5/together/assets/index-B7cc8JVP.js b/h5/together/assets/index-B7cc8JVP.js new file mode 100755 index 0000000..917167e --- /dev/null +++ b/h5/together/assets/index-B7cc8JVP.js @@ -0,0 +1,379 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const f of r)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&a(m)}).observe(document,{childList:!0,subtree:!0});function l(r){const f={};return r.integrity&&(f.integrity=r.integrity),r.referrerPolicy&&(f.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?f.credentials="include":r.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(r){if(r.ep)return;r.ep=!0;const f=l(r);fetch(r.href,f)}})();function Lh(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var lu={exports:{}},$o={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Op;function e0(){if(Op)return $o;Op=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function l(a,r,f){var m=null;if(f!==void 0&&(m=""+f),r.key!==void 0&&(m=""+r.key),"key"in r){f={};for(var g in r)g!=="key"&&(f[g]=r[g])}else f=r;return r=f.ref,{$$typeof:i,type:a,key:m,ref:r!==void 0?r:null,props:f}}return $o.Fragment=t,$o.jsx=l,$o.jsxs=l,$o}var Fp;function t0(){return Fp||(Fp=1,lu.exports=e0()),lu.exports}var B=t0(),au={exports:{}},le={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Jp;function n0(){if(Jp)return le;Jp=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),E=Symbol.iterator;function C(M){return M===null||typeof M!="object"?null:(M=E&&M[E]||M["@@iterator"],typeof M=="function"?M:null)}var U={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,b={};function P(M,z,J){this.props=M,this.context=z,this.refs=b,this.updater=J||U}P.prototype.isReactComponent={},P.prototype.setState=function(M,z){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,z,"setState")},P.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function X(){}X.prototype=P.prototype;function k(M,z,J){this.props=M,this.context=z,this.refs=b,this.updater=J||U}var K=k.prototype=new X;K.constructor=k,H(K,P.prototype),K.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var F={H:null,A:null,T:null,S:null},he=Object.prototype.hasOwnProperty;function W(M,z,J){var Z=J.ref;return{$$typeof:i,type:M,key:z,ref:Z!==void 0?Z:null,props:J}}function de(M,z){return W(M.type,z,M.props)}function Ce(M){return typeof M=="object"&&M!==null&&M.$$typeof===i}function Ge(M){var z={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(J){return z[J]})}var Ee=/\/+/g;function Pe(M,z){return typeof M=="object"&&M!==null&&M.key!=null?Ge(""+M.key):z.toString(36)}function rt(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(te,te):(M.status="pending",M.then(function(z){M.status==="pending"&&(M.status="fulfilled",M.value=z)},function(z){M.status==="pending"&&(M.status="rejected",M.reason=z)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function L(M,z,J,Z,ae){var ue=typeof M;(ue==="undefined"||ue==="boolean")&&(M=null);var _e=!1;if(M===null)_e=!0;else switch(ue){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(M.$$typeof){case i:case t:_e=!0;break;case v:return _e=M._init,L(_e(M._payload),z,J,Z,ae)}}if(_e)return ae=ae(M),_e=Z===""?"."+Pe(M,0):Z,ee(ae)?(J="",_e!=null&&(J=_e.replace(Ee,"$&/")+"/"),L(ae,z,J,"",function(io){return io})):ae!=null&&(Ce(ae)&&(ae=de(ae,J+(ae.key==null||M&&M.key===ae.key?"":(""+ae.key).replace(Ee,"$&/")+"/")+_e)),z.push(ae)),1;_e=0;var ot=Z===""?".":Z+":";if(ee(M))for(var Ve=0;Ve>>1,De=L[Me];if(0>>1;Mer(J,ie))Zr(ae,J)?(L[Me]=ae,L[Z]=ie,Me=Z):(L[Me]=J,L[z]=ie,Me=z);else if(Zr(ae,ie))L[Me]=ae,L[Z]=ie,Me=Z;else break e}}return O}function r(L,O){var ie=L.sortIndex-O.sortIndex;return ie!==0?ie:L.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,g=m.now();i.unstable_now=function(){return m.now()-g}}var y=[],h=[],v=1,S=null,E=3,C=!1,U=!1,H=!1,b=!1,P=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function K(L){for(var O=l(h);O!==null;){if(O.callback===null)a(h);else if(O.startTime<=L)a(h),O.sortIndex=O.expirationTime,t(y,O);else break;O=l(h)}}function ee(L){if(H=!1,K(L),!U)if(l(y)!==null)U=!0,te||(te=!0,Ge());else{var O=l(h);O!==null&&rt(ee,O.startTime-L)}}var te=!1,F=-1,he=5,W=-1;function de(){return b?!0:!(i.unstable_now()-WL&&de());){var Me=S.callback;if(typeof Me=="function"){S.callback=null,E=S.priorityLevel;var De=Me(S.expirationTime<=L);if(L=i.unstable_now(),typeof De=="function"){S.callback=De,K(L),O=!0;break t}S===l(y)&&a(y),K(L)}else a(y);S=l(y)}if(S!==null)O=!0;else{var M=l(h);M!==null&&rt(ee,M.startTime-L),O=!1}}break e}finally{S=null,E=ie,C=!1}O=void 0}}finally{O?Ge():te=!1}}}var Ge;if(typeof k=="function")Ge=function(){k(Ce)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Pe=Ee.port2;Ee.port1.onmessage=Ce,Ge=function(){Pe.postMessage(null)}}else Ge=function(){P(Ce,0)};function rt(L,O){F=P(function(){L(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(L){L.callback=null},i.unstable_forceFrameRate=function(L){0>L||125Me?(L.sortIndex=ie,t(h,L),l(y)===null&&L===l(h)&&(H?(X(F),F=-1):H=!0,rt(ee,ie-Me))):(L.sortIndex=De,t(y,L),U||C||(U=!0,te||(te=!0,Ge()))),L},i.unstable_shouldYield=de,i.unstable_wrapCallback=function(L){var O=E;return function(){var ie=E;E=O;try{return L.apply(this,arguments)}finally{E=ie}}}})(uu)),uu}var Kp;function l0(){return Kp||(Kp=1,ru.exports=o0()),ru.exports}var cu={exports:{}},tt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Qp;function a0(){if(Qp)return tt;Qp=1;var i=Du();function t(y){var h="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),cu.exports=a0(),cu.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $p;function r0(){if($p)return Wo;$p=1;var i=l0(),t=Du(),l=s0();function a(e){var n="https://react.dev/errors/"+e;if(1De||(e.current=Me[De],Me[De]=null,De--)}function J(e,n){De++,Me[De]=e.current,e.current=n}var Z=M(null),ae=M(null),ue=M(null),_e=M(null);function ot(e,n){switch(J(ue,n),J(ae,e),J(Z,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=dp(n),e=pp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(Z),J(Z,e)}function Ve(){z(Z),z(ae),z(ue)}function io(e){e.memoizedState!==null&&J(_e,e);var n=Z.current,o=pp(n,e.type);n!==o&&(J(ae,e),J(Z,o))}function nl(e){ae.current===e&&(z(Z),z(ae)),_e.current===e&&(z(_e),Xo._currentValue=ie)}var Pa,Pu;function Fn(e){if(Pa===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);Pa=n&&n[1]||"",Pu=-1)":-1d||A[s]!==x[d]){var G=` +`+A[s].replace(" at new "," at ");return e.displayName&&G.includes("")&&(G=G.replace("",e.displayName)),G}while(1<=s&&0<=d);break}}}finally{ka=!1,Error.prepareStackTrace=o}return(o=e?e.displayName||e.name:"")?Fn(o):""}function Ug(e,n){switch(e.tag){case 26:case 27:case 5:return Fn(e.type);case 16:return Fn("Lazy");case 13:return e.child!==n&&n!==null?Fn("Suspense Fallback"):Fn("Suspense");case 19:return Fn("SuspenseList");case 0:case 15:return Oa(e.type,!1);case 11:return Oa(e.type.render,!1);case 1:return Oa(e.type,!0);case 31:return Fn("Activity");default:return""}}function ku(e){try{var n="",o=null;do n+=Ug(e,o),o=e,e=e.return;while(e);return n}catch(s){return` +Error generating stack: `+s.message+` +`+s.stack}}var Fa=Object.prototype.hasOwnProperty,Ja=i.unstable_scheduleCallback,Ya=i.unstable_cancelCallback,wg=i.unstable_shouldYield,bg=i.unstable_requestPaint,gt=i.unstable_now,Lg=i.unstable_getCurrentPriorityLevel,Ou=i.unstable_ImmediatePriority,Fu=i.unstable_UserBlockingPriority,il=i.unstable_NormalPriority,Gg=i.unstable_LowPriority,Ju=i.unstable_IdlePriority,Hg=i.log,qg=i.unstable_setDisableYieldValue,oo=null,yt=null;function yn(e){if(typeof Hg=="function"&&qg(e),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(oo,e)}catch{}}var vt=Math.clz32?Math.clz32:Bg,Vg=Math.log,zg=Math.LN2;function Bg(e){return e>>>=0,e===0?32:31-(Vg(e)/zg|0)|0}var ol=256,ll=262144,al=4194304;function Jn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function sl(e,n,o){var s=e.pendingLanes;if(s===0)return 0;var d=0,p=e.suspendedLanes,T=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~p,s!==0?d=Jn(s):(T&=_,T!==0?d=Jn(T):o||(o=_&~e,o!==0&&(d=Jn(o))))):(_=s&~p,_!==0?d=Jn(_):T!==0?d=Jn(T):o||(o=s&~e,o!==0&&(d=Jn(o)))),d===0?0:n!==0&&n!==d&&(n&p)===0&&(p=d&-d,o=n&-n,p>=o||p===32&&(o&4194048)!==0)?n:d}function lo(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Pg(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yu(){var e=al;return al<<=1,(al&62914560)===0&&(al=4194304),e}function Xa(e){for(var n=[],o=0;31>o;o++)n.push(e);return n}function ao(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kg(e,n,o,s,d,p){var T=e.pendingLanes;e.pendingLanes=o,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=o,e.entangledLanes&=o,e.errorRecoveryDisabledLanes&=o,e.shellSuspendCounter=0;var _=e.entanglements,A=e.expirationTimes,x=e.hiddenUpdates;for(o=T&~o;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Kg=/[\n"\\]/g;function Nt(e){return e.replace(Kg,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ja(e,n,o,s,d,p,T,_){e.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.type=T:e.removeAttribute("type"),n!=null?T==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Mt(n)):e.value!==""+Mt(n)&&(e.value=""+Mt(n)):T!=="submit"&&T!=="reset"||e.removeAttribute("value"),n!=null?es(e,T,Mt(n)):o!=null?es(e,T,Mt(o)):s!=null&&e.removeAttribute("value"),d==null&&p!=null&&(e.defaultChecked=!!p),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.name=""+Mt(_):e.removeAttribute("name")}function lc(e,n,o,s,d,p,T,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Wa(e);return}o=o!=null?""+Mt(o):"",n=n!=null?""+Mt(n):o,_||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=_?e.checked:!!s,e.defaultChecked=!!s,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(e.name=T),Wa(e)}function es(e,n,o){n==="number"&&cl(e.ownerDocument)===e||e.defaultValue===""+o||(e.defaultValue=""+o)}function gi(e,n,o,s){if(e=e.options,n){n={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ls=!1;if($t)try{var co={};Object.defineProperty(co,"passive",{get:function(){ls=!0}}),window.addEventListener("test",co,co),window.removeEventListener("test",co,co)}catch{ls=!1}var Tn=null,as=null,dl=null;function dc(){if(dl)return dl;var e,n=as,o=n.length,s,d="value"in Tn?Tn.value:Tn.textContent,p=d.length;for(e=0;e=mo),vc=" ",Tc=!1;function Sc(e,n){switch(e){case"keyup":return _y.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Si=!1;function Ay(e,n){switch(e){case"compositionend":return Ec(n);case"keypress":return n.which!==32?null:(Tc=!0,vc);case"textInput":return e=n.data,e===vc&&Tc?null:e;default:return null}}function Ry(e,n){if(Si)return e==="compositionend"||!fs&&Sc(e,n)?(e=dc(),dl=as=Tn=null,Si=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:o,offset:n-e};e=s}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=xc(o)}}function Uc(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Uc(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function wc(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=cl(e.document);n instanceof e.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)e=n.contentWindow;else break;n=cl(e.document)}return n}function ms(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var by=$t&&"documentMode"in document&&11>=document.documentMode,Ei=null,hs=null,vo=null,gs=!1;function bc(e,n,o){var s=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;gs||Ei==null||Ei!==cl(s)||(s=Ei,"selectionStart"in s&&ms(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vo&&yo(vo,s)||(vo=s,s=la(hs,"onSelect"),0>=T,d-=T,Jt=1<<32-vt(n)+d|o<re?(me=$,$=null):me=$.sibling;var ve=D(N,$,I[re],q);if(ve===null){$===null&&($=me);break}e&&$&&ve.alternate===null&&n(N,$),R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve,$=me}if(re===I.length)return o(N,$),ge&&jt(N,re),j;if($===null){for(;rere?(me=$,$=null):me=$.sibling;var Pn=D(N,$,ve.value,q);if(Pn===null){$===null&&($=me);break}e&&$&&Pn.alternate===null&&n(N,$),R=p(Pn,R,re),ye===null?j=Pn:ye.sibling=Pn,ye=Pn,$=me}if(ve.done)return o(N,$),ge&&jt(N,re),j;if($===null){for(;!ve.done;re++,ve=I.next())ve=V(N,ve.value,q),ve!==null&&(R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve);return ge&&jt(N,re),j}for($=s($);!ve.done;re++,ve=I.next())ve=w($,N,re,ve.value,q),ve!==null&&(e&&ve.alternate!==null&&$.delete(ve.key===null?re:ve.key),R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve);return e&&$.forEach(function(jv){return n(N,jv)}),ge&&jt(N,re),j}function xe(N,R,I,q){if(typeof I=="object"&&I!==null&&I.type===H&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case C:e:{for(var j=I.key;R!==null;){if(R.key===j){if(j=I.type,j===H){if(R.tag===7){o(N,R.sibling),q=d(R,I.props.children),q.return=N,N=q;break e}}else if(R.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===he&&ni(j)===R.type){o(N,R.sibling),q=d(R,I.props),Ao(q,I),q.return=N,N=q;break e}o(N,R);break}else n(N,R);R=R.sibling}I.type===H?(q=$n(I.props.children,N.mode,q,I.key),q.return=N,N=q):(q=_l(I.type,I.key,I.props,null,N.mode,q),Ao(q,I),q.return=N,N=q)}return T(N);case U:e:{for(j=I.key;R!==null;){if(R.key===j)if(R.tag===4&&R.stateNode.containerInfo===I.containerInfo&&R.stateNode.implementation===I.implementation){o(N,R.sibling),q=d(R,I.children||[]),q.return=N,N=q;break e}else{o(N,R);break}else n(N,R);R=R.sibling}q=Cs(I,N.mode,q),q.return=N,N=q}return T(N);case he:return I=ni(I),xe(N,R,I,q)}if(rt(I))return Q(N,R,I,q);if(Ge(I)){if(j=Ge(I),typeof j!="function")throw Error(a(150));return I=j.call(I),ne(N,R,I,q)}if(typeof I.then=="function")return xe(N,R,xl(I),q);if(I.$$typeof===k)return xe(N,R,Rl(N,I),q);Dl(N,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,R!==null&&R.tag===6?(o(N,R.sibling),q=d(R,I),q.return=N,N=q):(o(N,R),q=_s(I,N.mode,q),q.return=N,N=q),T(N)):o(N,R)}return function(N,R,I,q){try{Co=0;var j=xe(N,R,I,q);return wi=null,j}catch($){if($===Ui||$===Nl)throw $;var ye=St(29,$,null,N.mode);return ye.lanes=q,ye.return=N,ye}finally{}}}var oi=nf(!0),of=nf(!1),An=!1;function Gs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hs(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Rn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Mn(e,n,o){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Se&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=El(e),Bc(e,null,o),n}return Sl(e,s,n,o),El(e)}function Ro(e,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,o|=s,n.lanes=o,Ku(e,o)}}function qs(e,n){var o=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,o===s)){var d=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var T={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};p===null?d=p=T:p=p.next=T,o=o.next}while(o!==null);p===null?d=p=n:p=p.next=n}else d=p=n;o={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=n:e.next=n,o.lastBaseUpdate=n}var Vs=!1;function Mo(){if(Vs){var e=Di;if(e!==null)throw e}}function No(e,n,o,s){Vs=!1;var d=e.updateQueue;An=!1;var p=d.firstBaseUpdate,T=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var A=_,x=A.next;A.next=null,T===null?p=x:T.next=x,T=A;var G=e.alternate;G!==null&&(G=G.updateQueue,_=G.lastBaseUpdate,_!==T&&(_===null?G.firstBaseUpdate=x:_.next=x,G.lastBaseUpdate=A))}if(p!==null){var V=d.baseState;T=0,G=x=A=null,_=p;do{var D=_.lane&-536870913,w=D!==_.lane;if(w?(pe&D)===D:(s&D)===D){D!==0&&D===xi&&(Vs=!0),G!==null&&(G=G.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Q=e,ne=_;D=n;var xe=o;switch(ne.tag){case 1:if(Q=ne.payload,typeof Q=="function"){V=Q.call(xe,V,D);break e}V=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=ne.payload,D=typeof Q=="function"?Q.call(xe,V,D):Q,D==null)break e;V=S({},V,D);break e;case 2:An=!0}}D=_.callback,D!==null&&(e.flags|=64,w&&(e.flags|=8192),w=d.callbacks,w===null?d.callbacks=[D]:w.push(D))}else w={lane:D,tag:_.tag,payload:_.payload,callback:_.callback,next:null},G===null?(x=G=w,A=V):G=G.next=w,T|=D;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;w=_,_=w.next,w.next=null,d.lastBaseUpdate=w,d.shared.pending=null}}while(!0);G===null&&(A=V),d.baseState=A,d.firstBaseUpdate=x,d.lastBaseUpdate=G,p===null&&(d.shared.lanes=0),Un|=T,e.lanes=T,e.memoizedState=V}}function lf(e,n){if(typeof e!="function")throw Error(a(191,e));e.call(n)}function af(e,n){var o=e.callbacks;if(o!==null)for(e.callbacks=null,e=0;ep?p:8;var T=L.T,_={};L.T=_,ir(e,!1,n,o);try{var A=d(),x=L.S;if(x!==null&&x(_,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var G=ky(A,s);Do(e,n,G,Rt(e))}else Do(e,n,s,Rt(e))}catch(V){Do(e,n,{then:function(){},status:"rejected",reason:V},Rt())}finally{O.p=p,T!==null&&_.types!==null&&(T.types=_.types),L.T=T}}function Ky(){}function tr(e,n,o,s){if(e.tag!==5)throw Error(a(476));var d=Vf(e).queue;qf(e,d,n,ie,o===null?Ky:function(){return zf(e),o(s)})}function Vf(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:on,lastRenderedState:ie},next:null};var o={};return n.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:on,lastRenderedState:o},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function zf(e){var n=Vf(e);n.next===null&&(n=e.alternate.memoizedState),Do(e,n.next.queue,{},Rt())}function nr(){return We(Xo)}function Bf(){return Be().memoizedState}function Pf(){return Be().memoizedState}function Qy(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var o=Rt();e=Rn(o);var s=Mn(n,e,o);s!==null&&(ht(s,n,o),Ro(s,n,o)),n={cache:Us()},e.payload=n;return}n=n.return}}function Zy(e,n,o){var s=Rt();o={lane:s,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Bl(e)?Of(n,o):(o=Ss(e,n,o,s),o!==null&&(ht(o,e,s),Ff(o,n,s)))}function kf(e,n,o){var s=Rt();Do(e,n,o,s)}function Do(e,n,o,s){var d={lane:s,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Bl(e))Of(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var T=n.lastRenderedState,_=p(T,o);if(d.hasEagerState=!0,d.eagerState=_,Tt(_,T))return Sl(e,n,d,0),Ue===null&&Tl(),!1}catch{}finally{}if(o=Ss(e,n,d,s),o!==null)return ht(o,e,s),Ff(o,n,s),!0}return!1}function ir(e,n,o,s){if(s={lane:2,revertLane:Gr(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Bl(e)){if(n)throw Error(a(479))}else n=Ss(e,o,s,2),n!==null&&ht(n,e,2)}function Bl(e){var n=e.alternate;return e===se||n!==null&&n===se}function Of(e,n){Li=bl=!0;var o=e.pending;o===null?n.next=n:(n.next=o.next,o.next=n),e.pending=n}function Ff(e,n,o){if((o&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,o|=s,n.lanes=o,Ku(e,o)}}var Uo={readContext:We,use:Hl,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useLayoutEffect:He,useInsertionEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useSyncExternalStore:He,useId:He,useHostTransitionStatus:He,useFormState:He,useActionState:He,useOptimistic:He,useMemoCache:He,useCacheRefresh:He};Uo.useEffectEvent=He;var Jf={readContext:We,use:Hl,useCallback:function(e,n){return lt().memoizedState=[e,n===void 0?null:n],e},useContext:We,useEffect:If,useImperativeHandle:function(e,n,o){o=o!=null?o.concat([e]):null,Vl(4194308,4,wf.bind(null,n,e),o)},useLayoutEffect:function(e,n){return Vl(4194308,4,e,n)},useInsertionEffect:function(e,n){Vl(4,2,e,n)},useMemo:function(e,n){var o=lt();n=n===void 0?null:n;var s=e();if(li){yn(!0);try{e()}finally{yn(!1)}}return o.memoizedState=[s,n],s},useReducer:function(e,n,o){var s=lt();if(o!==void 0){var d=o(n);if(li){yn(!0);try{o(n)}finally{yn(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=Zy.bind(null,se,e),[s.memoizedState,e]},useRef:function(e){var n=lt();return e={current:e},n.memoizedState=e},useState:function(e){e=Zs(e);var n=e.queue,o=kf.bind(null,se,n);return n.dispatch=o,[e.memoizedState,o]},useDebugValue:js,useDeferredValue:function(e,n){var o=lt();return er(o,e,n)},useTransition:function(){var e=Zs(!1);return e=qf.bind(null,se,e.queue,!0,!1),lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,o){var s=se,d=lt();if(ge){if(o===void 0)throw Error(a(407));o=o()}else{if(o=n(),Ue===null)throw Error(a(349));(pe&127)!==0||df(s,n,o)}d.memoizedState=o;var p={value:o,getSnapshot:n};return d.queue=p,If(mf.bind(null,s,p,e),[e]),s.flags|=2048,Hi(9,{destroy:void 0},pf.bind(null,s,p,o,n),null),o},useId:function(){var e=lt(),n=Ue.identifierPrefix;if(ge){var o=Yt,s=Jt;o=(s&~(1<<32-vt(s)-1)).toString(32)+o,n="_"+n+"R_"+o,o=Ll++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?T.createElement("select",{is:s.is}):T.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?T.createElement(d,{is:s.is}):T.createElement(d)}}p[Ze]=n,p[ut]=s;e:for(T=n.child;T!==null;){if(T.tag===5||T.tag===6)p.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===n)break e;for(;T.sibling===null;){if(T.return===null||T.return===n)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}n.stateNode=p;e:switch(et(p,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&an(n)}}return be(n),yr(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,o),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&an(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(a(166));if(e=ue.current,Ni(n)){if(e=n.stateNode,o=n.memoizedProps,s=null,d=$e,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[Ze]=n,e=!!(e.nodeValue===o||s!==null&&s.suppressHydrationWarning===!0||cp(e.nodeValue,o)),e||_n(n,!0)}else e=aa(e).createTextNode(s),e[Ze]=n,n.stateNode=e}return be(n),null;case 31:if(o=n.memoizedState,e===null||e.memoizedState!==null){if(s=Ni(n),o!==null){if(e===null){if(!s)throw Error(a(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Ze]=n}else Wn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;be(n),e=!1}else o=Ns(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),e=!0;if(!e)return n.flags&256?(_t(n),n):(_t(n),null);if((n.flags&128)!==0)throw Error(a(558))}return be(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Ni(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(a(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));d[Ze]=n}else Wn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;be(n),d=!1}else d=Ns(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(_t(n),n):(_t(n),null)}return _t(n),(n.flags&128)!==0?(n.lanes=o,n):(o=s!==null,e=e!==null&&e.memoizedState!==null,o&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==d&&(s.flags|=2048)),o!==e&&o&&(n.child.flags|=8192),Jl(n,n.updateQueue),be(n),null);case 4:return Ve(),e===null&&zr(n.stateNode.containerInfo),be(n),null;case 10:return tn(n.type),be(n),null;case 19:if(z(ze),s=n.memoizedState,s===null)return be(n),null;if(d=(n.flags&128)!==0,p=s.rendering,p===null)if(d)bo(s,!1);else{if(qe!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=wl(e),p!==null){for(n.flags|=128,bo(s,!1),e=p.updateQueue,n.updateQueue=e,Jl(n,e),n.subtreeFlags=0,e=o,o=n.child;o!==null;)Pc(o,e),o=o.sibling;return J(ze,ze.current&1|2),ge&&jt(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&>()>Zl&&(n.flags|=128,d=!0,bo(s,!1),n.lanes=4194304)}else{if(!d)if(e=wl(p),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,Jl(n,e),bo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ge)return be(n),null}else 2*gt()-s.renderingStartTime>Zl&&o!==536870912&&(n.flags|=128,d=!0,bo(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=gt(),e.sibling=null,o=ze.current,J(ze,d?o&1|2:o&1),ge&&jt(n,s.treeForkCount),e):(be(n),null);case 22:case 23:return _t(n),Bs(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(o&536870912)!==0&&(n.flags&128)===0&&(be(n),n.subtreeFlags&6&&(n.flags|=8192)):be(n),o=n.updateQueue,o!==null&&Jl(n,o.retryQueue),o=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(o=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==o&&(n.flags|=2048),e!==null&&z(ti),null;case 24:return o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),tn(ke),be(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function tv(e,n){switch(Rs(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return tn(ke),Ve(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return nl(n),null;case 31:if(n.memoizedState!==null){if(_t(n),n.alternate===null)throw Error(a(340));Wn()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(_t(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(a(340));Wn()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return z(ze),null;case 4:return Ve(),null;case 10:return tn(n.type),null;case 22:case 23:return _t(n),Bs(),e!==null&&z(ti),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return tn(ke),null;case 25:return null;default:return null}}function hd(e,n){switch(Rs(n),n.tag){case 3:tn(ke),Ve();break;case 26:case 27:case 5:nl(n);break;case 4:Ve();break;case 31:n.memoizedState!==null&&_t(n);break;case 13:_t(n);break;case 19:z(ze);break;case 10:tn(n.type);break;case 22:case 23:_t(n),Bs(),e!==null&&z(ti);break;case 24:tn(ke)}}function Lo(e,n){try{var o=n.updateQueue,s=o!==null?o.lastEffect:null;if(s!==null){var d=s.next;o=d;do{if((o.tag&e)===e){s=void 0;var p=o.create,T=o.inst;s=p(),T.destroy=s}o=o.next}while(o!==d)}}catch(_){Re(n,n.return,_)}}function xn(e,n,o){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var p=d.next;s=p;do{if((s.tag&e)===e){var T=s.inst,_=T.destroy;if(_!==void 0){T.destroy=void 0,d=n;var A=o,x=_;try{x()}catch(G){Re(d,A,G)}}}s=s.next}while(s!==p)}}catch(G){Re(n,n.return,G)}}function gd(e){var n=e.updateQueue;if(n!==null){var o=e.stateNode;try{af(n,o)}catch(s){Re(e,e.return,s)}}}function yd(e,n,o){o.props=ai(e.type,e.memoizedProps),o.state=e.memoizedState;try{o.componentWillUnmount()}catch(s){Re(e,n,s)}}function Go(e,n){try{var o=e.ref;if(o!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof o=="function"?e.refCleanup=o(s):o.current=s}}catch(d){Re(e,n,d)}}function Xt(e,n){var o=e.ref,s=e.refCleanup;if(o!==null)if(typeof s=="function")try{s()}catch(d){Re(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(d){Re(e,n,d)}else o.current=null}function vd(e){var n=e.type,o=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":o.autoFocus&&s.focus();break e;case"img":o.src?s.src=o.src:o.srcSet&&(s.srcset=o.srcSet)}}catch(d){Re(e,e.return,d)}}function vr(e,n,o){try{var s=e.stateNode;Cv(s,e.type,o,n),s[ut]=n}catch(d){Re(e,e.return,d)}}function Td(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Hn(e.type)||e.tag===4}function Tr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Td(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Hn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Sr(e,n,o){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(e,n):(n=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,n.appendChild(e),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=Zt));else if(s!==4&&(s===27&&Hn(e.type)&&(o=e.stateNode,n=null),e=e.child,e!==null))for(Sr(e,n,o),e=e.sibling;e!==null;)Sr(e,n,o),e=e.sibling}function Yl(e,n,o){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?o.insertBefore(e,n):o.appendChild(e);else if(s!==4&&(s===27&&Hn(e.type)&&(o=e.stateNode),e=e.child,e!==null))for(Yl(e,n,o),e=e.sibling;e!==null;)Yl(e,n,o),e=e.sibling}function Sd(e){var n=e.stateNode,o=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);et(n,s,o),n[Ze]=e,n[ut]=o}catch(p){Re(e,e.return,p)}}var sn=!1,Je=!1,Er=!1,Ed=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function nv(e,n){if(e=e.containerInfo,kr=pa,e=wc(e),ms(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var s=o.getSelection&&o.getSelection();if(s&&s.rangeCount!==0){o=s.anchorNode;var d=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var T=0,_=-1,A=-1,x=0,G=0,V=e,D=null;t:for(;;){for(var w;V!==o||d!==0&&V.nodeType!==3||(_=T+d),V!==p||s!==0&&V.nodeType!==3||(A=T+s),V.nodeType===3&&(T+=V.nodeValue.length),(w=V.firstChild)!==null;)D=V,V=w;for(;;){if(V===e)break t;if(D===o&&++x===d&&(_=T),D===p&&++G===s&&(A=T),(w=V.nextSibling)!==null)break;V=D,D=V.parentNode}V=w}o=_===-1||A===-1?null:{start:_,end:A}}else o=null}o=o||{start:0,end:0}}else o=null;for(Or={focusedElem:e,selectionRange:o},pa=!1,Ke=n;Ke!==null;)if(n=Ke,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ke=e;else for(;Ke!==null;){switch(n=Ke,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(o=0;o title"))),et(p,s,o),p[Ze]=e,Xe(p),s=p;break e;case"link":var T=Np("link","href",d).get(s+(o.href||""));if(T){for(var _=0;_xe&&(T=xe,xe=ne,ne=T);var N=Dc(_,ne),R=Dc(_,xe);if(N&&R&&(w.rangeCount!==1||w.anchorNode!==N.node||w.anchorOffset!==N.offset||w.focusNode!==R.node||w.focusOffset!==R.offset)){var I=V.createRange();I.setStart(N.node,N.offset),w.removeAllRanges(),ne>xe?(w.addRange(I),w.extend(R.node,R.offset)):(I.setEnd(R.node,R.offset),w.addRange(I))}}}}for(V=[],w=_;w=w.parentNode;)w.nodeType===1&&V.push({element:w,left:w.scrollLeft,top:w.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_o?32:o,L.T=null,o=Ir,Ir=null;var p=bn,T=dn;if(Ye=0,Pi=bn=null,dn=0,(Se&6)!==0)throw Error(a(331));var _=Se;if(Se|=4,wd(p.current),xd(p,p.current,T,o),Se=_,Po(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(oo,p)}catch{}return!0}finally{O.p=d,L.T=s,Zd(e,n)}}function Wd(e,n,o){n=xt(o,n),n=sr(e.stateNode,n,2),e=Mn(e,n,2),e!==null&&(ao(e,2),Kt(e))}function Re(e,n,o){if(e.tag===3)Wd(e,e,o);else for(;n!==null;){if(n.tag===3){Wd(n,e,o);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(wn===null||!wn.has(s))){e=xt(o,e),o=jf(2),s=Mn(n,o,2),s!==null&&(ed(o,s,n,e),ao(s,2),Kt(s));break}}n=n.return}}function wr(e,n,o){var s=e.pingCache;if(s===null){s=e.pingCache=new lv;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(o)||(Ar=!0,d.add(o),e=cv.bind(null,e,n,o),n.then(e,e))}function cv(e,n,o){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&o,e.warmLanes&=~o,Ue===e&&(pe&o)===o&&(qe===4||qe===3&&(pe&62914560)===pe&&300>gt()-Ql?(Se&2)===0&&ki(e,0):Rr|=o,Bi===pe&&(Bi=0)),Kt(e)}function jd(e,n){n===0&&(n=Yu()),e=Zn(e,n),e!==null&&(ao(e,n),Kt(e))}function fv(e){var n=e.memoizedState,o=0;n!==null&&(o=n.retryLane),jd(e,o)}function dv(e,n){var o=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(o=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(a(314))}s!==null&&s.delete(n),jd(e,o)}function pv(e,n){return Ja(e,n)}var na=null,Fi=null,br=!1,ia=!1,Lr=!1,Gn=0;function Kt(e){e!==Fi&&e.next===null&&(Fi===null?na=Fi=e:Fi=Fi.next=e),ia=!0,br||(br=!0,hv())}function Po(e,n){if(!Lr&&ia){Lr=!0;do for(var o=!1,s=na;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var p=0;else{var T=s.suspendedLanes,_=s.pingedLanes;p=(1<<31-vt(42|e)+1)-1,p&=d&~(T&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(o=!0,ip(s,p))}else p=pe,p=sl(s,s===Ue?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||lo(s,p)||(o=!0,ip(s,p));s=s.next}while(o);Lr=!1}}function mv(){ep()}function ep(){ia=br=!1;var e=0;Gn!==0&&Rv()&&(e=Gn);for(var n=gt(),o=null,s=na;s!==null;){var d=s.next,p=tp(s,n);p===0?(s.next=null,o===null?na=d:o.next=d,d===null&&(Fi=o)):(o=s,(e!==0||(p&3)!==0)&&(ia=!0)),s=d}Ye!==0&&Ye!==5||Po(e),Gn!==0&&(Gn=0)}function tp(e,n){for(var o=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes&-62914561;0_)break;var G=A.transferSize,V=A.initiatorType;G&&fp(V)&&(A=A.responseEnd,T+=G*(A<_?1:(_-x)/(A-x)))}if(--s,n+=8*(p+T)/(d.duration/1e3),e++,10"u"?null:document;function Cp(e,n,o){var s=Ji;if(s&&typeof n=="string"&&n){var d=Nt(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof o=="string"&&(d+='[crossorigin="'+o+'"]'),_p.has(d)||(_p.add(d),e={rel:e,crossOrigin:o,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),et(n,"link",e),Xe(n),s.head.appendChild(n)))}}function Lv(e){pn.D(e),Cp("dns-prefetch",e,null)}function Gv(e,n){pn.C(e,n),Cp("preconnect",e,n)}function Hv(e,n,o){pn.L(e,n,o);var s=Ji;if(s&&e&&n){var d='link[rel="preload"][as="'+Nt(n)+'"]';n==="image"&&o&&o.imageSrcSet?(d+='[imagesrcset="'+Nt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(d+='[imagesizes="'+Nt(o.imageSizes)+'"]')):d+='[href="'+Nt(e)+'"]';var p=d;switch(n){case"style":p=Yi(e);break;case"script":p=Xi(e)}Gt.has(p)||(e=S({rel:"preload",href:n==="image"&&o&&o.imageSrcSet?void 0:e,as:n},o),Gt.set(p,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Jo(p))||n==="script"&&s.querySelector(Yo(p))||(n=s.createElement("link"),et(n,"link",e),Xe(n),s.head.appendChild(n)))}}function qv(e,n){pn.m(e,n);var o=Ji;if(o&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+Nt(s)+'"][href="'+Nt(e)+'"]',p=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Xi(e)}if(!Gt.has(p)&&(e=S({rel:"modulepreload",href:e},n),Gt.set(p,e),o.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Yo(p)))return}s=o.createElement("link"),et(s,"link",e),Xe(s),o.head.appendChild(s)}}}function Vv(e,n,o){pn.S(e,n,o);var s=Ji;if(s&&e){var d=mi(s).hoistableStyles,p=Yi(e);n=n||"default";var T=d.get(p);if(!T){var _={loading:0,preload:null};if(T=s.querySelector(Jo(p)))_.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":n},o),(o=Gt.get(p))&&Zr(e,o);var A=T=s.createElement("link");Xe(A),et(A,"link",e),A._p=new Promise(function(x,G){A.onload=x,A.onerror=G}),A.addEventListener("load",function(){_.loading|=1}),A.addEventListener("error",function(){_.loading|=2}),_.loading|=4,ra(T,n,s)}T={type:"stylesheet",instance:T,count:1,state:_},d.set(p,T)}}}function zv(e,n){pn.X(e,n);var o=Ji;if(o&&e){var s=mi(o).hoistableScripts,d=Xi(e),p=s.get(d);p||(p=o.querySelector(Yo(d)),p||(e=S({src:e,async:!0},n),(n=Gt.get(d))&&$r(e,n),p=o.createElement("script"),Xe(p),et(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Bv(e,n){pn.M(e,n);var o=Ji;if(o&&e){var s=mi(o).hoistableScripts,d=Xi(e),p=s.get(d);p||(p=o.querySelector(Yo(d)),p||(e=S({src:e,async:!0,type:"module"},n),(n=Gt.get(d))&&$r(e,n),p=o.createElement("script"),Xe(p),et(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Ap(e,n,o,s){var d=(d=ue.current)?sa(d):null;if(!d)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(n=Yi(o.href),o=mi(d).hoistableStyles,s=o.get(n),s||(s={type:"style",instance:null,count:0,state:null},o.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){e=Yi(o.href);var p=mi(d).hoistableStyles,T=p.get(e);if(T||(d=d.ownerDocument||d,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,T),(p=d.querySelector(Jo(e)))&&!p._p&&(T.instance=p,T.state.loading=5),Gt.has(e)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Gt.set(e,o),p||Pv(d,e,o,T.state))),n&&s===null)throw Error(a(528,""));return T}if(n&&s!==null)throw Error(a(529,""));return null;case"script":return n=o.async,o=o.src,typeof o=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Xi(o),o=mi(d).hoistableScripts,s=o.get(n),s||(s={type:"script",instance:null,count:0,state:null},o.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Yi(e){return'href="'+Nt(e)+'"'}function Jo(e){return'link[rel="stylesheet"]['+e+"]"}function Rp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Pv(e,n,o,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),et(n,"link",o),Xe(n),e.head.appendChild(n))}function Xi(e){return'[src="'+Nt(e)+'"]'}function Yo(e){return"script[async]"+e}function Mp(e,n,o){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Nt(o.href)+'"]');if(s)return n.instance=s,Xe(s),s;var d=S({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Xe(s),et(s,"style",d),ra(s,o.precedence,e),n.instance=s;case"stylesheet":d=Yi(o.href);var p=e.querySelector(Jo(d));if(p)return n.state.loading|=4,n.instance=p,Xe(p),p;s=Rp(o),(d=Gt.get(d))&&Zr(s,d),p=(e.ownerDocument||e).createElement("link"),Xe(p);var T=p;return T._p=new Promise(function(_,A){T.onload=_,T.onerror=A}),et(p,"link",s),n.state.loading|=4,ra(p,o.precedence,e),n.instance=p;case"script":return p=Xi(o.src),(d=e.querySelector(Yo(p)))?(n.instance=d,Xe(d),d):(s=o,(d=Gt.get(p))&&(s=S({},o),$r(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),Xe(d),et(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,ra(s,o.precedence,e));return n.instance}function ra(e,n,o){for(var s=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,p=d,T=0;T title"):null)}function kv(e,n,o){if(o===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ov(e,n,o,s){if(o.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var d=Yi(s.href),p=n.querySelector(Jo(d));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ca.bind(e),n.then(e,e)),o.state.loading|=4,o.instance=p,Xe(p);return}p=n.ownerDocument||n,s=Rp(s),(d=Gt.get(d))&&Zr(s,d),p=p.createElement("link"),Xe(p);var T=p;T._p=new Promise(function(_,A){T.onload=_,T.onerror=A}),et(p,"link",s),o.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(o,n),(n=o.state.preload)&&(o.state.loading&3)===0&&(e.count++,o=ca.bind(e),n.addEventListener("load",o),n.addEventListener("error",o))}}var Wr=0;function Fv(e,n){return e.stylesheets&&e.count===0&&da(e,e.stylesheets),0Wr?50:800)+n);return e.unsuspend=o,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function ca(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)da(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var fa=null;function da(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,fa=new Map,n.forEach(Jv,e),fa=null,ca.call(e))}function Jv(e,n){if(!(n.state.loading&4)){var o=fa.get(e);if(o)var s=o.get(null);else{o=new Map,fa.set(e,o);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),su.exports=r0(),su.exports}var c0=u0();const f0=Lh(c0),jp=({children:i})=>B.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-start pt-8 pb-8 px-4 sm:px-6 max-w-md mx-auto w-full relative",children:[B.jsxs("div",{className:"fixed top-0 left-0 w-full h-full overflow-hidden pointer-events-none -z-10",children:[B.jsx("div",{className:"absolute top-10 right-10 w-20 h-20 border-4 border-white/20 rounded-full animate-float"}),B.jsx("div",{className:"absolute bottom-20 left-10 w-16 h-16 bg-brand-yellow/20 rounded-full blur-xl animate-pulse"})]}),B.jsxs("header",{className:"w-full flex flex-col items-center mb-6 text-center relative z-20",children:[B.jsx("div",{className:"inline-block bg-white text-brand-red px-3 py-1 rounded-full text-xs font-bold mb-3 shadow-lg transform -rotate-2",children:"🎵 歌词灵感 · 现场征集"}),B.jsxs("h1",{className:"text-4xl font-black italic tracking-tighter text-white drop-shadow-lg mb-2 transform -skew-x-3",children:["一起做首",B.jsx("br",{}),B.jsx("span",{className:"text-5xl",children:"我们的歌"})]}),B.jsxs("div",{className:"mt-6 space-y-1",children:[B.jsx("p",{className:"text-lg font-bold text-white border-b-2 border-white/30 inline-block pb-1",children:"门槛不高,不需要懂音乐"}),B.jsx("p",{className:"text-sm opacity-90",children:"聊聊咱们的故事,将灵感汇聚成歌"})]})]}),B.jsx("main",{className:"w-full bg-white rounded-3xl p-6 shadow-xl relative overflow-hidden text-gray-800",children:i}),B.jsx("footer",{className:"mt-8 text-[10px] text-white/60 text-center uppercase tracking-wider",children:"© 2025 COMMUNE Music Co-creation"})]});/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),p0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,l,a)=>a?a.toUpperCase():l.toLowerCase()),em=i=>{const t=p0(i);return t.charAt(0).toUpperCase()+t.slice(1)},Gh=(...i)=>i.filter((t,l,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===l).join(" ").trim(),m0=i=>{for(const t in i)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var h0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g0=nt.forwardRef(({color:i="currentColor",size:t=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:r="",children:f,iconNode:m,...g},y)=>nt.createElement("svg",{ref:y,...h0,width:t,height:t,stroke:i,strokeWidth:a?Number(l)*24/Number(t):l,className:Gh("lucide",r),...!f&&!m0(g)&&{"aria-hidden":"true"},...g},[...m.map(([h,v])=>nt.createElement(h,v)),...Array.isArray(f)?f:[f]]));/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ot=(i,t)=>{const l=nt.forwardRef(({className:a,...r},f)=>nt.createElement(g0,{ref:f,iconNode:t,className:Gh(`lucide-${d0(em(i))}`,`lucide-${i}`,a),...r}));return l.displayName=em(i),l};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],v0=Ot("arrow-right",y0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],S0=Ot("circle-check",T0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E0=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],_0=Ot("coffee",E0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Hh=Ot("loader-circle",C0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A0=[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]],R0=Ot("music-2",A0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M0=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],N0=Ot("quote",M0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],x0=Ot("refresh-cw",I0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],U0=Ot("send",D0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w0=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],b0=Ot("smartphone",w0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L0=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],qh=Ot("sparkles",L0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],H0=Ot("user",G0),fu="ai_song_fest_user",du="ai_song_fest_songs",q0=/^1[3-9]\d{9}$/,hu={login:async i=>{if(await new Promise(a=>setTimeout(a,800)),!q0.test(i))return{success:!1,error:"手机号格式不正确"};if(i.endsWith("0000"))return{success:!1,error:"该手机号未报名参与本次活动"};const t=`tk_${i}_${Date.now().toString(36)}`,l={phone:i,token:t};return localStorage.setItem(fu,JSON.stringify(l)),{success:!0,token:t}},getCurrentUser:()=>{const i=localStorage.getItem(fu);return i?JSON.parse(i):null},logout:()=>{localStorage.removeItem(fu)}},Sa={getSongByPhone:async i=>(await new Promise(l=>setTimeout(l,300)),JSON.parse(localStorage.getItem(du)||"{}")[i]||null),submitSong:async(i,t)=>{await new Promise(f=>setTimeout(f,1500));const l=`TKT-${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}-${Date.now().toString().slice(-4)}`,a={id:Date.now().toString(36),phone:i,title:t.title,lyrics:t.lyrics,style:t.style,nickname:t.nickname,status:"submitted",ticketNumber:l,createdAt:Date.now()},r=JSON.parse(localStorage.getItem(du)||"{}");return r[i]=a,localStorage.setItem(du,JSON.stringify(r)),a}},V0=({onLoginSuccess:i})=>{const[t,l]=nt.useState(""),[a,r]=nt.useState(!1),[f,m]=nt.useState(""),g=async y=>{y.preventDefault(),r(!0),m("");try{const h=await hu.login(t);h.success?i():m(h.error||"验证失败")}catch{m("发生未知错误")}finally{r(!1)}};return B.jsxs("div",{className:"space-y-8 py-2",children:[B.jsxs("div",{className:"text-center space-y-2",children:[B.jsx("h2",{className:"text-2xl font-black text-brand-dark tracking-wide",children:"欢迎加入共创"}),B.jsx("p",{className:"text-gray-500 text-sm",children:"输入手机号,开始分享你的故事"})]}),B.jsxs("form",{onSubmit:g,className:"space-y-6",children:[B.jsxs("div",{className:"group",children:[B.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-2 uppercase tracking-wider ml-1",children:"手机号码"}),B.jsxs("div",{className:"relative transition-transform duration-300 focus-within:scale-[1.02]",children:[B.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-12 flex items-center justify-center text-gray-400 group-focus-within:text-brand-orange transition-colors",children:B.jsx(b0,{className:"w-5 h-5"})}),B.jsx("input",{type:"tel",value:t,onChange:y=>l(y.target.value),placeholder:"138 0000 0000",className:"w-full bg-gray-50 border border-gray-200 rounded-xl py-4 pl-12 pr-4 text-gray-800 placeholder-gray-400 focus:outline-none focus:border-brand-orange focus:ring-1 focus:ring-brand-orange transition-all font-mono text-lg",required:!0})]})]}),f&&B.jsxs("div",{className:"p-3 rounded-lg bg-red-50 border border-red-100 text-red-500 text-sm flex items-center gap-2 animate-pulse",children:[B.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),f]}),B.jsx("button",{type:"submit",disabled:a,className:"w-full bg-gradient-to-r from-brand-orange to-brand-red hover:shadow-lg hover:shadow-brand-orange/30 disabled:opacity-50 text-white font-bold py-4 rounded-xl transition-all transform active:scale-95 flex items-center justify-center gap-2",children:a?B.jsx(Hh,{className:"w-5 h-5 animate-spin"}):B.jsxs(B.Fragment,{children:["验证并开始 ",B.jsx(v0,{className:"w-5 h-5"})]})})]}),B.jsx("div",{className:"text-[10px] text-center text-gray-400 pt-4",children:B.jsx("span",{className:"inline-block px-2 py-1 bg-gray-100 rounded",children:"测试提示: 尾号 0000 将会被拒绝"})})]})};var z0={};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */let B0,P0;function k0(){return{geminiUrl:B0,vertexUrl:P0}}function O0(i,t,l,a){var r,f;if(!(i!=null&&i.baseUrl)){const m=k0();return t?(r=m.vertexUrl)!==null&&r!==void 0?r:l:(f=m.geminiUrl)!==null&&f!==void 0?f:a}return i.baseUrl}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class hn{}function Y(i,t){const l=/\{([^}]+)\}/g;return i.replace(l,(a,r)=>{if(Object.prototype.hasOwnProperty.call(t,r)){const f=t[r];return f!=null?String(f):""}else throw new Error(`Key '${r}' not found in valueMap.`)})}function c(i,t,l){for(let f=0;f({}));else throw new Error(`Value must be a list given an array path ${m}`);if(Array.isArray(i[g])){const y=i[g];if(Array.isArray(l))for(let h=0;hu(g,t.slice(a+1),l)):l}else return l}else i=i[r]}return i}catch(a){if(a instanceof TypeError)return l;throw a}}function F0(i,t){for(const[l,a]of Object.entries(t)){const r=l.split("."),f=a.split("."),m=new Set;let g=-1;for(let y=0;yg)for(let y=g;y=t.length||typeof i!="object"||i===null)return;const f=t[a];if(f.endsWith("[]")){const m=f.slice(0,-2),g=i;if(m in g&&Array.isArray(g[m]))for(const y of g[m])gu(y,t,l,a+1,r)}else if(f==="*"){if(typeof i=="object"&&i!==null&&!Array.isArray(i)){const m=i,g=Object.keys(m).filter(h=>!h.startsWith("_")&&!r.has(h)),y={};for(const h of g)y[h]=m[h];for(const[h,v]of Object.entries(y)){const S=[];for(const E of l.slice(a))E==="*"?S.push(h):S.push(E);c(m,S,v)}for(const h of g)delete m[h]}}else{const m=i;f in m&&gu(m[f],t,l,a+1,r)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Uu(i){if(typeof i!="string")throw new Error("fromImageBytes must be a string");return i}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function J0(i){const t={},l=u(i,["operationName"]);l!=null&&c(t,["operationName"],l);const a=u(i,["resourceName"]);return a!=null&&c(t,["_url","resourceName"],a),t}function Y0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response","generateVideoResponse"]);return m!=null&&c(t,["response"],K0(m)),t}function X0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],Q0(m)),t}function K0(i){const t={},l=u(i,["generatedSamples"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>Z0(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function Q0(i){const t={},l=u(i,["videos"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>$0(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function Z0(i){const t={},l=u(i,["video"]);return l!=null&&c(t,["video"],iT(l)),t}function $0(i){const t={},l=u(i,["_self"]);return l!=null&&c(t,["video"],oT(l)),t}function W0(i){const t={},l=u(i,["operationName"]);return l!=null&&c(t,["_url","operationName"],l),t}function j0(i){const t={},l=u(i,["operationName"]);return l!=null&&c(t,["_url","operationName"],l),t}function eT(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],tT(m)),t}function tT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function Vh(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],nT(m)),t}function nT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function iT(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],Uu(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function oT(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["uri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],Uu(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var tm;(function(i){i.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",i.OUTCOME_OK="OUTCOME_OK",i.OUTCOME_FAILED="OUTCOME_FAILED",i.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(tm||(tm={}));var nm;(function(i){i.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",i.PYTHON="PYTHON"})(nm||(nm={}));var im;(function(i){i.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",i.SILENT="SILENT",i.WHEN_IDLE="WHEN_IDLE",i.INTERRUPT="INTERRUPT"})(im||(im={}));var kn;(function(i){i.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",i.STRING="STRING",i.NUMBER="NUMBER",i.INTEGER="INTEGER",i.BOOLEAN="BOOLEAN",i.ARRAY="ARRAY",i.OBJECT="OBJECT",i.NULL="NULL"})(kn||(kn={}));var om;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(om||(om={}));var lm;(function(i){i.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",i.SIMPLE_SEARCH="SIMPLE_SEARCH",i.ELASTIC_SEARCH="ELASTIC_SEARCH"})(lm||(lm={}));var am;(function(i){i.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",i.NO_AUTH="NO_AUTH",i.API_KEY_AUTH="API_KEY_AUTH",i.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",i.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",i.OAUTH="OAUTH",i.OIDC_AUTH="OIDC_AUTH"})(am||(am={}));var sm;(function(i){i.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",i.HTTP_IN_QUERY="HTTP_IN_QUERY",i.HTTP_IN_HEADER="HTTP_IN_HEADER",i.HTTP_IN_PATH="HTTP_IN_PATH",i.HTTP_IN_BODY="HTTP_IN_BODY",i.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(sm||(sm={}));var rm;(function(i){i.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",i.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",i.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",i.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(rm||(rm={}));var um;(function(i){i.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH",i.MINIMAL="MINIMAL"})(um||(um={}));var cm;(function(i){i.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",i.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",i.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",i.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",i.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",i.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",i.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",i.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",i.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(cm||(cm={}));var fm;(function(i){i.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",i.SEVERITY="SEVERITY",i.PROBABILITY="PROBABILITY"})(fm||(fm={}));var dm;(function(i){i.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE",i.OFF="OFF"})(dm||(dm={}));var pm;(function(i){i.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",i.STOP="STOP",i.MAX_TOKENS="MAX_TOKENS",i.SAFETY="SAFETY",i.RECITATION="RECITATION",i.LANGUAGE="LANGUAGE",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.SPII="SPII",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.IMAGE_SAFETY="IMAGE_SAFETY",i.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",i.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",i.NO_IMAGE="NO_IMAGE",i.IMAGE_RECITATION="IMAGE_RECITATION",i.IMAGE_OTHER="IMAGE_OTHER"})(pm||(pm={}));var mm;(function(i){i.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",i.NEGLIGIBLE="NEGLIGIBLE",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH"})(mm||(mm={}));var hm;(function(i){i.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",i.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",i.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",i.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",i.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(hm||(hm={}));var gm;(function(i){i.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",i.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",i.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",i.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",i.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(gm||(gm={}));var ym;(function(i){i.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",i.SAFETY="SAFETY",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.IMAGE_SAFETY="IMAGE_SAFETY",i.MODEL_ARMOR="MODEL_ARMOR",i.JAILBREAK="JAILBREAK"})(ym||(ym={}));var vm;(function(i){i.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",i.ON_DEMAND="ON_DEMAND",i.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(vm||(vm={}));var Ia;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.AUDIO="AUDIO"})(Ia||(Ia={}));var Tm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(Tm||(Tm={}));var Sm;(function(i){i.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",i.TUNING_MODE_FULL="TUNING_MODE_FULL",i.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(Sm||(Sm={}));var Em;(function(i){i.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",i.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",i.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",i.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",i.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",i.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",i.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(Em||(Em={}));var yu;(function(i){i.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",i.JOB_STATE_QUEUED="JOB_STATE_QUEUED",i.JOB_STATE_PENDING="JOB_STATE_PENDING",i.JOB_STATE_RUNNING="JOB_STATE_RUNNING",i.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",i.JOB_STATE_FAILED="JOB_STATE_FAILED",i.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",i.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",i.JOB_STATE_PAUSED="JOB_STATE_PAUSED",i.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",i.JOB_STATE_UPDATING="JOB_STATE_UPDATING",i.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(yu||(yu={}));var _m;(function(i){i.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",i.TUNING_TASK_I2V="TUNING_TASK_I2V",i.TUNING_TASK_T2V="TUNING_TASK_T2V",i.TUNING_TASK_R2V="TUNING_TASK_R2V"})(_m||(_m={}));var Cm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",i.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(Cm||(Cm={}));var Am;(function(i){i.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",i.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",i.BALANCED="BALANCED",i.PRIORITIZE_COST="PRIORITIZE_COST"})(Am||(Am={}));var Rm;(function(i){i.UNSPECIFIED="UNSPECIFIED",i.BLOCKING="BLOCKING",i.NON_BLOCKING="NON_BLOCKING"})(Rm||(Rm={}));var Mm;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(Mm||(Mm={}));var Nm;(function(i){i.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",i.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(Nm||(Nm={}));var Im;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.AUTO="AUTO",i.ANY="ANY",i.NONE="NONE",i.VALIDATED="VALIDATED"})(Im||(Im={}));var xm;(function(i){i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE"})(xm||(xm={}));var Dm;(function(i){i.DONT_ALLOW="DONT_ALLOW",i.ALLOW_ADULT="ALLOW_ADULT",i.ALLOW_ALL="ALLOW_ALL"})(Dm||(Dm={}));var Um;(function(i){i.auto="auto",i.en="en",i.ja="ja",i.ko="ko",i.hi="hi",i.zh="zh",i.pt="pt",i.es="es"})(Um||(Um={}));var wm;(function(i){i.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",i.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",i.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",i.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",i.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(wm||(wm={}));var bm;(function(i){i.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",i.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",i.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",i.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(bm||(bm={}));var Lm;(function(i){i.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",i.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",i.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",i.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Lm||(Lm={}));var Gm;(function(i){i.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",i.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",i.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",i.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",i.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",i.EDIT_MODE_STYLE="EDIT_MODE_STYLE",i.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",i.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(Gm||(Gm={}));var Hm;(function(i){i.FOREGROUND="FOREGROUND",i.BACKGROUND="BACKGROUND",i.PROMPT="PROMPT",i.SEMANTIC="SEMANTIC",i.INTERACTIVE="INTERACTIVE"})(Hm||(Hm={}));var qm;(function(i){i.ASSET="ASSET",i.STYLE="STYLE"})(qm||(qm={}));var Vm;(function(i){i.INSERT="INSERT",i.REMOVE="REMOVE",i.REMOVE_STATIC="REMOVE_STATIC",i.OUTPAINT="OUTPAINT"})(Vm||(Vm={}));var zm;(function(i){i.OPTIMIZED="OPTIMIZED",i.LOSSLESS="LOSSLESS"})(zm||(zm={}));var Bm;(function(i){i.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",i.PREFERENCE_TUNING="PREFERENCE_TUNING"})(Bm||(Bm={}));var Pm;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.STATE_PENDING="STATE_PENDING",i.STATE_ACTIVE="STATE_ACTIVE",i.STATE_FAILED="STATE_FAILED"})(Pm||(Pm={}));var km;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.PROCESSING="PROCESSING",i.ACTIVE="ACTIVE",i.FAILED="FAILED"})(km||(km={}));var Om;(function(i){i.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",i.UPLOADED="UPLOADED",i.GENERATED="GENERATED"})(Om||(Om={}));var Fm;(function(i){i.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.RESPONSE_REJECTED="RESPONSE_REJECTED",i.NEED_MORE_INPUT="NEED_MORE_INPUT"})(Fm||(Fm={}));var Jm;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.VIDEO="VIDEO",i.AUDIO="AUDIO",i.DOCUMENT="DOCUMENT"})(Jm||(Jm={}));var Ym;(function(i){i.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",i.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",i.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(Ym||(Ym={}));var Xm;(function(i){i.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",i.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",i.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Xm||(Xm={}));var Km;(function(i){i.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",i.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",i.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Km||(Km={}));var Qm;(function(i){i.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",i.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",i.NO_INTERRUPTION="NO_INTERRUPTION"})(Qm||(Qm={}));var Zm;(function(i){i.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",i.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",i.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(Zm||(Zm={}));var $m;(function(i){i.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",i.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",i.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",i.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",i.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",i.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",i.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",i.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",i.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",i.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",i.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",i.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",i.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})($m||($m={}));var Wm;(function(i){i.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",i.QUALITY="QUALITY",i.DIVERSITY="DIVERSITY",i.VOCALIZATION="VOCALIZATION"})(Wm||(Wm={}));var Zi;(function(i){i.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",i.PLAY="PLAY",i.PAUSE="PAUSE",i.STOP="STOP",i.RESET_CONTEXT="RESET_CONTEXT"})(Zi||(Zi={}));class vu{constructor(t){const l={};for(const a of t.headers.entries())l[a[0]]=a[1];this.headers=l,this.responseInternal=t}json(){return this.responseInternal.json()}}class jo{get text(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 h="",v=!1;const S=[];for(const E of(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[C,U]of Object.entries(E))C!=="text"&&C!=="thought"&&C!=="thoughtSignature"&&(U!==null||U!==void 0)&&S.push(C);if(typeof E.text=="string"){if(typeof E.thought=="boolean"&&E.thought)continue;v=!0,h+=E.text}}return S.length>0&&console.warn(`there are non-text parts ${S} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),v?h:void 0}get data(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 h="";const v=[];for(const S of(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[E,C]of Object.entries(S))E!=="inlineData"&&(C!==null||C!==void 0)&&v.push(E);S.inlineData&&typeof S.inlineData.data=="string"&&(h+=atob(S.inlineData.data))}return v.length>0&&console.warn(`there are non-data parts ${v} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),h.length>0?btoa(h):void 0}get functionCalls(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const h=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(v=>v.functionCall).map(v=>v.functionCall).filter(v=>v!==void 0);if((h==null?void 0:h.length)!==0)return h}get executableCode(){var t,l,a,r,f,m,g,y,h;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const v=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(S=>S.executableCode).map(S=>S.executableCode).filter(S=>S!==void 0);if((v==null?void 0:v.length)!==0)return(h=v==null?void 0:v[0])===null||h===void 0?void 0:h.code}get codeExecutionResult(){var t,l,a,r,f,m,g,y,h;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const v=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(S=>S.codeExecutionResult).map(S=>S.codeExecutionResult).filter(S=>S!==void 0);if((v==null?void 0:v.length)!==0)return(h=v==null?void 0:v[0])===null||h===void 0?void 0:h.output}}class jm{}class eh{}class lT{}class aT{}class sT{}class rT{}class th{}class nh{}class ih{}class uT{}class xa{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new xa;let r;const f=t;return l?r=X0(f):r=Y0(f),Object.assign(a,r),a}}class oh{}class lh{}class ah{}class sh{}class cT{}class fT{}class dT{}class wu{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new wu,f=eT(t);return Object.assign(a,f),a}}class pT{}class mT{}class hT{}class rh{}class gT{get text(){var t,l,a;let r="",f=!1;const m=[];for(const g of(a=(l=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[y,h]of Object.entries(g))y!=="text"&&y!=="thought"&&h!==null&&m.push(y);if(typeof g.text=="string"){if(typeof g.thought=="boolean"&&g.thought)continue;f=!0,r+=g.text}}return m.length>0&&console.warn(`there are non-text parts ${m} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),f?r:void 0}get data(){var t,l,a;let r="";const f=[];for(const m of(a=(l=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[g,y]of Object.entries(m))g!=="inlineData"&&y!==null&&f.push(g);m.inlineData&&typeof m.inlineData.data=="string"&&(r+=atob(m.inlineData.data))}return f.length>0&&console.warn(`there are non-data parts ${f} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),r.length>0?btoa(r):void 0}}class yT{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class bu{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new bu,f=Vh(t);return Object.assign(a,f),a}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Te(i,t){if(!t||typeof t!="string")throw new Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw new Error("invalid model parameter");if(i.isVertexAI()){if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;if(t.indexOf("/")>=0){const l=t.split("/",2);return`publishers/${l[0]}/models/${l[1]}`}else return`publishers/google/models/${t}`}else return t.startsWith("models/")||t.startsWith("tunedModels/")?t:`models/${t}`}function zh(i,t){const l=Te(i,t);return l?l.startsWith("publishers/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/${l}`:l.startsWith("models/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/publishers/google/${l}`:l:""}function Bh(i){return Array.isArray(i)?i.map(t=>Da(t)):[Da(i)]}function Da(i){if(typeof i=="object"&&i!==null)return i;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof i}`)}function Ph(i){const t=Da(i);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function kh(i){const t=Da(i);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function uh(i){if(i==null)throw new Error("PartUnion is required");if(typeof i=="object")return i;if(typeof i=="string")return{text:i};throw new Error(`Unsupported part type: ${typeof i}`)}function Oh(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("PartListUnion is required");return Array.isArray(i)?i.map(t=>uh(t)):[uh(i)]}function Tu(i){return i!=null&&typeof i=="object"&&"parts"in i&&Array.isArray(i.parts)}function ch(i){return i!=null&&typeof i=="object"&&"functionCall"in i}function fh(i){return i!=null&&typeof i=="object"&&"functionResponse"in i}function it(i){if(i==null)throw new Error("ContentUnion is required");return Tu(i)?i:{role:"user",parts:Oh(i)}}function Lu(i,t){if(!t)return[];if(i.isVertexAI()&&Array.isArray(t))return t.flatMap(l=>{const a=it(l);return a.parts&&a.parts.length>0&&a.parts[0].text!==void 0?[a.parts[0].text]:[]});if(i.isVertexAI()){const l=it(t);return l.parts&&l.parts.length>0&&l.parts[0].text!==void 0?[l.parts[0].text]:[]}return Array.isArray(t)?t.map(l=>it(l)):[it(t)]}function Ht(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("contents are required");if(!Array.isArray(i)){if(ch(i)||fh(i))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[it(i)]}const t=[],l=[],a=Tu(i[0]);for(const r of i){const f=Tu(r);if(f!=a)throw new Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(f)t.push(r);else{if(ch(r)||fh(r))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");l.push(r)}}return a||t.push({role:"user",parts:Oh(l)}),t}function vT(i,t){i.includes("null")&&(t.nullable=!0);const l=i.filter(a=>a!=="null");if(l.length===1)t.type=Object.values(kn).includes(l[0].toUpperCase())?l[0].toUpperCase():kn.TYPE_UNSPECIFIED;else{t.anyOf=[];for(const a of l)t.anyOf.push({type:Object.values(kn).includes(a.toUpperCase())?a.toUpperCase():kn.TYPE_UNSPECIFIED})}}function Wi(i){const t={},l=["items"],a=["anyOf"],r=["properties"];if(i.type&&i.anyOf)throw new Error("type and anyOf cannot be both populated.");const f=i.anyOf;f!=null&&f.length==2&&(f[0].type==="null"?(t.nullable=!0,i=f[1]):f[1].type==="null"&&(t.nullable=!0,i=f[0])),i.type instanceof Array&&vT(i.type,t);for(const[m,g]of Object.entries(i))if(g!=null)if(m=="type"){if(g==="null")throw new Error("type: null can not be the only possible type for the field.");if(g instanceof Array)continue;t.type=Object.values(kn).includes(g.toUpperCase())?g.toUpperCase():kn.TYPE_UNSPECIFIED}else if(l.includes(m))t[m]=Wi(g);else if(a.includes(m)){const y=[];for(const h of g){if(h.type=="null"){t.nullable=!0;continue}y.push(Wi(h))}t[m]=y}else if(r.includes(m)){const y={};for(const[h,v]of Object.entries(g))y[h]=Wi(v);t[m]=y}else{if(m==="additionalProperties")continue;t[m]=g}return t}function Gu(i){return Wi(i)}function Hu(i){if(typeof i=="object")return i;if(typeof i=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:i}}};throw new Error(`Unsupported speechConfig type: ${typeof i}`)}function qu(i){if("multiSpeakerVoiceConfig"in i)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return i}function eo(i){if(i.functionDeclarations)for(const t of i.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes("$schema")?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=Wi(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=Wi(t.response));return i}function to(i){if(i==null)throw new Error("tools is required");if(!Array.isArray(i))throw new Error("tools is required and must be an array of Tools");const t=[];for(const l of i)t.push(l);return t}function TT(i,t,l,a=1){const r=!t.startsWith(`${l}/`)&&t.split("/").length===a;return i.isVertexAI()?t.startsWith("projects/")?t:t.startsWith("locations/")?`projects/${i.getProject()}/${t}`:t.startsWith(`${l}/`)?`projects/${i.getProject()}/locations/${i.getLocation()}/${t}`:r?`projects/${i.getProject()}/locations/${i.getLocation()}/${l}/${t}`:t:r?`${l}/${t}`:t}function gn(i,t){if(typeof t!="string")throw new Error("name must be a string");return TT(i,t,"cachedContents")}function Fh(i){switch(i){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 i}}function On(i){return Uu(i)}function ST(i){return i!=null&&typeof i=="object"&&"name"in i}function ET(i){return i!=null&&typeof i=="object"&&"video"in i}function _T(i){return i!=null&&typeof i=="object"&&"uri"in i}function Jh(i){var t;let l;if(ST(i)&&(l=i.name),!(_T(i)&&(l=i.uri,l===void 0))&&!(ET(i)&&(l=(t=i.video)===null||t===void 0?void 0:t.uri,l===void 0))){if(typeof i=="string"&&(l=i),l===void 0)throw new Error("Could not extract file name from the provided input.");if(l.startsWith("https://")){const r=l.split("files/")[1].match(/[a-z0-9]+/);if(r===null)throw new Error(`Could not extract file name from URI ${l}`);l=r[0]}else l.startsWith("files/")&&(l=l.split("files/")[1]);return l}}function Yh(i,t){let l;return i.isVertexAI()?l=t?"publishers/google/models":"models":l=t?"models":"tunedModels",l}function Xh(i){for(const t of["models","tunedModels","publisherModels"])if(CT(i,t))return i[t];return[]}function CT(i,t){return i!==null&&typeof i=="object"&&t in i}function AT(i,t={}){const l=i,a={name:l.name,description:l.description,parametersJsonSchema:l.inputSchema};return l.outputSchema&&(a.responseJsonSchema=l.outputSchema),t.behavior&&(a.behavior=t.behavior),{functionDeclarations:[a]}}function RT(i,t={}){const l=[],a=new Set;for(const r of i){const f=r.name;if(a.has(f))throw new Error(`Duplicate function name ${f} found in MCP tools. Please ensure function names are unique.`);a.add(f);const m=AT(r,t);m.functionDeclarations&&l.push(...m.functionDeclarations)}return{functionDeclarations:l}}function Kh(i,t){let l;if(typeof t=="string")if(i.isVertexAI())if(t.startsWith("gs://"))l={format:"jsonl",gcsUri:[t]};else if(t.startsWith("bq://"))l={format:"bigquery",bigqueryUri:t};else throw new Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))l={fileName:t};else throw new Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(i.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");l={inlinedRequests:t}}else l=t;const a=[l.gcsUri,l.bigqueryUri].filter(Boolean).length,r=[l.inlinedRequests,l.fileName].filter(Boolean).length;if(i.isVertexAI()){if(r>0||a!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(a>0||r!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return l}function MT(i){if(typeof i!="string")return i;const t=i;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};throw new Error(`Unsupported destination: ${t}`)}function Qh(i){if(typeof i!="object"||i===null)return{};const t=i,l=t.inlinedResponses;if(typeof l!="object"||l===null)return i;const r=l.inlinedResponses;if(!Array.isArray(r)||r.length===0)return i;let f=!1;for(const m of r){if(typeof m!="object"||m===null)continue;const y=m.response;if(typeof y!="object"||y===null)continue;if(y.embedding!==void 0){f=!0;break}}return f&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),i}function no(i,t){const l=t;if(!i.isVertexAI()){if(/batches\/[^/]+$/.test(l))return l.split("/").pop();throw new Error(`Invalid batch job name: ${l}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(l))return l.split("/").pop();if(/^\d+$/.test(l))return l;throw new Error(`Invalid batch job name: ${l}.`)}function Zh(i){const t=i;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}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function NT(i){const t={},l=u(i,["responsesFile"]);l!=null&&c(t,["fileName"],l);const a=u(i,["inlinedResponses","inlinedResponses"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>sS(m))),c(t,["inlinedResponses"],f)}const r=u(i,["inlinedEmbedContentResponses","inlinedResponses"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["inlinedEmbedContentResponses"],f)}return t}function IT(i){const t={},l=u(i,["predictionsFormat"]);l!=null&&c(t,["format"],l);const a=u(i,["gcsDestination","outputUriPrefix"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigqueryDestination","outputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function xT(i){const t={},l=u(i,["format"]);l!=null&&c(t,["predictionsFormat"],l);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsDestination","outputUriPrefix"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigqueryDestination","outputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(u(i,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return t}function Ma(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata","displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["metadata","state"]);r!=null&&c(t,["state"],Zh(r));const f=u(i,["metadata","createTime"]);f!=null&&c(t,["createTime"],f);const m=u(i,["metadata","endTime"]);m!=null&&c(t,["endTime"],m);const g=u(i,["metadata","updateTime"]);g!=null&&c(t,["updateTime"],g);const y=u(i,["metadata","model"]);y!=null&&c(t,["model"],y);const h=u(i,["metadata","output"]);return h!=null&&c(t,["dest"],NT(Qh(h))),t}function Su(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["state"]);r!=null&&c(t,["state"],Zh(r));const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["createTime"]);m!=null&&c(t,["createTime"],m);const g=u(i,["startTime"]);g!=null&&c(t,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(t,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(t,["updateTime"],h);const v=u(i,["model"]);v!=null&&c(t,["model"],v);const S=u(i,["inputConfig"]);S!=null&&c(t,["src"],DT(S));const E=u(i,["outputConfig"]);E!=null&&c(t,["dest"],IT(Qh(E)));const C=u(i,["completionStats"]);return C!=null&&c(t,["completionStats"],C),t}function DT(i){const t={},l=u(i,["instancesFormat"]);l!=null&&c(t,["format"],l);const a=u(i,["gcsSource","uris"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigquerySource","inputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function UT(i,t){const l={};if(u(t,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(u(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const a=u(t,["fileName"]);a!=null&&c(l,["fileName"],a);const r=u(t,["inlinedRequests"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>aS(i,m))),c(l,["requests","requests"],f)}return l}function wT(i){const t={},l=u(i,["format"]);l!=null&&c(t,["instancesFormat"],l);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsSource","uris"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigquerySource","inputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return t}function bT(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function LT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function GT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function HT(i){const t={},l=u(i,["content"]);l!=null&&c(t,["content"],l);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],qT(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const m=u(i,["avgLogprobs"]);m!=null&&c(t,["avgLogprobs"],m);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const h=u(i,["logprobsResult"]);h!=null&&c(t,["logprobsResult"],h);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(C=>C)),c(t,["safetyRatings"],E)}const S=u(i,["urlContextMetadata"]);return S!=null&&c(t,["urlContextMetadata"],S),t}function qT(i){const t={},l=u(i,["citationSources"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function $h(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>mS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function VT(i,t){const l={},a=u(i,["displayName"]);if(t!==void 0&&a!=null&&c(t,["batch","displayName"],a),u(i,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return l}function zT(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["dest"]);return t!==void 0&&r!=null&&c(t,["outputConfig"],xT(MT(r))),l}function dh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["batch","inputConfig"],UT(i,Kh(i,r)));const f=u(t,["config"]);return f!=null&&VT(f,l),l}function BT(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["inputConfig"],wT(Kh(i,r)));const f=u(t,["config"]);return f!=null&&zT(f,l),l}function PT(i,t){const l={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["batch","displayName"],a),l}function kT(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["batch","inputConfig"],QT(i,r));const f=u(t,["config"]);return f!=null&&PT(f,l),l}function OT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function FT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function JT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function YT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function XT(i,t){const l={},a=u(t,["contents"]);if(a!=null){let f=Lu(i,a);Array.isArray(f)&&(f=f.map(m=>m)),c(l,["requests[]","request","content"],f)}const r=u(t,["config"]);return r!=null&&(c(l,["_self"],KT(r,l)),F0(l,{"requests[].*":"requests[].request.*"})),l}function KT(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return l}function QT(i,t){const l={},a=u(t,["fileName"]);a!=null&&c(l,["file_name"],a);const r=u(t,["inlinedRequests"]);return r!=null&&c(l,["requests"],XT(i,r)),l}function ZT(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function $T(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function WT(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function jT(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],$h(it(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const U=u(t,["frequencyPenalty"]);U!=null&&c(a,["frequencyPenalty"],U);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);if(X!=null&&c(a,["responseJsonSchema"],X),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const k=u(t,["safetySettings"]);if(l!==void 0&&k!=null){let Ee=k;Array.isArray(Ee)&&(Ee=Ee.map(Pe=>hS(Pe))),c(l,["safetySettings"],Ee)}const K=u(t,["tools"]);if(l!==void 0&&K!=null){let Ee=to(K);Array.isArray(Ee)&&(Ee=Ee.map(Pe=>yS(eo(Pe)))),c(l,["tools"],Ee)}const ee=u(t,["toolConfig"]);if(l!==void 0&&ee!=null&&c(l,["toolConfig"],gS(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const te=u(t,["cachedContent"]);l!==void 0&&te!=null&&c(l,["cachedContent"],gn(i,te));const F=u(t,["responseModalities"]);F!=null&&c(a,["responseModalities"],F);const he=u(t,["mediaResolution"]);he!=null&&c(a,["mediaResolution"],he);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],Hu(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const Ce=u(t,["imageConfig"]);Ce!=null&&c(a,["imageConfig"],lS(Ce));const Ge=u(t,["enableEnhancedCivicAnswers"]);return Ge!=null&&c(a,["enableEnhancedCivicAnswers"],Ge),a}function eS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(h=>HT(h))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const m=u(i,["responseId"]);m!=null&&c(t,["responseId"],m);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function tS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function nS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function iS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function oS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function lS(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function aS(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["request","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let g=Ht(r);Array.isArray(g)&&(g=g.map(y=>$h(y))),c(l,["request","contents"],g)}const f=u(t,["metadata"]);f!=null&&c(l,["metadata"],f);const m=u(t,["config"]);return m!=null&&c(l,["request","generationConfig"],jT(i,m,u(l,["request"],{}))),l}function sS(i){const t={},l=u(i,["response"]);l!=null&&c(t,["response"],eS(l));const a=u(i,["error"]);return a!=null&&c(t,["error"],a),t}function rS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);if(t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),u(i,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return l}function uS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);t!==void 0&&r!=null&&c(t,["_query","pageToken"],r);const f=u(i,["filter"]);return t!==void 0&&f!=null&&c(t,["_query","filter"],f),l}function cS(i){const t={},l=u(i,["config"]);return l!=null&&rS(l,t),t}function fS(i){const t={},l=u(i,["config"]);return l!=null&&uS(l,t),t}function dS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["operations"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>Ma(m))),c(t,["batchJobs"],f)}return t}function pS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["batchPredictionJobs"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>Su(m))),c(t,["batchJobs"],f)}return t}function mS(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],ZT(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],$T(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],bT(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function hS(i){const t={},l=u(i,["category"]);if(l!=null&&c(t,["category"],l),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function gS(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],WT(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function yS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],iS(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],oS(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var mn;(function(i){i.PAGED_ITEM_BATCH_JOBS="batchJobs",i.PAGED_ITEM_MODELS="models",i.PAGED_ITEM_TUNING_JOBS="tuningJobs",i.PAGED_ITEM_FILES="files",i.PAGED_ITEM_CACHED_CONTENTS="cachedContents",i.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",i.PAGED_ITEM_DOCUMENTS="documents"})(mn||(mn={}));class ci{constructor(t,l,a,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=l,this.init(t,a,r)}init(t,l,a){var r,f;this.nameInternal=t,this.pageInternal=l[this.nameInternal]||[],this.sdkHttpResponseInternal=l==null?void 0:l.sdkHttpResponse,this.idxInternal=0;let m={config:{}};!a||Object.keys(a).length===0?m={config:{}}:typeof a=="object"?m=Object.assign({},a):m=a,m.config&&(m.config.pageToken=l.nextPageToken),this.paramsInternal=m,this.pageInternalSize=(f=(r=m.config)===null||r===void 0?void 0:r.pageSize)!==null&&f!==void 0?f:this.pageInternal.length}initNextPage(t){this.init(this.nameInternal,t,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(t){return this.pageInternal[t]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const t=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:t,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const t=await this.requestInternal(this.params);return this.initNextPage(t),this.page}hasNextPage(){var t;return((t=this.params.config)===null||t===void 0?void 0:t.pageToken)!==void 0}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class vS extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_BATCH_JOBS,a=>this.listInternal(a),await this.listInternal(l),l),this.create=async l=>(this.apiClient.isVertexAI()&&(l.config=this.formatDestination(l.src,l.config)),this.createInternal(l)),this.createEmbeddings=async l=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(l)}}createInlinedGenerateContentRequest(t){const l=dh(this.apiClient,t),a=l._url,r=Y("{model}:batchGenerateContent",a),g=l.batch.inputConfig.requests,y=g.requests,h=[];for(const v of y){const S=Object.assign({},v);if(S.systemInstruction){const E=S.systemInstruction;delete S.systemInstruction;const C=S.request;C.systemInstruction=E,S.request=C}h.push(S)}return g.requests=h,delete l.config,delete l._url,delete l._query,{path:r,body:l}}getGcsUri(t){if(typeof t=="string")return t.startsWith("gs://")?t:void 0;if(!Array.isArray(t)&&t.gcsUri&&t.gcsUri.length>0)return t.gcsUri[0]}getBigqueryUri(t){if(typeof t=="string")return t.startsWith("bq://")?t:void 0;if(!Array.isArray(t))return t.bigqueryUri}formatDestination(t,l){const a=l?Object.assign({},l):{},r=Date.now().toString();if(a.displayName||(a.displayName=`genaiBatchJob_${r}`),a.dest===void 0){const f=this.getGcsUri(t),m=this.getBigqueryUri(t);if(f)f.endsWith(".jsonl")?a.dest=`${f.slice(0,-6)}/dest`:a.dest=`${f}_dest_${r}`;else if(m)a.dest=`${m}_dest_${r}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return a}async createInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=BT(this.apiClient,t);return g=Y("batchPredictionJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>Su(v))}else{const h=dh(this.apiClient,t);return g=Y("{model}:batchGenerateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Ma(v))}}async createEmbeddingsInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=kT(this.apiClient,t);return f=Y("{model}:asyncBatchEmbedContent",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>Ma(y))}}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=nS(this.apiClient,t);return g=Y("batchPredictionJobs/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>Su(v))}else{const h=tS(this.apiClient,t);return g=Y("batches/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Ma(v))}}async cancel(t){var l,a,r,f;let m="",g={};if(this.apiClient.isVertexAI()){const y=GT(this.apiClient,t);m=Y("batchPredictionJobs/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:m,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}else{const y=LT(this.apiClient,t);m=Y("batches/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:m,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal})}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=fS(t);return g=Y("batchPredictionJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=pS(v),E=new rh;return Object.assign(E,S),E})}else{const h=cS(t);return g=Y("batches",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=dS(v),E=new rh;return Object.assign(E,S),E})}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=FT(this.apiClient,t);return g=Y("batchPredictionJobs/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>YT(v))}else{const h=OT(this.apiClient,t);return g=Y("batches/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>JT(v))}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function TS(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function ph(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>kS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function SS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const m=u(i,["contents"]);if(t!==void 0&&m!=null){let v=Ht(m);Array.isArray(v)&&(v=v.map(S=>ph(S))),c(t,["contents"],v)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],ph(it(g)));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let v=y;Array.isArray(v)&&(v=v.map(S=>FS(S))),c(t,["tools"],v)}const h=u(i,["toolConfig"]);if(t!==void 0&&h!=null&&c(t,["toolConfig"],OS(h)),u(i,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return l}function ES(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const m=u(i,["contents"]);if(t!==void 0&&m!=null){let S=Ht(m);Array.isArray(S)&&(S=S.map(E=>E)),c(t,["contents"],S)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],it(g));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let S=y;Array.isArray(S)&&(S=S.map(E=>JS(E))),c(t,["tools"],S)}const h=u(i,["toolConfig"]);t!==void 0&&h!=null&&c(t,["toolConfig"],h);const v=u(i,["kmsKeyName"]);return t!==void 0&&v!=null&&c(t,["encryption_spec","kmsKeyName"],v),l}function _S(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],zh(i,a));const r=u(t,["config"]);return r!=null&&SS(r,l),l}function CS(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],zh(i,a));const r=u(t,["config"]);return r!=null&&ES(r,l),l}function AS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function RS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function MS(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function NS(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function IS(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function xS(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function DS(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function US(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function wS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function bS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function LS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function GS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function HS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function qS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function VS(i){const t={},l=u(i,["config"]);return l!=null&&HS(l,t),t}function zS(i){const t={},l=u(i,["config"]);return l!=null&&qS(l,t),t}function BS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["cachedContents"],f)}return t}function PS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["cachedContents"],f)}return t}function kS(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],IS(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],xS(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],TS(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function OS(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],DS(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function FS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],LS(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],GS(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function JS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>US(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function YS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),l}function XS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),l}function KS(i,t){const l={},a=u(t,["name"]);a!=null&&c(l,["_url","name"],gn(i,a));const r=u(t,["config"]);return r!=null&&YS(r,l),l}function QS(i,t){const l={},a=u(t,["name"]);a!=null&&c(l,["_url","name"],gn(i,a));const r=u(t,["config"]);return r!=null&&XS(r,l),l}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class ZS extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_CACHED_CONTENTS,a=>this.listInternal(a),await this.listInternal(l),l)}async create(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=CS(this.apiClient,t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=_S(this.apiClient,t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=bS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=wS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=RS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=NS(v),E=new ah;return Object.assign(E,S),E})}else{const h=AS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=MS(v),E=new ah;return Object.assign(E,S),E})}}async update(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=QS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=KS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=zS(t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=PS(v),E=new sh;return Object.assign(E,S),E})}else{const h=VS(t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=BS(v),E=new sh;return Object.assign(E,S),E})}}}function Ua(i,t){var l={};for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&t.indexOf(a)<0&&(l[a]=i[a]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(i);r=i.length&&(i=void 0),{value:i&&i[a++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function oe(i){return this instanceof oe?(this.v=i,this):new oe(i)}function Pt(i,t,l){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=l.apply(i,t||[]),r,f=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),g("next"),g("throw"),g("return",m),r[Symbol.asyncIterator]=function(){return this},r;function m(C){return function(U){return Promise.resolve(U).then(C,S)}}function g(C,U){a[C]&&(r[C]=function(H){return new Promise(function(b,P){f.push([C,H,b,P])>1||y(C,H)})},U&&(r[C]=U(r[C])))}function y(C,U){try{h(a[C](U))}catch(H){E(f[0][3],H)}}function h(C){C.value instanceof oe?Promise.resolve(C.value.v).then(v,S):E(f[0][2],C)}function v(C){y("next",C)}function S(C){y("throw",C)}function E(C,U){C(U),f.shift(),f.length&&y(f[0][0],f[0][1])}}function kt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],l;return t?t.call(i):(i=typeof mh=="function"?mh(i):i[Symbol.iterator](),l={},a("next"),a("throw"),a("return"),l[Symbol.asyncIterator]=function(){return this},l);function a(f){l[f]=i[f]&&function(m){return new Promise(function(g,y){m=i[f](m),r(g,y,m.done,m.value)})}}function r(f,m,g,y){Promise.resolve(y).then(function(h){f({value:h,done:g})},m)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function $S(i){var t;if(i.candidates==null||i.candidates.length===0)return!1;const l=(t=i.candidates[0])===null||t===void 0?void 0:t.content;return l===void 0?!1:Wh(l)}function Wh(i){if(i.parts===void 0||i.parts.length===0)return!1;for(const t of i.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function WS(i){if(i.length!==0){for(const t of i)if(t.role!=="user"&&t.role!=="model")throw new Error(`Role must be user or model, but got ${t.role}.`)}}function hh(i){if(i===void 0||i.length===0)return[];const t=[],l=i.length;let a=0;for(;a{var f,m,g;const y=await r,h=(m=(f=y.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content,v=y.automaticFunctionCallingHistory,S=this.getHistory(!0).length;let E=[];v!=null&&(E=(g=v.slice(S))!==null&&g!==void 0?g:[]);const C=h?[h]:[];this.recordHistory(a,C,E)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),r}async sendMessageStream(t){var l;await this.sendPromise;const a=it(t.message),r=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(a),config:(l=t.config)!==null&&l!==void 0?l:this.config});this.sendPromise=r.then(()=>{}).catch(()=>{});const f=await r;return this.processStreamResponse(f,a)}getHistory(t=!1){const l=t?hh(this.history):this.history;return structuredClone(l)}processStreamResponse(t,l){return Pt(this,arguments,function*(){var r,f,m,g,y,h;const v=[];try{for(var S=!0,E=kt(t),C;C=yield oe(E.next()),r=C.done,!r;S=!0){g=C.value,S=!1;const U=g;if($S(U)){const H=(h=(y=U.candidates)===null||y===void 0?void 0:y[0])===null||h===void 0?void 0:h.content;H!==void 0&&v.push(H)}yield yield oe(U)}}catch(U){f={error:U}}finally{try{!S&&!r&&(m=E.return)&&(yield oe(m.call(E)))}finally{if(f)throw f.error}}this.recordHistory(l,v)})}recordHistory(t,l,a){let r=[];l.length>0&&l.every(f=>f.role!==void 0)?r=l:r.push({role:"model",parts:[]}),a&&a.length>0?this.history.push(...hh(a)):this.history.push(t),this.history.push(...r)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class La extends Error{constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,La.prototype)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function tE(i){const t={},l=u(i,["file"]);return l!=null&&c(t,["file"],l),t}function nE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function iE(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","file"],Jh(l)),t}function oE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function lE(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","file"],Jh(l)),t}function aE(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function sE(i){const t={},l=u(i,["config"]);return l!=null&&aE(l,t),t}function rE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["files"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["files"],f)}return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class uE extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_FILES,a=>this.listInternal(a),await this.listInternal(l),l)}async upload(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(t.file,t.config).then(l=>l)}async download(t){await this.apiClient.downloadFile(t)}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=sE(t);return f=Y("files",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=rE(y),v=new pT;return Object.assign(v,h),v})}}async createInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=tE(t);return f=Y("upload/v1beta/files",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=nE(y),v=new mT;return Object.assign(v,h),v})}}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=lE(t);return f=Y("files/{file}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=iE(t);return f=Y("files/{file}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=oE(y),v=new hT;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Na(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function cE(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>ME(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function fE(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function dE(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function pE(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function mE(i){const t={},l=u(i,["modelSelectionConfig"]);l!=null&&c(t,["modelConfig"],l);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const m=u(i,["enableAffectiveDialog"]);m!=null&&c(t,["enableAffectiveDialog"],m);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const h=u(i,["maxOutputTokens"]);h!=null&&c(t,["maxOutputTokens"],h);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const S=u(i,["presencePenalty"]);S!=null&&c(t,["presencePenalty"],S);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const C=u(i,["responseMimeType"]);C!=null&&c(t,["responseMimeType"],C);const U=u(i,["responseModalities"]);U!=null&&c(t,["responseModalities"],U);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const b=u(i,["routingConfig"]);b!=null&&c(t,["routingConfig"],b);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const X=u(i,["speechConfig"]);X!=null&&c(t,["speechConfig"],X);const k=u(i,["stopSequences"]);k!=null&&c(t,["stopSequences"],k);const K=u(i,["temperature"]);K!=null&&c(t,["temperature"],K);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const te=u(i,["topK"]);te!=null&&c(t,["topK"],te);const F=u(i,["topP"]);if(F!=null&&c(t,["topP"],F),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function hE(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function gE(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function yE(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const U=u(i,["systemInstruction"]);t!==void 0&&U!=null&&c(t,["setup","systemInstruction"],cE(it(U)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let te=to(H);Array.isArray(te)&&(te=te.map(F=>IE(eo(F)))),c(t,["setup","tools"],te)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],NE(b));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return l}function vE(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],mE(a));const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const U=u(i,["systemInstruction"]);t!==void 0&&U!=null&&c(t,["setup","systemInstruction"],it(U));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let F=to(H);Array.isArray(F)&&(F=F.map(he=>xE(eo(he)))),c(t,["setup","tools"],F)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],b);const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee);const te=u(i,["explicitVadSignal"]);return t!==void 0&&te!=null&&c(t,["setup","explicitVadSignal"],te),l}function TE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],yE(r,l)),l}function SE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],vE(r,l)),l}function EE(i){const t={},l=u(i,["musicGenerationConfig"]);return l!=null&&c(t,["musicGenerationConfig"],l),t}function _E(i){const t={},l=u(i,["weightedPrompts"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["weightedPrompts"],a)}return t}function CE(i){const t={},l=u(i,["media"]);if(l!=null){let h=Bh(l);Array.isArray(h)&&(h=h.map(v=>Na(v))),c(t,["mediaChunks"],h)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],Na(kh(a)));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Na(Ph(f)));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function AE(i){const t={},l=u(i,["media"]);if(l!=null){let h=Bh(l);Array.isArray(h)&&(h=h.map(v=>v)),c(t,["mediaChunks"],h)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],kh(a));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Ph(f));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function RE(i){const t={},l=u(i,["setupComplete"]);l!=null&&c(t,["setupComplete"],l);const a=u(i,["serverContent"]);a!=null&&c(t,["serverContent"],a);const r=u(i,["toolCall"]);r!=null&&c(t,["toolCall"],r);const f=u(i,["toolCallCancellation"]);f!=null&&c(t,["toolCallCancellation"],f);const m=u(i,["usageMetadata"]);m!=null&&c(t,["usageMetadata"],DE(m));const g=u(i,["goAway"]);g!=null&&c(t,["goAway"],g);const y=u(i,["sessionResumptionUpdate"]);y!=null&&c(t,["sessionResumptionUpdate"],y);const h=u(i,["voiceActivityDetectionSignal"]);return h!=null&&c(t,["voiceActivityDetectionSignal"],h),t}function ME(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],fE(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],dE(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],Na(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function NE(i){const t={},l=u(i,["handle"]);if(l!=null&&c(t,["handle"],l),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function IE(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],hE(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],gE(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function xE(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>pE(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function DE(i){const t={},l=u(i,["promptTokenCount"]);l!=null&&c(t,["promptTokenCount"],l);const a=u(i,["cachedContentTokenCount"]);a!=null&&c(t,["cachedContentTokenCount"],a);const r=u(i,["candidatesTokenCount"]);r!=null&&c(t,["responseTokenCount"],r);const f=u(i,["toolUsePromptTokenCount"]);f!=null&&c(t,["toolUsePromptTokenCount"],f);const m=u(i,["thoughtsTokenCount"]);m!=null&&c(t,["thoughtsTokenCount"],m);const g=u(i,["totalTokenCount"]);g!=null&&c(t,["totalTokenCount"],g);const y=u(i,["promptTokensDetails"]);if(y!=null){let C=y;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["promptTokensDetails"],C)}const h=u(i,["cacheTokensDetails"]);if(h!=null){let C=h;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["cacheTokensDetails"],C)}const v=u(i,["candidatesTokensDetails"]);if(v!=null){let C=v;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["responseTokensDetails"],C)}const S=u(i,["toolUsePromptTokensDetails"]);if(S!=null){let C=S;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["toolUsePromptTokensDetails"],C)}const E=u(i,["trafficType"]);return E!=null&&c(t,["trafficType"],E),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function UE(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function wE(i){const t={},l=u(i,["content"]);l!=null&&c(t,["content"],l);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],bE(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const m=u(i,["avgLogprobs"]);m!=null&&c(t,["avgLogprobs"],m);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const h=u(i,["logprobsResult"]);h!=null&&c(t,["logprobsResult"],h);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(C=>C)),c(t,["safetyRatings"],E)}const S=u(i,["urlContextMetadata"]);return S!=null&&c(t,["urlContextMetadata"],S),t}function bE(i){const t={},l=u(i,["citationSources"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function LE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let f=Ht(r);Array.isArray(f)&&(f=f.map(m=>m)),c(l,["contents"],f)}return l}function GE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["tokensInfo"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["tokensInfo"],r)}return t}function HE(i){const t={},l=u(i,["values"]);l!=null&&c(t,["values"],l);const a=u(i,["statistics"]);return a!=null&&c(t,["statistics"],qE(a)),t}function qE(i){const t={},l=u(i,["truncated"]);l!=null&&c(t,["truncated"],l);const a=u(i,["token_count"]);return a!=null&&c(t,["tokenCount"],a),t}function Ga(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>Y_(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function VE(i){const t={},l=u(i,["controlType"]);l!=null&&c(t,["controlType"],l);const a=u(i,["enableControlImageComputation"]);return a!=null&&c(t,["computeControl"],a),t}function zE(i){const t={};if(u(i,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(u(i,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(u(i,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return t}function BE(i,t){const l={},a=u(i,["systemInstruction"]);t!==void 0&&a!=null&&c(t,["systemInstruction"],it(a));const r=u(i,["tools"]);if(t!==void 0&&r!=null){let m=r;Array.isArray(m)&&(m=m.map(g=>ng(g))),c(t,["tools"],m)}const f=u(i,["generationConfig"]);return t!==void 0&&f!=null&&c(t,["generationConfig"],U_(f)),l}function PE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>Ga(g))),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&zE(f),l}function kE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&BE(f,l),l}function OE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["totalTokens"]);a!=null&&c(t,["totalTokens"],a);const r=u(i,["cachedContentTokenCount"]);return r!=null&&c(t,["cachedContentTokenCount"],r),t}function FE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["totalTokens"]);return a!=null&&c(t,["totalTokens"],a),t}function JE(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function YE(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function XE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function KE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function QE(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["negativePrompt"]);t!==void 0&&r!=null&&c(t,["parameters","negativePrompt"],r);const f=u(i,["numberOfImages"]);t!==void 0&&f!=null&&c(t,["parameters","sampleCount"],f);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const g=u(i,["guidanceScale"]);t!==void 0&&g!=null&&c(t,["parameters","guidanceScale"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const h=u(i,["safetyFilterLevel"]);t!==void 0&&h!=null&&c(t,["parameters","safetySetting"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["includeSafetyAttributes"]);t!==void 0&&S!=null&&c(t,["parameters","includeSafetyAttributes"],S);const E=u(i,["includeRaiReason"]);t!==void 0&&E!=null&&c(t,["parameters","includeRaiReason"],E);const C=u(i,["language"]);t!==void 0&&C!=null&&c(t,["parameters","language"],C);const U=u(i,["outputMimeType"]);t!==void 0&&U!=null&&c(t,["parameters","outputOptions","mimeType"],U);const H=u(i,["outputCompressionQuality"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","compressionQuality"],H);const b=u(i,["addWatermark"]);t!==void 0&&b!=null&&c(t,["parameters","addWatermark"],b);const P=u(i,["labels"]);t!==void 0&&P!=null&&c(t,["labels"],P);const X=u(i,["editMode"]);t!==void 0&&X!=null&&c(t,["parameters","editMode"],X);const k=u(i,["baseSteps"]);return t!==void 0&&k!=null&&c(t,["parameters","editConfig","baseSteps"],k),l}function ZE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["referenceImages"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>W_(y))),c(l,["instances[0]","referenceImages"],g)}const m=u(t,["config"]);return m!=null&&QE(m,l),l}function $E(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>Ha(f))),c(t,["generatedImages"],r)}return t}function WE(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return l}function jE(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["instances[]","task_type"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["instances[]","title"],r);const f=u(i,["outputDimensionality"]);t!==void 0&&f!=null&&c(t,["parameters","outputDimensionality"],f);const m=u(i,["mimeType"]);t!==void 0&&m!=null&&c(t,["instances[]","mimeType"],m);const g=u(i,["autoTruncate"]);return t!==void 0&&g!=null&&c(t,["parameters","autoTruncate"],g),l}function e_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let g=Lu(i,r);Array.isArray(g)&&(g=g.map(y=>y)),c(l,["requests[]","content"],g)}const f=u(t,["config"]);f!=null&&WE(f,l);const m=u(t,["model"]);return m!==void 0&&c(l,["requests[]","model"],Te(i,m)),l}function t_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Lu(i,r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["instances[]","content"],m)}const f=u(t,["config"]);return f!=null&&jE(f,l),l}function n_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["embeddings"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["embeddings"],f)}const r=u(i,["metadata"]);return r!=null&&c(t,["metadata"],r),t}function i_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions[]","embeddings"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>HE(m))),c(t,["embeddings"],f)}const r=u(i,["metadata"]);return r!=null&&c(t,["metadata"],r),t}function o_(i){const t={},l=u(i,["endpoint"]);l!=null&&c(t,["name"],l);const a=u(i,["deployedModelId"]);return a!=null&&c(t,["deployedModelId"],a),t}function l_(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function a_(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function s_(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function r_(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function u_(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],Ga(it(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const U=u(t,["frequencyPenalty"]);U!=null&&c(a,["frequencyPenalty"],U);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);if(X!=null&&c(a,["responseJsonSchema"],X),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const k=u(t,["safetySettings"]);if(l!==void 0&&k!=null){let Ee=k;Array.isArray(Ee)&&(Ee=Ee.map(Pe=>j_(Pe))),c(l,["safetySettings"],Ee)}const K=u(t,["tools"]);if(l!==void 0&&K!=null){let Ee=to(K);Array.isArray(Ee)&&(Ee=Ee.map(Pe=>aC(eo(Pe)))),c(l,["tools"],Ee)}const ee=u(t,["toolConfig"]);if(l!==void 0&&ee!=null&&c(l,["toolConfig"],lC(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const te=u(t,["cachedContent"]);l!==void 0&&te!=null&&c(l,["cachedContent"],gn(i,te));const F=u(t,["responseModalities"]);F!=null&&c(a,["responseModalities"],F);const he=u(t,["mediaResolution"]);he!=null&&c(a,["mediaResolution"],he);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],Hu(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const Ce=u(t,["imageConfig"]);Ce!=null&&c(a,["imageConfig"],H_(Ce));const Ge=u(t,["enableEnhancedCivicAnswers"]);return Ge!=null&&c(a,["enableEnhancedCivicAnswers"],Ge),a}function c_(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],it(r));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const U=u(t,["frequencyPenalty"]);U!=null&&c(a,["frequencyPenalty"],U);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);X!=null&&c(a,["responseJsonSchema"],X);const k=u(t,["routingConfig"]);k!=null&&c(a,["routingConfig"],k);const K=u(t,["modelSelectionConfig"]);K!=null&&c(a,["modelConfig"],K);const ee=u(t,["safetySettings"]);if(l!==void 0&&ee!=null){let L=ee;Array.isArray(L)&&(L=L.map(O=>O)),c(l,["safetySettings"],L)}const te=u(t,["tools"]);if(l!==void 0&&te!=null){let L=to(te);Array.isArray(L)&&(L=L.map(O=>ng(eo(O)))),c(l,["tools"],L)}const F=u(t,["toolConfig"]);l!==void 0&&F!=null&&c(l,["toolConfig"],F);const he=u(t,["labels"]);l!==void 0&&he!=null&&c(l,["labels"],he);const W=u(t,["cachedContent"]);l!==void 0&&W!=null&&c(l,["cachedContent"],gn(i,W));const de=u(t,["responseModalities"]);de!=null&&c(a,["responseModalities"],de);const Ce=u(t,["mediaResolution"]);Ce!=null&&c(a,["mediaResolution"],Ce);const Ge=u(t,["speechConfig"]);Ge!=null&&c(a,["speechConfig"],Hu(Ge));const Ee=u(t,["audioTimestamp"]);Ee!=null&&c(a,["audioTimestamp"],Ee);const Pe=u(t,["thinkingConfig"]);Pe!=null&&c(a,["thinkingConfig"],Pe);const rt=u(t,["imageConfig"]);if(rt!=null&&c(a,["imageConfig"],q_(rt)),u(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return a}function gh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>Ga(g))),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&c(l,["generationConfig"],u_(i,f,l)),l}function yh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&c(l,["generationConfig"],c_(i,f,l)),l}function vh(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(h=>wE(h))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const m=u(i,["responseId"]);m!=null&&c(t,["responseId"],m);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function Th(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let h=a;Array.isArray(h)&&(h=h.map(v=>v)),c(t,["candidates"],h)}const r=u(i,["createTime"]);r!=null&&c(t,["createTime"],r);const f=u(i,["modelVersion"]);f!=null&&c(t,["modelVersion"],f);const m=u(i,["promptFeedback"]);m!=null&&c(t,["promptFeedback"],m);const g=u(i,["responseId"]);g!=null&&c(t,["responseId"],g);const y=u(i,["usageMetadata"]);return y!=null&&c(t,["usageMetadata"],y),t}function f_(i,t){const l={};if(u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const a=u(i,["numberOfImages"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["aspectRatio"]);t!==void 0&&r!=null&&c(t,["parameters","aspectRatio"],r);const f=u(i,["guidanceScale"]);if(t!==void 0&&f!=null&&c(t,["parameters","guidanceScale"],f),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const m=u(i,["safetyFilterLevel"]);t!==void 0&&m!=null&&c(t,["parameters","safetySetting"],m);const g=u(i,["personGeneration"]);t!==void 0&&g!=null&&c(t,["parameters","personGeneration"],g);const y=u(i,["includeSafetyAttributes"]);t!==void 0&&y!=null&&c(t,["parameters","includeSafetyAttributes"],y);const h=u(i,["includeRaiReason"]);t!==void 0&&h!=null&&c(t,["parameters","includeRaiReason"],h);const v=u(i,["language"]);t!==void 0&&v!=null&&c(t,["parameters","language"],v);const S=u(i,["outputMimeType"]);t!==void 0&&S!=null&&c(t,["parameters","outputOptions","mimeType"],S);const E=u(i,["outputCompressionQuality"]);if(t!==void 0&&E!=null&&c(t,["parameters","outputOptions","compressionQuality"],E),u(i,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const C=u(i,["imageSize"]);if(t!==void 0&&C!=null&&c(t,["parameters","sampleImageSize"],C),u(i,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return l}function d_(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["negativePrompt"]);t!==void 0&&r!=null&&c(t,["parameters","negativePrompt"],r);const f=u(i,["numberOfImages"]);t!==void 0&&f!=null&&c(t,["parameters","sampleCount"],f);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const g=u(i,["guidanceScale"]);t!==void 0&&g!=null&&c(t,["parameters","guidanceScale"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const h=u(i,["safetyFilterLevel"]);t!==void 0&&h!=null&&c(t,["parameters","safetySetting"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["includeSafetyAttributes"]);t!==void 0&&S!=null&&c(t,["parameters","includeSafetyAttributes"],S);const E=u(i,["includeRaiReason"]);t!==void 0&&E!=null&&c(t,["parameters","includeRaiReason"],E);const C=u(i,["language"]);t!==void 0&&C!=null&&c(t,["parameters","language"],C);const U=u(i,["outputMimeType"]);t!==void 0&&U!=null&&c(t,["parameters","outputOptions","mimeType"],U);const H=u(i,["outputCompressionQuality"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","compressionQuality"],H);const b=u(i,["addWatermark"]);t!==void 0&&b!=null&&c(t,["parameters","addWatermark"],b);const P=u(i,["labels"]);t!==void 0&&P!=null&&c(t,["labels"],P);const X=u(i,["imageSize"]);t!==void 0&&X!=null&&c(t,["parameters","sampleImageSize"],X);const k=u(i,["enhancePrompt"]);return t!==void 0&&k!=null&&c(t,["parameters","enhancePrompt"],k),l}function p_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["config"]);return f!=null&&f_(f,l),l}function m_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["config"]);return f!=null&&d_(f,l),l}function h_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>N_(m))),c(t,["generatedImages"],f)}const r=u(i,["positivePromptSafetyAttributes"]);return r!=null&&c(t,["positivePromptSafetyAttributes"],eg(r)),t}function g_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>Ha(m))),c(t,["generatedImages"],f)}const r=u(i,["positivePromptSafetyAttributes"]);return r!=null&&c(t,["positivePromptSafetyAttributes"],tg(r)),t}function y_(i,t){const l={},a=u(i,["numberOfVideos"]);if(t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a),u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const r=u(i,["durationSeconds"]);if(t!==void 0&&r!=null&&c(t,["parameters","durationSeconds"],r),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const f=u(i,["aspectRatio"]);t!==void 0&&f!=null&&c(t,["parameters","aspectRatio"],f);const m=u(i,["resolution"]);t!==void 0&&m!=null&&c(t,["parameters","resolution"],m);const g=u(i,["personGeneration"]);if(t!==void 0&&g!=null&&c(t,["parameters","personGeneration"],g),u(i,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const y=u(i,["negativePrompt"]);t!==void 0&&y!=null&&c(t,["parameters","negativePrompt"],y);const h=u(i,["enhancePrompt"]);if(t!==void 0&&h!=null&&c(t,["parameters","enhancePrompt"],h),u(i,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const v=u(i,["lastFrame"]);t!==void 0&&v!=null&&c(t,["instances[0]","lastFrame"],qa(v));const S=u(i,["referenceImages"]);if(t!==void 0&&S!=null){let E=S;Array.isArray(E)&&(E=E.map(C=>TC(C))),c(t,["instances[0]","referenceImages"],E)}if(u(i,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(u(i,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return l}function v_(i,t){const l={},a=u(i,["numberOfVideos"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["outputGcsUri"]);t!==void 0&&r!=null&&c(t,["parameters","storageUri"],r);const f=u(i,["fps"]);t!==void 0&&f!=null&&c(t,["parameters","fps"],f);const m=u(i,["durationSeconds"]);t!==void 0&&m!=null&&c(t,["parameters","durationSeconds"],m);const g=u(i,["seed"]);t!==void 0&&g!=null&&c(t,["parameters","seed"],g);const y=u(i,["aspectRatio"]);t!==void 0&&y!=null&&c(t,["parameters","aspectRatio"],y);const h=u(i,["resolution"]);t!==void 0&&h!=null&&c(t,["parameters","resolution"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["pubsubTopic"]);t!==void 0&&S!=null&&c(t,["parameters","pubsubTopic"],S);const E=u(i,["negativePrompt"]);t!==void 0&&E!=null&&c(t,["parameters","negativePrompt"],E);const C=u(i,["enhancePrompt"]);t!==void 0&&C!=null&&c(t,["parameters","enhancePrompt"],C);const U=u(i,["generateAudio"]);t!==void 0&&U!=null&&c(t,["parameters","generateAudio"],U);const H=u(i,["lastFrame"]);t!==void 0&&H!=null&&c(t,["instances[0]","lastFrame"],Ft(H));const b=u(i,["referenceImages"]);if(t!==void 0&&b!=null){let k=b;Array.isArray(k)&&(k=k.map(K=>SC(K))),c(t,["instances[0]","referenceImages"],k)}const P=u(i,["mask"]);t!==void 0&&P!=null&&c(t,["instances[0]","mask"],vC(P));const X=u(i,["compressionQuality"]);return t!==void 0&&X!=null&&c(t,["parameters","compressionQuality"],X),l}function T_(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response","generateVideoResponse"]);return m!=null&&c(t,["response"],C_(m)),t}function S_(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],A_(m)),t}function E_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["image"]);f!=null&&c(l,["instances[0]","image"],qa(f));const m=u(t,["video"]);m!=null&&c(l,["instances[0]","video"],ig(m));const g=u(t,["source"]);g!=null&&R_(g,l);const y=u(t,["config"]);return y!=null&&y_(y,l),l}function __(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["image"]);f!=null&&c(l,["instances[0]","image"],Ft(f));const m=u(t,["video"]);m!=null&&c(l,["instances[0]","video"],og(m));const g=u(t,["source"]);g!=null&&M_(g,l);const y=u(t,["config"]);return y!=null&&v_(y,l),l}function C_(i){const t={},l=u(i,["generatedSamples"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>x_(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function A_(i){const t={},l=u(i,["videos"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>D_(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function R_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],qa(r));const f=u(i,["video"]);return t!==void 0&&f!=null&&c(t,["instances[0]","video"],ig(f)),l}function M_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Ft(r));const f=u(i,["video"]);return t!==void 0&&f!=null&&c(t,["instances[0]","video"],og(f)),l}function N_(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["image"],V_(l));const a=u(i,["raiFilteredReason"]);a!=null&&c(t,["raiFilteredReason"],a);const r=u(i,["_self"]);return r!=null&&c(t,["safetyAttributes"],eg(r)),t}function Ha(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["image"],jh(l));const a=u(i,["raiFilteredReason"]);a!=null&&c(t,["raiFilteredReason"],a);const r=u(i,["_self"]);r!=null&&c(t,["safetyAttributes"],tg(r));const f=u(i,["prompt"]);return f!=null&&c(t,["enhancedPrompt"],f),t}function I_(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["mask"],jh(l));const a=u(i,["labels"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["labels"],r)}return t}function x_(i){const t={},l=u(i,["video"]);return l!=null&&c(t,["video"],gC(l)),t}function D_(i){const t={},l=u(i,["_self"]);return l!=null&&c(t,["video"],yC(l)),t}function U_(i){const t={},l=u(i,["modelSelectionConfig"]);l!=null&&c(t,["modelConfig"],l);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const m=u(i,["enableAffectiveDialog"]);m!=null&&c(t,["enableAffectiveDialog"],m);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const h=u(i,["maxOutputTokens"]);h!=null&&c(t,["maxOutputTokens"],h);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const S=u(i,["presencePenalty"]);S!=null&&c(t,["presencePenalty"],S);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const C=u(i,["responseMimeType"]);C!=null&&c(t,["responseMimeType"],C);const U=u(i,["responseModalities"]);U!=null&&c(t,["responseModalities"],U);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const b=u(i,["routingConfig"]);b!=null&&c(t,["routingConfig"],b);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const X=u(i,["speechConfig"]);X!=null&&c(t,["speechConfig"],X);const k=u(i,["stopSequences"]);k!=null&&c(t,["stopSequences"],k);const K=u(i,["temperature"]);K!=null&&c(t,["temperature"],K);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const te=u(i,["topK"]);te!=null&&c(t,["topK"],te);const F=u(i,["topP"]);if(F!=null&&c(t,["topP"],F),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function w_(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function b_(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function L_(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function G_(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function H_(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function q_(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);a!=null&&c(t,["imageSize"],a);const r=u(i,["outputMimeType"]);r!=null&&c(t,["imageOutputOptions","mimeType"],r);const f=u(i,["outputCompressionQuality"]);return f!=null&&c(t,["imageOutputOptions","compressionQuality"],f),t}function V_(i){const t={},l=u(i,["bytesBase64Encoded"]);l!=null&&c(t,["imageBytes"],On(l));const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function jh(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["imageBytes"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function qa(i){const t={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const l=u(i,["imageBytes"]);l!=null&&c(t,["bytesBase64Encoded"],On(l));const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function Ft(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["imageBytes"]);a!=null&&c(t,["bytesBase64Encoded"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function z_(i,t,l){const a={},r=u(t,["pageSize"]);l!==void 0&&r!=null&&c(l,["_query","pageSize"],r);const f=u(t,["pageToken"]);l!==void 0&&f!=null&&c(l,["_query","pageToken"],f);const m=u(t,["filter"]);l!==void 0&&m!=null&&c(l,["_query","filter"],m);const g=u(t,["queryBase"]);return l!==void 0&&g!=null&&c(l,["_url","models_url"],Yh(i,g)),a}function B_(i,t,l){const a={},r=u(t,["pageSize"]);l!==void 0&&r!=null&&c(l,["_query","pageSize"],r);const f=u(t,["pageToken"]);l!==void 0&&f!=null&&c(l,["_query","pageToken"],f);const m=u(t,["filter"]);l!==void 0&&m!=null&&c(l,["_query","filter"],m);const g=u(t,["queryBase"]);return l!==void 0&&g!=null&&c(l,["_url","models_url"],Yh(i,g)),a}function P_(i,t){const l={},a=u(t,["config"]);return a!=null&&z_(i,a,l),l}function k_(i,t){const l={},a=u(t,["config"]);return a!=null&&B_(i,a,l),l}function O_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["_self"]);if(r!=null){let f=Xh(r);Array.isArray(f)&&(f=f.map(m=>Eu(m))),c(t,["models"],f)}return t}function F_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["_self"]);if(r!=null){let f=Xh(r);Array.isArray(f)&&(f=f.map(m=>_u(m))),c(t,["models"],f)}return t}function J_(i){const t={},l=u(i,["maskMode"]);l!=null&&c(t,["maskMode"],l);const a=u(i,["segmentationClasses"]);a!=null&&c(t,["maskClasses"],a);const r=u(i,["maskDilation"]);return r!=null&&c(t,["dilation"],r),t}function Eu(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);r!=null&&c(t,["description"],r);const f=u(i,["version"]);f!=null&&c(t,["version"],f);const m=u(i,["_self"]);m!=null&&c(t,["tunedModelInfo"],sC(m));const g=u(i,["inputTokenLimit"]);g!=null&&c(t,["inputTokenLimit"],g);const y=u(i,["outputTokenLimit"]);y!=null&&c(t,["outputTokenLimit"],y);const h=u(i,["supportedGenerationMethods"]);h!=null&&c(t,["supportedActions"],h);const v=u(i,["temperature"]);v!=null&&c(t,["temperature"],v);const S=u(i,["maxTemperature"]);S!=null&&c(t,["maxTemperature"],S);const E=u(i,["topP"]);E!=null&&c(t,["topP"],E);const C=u(i,["topK"]);C!=null&&c(t,["topK"],C);const U=u(i,["thinking"]);return U!=null&&c(t,["thinking"],U),t}function _u(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);r!=null&&c(t,["description"],r);const f=u(i,["versionId"]);f!=null&&c(t,["version"],f);const m=u(i,["deployedModels"]);if(m!=null){let S=m;Array.isArray(S)&&(S=S.map(E=>o_(E))),c(t,["endpoints"],S)}const g=u(i,["labels"]);g!=null&&c(t,["labels"],g);const y=u(i,["_self"]);y!=null&&c(t,["tunedModelInfo"],rC(y));const h=u(i,["defaultCheckpointId"]);h!=null&&c(t,["defaultCheckpointId"],h);const v=u(i,["checkpoints"]);if(v!=null){let S=v;Array.isArray(S)&&(S=S.map(E=>E)),c(t,["checkpoints"],S)}return t}function Y_(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],l_(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],a_(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],UE(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function X_(i){const t={},l=u(i,["productImage"]);return l!=null&&c(t,["image"],Ft(l)),t}function K_(i,t){const l={},a=u(i,["numberOfImages"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["baseSteps"]);t!==void 0&&r!=null&&c(t,["parameters","baseSteps"],r);const f=u(i,["outputGcsUri"]);t!==void 0&&f!=null&&c(t,["parameters","storageUri"],f);const m=u(i,["seed"]);t!==void 0&&m!=null&&c(t,["parameters","seed"],m);const g=u(i,["safetyFilterLevel"]);t!==void 0&&g!=null&&c(t,["parameters","safetySetting"],g);const y=u(i,["personGeneration"]);t!==void 0&&y!=null&&c(t,["parameters","personGeneration"],y);const h=u(i,["addWatermark"]);t!==void 0&&h!=null&&c(t,["parameters","addWatermark"],h);const v=u(i,["outputMimeType"]);t!==void 0&&v!=null&&c(t,["parameters","outputOptions","mimeType"],v);const S=u(i,["outputCompressionQuality"]);t!==void 0&&S!=null&&c(t,["parameters","outputOptions","compressionQuality"],S);const E=u(i,["enhancePrompt"]);t!==void 0&&E!=null&&c(t,["parameters","enhancePrompt"],E);const C=u(i,["labels"]);return t!==void 0&&C!=null&&c(t,["labels"],C),l}function Q_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["source"]);r!=null&&$_(r,l);const f=u(t,["config"]);return f!=null&&K_(f,l),l}function Z_(i){const t={},l=u(i,["predictions"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>Ha(r))),c(t,["generatedImages"],a)}return t}function $_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["personImage"]);t!==void 0&&r!=null&&c(t,["instances[0]","personImage","image"],Ft(r));const f=u(i,["productImages"]);if(t!==void 0&&f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>X_(g))),c(t,["instances[0]","productImages"],m)}return l}function W_(i){const t={},l=u(i,["referenceImage"]);l!=null&&c(t,["referenceImage"],Ft(l));const a=u(i,["referenceId"]);a!=null&&c(t,["referenceId"],a);const r=u(i,["referenceType"]);r!=null&&c(t,["referenceType"],r);const f=u(i,["maskImageConfig"]);f!=null&&c(t,["maskImageConfig"],J_(f));const m=u(i,["controlImageConfig"]);m!=null&&c(t,["controlImageConfig"],VE(m));const g=u(i,["styleImageConfig"]);g!=null&&c(t,["styleImageConfig"],g);const y=u(i,["subjectImageConfig"]);return y!=null&&c(t,["subjectImageConfig"],y),t}function eg(i){const t={},l=u(i,["safetyAttributes","categories"]);l!=null&&c(t,["categories"],l);const a=u(i,["safetyAttributes","scores"]);a!=null&&c(t,["scores"],a);const r=u(i,["contentType"]);return r!=null&&c(t,["contentType"],r),t}function tg(i){const t={},l=u(i,["safetyAttributes","categories"]);l!=null&&c(t,["categories"],l);const a=u(i,["safetyAttributes","scores"]);a!=null&&c(t,["scores"],a);const r=u(i,["contentType"]);return r!=null&&c(t,["contentType"],r),t}function j_(i){const t={},l=u(i,["category"]);if(l!=null&&c(t,["category"],l),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function eC(i){const t={},l=u(i,["image"]);return l!=null&&c(t,["image"],Ft(l)),t}function tC(i,t){const l={},a=u(i,["mode"]);t!==void 0&&a!=null&&c(t,["parameters","mode"],a);const r=u(i,["maxPredictions"]);t!==void 0&&r!=null&&c(t,["parameters","maxPredictions"],r);const f=u(i,["confidenceThreshold"]);t!==void 0&&f!=null&&c(t,["parameters","confidenceThreshold"],f);const m=u(i,["maskDilation"]);t!==void 0&&m!=null&&c(t,["parameters","maskDilation"],m);const g=u(i,["binaryColorThreshold"]);t!==void 0&&g!=null&&c(t,["parameters","binaryColorThreshold"],g);const y=u(i,["labels"]);return t!==void 0&&y!=null&&c(t,["labels"],y),l}function nC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["source"]);r!=null&&oC(r,l);const f=u(t,["config"]);return f!=null&&tC(f,l),l}function iC(i){const t={},l=u(i,["predictions"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>I_(r))),c(t,["generatedMasks"],a)}return t}function oC(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Ft(r));const f=u(i,["scribbleImage"]);return t!==void 0&&f!=null&&c(t,["instances[0]","scribble"],eC(f)),l}function lC(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],s_(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function aC(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],L_(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],G_(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function ng(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>r_(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function sC(i){const t={},l=u(i,["baseModel"]);l!=null&&c(t,["baseModel"],l);const a=u(i,["createTime"]);a!=null&&c(t,["createTime"],a);const r=u(i,["updateTime"]);return r!=null&&c(t,["updateTime"],r),t}function rC(i){const t={},l=u(i,["labels","google-vertex-llm-tuning-base-model-id"]);l!=null&&c(t,["baseModel"],l);const a=u(i,["createTime"]);a!=null&&c(t,["createTime"],a);const r=u(i,["updateTime"]);return r!=null&&c(t,["updateTime"],r),t}function uC(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);t!==void 0&&r!=null&&c(t,["description"],r);const f=u(i,["defaultCheckpointId"]);return t!==void 0&&f!=null&&c(t,["defaultCheckpointId"],f),l}function cC(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);t!==void 0&&r!=null&&c(t,["description"],r);const f=u(i,["defaultCheckpointId"]);return t!==void 0&&f!=null&&c(t,["defaultCheckpointId"],f),l}function fC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","name"],Te(i,a));const r=u(t,["config"]);return r!=null&&uC(r,l),l}function dC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&cC(r,l),l}function pC(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["safetyFilterLevel"]);t!==void 0&&r!=null&&c(t,["parameters","safetySetting"],r);const f=u(i,["personGeneration"]);t!==void 0&&f!=null&&c(t,["parameters","personGeneration"],f);const m=u(i,["includeRaiReason"]);t!==void 0&&m!=null&&c(t,["parameters","includeRaiReason"],m);const g=u(i,["outputMimeType"]);t!==void 0&&g!=null&&c(t,["parameters","outputOptions","mimeType"],g);const y=u(i,["outputCompressionQuality"]);t!==void 0&&y!=null&&c(t,["parameters","outputOptions","compressionQuality"],y);const h=u(i,["enhanceInputImage"]);t!==void 0&&h!=null&&c(t,["parameters","upscaleConfig","enhanceInputImage"],h);const v=u(i,["imagePreservationFactor"]);t!==void 0&&v!=null&&c(t,["parameters","upscaleConfig","imagePreservationFactor"],v);const S=u(i,["labels"]);t!==void 0&&S!=null&&c(t,["labels"],S);const E=u(i,["numberOfImages"]);t!==void 0&&E!=null&&c(t,["parameters","sampleCount"],E);const C=u(i,["mode"]);return t!==void 0&&C!=null&&c(t,["parameters","mode"],C),l}function mC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["image"]);r!=null&&c(l,["instances[0]","image"],Ft(r));const f=u(t,["upscaleFactor"]);f!=null&&c(l,["parameters","upscaleConfig","upscaleFactor"],f);const m=u(t,["config"]);return m!=null&&pC(m,l),l}function hC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>Ha(f))),c(t,["generatedImages"],r)}return t}function gC(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],On(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function yC(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["uri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function vC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["_self"],Ft(l));const a=u(i,["maskMode"]);return a!=null&&c(t,["maskMode"],a),t}function TC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["image"],qa(l));const a=u(i,["referenceType"]);return a!=null&&c(t,["referenceType"],a),t}function SC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["image"],Ft(l));const a=u(i,["referenceType"]);return a!=null&&c(t,["referenceType"],a),t}function ig(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["videoBytes"]);a!=null&&c(t,["encodedVideo"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["encoding"],r),t}function og(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["videoBytes"]);a!=null&&c(t,["bytesBase64Encoded"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function EC(i,t){const l={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["displayName"],a),l}function _C(i){const t={},l=u(i,["config"]);return l!=null&&EC(l,t),t}function CC(i,t){const l={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),l}function AC(i){const t={},l=u(i,["name"]);l!=null&&c(t,["_url","name"],l);const a=u(i,["config"]);return a!=null&&CC(a,t),t}function RC(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","name"],l),t}function MC(i,t){const l={},a=u(i,["customMetadata"]);if(t!==void 0&&a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["customMetadata"],f)}const r=u(i,["chunkingConfig"]);return t!==void 0&&r!=null&&c(t,["chunkingConfig"],r),l}function NC(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],xC(m)),t}function IC(i){const t={},l=u(i,["fileSearchStoreName"]);l!=null&&c(t,["_url","file_search_store_name"],l);const a=u(i,["fileName"]);a!=null&&c(t,["fileName"],a);const r=u(i,["config"]);return r!=null&&MC(r,t),t}function xC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function DC(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function UC(i){const t={},l=u(i,["config"]);return l!=null&&DC(l,t),t}function wC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["fileSearchStores"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["fileSearchStores"],f)}return t}function lg(i,t){const l={},a=u(i,["mimeType"]);t!==void 0&&a!=null&&c(t,["mimeType"],a);const r=u(i,["displayName"]);t!==void 0&&r!=null&&c(t,["displayName"],r);const f=u(i,["customMetadata"]);if(t!==void 0&&f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>y)),c(t,["customMetadata"],g)}const m=u(i,["chunkingConfig"]);return t!==void 0&&m!=null&&c(t,["chunkingConfig"],m),l}function bC(i){const t={},l=u(i,["fileSearchStoreName"]);l!=null&&c(t,["_url","file_search_store_name"],l);const a=u(i,["config"]);return a!=null&&lg(a,t),t}function LC(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const GC="Content-Type",HC="X-Server-Timeout",qC="User-Agent",Cu="x-goog-api-client",VC="1.34.0",zC=`google-genai-sdk/${VC}`,BC="v1beta1",PC="v1beta";class kC{constructor(t){var l,a;this.clientOptions=Object.assign(Object.assign({},t),{project:t.project,location:t.location,apiKey:t.apiKey,vertexai:t.vertexai});const r={};this.clientOptions.vertexai?(r.apiVersion=(l=this.clientOptions.apiVersion)!==null&&l!==void 0?l:BC,r.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(r.apiVersion=(a=this.clientOptions.apiVersion)!==null&&a!==void 0?a:PC,r.baseUrl="https://generativelanguage.googleapis.com/"),r.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=r,t.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(r,t.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var t;return(t=this.clientOptions.vertexai)!==null&&t!==void 0?t:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}async getAuthHeaders(){const t=new Headers;return await this.clientOptions.auth.addAuthHeaders(t),t}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(t){if(!t||t.baseUrl===void 0||t.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const a=[t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl];return t.apiVersion&&t.apiVersion!==""&&a.push(t.apiVersion),a.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const t=this.getBaseUrl(),l=new URL(t);return l.protocol=l.protocol=="http:"?"ws":"wss",l.toString()}setBaseUrl(t){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=t;else throw new Error("HTTP options are not correctly set.")}constructUrl(t,l,a){const r=[this.getRequestUrlInternal(l)];return a&&r.push(this.getBaseResourcePath()),t!==""&&r.push(t),new URL(`${r.join("/")}`)}shouldPrependVertexProjectPath(t){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||t.path.startsWith("projects/")||t.httpMethod==="GET"&&t.path.startsWith("publishers/google/models"))}async request(t){let l=this.clientOptions.httpOptions;t.httpOptions&&(l=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t),r=this.constructUrl(t.path,l,a);if(t.queryParams)for(const[m,g]of Object.entries(t.queryParams))r.searchParams.append(m,String(g));let f={};if(t.httpMethod==="GET"){if(t.body&&t.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else f.body=t.body;return f=await this.includeExtraHttpOptionsToRequestInit(f,l,r.toString(),t.abortSignal),this.unaryApiCall(r,f,t.httpMethod)}patchHttpOptions(t,l){const a=JSON.parse(JSON.stringify(t));for(const[r,f]of Object.entries(l))typeof f=="object"?a[r]=Object.assign(Object.assign({},a[r]),f):f!==void 0&&(a[r]=f);return a}async requestStream(t){let l=this.clientOptions.httpOptions;t.httpOptions&&(l=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t),r=this.constructUrl(t.path,l,a);(!r.searchParams.has("alt")||r.searchParams.get("alt")!=="sse")&&r.searchParams.set("alt","sse");let f={};return f.body=t.body,f=await this.includeExtraHttpOptionsToRequestInit(f,l,r.toString(),t.abortSignal),this.streamApiCall(r,f,t.httpMethod)}async includeExtraHttpOptionsToRequestInit(t,l,a,r){if(l&&l.timeout||r){const f=new AbortController,m=f.signal;if(l.timeout&&(l==null?void 0:l.timeout)>0){const g=setTimeout(()=>f.abort(),l.timeout);g&&typeof g.unref=="function"&&g.unref()}r&&r.addEventListener("abort",()=>{f.abort()}),t.signal=m}return l&&l.extraBody!==null&&OC(t,l.extraBody),t.headers=await this.getHeadersInternal(l,a),t}async unaryApiCall(t,l,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},l),{method:a})).then(async r=>(await Sh(r),new vu(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}async streamApiCall(t,l,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},l),{method:a})).then(async r=>(await Sh(r),this.processStreamResponse(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}processStreamResponse(t){return Pt(this,arguments,function*(){var a;const r=(a=t==null?void 0:t.body)===null||a===void 0?void 0:a.getReader(),f=new TextDecoder("utf-8");if(!r)throw new Error("Response body is empty");try{let m="";const g="data:",y=[` + +`,"\r\r",`\r +\r +`];for(;;){const{done:h,value:v}=yield oe(r.read());if(h){if(m.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const S=f.decode(v,{stream:!0});try{const U=JSON.parse(S);if("error"in U){const H=JSON.parse(JSON.stringify(U.error)),b=H.status,P=H.code,X=`got status: ${b}. ${JSON.stringify(U)}`;if(P>=400&&P<600)throw new La({message:X,status:P})}}catch(U){if(U.name==="ApiError")throw U}m+=S;let E=-1,C=0;for(;;){E=-1,C=0;for(const b of y){const P=m.indexOf(b);P!==-1&&(E===-1||P{throw new Error(`exception ${a} sending request`)})}getDefaultHeaders(){const t={},l=zC+" "+this.clientOptions.userAgentExtra;return t[qC]=l,t[Cu]=l,t[GC]="application/json",t}async getHeadersInternal(t,l){const a=new Headers;if(t&&t.headers){for(const[r,f]of Object.entries(t.headers))a.append(r,f);t.timeout&&t.timeout>0&&a.append(HC,String(Math.ceil(t.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(a,l),a}getFileName(t){var l;let a="";return typeof t=="string"&&(a=t.replace(/[/\\]+$/,""),a=(l=a.split(/[/\\]/).pop())!==null&&l!==void 0?l:""),a}async uploadFile(t,l){var a;const r={};l!=null&&(r.mimeType=l.mimeType,r.name=l.name,r.displayName=l.displayName),r.name&&!r.name.startsWith("files/")&&(r.name=`files/${r.name}`);const f=this.clientOptions.uploader,m=await f.stat(t);r.sizeBytes=String(m.size);const g=(a=l==null?void 0:l.mimeType)!==null&&a!==void 0?a:m.type;if(g===void 0||g==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");r.mimeType=g;const y={file:r},h=this.getFileName(t),v=Y("upload/v1beta/files",y._url),S=await this.fetchUploadUrl(v,r.sizeBytes,r.mimeType,h,y,l==null?void 0:l.httpOptions);return f.upload(t,S,this)}async uploadFileToFileSearchStore(t,l,a){var r;const f=this.clientOptions.uploader,m=await f.stat(l),g=String(m.size),y=(r=a==null?void 0:a.mimeType)!==null&&r!==void 0?r:m.type;if(y===void 0||y==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const h=`upload/v1beta/${t}:uploadToFileSearchStore`,v=this.getFileName(l),S={};a!=null&&lg(a,S);const E=await this.fetchUploadUrl(h,g,y,v,S,a==null?void 0:a.httpOptions);return f.uploadToFileSearchStore(l,E,this)}async downloadFile(t){await this.clientOptions.downloader.download(t,this)}async fetchUploadUrl(t,l,a,r,f,m){var g;let y={};m?y=m:y={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${l}`,"X-Goog-Upload-Header-Content-Type":`${a}`},r?{"X-Goog-Upload-File-Name":r}:{})};const h=await this.request({path:t,body:JSON.stringify(f),httpMethod:"POST",httpOptions:y});if(!h||!(h!=null&&h.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const v=(g=h==null?void 0:h.headers)===null||g===void 0?void 0:g["x-goog-upload-url"];if(v===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return v}}async function Sh(i){var t;if(i===void 0)throw new Error("response is undefined");if(!i.ok){const l=i.status;let a;!((t=i.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?a=await i.json():a={error:{message:await i.text(),code:i.status,status:i.statusText}};const r=JSON.stringify(a);throw l>=400&&l<600?new La({message:r,status:l}):new Error(r)}}function OC(i,t){if(!t||Object.keys(t).length===0)return;if(i.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let l={};if(typeof i.body=="string"&&i.body.length>0)try{const f=JSON.parse(i.body);if(typeof f=="object"&&f!==null&&!Array.isArray(f))l=f;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function a(f,m){const g=Object.assign({},f);for(const y in m)if(Object.prototype.hasOwnProperty.call(m,y)){const h=m[y],v=g[y];h&&typeof h=="object"&&!Array.isArray(h)&&v&&typeof v=="object"&&!Array.isArray(v)?g[y]=a(v,h):(v&&h&&typeof v!=typeof h&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${y}". Original type: ${typeof v}, New type: ${typeof h}. Overwriting.`),g[y]=h)}return g}const r=a(l,t);i.body=JSON.stringify(r)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const FC="mcp_used/unknown";let JC=!1;function ag(i){for(const t of i)if(YC(t)||typeof t=="object"&&"inputSchema"in t)return!0;return JC}function sg(i){var t;const l=(t=i[Cu])!==null&&t!==void 0?t:"";i[Cu]=(l+` ${FC}`).trimStart()}function YC(i){return i!==null&&typeof i=="object"&&i instanceof Vu}function XC(i){return Pt(this,arguments,function*(l,a=100){let r,f=0;for(;f0)return;const f={},m=[];for(const v of this.mcpClients)try{for(var g=!0,y=(l=void 0,kt(XC(v))),h;h=await y.next(),t=h.done,!t;g=!0){r=h.value,g=!1;const S=r;m.push(S);const E=S.name;if(f[E])throw new Error(`Duplicate function name ${E} found in MCP tools. Please ensure function names are unique.`);f[E]=v}}catch(S){l={error:S}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(l)throw l.error}}this.mcpTools=m,this.functionNameToMcpClient=f}async tool(){return await this.initialize(),RT(this.mcpTools,this.config)}async callTool(t){await this.initialize();const l=[];for(const a of t)if(a.name in this.functionNameToMcpClient){const r=this.functionNameToMcpClient[a.name];let f;this.config.timeout&&(f={timeout:this.config.timeout});const m=await r.callTool({name:a.name,arguments:a.args},void 0,f);l.push({functionResponse:{name:a.name,response:m.isError?{error:m}:m}})}return l}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */async function KC(i,t,l){const a=new yT;let r;l.data instanceof Blob?r=JSON.parse(await l.data.text()):r=JSON.parse(l.data),Object.assign(a,r),t(a)}class QC{constructor(t,l,a){this.apiClient=t,this.auth=l,this.webSocketFactory=a}async connect(t){var l,a;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const r=this.apiClient.getWebsocketBaseUrl(),f=this.apiClient.getApiVersion(),m=WC(this.apiClient.getDefaultHeaders()),g=this.apiClient.getApiKey(),y=`${r}/ws/google.ai.generativelanguage.${f}.GenerativeService.BidiGenerateMusic?key=${g}`;let h=()=>{};const v=new Promise(k=>{h=k}),S=t.callbacks,E=function(){h({})},C=this.apiClient,U={onopen:E,onmessage:k=>{KC(C,S.onmessage,k)},onerror:(l=S==null?void 0:S.onerror)!==null&&l!==void 0?l:function(k){},onclose:(a=S==null?void 0:S.onclose)!==null&&a!==void 0?a:function(k){}},H=this.webSocketFactory.create(y,$C(m),U);H.connect(),await v;const X={setup:{model:Te(this.apiClient,t.model)}};return H.send(JSON.stringify(X)),new ZC(H,this.apiClient)}}class ZC{constructor(t,l){this.conn=t,this.apiClient=l}async setWeightedPrompts(t){if(!t.weightedPrompts||Object.keys(t.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const l=_E(t);this.conn.send(JSON.stringify({clientContent:l}))}async setMusicGenerationConfig(t){t.musicGenerationConfig||(t.musicGenerationConfig={});const l=EE(t);this.conn.send(JSON.stringify(l))}sendPlaybackControl(t){const l={playbackControl:t};this.conn.send(JSON.stringify(l))}play(){this.sendPlaybackControl(Zi.PLAY)}pause(){this.sendPlaybackControl(Zi.PAUSE)}stop(){this.sendPlaybackControl(Zi.STOP)}resetContext(){this.sendPlaybackControl(Zi.RESET_CONTEXT)}close(){this.conn.close()}}function $C(i){const t={};return i.forEach((l,a)=>{t[a]=l}),t}function WC(i){const t=new Headers;for(const[l,a]of Object.entries(i))t.append(l,a);return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const jC="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function eA(i,t,l){const a=new gT;let r;l.data instanceof Blob?r=await l.data.text():l.data instanceof ArrayBuffer?r=new TextDecoder().decode(l.data):r=l.data;const f=JSON.parse(r);if(i.isVertexAI()){const m=RE(f);Object.assign(a,m)}else Object.assign(a,f);t(a)}class tA{constructor(t,l,a){this.apiClient=t,this.auth=l,this.webSocketFactory=a,this.music=new QC(this.apiClient,this.auth,this.webSocketFactory)}async connect(t){var l,a,r,f,m,g;if(t.config&&t.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const y=this.apiClient.getWebsocketBaseUrl(),h=this.apiClient.getApiVersion();let v;const S=this.apiClient.getHeaders();t.config&&t.config.tools&&ag(t.config.tools)&&sg(S);const E=lA(S);if(this.apiClient.isVertexAI())v=`${y}/ws/google.cloud.aiplatform.${h}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(E,v);else{const W=this.apiClient.getApiKey();let de="BidiGenerateContent",Ce="key";W!=null&&W.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),h!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),de="BidiGenerateContentConstrained",Ce="access_token"),v=`${y}/ws/google.ai.generativelanguage.${h}.GenerativeService.${de}?${Ce}=${W}`}let C=()=>{};const U=new Promise(W=>{C=W}),H=t.callbacks,b=function(){var W;(W=H==null?void 0:H.onopen)===null||W===void 0||W.call(H),C({})},P=this.apiClient,X={onopen:b,onmessage:W=>{eA(P,H.onmessage,W)},onerror:(l=H==null?void 0:H.onerror)!==null&&l!==void 0?l:function(W){},onclose:(a=H==null?void 0:H.onclose)!==null&&a!==void 0?a:function(W){}},k=this.webSocketFactory.create(v,oA(E),X);k.connect(),await U;let K=Te(this.apiClient,t.model);if(this.apiClient.isVertexAI()&&K.startsWith("publishers/")){const W=this.apiClient.getProject(),de=this.apiClient.getLocation();K=`projects/${W}/locations/${de}/`+K}let ee={};this.apiClient.isVertexAI()&&((r=t.config)===null||r===void 0?void 0:r.responseModalities)===void 0&&(t.config===void 0?t.config={responseModalities:[Ia.AUDIO]}:t.config.responseModalities=[Ia.AUDIO]),!((f=t.config)===null||f===void 0)&&f.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");const te=(g=(m=t.config)===null||m===void 0?void 0:m.tools)!==null&&g!==void 0?g:[],F=[];for(const W of te)if(this.isCallableTool(W)){const de=W;F.push(await de.tool())}else F.push(W);F.length>0&&(t.config.tools=F);const he={model:K,config:t.config,callbacks:t.callbacks};return this.apiClient.isVertexAI()?ee=SE(this.apiClient,he):ee=TE(this.apiClient,he),delete ee.config,k.send(JSON.stringify(ee)),new iA(k,this.apiClient)}isCallableTool(t){return"callTool"in t&&typeof t.callTool=="function"}}const nA={turnComplete:!0};class iA{constructor(t,l){this.conn=t,this.apiClient=l}tLiveClientContent(t,l){if(l.turns!==null&&l.turns!==void 0){let a=[];try{a=Ht(l.turns),t.isVertexAI()||(a=a.map(r=>Ga(r)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof l.turns}'`)}return{clientContent:{turns:a,turnComplete:l.turnComplete}}}return{clientContent:{turnComplete:l.turnComplete}}}tLiveClienttToolResponse(t,l){let a=[];if(l.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(l.functionResponses)?a=l.functionResponses:a=[l.functionResponses],a.length===0)throw new Error("functionResponses is required.");for(const f of a){if(typeof f!="object"||f===null||!("name"in f)||!("response"in f))throw new Error(`Could not parse function response, type '${typeof f}'.`);if(!t.isVertexAI()&&!("id"in f))throw new Error(jC)}return{toolResponse:{functionResponses:a}}}sendClientContent(t){t=Object.assign(Object.assign({},nA),t);const l=this.tLiveClientContent(this.apiClient,t);this.conn.send(JSON.stringify(l))}sendRealtimeInput(t){let l={};this.apiClient.isVertexAI()?l={realtimeInput:AE(t)}:l={realtimeInput:CE(t)},this.conn.send(JSON.stringify(l))}sendToolResponse(t){if(t.functionResponses==null)throw new Error("Tool response parameters are required.");const l=this.tLiveClienttToolResponse(this.apiClient,t);this.conn.send(JSON.stringify(l))}close(){this.conn.close()}}function oA(i){const t={};return i.forEach((l,a)=>{t[a]=l}),t}function lA(i){const t=new Headers;for(const[l,a]of Object.entries(i))t.append(l,a);return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Eh=10;function _h(i){var t,l,a;if(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let r=!1;for(const m of(l=i==null?void 0:i.tools)!==null&&l!==void 0?l:[])if(ji(m)){r=!0;break}if(!r)return!0;const f=(a=i==null?void 0:i.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls;return f&&(f<0||!Number.isInteger(f))||f==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",f),!0):!1}function ji(i){return"callTool"in i&&typeof i.callTool=="function"}function aA(i){var t,l,a;return(a=(l=(t=i.config)===null||t===void 0?void 0:t.tools)===null||l===void 0?void 0:l.some(r=>ji(r)))!==null&&a!==void 0?a:!1}function Ch(i){var t;const l=[];return!((t=i==null?void 0:i.config)===null||t===void 0)&&t.tools&&i.config.tools.forEach((a,r)=>{if(ji(a))return;const f=a;f.functionDeclarations&&f.functionDeclarations.length>0&&l.push(r)}),l}function Ah(i){var t;return!(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.ignoreCallHistory)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class sA extends hn{constructor(t){super(),this.apiClient=t,this.generateContent=async l=>{var a,r,f,m,g;const y=await this.processParamsMaybeAddMcpUsage(l);if(this.maybeMoveToResponseJsonSchem(l),!aA(l)||_h(l.config))return await this.generateContentInternal(y);const h=Ch(l);if(h.length>0){const H=h.map(b=>`tools[${b}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${H}.`)}let v,S;const E=Ht(y.contents),C=(f=(r=(a=y.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls)!==null&&f!==void 0?f:Eh;let U=0;for(;U{var a,r,f,m,g;if(this.maybeMoveToResponseJsonSchem(l),_h(l.config)){const S=await this.processParamsMaybeAddMcpUsage(l);return await this.generateContentStreamInternal(S)}const y=Ch(l);if(y.length>0){const S=y.map(E=>`tools[${E}]`).join(", ");throw new Error(`Incompatible tools found at ${S}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const h=(f=(r=(a=l==null?void 0:l.config)===null||a===void 0?void 0:a.toolConfig)===null||r===void 0?void 0:r.functionCallingConfig)===null||f===void 0?void 0:f.streamFunctionCallArguments,v=(g=(m=l==null?void 0:l.config)===null||m===void 0?void 0:m.automaticFunctionCalling)===null||g===void 0?void 0:g.disable;if(h&&!v)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(l)},this.generateImages=async l=>await this.generateImagesInternal(l).then(a=>{var r;let f;const m=[];if(a!=null&&a.generatedImages)for(const y of a.generatedImages)y&&(y!=null&&y.safetyAttributes)&&((r=y==null?void 0:y.safetyAttributes)===null||r===void 0?void 0:r.contentType)==="Positive Prompt"?f=y==null?void 0:y.safetyAttributes:m.push(y);let g;return f?g={generatedImages:m,positivePromptSafetyAttributes:f,sdkHttpResponse:a.sdkHttpResponse}:g={generatedImages:m,sdkHttpResponse:a.sdkHttpResponse},g}),this.list=async l=>{var a;const m={config:Object.assign(Object.assign({},{queryBase:!0}),l==null?void 0:l.config)};if(this.apiClient.isVertexAI()&&!m.config.queryBase){if(!((a=m.config)===null||a===void 0)&&a.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");m.config.filter="labels.tune-type:*"}return new ci(mn.PAGED_ITEM_MODELS,g=>this.listInternal(g),await this.listInternal(m),m)},this.editImage=async l=>{const a={model:l.model,prompt:l.prompt,referenceImages:[],config:l.config};return l.referenceImages&&l.referenceImages&&(a.referenceImages=l.referenceImages.map(r=>r.toReferenceImageAPI())),await this.editImageInternal(a)},this.upscaleImage=async l=>{let a={numberOfImages:1,mode:"upscale"};l.config&&(a=Object.assign(Object.assign({},a),l.config));const r={model:l.model,image:l.image,upscaleFactor:l.upscaleFactor,config:a};return await this.upscaleImageInternal(r)},this.generateVideos=async l=>{var a,r,f,m,g,y;if((l.prompt||l.image||l.video)&&l.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((a=l.video)===null||a===void 0)&&a.uri&&(!((r=l.video)===null||r===void 0)&&r.videoBytes)?l.video={uri:l.video.uri,mimeType:l.video.mimeType}:!((m=(f=l.source)===null||f===void 0?void 0:f.video)===null||m===void 0)&&m.uri&&(!((y=(g=l.source)===null||g===void 0?void 0:g.video)===null||y===void 0)&&y.videoBytes)&&(l.source.video={uri:l.source.video.uri,mimeType:l.source.video.mimeType})),await this.generateVideosInternal(l)}}maybeMoveToResponseJsonSchem(t){t.config&&t.config.responseSchema&&(t.config.responseJsonSchema||Object.keys(t.config.responseSchema).includes("$schema")&&(t.config.responseJsonSchema=t.config.responseSchema,delete t.config.responseSchema))}async processParamsMaybeAddMcpUsage(t){var l,a,r;const f=(l=t.config)===null||l===void 0?void 0:l.tools;if(!f)return t;const m=await Promise.all(f.map(async y=>ji(y)?await y.tool():y)),g={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:m})};if(g.config.tools=m,t.config&&t.config.tools&&ag(t.config.tools)){const y=(r=(a=t.config.httpOptions)===null||a===void 0?void 0:a.headers)!==null&&r!==void 0?r:{};let h=Object.assign({},y);Object.keys(h).length===0&&(h=this.apiClient.getDefaultHeaders()),sg(h),g.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:h})}return g}async initAfcToolsMap(t){var l,a,r;const f=new Map;for(const m of(a=(l=t.config)===null||l===void 0?void 0:l.tools)!==null&&a!==void 0?a:[])if(ji(m)){const g=m,y=await g.tool();for(const h of(r=y.functionDeclarations)!==null&&r!==void 0?r:[]){if(!h.name)throw new Error("Function declaration name is required.");if(f.has(h.name))throw new Error(`Duplicate tool declaration name: ${h.name}`);f.set(h.name,g)}}return f}async processAfcStream(t){var l,a,r;const f=(r=(a=(l=t.config)===null||l===void 0?void 0:l.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls)!==null&&r!==void 0?r:Eh;let m=!1,g=0;const y=await this.initAfcToolsMap(t);return(function(h,v,S){return Pt(this,arguments,function*(){for(var E,C,U,H,b,P;g0){m=!0;const W=new jo;W.candidates=[{content:{role:"user",parts:F}}],yield yield oe(W);const de=[];de.push(...he),de.push({role:"user",parts:F});const Ce=Ht(S.contents).concat(de);S.contents=Ce}else break}})})(this,y,t)}async generateContentInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=yh(this.apiClient,t);return g=Y("{model}:generateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=Th(v),E=new jo;return Object.assign(E,S),E})}else{const h=gh(this.apiClient,t);return g=Y("{model}:generateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=vh(v),E=new jo;return Object.assign(E,S),E})}}async generateContentStreamInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=yh(this.apiClient,t);return g=Y("{model}:streamGenerateContent?alt=sse",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}),m.then(function(S){return Pt(this,arguments,function*(){var E,C,U,H;try{for(var b=!0,P=kt(S),X;X=yield oe(P.next()),E=X.done,!E;b=!0){H=X.value,b=!1;const k=H,K=Th(yield oe(k.json()));K.sdkHttpResponse={headers:k.headers};const ee=new jo;Object.assign(ee,K),yield yield oe(ee)}}catch(k){C={error:k}}finally{try{!b&&!E&&(U=P.return)&&(yield oe(U.call(P)))}finally{if(C)throw C.error}}})})}else{const h=gh(this.apiClient,t);return g=Y("{model}:streamGenerateContent?alt=sse",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}),m.then(function(S){return Pt(this,arguments,function*(){var E,C,U,H;try{for(var b=!0,P=kt(S),X;X=yield oe(P.next()),E=X.done,!E;b=!0){H=X.value,b=!1;const k=H,K=vh(yield oe(k.json()));K.sdkHttpResponse={headers:k.headers};const ee=new jo;Object.assign(ee,K),yield yield oe(ee)}}catch(k){C={error:k}}finally{try{!b&&!E&&(U=P.return)&&(yield oe(U.call(P)))}finally{if(C)throw C.error}}})})}}async embedContent(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=t_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=i_(v),E=new jm;return Object.assign(E,S),E})}else{const h=e_(this.apiClient,t);return g=Y("{model}:batchEmbedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=n_(v),E=new jm;return Object.assign(E,S),E})}}async generateImagesInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=m_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=g_(v),E=new eh;return Object.assign(E,S),E})}else{const h=p_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=h_(v),E=new eh;return Object.assign(E,S),E})}}async editImageInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=ZE(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=$E(y),v=new lT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=mC(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=hC(y),v=new aT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=Q_(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=Z_(y),v=new sT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=nC(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=iC(y),v=new rT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=b_(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>_u(v))}else{const h=w_(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Eu(v))}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=k_(this.apiClient,t);return g=Y("{models_url}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=F_(v),E=new th;return Object.assign(E,S),E})}else{const h=P_(this.apiClient,t);return g=Y("{models_url}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=O_(v),E=new th;return Object.assign(E,S),E})}}async update(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=dC(this.apiClient,t);return g=Y("{model}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>_u(v))}else{const h=fC(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Eu(v))}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=YE(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=KE(v),E=new nh;return Object.assign(E,S),E})}else{const h=JE(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=XE(v),E=new nh;return Object.assign(E,S),E})}}async countTokens(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=kE(this.apiClient,t);return g=Y("{model}:countTokens",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=FE(v),E=new ih;return Object.assign(E,S),E})}else{const h=PE(this.apiClient,t);return g=Y("{model}:countTokens",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=OE(v),E=new ih;return Object.assign(E,S),E})}}async computeTokens(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=LE(this.apiClient,t);return f=Y("{model}:computeTokens",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=GE(y),v=new uT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=__(this.apiClient,t);return g=Y("{model}:predictLongRunning",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>{const S=S_(v),E=new xa;return Object.assign(E,S),E})}else{const h=E_(this.apiClient,t);return g=Y("{model}:predictLongRunning",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>{const S=T_(v),E=new xa;return Object.assign(E,S),E})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class rA extends hn{constructor(t){super(),this.apiClient=t}async getVideosOperation(t){const l=t.operation,a=t.config;if(l.name===void 0||l.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=l.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const m=await this.fetchPredictVideosOperationInternal({operationName:l.name,resourceName:r,config:{httpOptions:f}});return l._fromAPIResponse({apiResponse:m,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:l.name,config:a});return l._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async get(t){const l=t.operation,a=t.config;if(l.name===void 0||l.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=l.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const m=await this.fetchPredictVideosOperationInternal({operationName:l.name,resourceName:r,config:{httpOptions:f}});return l._fromAPIResponse({apiResponse:m,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:l.name,config:a});return l._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async getVideosOperationInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=j0(t);return g=Y("{operationName}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m}else{const h=W0(t);return g=Y("{operationName}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m}}async fetchPredictVideosOperationInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=J0(t);return f=Y("{resourceName}:fetchPredictOperation",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r}else throw new Error("This method is only supported by the Vertex AI.")}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function uA(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function cA(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>TA(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function fA(i,t,l){const a={},r=u(t,["expireTime"]);l!==void 0&&r!=null&&c(l,["expireTime"],r);const f=u(t,["newSessionExpireTime"]);l!==void 0&&f!=null&&c(l,["newSessionExpireTime"],f);const m=u(t,["uses"]);l!==void 0&&m!=null&&c(l,["uses"],m);const g=u(t,["liveConnectConstraints"]);l!==void 0&&g!=null&&c(l,["bidiGenerateContentSetup"],vA(i,g));const y=u(t,["lockAdditionalFields"]);return l!==void 0&&y!=null&&c(l,["fieldMask"],y),a}function dA(i,t){const l={},a=u(t,["config"]);return a!=null&&c(l,["config"],fA(i,a,l)),l}function pA(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function mA(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function hA(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function gA(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function yA(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const U=u(i,["systemInstruction"]);t!==void 0&&U!=null&&c(t,["setup","systemInstruction"],cA(it(U)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let te=to(H);Array.isArray(te)&&(te=te.map(F=>EA(eo(F)))),c(t,["setup","tools"],te)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],SA(b));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return l}function vA(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],yA(r,l)),l}function TA(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],pA(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],mA(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],uA(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function SA(i){const t={},l=u(i,["handle"]);if(l!=null&&c(t,["handle"],l),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function EA(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],hA(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],gA(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function _A(i){const t=[];for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const a=i[l];if(typeof a=="object"&&a!=null&&Object.keys(a).length>0){const r=Object.keys(a).map(f=>`${l}.${f}`);t.push(...r)}else t.push(l)}return t.join(",")}function CA(i,t){let l=null;const a=i.bidiGenerateContentSetup;if(typeof a=="object"&&a!==null&&"setup"in a){const f=a.setup;typeof f=="object"&&f!==null?(i.bidiGenerateContentSetup=f,l=f):delete i.bidiGenerateContentSetup}else a!==void 0&&delete i.bidiGenerateContentSetup;const r=i.fieldMask;if(l){const f=_A(l);if(Array.isArray(t==null?void 0:t.lockAdditionalFields)&&(t==null?void 0:t.lockAdditionalFields.length)===0)f?i.fieldMask=f:delete i.fieldMask;else if(t!=null&&t.lockAdditionalFields&&t.lockAdditionalFields.length>0&&r!==null&&Array.isArray(r)&&r.length>0){const m=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let g=[];r.length>0&&(g=r.map(h=>m.includes(h)?`generationConfig.${h}`:h));const y=[];f&&y.push(f),g.length>0&&y.push(...g),y.length>0?i.fieldMask=y.join(","):delete i.fieldMask}else delete i.fieldMask}else r!==null&&Array.isArray(r)&&r.length>0?i.fieldMask=r.join(","):delete i.fieldMask;return i}class AA extends hn{constructor(t){super(),this.apiClient=t}async create(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const g=dA(this.apiClient,t);f=Y("auth_tokens",g._url),m=g._query,delete g.config,delete g._url,delete g._query;const y=CA(g,t.config);return r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(h=>h.json()),r.then(h=>h)}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function RA(i,t){const l={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),l}function MA(i){const t={},l=u(i,["name"]);l!=null&&c(t,["_url","name"],l);const a=u(i,["config"]);return a!=null&&RA(a,t),t}function NA(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","name"],l),t}function IA(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function xA(i){const t={},l=u(i,["parent"]);l!=null&&c(t,["_url","parent"],l);const a=u(i,["config"]);return a!=null&&IA(a,t),t}function DA(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["documents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["documents"],f)}return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class UA extends hn{constructor(t){super(),this.apiClient=t,this.list=async l=>new ci(mn.PAGED_ITEM_DOCUMENTS,a=>this.listInternal({parent:l.parent,config:a.config}),await this.listInternal(l),l)}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=NA(t);return f=Y("{name}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const m=MA(t);r=Y("{name}",m._url),f=m._query,delete m._url,delete m._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=xA(t);return f=Y("{parent}/documents",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=DA(y),v=new cT;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class wA extends hn{constructor(t,l=new UA(t)){super(),this.apiClient=t,this.documents=l,this.list=async(a={})=>new ci(mn.PAGED_ITEM_FILE_SEARCH_STORES,r=>this.listInternal(r),await this.listInternal(a),a)}async uploadToFileSearchStore(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(t.fileSearchStoreName,t.file,t.config)}async create(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=_C(t);return f=Y("fileSearchStores",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=RC(t);return f=Y("{name}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const m=AC(t);r=Y("{name}",m._url),f=m._query,delete m._url,delete m._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=UC(t);return f=Y("fileSearchStores",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=wC(y),v=new fT;return Object.assign(v,h),v})}}async uploadToFileSearchStoreInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=bC(t);return f=Y("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=LC(y),v=new dT;return Object.assign(v,h),v})}}async importFile(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=IC(t);return f=Y("{file_search_store_name}:importFile",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=NC(y),v=new wu;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */let rg=function(){const{crypto:i}=globalThis;if(i!=null&&i.randomUUID)return rg=i.randomUUID.bind(i),i.randomUUID();const t=new Uint8Array(1),l=i?()=>i.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(+a^l()&15>>+a/4).toString(16))};const bA=()=>rg();/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Au(i){return typeof i=="object"&&i!==null&&("name"in i&&i.name==="AbortError"||"message"in i&&String(i.message).includes("FetchRequestCanceledException"))}const Ru=i=>{if(i instanceof Error)return i;if(typeof i=="object"&&i!==null){try{if(Object.prototype.toString.call(i)==="[object Error]"){const t=new Error(i.message,i.cause?{cause:i.cause}:{});return i.stack&&(t.stack=i.stack),i.cause&&!t.cause&&(t.cause=i.cause),i.name&&(t.name=i.name),t}}catch{}try{return new Error(JSON.stringify(i))}catch{}}return new Error(i)};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class qt extends Error{}class st extends qt{constructor(t,l,a,r){super(`${st.makeMessage(t,l,a)}`),this.status=t,this.headers=r,this.error=l}static makeMessage(t,l,a){const r=l!=null&&l.message?typeof l.message=="string"?l.message:JSON.stringify(l.message):l?JSON.stringify(l):a;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,l,a,r){if(!t||!r)return new Va({message:a,cause:Ru(l)});const f=l;return t===400?new cg(t,f,a,r):t===401?new fg(t,f,a,r):t===403?new dg(t,f,a,r):t===404?new pg(t,f,a,r):t===409?new mg(t,f,a,r):t===422?new hg(t,f,a,r):t===429?new gg(t,f,a,r):t>=500?new yg(t,f,a,r):new st(t,f,a,r)}}class Mu extends st{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class Va extends st{constructor({message:t,cause:l}){super(void 0,void 0,t||"Connection error.",void 0),l&&(this.cause=l)}}class ug extends Va{constructor({message:t}={}){super({message:t??"Request timed out."})}}class cg extends st{}class fg extends st{}class dg extends st{}class pg extends st{}class mg extends st{}class hg extends st{}class gg extends st{}class yg extends st{}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const LA=/^[a-z][a-z0-9+.-]*:/i,GA=i=>LA.test(i);let Nu=i=>(Nu=Array.isArray,Nu(i));const HA=Nu;let qA=HA;const Rh=qA;function VA(i){if(!i)return!0;for(const t in i)return!1;return!0}function zA(i,t){return Object.prototype.hasOwnProperty.call(i,t)}const BA=(i,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new qt(`${i} must be an integer`);if(t<0)throw new qt(`${i} must be a positive integer`);return t},PA=i=>{try{return JSON.parse(i)}catch{return}};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const kA=i=>new Promise(t=>setTimeout(t,i));/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Qi="0.0.1";/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function OA(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const FA=()=>{var i,t,l,a,r;const f=OA();if(f==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":Nh(Deno.build.os),"X-Stainless-Arch":Mh(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(t=(i=Deno.version)===null||i===void 0?void 0:i.deno)!==null&&t!==void 0?t:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(f==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":Nh((l=globalThis.process.platform)!==null&&l!==void 0?l:"unknown"),"X-Stainless-Arch":Mh((a=globalThis.process.arch)!==null&&a!==void 0?a:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(r=globalThis.process.version)!==null&&r!==void 0?r:"unknown"};const m=JA();return m?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${m.browser}`,"X-Stainless-Runtime-Version":m.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function JA(){if(typeof navigator>"u"||!navigator)return null;const i=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:l}of i){const a=l.exec(navigator.userAgent);if(a){const r=a[1]||0,f=a[2]||0,m=a[3]||0;return{browser:t,version:`${r}.${f}.${m}`}}}return null}const Mh=i=>i==="x32"?"x32":i==="x86_64"||i==="x64"?"x64":i==="arm"?"arm":i==="aarch64"||i==="arm64"?"arm64":i?`other:${i}`:"unknown",Nh=i=>(i=i.toLowerCase(),i.includes("ios")?"iOS":i==="android"?"Android":i==="darwin"?"MacOS":i==="win32"?"Windows":i==="freebsd"?"FreeBSD":i==="openbsd"?"OpenBSD":i==="linux"?"Linux":i?`Other:${i}`:"Unknown");let Ea;const YA=()=>Ea??(Ea=FA());/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function XA(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function vg(...i){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...i)}function KA(i){let t=Symbol.asyncIterator in i?i[Symbol.asyncIterator]():i[Symbol.iterator]();return vg({start(){},async pull(l){const{done:a,value:r}=await t.next();a?l.close():l.enqueue(r)},async cancel(){var l;await((l=t.return)===null||l===void 0?void 0:l.call(t))}})}function Tg(i){if(i[Symbol.asyncIterator])return i;const t=i.getReader();return{async next(){try{const l=await t.read();return l!=null&&l.done&&t.releaseLock(),l}catch(l){throw t.releaseLock(),l}},async return(){const l=t.cancel();return t.releaseLock(),await l,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function QA(i){var t,l;if(i===null||typeof i!="object")return;if(i[Symbol.asyncIterator]){await((l=(t=i[Symbol.asyncIterator]()).return)===null||l===void 0?void 0:l.call(t));return}const a=i.getReader(),r=a.cancel();a.releaseLock(),await r}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const ZA=({headers:i,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Sg=()=>{var i;if(typeof File>"u"){const{process:t}=globalThis,l=typeof((i=t==null?void 0:t.versions)===null||i===void 0?void 0:i.node)=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(l?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function pu(i,t,l){return Sg(),new File(i,t??"unknown_file",l)}function $A(i){return(typeof i=="object"&&i!==null&&("name"in i&&i.name&&String(i.name)||"url"in i&&i.url&&String(i.url)||"filename"in i&&i.filename&&String(i.filename)||"path"in i&&i.path&&String(i.path))||"").split(/[\\/]/).pop()||void 0}const WA=i=>i!=null&&typeof i=="object"&&typeof i[Symbol.asyncIterator]=="function";/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Eg=i=>i!=null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.type=="string"&&typeof i.text=="function"&&typeof i.slice=="function"&&typeof i.arrayBuffer=="function",jA=i=>i!=null&&typeof i=="object"&&typeof i.name=="string"&&typeof i.lastModified=="number"&&Eg(i),eR=i=>i!=null&&typeof i=="object"&&typeof i.url=="string"&&typeof i.blob=="function";async function tR(i,t,l){if(Sg(),i=await i,jA(i))return i instanceof File?i:pu([await i.arrayBuffer()],i.name);if(eR(i)){const r=await i.blob();return t||(t=new URL(i.url).pathname.split(/[\\/]/).pop()),pu(await Iu(r),t,l)}const a=await Iu(i);if(t||(t=$A(i)),!(l!=null&&l.type)){const r=a.find(f=>typeof f=="object"&&"type"in f&&f.type);typeof r=="string"&&(l=Object.assign(Object.assign({},l),{type:r}))}return pu(a,t,l)}async function Iu(i){var t,l,a,r,f;let m=[];if(typeof i=="string"||ArrayBuffer.isView(i)||i instanceof ArrayBuffer)m.push(i);else if(Eg(i))m.push(i instanceof Blob?i:await i.arrayBuffer());else if(WA(i))try{for(var g=!0,y=kt(i),h;h=await y.next(),t=h.done,!t;g=!0){r=h.value,g=!1;const v=r;m.push(...await Iu(v))}}catch(v){l={error:v}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(l)throw l.error}}else{const v=(f=i==null?void 0:i.constructor)===null||f===void 0?void 0:f.name;throw new Error(`Unexpected data type: ${typeof i}${v?`; constructor: ${v}`:""}${nR(i)}`)}return m}function nR(i){return typeof i!="object"||i===null?"":`; props: [${Object.getOwnPropertyNames(i).map(l=>`"${l}"`).join(", ")}]`}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class _g{constructor(t){this._client=t}}_g._key=[];/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Cg(i){return i.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const Ih=Object.freeze(Object.create(null)),iR=(i=Cg)=>(function(l,...a){if(l.length===1)return l[0];let r=!1;const f=[],m=l.reduce((v,S,E)=>{var C,U,H;/[?#]/.test(S)&&(r=!0);const b=a[E];let P=(r?encodeURIComponent:i)(""+b);return E!==a.length&&(b==null||typeof b=="object"&&b.toString===((H=Object.getPrototypeOf((U=Object.getPrototypeOf((C=b.hasOwnProperty)!==null&&C!==void 0?C:Ih))!==null&&U!==void 0?U:Ih))===null||H===void 0?void 0:H.toString))&&(P=b+"",f.push({start:v.length+S.length,length:P.length,error:`Value of type ${Object.prototype.toString.call(b).slice(8,-1)} is not a valid path parameter`})),v+S+(E===a.length?"":P)},""),g=m.split(/[?#]/,1)[0],y=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let h;for(;(h=y.exec(g))!==null;)f.push({start:h.index,length:h[0].length,error:`Value "${h[0]}" can't be safely passed as a path parameter`});if(f.sort((v,S)=>v.start-S.start),f.length>0){let v=0;const S=f.reduce((E,C)=>{const U=" ".repeat(C.start-v),H="^".repeat(C.length);return v=C.start+C.length,E+U+H},"");throw new qt(`Path parameters result in path with invalid segments: +${f.map(E=>E.error).join(` +`)} +${m} +${S}`)}return m}),_a=iR(Cg);/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Ag extends _g{create(t,l){var a;const{api_version:r=this._client.apiVersion}=t,f=Ua(t,["api_version"]);if("model"in f&&"agent_config"in f)throw new qt("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in f&&"generation_config"in f)throw new qt("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(_a`/${r}/interactions`,Object.assign(Object.assign({body:f},l),{stream:(a=t.stream)!==null&&a!==void 0?a:!1}))}delete(t,l={},a){const{api_version:r=this._client.apiVersion}=l??{};return this._client.delete(_a`/${r}/interactions/${t}`,a)}cancel(t,l={},a){const{api_version:r=this._client.apiVersion}=l??{};return this._client.post(_a`/${r}/interactions/${t}/cancel`,a)}get(t,l={},a){var r;const f=l??{},{api_version:m=this._client.apiVersion}=f,g=Ua(f,["api_version"]);return this._client.get(_a`/${m}/interactions/${t}`,Object.assign(Object.assign({query:g},a),{stream:(r=l==null?void 0:l.stream)!==null&&r!==void 0?r:!1}))}}Ag._key=Object.freeze(["interactions"]);class Rg extends Ag{}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function oR(i){let t=0;for(const r of i)t+=r.length;const l=new Uint8Array(t);let a=0;for(const r of i)l.set(r,a),a+=r.length;return l}let Ca;function zu(i){let t;return(Ca??(t=new globalThis.TextEncoder,Ca=t.encode.bind(t)))(i)}let Aa;function xh(i){let t;return(Aa??(t=new globalThis.TextDecoder,Aa=t.decode.bind(t)))(i)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class za{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(t){if(t==null)return[];const l=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?zu(t):t;this.buffer=oR([this.buffer,l]);const a=[];let r;for(;(r=lR(this.buffer,this.carriageReturnIndex))!=null;){if(r.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=r.index;continue}if(this.carriageReturnIndex!=null&&(r.index!==this.carriageReturnIndex+1||r.carriage)){a.push(xh(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}const f=this.carriageReturnIndex!==null?r.preceding-1:r.preceding,m=xh(this.buffer.subarray(0,f));a.push(m),this.buffer=this.buffer.subarray(r.index),this.carriageReturnIndex=null}return a}flush(){return this.buffer.length?this.decode(` +`):[]}}za.NEWLINE_CHARS=new Set([` +`,"\r"]);za.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function lR(i,t){for(let r=t??0;r{if(i){if(zA(wa,i))return i;at(l).warn(`${t} was set to ${JSON.stringify(i)}, expected one of ${JSON.stringify(Object.keys(wa))}`)}};function tl(){}function Ra(i,t,l){return!t||wa[i]>wa[l]?tl:t[i].bind(t)}const sR={error:tl,warn:tl,info:tl,debug:tl};let Uh=new WeakMap;function at(i){var t;const l=i.logger,a=(t=i.logLevel)!==null&&t!==void 0?t:"off";if(!l)return sR;const r=Uh.get(l);if(r&&r[0]===a)return r[1];const f={error:Ra("error",l,a),warn:Ra("warn",l,a),info:Ra("info",l,a),debug:Ra("debug",l,a)};return Uh.set(l,[a,f]),f}const ui=i=>(i.options&&(i.options=Object.assign({},i.options),delete i.options.headers),i.headers&&(i.headers=Object.fromEntries((i.headers instanceof Headers?[...i.headers]:Object.entries(i.headers)).map(([t,l])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":l]))),"retryOfRequestLogID"in i&&(i.retryOfRequestLogID&&(i.retryOf=i.retryOfRequestLogID),delete i.retryOfRequestLogID),i);/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class $i{constructor(t,l,a){this.iterator=t,this.controller=l,this.client=a}static fromSSEResponse(t,l,a){let r=!1;const f=a?at(a):console;function m(){return Pt(this,arguments,function*(){var y,h,v,S;if(r)throw new qt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var C=!0,U=kt(rR(t,l)),H;H=yield oe(U.next()),y=H.done,!y;C=!0){S=H.value,C=!1;const b=S;if(!E)if(b.data.startsWith("[DONE]")){E=!0;continue}else try{yield yield oe(JSON.parse(b.data))}catch(P){throw f.error("Could not parse message into JSON:",b.data),f.error("From chunk:",b.raw),P}}}catch(b){h={error:b}}finally{try{!C&&!y&&(v=U.return)&&(yield oe(v.call(U)))}finally{if(h)throw h.error}}E=!0}catch(b){if(Au(b))return yield oe(void 0);throw b}finally{E||l.abort()}})}return new $i(m,l,a)}static fromReadableStream(t,l,a){let r=!1;function f(){return Pt(this,arguments,function*(){var y,h,v,S;const E=new za,C=Tg(t);try{for(var U=!0,H=kt(C),b;b=yield oe(H.next()),y=b.done,!y;U=!0){S=b.value,U=!1;const P=S;for(const X of E.decode(P))yield yield oe(X)}}catch(P){h={error:P}}finally{try{!U&&!y&&(v=H.return)&&(yield oe(v.call(H)))}finally{if(h)throw h.error}}for(const P of E.flush())yield yield oe(P)})}function m(){return Pt(this,arguments,function*(){var y,h,v,S;if(r)throw new qt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var C=!0,U=kt(f()),H;H=yield oe(U.next()),y=H.done,!y;C=!0){S=H.value,C=!1;const b=S;E||b&&(yield yield oe(JSON.parse(b)))}}catch(b){h={error:b}}finally{try{!C&&!y&&(v=U.return)&&(yield oe(v.call(U)))}finally{if(h)throw h.error}}E=!0}catch(b){if(Au(b))return yield oe(void 0);throw b}finally{E||l.abort()}})}return new $i(m,l,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],l=[],a=this.iterator(),r=f=>({next:()=>{if(f.length===0){const m=a.next();t.push(m),l.push(m)}return f.shift()}});return[new $i(()=>r(t),this.controller,this.client),new $i(()=>r(l),this.controller,this.client)]}toReadableStream(){const t=this;let l;return vg({async start(){l=t[Symbol.asyncIterator]()},async pull(a){try{const{value:r,done:f}=await l.next();if(f)return a.close();const m=zu(JSON.stringify(r)+` +`);a.enqueue(m)}catch(r){a.error(r)}},async cancel(){var a;await((a=l.return)===null||a===void 0?void 0:a.call(l))}})}}function rR(i,t){return Pt(this,arguments,function*(){var a,r,f,m;if(!i.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new qt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new qt("Attempted to iterate over a response with no body");const g=new cR,y=new za,h=Tg(i.body);try{for(var v=!0,S=kt(uR(h)),E;E=yield oe(S.next()),a=E.done,!a;v=!0){m=E.value,v=!1;const C=m;for(const U of y.decode(C)){const H=g.decode(U);H&&(yield yield oe(H))}}}catch(C){r={error:C}}finally{try{!v&&!a&&(f=S.return)&&(yield oe(f.call(S)))}finally{if(r)throw r.error}}for(const C of y.flush()){const U=g.decode(C);U&&(yield yield oe(U))}})}function uR(i){return Pt(this,arguments,function*(){var l,a,r,f;let m=new Uint8Array;try{for(var g=!0,y=kt(i),h;h=yield oe(y.next()),l=h.done,!l;g=!0){f=h.value,g=!1;const v=f;if(v==null)continue;const S=v instanceof ArrayBuffer?new Uint8Array(v):typeof v=="string"?zu(v):v;let E=new Uint8Array(m.length+S.length);E.set(m),E.set(S,m.length),m=E;let C;for(;(C=aR(m))!==-1;)yield yield oe(m.slice(0,C)),m=m.slice(C)}}catch(v){a={error:v}}finally{try{!g&&!l&&(r=y.return)&&(yield oe(r.call(y)))}finally{if(a)throw a.error}}m.length>0&&(yield yield oe(m))})}class cR{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;const f={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],f}if(this.chunks.push(t),t.startsWith(":"))return null;let[l,a,r]=fR(t,":");return r.startsWith(" ")&&(r=r.substring(1)),l==="event"?this.event=r:l==="data"&&this.data.push(r),null}}function fR(i,t){const l=i.indexOf(t);return l!==-1?[i.substring(0,l),t,i.substring(l+t.length)]:[i,"",""]}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */async function dR(i,t){const{response:l,requestLogID:a,retryOfRequestLogID:r,startTime:f}=t,m=await(async()=>{var g;if(t.options.stream)return at(i).debug("response",l.status,l.url,l.headers,l.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(l,t.controller,i):$i.fromSSEResponse(l,t.controller,i);if(l.status===204)return null;if(t.options.__binaryResponse)return l;const y=l.headers.get("content-type"),h=(g=y==null?void 0:y.split(";")[0])===null||g===void 0?void 0:g.trim();return(h==null?void 0:h.includes("application/json"))||(h==null?void 0:h.endsWith("+json"))?await l.json():await l.text()})();return at(i).debug(`[${a}] response parsed`,ui({retryOfRequestLogID:r,url:l.url,status:l.status,body:m,durationMs:Date.now()-f})),m}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Bu extends Promise{constructor(t,l,a=dR){super(r=>{r(null)}),this.responsePromise=l,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new Bu(this.client,this.responsePromise,async(l,a)=>t(await this.parseResponse(l,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){const[t,l]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:l}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,l){return this.parse().then(t,l)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Mg=Symbol("brand.privateNullableHeaders");function*pR(i){if(!i)return;if(Mg in i){const{values:a,nulls:r}=i;yield*a.entries();for(const f of r)yield[f,null];return}let t=!1,l;i instanceof Headers?l=i.entries():Rh(i)?l=i:(t=!0,l=Object.entries(i??{}));for(let a of l){const r=a[0];if(typeof r!="string")throw new TypeError("expected header name to be a string");const f=Rh(a[1])?a[1]:[a[1]];let m=!1;for(const g of f)g!==void 0&&(t&&!m&&(m=!0,yield[r,null]),yield[r,g])}}const el=i=>{const t=new Headers,l=new Set;for(const a of i){const r=new Set;for(const[f,m]of pR(a)){const g=f.toLowerCase();r.has(g)||(t.delete(f),r.add(g)),m===null?(t.delete(f),l.add(g)):(t.append(f,m),l.delete(g))}}return{[Mg]:!0,values:t,nulls:l}};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const mu=i=>{var t,l,a,r,f,m;if(typeof globalThis.process<"u")return(a=(l=(t=z0)===null||t===void 0?void 0:t[i])===null||l===void 0?void 0:l.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(m=(f=(r=globalThis.Deno.env)===null||r===void 0?void 0:r.get)===null||f===void 0?void 0:f.call(r,i))===null||m===void 0?void 0:m.trim()};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var Ng;class Ba{constructor(t){var l,a,r,f,m,g,y,{baseURL:h=mu("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:v=(l=mu("GEMINI_API_KEY"))!==null&&l!==void 0?l:null,apiVersion:S="v1beta"}=t,E=Ua(t,["baseURL","apiKey","apiVersion"]);const C=Object.assign(Object.assign({apiKey:v,apiVersion:S},E),{baseURL:h||"https://generativelanguage.googleapis.com"});this.baseURL=C.baseURL,this.timeout=(a=C.timeout)!==null&&a!==void 0?a:Ba.DEFAULT_TIMEOUT,this.logger=(r=C.logger)!==null&&r!==void 0?r:console;const U="warn";this.logLevel=U,this.logLevel=(m=(f=Dh(C.logLevel,"ClientOptions.logLevel",this))!==null&&f!==void 0?f:Dh(mu("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&m!==void 0?m:U,this.fetchOptions=C.fetchOptions,this.maxRetries=(g=C.maxRetries)!==null&&g!==void 0?g:2,this.fetch=(y=C.fetch)!==null&&y!==void 0?y:XA(),this.encoder=ZA,this._options=C,this.apiKey=v,this.apiVersion=S,this.clientAdapter=C.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:l}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!l.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){const l=el([t.headers]);if(!(l.values.has("authorization")||l.values.has("x-goog-api-key"))){if(this.apiKey)return el([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return el([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([l,a])=>typeof a<"u").map(([l,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(l)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(l)}=`;throw new qt(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${Qi}`}defaultIdempotencyKey(){return`stainless-node-retry-${bA()}`}makeStatusError(t,l,a,r){return st.generate(t,l,a,r)}buildURL(t,l,a){const r=!this.baseURLOverridden()&&a||this.baseURL,f=GA(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),m=this.defaultQuery();return VA(m)||(l=Object.assign(Object.assign({},m),l)),typeof l=="object"&&l&&!Array.isArray(l)&&(f.search=this.stringifyQuery(l)),f.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){const l=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${l}`}}async prepareRequest(t,{url:l,options:a}){}get(t,l){return this.methodRequest("get",t,l)}post(t,l){return this.methodRequest("post",t,l)}patch(t,l){return this.methodRequest("patch",t,l)}put(t,l){return this.methodRequest("put",t,l)}delete(t,l){return this.methodRequest("delete",t,l)}methodRequest(t,l,a){return this.request(Promise.resolve(a).then(r=>Object.assign({method:t,path:l},r)))}request(t,l=null){return new Bu(this,this.makeRequest(t,l,void 0))}async makeRequest(t,l,a){var r,f,m;const g=await t,y=(r=g.maxRetries)!==null&&r!==void 0?r:this.maxRetries;l==null&&(l=y),await this.prepareOptions(g);const{req:h,url:v,timeout:S}=await this.buildRequest(g,{retryCount:y-l});await this.prepareRequest(h,{url:v,options:g});const E="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),C=a===void 0?"":`, retryOf: ${a}`,U=Date.now();if(at(this).debug(`[${E}] sending request`,ui({retryOfRequestLogID:a,method:g.method,url:v,options:g,headers:h.headers})),!((f=g.signal)===null||f===void 0)&&f.aborted)throw new Mu;const H=new AbortController,b=await this.fetchWithTimeout(v,h,S,H).catch(Ru),P=Date.now();if(b instanceof globalThis.Error){const k=`retrying, ${l} attempts remaining`;if(!((m=g.signal)===null||m===void 0)&&m.aborted)throw new Mu;const K=Au(b)||/timed? ?out/i.test(String(b)+("cause"in b?String(b.cause):""));if(l)return at(this).info(`[${E}] connection ${K?"timed out":"failed"} - ${k}`),at(this).debug(`[${E}] connection ${K?"timed out":"failed"} (${k})`,ui({retryOfRequestLogID:a,url:v,durationMs:P-U,message:b.message})),this.retryRequest(g,l,a??E);throw at(this).info(`[${E}] connection ${K?"timed out":"failed"} - error; no more retries left`),at(this).debug(`[${E}] connection ${K?"timed out":"failed"} (error; no more retries left)`,ui({retryOfRequestLogID:a,url:v,durationMs:P-U,message:b.message})),K?new ug:new Va({cause:b})}const X=`[${E}${C}] ${h.method} ${v} ${b.ok?"succeeded":"failed"} with status ${b.status} in ${P-U}ms`;if(!b.ok){const k=await this.shouldRetry(b);if(l&&k){const W=`retrying, ${l} attempts remaining`;return await QA(b.body),at(this).info(`${X} - ${W}`),at(this).debug(`[${E}] response error (${W})`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,durationMs:P-U})),this.retryRequest(g,l,a??E,b.headers)}const K=k?"error; no more retries left":"error; not retryable";at(this).info(`${X} - ${K}`);const ee=await b.text().catch(W=>Ru(W).message),te=PA(ee),F=te?void 0:ee;throw at(this).debug(`[${E}] response error (${K})`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,message:F,durationMs:Date.now()-U})),this.makeStatusError(b.status,te,F,b.headers)}return at(this).info(X),at(this).debug(`[${E}] response start`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,durationMs:P-U})),{response:b,options:g,controller:H,requestLogID:E,retryOfRequestLogID:a,startTime:U}}async fetchWithTimeout(t,l,a,r){const f=l||{},{signal:m,method:g}=f,y=Ua(f,["signal","method"]);m&&m.addEventListener("abort",()=>r.abort());const h=setTimeout(()=>r.abort(),a),v=globalThis.ReadableStream&&y.body instanceof globalThis.ReadableStream||typeof y.body=="object"&&y.body!==null&&Symbol.asyncIterator in y.body,S=Object.assign(Object.assign(Object.assign({signal:r.signal},v?{duplex:"half"}:{}),{method:"GET"}),y);g&&(S.method=g.toUpperCase());try{return await this.fetch.call(void 0,t,S)}finally{clearTimeout(h)}}async shouldRetry(t){const l=t.headers.get("x-should-retry");return l==="true"?!0:l==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,l,a,r){var f;let m;const g=r==null?void 0:r.get("retry-after-ms");if(g){const h=parseFloat(g);Number.isNaN(h)||(m=h)}const y=r==null?void 0:r.get("retry-after");if(y&&!m){const h=parseFloat(y);Number.isNaN(h)?m=Date.parse(y)-Date.now():m=h*1e3}if(!(m&&0<=m&&m<60*1e3)){const h=(f=t.maxRetries)!==null&&f!==void 0?f:this.maxRetries;m=this.calculateDefaultRetryTimeoutMillis(l,h)}return await kA(m),this.makeRequest(t,l-1,a)}calculateDefaultRetryTimeoutMillis(t,l){const f=l-t,m=Math.min(.5*Math.pow(2,f),8),g=1-Math.random()*.25;return m*g*1e3}async buildRequest(t,{retryCount:l=0}={}){var a,r,f;const m=Object.assign({},t),{method:g,path:y,query:h,defaultBaseURL:v}=m,S=this.buildURL(y,h,v);"timeout"in m&&BA("timeout",m.timeout),m.timeout=(a=m.timeout)!==null&&a!==void 0?a:this.timeout;const{bodyHeaders:E,body:C}=this.buildBody({options:m}),U=await this.buildHeaders({options:t,method:g,bodyHeaders:E,retryCount:l});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:g,headers:U},m.signal&&{signal:m.signal}),globalThis.ReadableStream&&C instanceof globalThis.ReadableStream&&{duplex:"half"}),C&&{body:C}),(r=this.fetchOptions)!==null&&r!==void 0?r:{}),(f=m.fetchOptions)!==null&&f!==void 0?f:{}),url:S,timeout:m.timeout}}async buildHeaders({options:t,method:l,bodyHeaders:a,retryCount:r}){let f={};this.idempotencyHeader&&l!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),f[this.idempotencyHeader]=t.idempotencyKey);const m=await this.authHeaders(t);let g=el([f,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),YA()),this._options.defaultHeaders,a,t.headers,m]);return this.validateHeaders(g),g.values}buildBody({options:{body:t,headers:l}}){if(!t)return{bodyHeaders:void 0,body:void 0};const a=el([l]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:KA(t)}:this.encoder({body:t,headers:a})}}Ba.DEFAULT_TIMEOUT=6e4;class Qe extends Ba{constructor(){super(...arguments),this.interactions=new Rg(this)}}Ng=Qe;Qe.GeminiNextGenAPIClient=Ng;Qe.GeminiNextGenAPIClientError=qt;Qe.APIError=st;Qe.APIConnectionError=Va;Qe.APIConnectionTimeoutError=ug;Qe.APIUserAbortError=Mu;Qe.NotFoundError=pg;Qe.ConflictError=mg;Qe.RateLimitError=gg;Qe.BadRequestError=cg;Qe.AuthenticationError=fg;Qe.InternalServerError=yg;Qe.PermissionDeniedError=dg;Qe.UnprocessableEntityError=hg;Qe.toFile=tR;Qe.Interactions=Rg;/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function mR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function hR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function gR(i,t){const l={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(l,["sdkHttpResponse"],a),l}function yR(i,t){const l={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(l,["sdkHttpResponse"],a),l}function vR(i,t,l){const a={};if(u(i,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const r=u(i,["tunedModelDisplayName"]);if(t!==void 0&&r!=null&&c(t,["displayName"],r),u(i,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const f=u(i,["epochCount"]);t!==void 0&&f!=null&&c(t,["tuningTask","hyperparameters","epochCount"],f);const m=u(i,["learningRateMultiplier"]);if(m!=null&&c(a,["tuningTask","hyperparameters","learningRateMultiplier"],m),u(i,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(u(i,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(u(i,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const g=u(i,["batchSize"]);t!==void 0&&g!=null&&c(t,["tuningTask","hyperparameters","batchSize"],g);const y=u(i,["learningRate"]);if(t!==void 0&&y!=null&&c(t,["tuningTask","hyperparameters","learningRate"],y),u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(u(i,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return a}function TR(i,t,l){const a={};let r=u(l,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const C=u(i,["validationDataset"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec"],wh(C))}else if(r==="PREFERENCE_TUNING"){const C=u(i,["validationDataset"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec"],wh(C))}const f=u(i,["tunedModelDisplayName"]);t!==void 0&&f!=null&&c(t,["tunedModelDisplayName"],f);const m=u(i,["description"]);t!==void 0&&m!=null&&c(t,["description"],m);let g=u(l,["config","method"]);if(g===void 0&&(g="SUPERVISED_FINE_TUNING"),g==="SUPERVISED_FINE_TUNING"){const C=u(i,["epochCount"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","epochCount"],C)}else if(g==="PREFERENCE_TUNING"){const C=u(i,["epochCount"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],C)}let y=u(l,["config","method"]);if(y===void 0&&(y="SUPERVISED_FINE_TUNING"),y==="SUPERVISED_FINE_TUNING"){const C=u(i,["learningRateMultiplier"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],C)}else if(y==="PREFERENCE_TUNING"){const C=u(i,["learningRateMultiplier"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],C)}let h=u(l,["config","method"]);if(h===void 0&&(h="SUPERVISED_FINE_TUNING"),h==="SUPERVISED_FINE_TUNING"){const C=u(i,["exportLastCheckpointOnly"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","exportLastCheckpointOnly"],C)}else if(h==="PREFERENCE_TUNING"){const C=u(i,["exportLastCheckpointOnly"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],C)}let v=u(l,["config","method"]);if(v===void 0&&(v="SUPERVISED_FINE_TUNING"),v==="SUPERVISED_FINE_TUNING"){const C=u(i,["adapterSize"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","adapterSize"],C)}else if(v==="PREFERENCE_TUNING"){const C=u(i,["adapterSize"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],C)}if(u(i,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(u(i,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const S=u(i,["labels"]);t!==void 0&&S!=null&&c(t,["labels"],S);const E=u(i,["beta"]);return t!==void 0&&E!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","beta"],E),a}function SR(i,t){const l={},a=u(i,["baseModel"]);a!=null&&c(l,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(l,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&UR(f);const m=u(i,["config"]);return m!=null&&vR(m,l),l}function ER(i,t){const l={},a=u(i,["baseModel"]);a!=null&&c(l,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(l,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&wR(f,l,t);const m=u(i,["config"]);return m!=null&&TR(m,l,t),l}function _R(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function CR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function AR(i,t,l){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const m=u(i,["filter"]);return t!==void 0&&m!=null&&c(t,["_query","filter"],m),a}function RR(i,t,l){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const m=u(i,["filter"]);return t!==void 0&&m!=null&&c(t,["_query","filter"],m),a}function MR(i,t){const l={},a=u(i,["config"]);return a!=null&&AR(a,l),l}function NR(i,t){const l={},a=u(i,["config"]);return a!=null&&RR(a,l),l}function IR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(l,["nextPageToken"],r);const f=u(i,["tunedModels"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>Ig(g))),c(l,["tuningJobs"],m)}return l}function xR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(l,["nextPageToken"],r);const f=u(i,["tuningJobs"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>xu(g))),c(l,["tuningJobs"],m)}return l}function DR(i,t){const l={},a=u(i,["name"]);a!=null&&c(l,["model"],a);const r=u(i,["name"]);return r!=null&&c(l,["endpoint"],r),l}function UR(i,t){const l={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(i,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const a=u(i,["examples"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(l,["examples","examples"],r)}return l}function wR(i,t,l){const a={};let r=u(l,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const m=u(i,["gcsUri"]);t!==void 0&&m!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],m)}else if(r==="PREFERENCE_TUNING"){const m=u(i,["gcsUri"]);t!==void 0&&m!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],m)}let f=u(l,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){const m=u(i,["vertexDatasetResource"]);t!==void 0&&m!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],m)}else if(f==="PREFERENCE_TUNING"){const m=u(i,["vertexDatasetResource"]);t!==void 0&&m!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],m)}if(u(i,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return a}function Ig(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["state"]);f!=null&&c(l,["state"],Fh(f));const m=u(i,["createTime"]);m!=null&&c(l,["createTime"],m);const g=u(i,["tuningTask","startTime"]);g!=null&&c(l,["startTime"],g);const y=u(i,["tuningTask","completeTime"]);y!=null&&c(l,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(l,["updateTime"],h);const v=u(i,["description"]);v!=null&&c(l,["description"],v);const S=u(i,["baseModel"]);S!=null&&c(l,["baseModel"],S);const E=u(i,["_self"]);return E!=null&&c(l,["tunedModel"],DR(E)),l}function xu(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["state"]);f!=null&&c(l,["state"],Fh(f));const m=u(i,["createTime"]);m!=null&&c(l,["createTime"],m);const g=u(i,["startTime"]);g!=null&&c(l,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(l,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(l,["updateTime"],h);const v=u(i,["error"]);v!=null&&c(l,["error"],v);const S=u(i,["description"]);S!=null&&c(l,["description"],S);const E=u(i,["baseModel"]);E!=null&&c(l,["baseModel"],E);const C=u(i,["tunedModel"]);C!=null&&c(l,["tunedModel"],C);const U=u(i,["preTunedModel"]);U!=null&&c(l,["preTunedModel"],U);const H=u(i,["supervisedTuningSpec"]);H!=null&&c(l,["supervisedTuningSpec"],H);const b=u(i,["preferenceOptimizationSpec"]);b!=null&&c(l,["preferenceOptimizationSpec"],b);const P=u(i,["tuningDataStats"]);P!=null&&c(l,["tuningDataStats"],P);const X=u(i,["encryptionSpec"]);X!=null&&c(l,["encryptionSpec"],X);const k=u(i,["partnerModelTuningSpec"]);k!=null&&c(l,["partnerModelTuningSpec"],k);const K=u(i,["customBaseModel"]);K!=null&&c(l,["customBaseModel"],K);const ee=u(i,["experiment"]);ee!=null&&c(l,["experiment"],ee);const te=u(i,["labels"]);te!=null&&c(l,["labels"],te);const F=u(i,["outputUri"]);F!=null&&c(l,["outputUri"],F);const he=u(i,["pipelineJob"]);he!=null&&c(l,["pipelineJob"],he);const W=u(i,["serviceAccount"]);W!=null&&c(l,["serviceAccount"],W);const de=u(i,["tunedModelDisplayName"]);de!=null&&c(l,["tunedModelDisplayName"],de);const Ce=u(i,["veoTuningSpec"]);return Ce!=null&&c(l,["veoTuningSpec"],Ce),l}function bR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["metadata"]);f!=null&&c(l,["metadata"],f);const m=u(i,["done"]);m!=null&&c(l,["done"],m);const g=u(i,["error"]);return g!=null&&c(l,["error"],g),l}function wh(i,t){const l={},a=u(i,["gcsUri"]);a!=null&&c(l,["validationDatasetUri"],a);const r=u(i,["vertexDatasetResource"]);return r!=null&&c(l,["validationDatasetUri"],r),l}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class LR extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_TUNING_JOBS,a=>this.listInternal(a),await this.listInternal(l),l),this.get=async l=>await this.getInternal(l),this.tune=async l=>{var a;if(this.apiClient.isVertexAI())if(l.baseModel.startsWith("projects/")){const r={tunedModelName:l.baseModel};!((a=l.config)===null||a===void 0)&&a.preTunedModelCheckpointId&&(r.checkpointId=l.config.preTunedModelCheckpointId);const f=Object.assign(Object.assign({},l),{preTunedModel:r});return f.baseModel=void 0,await this.tuneInternal(f)}else{const r=Object.assign({},l);return await this.tuneInternal(r)}else{const r=Object.assign({},l),f=await this.tuneMldevInternal(r);let m="";return f.metadata!==void 0&&f.metadata.tunedModel!==void 0?m=f.metadata.tunedModel:f.name!==void 0&&f.name.includes("/operations/")&&(m=f.name.split("/operations/")[0]),{name:m,state:yu.JOB_STATE_QUEUED}}}}async getInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=CR(t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>xu(v))}else{const h=_R(t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>Ig(v))}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=NR(t);return g=Y("tuningJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=xR(v),E=new oh;return Object.assign(E,S),E})}else{const h=MR(t);return g=Y("tunedModels",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=IR(v),E=new oh;return Object.assign(E,S),E})}}async cancel(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=hR(t);return g=Y("{name}:cancel",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=yR(v),E=new lh;return Object.assign(E,S),E})}else{const h=mR(t);return g=Y("{name}:cancel",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=gR(v),E=new lh;return Object.assign(E,S),E})}}async tuneInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=ER(t,t);return f=Y("tuningJobs",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>xu(y))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=SR(t);return f=Y("tunedModels",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>bR(y))}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class GR{async download(t,l){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an tag.")}}const HR=1024*1024*8,qR=3,VR=1e3,zR=2,ba="x-goog-upload-status";async function BR(i,t,l){var a;const r=await xg(i,t,l),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[ba])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function PR(i,t,l){var a;const r=await xg(i,t,l),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[ba])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const m=Vh(f),g=new bu;return Object.assign(g,m),g}async function xg(i,t,l){var a,r;let f=0,m=0,g=new vu(new Response),y="upload";for(f=i.size;m=f&&(y+=", finalize");let S=0,E=VR;for(;SsetTimeout(t,i))}class FR{async upload(t,l,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await BR(t,l,a)}async uploadToFileSearchStore(t,l,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await PR(t,l,a)}async stat(t){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await kR(t)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class JR{create(t,l,a){return new YR(t,l,a)}}class YR{constructor(t,l,a){this.url=t,this.headers=l,this.callbacks=a}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(t){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(t)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const bh="x-goog-api-key";class XR{constructor(t){this.apiKey=t}async addAuthHeaders(t,l){if(t.get(bh)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");t.append(bh,this.apiKey)}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const KR="gl-node/";class QR{get interactions(){if(this._interactions!==void 0)return this._interactions;console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.");const t=this.httpOptions;t!=null&&t.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");const l=new Qe({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:t==null?void 0:t.timeout});return this._interactions=l.interactions,this._interactions}constructor(t){var l;if(t.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(t.project||t.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(l=t.vertexai)!==null&&l!==void 0?l:!1,this.apiKey=t.apiKey;const a=O0(t.httpOptions,t.vertexai,void 0,void 0);a&&(t.httpOptions?t.httpOptions.baseUrl=a:t.httpOptions={baseUrl:a}),this.apiVersion=t.apiVersion,this.httpOptions=t.httpOptions;const r=new XR(this.apiKey);this.apiClient=new kC({auth:r,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:KR+"web",uploader:new FR,downloader:new GR}),this.models=new sA(this.apiClient),this.live=new tA(this.apiClient,r,new JR),this.batches=new vS(this.apiClient),this.chats=new jS(this.models,this.apiClient),this.caches=new ZS(this.apiClient),this.files=new uE(this.apiClient),this.operations=new rA(this.apiClient),this.authTokens=new AA(this.apiClient),this.tunings=new LR(this.apiClient),this.fileSearchStores=new wA(this.apiClient)}}const ZR=()=>{const i="PLACEHOLDER_API_KEY";return new QR({apiKey:i})},$R=async(i,t)=>{const l=ZR();if(!l)return"错误: 未配置 API Key";try{const a=`Act as a creative songwriter assistant. + User is submitting lyrics for a song. + Song Style: ${t} + User Input (Title or Draft Lyrics): ${i} + + Task: Write or polish short song lyrics (about 4-8 lines) in Chinese based on the input. + Make it poetic and fitting for the style. + Return ONLY the lyrics text.`;return(await l.models.generateContent({model:"gemini-2.5-flash",contents:a})).text||"暂时无法生成歌词,请稍后重试。"}catch(a){return console.error("Gemini API Error:",a),"抱歉,AI 灵感枯竭了,请重试。"}},WR=({onSubmit:i,initialValues:t})=>{const[l,a]=nt.useState({title:(t==null?void 0:t.title)||"",lyrics:(t==null?void 0:t.lyrics)||"",style:(t==null?void 0:t.style)||"",nickname:(t==null?void 0:t.nickname)||""}),[r,f]=nt.useState(!1),[m,g]=nt.useState(!1),y=async()=>{if(!l.title&&!l.lyrics){alert("请至少输入歌名或一点歌词内容!");return}f(!0);const v=await $R(l.title+(l.lyrics?` Content: ${l.lyrics}`:""),l.style||"流行");a(S=>({...S,lyrics:v})),f(!1)},h=v=>{v.preventDefault(),g(!0);const S={...l,nickname:l.nickname.trim()===""?"音乐共创人":l.nickname};i(S)};return B.jsxs("div",{className:"space-y-6",children:[B.jsxs("div",{className:"text-center mb-4",children:[B.jsxs("h2",{className:"text-xl font-black text-brand-dark flex items-center justify-center gap-2",children:[B.jsx(R0,{className:"w-6 h-6 text-brand-red"}),"填写报名信息"]}),B.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"写下你的歌,我们一起唱"})]}),B.jsxs("form",{onSubmit:h,className:"space-y-5",children:[B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["你的昵称 ",B.jsx("span",{className:"text-[10px] font-normal text-gray-400 bg-gray-100 px-1.5 py-0.5 rounded ml-1",children:"选填"})]}),B.jsx("input",{type:"text",value:l.nickname,onChange:v=>a({...l,nickname:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"例如: 阳光天地的朋友"})]}),B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["歌曲风格 ",B.jsx("span",{className:"text-brand-red",children:"*"})]}),B.jsx("input",{type:"text",required:!0,value:l.style,onChange:v=>a({...l,style:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"例如: 温暖感动、R&B、摇滚..."})]}),B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["歌曲名称 ",B.jsx("span",{className:"text-brand-red",children:"*"})]}),B.jsx("input",{type:"text",required:!0,value:l.title,onChange:v=>a({...l,title:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"为你的歌起个名字吧..."})]}),B.jsxs("div",{className:"relative",children:[B.jsxs("div",{className:"flex justify-between items-center mb-1 ml-1",children:[B.jsx("label",{className:"block text-xs font-bold text-gray-500",children:"歌词内容"}),B.jsxs("button",{type:"button",onClick:y,disabled:r,className:"flex items-center gap-1.5 text-[10px] font-bold text-brand-orange hover:text-brand-red transition-colors disabled:opacity-50",children:[B.jsx(qh,{className:"w-3 h-3"}),r?"AI 生成中...":"AI 帮我写词"]})]}),B.jsx("textarea",{required:!0,rows:5,value:l.lyrics,onChange:v=>a({...l,lyrics:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all text-sm leading-relaxed placeholder-gray-400 resize-none",placeholder:"写下你想说的话,或者具体的歌词..."})]}),B.jsx("button",{type:"submit",disabled:m||r,className:"w-full mt-6 bg-gradient-to-r from-brand-orange to-brand-red text-white font-bold py-4 rounded-xl shadow-lg shadow-brand-orange/30 flex items-center justify-center gap-2 hover:scale-[1.02] transition-all active:scale-95",children:m?B.jsx(Hh,{className:"animate-spin"}):B.jsxs(B.Fragment,{children:[B.jsx(U0,{className:"w-4 h-4"})," 确认提交报名"]})})]})]})},jR=({song:i})=>B.jsxs("div",{className:"space-y-6",children:[B.jsxs("div",{className:"text-center mb-4",children:[B.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-100 border border-green-200 text-green-600 text-xs font-bold mb-4 animate-bounce",children:[B.jsx(S0,{className:"w-4 h-4"})," 提交成功"]}),B.jsx("h2",{className:"text-1xl font-black text-brand-dark",children:"请截图保存下方凭证,等待工作人员联系"}),B.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"您的创作已收录,快来现场一起畅聊吧"})]}),B.jsxs("div",{className:"relative bg-orange-50 rounded-2xl border-2 border-brand-orange/20 overflow-hidden shadow-sm group",children:[B.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-5",children:B.jsx(N0,{className:"w-24 h-24 text-brand-orange"})}),B.jsxs("div",{className:"p-6 relative z-10",children:[B.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[B.jsx("div",{className:"w-10 h-10 rounded-full bg-white border border-brand-orange/20 flex items-center justify-center shadow-sm",children:B.jsx(H0,{className:"w-5 h-5 text-brand-orange"})}),B.jsxs("div",{children:[B.jsx("div",{className:"text-xs text-gray-400",children:"来自共创人"}),B.jsx("div",{className:"font-bold text-gray-800",children:i.nickname})]}),B.jsx("div",{className:"ml-auto bg-brand-orange/10 text-brand-orange px-2 py-1 rounded text-[10px] font-bold",children:i.style})]}),B.jsxs("div",{className:"bg-white rounded-xl p-4 shadow-sm border border-brand-orange/10 mb-4",children:[B.jsxs("h3",{className:"text-sm font-bold text-brand-dark mb-2 flex items-center gap-2 min-w-0",children:[B.jsx(qh,{className:"w-3.5 h-3.5 text-brand-yellow"}),B.jsx("span",{className:"flex-1 truncate",children:i.title})]}),B.jsxs("p",{className:"text-sm text-gray-600 italic leading-relaxed whitespace-pre-wrap",children:['"',i.lyrics,'"']})]}),B.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400 border-t border-brand-orange/10 pt-4",children:[B.jsxs("div",{className:"flex items-center gap-1",children:[B.jsx("span",{children:"凭证编号:"}),B.jsx("span",{className:"font-mono text-brand-orange",children:i.ticketNumber||"PENDING"})]}),B.jsx("div",{className:"flex items-center gap-1",children:B.jsx(_0,{className:"w-3.5 h-3.5"})})]})]})]}),B.jsxs("button",{onClick:()=>{localStorage.removeItem("ai_song_fest_songs"),window.location.reload()},className:"w-full py-4 text-xs text-gray-400 hover:text-brand-orange transition-colors flex items-center justify-center gap-2 group",children:[B.jsx(x0,{className:"w-3 h-3 group-hover:rotate-180 transition-transform duration-500"}),"提交新的报名"]})]});function eM(){const[i,t]=nt.useState("loading"),[l,a]=nt.useState(null),[r,f]=nt.useState(null);nt.useEffect(()=>{(async()=>{const v=hu.getCurrentUser();if(!v){t("login");return}a(v);const S=await Sa.getSongByPhone(v.phone);S?(f(S),t("result")):t("form")})()},[]);const m=async()=>{const h=hu.getCurrentUser();if(a(h),h){const v=await Sa.getSongByPhone(h.phone);v?(f(v),t("result")):t("form")}},g=async h=>{if(!l)return;const v=await Sa.submitSong(l.phone,h);f(v),t("result")},y=async()=>{if(l){const h=await Sa.getSongByPhone(l.phone);h&&f(h)}};return i==="loading"?B.jsx(jp,{children:B.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-white",children:[B.jsx("div",{className:"w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin"}),B.jsx("p",{className:"mt-6 text-sm font-bold tracking-widest animate-pulse",children:"正在进入..."})]})}):B.jsxs(jp,{children:[i==="login"&&B.jsx(V0,{onLoginSuccess:m}),i==="form"&&B.jsx(WR,{onSubmit:g}),i==="result"&&r&&B.jsx(jR,{song:r,onRefresh:y})]})}const Dg=document.getElementById("root");if(!Dg)throw new Error("Could not find root element to mount to");const tM=f0.createRoot(Dg);tM.render(B.jsx(i0.StrictMode,{children:B.jsx(eM,{})})); diff --git a/h5/together/assets/index-CketmARB.js b/h5/together/assets/index-CketmARB.js new file mode 100755 index 0000000..9bf29f1 --- /dev/null +++ b/h5/together/assets/index-CketmARB.js @@ -0,0 +1,374 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const f of r)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&a(m)}).observe(document,{childList:!0,subtree:!0});function l(r){const f={};return r.integrity&&(f.integrity=r.integrity),r.referrerPolicy&&(f.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?f.credentials="include":r.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(r){if(r.ep)return;r.ep=!0;const f=l(r);fetch(r.href,f)}})();function Lh(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var lu={exports:{}},$o={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Op;function e0(){if(Op)return $o;Op=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function l(a,r,f){var m=null;if(f!==void 0&&(m=""+f),r.key!==void 0&&(m=""+r.key),"key"in r){f={};for(var g in r)g!=="key"&&(f[g]=r[g])}else f=r;return r=f.ref,{$$typeof:i,type:a,key:m,ref:r!==void 0?r:null,props:f}}return $o.Fragment=t,$o.jsx=l,$o.jsxs=l,$o}var Fp;function t0(){return Fp||(Fp=1,lu.exports=e0()),lu.exports}var B=t0(),au={exports:{}},le={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Jp;function n0(){if(Jp)return le;Jp=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),E=Symbol.iterator;function C(M){return M===null||typeof M!="object"?null:(M=E&&M[E]||M["@@iterator"],typeof M=="function"?M:null)}var U={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,b={};function P(M,z,J){this.props=M,this.context=z,this.refs=b,this.updater=J||U}P.prototype.isReactComponent={},P.prototype.setState=function(M,z){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,z,"setState")},P.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function X(){}X.prototype=P.prototype;function k(M,z,J){this.props=M,this.context=z,this.refs=b,this.updater=J||U}var K=k.prototype=new X;K.constructor=k,H(K,P.prototype),K.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var F={H:null,A:null,T:null,S:null},he=Object.prototype.hasOwnProperty;function W(M,z,J){var Z=J.ref;return{$$typeof:i,type:M,key:z,ref:Z!==void 0?Z:null,props:J}}function de(M,z){return W(M.type,z,M.props)}function Ce(M){return typeof M=="object"&&M!==null&&M.$$typeof===i}function Ge(M){var z={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(J){return z[J]})}var Ee=/\/+/g;function Pe(M,z){return typeof M=="object"&&M!==null&&M.key!=null?Ge(""+M.key):z.toString(36)}function rt(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(te,te):(M.status="pending",M.then(function(z){M.status==="pending"&&(M.status="fulfilled",M.value=z)},function(z){M.status==="pending"&&(M.status="rejected",M.reason=z)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function L(M,z,J,Z,ae){var ue=typeof M;(ue==="undefined"||ue==="boolean")&&(M=null);var _e=!1;if(M===null)_e=!0;else switch(ue){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(M.$$typeof){case i:case t:_e=!0;break;case v:return _e=M._init,L(_e(M._payload),z,J,Z,ae)}}if(_e)return ae=ae(M),_e=Z===""?"."+Pe(M,0):Z,ee(ae)?(J="",_e!=null&&(J=_e.replace(Ee,"$&/")+"/"),L(ae,z,J,"",function(io){return io})):ae!=null&&(Ce(ae)&&(ae=de(ae,J+(ae.key==null||M&&M.key===ae.key?"":(""+ae.key).replace(Ee,"$&/")+"/")+_e)),z.push(ae)),1;_e=0;var ot=Z===""?".":Z+":";if(ee(M))for(var Ve=0;Ve>>1,De=L[Me];if(0>>1;Mer(J,ie))Zr(ae,J)?(L[Me]=ae,L[Z]=ie,Me=Z):(L[Me]=J,L[z]=ie,Me=z);else if(Zr(ae,ie))L[Me]=ae,L[Z]=ie,Me=Z;else break e}}return O}function r(L,O){var ie=L.sortIndex-O.sortIndex;return ie!==0?ie:L.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,g=m.now();i.unstable_now=function(){return m.now()-g}}var y=[],h=[],v=1,S=null,E=3,C=!1,U=!1,H=!1,b=!1,P=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function K(L){for(var O=l(h);O!==null;){if(O.callback===null)a(h);else if(O.startTime<=L)a(h),O.sortIndex=O.expirationTime,t(y,O);else break;O=l(h)}}function ee(L){if(H=!1,K(L),!U)if(l(y)!==null)U=!0,te||(te=!0,Ge());else{var O=l(h);O!==null&&rt(ee,O.startTime-L)}}var te=!1,F=-1,he=5,W=-1;function de(){return b?!0:!(i.unstable_now()-WL&&de());){var Me=S.callback;if(typeof Me=="function"){S.callback=null,E=S.priorityLevel;var De=Me(S.expirationTime<=L);if(L=i.unstable_now(),typeof De=="function"){S.callback=De,K(L),O=!0;break t}S===l(y)&&a(y),K(L)}else a(y);S=l(y)}if(S!==null)O=!0;else{var M=l(h);M!==null&&rt(ee,M.startTime-L),O=!1}}break e}finally{S=null,E=ie,C=!1}O=void 0}}finally{O?Ge():te=!1}}}var Ge;if(typeof k=="function")Ge=function(){k(Ce)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Pe=Ee.port2;Ee.port1.onmessage=Ce,Ge=function(){Pe.postMessage(null)}}else Ge=function(){P(Ce,0)};function rt(L,O){F=P(function(){L(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(L){L.callback=null},i.unstable_forceFrameRate=function(L){0>L||125Me?(L.sortIndex=ie,t(h,L),l(y)===null&&L===l(h)&&(H?(X(F),F=-1):H=!0,rt(ee,ie-Me))):(L.sortIndex=De,t(y,L),U||C||(U=!0,te||(te=!0,Ge()))),L},i.unstable_shouldYield=de,i.unstable_wrapCallback=function(L){var O=E;return function(){var ie=E;E=O;try{return L.apply(this,arguments)}finally{E=ie}}}})(uu)),uu}var Kp;function l0(){return Kp||(Kp=1,ru.exports=o0()),ru.exports}var cu={exports:{}},tt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Qp;function a0(){if(Qp)return tt;Qp=1;var i=Du();function t(y){var h="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),cu.exports=a0(),cu.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $p;function r0(){if($p)return Wo;$p=1;var i=l0(),t=Du(),l=s0();function a(e){var n="https://react.dev/errors/"+e;if(1De||(e.current=Me[De],Me[De]=null,De--)}function J(e,n){De++,Me[De]=e.current,e.current=n}var Z=M(null),ae=M(null),ue=M(null),_e=M(null);function ot(e,n){switch(J(ue,n),J(ae,e),J(Z,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=dp(n),e=pp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(Z),J(Z,e)}function Ve(){z(Z),z(ae),z(ue)}function io(e){e.memoizedState!==null&&J(_e,e);var n=Z.current,o=pp(n,e.type);n!==o&&(J(ae,e),J(Z,o))}function nl(e){ae.current===e&&(z(Z),z(ae)),_e.current===e&&(z(_e),Xo._currentValue=ie)}var Pa,Pu;function Fn(e){if(Pa===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);Pa=n&&n[1]||"",Pu=-1)":-1d||A[s]!==x[d]){var G=` +`+A[s].replace(" at new "," at ");return e.displayName&&G.includes("")&&(G=G.replace("",e.displayName)),G}while(1<=s&&0<=d);break}}}finally{ka=!1,Error.prepareStackTrace=o}return(o=e?e.displayName||e.name:"")?Fn(o):""}function Ug(e,n){switch(e.tag){case 26:case 27:case 5:return Fn(e.type);case 16:return Fn("Lazy");case 13:return e.child!==n&&n!==null?Fn("Suspense Fallback"):Fn("Suspense");case 19:return Fn("SuspenseList");case 0:case 15:return Oa(e.type,!1);case 11:return Oa(e.type.render,!1);case 1:return Oa(e.type,!0);case 31:return Fn("Activity");default:return""}}function ku(e){try{var n="",o=null;do n+=Ug(e,o),o=e,e=e.return;while(e);return n}catch(s){return` +Error generating stack: `+s.message+` +`+s.stack}}var Fa=Object.prototype.hasOwnProperty,Ja=i.unstable_scheduleCallback,Ya=i.unstable_cancelCallback,wg=i.unstable_shouldYield,bg=i.unstable_requestPaint,gt=i.unstable_now,Lg=i.unstable_getCurrentPriorityLevel,Ou=i.unstable_ImmediatePriority,Fu=i.unstable_UserBlockingPriority,il=i.unstable_NormalPriority,Gg=i.unstable_LowPriority,Ju=i.unstable_IdlePriority,Hg=i.log,qg=i.unstable_setDisableYieldValue,oo=null,yt=null;function yn(e){if(typeof Hg=="function"&&qg(e),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(oo,e)}catch{}}var vt=Math.clz32?Math.clz32:Bg,Vg=Math.log,zg=Math.LN2;function Bg(e){return e>>>=0,e===0?32:31-(Vg(e)/zg|0)|0}var ol=256,ll=262144,al=4194304;function Jn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function sl(e,n,o){var s=e.pendingLanes;if(s===0)return 0;var d=0,p=e.suspendedLanes,T=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~p,s!==0?d=Jn(s):(T&=_,T!==0?d=Jn(T):o||(o=_&~e,o!==0&&(d=Jn(o))))):(_=s&~p,_!==0?d=Jn(_):T!==0?d=Jn(T):o||(o=s&~e,o!==0&&(d=Jn(o)))),d===0?0:n!==0&&n!==d&&(n&p)===0&&(p=d&-d,o=n&-n,p>=o||p===32&&(o&4194048)!==0)?n:d}function lo(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Pg(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yu(){var e=al;return al<<=1,(al&62914560)===0&&(al=4194304),e}function Xa(e){for(var n=[],o=0;31>o;o++)n.push(e);return n}function ao(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kg(e,n,o,s,d,p){var T=e.pendingLanes;e.pendingLanes=o,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=o,e.entangledLanes&=o,e.errorRecoveryDisabledLanes&=o,e.shellSuspendCounter=0;var _=e.entanglements,A=e.expirationTimes,x=e.hiddenUpdates;for(o=T&~o;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Kg=/[\n"\\]/g;function Nt(e){return e.replace(Kg,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ja(e,n,o,s,d,p,T,_){e.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.type=T:e.removeAttribute("type"),n!=null?T==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Mt(n)):e.value!==""+Mt(n)&&(e.value=""+Mt(n)):T!=="submit"&&T!=="reset"||e.removeAttribute("value"),n!=null?es(e,T,Mt(n)):o!=null?es(e,T,Mt(o)):s!=null&&e.removeAttribute("value"),d==null&&p!=null&&(e.defaultChecked=!!p),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.name=""+Mt(_):e.removeAttribute("name")}function lc(e,n,o,s,d,p,T,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Wa(e);return}o=o!=null?""+Mt(o):"",n=n!=null?""+Mt(n):o,_||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=_?e.checked:!!s,e.defaultChecked=!!s,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(e.name=T),Wa(e)}function es(e,n,o){n==="number"&&cl(e.ownerDocument)===e||e.defaultValue===""+o||(e.defaultValue=""+o)}function gi(e,n,o,s){if(e=e.options,n){n={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ls=!1;if($t)try{var co={};Object.defineProperty(co,"passive",{get:function(){ls=!0}}),window.addEventListener("test",co,co),window.removeEventListener("test",co,co)}catch{ls=!1}var Tn=null,as=null,dl=null;function dc(){if(dl)return dl;var e,n=as,o=n.length,s,d="value"in Tn?Tn.value:Tn.textContent,p=d.length;for(e=0;e=mo),vc=" ",Tc=!1;function Sc(e,n){switch(e){case"keyup":return _y.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Si=!1;function Ay(e,n){switch(e){case"compositionend":return Ec(n);case"keypress":return n.which!==32?null:(Tc=!0,vc);case"textInput":return e=n.data,e===vc&&Tc?null:e;default:return null}}function Ry(e,n){if(Si)return e==="compositionend"||!fs&&Sc(e,n)?(e=dc(),dl=as=Tn=null,Si=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:o,offset:n-e};e=s}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=xc(o)}}function Uc(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Uc(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function wc(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=cl(e.document);n instanceof e.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)e=n.contentWindow;else break;n=cl(e.document)}return n}function ms(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var by=$t&&"documentMode"in document&&11>=document.documentMode,Ei=null,hs=null,vo=null,gs=!1;function bc(e,n,o){var s=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;gs||Ei==null||Ei!==cl(s)||(s=Ei,"selectionStart"in s&&ms(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vo&&yo(vo,s)||(vo=s,s=la(hs,"onSelect"),0>=T,d-=T,Ft=1<<32-vt(n)+d|o<re?(me=$,$=null):me=$.sibling;var ve=D(N,$,I[re],q);if(ve===null){$===null&&($=me);break}e&&$&&ve.alternate===null&&n(N,$),R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve,$=me}if(re===I.length)return o(N,$),ge&&jt(N,re),j;if($===null){for(;rere?(me=$,$=null):me=$.sibling;var Pn=D(N,$,ve.value,q);if(Pn===null){$===null&&($=me);break}e&&$&&Pn.alternate===null&&n(N,$),R=p(Pn,R,re),ye===null?j=Pn:ye.sibling=Pn,ye=Pn,$=me}if(ve.done)return o(N,$),ge&&jt(N,re),j;if($===null){for(;!ve.done;re++,ve=I.next())ve=V(N,ve.value,q),ve!==null&&(R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve);return ge&&jt(N,re),j}for($=s($);!ve.done;re++,ve=I.next())ve=w($,N,re,ve.value,q),ve!==null&&(e&&ve.alternate!==null&&$.delete(ve.key===null?re:ve.key),R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve);return e&&$.forEach(function(jv){return n(N,jv)}),ge&&jt(N,re),j}function xe(N,R,I,q){if(typeof I=="object"&&I!==null&&I.type===H&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case C:e:{for(var j=I.key;R!==null;){if(R.key===j){if(j=I.type,j===H){if(R.tag===7){o(N,R.sibling),q=d(R,I.props.children),q.return=N,N=q;break e}}else if(R.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===he&&ni(j)===R.type){o(N,R.sibling),q=d(R,I.props),Ao(q,I),q.return=N,N=q;break e}o(N,R);break}else n(N,R);R=R.sibling}I.type===H?(q=$n(I.props.children,N.mode,q,I.key),q.return=N,N=q):(q=_l(I.type,I.key,I.props,null,N.mode,q),Ao(q,I),q.return=N,N=q)}return T(N);case U:e:{for(j=I.key;R!==null;){if(R.key===j)if(R.tag===4&&R.stateNode.containerInfo===I.containerInfo&&R.stateNode.implementation===I.implementation){o(N,R.sibling),q=d(R,I.children||[]),q.return=N,N=q;break e}else{o(N,R);break}else n(N,R);R=R.sibling}q=Cs(I,N.mode,q),q.return=N,N=q}return T(N);case he:return I=ni(I),xe(N,R,I,q)}if(rt(I))return Q(N,R,I,q);if(Ge(I)){if(j=Ge(I),typeof j!="function")throw Error(a(150));return I=j.call(I),ne(N,R,I,q)}if(typeof I.then=="function")return xe(N,R,xl(I),q);if(I.$$typeof===k)return xe(N,R,Rl(N,I),q);Dl(N,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,R!==null&&R.tag===6?(o(N,R.sibling),q=d(R,I),q.return=N,N=q):(o(N,R),q=_s(I,N.mode,q),q.return=N,N=q),T(N)):o(N,R)}return function(N,R,I,q){try{Co=0;var j=xe(N,R,I,q);return wi=null,j}catch($){if($===Ui||$===Nl)throw $;var ye=St(29,$,null,N.mode);return ye.lanes=q,ye.return=N,ye}finally{}}}var oi=nf(!0),of=nf(!1),An=!1;function Gs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hs(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Rn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Mn(e,n,o){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Se&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=El(e),Bc(e,null,o),n}return Sl(e,s,n,o),El(e)}function Ro(e,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,o|=s,n.lanes=o,Ku(e,o)}}function qs(e,n){var o=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,o===s)){var d=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var T={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};p===null?d=p=T:p=p.next=T,o=o.next}while(o!==null);p===null?d=p=n:p=p.next=n}else d=p=n;o={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=n:e.next=n,o.lastBaseUpdate=n}var Vs=!1;function Mo(){if(Vs){var e=Di;if(e!==null)throw e}}function No(e,n,o,s){Vs=!1;var d=e.updateQueue;An=!1;var p=d.firstBaseUpdate,T=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var A=_,x=A.next;A.next=null,T===null?p=x:T.next=x,T=A;var G=e.alternate;G!==null&&(G=G.updateQueue,_=G.lastBaseUpdate,_!==T&&(_===null?G.firstBaseUpdate=x:_.next=x,G.lastBaseUpdate=A))}if(p!==null){var V=d.baseState;T=0,G=x=A=null,_=p;do{var D=_.lane&-536870913,w=D!==_.lane;if(w?(pe&D)===D:(s&D)===D){D!==0&&D===xi&&(Vs=!0),G!==null&&(G=G.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Q=e,ne=_;D=n;var xe=o;switch(ne.tag){case 1:if(Q=ne.payload,typeof Q=="function"){V=Q.call(xe,V,D);break e}V=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=ne.payload,D=typeof Q=="function"?Q.call(xe,V,D):Q,D==null)break e;V=S({},V,D);break e;case 2:An=!0}}D=_.callback,D!==null&&(e.flags|=64,w&&(e.flags|=8192),w=d.callbacks,w===null?d.callbacks=[D]:w.push(D))}else w={lane:D,tag:_.tag,payload:_.payload,callback:_.callback,next:null},G===null?(x=G=w,A=V):G=G.next=w,T|=D;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;w=_,_=w.next,w.next=null,d.lastBaseUpdate=w,d.shared.pending=null}}while(!0);G===null&&(A=V),d.baseState=A,d.firstBaseUpdate=x,d.lastBaseUpdate=G,p===null&&(d.shared.lanes=0),Un|=T,e.lanes=T,e.memoizedState=V}}function lf(e,n){if(typeof e!="function")throw Error(a(191,e));e.call(n)}function af(e,n){var o=e.callbacks;if(o!==null)for(e.callbacks=null,e=0;ep?p:8;var T=L.T,_={};L.T=_,ir(e,!1,n,o);try{var A=d(),x=L.S;if(x!==null&&x(_,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var G=ky(A,s);Do(e,n,G,Rt(e))}else Do(e,n,s,Rt(e))}catch(V){Do(e,n,{then:function(){},status:"rejected",reason:V},Rt())}finally{O.p=p,T!==null&&_.types!==null&&(T.types=_.types),L.T=T}}function Ky(){}function tr(e,n,o,s){if(e.tag!==5)throw Error(a(476));var d=Vf(e).queue;qf(e,d,n,ie,o===null?Ky:function(){return zf(e),o(s)})}function Vf(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:on,lastRenderedState:ie},next:null};var o={};return n.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:on,lastRenderedState:o},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function zf(e){var n=Vf(e);n.next===null&&(n=e.alternate.memoizedState),Do(e,n.next.queue,{},Rt())}function nr(){return We(Xo)}function Bf(){return Be().memoizedState}function Pf(){return Be().memoizedState}function Qy(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var o=Rt();e=Rn(o);var s=Mn(n,e,o);s!==null&&(ht(s,n,o),Ro(s,n,o)),n={cache:Us()},e.payload=n;return}n=n.return}}function Zy(e,n,o){var s=Rt();o={lane:s,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Bl(e)?Of(n,o):(o=Ss(e,n,o,s),o!==null&&(ht(o,e,s),Ff(o,n,s)))}function kf(e,n,o){var s=Rt();Do(e,n,o,s)}function Do(e,n,o,s){var d={lane:s,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Bl(e))Of(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var T=n.lastRenderedState,_=p(T,o);if(d.hasEagerState=!0,d.eagerState=_,Tt(_,T))return Sl(e,n,d,0),Ue===null&&Tl(),!1}catch{}finally{}if(o=Ss(e,n,d,s),o!==null)return ht(o,e,s),Ff(o,n,s),!0}return!1}function ir(e,n,o,s){if(s={lane:2,revertLane:Gr(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Bl(e)){if(n)throw Error(a(479))}else n=Ss(e,o,s,2),n!==null&&ht(n,e,2)}function Bl(e){var n=e.alternate;return e===se||n!==null&&n===se}function Of(e,n){Li=bl=!0;var o=e.pending;o===null?n.next=n:(n.next=o.next,o.next=n),e.pending=n}function Ff(e,n,o){if((o&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,o|=s,n.lanes=o,Ku(e,o)}}var Uo={readContext:We,use:Hl,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useLayoutEffect:He,useInsertionEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useSyncExternalStore:He,useId:He,useHostTransitionStatus:He,useFormState:He,useActionState:He,useOptimistic:He,useMemoCache:He,useCacheRefresh:He};Uo.useEffectEvent=He;var Jf={readContext:We,use:Hl,useCallback:function(e,n){return lt().memoizedState=[e,n===void 0?null:n],e},useContext:We,useEffect:If,useImperativeHandle:function(e,n,o){o=o!=null?o.concat([e]):null,Vl(4194308,4,wf.bind(null,n,e),o)},useLayoutEffect:function(e,n){return Vl(4194308,4,e,n)},useInsertionEffect:function(e,n){Vl(4,2,e,n)},useMemo:function(e,n){var o=lt();n=n===void 0?null:n;var s=e();if(li){yn(!0);try{e()}finally{yn(!1)}}return o.memoizedState=[s,n],s},useReducer:function(e,n,o){var s=lt();if(o!==void 0){var d=o(n);if(li){yn(!0);try{o(n)}finally{yn(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=Zy.bind(null,se,e),[s.memoizedState,e]},useRef:function(e){var n=lt();return e={current:e},n.memoizedState=e},useState:function(e){e=Zs(e);var n=e.queue,o=kf.bind(null,se,n);return n.dispatch=o,[e.memoizedState,o]},useDebugValue:js,useDeferredValue:function(e,n){var o=lt();return er(o,e,n)},useTransition:function(){var e=Zs(!1);return e=qf.bind(null,se,e.queue,!0,!1),lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,o){var s=se,d=lt();if(ge){if(o===void 0)throw Error(a(407));o=o()}else{if(o=n(),Ue===null)throw Error(a(349));(pe&127)!==0||df(s,n,o)}d.memoizedState=o;var p={value:o,getSnapshot:n};return d.queue=p,If(mf.bind(null,s,p,e),[e]),s.flags|=2048,Hi(9,{destroy:void 0},pf.bind(null,s,p,o,n),null),o},useId:function(){var e=lt(),n=Ue.identifierPrefix;if(ge){var o=Jt,s=Ft;o=(s&~(1<<32-vt(s)-1)).toString(32)+o,n="_"+n+"R_"+o,o=Ll++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?T.createElement("select",{is:s.is}):T.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?T.createElement(d,{is:s.is}):T.createElement(d)}}p[Ze]=n,p[ut]=s;e:for(T=n.child;T!==null;){if(T.tag===5||T.tag===6)p.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===n)break e;for(;T.sibling===null;){if(T.return===null||T.return===n)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}n.stateNode=p;e:switch(et(p,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&an(n)}}return be(n),yr(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,o),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&an(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(a(166));if(e=ue.current,Ni(n)){if(e=n.stateNode,o=n.memoizedProps,s=null,d=$e,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[Ze]=n,e=!!(e.nodeValue===o||s!==null&&s.suppressHydrationWarning===!0||cp(e.nodeValue,o)),e||_n(n,!0)}else e=aa(e).createTextNode(s),e[Ze]=n,n.stateNode=e}return be(n),null;case 31:if(o=n.memoizedState,e===null||e.memoizedState!==null){if(s=Ni(n),o!==null){if(e===null){if(!s)throw Error(a(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Ze]=n}else Wn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;be(n),e=!1}else o=Ns(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),e=!0;if(!e)return n.flags&256?(_t(n),n):(_t(n),null);if((n.flags&128)!==0)throw Error(a(558))}return be(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Ni(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(a(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));d[Ze]=n}else Wn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;be(n),d=!1}else d=Ns(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(_t(n),n):(_t(n),null)}return _t(n),(n.flags&128)!==0?(n.lanes=o,n):(o=s!==null,e=e!==null&&e.memoizedState!==null,o&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==d&&(s.flags|=2048)),o!==e&&o&&(n.child.flags|=8192),Jl(n,n.updateQueue),be(n),null);case 4:return Ve(),e===null&&zr(n.stateNode.containerInfo),be(n),null;case 10:return tn(n.type),be(n),null;case 19:if(z(ze),s=n.memoizedState,s===null)return be(n),null;if(d=(n.flags&128)!==0,p=s.rendering,p===null)if(d)bo(s,!1);else{if(qe!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=wl(e),p!==null){for(n.flags|=128,bo(s,!1),e=p.updateQueue,n.updateQueue=e,Jl(n,e),n.subtreeFlags=0,e=o,o=n.child;o!==null;)Pc(o,e),o=o.sibling;return J(ze,ze.current&1|2),ge&&jt(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&>()>Zl&&(n.flags|=128,d=!0,bo(s,!1),n.lanes=4194304)}else{if(!d)if(e=wl(p),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,Jl(n,e),bo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ge)return be(n),null}else 2*gt()-s.renderingStartTime>Zl&&o!==536870912&&(n.flags|=128,d=!0,bo(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=gt(),e.sibling=null,o=ze.current,J(ze,d?o&1|2:o&1),ge&&jt(n,s.treeForkCount),e):(be(n),null);case 22:case 23:return _t(n),Bs(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(o&536870912)!==0&&(n.flags&128)===0&&(be(n),n.subtreeFlags&6&&(n.flags|=8192)):be(n),o=n.updateQueue,o!==null&&Jl(n,o.retryQueue),o=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(o=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==o&&(n.flags|=2048),e!==null&&z(ti),null;case 24:return o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),tn(ke),be(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function tv(e,n){switch(Rs(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return tn(ke),Ve(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return nl(n),null;case 31:if(n.memoizedState!==null){if(_t(n),n.alternate===null)throw Error(a(340));Wn()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(_t(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(a(340));Wn()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return z(ze),null;case 4:return Ve(),null;case 10:return tn(n.type),null;case 22:case 23:return _t(n),Bs(),e!==null&&z(ti),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return tn(ke),null;case 25:return null;default:return null}}function hd(e,n){switch(Rs(n),n.tag){case 3:tn(ke),Ve();break;case 26:case 27:case 5:nl(n);break;case 4:Ve();break;case 31:n.memoizedState!==null&&_t(n);break;case 13:_t(n);break;case 19:z(ze);break;case 10:tn(n.type);break;case 22:case 23:_t(n),Bs(),e!==null&&z(ti);break;case 24:tn(ke)}}function Lo(e,n){try{var o=n.updateQueue,s=o!==null?o.lastEffect:null;if(s!==null){var d=s.next;o=d;do{if((o.tag&e)===e){s=void 0;var p=o.create,T=o.inst;s=p(),T.destroy=s}o=o.next}while(o!==d)}}catch(_){Re(n,n.return,_)}}function xn(e,n,o){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var p=d.next;s=p;do{if((s.tag&e)===e){var T=s.inst,_=T.destroy;if(_!==void 0){T.destroy=void 0,d=n;var A=o,x=_;try{x()}catch(G){Re(d,A,G)}}}s=s.next}while(s!==p)}}catch(G){Re(n,n.return,G)}}function gd(e){var n=e.updateQueue;if(n!==null){var o=e.stateNode;try{af(n,o)}catch(s){Re(e,e.return,s)}}}function yd(e,n,o){o.props=ai(e.type,e.memoizedProps),o.state=e.memoizedState;try{o.componentWillUnmount()}catch(s){Re(e,n,s)}}function Go(e,n){try{var o=e.ref;if(o!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof o=="function"?e.refCleanup=o(s):o.current=s}}catch(d){Re(e,n,d)}}function Yt(e,n){var o=e.ref,s=e.refCleanup;if(o!==null)if(typeof s=="function")try{s()}catch(d){Re(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(d){Re(e,n,d)}else o.current=null}function vd(e){var n=e.type,o=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":o.autoFocus&&s.focus();break e;case"img":o.src?s.src=o.src:o.srcSet&&(s.srcset=o.srcSet)}}catch(d){Re(e,e.return,d)}}function vr(e,n,o){try{var s=e.stateNode;Cv(s,e.type,o,n),s[ut]=n}catch(d){Re(e,e.return,d)}}function Td(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Hn(e.type)||e.tag===4}function Tr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Td(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Hn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Sr(e,n,o){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(e,n):(n=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,n.appendChild(e),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=Zt));else if(s!==4&&(s===27&&Hn(e.type)&&(o=e.stateNode,n=null),e=e.child,e!==null))for(Sr(e,n,o),e=e.sibling;e!==null;)Sr(e,n,o),e=e.sibling}function Yl(e,n,o){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?o.insertBefore(e,n):o.appendChild(e);else if(s!==4&&(s===27&&Hn(e.type)&&(o=e.stateNode),e=e.child,e!==null))for(Yl(e,n,o),e=e.sibling;e!==null;)Yl(e,n,o),e=e.sibling}function Sd(e){var n=e.stateNode,o=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);et(n,s,o),n[Ze]=e,n[ut]=o}catch(p){Re(e,e.return,p)}}var sn=!1,Je=!1,Er=!1,Ed=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function nv(e,n){if(e=e.containerInfo,kr=pa,e=wc(e),ms(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var s=o.getSelection&&o.getSelection();if(s&&s.rangeCount!==0){o=s.anchorNode;var d=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var T=0,_=-1,A=-1,x=0,G=0,V=e,D=null;t:for(;;){for(var w;V!==o||d!==0&&V.nodeType!==3||(_=T+d),V!==p||s!==0&&V.nodeType!==3||(A=T+s),V.nodeType===3&&(T+=V.nodeValue.length),(w=V.firstChild)!==null;)D=V,V=w;for(;;){if(V===e)break t;if(D===o&&++x===d&&(_=T),D===p&&++G===s&&(A=T),(w=V.nextSibling)!==null)break;V=D,D=V.parentNode}V=w}o=_===-1||A===-1?null:{start:_,end:A}}else o=null}o=o||{start:0,end:0}}else o=null;for(Or={focusedElem:e,selectionRange:o},pa=!1,Ke=n;Ke!==null;)if(n=Ke,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ke=e;else for(;Ke!==null;){switch(n=Ke,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(o=0;o title"))),et(p,s,o),p[Ze]=e,Xe(p),s=p;break e;case"link":var T=Np("link","href",d).get(s+(o.href||""));if(T){for(var _=0;_xe&&(T=xe,xe=ne,ne=T);var N=Dc(_,ne),R=Dc(_,xe);if(N&&R&&(w.rangeCount!==1||w.anchorNode!==N.node||w.anchorOffset!==N.offset||w.focusNode!==R.node||w.focusOffset!==R.offset)){var I=V.createRange();I.setStart(N.node,N.offset),w.removeAllRanges(),ne>xe?(w.addRange(I),w.extend(R.node,R.offset)):(I.setEnd(R.node,R.offset),w.addRange(I))}}}}for(V=[],w=_;w=w.parentNode;)w.nodeType===1&&V.push({element:w,left:w.scrollLeft,top:w.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_o?32:o,L.T=null,o=Ir,Ir=null;var p=bn,T=dn;if(Ye=0,Pi=bn=null,dn=0,(Se&6)!==0)throw Error(a(331));var _=Se;if(Se|=4,wd(p.current),xd(p,p.current,T,o),Se=_,Po(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(oo,p)}catch{}return!0}finally{O.p=d,L.T=s,Zd(e,n)}}function Wd(e,n,o){n=xt(o,n),n=sr(e.stateNode,n,2),e=Mn(e,n,2),e!==null&&(ao(e,2),Xt(e))}function Re(e,n,o){if(e.tag===3)Wd(e,e,o);else for(;n!==null;){if(n.tag===3){Wd(n,e,o);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(wn===null||!wn.has(s))){e=xt(o,e),o=jf(2),s=Mn(n,o,2),s!==null&&(ed(o,s,n,e),ao(s,2),Xt(s));break}}n=n.return}}function wr(e,n,o){var s=e.pingCache;if(s===null){s=e.pingCache=new lv;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(o)||(Ar=!0,d.add(o),e=cv.bind(null,e,n,o),n.then(e,e))}function cv(e,n,o){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&o,e.warmLanes&=~o,Ue===e&&(pe&o)===o&&(qe===4||qe===3&&(pe&62914560)===pe&&300>gt()-Ql?(Se&2)===0&&ki(e,0):Rr|=o,Bi===pe&&(Bi=0)),Xt(e)}function jd(e,n){n===0&&(n=Yu()),e=Zn(e,n),e!==null&&(ao(e,n),Xt(e))}function fv(e){var n=e.memoizedState,o=0;n!==null&&(o=n.retryLane),jd(e,o)}function dv(e,n){var o=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(o=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(a(314))}s!==null&&s.delete(n),jd(e,o)}function pv(e,n){return Ja(e,n)}var na=null,Fi=null,br=!1,ia=!1,Lr=!1,Gn=0;function Xt(e){e!==Fi&&e.next===null&&(Fi===null?na=Fi=e:Fi=Fi.next=e),ia=!0,br||(br=!0,hv())}function Po(e,n){if(!Lr&&ia){Lr=!0;do for(var o=!1,s=na;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var p=0;else{var T=s.suspendedLanes,_=s.pingedLanes;p=(1<<31-vt(42|e)+1)-1,p&=d&~(T&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(o=!0,ip(s,p))}else p=pe,p=sl(s,s===Ue?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||lo(s,p)||(o=!0,ip(s,p));s=s.next}while(o);Lr=!1}}function mv(){ep()}function ep(){ia=br=!1;var e=0;Gn!==0&&Rv()&&(e=Gn);for(var n=gt(),o=null,s=na;s!==null;){var d=s.next,p=tp(s,n);p===0?(s.next=null,o===null?na=d:o.next=d,d===null&&(Fi=o)):(o=s,(e!==0||(p&3)!==0)&&(ia=!0)),s=d}Ye!==0&&Ye!==5||Po(e),Gn!==0&&(Gn=0)}function tp(e,n){for(var o=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes&-62914561;0_)break;var G=A.transferSize,V=A.initiatorType;G&&fp(V)&&(A=A.responseEnd,T+=G*(A<_?1:(_-x)/(A-x)))}if(--s,n+=8*(p+T)/(d.duration/1e3),e++,10"u"?null:document;function Cp(e,n,o){var s=Ji;if(s&&typeof n=="string"&&n){var d=Nt(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof o=="string"&&(d+='[crossorigin="'+o+'"]'),_p.has(d)||(_p.add(d),e={rel:e,crossOrigin:o,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),et(n,"link",e),Xe(n),s.head.appendChild(n)))}}function Lv(e){pn.D(e),Cp("dns-prefetch",e,null)}function Gv(e,n){pn.C(e,n),Cp("preconnect",e,n)}function Hv(e,n,o){pn.L(e,n,o);var s=Ji;if(s&&e&&n){var d='link[rel="preload"][as="'+Nt(n)+'"]';n==="image"&&o&&o.imageSrcSet?(d+='[imagesrcset="'+Nt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(d+='[imagesizes="'+Nt(o.imageSizes)+'"]')):d+='[href="'+Nt(e)+'"]';var p=d;switch(n){case"style":p=Yi(e);break;case"script":p=Xi(e)}Gt.has(p)||(e=S({rel:"preload",href:n==="image"&&o&&o.imageSrcSet?void 0:e,as:n},o),Gt.set(p,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Jo(p))||n==="script"&&s.querySelector(Yo(p))||(n=s.createElement("link"),et(n,"link",e),Xe(n),s.head.appendChild(n)))}}function qv(e,n){pn.m(e,n);var o=Ji;if(o&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+Nt(s)+'"][href="'+Nt(e)+'"]',p=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Xi(e)}if(!Gt.has(p)&&(e=S({rel:"modulepreload",href:e},n),Gt.set(p,e),o.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Yo(p)))return}s=o.createElement("link"),et(s,"link",e),Xe(s),o.head.appendChild(s)}}}function Vv(e,n,o){pn.S(e,n,o);var s=Ji;if(s&&e){var d=mi(s).hoistableStyles,p=Yi(e);n=n||"default";var T=d.get(p);if(!T){var _={loading:0,preload:null};if(T=s.querySelector(Jo(p)))_.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":n},o),(o=Gt.get(p))&&Zr(e,o);var A=T=s.createElement("link");Xe(A),et(A,"link",e),A._p=new Promise(function(x,G){A.onload=x,A.onerror=G}),A.addEventListener("load",function(){_.loading|=1}),A.addEventListener("error",function(){_.loading|=2}),_.loading|=4,ra(T,n,s)}T={type:"stylesheet",instance:T,count:1,state:_},d.set(p,T)}}}function zv(e,n){pn.X(e,n);var o=Ji;if(o&&e){var s=mi(o).hoistableScripts,d=Xi(e),p=s.get(d);p||(p=o.querySelector(Yo(d)),p||(e=S({src:e,async:!0},n),(n=Gt.get(d))&&$r(e,n),p=o.createElement("script"),Xe(p),et(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Bv(e,n){pn.M(e,n);var o=Ji;if(o&&e){var s=mi(o).hoistableScripts,d=Xi(e),p=s.get(d);p||(p=o.querySelector(Yo(d)),p||(e=S({src:e,async:!0,type:"module"},n),(n=Gt.get(d))&&$r(e,n),p=o.createElement("script"),Xe(p),et(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Ap(e,n,o,s){var d=(d=ue.current)?sa(d):null;if(!d)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(n=Yi(o.href),o=mi(d).hoistableStyles,s=o.get(n),s||(s={type:"style",instance:null,count:0,state:null},o.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){e=Yi(o.href);var p=mi(d).hoistableStyles,T=p.get(e);if(T||(d=d.ownerDocument||d,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,T),(p=d.querySelector(Jo(e)))&&!p._p&&(T.instance=p,T.state.loading=5),Gt.has(e)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Gt.set(e,o),p||Pv(d,e,o,T.state))),n&&s===null)throw Error(a(528,""));return T}if(n&&s!==null)throw Error(a(529,""));return null;case"script":return n=o.async,o=o.src,typeof o=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Xi(o),o=mi(d).hoistableScripts,s=o.get(n),s||(s={type:"script",instance:null,count:0,state:null},o.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Yi(e){return'href="'+Nt(e)+'"'}function Jo(e){return'link[rel="stylesheet"]['+e+"]"}function Rp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Pv(e,n,o,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),et(n,"link",o),Xe(n),e.head.appendChild(n))}function Xi(e){return'[src="'+Nt(e)+'"]'}function Yo(e){return"script[async]"+e}function Mp(e,n,o){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Nt(o.href)+'"]');if(s)return n.instance=s,Xe(s),s;var d=S({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Xe(s),et(s,"style",d),ra(s,o.precedence,e),n.instance=s;case"stylesheet":d=Yi(o.href);var p=e.querySelector(Jo(d));if(p)return n.state.loading|=4,n.instance=p,Xe(p),p;s=Rp(o),(d=Gt.get(d))&&Zr(s,d),p=(e.ownerDocument||e).createElement("link"),Xe(p);var T=p;return T._p=new Promise(function(_,A){T.onload=_,T.onerror=A}),et(p,"link",s),n.state.loading|=4,ra(p,o.precedence,e),n.instance=p;case"script":return p=Xi(o.src),(d=e.querySelector(Yo(p)))?(n.instance=d,Xe(d),d):(s=o,(d=Gt.get(p))&&(s=S({},o),$r(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),Xe(d),et(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,ra(s,o.precedence,e));return n.instance}function ra(e,n,o){for(var s=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,p=d,T=0;T title"):null)}function kv(e,n,o){if(o===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ov(e,n,o,s){if(o.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var d=Yi(s.href),p=n.querySelector(Jo(d));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ca.bind(e),n.then(e,e)),o.state.loading|=4,o.instance=p,Xe(p);return}p=n.ownerDocument||n,s=Rp(s),(d=Gt.get(d))&&Zr(s,d),p=p.createElement("link"),Xe(p);var T=p;T._p=new Promise(function(_,A){T.onload=_,T.onerror=A}),et(p,"link",s),o.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(o,n),(n=o.state.preload)&&(o.state.loading&3)===0&&(e.count++,o=ca.bind(e),n.addEventListener("load",o),n.addEventListener("error",o))}}var Wr=0;function Fv(e,n){return e.stylesheets&&e.count===0&&da(e,e.stylesheets),0Wr?50:800)+n);return e.unsuspend=o,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function ca(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)da(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var fa=null;function da(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,fa=new Map,n.forEach(Jv,e),fa=null,ca.call(e))}function Jv(e,n){if(!(n.state.loading&4)){var o=fa.get(e);if(o)var s=o.get(null);else{o=new Map,fa.set(e,o);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),su.exports=r0(),su.exports}var c0=u0();const f0=Lh(c0),jp=({children:i})=>B.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-start pt-8 pb-8 px-4 sm:px-6 max-w-md mx-auto w-full relative",children:[B.jsxs("div",{className:"fixed top-0 left-0 w-full h-full overflow-hidden pointer-events-none -z-10",children:[B.jsx("div",{className:"absolute top-10 right-10 w-20 h-20 border-4 border-white/20 rounded-full animate-float"}),B.jsx("div",{className:"absolute bottom-20 left-10 w-16 h-16 bg-brand-yellow/20 rounded-full blur-xl animate-pulse"})]}),B.jsxs("header",{className:"w-full flex flex-col items-center mb-6 text-center relative z-20",children:[B.jsx("div",{className:"inline-block bg-white text-brand-red px-3 py-1 rounded-full text-xs font-bold mb-3 shadow-lg transform -rotate-2",children:"🎵 歌词灵感 · 现场征集"}),B.jsxs("h1",{className:"text-4xl font-black italic tracking-tighter text-white drop-shadow-lg mb-2 transform -skew-x-3",children:["一起做首",B.jsx("br",{}),B.jsx("span",{className:"text-5xl",children:"我们的歌"})]}),B.jsxs("div",{className:"mt-6 space-y-1",children:[B.jsx("p",{className:"text-lg font-bold text-white border-b-2 border-white/30 inline-block pb-1",children:"门槛不高,不需要懂音乐"}),B.jsx("p",{className:"text-sm opacity-90",children:"聊聊咱们的故事,将灵感汇聚成歌"})]})]}),B.jsx("main",{className:"w-full bg-white rounded-3xl p-6 shadow-xl relative overflow-hidden text-gray-800",children:i}),B.jsxs("footer",{className:"mt-8 text-[10px] text-white/60 text-center uppercase tracking-wider",children:[B.jsx("p",{className:"mb-1",children:"朴见潮音"}),B.jsx("p",{children:"© 2025 COMMUNE Music Co-creation"})]})]});/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),p0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,l,a)=>a?a.toUpperCase():l.toLowerCase()),em=i=>{const t=p0(i);return t.charAt(0).toUpperCase()+t.slice(1)},Gh=(...i)=>i.filter((t,l,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===l).join(" ").trim(),m0=i=>{for(const t in i)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var h0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g0=nt.forwardRef(({color:i="currentColor",size:t=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:r="",children:f,iconNode:m,...g},y)=>nt.createElement("svg",{ref:y,...h0,width:t,height:t,stroke:i,strokeWidth:a?Number(l)*24/Number(t):l,className:Gh("lucide",r),...!f&&!m0(g)&&{"aria-hidden":"true"},...g},[...m.map(([h,v])=>nt.createElement(h,v)),...Array.isArray(f)?f:[f]]));/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kt=(i,t)=>{const l=nt.forwardRef(({className:a,...r},f)=>nt.createElement(g0,{ref:f,iconNode:t,className:Gh(`lucide-${d0(em(i))}`,`lucide-${i}`,a),...r}));return l.displayName=em(i),l};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],v0=Kt("arrow-right",y0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],S0=Kt("circle-check",T0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E0=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],_0=Kt("coffee",E0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Hh=Kt("loader-circle",C0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A0=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],R0=Kt("quote",A0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],N0=Kt("refresh-cw",M0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],x0=Kt("send",I0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D0=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],U0=Kt("smartphone",D0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w0=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],qh=Kt("sparkles",w0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],L0=Kt("user",b0),fu="ai_song_fest_user",du="ai_song_fest_songs",G0=/^1[3-9]\d{9}$/,hu={login:async i=>{if(await new Promise(a=>setTimeout(a,800)),!G0.test(i))return{success:!1,error:"手机号格式不正确"};if(i.endsWith("0000"))return{success:!1,error:"该手机号未报名参与本次活动"};const t=`tk_${i}_${Date.now().toString(36)}`,l={phone:i,token:t};return localStorage.setItem(fu,JSON.stringify(l)),{success:!0,token:t}},getCurrentUser:()=>{const i=localStorage.getItem(fu);return i?JSON.parse(i):null},logout:()=>{localStorage.removeItem(fu)}},Sa={getSongByPhone:async i=>(await new Promise(l=>setTimeout(l,300)),JSON.parse(localStorage.getItem(du)||"{}")[i]||null),submitSong:async(i,t)=>{await new Promise(f=>setTimeout(f,1500));const l=`TKT-${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}-${Date.now().toString().slice(-4)}`,a={id:Date.now().toString(36),phone:i,title:t.title,lyrics:t.lyrics,style:t.style,nickname:t.nickname,status:"submitted",ticketNumber:l,createdAt:Date.now()},r=JSON.parse(localStorage.getItem(du)||"{}");return r[i]=a,localStorage.setItem(du,JSON.stringify(r)),a}},H0=({onLoginSuccess:i})=>{const[t,l]=nt.useState(""),[a,r]=nt.useState(!1),[f,m]=nt.useState(""),g=async y=>{y.preventDefault(),r(!0),m("");try{const h=await hu.login(t);h.success?i():m(h.error||"验证失败")}catch{m("发生未知错误")}finally{r(!1)}};return B.jsxs("div",{className:"space-y-8 py-2",children:[B.jsxs("div",{className:"text-center space-y-2",children:[B.jsx("h2",{className:"text-2xl font-black text-brand-dark tracking-wide",children:"欢迎加入共创"}),B.jsx("p",{className:"text-gray-500 text-sm",children:"输入手机号,开始分享你的故事"})]}),B.jsxs("form",{onSubmit:g,className:"space-y-6",children:[B.jsxs("div",{className:"group",children:[B.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-2 uppercase tracking-wider ml-1",children:"手机号码"}),B.jsxs("div",{className:"relative transition-transform duration-300 focus-within:scale-[1.02]",children:[B.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-12 flex items-center justify-center text-gray-400 group-focus-within:text-brand-orange transition-colors",children:B.jsx(U0,{className:"w-5 h-5"})}),B.jsx("input",{type:"tel",value:t,onChange:y=>l(y.target.value),placeholder:"138 0000 0000",className:"w-full bg-gray-50 border border-gray-200 rounded-xl py-4 pl-12 pr-4 text-gray-800 placeholder-gray-400 focus:outline-none focus:border-brand-orange focus:ring-1 focus:ring-brand-orange transition-all font-mono text-lg",required:!0})]})]}),f&&B.jsxs("div",{className:"p-3 rounded-lg bg-red-50 border border-red-100 text-red-500 text-sm flex items-center gap-2 animate-pulse",children:[B.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),f]}),B.jsx("button",{type:"submit",disabled:a,className:"w-full bg-gradient-to-r from-brand-orange to-brand-red hover:shadow-lg hover:shadow-brand-orange/30 disabled:opacity-50 text-white font-bold py-4 rounded-xl transition-all transform active:scale-95 flex items-center justify-center gap-2",children:a?B.jsx(Hh,{className:"w-5 h-5 animate-spin"}):B.jsxs(B.Fragment,{children:["验证并开始 ",B.jsx(v0,{className:"w-5 h-5"})]})})]}),B.jsx("div",{className:"text-[10px] text-center text-gray-400 pt-4",children:B.jsx("span",{className:"inline-block px-2 py-1 bg-gray-100 rounded",children:"测试提示: 尾号 0000 将会被拒绝"})})]})};var q0={};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */let V0,z0;function B0(){return{geminiUrl:V0,vertexUrl:z0}}function P0(i,t,l,a){var r,f;if(!(i!=null&&i.baseUrl)){const m=B0();return t?(r=m.vertexUrl)!==null&&r!==void 0?r:l:(f=m.geminiUrl)!==null&&f!==void 0?f:a}return i.baseUrl}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class hn{}function Y(i,t){const l=/\{([^}]+)\}/g;return i.replace(l,(a,r)=>{if(Object.prototype.hasOwnProperty.call(t,r)){const f=t[r];return f!=null?String(f):""}else throw new Error(`Key '${r}' not found in valueMap.`)})}function c(i,t,l){for(let f=0;f({}));else throw new Error(`Value must be a list given an array path ${m}`);if(Array.isArray(i[g])){const y=i[g];if(Array.isArray(l))for(let h=0;hu(g,t.slice(a+1),l)):l}else return l}else i=i[r]}return i}catch(a){if(a instanceof TypeError)return l;throw a}}function k0(i,t){for(const[l,a]of Object.entries(t)){const r=l.split("."),f=a.split("."),m=new Set;let g=-1;for(let y=0;yg)for(let y=g;y=t.length||typeof i!="object"||i===null)return;const f=t[a];if(f.endsWith("[]")){const m=f.slice(0,-2),g=i;if(m in g&&Array.isArray(g[m]))for(const y of g[m])gu(y,t,l,a+1,r)}else if(f==="*"){if(typeof i=="object"&&i!==null&&!Array.isArray(i)){const m=i,g=Object.keys(m).filter(h=>!h.startsWith("_")&&!r.has(h)),y={};for(const h of g)y[h]=m[h];for(const[h,v]of Object.entries(y)){const S=[];for(const E of l.slice(a))E==="*"?S.push(h):S.push(E);c(m,S,v)}for(const h of g)delete m[h]}}else{const m=i;f in m&&gu(m[f],t,l,a+1,r)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Uu(i){if(typeof i!="string")throw new Error("fromImageBytes must be a string");return i}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function O0(i){const t={},l=u(i,["operationName"]);l!=null&&c(t,["operationName"],l);const a=u(i,["resourceName"]);return a!=null&&c(t,["_url","resourceName"],a),t}function F0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response","generateVideoResponse"]);return m!=null&&c(t,["response"],Y0(m)),t}function J0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],X0(m)),t}function Y0(i){const t={},l=u(i,["generatedSamples"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>K0(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function X0(i){const t={},l=u(i,["videos"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>Q0(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function K0(i){const t={},l=u(i,["video"]);return l!=null&&c(t,["video"],tT(l)),t}function Q0(i){const t={},l=u(i,["_self"]);return l!=null&&c(t,["video"],nT(l)),t}function Z0(i){const t={},l=u(i,["operationName"]);return l!=null&&c(t,["_url","operationName"],l),t}function $0(i){const t={},l=u(i,["operationName"]);return l!=null&&c(t,["_url","operationName"],l),t}function W0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],j0(m)),t}function j0(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function Vh(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],eT(m)),t}function eT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function tT(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],Uu(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function nT(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["uri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],Uu(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var tm;(function(i){i.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",i.OUTCOME_OK="OUTCOME_OK",i.OUTCOME_FAILED="OUTCOME_FAILED",i.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(tm||(tm={}));var nm;(function(i){i.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",i.PYTHON="PYTHON"})(nm||(nm={}));var im;(function(i){i.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",i.SILENT="SILENT",i.WHEN_IDLE="WHEN_IDLE",i.INTERRUPT="INTERRUPT"})(im||(im={}));var kn;(function(i){i.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",i.STRING="STRING",i.NUMBER="NUMBER",i.INTEGER="INTEGER",i.BOOLEAN="BOOLEAN",i.ARRAY="ARRAY",i.OBJECT="OBJECT",i.NULL="NULL"})(kn||(kn={}));var om;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(om||(om={}));var lm;(function(i){i.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",i.SIMPLE_SEARCH="SIMPLE_SEARCH",i.ELASTIC_SEARCH="ELASTIC_SEARCH"})(lm||(lm={}));var am;(function(i){i.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",i.NO_AUTH="NO_AUTH",i.API_KEY_AUTH="API_KEY_AUTH",i.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",i.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",i.OAUTH="OAUTH",i.OIDC_AUTH="OIDC_AUTH"})(am||(am={}));var sm;(function(i){i.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",i.HTTP_IN_QUERY="HTTP_IN_QUERY",i.HTTP_IN_HEADER="HTTP_IN_HEADER",i.HTTP_IN_PATH="HTTP_IN_PATH",i.HTTP_IN_BODY="HTTP_IN_BODY",i.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(sm||(sm={}));var rm;(function(i){i.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",i.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",i.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",i.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(rm||(rm={}));var um;(function(i){i.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH",i.MINIMAL="MINIMAL"})(um||(um={}));var cm;(function(i){i.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",i.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",i.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",i.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",i.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",i.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",i.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",i.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",i.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(cm||(cm={}));var fm;(function(i){i.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",i.SEVERITY="SEVERITY",i.PROBABILITY="PROBABILITY"})(fm||(fm={}));var dm;(function(i){i.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE",i.OFF="OFF"})(dm||(dm={}));var pm;(function(i){i.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",i.STOP="STOP",i.MAX_TOKENS="MAX_TOKENS",i.SAFETY="SAFETY",i.RECITATION="RECITATION",i.LANGUAGE="LANGUAGE",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.SPII="SPII",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.IMAGE_SAFETY="IMAGE_SAFETY",i.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",i.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",i.NO_IMAGE="NO_IMAGE",i.IMAGE_RECITATION="IMAGE_RECITATION",i.IMAGE_OTHER="IMAGE_OTHER"})(pm||(pm={}));var mm;(function(i){i.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",i.NEGLIGIBLE="NEGLIGIBLE",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH"})(mm||(mm={}));var hm;(function(i){i.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",i.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",i.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",i.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",i.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(hm||(hm={}));var gm;(function(i){i.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",i.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",i.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",i.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",i.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(gm||(gm={}));var ym;(function(i){i.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",i.SAFETY="SAFETY",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.IMAGE_SAFETY="IMAGE_SAFETY",i.MODEL_ARMOR="MODEL_ARMOR",i.JAILBREAK="JAILBREAK"})(ym||(ym={}));var vm;(function(i){i.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",i.ON_DEMAND="ON_DEMAND",i.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(vm||(vm={}));var Ia;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.AUDIO="AUDIO"})(Ia||(Ia={}));var Tm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(Tm||(Tm={}));var Sm;(function(i){i.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",i.TUNING_MODE_FULL="TUNING_MODE_FULL",i.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(Sm||(Sm={}));var Em;(function(i){i.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",i.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",i.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",i.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",i.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",i.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",i.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(Em||(Em={}));var yu;(function(i){i.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",i.JOB_STATE_QUEUED="JOB_STATE_QUEUED",i.JOB_STATE_PENDING="JOB_STATE_PENDING",i.JOB_STATE_RUNNING="JOB_STATE_RUNNING",i.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",i.JOB_STATE_FAILED="JOB_STATE_FAILED",i.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",i.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",i.JOB_STATE_PAUSED="JOB_STATE_PAUSED",i.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",i.JOB_STATE_UPDATING="JOB_STATE_UPDATING",i.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(yu||(yu={}));var _m;(function(i){i.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",i.TUNING_TASK_I2V="TUNING_TASK_I2V",i.TUNING_TASK_T2V="TUNING_TASK_T2V",i.TUNING_TASK_R2V="TUNING_TASK_R2V"})(_m||(_m={}));var Cm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",i.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(Cm||(Cm={}));var Am;(function(i){i.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",i.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",i.BALANCED="BALANCED",i.PRIORITIZE_COST="PRIORITIZE_COST"})(Am||(Am={}));var Rm;(function(i){i.UNSPECIFIED="UNSPECIFIED",i.BLOCKING="BLOCKING",i.NON_BLOCKING="NON_BLOCKING"})(Rm||(Rm={}));var Mm;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(Mm||(Mm={}));var Nm;(function(i){i.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",i.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(Nm||(Nm={}));var Im;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.AUTO="AUTO",i.ANY="ANY",i.NONE="NONE",i.VALIDATED="VALIDATED"})(Im||(Im={}));var xm;(function(i){i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE"})(xm||(xm={}));var Dm;(function(i){i.DONT_ALLOW="DONT_ALLOW",i.ALLOW_ADULT="ALLOW_ADULT",i.ALLOW_ALL="ALLOW_ALL"})(Dm||(Dm={}));var Um;(function(i){i.auto="auto",i.en="en",i.ja="ja",i.ko="ko",i.hi="hi",i.zh="zh",i.pt="pt",i.es="es"})(Um||(Um={}));var wm;(function(i){i.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",i.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",i.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",i.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",i.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(wm||(wm={}));var bm;(function(i){i.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",i.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",i.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",i.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(bm||(bm={}));var Lm;(function(i){i.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",i.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",i.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",i.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Lm||(Lm={}));var Gm;(function(i){i.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",i.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",i.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",i.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",i.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",i.EDIT_MODE_STYLE="EDIT_MODE_STYLE",i.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",i.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(Gm||(Gm={}));var Hm;(function(i){i.FOREGROUND="FOREGROUND",i.BACKGROUND="BACKGROUND",i.PROMPT="PROMPT",i.SEMANTIC="SEMANTIC",i.INTERACTIVE="INTERACTIVE"})(Hm||(Hm={}));var qm;(function(i){i.ASSET="ASSET",i.STYLE="STYLE"})(qm||(qm={}));var Vm;(function(i){i.INSERT="INSERT",i.REMOVE="REMOVE",i.REMOVE_STATIC="REMOVE_STATIC",i.OUTPAINT="OUTPAINT"})(Vm||(Vm={}));var zm;(function(i){i.OPTIMIZED="OPTIMIZED",i.LOSSLESS="LOSSLESS"})(zm||(zm={}));var Bm;(function(i){i.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",i.PREFERENCE_TUNING="PREFERENCE_TUNING"})(Bm||(Bm={}));var Pm;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.STATE_PENDING="STATE_PENDING",i.STATE_ACTIVE="STATE_ACTIVE",i.STATE_FAILED="STATE_FAILED"})(Pm||(Pm={}));var km;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.PROCESSING="PROCESSING",i.ACTIVE="ACTIVE",i.FAILED="FAILED"})(km||(km={}));var Om;(function(i){i.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",i.UPLOADED="UPLOADED",i.GENERATED="GENERATED"})(Om||(Om={}));var Fm;(function(i){i.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.RESPONSE_REJECTED="RESPONSE_REJECTED",i.NEED_MORE_INPUT="NEED_MORE_INPUT"})(Fm||(Fm={}));var Jm;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.VIDEO="VIDEO",i.AUDIO="AUDIO",i.DOCUMENT="DOCUMENT"})(Jm||(Jm={}));var Ym;(function(i){i.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",i.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",i.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(Ym||(Ym={}));var Xm;(function(i){i.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",i.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",i.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Xm||(Xm={}));var Km;(function(i){i.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",i.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",i.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Km||(Km={}));var Qm;(function(i){i.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",i.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",i.NO_INTERRUPTION="NO_INTERRUPTION"})(Qm||(Qm={}));var Zm;(function(i){i.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",i.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",i.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(Zm||(Zm={}));var $m;(function(i){i.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",i.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",i.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",i.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",i.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",i.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",i.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",i.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",i.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",i.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",i.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",i.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",i.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})($m||($m={}));var Wm;(function(i){i.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",i.QUALITY="QUALITY",i.DIVERSITY="DIVERSITY",i.VOCALIZATION="VOCALIZATION"})(Wm||(Wm={}));var Zi;(function(i){i.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",i.PLAY="PLAY",i.PAUSE="PAUSE",i.STOP="STOP",i.RESET_CONTEXT="RESET_CONTEXT"})(Zi||(Zi={}));class vu{constructor(t){const l={};for(const a of t.headers.entries())l[a[0]]=a[1];this.headers=l,this.responseInternal=t}json(){return this.responseInternal.json()}}class jo{get text(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 h="",v=!1;const S=[];for(const E of(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[C,U]of Object.entries(E))C!=="text"&&C!=="thought"&&C!=="thoughtSignature"&&(U!==null||U!==void 0)&&S.push(C);if(typeof E.text=="string"){if(typeof E.thought=="boolean"&&E.thought)continue;v=!0,h+=E.text}}return S.length>0&&console.warn(`there are non-text parts ${S} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),v?h:void 0}get data(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 h="";const v=[];for(const S of(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[E,C]of Object.entries(S))E!=="inlineData"&&(C!==null||C!==void 0)&&v.push(E);S.inlineData&&typeof S.inlineData.data=="string"&&(h+=atob(S.inlineData.data))}return v.length>0&&console.warn(`there are non-data parts ${v} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),h.length>0?btoa(h):void 0}get functionCalls(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const h=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(v=>v.functionCall).map(v=>v.functionCall).filter(v=>v!==void 0);if((h==null?void 0:h.length)!==0)return h}get executableCode(){var t,l,a,r,f,m,g,y,h;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const v=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(S=>S.executableCode).map(S=>S.executableCode).filter(S=>S!==void 0);if((v==null?void 0:v.length)!==0)return(h=v==null?void 0:v[0])===null||h===void 0?void 0:h.code}get codeExecutionResult(){var t,l,a,r,f,m,g,y,h;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const v=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(S=>S.codeExecutionResult).map(S=>S.codeExecutionResult).filter(S=>S!==void 0);if((v==null?void 0:v.length)!==0)return(h=v==null?void 0:v[0])===null||h===void 0?void 0:h.output}}class jm{}class eh{}class iT{}class oT{}class lT{}class aT{}class th{}class nh{}class ih{}class sT{}class xa{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new xa;let r;const f=t;return l?r=J0(f):r=F0(f),Object.assign(a,r),a}}class oh{}class lh{}class ah{}class sh{}class rT{}class uT{}class cT{}class wu{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new wu,f=W0(t);return Object.assign(a,f),a}}class fT{}class dT{}class pT{}class rh{}class mT{get text(){var t,l,a;let r="",f=!1;const m=[];for(const g of(a=(l=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[y,h]of Object.entries(g))y!=="text"&&y!=="thought"&&h!==null&&m.push(y);if(typeof g.text=="string"){if(typeof g.thought=="boolean"&&g.thought)continue;f=!0,r+=g.text}}return m.length>0&&console.warn(`there are non-text parts ${m} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),f?r:void 0}get data(){var t,l,a;let r="";const f=[];for(const m of(a=(l=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[g,y]of Object.entries(m))g!=="inlineData"&&y!==null&&f.push(g);m.inlineData&&typeof m.inlineData.data=="string"&&(r+=atob(m.inlineData.data))}return f.length>0&&console.warn(`there are non-data parts ${f} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),r.length>0?btoa(r):void 0}}class hT{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class bu{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new bu,f=Vh(t);return Object.assign(a,f),a}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Te(i,t){if(!t||typeof t!="string")throw new Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw new Error("invalid model parameter");if(i.isVertexAI()){if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;if(t.indexOf("/")>=0){const l=t.split("/",2);return`publishers/${l[0]}/models/${l[1]}`}else return`publishers/google/models/${t}`}else return t.startsWith("models/")||t.startsWith("tunedModels/")?t:`models/${t}`}function zh(i,t){const l=Te(i,t);return l?l.startsWith("publishers/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/${l}`:l.startsWith("models/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/publishers/google/${l}`:l:""}function Bh(i){return Array.isArray(i)?i.map(t=>Da(t)):[Da(i)]}function Da(i){if(typeof i=="object"&&i!==null)return i;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof i}`)}function Ph(i){const t=Da(i);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function kh(i){const t=Da(i);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function uh(i){if(i==null)throw new Error("PartUnion is required");if(typeof i=="object")return i;if(typeof i=="string")return{text:i};throw new Error(`Unsupported part type: ${typeof i}`)}function Oh(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("PartListUnion is required");return Array.isArray(i)?i.map(t=>uh(t)):[uh(i)]}function Tu(i){return i!=null&&typeof i=="object"&&"parts"in i&&Array.isArray(i.parts)}function ch(i){return i!=null&&typeof i=="object"&&"functionCall"in i}function fh(i){return i!=null&&typeof i=="object"&&"functionResponse"in i}function it(i){if(i==null)throw new Error("ContentUnion is required");return Tu(i)?i:{role:"user",parts:Oh(i)}}function Lu(i,t){if(!t)return[];if(i.isVertexAI()&&Array.isArray(t))return t.flatMap(l=>{const a=it(l);return a.parts&&a.parts.length>0&&a.parts[0].text!==void 0?[a.parts[0].text]:[]});if(i.isVertexAI()){const l=it(t);return l.parts&&l.parts.length>0&&l.parts[0].text!==void 0?[l.parts[0].text]:[]}return Array.isArray(t)?t.map(l=>it(l)):[it(t)]}function Ht(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("contents are required");if(!Array.isArray(i)){if(ch(i)||fh(i))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[it(i)]}const t=[],l=[],a=Tu(i[0]);for(const r of i){const f=Tu(r);if(f!=a)throw new Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(f)t.push(r);else{if(ch(r)||fh(r))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");l.push(r)}}return a||t.push({role:"user",parts:Oh(l)}),t}function gT(i,t){i.includes("null")&&(t.nullable=!0);const l=i.filter(a=>a!=="null");if(l.length===1)t.type=Object.values(kn).includes(l[0].toUpperCase())?l[0].toUpperCase():kn.TYPE_UNSPECIFIED;else{t.anyOf=[];for(const a of l)t.anyOf.push({type:Object.values(kn).includes(a.toUpperCase())?a.toUpperCase():kn.TYPE_UNSPECIFIED})}}function Wi(i){const t={},l=["items"],a=["anyOf"],r=["properties"];if(i.type&&i.anyOf)throw new Error("type and anyOf cannot be both populated.");const f=i.anyOf;f!=null&&f.length==2&&(f[0].type==="null"?(t.nullable=!0,i=f[1]):f[1].type==="null"&&(t.nullable=!0,i=f[0])),i.type instanceof Array&&gT(i.type,t);for(const[m,g]of Object.entries(i))if(g!=null)if(m=="type"){if(g==="null")throw new Error("type: null can not be the only possible type for the field.");if(g instanceof Array)continue;t.type=Object.values(kn).includes(g.toUpperCase())?g.toUpperCase():kn.TYPE_UNSPECIFIED}else if(l.includes(m))t[m]=Wi(g);else if(a.includes(m)){const y=[];for(const h of g){if(h.type=="null"){t.nullable=!0;continue}y.push(Wi(h))}t[m]=y}else if(r.includes(m)){const y={};for(const[h,v]of Object.entries(g))y[h]=Wi(v);t[m]=y}else{if(m==="additionalProperties")continue;t[m]=g}return t}function Gu(i){return Wi(i)}function Hu(i){if(typeof i=="object")return i;if(typeof i=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:i}}};throw new Error(`Unsupported speechConfig type: ${typeof i}`)}function qu(i){if("multiSpeakerVoiceConfig"in i)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return i}function eo(i){if(i.functionDeclarations)for(const t of i.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes("$schema")?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=Wi(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=Wi(t.response));return i}function to(i){if(i==null)throw new Error("tools is required");if(!Array.isArray(i))throw new Error("tools is required and must be an array of Tools");const t=[];for(const l of i)t.push(l);return t}function yT(i,t,l,a=1){const r=!t.startsWith(`${l}/`)&&t.split("/").length===a;return i.isVertexAI()?t.startsWith("projects/")?t:t.startsWith("locations/")?`projects/${i.getProject()}/${t}`:t.startsWith(`${l}/`)?`projects/${i.getProject()}/locations/${i.getLocation()}/${t}`:r?`projects/${i.getProject()}/locations/${i.getLocation()}/${l}/${t}`:t:r?`${l}/${t}`:t}function gn(i,t){if(typeof t!="string")throw new Error("name must be a string");return yT(i,t,"cachedContents")}function Fh(i){switch(i){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 i}}function On(i){return Uu(i)}function vT(i){return i!=null&&typeof i=="object"&&"name"in i}function TT(i){return i!=null&&typeof i=="object"&&"video"in i}function ST(i){return i!=null&&typeof i=="object"&&"uri"in i}function Jh(i){var t;let l;if(vT(i)&&(l=i.name),!(ST(i)&&(l=i.uri,l===void 0))&&!(TT(i)&&(l=(t=i.video)===null||t===void 0?void 0:t.uri,l===void 0))){if(typeof i=="string"&&(l=i),l===void 0)throw new Error("Could not extract file name from the provided input.");if(l.startsWith("https://")){const r=l.split("files/")[1].match(/[a-z0-9]+/);if(r===null)throw new Error(`Could not extract file name from URI ${l}`);l=r[0]}else l.startsWith("files/")&&(l=l.split("files/")[1]);return l}}function Yh(i,t){let l;return i.isVertexAI()?l=t?"publishers/google/models":"models":l=t?"models":"tunedModels",l}function Xh(i){for(const t of["models","tunedModels","publisherModels"])if(ET(i,t))return i[t];return[]}function ET(i,t){return i!==null&&typeof i=="object"&&t in i}function _T(i,t={}){const l=i,a={name:l.name,description:l.description,parametersJsonSchema:l.inputSchema};return l.outputSchema&&(a.responseJsonSchema=l.outputSchema),t.behavior&&(a.behavior=t.behavior),{functionDeclarations:[a]}}function CT(i,t={}){const l=[],a=new Set;for(const r of i){const f=r.name;if(a.has(f))throw new Error(`Duplicate function name ${f} found in MCP tools. Please ensure function names are unique.`);a.add(f);const m=_T(r,t);m.functionDeclarations&&l.push(...m.functionDeclarations)}return{functionDeclarations:l}}function Kh(i,t){let l;if(typeof t=="string")if(i.isVertexAI())if(t.startsWith("gs://"))l={format:"jsonl",gcsUri:[t]};else if(t.startsWith("bq://"))l={format:"bigquery",bigqueryUri:t};else throw new Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))l={fileName:t};else throw new Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(i.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");l={inlinedRequests:t}}else l=t;const a=[l.gcsUri,l.bigqueryUri].filter(Boolean).length,r=[l.inlinedRequests,l.fileName].filter(Boolean).length;if(i.isVertexAI()){if(r>0||a!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(a>0||r!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return l}function AT(i){if(typeof i!="string")return i;const t=i;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};throw new Error(`Unsupported destination: ${t}`)}function Qh(i){if(typeof i!="object"||i===null)return{};const t=i,l=t.inlinedResponses;if(typeof l!="object"||l===null)return i;const r=l.inlinedResponses;if(!Array.isArray(r)||r.length===0)return i;let f=!1;for(const m of r){if(typeof m!="object"||m===null)continue;const y=m.response;if(typeof y!="object"||y===null)continue;if(y.embedding!==void 0){f=!0;break}}return f&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),i}function no(i,t){const l=t;if(!i.isVertexAI()){if(/batches\/[^/]+$/.test(l))return l.split("/").pop();throw new Error(`Invalid batch job name: ${l}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(l))return l.split("/").pop();if(/^\d+$/.test(l))return l;throw new Error(`Invalid batch job name: ${l}.`)}function Zh(i){const t=i;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}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function RT(i){const t={},l=u(i,["responsesFile"]);l!=null&&c(t,["fileName"],l);const a=u(i,["inlinedResponses","inlinedResponses"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>lS(m))),c(t,["inlinedResponses"],f)}const r=u(i,["inlinedEmbedContentResponses","inlinedResponses"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["inlinedEmbedContentResponses"],f)}return t}function MT(i){const t={},l=u(i,["predictionsFormat"]);l!=null&&c(t,["format"],l);const a=u(i,["gcsDestination","outputUriPrefix"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigqueryDestination","outputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function NT(i){const t={},l=u(i,["format"]);l!=null&&c(t,["predictionsFormat"],l);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsDestination","outputUriPrefix"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigqueryDestination","outputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(u(i,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return t}function Ma(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata","displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["metadata","state"]);r!=null&&c(t,["state"],Zh(r));const f=u(i,["metadata","createTime"]);f!=null&&c(t,["createTime"],f);const m=u(i,["metadata","endTime"]);m!=null&&c(t,["endTime"],m);const g=u(i,["metadata","updateTime"]);g!=null&&c(t,["updateTime"],g);const y=u(i,["metadata","model"]);y!=null&&c(t,["model"],y);const h=u(i,["metadata","output"]);return h!=null&&c(t,["dest"],RT(Qh(h))),t}function Su(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["state"]);r!=null&&c(t,["state"],Zh(r));const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["createTime"]);m!=null&&c(t,["createTime"],m);const g=u(i,["startTime"]);g!=null&&c(t,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(t,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(t,["updateTime"],h);const v=u(i,["model"]);v!=null&&c(t,["model"],v);const S=u(i,["inputConfig"]);S!=null&&c(t,["src"],IT(S));const E=u(i,["outputConfig"]);E!=null&&c(t,["dest"],MT(Qh(E)));const C=u(i,["completionStats"]);return C!=null&&c(t,["completionStats"],C),t}function IT(i){const t={},l=u(i,["instancesFormat"]);l!=null&&c(t,["format"],l);const a=u(i,["gcsSource","uris"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigquerySource","inputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function xT(i,t){const l={};if(u(t,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(u(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const a=u(t,["fileName"]);a!=null&&c(l,["fileName"],a);const r=u(t,["inlinedRequests"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>oS(i,m))),c(l,["requests","requests"],f)}return l}function DT(i){const t={},l=u(i,["format"]);l!=null&&c(t,["instancesFormat"],l);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsSource","uris"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigquerySource","inputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return t}function UT(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function wT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function bT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function LT(i){const t={},l=u(i,["content"]);l!=null&&c(t,["content"],l);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],GT(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const m=u(i,["avgLogprobs"]);m!=null&&c(t,["avgLogprobs"],m);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const h=u(i,["logprobsResult"]);h!=null&&c(t,["logprobsResult"],h);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(C=>C)),c(t,["safetyRatings"],E)}const S=u(i,["urlContextMetadata"]);return S!=null&&c(t,["urlContextMetadata"],S),t}function GT(i){const t={},l=u(i,["citationSources"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function $h(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>dS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function HT(i,t){const l={},a=u(i,["displayName"]);if(t!==void 0&&a!=null&&c(t,["batch","displayName"],a),u(i,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return l}function qT(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["dest"]);return t!==void 0&&r!=null&&c(t,["outputConfig"],NT(AT(r))),l}function dh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["batch","inputConfig"],xT(i,Kh(i,r)));const f=u(t,["config"]);return f!=null&&HT(f,l),l}function VT(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["inputConfig"],DT(Kh(i,r)));const f=u(t,["config"]);return f!=null&&qT(f,l),l}function zT(i,t){const l={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["batch","displayName"],a),l}function BT(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["batch","inputConfig"],XT(i,r));const f=u(t,["config"]);return f!=null&&zT(f,l),l}function PT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function kT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function OT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function FT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function JT(i,t){const l={},a=u(t,["contents"]);if(a!=null){let f=Lu(i,a);Array.isArray(f)&&(f=f.map(m=>m)),c(l,["requests[]","request","content"],f)}const r=u(t,["config"]);return r!=null&&(c(l,["_self"],YT(r,l)),k0(l,{"requests[].*":"requests[].request.*"})),l}function YT(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return l}function XT(i,t){const l={},a=u(t,["fileName"]);a!=null&&c(l,["file_name"],a);const r=u(t,["inlinedRequests"]);return r!=null&&c(l,["requests"],JT(i,r)),l}function KT(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function QT(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function ZT(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function $T(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],$h(it(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const U=u(t,["frequencyPenalty"]);U!=null&&c(a,["frequencyPenalty"],U);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);if(X!=null&&c(a,["responseJsonSchema"],X),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const k=u(t,["safetySettings"]);if(l!==void 0&&k!=null){let Ee=k;Array.isArray(Ee)&&(Ee=Ee.map(Pe=>pS(Pe))),c(l,["safetySettings"],Ee)}const K=u(t,["tools"]);if(l!==void 0&&K!=null){let Ee=to(K);Array.isArray(Ee)&&(Ee=Ee.map(Pe=>hS(eo(Pe)))),c(l,["tools"],Ee)}const ee=u(t,["toolConfig"]);if(l!==void 0&&ee!=null&&c(l,["toolConfig"],mS(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const te=u(t,["cachedContent"]);l!==void 0&&te!=null&&c(l,["cachedContent"],gn(i,te));const F=u(t,["responseModalities"]);F!=null&&c(a,["responseModalities"],F);const he=u(t,["mediaResolution"]);he!=null&&c(a,["mediaResolution"],he);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],Hu(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const Ce=u(t,["imageConfig"]);Ce!=null&&c(a,["imageConfig"],iS(Ce));const Ge=u(t,["enableEnhancedCivicAnswers"]);return Ge!=null&&c(a,["enableEnhancedCivicAnswers"],Ge),a}function WT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(h=>LT(h))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const m=u(i,["responseId"]);m!=null&&c(t,["responseId"],m);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function jT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function eS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function tS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function nS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function iS(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function oS(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["request","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let g=Ht(r);Array.isArray(g)&&(g=g.map(y=>$h(y))),c(l,["request","contents"],g)}const f=u(t,["metadata"]);f!=null&&c(l,["metadata"],f);const m=u(t,["config"]);return m!=null&&c(l,["request","generationConfig"],$T(i,m,u(l,["request"],{}))),l}function lS(i){const t={},l=u(i,["response"]);l!=null&&c(t,["response"],WT(l));const a=u(i,["error"]);return a!=null&&c(t,["error"],a),t}function aS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);if(t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),u(i,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return l}function sS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);t!==void 0&&r!=null&&c(t,["_query","pageToken"],r);const f=u(i,["filter"]);return t!==void 0&&f!=null&&c(t,["_query","filter"],f),l}function rS(i){const t={},l=u(i,["config"]);return l!=null&&aS(l,t),t}function uS(i){const t={},l=u(i,["config"]);return l!=null&&sS(l,t),t}function cS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["operations"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>Ma(m))),c(t,["batchJobs"],f)}return t}function fS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["batchPredictionJobs"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>Su(m))),c(t,["batchJobs"],f)}return t}function dS(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],KT(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],QT(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],UT(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function pS(i){const t={},l=u(i,["category"]);if(l!=null&&c(t,["category"],l),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function mS(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],ZT(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function hS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],tS(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],nS(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var mn;(function(i){i.PAGED_ITEM_BATCH_JOBS="batchJobs",i.PAGED_ITEM_MODELS="models",i.PAGED_ITEM_TUNING_JOBS="tuningJobs",i.PAGED_ITEM_FILES="files",i.PAGED_ITEM_CACHED_CONTENTS="cachedContents",i.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",i.PAGED_ITEM_DOCUMENTS="documents"})(mn||(mn={}));class ci{constructor(t,l,a,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=l,this.init(t,a,r)}init(t,l,a){var r,f;this.nameInternal=t,this.pageInternal=l[this.nameInternal]||[],this.sdkHttpResponseInternal=l==null?void 0:l.sdkHttpResponse,this.idxInternal=0;let m={config:{}};!a||Object.keys(a).length===0?m={config:{}}:typeof a=="object"?m=Object.assign({},a):m=a,m.config&&(m.config.pageToken=l.nextPageToken),this.paramsInternal=m,this.pageInternalSize=(f=(r=m.config)===null||r===void 0?void 0:r.pageSize)!==null&&f!==void 0?f:this.pageInternal.length}initNextPage(t){this.init(this.nameInternal,t,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(t){return this.pageInternal[t]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const t=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:t,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const t=await this.requestInternal(this.params);return this.initNextPage(t),this.page}hasNextPage(){var t;return((t=this.params.config)===null||t===void 0?void 0:t.pageToken)!==void 0}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class gS extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_BATCH_JOBS,a=>this.listInternal(a),await this.listInternal(l),l),this.create=async l=>(this.apiClient.isVertexAI()&&(l.config=this.formatDestination(l.src,l.config)),this.createInternal(l)),this.createEmbeddings=async l=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(l)}}createInlinedGenerateContentRequest(t){const l=dh(this.apiClient,t),a=l._url,r=Y("{model}:batchGenerateContent",a),g=l.batch.inputConfig.requests,y=g.requests,h=[];for(const v of y){const S=Object.assign({},v);if(S.systemInstruction){const E=S.systemInstruction;delete S.systemInstruction;const C=S.request;C.systemInstruction=E,S.request=C}h.push(S)}return g.requests=h,delete l.config,delete l._url,delete l._query,{path:r,body:l}}getGcsUri(t){if(typeof t=="string")return t.startsWith("gs://")?t:void 0;if(!Array.isArray(t)&&t.gcsUri&&t.gcsUri.length>0)return t.gcsUri[0]}getBigqueryUri(t){if(typeof t=="string")return t.startsWith("bq://")?t:void 0;if(!Array.isArray(t))return t.bigqueryUri}formatDestination(t,l){const a=l?Object.assign({},l):{},r=Date.now().toString();if(a.displayName||(a.displayName=`genaiBatchJob_${r}`),a.dest===void 0){const f=this.getGcsUri(t),m=this.getBigqueryUri(t);if(f)f.endsWith(".jsonl")?a.dest=`${f.slice(0,-6)}/dest`:a.dest=`${f}_dest_${r}`;else if(m)a.dest=`${m}_dest_${r}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return a}async createInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=VT(this.apiClient,t);return g=Y("batchPredictionJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>Su(v))}else{const h=dh(this.apiClient,t);return g=Y("{model}:batchGenerateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Ma(v))}}async createEmbeddingsInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=BT(this.apiClient,t);return f=Y("{model}:asyncBatchEmbedContent",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>Ma(y))}}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=eS(this.apiClient,t);return g=Y("batchPredictionJobs/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>Su(v))}else{const h=jT(this.apiClient,t);return g=Y("batches/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Ma(v))}}async cancel(t){var l,a,r,f;let m="",g={};if(this.apiClient.isVertexAI()){const y=bT(this.apiClient,t);m=Y("batchPredictionJobs/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:m,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}else{const y=wT(this.apiClient,t);m=Y("batches/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:m,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal})}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=uS(t);return g=Y("batchPredictionJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=fS(v),E=new rh;return Object.assign(E,S),E})}else{const h=rS(t);return g=Y("batches",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=cS(v),E=new rh;return Object.assign(E,S),E})}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=kT(this.apiClient,t);return g=Y("batchPredictionJobs/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>FT(v))}else{const h=PT(this.apiClient,t);return g=Y("batches/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>OT(v))}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function yS(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function ph(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>BS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function vS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const m=u(i,["contents"]);if(t!==void 0&&m!=null){let v=Ht(m);Array.isArray(v)&&(v=v.map(S=>ph(S))),c(t,["contents"],v)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],ph(it(g)));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let v=y;Array.isArray(v)&&(v=v.map(S=>kS(S))),c(t,["tools"],v)}const h=u(i,["toolConfig"]);if(t!==void 0&&h!=null&&c(t,["toolConfig"],PS(h)),u(i,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return l}function TS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const m=u(i,["contents"]);if(t!==void 0&&m!=null){let S=Ht(m);Array.isArray(S)&&(S=S.map(E=>E)),c(t,["contents"],S)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],it(g));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let S=y;Array.isArray(S)&&(S=S.map(E=>OS(E))),c(t,["tools"],S)}const h=u(i,["toolConfig"]);t!==void 0&&h!=null&&c(t,["toolConfig"],h);const v=u(i,["kmsKeyName"]);return t!==void 0&&v!=null&&c(t,["encryption_spec","kmsKeyName"],v),l}function SS(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],zh(i,a));const r=u(t,["config"]);return r!=null&&vS(r,l),l}function ES(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],zh(i,a));const r=u(t,["config"]);return r!=null&&TS(r,l),l}function _S(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function CS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function AS(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function RS(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function MS(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function NS(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function IS(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function xS(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function DS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function US(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function wS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function bS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function LS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function GS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function HS(i){const t={},l=u(i,["config"]);return l!=null&&LS(l,t),t}function qS(i){const t={},l=u(i,["config"]);return l!=null&&GS(l,t),t}function VS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["cachedContents"],f)}return t}function zS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["cachedContents"],f)}return t}function BS(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],MS(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],NS(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],yS(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function PS(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],IS(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function kS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],wS(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],bS(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function OS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>xS(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function FS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),l}function JS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),l}function YS(i,t){const l={},a=u(t,["name"]);a!=null&&c(l,["_url","name"],gn(i,a));const r=u(t,["config"]);return r!=null&&FS(r,l),l}function XS(i,t){const l={},a=u(t,["name"]);a!=null&&c(l,["_url","name"],gn(i,a));const r=u(t,["config"]);return r!=null&&JS(r,l),l}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class KS extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_CACHED_CONTENTS,a=>this.listInternal(a),await this.listInternal(l),l)}async create(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=ES(this.apiClient,t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=SS(this.apiClient,t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=US(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=DS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=CS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=RS(v),E=new ah;return Object.assign(E,S),E})}else{const h=_S(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=AS(v),E=new ah;return Object.assign(E,S),E})}}async update(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=XS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=YS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=qS(t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=zS(v),E=new sh;return Object.assign(E,S),E})}else{const h=HS(t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=VS(v),E=new sh;return Object.assign(E,S),E})}}}function Ua(i,t){var l={};for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&t.indexOf(a)<0&&(l[a]=i[a]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(i);r=i.length&&(i=void 0),{value:i&&i[a++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function oe(i){return this instanceof oe?(this.v=i,this):new oe(i)}function Pt(i,t,l){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=l.apply(i,t||[]),r,f=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),g("next"),g("throw"),g("return",m),r[Symbol.asyncIterator]=function(){return this},r;function m(C){return function(U){return Promise.resolve(U).then(C,S)}}function g(C,U){a[C]&&(r[C]=function(H){return new Promise(function(b,P){f.push([C,H,b,P])>1||y(C,H)})},U&&(r[C]=U(r[C])))}function y(C,U){try{h(a[C](U))}catch(H){E(f[0][3],H)}}function h(C){C.value instanceof oe?Promise.resolve(C.value.v).then(v,S):E(f[0][2],C)}function v(C){y("next",C)}function S(C){y("throw",C)}function E(C,U){C(U),f.shift(),f.length&&y(f[0][0],f[0][1])}}function kt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],l;return t?t.call(i):(i=typeof mh=="function"?mh(i):i[Symbol.iterator](),l={},a("next"),a("throw"),a("return"),l[Symbol.asyncIterator]=function(){return this},l);function a(f){l[f]=i[f]&&function(m){return new Promise(function(g,y){m=i[f](m),r(g,y,m.done,m.value)})}}function r(f,m,g,y){Promise.resolve(y).then(function(h){f({value:h,done:g})},m)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function QS(i){var t;if(i.candidates==null||i.candidates.length===0)return!1;const l=(t=i.candidates[0])===null||t===void 0?void 0:t.content;return l===void 0?!1:Wh(l)}function Wh(i){if(i.parts===void 0||i.parts.length===0)return!1;for(const t of i.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function ZS(i){if(i.length!==0){for(const t of i)if(t.role!=="user"&&t.role!=="model")throw new Error(`Role must be user or model, but got ${t.role}.`)}}function hh(i){if(i===void 0||i.length===0)return[];const t=[],l=i.length;let a=0;for(;a{var f,m,g;const y=await r,h=(m=(f=y.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content,v=y.automaticFunctionCallingHistory,S=this.getHistory(!0).length;let E=[];v!=null&&(E=(g=v.slice(S))!==null&&g!==void 0?g:[]);const C=h?[h]:[];this.recordHistory(a,C,E)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),r}async sendMessageStream(t){var l;await this.sendPromise;const a=it(t.message),r=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(a),config:(l=t.config)!==null&&l!==void 0?l:this.config});this.sendPromise=r.then(()=>{}).catch(()=>{});const f=await r;return this.processStreamResponse(f,a)}getHistory(t=!1){const l=t?hh(this.history):this.history;return structuredClone(l)}processStreamResponse(t,l){return Pt(this,arguments,function*(){var r,f,m,g,y,h;const v=[];try{for(var S=!0,E=kt(t),C;C=yield oe(E.next()),r=C.done,!r;S=!0){g=C.value,S=!1;const U=g;if(QS(U)){const H=(h=(y=U.candidates)===null||y===void 0?void 0:y[0])===null||h===void 0?void 0:h.content;H!==void 0&&v.push(H)}yield yield oe(U)}}catch(U){f={error:U}}finally{try{!S&&!r&&(m=E.return)&&(yield oe(m.call(E)))}finally{if(f)throw f.error}}this.recordHistory(l,v)})}recordHistory(t,l,a){let r=[];l.length>0&&l.every(f=>f.role!==void 0)?r=l:r.push({role:"model",parts:[]}),a&&a.length>0?this.history.push(...hh(a)):this.history.push(t),this.history.push(...r)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class La extends Error{constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,La.prototype)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function jS(i){const t={},l=u(i,["file"]);return l!=null&&c(t,["file"],l),t}function eE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function tE(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","file"],Jh(l)),t}function nE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function iE(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","file"],Jh(l)),t}function oE(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function lE(i){const t={},l=u(i,["config"]);return l!=null&&oE(l,t),t}function aE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["files"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["files"],f)}return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class sE extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_FILES,a=>this.listInternal(a),await this.listInternal(l),l)}async upload(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(t.file,t.config).then(l=>l)}async download(t){await this.apiClient.downloadFile(t)}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=lE(t);return f=Y("files",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=aE(y),v=new fT;return Object.assign(v,h),v})}}async createInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=jS(t);return f=Y("upload/v1beta/files",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=eE(y),v=new dT;return Object.assign(v,h),v})}}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=iE(t);return f=Y("files/{file}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=tE(t);return f=Y("files/{file}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=nE(y),v=new pT;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Na(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function rE(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>AE(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function uE(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function cE(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function fE(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function dE(i){const t={},l=u(i,["modelSelectionConfig"]);l!=null&&c(t,["modelConfig"],l);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const m=u(i,["enableAffectiveDialog"]);m!=null&&c(t,["enableAffectiveDialog"],m);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const h=u(i,["maxOutputTokens"]);h!=null&&c(t,["maxOutputTokens"],h);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const S=u(i,["presencePenalty"]);S!=null&&c(t,["presencePenalty"],S);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const C=u(i,["responseMimeType"]);C!=null&&c(t,["responseMimeType"],C);const U=u(i,["responseModalities"]);U!=null&&c(t,["responseModalities"],U);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const b=u(i,["routingConfig"]);b!=null&&c(t,["routingConfig"],b);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const X=u(i,["speechConfig"]);X!=null&&c(t,["speechConfig"],X);const k=u(i,["stopSequences"]);k!=null&&c(t,["stopSequences"],k);const K=u(i,["temperature"]);K!=null&&c(t,["temperature"],K);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const te=u(i,["topK"]);te!=null&&c(t,["topK"],te);const F=u(i,["topP"]);if(F!=null&&c(t,["topP"],F),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function pE(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function mE(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function hE(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const U=u(i,["systemInstruction"]);t!==void 0&&U!=null&&c(t,["setup","systemInstruction"],rE(it(U)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let te=to(H);Array.isArray(te)&&(te=te.map(F=>ME(eo(F)))),c(t,["setup","tools"],te)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],RE(b));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return l}function gE(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],dE(a));const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const U=u(i,["systemInstruction"]);t!==void 0&&U!=null&&c(t,["setup","systemInstruction"],it(U));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let F=to(H);Array.isArray(F)&&(F=F.map(he=>NE(eo(he)))),c(t,["setup","tools"],F)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],b);const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee);const te=u(i,["explicitVadSignal"]);return t!==void 0&&te!=null&&c(t,["setup","explicitVadSignal"],te),l}function yE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],hE(r,l)),l}function vE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],gE(r,l)),l}function TE(i){const t={},l=u(i,["musicGenerationConfig"]);return l!=null&&c(t,["musicGenerationConfig"],l),t}function SE(i){const t={},l=u(i,["weightedPrompts"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["weightedPrompts"],a)}return t}function EE(i){const t={},l=u(i,["media"]);if(l!=null){let h=Bh(l);Array.isArray(h)&&(h=h.map(v=>Na(v))),c(t,["mediaChunks"],h)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],Na(kh(a)));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Na(Ph(f)));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function _E(i){const t={},l=u(i,["media"]);if(l!=null){let h=Bh(l);Array.isArray(h)&&(h=h.map(v=>v)),c(t,["mediaChunks"],h)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],kh(a));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Ph(f));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function CE(i){const t={},l=u(i,["setupComplete"]);l!=null&&c(t,["setupComplete"],l);const a=u(i,["serverContent"]);a!=null&&c(t,["serverContent"],a);const r=u(i,["toolCall"]);r!=null&&c(t,["toolCall"],r);const f=u(i,["toolCallCancellation"]);f!=null&&c(t,["toolCallCancellation"],f);const m=u(i,["usageMetadata"]);m!=null&&c(t,["usageMetadata"],IE(m));const g=u(i,["goAway"]);g!=null&&c(t,["goAway"],g);const y=u(i,["sessionResumptionUpdate"]);y!=null&&c(t,["sessionResumptionUpdate"],y);const h=u(i,["voiceActivityDetectionSignal"]);return h!=null&&c(t,["voiceActivityDetectionSignal"],h),t}function AE(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],uE(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],cE(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],Na(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function RE(i){const t={},l=u(i,["handle"]);if(l!=null&&c(t,["handle"],l),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function ME(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],pE(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],mE(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function NE(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>fE(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function IE(i){const t={},l=u(i,["promptTokenCount"]);l!=null&&c(t,["promptTokenCount"],l);const a=u(i,["cachedContentTokenCount"]);a!=null&&c(t,["cachedContentTokenCount"],a);const r=u(i,["candidatesTokenCount"]);r!=null&&c(t,["responseTokenCount"],r);const f=u(i,["toolUsePromptTokenCount"]);f!=null&&c(t,["toolUsePromptTokenCount"],f);const m=u(i,["thoughtsTokenCount"]);m!=null&&c(t,["thoughtsTokenCount"],m);const g=u(i,["totalTokenCount"]);g!=null&&c(t,["totalTokenCount"],g);const y=u(i,["promptTokensDetails"]);if(y!=null){let C=y;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["promptTokensDetails"],C)}const h=u(i,["cacheTokensDetails"]);if(h!=null){let C=h;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["cacheTokensDetails"],C)}const v=u(i,["candidatesTokensDetails"]);if(v!=null){let C=v;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["responseTokensDetails"],C)}const S=u(i,["toolUsePromptTokensDetails"]);if(S!=null){let C=S;Array.isArray(C)&&(C=C.map(U=>U)),c(t,["toolUsePromptTokensDetails"],C)}const E=u(i,["trafficType"]);return E!=null&&c(t,["trafficType"],E),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function xE(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function DE(i){const t={},l=u(i,["content"]);l!=null&&c(t,["content"],l);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],UE(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const m=u(i,["avgLogprobs"]);m!=null&&c(t,["avgLogprobs"],m);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const h=u(i,["logprobsResult"]);h!=null&&c(t,["logprobsResult"],h);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(C=>C)),c(t,["safetyRatings"],E)}const S=u(i,["urlContextMetadata"]);return S!=null&&c(t,["urlContextMetadata"],S),t}function UE(i){const t={},l=u(i,["citationSources"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function wE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let f=Ht(r);Array.isArray(f)&&(f=f.map(m=>m)),c(l,["contents"],f)}return l}function bE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["tokensInfo"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["tokensInfo"],r)}return t}function LE(i){const t={},l=u(i,["values"]);l!=null&&c(t,["values"],l);const a=u(i,["statistics"]);return a!=null&&c(t,["statistics"],GE(a)),t}function GE(i){const t={},l=u(i,["truncated"]);l!=null&&c(t,["truncated"],l);const a=u(i,["token_count"]);return a!=null&&c(t,["tokenCount"],a),t}function Ga(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>F_(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function HE(i){const t={},l=u(i,["controlType"]);l!=null&&c(t,["controlType"],l);const a=u(i,["enableControlImageComputation"]);return a!=null&&c(t,["computeControl"],a),t}function qE(i){const t={};if(u(i,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(u(i,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(u(i,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return t}function VE(i,t){const l={},a=u(i,["systemInstruction"]);t!==void 0&&a!=null&&c(t,["systemInstruction"],it(a));const r=u(i,["tools"]);if(t!==void 0&&r!=null){let m=r;Array.isArray(m)&&(m=m.map(g=>ng(g))),c(t,["tools"],m)}const f=u(i,["generationConfig"]);return t!==void 0&&f!=null&&c(t,["generationConfig"],x_(f)),l}function zE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>Ga(g))),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&qE(f),l}function BE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&VE(f,l),l}function PE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["totalTokens"]);a!=null&&c(t,["totalTokens"],a);const r=u(i,["cachedContentTokenCount"]);return r!=null&&c(t,["cachedContentTokenCount"],r),t}function kE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["totalTokens"]);return a!=null&&c(t,["totalTokens"],a),t}function OE(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function FE(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function JE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function YE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function XE(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["negativePrompt"]);t!==void 0&&r!=null&&c(t,["parameters","negativePrompt"],r);const f=u(i,["numberOfImages"]);t!==void 0&&f!=null&&c(t,["parameters","sampleCount"],f);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const g=u(i,["guidanceScale"]);t!==void 0&&g!=null&&c(t,["parameters","guidanceScale"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const h=u(i,["safetyFilterLevel"]);t!==void 0&&h!=null&&c(t,["parameters","safetySetting"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["includeSafetyAttributes"]);t!==void 0&&S!=null&&c(t,["parameters","includeSafetyAttributes"],S);const E=u(i,["includeRaiReason"]);t!==void 0&&E!=null&&c(t,["parameters","includeRaiReason"],E);const C=u(i,["language"]);t!==void 0&&C!=null&&c(t,["parameters","language"],C);const U=u(i,["outputMimeType"]);t!==void 0&&U!=null&&c(t,["parameters","outputOptions","mimeType"],U);const H=u(i,["outputCompressionQuality"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","compressionQuality"],H);const b=u(i,["addWatermark"]);t!==void 0&&b!=null&&c(t,["parameters","addWatermark"],b);const P=u(i,["labels"]);t!==void 0&&P!=null&&c(t,["labels"],P);const X=u(i,["editMode"]);t!==void 0&&X!=null&&c(t,["parameters","editMode"],X);const k=u(i,["baseSteps"]);return t!==void 0&&k!=null&&c(t,["parameters","editConfig","baseSteps"],k),l}function KE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["referenceImages"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>Z_(y))),c(l,["instances[0]","referenceImages"],g)}const m=u(t,["config"]);return m!=null&&XE(m,l),l}function QE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>Ha(f))),c(t,["generatedImages"],r)}return t}function ZE(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return l}function $E(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["instances[]","task_type"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["instances[]","title"],r);const f=u(i,["outputDimensionality"]);t!==void 0&&f!=null&&c(t,["parameters","outputDimensionality"],f);const m=u(i,["mimeType"]);t!==void 0&&m!=null&&c(t,["instances[]","mimeType"],m);const g=u(i,["autoTruncate"]);return t!==void 0&&g!=null&&c(t,["parameters","autoTruncate"],g),l}function WE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let g=Lu(i,r);Array.isArray(g)&&(g=g.map(y=>y)),c(l,["requests[]","content"],g)}const f=u(t,["config"]);f!=null&&ZE(f,l);const m=u(t,["model"]);return m!==void 0&&c(l,["requests[]","model"],Te(i,m)),l}function jE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Lu(i,r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["instances[]","content"],m)}const f=u(t,["config"]);return f!=null&&$E(f,l),l}function e_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["embeddings"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["embeddings"],f)}const r=u(i,["metadata"]);return r!=null&&c(t,["metadata"],r),t}function t_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions[]","embeddings"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>LE(m))),c(t,["embeddings"],f)}const r=u(i,["metadata"]);return r!=null&&c(t,["metadata"],r),t}function n_(i){const t={},l=u(i,["endpoint"]);l!=null&&c(t,["name"],l);const a=u(i,["deployedModelId"]);return a!=null&&c(t,["deployedModelId"],a),t}function i_(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function o_(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function l_(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function a_(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function s_(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],Ga(it(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const U=u(t,["frequencyPenalty"]);U!=null&&c(a,["frequencyPenalty"],U);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);if(X!=null&&c(a,["responseJsonSchema"],X),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const k=u(t,["safetySettings"]);if(l!==void 0&&k!=null){let Ee=k;Array.isArray(Ee)&&(Ee=Ee.map(Pe=>$_(Pe))),c(l,["safetySettings"],Ee)}const K=u(t,["tools"]);if(l!==void 0&&K!=null){let Ee=to(K);Array.isArray(Ee)&&(Ee=Ee.map(Pe=>oC(eo(Pe)))),c(l,["tools"],Ee)}const ee=u(t,["toolConfig"]);if(l!==void 0&&ee!=null&&c(l,["toolConfig"],iC(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const te=u(t,["cachedContent"]);l!==void 0&&te!=null&&c(l,["cachedContent"],gn(i,te));const F=u(t,["responseModalities"]);F!=null&&c(a,["responseModalities"],F);const he=u(t,["mediaResolution"]);he!=null&&c(a,["mediaResolution"],he);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],Hu(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const Ce=u(t,["imageConfig"]);Ce!=null&&c(a,["imageConfig"],L_(Ce));const Ge=u(t,["enableEnhancedCivicAnswers"]);return Ge!=null&&c(a,["enableEnhancedCivicAnswers"],Ge),a}function r_(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],it(r));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const U=u(t,["frequencyPenalty"]);U!=null&&c(a,["frequencyPenalty"],U);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);X!=null&&c(a,["responseJsonSchema"],X);const k=u(t,["routingConfig"]);k!=null&&c(a,["routingConfig"],k);const K=u(t,["modelSelectionConfig"]);K!=null&&c(a,["modelConfig"],K);const ee=u(t,["safetySettings"]);if(l!==void 0&&ee!=null){let L=ee;Array.isArray(L)&&(L=L.map(O=>O)),c(l,["safetySettings"],L)}const te=u(t,["tools"]);if(l!==void 0&&te!=null){let L=to(te);Array.isArray(L)&&(L=L.map(O=>ng(eo(O)))),c(l,["tools"],L)}const F=u(t,["toolConfig"]);l!==void 0&&F!=null&&c(l,["toolConfig"],F);const he=u(t,["labels"]);l!==void 0&&he!=null&&c(l,["labels"],he);const W=u(t,["cachedContent"]);l!==void 0&&W!=null&&c(l,["cachedContent"],gn(i,W));const de=u(t,["responseModalities"]);de!=null&&c(a,["responseModalities"],de);const Ce=u(t,["mediaResolution"]);Ce!=null&&c(a,["mediaResolution"],Ce);const Ge=u(t,["speechConfig"]);Ge!=null&&c(a,["speechConfig"],Hu(Ge));const Ee=u(t,["audioTimestamp"]);Ee!=null&&c(a,["audioTimestamp"],Ee);const Pe=u(t,["thinkingConfig"]);Pe!=null&&c(a,["thinkingConfig"],Pe);const rt=u(t,["imageConfig"]);if(rt!=null&&c(a,["imageConfig"],G_(rt)),u(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return a}function gh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>Ga(g))),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&c(l,["generationConfig"],s_(i,f,l)),l}function yh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&c(l,["generationConfig"],r_(i,f,l)),l}function vh(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(h=>DE(h))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const m=u(i,["responseId"]);m!=null&&c(t,["responseId"],m);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function Th(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let h=a;Array.isArray(h)&&(h=h.map(v=>v)),c(t,["candidates"],h)}const r=u(i,["createTime"]);r!=null&&c(t,["createTime"],r);const f=u(i,["modelVersion"]);f!=null&&c(t,["modelVersion"],f);const m=u(i,["promptFeedback"]);m!=null&&c(t,["promptFeedback"],m);const g=u(i,["responseId"]);g!=null&&c(t,["responseId"],g);const y=u(i,["usageMetadata"]);return y!=null&&c(t,["usageMetadata"],y),t}function u_(i,t){const l={};if(u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const a=u(i,["numberOfImages"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["aspectRatio"]);t!==void 0&&r!=null&&c(t,["parameters","aspectRatio"],r);const f=u(i,["guidanceScale"]);if(t!==void 0&&f!=null&&c(t,["parameters","guidanceScale"],f),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const m=u(i,["safetyFilterLevel"]);t!==void 0&&m!=null&&c(t,["parameters","safetySetting"],m);const g=u(i,["personGeneration"]);t!==void 0&&g!=null&&c(t,["parameters","personGeneration"],g);const y=u(i,["includeSafetyAttributes"]);t!==void 0&&y!=null&&c(t,["parameters","includeSafetyAttributes"],y);const h=u(i,["includeRaiReason"]);t!==void 0&&h!=null&&c(t,["parameters","includeRaiReason"],h);const v=u(i,["language"]);t!==void 0&&v!=null&&c(t,["parameters","language"],v);const S=u(i,["outputMimeType"]);t!==void 0&&S!=null&&c(t,["parameters","outputOptions","mimeType"],S);const E=u(i,["outputCompressionQuality"]);if(t!==void 0&&E!=null&&c(t,["parameters","outputOptions","compressionQuality"],E),u(i,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const C=u(i,["imageSize"]);if(t!==void 0&&C!=null&&c(t,["parameters","sampleImageSize"],C),u(i,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return l}function c_(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["negativePrompt"]);t!==void 0&&r!=null&&c(t,["parameters","negativePrompt"],r);const f=u(i,["numberOfImages"]);t!==void 0&&f!=null&&c(t,["parameters","sampleCount"],f);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const g=u(i,["guidanceScale"]);t!==void 0&&g!=null&&c(t,["parameters","guidanceScale"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const h=u(i,["safetyFilterLevel"]);t!==void 0&&h!=null&&c(t,["parameters","safetySetting"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["includeSafetyAttributes"]);t!==void 0&&S!=null&&c(t,["parameters","includeSafetyAttributes"],S);const E=u(i,["includeRaiReason"]);t!==void 0&&E!=null&&c(t,["parameters","includeRaiReason"],E);const C=u(i,["language"]);t!==void 0&&C!=null&&c(t,["parameters","language"],C);const U=u(i,["outputMimeType"]);t!==void 0&&U!=null&&c(t,["parameters","outputOptions","mimeType"],U);const H=u(i,["outputCompressionQuality"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","compressionQuality"],H);const b=u(i,["addWatermark"]);t!==void 0&&b!=null&&c(t,["parameters","addWatermark"],b);const P=u(i,["labels"]);t!==void 0&&P!=null&&c(t,["labels"],P);const X=u(i,["imageSize"]);t!==void 0&&X!=null&&c(t,["parameters","sampleImageSize"],X);const k=u(i,["enhancePrompt"]);return t!==void 0&&k!=null&&c(t,["parameters","enhancePrompt"],k),l}function f_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["config"]);return f!=null&&u_(f,l),l}function d_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["config"]);return f!=null&&c_(f,l),l}function p_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>R_(m))),c(t,["generatedImages"],f)}const r=u(i,["positivePromptSafetyAttributes"]);return r!=null&&c(t,["positivePromptSafetyAttributes"],eg(r)),t}function m_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>Ha(m))),c(t,["generatedImages"],f)}const r=u(i,["positivePromptSafetyAttributes"]);return r!=null&&c(t,["positivePromptSafetyAttributes"],tg(r)),t}function h_(i,t){const l={},a=u(i,["numberOfVideos"]);if(t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a),u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const r=u(i,["durationSeconds"]);if(t!==void 0&&r!=null&&c(t,["parameters","durationSeconds"],r),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const f=u(i,["aspectRatio"]);t!==void 0&&f!=null&&c(t,["parameters","aspectRatio"],f);const m=u(i,["resolution"]);t!==void 0&&m!=null&&c(t,["parameters","resolution"],m);const g=u(i,["personGeneration"]);if(t!==void 0&&g!=null&&c(t,["parameters","personGeneration"],g),u(i,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const y=u(i,["negativePrompt"]);t!==void 0&&y!=null&&c(t,["parameters","negativePrompt"],y);const h=u(i,["enhancePrompt"]);if(t!==void 0&&h!=null&&c(t,["parameters","enhancePrompt"],h),u(i,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const v=u(i,["lastFrame"]);t!==void 0&&v!=null&&c(t,["instances[0]","lastFrame"],qa(v));const S=u(i,["referenceImages"]);if(t!==void 0&&S!=null){let E=S;Array.isArray(E)&&(E=E.map(C=>yC(C))),c(t,["instances[0]","referenceImages"],E)}if(u(i,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(u(i,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return l}function g_(i,t){const l={},a=u(i,["numberOfVideos"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["outputGcsUri"]);t!==void 0&&r!=null&&c(t,["parameters","storageUri"],r);const f=u(i,["fps"]);t!==void 0&&f!=null&&c(t,["parameters","fps"],f);const m=u(i,["durationSeconds"]);t!==void 0&&m!=null&&c(t,["parameters","durationSeconds"],m);const g=u(i,["seed"]);t!==void 0&&g!=null&&c(t,["parameters","seed"],g);const y=u(i,["aspectRatio"]);t!==void 0&&y!=null&&c(t,["parameters","aspectRatio"],y);const h=u(i,["resolution"]);t!==void 0&&h!=null&&c(t,["parameters","resolution"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["pubsubTopic"]);t!==void 0&&S!=null&&c(t,["parameters","pubsubTopic"],S);const E=u(i,["negativePrompt"]);t!==void 0&&E!=null&&c(t,["parameters","negativePrompt"],E);const C=u(i,["enhancePrompt"]);t!==void 0&&C!=null&&c(t,["parameters","enhancePrompt"],C);const U=u(i,["generateAudio"]);t!==void 0&&U!=null&&c(t,["parameters","generateAudio"],U);const H=u(i,["lastFrame"]);t!==void 0&&H!=null&&c(t,["instances[0]","lastFrame"],Ot(H));const b=u(i,["referenceImages"]);if(t!==void 0&&b!=null){let k=b;Array.isArray(k)&&(k=k.map(K=>vC(K))),c(t,["instances[0]","referenceImages"],k)}const P=u(i,["mask"]);t!==void 0&&P!=null&&c(t,["instances[0]","mask"],gC(P));const X=u(i,["compressionQuality"]);return t!==void 0&&X!=null&&c(t,["parameters","compressionQuality"],X),l}function y_(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response","generateVideoResponse"]);return m!=null&&c(t,["response"],E_(m)),t}function v_(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],__(m)),t}function T_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["image"]);f!=null&&c(l,["instances[0]","image"],qa(f));const m=u(t,["video"]);m!=null&&c(l,["instances[0]","video"],ig(m));const g=u(t,["source"]);g!=null&&C_(g,l);const y=u(t,["config"]);return y!=null&&h_(y,l),l}function S_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["image"]);f!=null&&c(l,["instances[0]","image"],Ot(f));const m=u(t,["video"]);m!=null&&c(l,["instances[0]","video"],og(m));const g=u(t,["source"]);g!=null&&A_(g,l);const y=u(t,["config"]);return y!=null&&g_(y,l),l}function E_(i){const t={},l=u(i,["generatedSamples"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>N_(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function __(i){const t={},l=u(i,["videos"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>I_(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function C_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],qa(r));const f=u(i,["video"]);return t!==void 0&&f!=null&&c(t,["instances[0]","video"],ig(f)),l}function A_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Ot(r));const f=u(i,["video"]);return t!==void 0&&f!=null&&c(t,["instances[0]","video"],og(f)),l}function R_(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["image"],H_(l));const a=u(i,["raiFilteredReason"]);a!=null&&c(t,["raiFilteredReason"],a);const r=u(i,["_self"]);return r!=null&&c(t,["safetyAttributes"],eg(r)),t}function Ha(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["image"],jh(l));const a=u(i,["raiFilteredReason"]);a!=null&&c(t,["raiFilteredReason"],a);const r=u(i,["_self"]);r!=null&&c(t,["safetyAttributes"],tg(r));const f=u(i,["prompt"]);return f!=null&&c(t,["enhancedPrompt"],f),t}function M_(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["mask"],jh(l));const a=u(i,["labels"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["labels"],r)}return t}function N_(i){const t={},l=u(i,["video"]);return l!=null&&c(t,["video"],mC(l)),t}function I_(i){const t={},l=u(i,["_self"]);return l!=null&&c(t,["video"],hC(l)),t}function x_(i){const t={},l=u(i,["modelSelectionConfig"]);l!=null&&c(t,["modelConfig"],l);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const m=u(i,["enableAffectiveDialog"]);m!=null&&c(t,["enableAffectiveDialog"],m);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const h=u(i,["maxOutputTokens"]);h!=null&&c(t,["maxOutputTokens"],h);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const S=u(i,["presencePenalty"]);S!=null&&c(t,["presencePenalty"],S);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const C=u(i,["responseMimeType"]);C!=null&&c(t,["responseMimeType"],C);const U=u(i,["responseModalities"]);U!=null&&c(t,["responseModalities"],U);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const b=u(i,["routingConfig"]);b!=null&&c(t,["routingConfig"],b);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const X=u(i,["speechConfig"]);X!=null&&c(t,["speechConfig"],X);const k=u(i,["stopSequences"]);k!=null&&c(t,["stopSequences"],k);const K=u(i,["temperature"]);K!=null&&c(t,["temperature"],K);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const te=u(i,["topK"]);te!=null&&c(t,["topK"],te);const F=u(i,["topP"]);if(F!=null&&c(t,["topP"],F),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function D_(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function U_(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function w_(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function b_(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function L_(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function G_(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);a!=null&&c(t,["imageSize"],a);const r=u(i,["outputMimeType"]);r!=null&&c(t,["imageOutputOptions","mimeType"],r);const f=u(i,["outputCompressionQuality"]);return f!=null&&c(t,["imageOutputOptions","compressionQuality"],f),t}function H_(i){const t={},l=u(i,["bytesBase64Encoded"]);l!=null&&c(t,["imageBytes"],On(l));const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function jh(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["imageBytes"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function qa(i){const t={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const l=u(i,["imageBytes"]);l!=null&&c(t,["bytesBase64Encoded"],On(l));const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function Ot(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["imageBytes"]);a!=null&&c(t,["bytesBase64Encoded"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function q_(i,t,l){const a={},r=u(t,["pageSize"]);l!==void 0&&r!=null&&c(l,["_query","pageSize"],r);const f=u(t,["pageToken"]);l!==void 0&&f!=null&&c(l,["_query","pageToken"],f);const m=u(t,["filter"]);l!==void 0&&m!=null&&c(l,["_query","filter"],m);const g=u(t,["queryBase"]);return l!==void 0&&g!=null&&c(l,["_url","models_url"],Yh(i,g)),a}function V_(i,t,l){const a={},r=u(t,["pageSize"]);l!==void 0&&r!=null&&c(l,["_query","pageSize"],r);const f=u(t,["pageToken"]);l!==void 0&&f!=null&&c(l,["_query","pageToken"],f);const m=u(t,["filter"]);l!==void 0&&m!=null&&c(l,["_query","filter"],m);const g=u(t,["queryBase"]);return l!==void 0&&g!=null&&c(l,["_url","models_url"],Yh(i,g)),a}function z_(i,t){const l={},a=u(t,["config"]);return a!=null&&q_(i,a,l),l}function B_(i,t){const l={},a=u(t,["config"]);return a!=null&&V_(i,a,l),l}function P_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["_self"]);if(r!=null){let f=Xh(r);Array.isArray(f)&&(f=f.map(m=>Eu(m))),c(t,["models"],f)}return t}function k_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["_self"]);if(r!=null){let f=Xh(r);Array.isArray(f)&&(f=f.map(m=>_u(m))),c(t,["models"],f)}return t}function O_(i){const t={},l=u(i,["maskMode"]);l!=null&&c(t,["maskMode"],l);const a=u(i,["segmentationClasses"]);a!=null&&c(t,["maskClasses"],a);const r=u(i,["maskDilation"]);return r!=null&&c(t,["dilation"],r),t}function Eu(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);r!=null&&c(t,["description"],r);const f=u(i,["version"]);f!=null&&c(t,["version"],f);const m=u(i,["_self"]);m!=null&&c(t,["tunedModelInfo"],lC(m));const g=u(i,["inputTokenLimit"]);g!=null&&c(t,["inputTokenLimit"],g);const y=u(i,["outputTokenLimit"]);y!=null&&c(t,["outputTokenLimit"],y);const h=u(i,["supportedGenerationMethods"]);h!=null&&c(t,["supportedActions"],h);const v=u(i,["temperature"]);v!=null&&c(t,["temperature"],v);const S=u(i,["maxTemperature"]);S!=null&&c(t,["maxTemperature"],S);const E=u(i,["topP"]);E!=null&&c(t,["topP"],E);const C=u(i,["topK"]);C!=null&&c(t,["topK"],C);const U=u(i,["thinking"]);return U!=null&&c(t,["thinking"],U),t}function _u(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);r!=null&&c(t,["description"],r);const f=u(i,["versionId"]);f!=null&&c(t,["version"],f);const m=u(i,["deployedModels"]);if(m!=null){let S=m;Array.isArray(S)&&(S=S.map(E=>n_(E))),c(t,["endpoints"],S)}const g=u(i,["labels"]);g!=null&&c(t,["labels"],g);const y=u(i,["_self"]);y!=null&&c(t,["tunedModelInfo"],aC(y));const h=u(i,["defaultCheckpointId"]);h!=null&&c(t,["defaultCheckpointId"],h);const v=u(i,["checkpoints"]);if(v!=null){let S=v;Array.isArray(S)&&(S=S.map(E=>E)),c(t,["checkpoints"],S)}return t}function F_(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],i_(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],o_(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],xE(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function J_(i){const t={},l=u(i,["productImage"]);return l!=null&&c(t,["image"],Ot(l)),t}function Y_(i,t){const l={},a=u(i,["numberOfImages"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["baseSteps"]);t!==void 0&&r!=null&&c(t,["parameters","baseSteps"],r);const f=u(i,["outputGcsUri"]);t!==void 0&&f!=null&&c(t,["parameters","storageUri"],f);const m=u(i,["seed"]);t!==void 0&&m!=null&&c(t,["parameters","seed"],m);const g=u(i,["safetyFilterLevel"]);t!==void 0&&g!=null&&c(t,["parameters","safetySetting"],g);const y=u(i,["personGeneration"]);t!==void 0&&y!=null&&c(t,["parameters","personGeneration"],y);const h=u(i,["addWatermark"]);t!==void 0&&h!=null&&c(t,["parameters","addWatermark"],h);const v=u(i,["outputMimeType"]);t!==void 0&&v!=null&&c(t,["parameters","outputOptions","mimeType"],v);const S=u(i,["outputCompressionQuality"]);t!==void 0&&S!=null&&c(t,["parameters","outputOptions","compressionQuality"],S);const E=u(i,["enhancePrompt"]);t!==void 0&&E!=null&&c(t,["parameters","enhancePrompt"],E);const C=u(i,["labels"]);return t!==void 0&&C!=null&&c(t,["labels"],C),l}function X_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["source"]);r!=null&&Q_(r,l);const f=u(t,["config"]);return f!=null&&Y_(f,l),l}function K_(i){const t={},l=u(i,["predictions"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>Ha(r))),c(t,["generatedImages"],a)}return t}function Q_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["personImage"]);t!==void 0&&r!=null&&c(t,["instances[0]","personImage","image"],Ot(r));const f=u(i,["productImages"]);if(t!==void 0&&f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>J_(g))),c(t,["instances[0]","productImages"],m)}return l}function Z_(i){const t={},l=u(i,["referenceImage"]);l!=null&&c(t,["referenceImage"],Ot(l));const a=u(i,["referenceId"]);a!=null&&c(t,["referenceId"],a);const r=u(i,["referenceType"]);r!=null&&c(t,["referenceType"],r);const f=u(i,["maskImageConfig"]);f!=null&&c(t,["maskImageConfig"],O_(f));const m=u(i,["controlImageConfig"]);m!=null&&c(t,["controlImageConfig"],HE(m));const g=u(i,["styleImageConfig"]);g!=null&&c(t,["styleImageConfig"],g);const y=u(i,["subjectImageConfig"]);return y!=null&&c(t,["subjectImageConfig"],y),t}function eg(i){const t={},l=u(i,["safetyAttributes","categories"]);l!=null&&c(t,["categories"],l);const a=u(i,["safetyAttributes","scores"]);a!=null&&c(t,["scores"],a);const r=u(i,["contentType"]);return r!=null&&c(t,["contentType"],r),t}function tg(i){const t={},l=u(i,["safetyAttributes","categories"]);l!=null&&c(t,["categories"],l);const a=u(i,["safetyAttributes","scores"]);a!=null&&c(t,["scores"],a);const r=u(i,["contentType"]);return r!=null&&c(t,["contentType"],r),t}function $_(i){const t={},l=u(i,["category"]);if(l!=null&&c(t,["category"],l),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function W_(i){const t={},l=u(i,["image"]);return l!=null&&c(t,["image"],Ot(l)),t}function j_(i,t){const l={},a=u(i,["mode"]);t!==void 0&&a!=null&&c(t,["parameters","mode"],a);const r=u(i,["maxPredictions"]);t!==void 0&&r!=null&&c(t,["parameters","maxPredictions"],r);const f=u(i,["confidenceThreshold"]);t!==void 0&&f!=null&&c(t,["parameters","confidenceThreshold"],f);const m=u(i,["maskDilation"]);t!==void 0&&m!=null&&c(t,["parameters","maskDilation"],m);const g=u(i,["binaryColorThreshold"]);t!==void 0&&g!=null&&c(t,["parameters","binaryColorThreshold"],g);const y=u(i,["labels"]);return t!==void 0&&y!=null&&c(t,["labels"],y),l}function eC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["source"]);r!=null&&nC(r,l);const f=u(t,["config"]);return f!=null&&j_(f,l),l}function tC(i){const t={},l=u(i,["predictions"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>M_(r))),c(t,["generatedMasks"],a)}return t}function nC(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Ot(r));const f=u(i,["scribbleImage"]);return t!==void 0&&f!=null&&c(t,["instances[0]","scribble"],W_(f)),l}function iC(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],l_(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function oC(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],w_(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],b_(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function ng(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>a_(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function lC(i){const t={},l=u(i,["baseModel"]);l!=null&&c(t,["baseModel"],l);const a=u(i,["createTime"]);a!=null&&c(t,["createTime"],a);const r=u(i,["updateTime"]);return r!=null&&c(t,["updateTime"],r),t}function aC(i){const t={},l=u(i,["labels","google-vertex-llm-tuning-base-model-id"]);l!=null&&c(t,["baseModel"],l);const a=u(i,["createTime"]);a!=null&&c(t,["createTime"],a);const r=u(i,["updateTime"]);return r!=null&&c(t,["updateTime"],r),t}function sC(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);t!==void 0&&r!=null&&c(t,["description"],r);const f=u(i,["defaultCheckpointId"]);return t!==void 0&&f!=null&&c(t,["defaultCheckpointId"],f),l}function rC(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);t!==void 0&&r!=null&&c(t,["description"],r);const f=u(i,["defaultCheckpointId"]);return t!==void 0&&f!=null&&c(t,["defaultCheckpointId"],f),l}function uC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","name"],Te(i,a));const r=u(t,["config"]);return r!=null&&sC(r,l),l}function cC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&rC(r,l),l}function fC(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["safetyFilterLevel"]);t!==void 0&&r!=null&&c(t,["parameters","safetySetting"],r);const f=u(i,["personGeneration"]);t!==void 0&&f!=null&&c(t,["parameters","personGeneration"],f);const m=u(i,["includeRaiReason"]);t!==void 0&&m!=null&&c(t,["parameters","includeRaiReason"],m);const g=u(i,["outputMimeType"]);t!==void 0&&g!=null&&c(t,["parameters","outputOptions","mimeType"],g);const y=u(i,["outputCompressionQuality"]);t!==void 0&&y!=null&&c(t,["parameters","outputOptions","compressionQuality"],y);const h=u(i,["enhanceInputImage"]);t!==void 0&&h!=null&&c(t,["parameters","upscaleConfig","enhanceInputImage"],h);const v=u(i,["imagePreservationFactor"]);t!==void 0&&v!=null&&c(t,["parameters","upscaleConfig","imagePreservationFactor"],v);const S=u(i,["labels"]);t!==void 0&&S!=null&&c(t,["labels"],S);const E=u(i,["numberOfImages"]);t!==void 0&&E!=null&&c(t,["parameters","sampleCount"],E);const C=u(i,["mode"]);return t!==void 0&&C!=null&&c(t,["parameters","mode"],C),l}function dC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["image"]);r!=null&&c(l,["instances[0]","image"],Ot(r));const f=u(t,["upscaleFactor"]);f!=null&&c(l,["parameters","upscaleConfig","upscaleFactor"],f);const m=u(t,["config"]);return m!=null&&fC(m,l),l}function pC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>Ha(f))),c(t,["generatedImages"],r)}return t}function mC(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],On(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function hC(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["uri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function gC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["_self"],Ot(l));const a=u(i,["maskMode"]);return a!=null&&c(t,["maskMode"],a),t}function yC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["image"],qa(l));const a=u(i,["referenceType"]);return a!=null&&c(t,["referenceType"],a),t}function vC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["image"],Ot(l));const a=u(i,["referenceType"]);return a!=null&&c(t,["referenceType"],a),t}function ig(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["videoBytes"]);a!=null&&c(t,["encodedVideo"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["encoding"],r),t}function og(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["videoBytes"]);a!=null&&c(t,["bytesBase64Encoded"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function TC(i,t){const l={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["displayName"],a),l}function SC(i){const t={},l=u(i,["config"]);return l!=null&&TC(l,t),t}function EC(i,t){const l={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),l}function _C(i){const t={},l=u(i,["name"]);l!=null&&c(t,["_url","name"],l);const a=u(i,["config"]);return a!=null&&EC(a,t),t}function CC(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","name"],l),t}function AC(i,t){const l={},a=u(i,["customMetadata"]);if(t!==void 0&&a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["customMetadata"],f)}const r=u(i,["chunkingConfig"]);return t!==void 0&&r!=null&&c(t,["chunkingConfig"],r),l}function RC(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],NC(m)),t}function MC(i){const t={},l=u(i,["fileSearchStoreName"]);l!=null&&c(t,["_url","file_search_store_name"],l);const a=u(i,["fileName"]);a!=null&&c(t,["fileName"],a);const r=u(i,["config"]);return r!=null&&AC(r,t),t}function NC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function IC(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function xC(i){const t={},l=u(i,["config"]);return l!=null&&IC(l,t),t}function DC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["fileSearchStores"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["fileSearchStores"],f)}return t}function lg(i,t){const l={},a=u(i,["mimeType"]);t!==void 0&&a!=null&&c(t,["mimeType"],a);const r=u(i,["displayName"]);t!==void 0&&r!=null&&c(t,["displayName"],r);const f=u(i,["customMetadata"]);if(t!==void 0&&f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>y)),c(t,["customMetadata"],g)}const m=u(i,["chunkingConfig"]);return t!==void 0&&m!=null&&c(t,["chunkingConfig"],m),l}function UC(i){const t={},l=u(i,["fileSearchStoreName"]);l!=null&&c(t,["_url","file_search_store_name"],l);const a=u(i,["config"]);return a!=null&&lg(a,t),t}function wC(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const bC="Content-Type",LC="X-Server-Timeout",GC="User-Agent",Cu="x-goog-api-client",HC="1.34.0",qC=`google-genai-sdk/${HC}`,VC="v1beta1",zC="v1beta";class BC{constructor(t){var l,a;this.clientOptions=Object.assign(Object.assign({},t),{project:t.project,location:t.location,apiKey:t.apiKey,vertexai:t.vertexai});const r={};this.clientOptions.vertexai?(r.apiVersion=(l=this.clientOptions.apiVersion)!==null&&l!==void 0?l:VC,r.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(r.apiVersion=(a=this.clientOptions.apiVersion)!==null&&a!==void 0?a:zC,r.baseUrl="https://generativelanguage.googleapis.com/"),r.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=r,t.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(r,t.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var t;return(t=this.clientOptions.vertexai)!==null&&t!==void 0?t:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}async getAuthHeaders(){const t=new Headers;return await this.clientOptions.auth.addAuthHeaders(t),t}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(t){if(!t||t.baseUrl===void 0||t.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const a=[t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl];return t.apiVersion&&t.apiVersion!==""&&a.push(t.apiVersion),a.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const t=this.getBaseUrl(),l=new URL(t);return l.protocol=l.protocol=="http:"?"ws":"wss",l.toString()}setBaseUrl(t){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=t;else throw new Error("HTTP options are not correctly set.")}constructUrl(t,l,a){const r=[this.getRequestUrlInternal(l)];return a&&r.push(this.getBaseResourcePath()),t!==""&&r.push(t),new URL(`${r.join("/")}`)}shouldPrependVertexProjectPath(t){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||t.path.startsWith("projects/")||t.httpMethod==="GET"&&t.path.startsWith("publishers/google/models"))}async request(t){let l=this.clientOptions.httpOptions;t.httpOptions&&(l=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t),r=this.constructUrl(t.path,l,a);if(t.queryParams)for(const[m,g]of Object.entries(t.queryParams))r.searchParams.append(m,String(g));let f={};if(t.httpMethod==="GET"){if(t.body&&t.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else f.body=t.body;return f=await this.includeExtraHttpOptionsToRequestInit(f,l,r.toString(),t.abortSignal),this.unaryApiCall(r,f,t.httpMethod)}patchHttpOptions(t,l){const a=JSON.parse(JSON.stringify(t));for(const[r,f]of Object.entries(l))typeof f=="object"?a[r]=Object.assign(Object.assign({},a[r]),f):f!==void 0&&(a[r]=f);return a}async requestStream(t){let l=this.clientOptions.httpOptions;t.httpOptions&&(l=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t),r=this.constructUrl(t.path,l,a);(!r.searchParams.has("alt")||r.searchParams.get("alt")!=="sse")&&r.searchParams.set("alt","sse");let f={};return f.body=t.body,f=await this.includeExtraHttpOptionsToRequestInit(f,l,r.toString(),t.abortSignal),this.streamApiCall(r,f,t.httpMethod)}async includeExtraHttpOptionsToRequestInit(t,l,a,r){if(l&&l.timeout||r){const f=new AbortController,m=f.signal;if(l.timeout&&(l==null?void 0:l.timeout)>0){const g=setTimeout(()=>f.abort(),l.timeout);g&&typeof g.unref=="function"&&g.unref()}r&&r.addEventListener("abort",()=>{f.abort()}),t.signal=m}return l&&l.extraBody!==null&&PC(t,l.extraBody),t.headers=await this.getHeadersInternal(l,a),t}async unaryApiCall(t,l,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},l),{method:a})).then(async r=>(await Sh(r),new vu(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}async streamApiCall(t,l,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},l),{method:a})).then(async r=>(await Sh(r),this.processStreamResponse(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}processStreamResponse(t){return Pt(this,arguments,function*(){var a;const r=(a=t==null?void 0:t.body)===null||a===void 0?void 0:a.getReader(),f=new TextDecoder("utf-8");if(!r)throw new Error("Response body is empty");try{let m="";const g="data:",y=[` + +`,"\r\r",`\r +\r +`];for(;;){const{done:h,value:v}=yield oe(r.read());if(h){if(m.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const S=f.decode(v,{stream:!0});try{const U=JSON.parse(S);if("error"in U){const H=JSON.parse(JSON.stringify(U.error)),b=H.status,P=H.code,X=`got status: ${b}. ${JSON.stringify(U)}`;if(P>=400&&P<600)throw new La({message:X,status:P})}}catch(U){if(U.name==="ApiError")throw U}m+=S;let E=-1,C=0;for(;;){E=-1,C=0;for(const b of y){const P=m.indexOf(b);P!==-1&&(E===-1||P{throw new Error(`exception ${a} sending request`)})}getDefaultHeaders(){const t={},l=qC+" "+this.clientOptions.userAgentExtra;return t[GC]=l,t[Cu]=l,t[bC]="application/json",t}async getHeadersInternal(t,l){const a=new Headers;if(t&&t.headers){for(const[r,f]of Object.entries(t.headers))a.append(r,f);t.timeout&&t.timeout>0&&a.append(LC,String(Math.ceil(t.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(a,l),a}getFileName(t){var l;let a="";return typeof t=="string"&&(a=t.replace(/[/\\]+$/,""),a=(l=a.split(/[/\\]/).pop())!==null&&l!==void 0?l:""),a}async uploadFile(t,l){var a;const r={};l!=null&&(r.mimeType=l.mimeType,r.name=l.name,r.displayName=l.displayName),r.name&&!r.name.startsWith("files/")&&(r.name=`files/${r.name}`);const f=this.clientOptions.uploader,m=await f.stat(t);r.sizeBytes=String(m.size);const g=(a=l==null?void 0:l.mimeType)!==null&&a!==void 0?a:m.type;if(g===void 0||g==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");r.mimeType=g;const y={file:r},h=this.getFileName(t),v=Y("upload/v1beta/files",y._url),S=await this.fetchUploadUrl(v,r.sizeBytes,r.mimeType,h,y,l==null?void 0:l.httpOptions);return f.upload(t,S,this)}async uploadFileToFileSearchStore(t,l,a){var r;const f=this.clientOptions.uploader,m=await f.stat(l),g=String(m.size),y=(r=a==null?void 0:a.mimeType)!==null&&r!==void 0?r:m.type;if(y===void 0||y==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const h=`upload/v1beta/${t}:uploadToFileSearchStore`,v=this.getFileName(l),S={};a!=null&&lg(a,S);const E=await this.fetchUploadUrl(h,g,y,v,S,a==null?void 0:a.httpOptions);return f.uploadToFileSearchStore(l,E,this)}async downloadFile(t){await this.clientOptions.downloader.download(t,this)}async fetchUploadUrl(t,l,a,r,f,m){var g;let y={};m?y=m:y={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${l}`,"X-Goog-Upload-Header-Content-Type":`${a}`},r?{"X-Goog-Upload-File-Name":r}:{})};const h=await this.request({path:t,body:JSON.stringify(f),httpMethod:"POST",httpOptions:y});if(!h||!(h!=null&&h.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const v=(g=h==null?void 0:h.headers)===null||g===void 0?void 0:g["x-goog-upload-url"];if(v===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return v}}async function Sh(i){var t;if(i===void 0)throw new Error("response is undefined");if(!i.ok){const l=i.status;let a;!((t=i.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?a=await i.json():a={error:{message:await i.text(),code:i.status,status:i.statusText}};const r=JSON.stringify(a);throw l>=400&&l<600?new La({message:r,status:l}):new Error(r)}}function PC(i,t){if(!t||Object.keys(t).length===0)return;if(i.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let l={};if(typeof i.body=="string"&&i.body.length>0)try{const f=JSON.parse(i.body);if(typeof f=="object"&&f!==null&&!Array.isArray(f))l=f;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function a(f,m){const g=Object.assign({},f);for(const y in m)if(Object.prototype.hasOwnProperty.call(m,y)){const h=m[y],v=g[y];h&&typeof h=="object"&&!Array.isArray(h)&&v&&typeof v=="object"&&!Array.isArray(v)?g[y]=a(v,h):(v&&h&&typeof v!=typeof h&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${y}". Original type: ${typeof v}, New type: ${typeof h}. Overwriting.`),g[y]=h)}return g}const r=a(l,t);i.body=JSON.stringify(r)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const kC="mcp_used/unknown";let OC=!1;function ag(i){for(const t of i)if(FC(t)||typeof t=="object"&&"inputSchema"in t)return!0;return OC}function sg(i){var t;const l=(t=i[Cu])!==null&&t!==void 0?t:"";i[Cu]=(l+` ${kC}`).trimStart()}function FC(i){return i!==null&&typeof i=="object"&&i instanceof Vu}function JC(i){return Pt(this,arguments,function*(l,a=100){let r,f=0;for(;f0)return;const f={},m=[];for(const v of this.mcpClients)try{for(var g=!0,y=(l=void 0,kt(JC(v))),h;h=await y.next(),t=h.done,!t;g=!0){r=h.value,g=!1;const S=r;m.push(S);const E=S.name;if(f[E])throw new Error(`Duplicate function name ${E} found in MCP tools. Please ensure function names are unique.`);f[E]=v}}catch(S){l={error:S}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(l)throw l.error}}this.mcpTools=m,this.functionNameToMcpClient=f}async tool(){return await this.initialize(),CT(this.mcpTools,this.config)}async callTool(t){await this.initialize();const l=[];for(const a of t)if(a.name in this.functionNameToMcpClient){const r=this.functionNameToMcpClient[a.name];let f;this.config.timeout&&(f={timeout:this.config.timeout});const m=await r.callTool({name:a.name,arguments:a.args},void 0,f);l.push({functionResponse:{name:a.name,response:m.isError?{error:m}:m}})}return l}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */async function YC(i,t,l){const a=new hT;let r;l.data instanceof Blob?r=JSON.parse(await l.data.text()):r=JSON.parse(l.data),Object.assign(a,r),t(a)}class XC{constructor(t,l,a){this.apiClient=t,this.auth=l,this.webSocketFactory=a}async connect(t){var l,a;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const r=this.apiClient.getWebsocketBaseUrl(),f=this.apiClient.getApiVersion(),m=ZC(this.apiClient.getDefaultHeaders()),g=this.apiClient.getApiKey(),y=`${r}/ws/google.ai.generativelanguage.${f}.GenerativeService.BidiGenerateMusic?key=${g}`;let h=()=>{};const v=new Promise(k=>{h=k}),S=t.callbacks,E=function(){h({})},C=this.apiClient,U={onopen:E,onmessage:k=>{YC(C,S.onmessage,k)},onerror:(l=S==null?void 0:S.onerror)!==null&&l!==void 0?l:function(k){},onclose:(a=S==null?void 0:S.onclose)!==null&&a!==void 0?a:function(k){}},H=this.webSocketFactory.create(y,QC(m),U);H.connect(),await v;const X={setup:{model:Te(this.apiClient,t.model)}};return H.send(JSON.stringify(X)),new KC(H,this.apiClient)}}class KC{constructor(t,l){this.conn=t,this.apiClient=l}async setWeightedPrompts(t){if(!t.weightedPrompts||Object.keys(t.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const l=SE(t);this.conn.send(JSON.stringify({clientContent:l}))}async setMusicGenerationConfig(t){t.musicGenerationConfig||(t.musicGenerationConfig={});const l=TE(t);this.conn.send(JSON.stringify(l))}sendPlaybackControl(t){const l={playbackControl:t};this.conn.send(JSON.stringify(l))}play(){this.sendPlaybackControl(Zi.PLAY)}pause(){this.sendPlaybackControl(Zi.PAUSE)}stop(){this.sendPlaybackControl(Zi.STOP)}resetContext(){this.sendPlaybackControl(Zi.RESET_CONTEXT)}close(){this.conn.close()}}function QC(i){const t={};return i.forEach((l,a)=>{t[a]=l}),t}function ZC(i){const t=new Headers;for(const[l,a]of Object.entries(i))t.append(l,a);return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const $C="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function WC(i,t,l){const a=new mT;let r;l.data instanceof Blob?r=await l.data.text():l.data instanceof ArrayBuffer?r=new TextDecoder().decode(l.data):r=l.data;const f=JSON.parse(r);if(i.isVertexAI()){const m=CE(f);Object.assign(a,m)}else Object.assign(a,f);t(a)}class jC{constructor(t,l,a){this.apiClient=t,this.auth=l,this.webSocketFactory=a,this.music=new XC(this.apiClient,this.auth,this.webSocketFactory)}async connect(t){var l,a,r,f,m,g;if(t.config&&t.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const y=this.apiClient.getWebsocketBaseUrl(),h=this.apiClient.getApiVersion();let v;const S=this.apiClient.getHeaders();t.config&&t.config.tools&&ag(t.config.tools)&&sg(S);const E=iA(S);if(this.apiClient.isVertexAI())v=`${y}/ws/google.cloud.aiplatform.${h}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(E,v);else{const W=this.apiClient.getApiKey();let de="BidiGenerateContent",Ce="key";W!=null&&W.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),h!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),de="BidiGenerateContentConstrained",Ce="access_token"),v=`${y}/ws/google.ai.generativelanguage.${h}.GenerativeService.${de}?${Ce}=${W}`}let C=()=>{};const U=new Promise(W=>{C=W}),H=t.callbacks,b=function(){var W;(W=H==null?void 0:H.onopen)===null||W===void 0||W.call(H),C({})},P=this.apiClient,X={onopen:b,onmessage:W=>{WC(P,H.onmessage,W)},onerror:(l=H==null?void 0:H.onerror)!==null&&l!==void 0?l:function(W){},onclose:(a=H==null?void 0:H.onclose)!==null&&a!==void 0?a:function(W){}},k=this.webSocketFactory.create(v,nA(E),X);k.connect(),await U;let K=Te(this.apiClient,t.model);if(this.apiClient.isVertexAI()&&K.startsWith("publishers/")){const W=this.apiClient.getProject(),de=this.apiClient.getLocation();K=`projects/${W}/locations/${de}/`+K}let ee={};this.apiClient.isVertexAI()&&((r=t.config)===null||r===void 0?void 0:r.responseModalities)===void 0&&(t.config===void 0?t.config={responseModalities:[Ia.AUDIO]}:t.config.responseModalities=[Ia.AUDIO]),!((f=t.config)===null||f===void 0)&&f.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");const te=(g=(m=t.config)===null||m===void 0?void 0:m.tools)!==null&&g!==void 0?g:[],F=[];for(const W of te)if(this.isCallableTool(W)){const de=W;F.push(await de.tool())}else F.push(W);F.length>0&&(t.config.tools=F);const he={model:K,config:t.config,callbacks:t.callbacks};return this.apiClient.isVertexAI()?ee=vE(this.apiClient,he):ee=yE(this.apiClient,he),delete ee.config,k.send(JSON.stringify(ee)),new tA(k,this.apiClient)}isCallableTool(t){return"callTool"in t&&typeof t.callTool=="function"}}const eA={turnComplete:!0};class tA{constructor(t,l){this.conn=t,this.apiClient=l}tLiveClientContent(t,l){if(l.turns!==null&&l.turns!==void 0){let a=[];try{a=Ht(l.turns),t.isVertexAI()||(a=a.map(r=>Ga(r)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof l.turns}'`)}return{clientContent:{turns:a,turnComplete:l.turnComplete}}}return{clientContent:{turnComplete:l.turnComplete}}}tLiveClienttToolResponse(t,l){let a=[];if(l.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(l.functionResponses)?a=l.functionResponses:a=[l.functionResponses],a.length===0)throw new Error("functionResponses is required.");for(const f of a){if(typeof f!="object"||f===null||!("name"in f)||!("response"in f))throw new Error(`Could not parse function response, type '${typeof f}'.`);if(!t.isVertexAI()&&!("id"in f))throw new Error($C)}return{toolResponse:{functionResponses:a}}}sendClientContent(t){t=Object.assign(Object.assign({},eA),t);const l=this.tLiveClientContent(this.apiClient,t);this.conn.send(JSON.stringify(l))}sendRealtimeInput(t){let l={};this.apiClient.isVertexAI()?l={realtimeInput:_E(t)}:l={realtimeInput:EE(t)},this.conn.send(JSON.stringify(l))}sendToolResponse(t){if(t.functionResponses==null)throw new Error("Tool response parameters are required.");const l=this.tLiveClienttToolResponse(this.apiClient,t);this.conn.send(JSON.stringify(l))}close(){this.conn.close()}}function nA(i){const t={};return i.forEach((l,a)=>{t[a]=l}),t}function iA(i){const t=new Headers;for(const[l,a]of Object.entries(i))t.append(l,a);return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Eh=10;function _h(i){var t,l,a;if(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let r=!1;for(const m of(l=i==null?void 0:i.tools)!==null&&l!==void 0?l:[])if(ji(m)){r=!0;break}if(!r)return!0;const f=(a=i==null?void 0:i.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls;return f&&(f<0||!Number.isInteger(f))||f==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",f),!0):!1}function ji(i){return"callTool"in i&&typeof i.callTool=="function"}function oA(i){var t,l,a;return(a=(l=(t=i.config)===null||t===void 0?void 0:t.tools)===null||l===void 0?void 0:l.some(r=>ji(r)))!==null&&a!==void 0?a:!1}function Ch(i){var t;const l=[];return!((t=i==null?void 0:i.config)===null||t===void 0)&&t.tools&&i.config.tools.forEach((a,r)=>{if(ji(a))return;const f=a;f.functionDeclarations&&f.functionDeclarations.length>0&&l.push(r)}),l}function Ah(i){var t;return!(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.ignoreCallHistory)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class lA extends hn{constructor(t){super(),this.apiClient=t,this.generateContent=async l=>{var a,r,f,m,g;const y=await this.processParamsMaybeAddMcpUsage(l);if(this.maybeMoveToResponseJsonSchem(l),!oA(l)||_h(l.config))return await this.generateContentInternal(y);const h=Ch(l);if(h.length>0){const H=h.map(b=>`tools[${b}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${H}.`)}let v,S;const E=Ht(y.contents),C=(f=(r=(a=y.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls)!==null&&f!==void 0?f:Eh;let U=0;for(;U{var a,r,f,m,g;if(this.maybeMoveToResponseJsonSchem(l),_h(l.config)){const S=await this.processParamsMaybeAddMcpUsage(l);return await this.generateContentStreamInternal(S)}const y=Ch(l);if(y.length>0){const S=y.map(E=>`tools[${E}]`).join(", ");throw new Error(`Incompatible tools found at ${S}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const h=(f=(r=(a=l==null?void 0:l.config)===null||a===void 0?void 0:a.toolConfig)===null||r===void 0?void 0:r.functionCallingConfig)===null||f===void 0?void 0:f.streamFunctionCallArguments,v=(g=(m=l==null?void 0:l.config)===null||m===void 0?void 0:m.automaticFunctionCalling)===null||g===void 0?void 0:g.disable;if(h&&!v)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(l)},this.generateImages=async l=>await this.generateImagesInternal(l).then(a=>{var r;let f;const m=[];if(a!=null&&a.generatedImages)for(const y of a.generatedImages)y&&(y!=null&&y.safetyAttributes)&&((r=y==null?void 0:y.safetyAttributes)===null||r===void 0?void 0:r.contentType)==="Positive Prompt"?f=y==null?void 0:y.safetyAttributes:m.push(y);let g;return f?g={generatedImages:m,positivePromptSafetyAttributes:f,sdkHttpResponse:a.sdkHttpResponse}:g={generatedImages:m,sdkHttpResponse:a.sdkHttpResponse},g}),this.list=async l=>{var a;const m={config:Object.assign(Object.assign({},{queryBase:!0}),l==null?void 0:l.config)};if(this.apiClient.isVertexAI()&&!m.config.queryBase){if(!((a=m.config)===null||a===void 0)&&a.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");m.config.filter="labels.tune-type:*"}return new ci(mn.PAGED_ITEM_MODELS,g=>this.listInternal(g),await this.listInternal(m),m)},this.editImage=async l=>{const a={model:l.model,prompt:l.prompt,referenceImages:[],config:l.config};return l.referenceImages&&l.referenceImages&&(a.referenceImages=l.referenceImages.map(r=>r.toReferenceImageAPI())),await this.editImageInternal(a)},this.upscaleImage=async l=>{let a={numberOfImages:1,mode:"upscale"};l.config&&(a=Object.assign(Object.assign({},a),l.config));const r={model:l.model,image:l.image,upscaleFactor:l.upscaleFactor,config:a};return await this.upscaleImageInternal(r)},this.generateVideos=async l=>{var a,r,f,m,g,y;if((l.prompt||l.image||l.video)&&l.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((a=l.video)===null||a===void 0)&&a.uri&&(!((r=l.video)===null||r===void 0)&&r.videoBytes)?l.video={uri:l.video.uri,mimeType:l.video.mimeType}:!((m=(f=l.source)===null||f===void 0?void 0:f.video)===null||m===void 0)&&m.uri&&(!((y=(g=l.source)===null||g===void 0?void 0:g.video)===null||y===void 0)&&y.videoBytes)&&(l.source.video={uri:l.source.video.uri,mimeType:l.source.video.mimeType})),await this.generateVideosInternal(l)}}maybeMoveToResponseJsonSchem(t){t.config&&t.config.responseSchema&&(t.config.responseJsonSchema||Object.keys(t.config.responseSchema).includes("$schema")&&(t.config.responseJsonSchema=t.config.responseSchema,delete t.config.responseSchema))}async processParamsMaybeAddMcpUsage(t){var l,a,r;const f=(l=t.config)===null||l===void 0?void 0:l.tools;if(!f)return t;const m=await Promise.all(f.map(async y=>ji(y)?await y.tool():y)),g={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:m})};if(g.config.tools=m,t.config&&t.config.tools&&ag(t.config.tools)){const y=(r=(a=t.config.httpOptions)===null||a===void 0?void 0:a.headers)!==null&&r!==void 0?r:{};let h=Object.assign({},y);Object.keys(h).length===0&&(h=this.apiClient.getDefaultHeaders()),sg(h),g.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:h})}return g}async initAfcToolsMap(t){var l,a,r;const f=new Map;for(const m of(a=(l=t.config)===null||l===void 0?void 0:l.tools)!==null&&a!==void 0?a:[])if(ji(m)){const g=m,y=await g.tool();for(const h of(r=y.functionDeclarations)!==null&&r!==void 0?r:[]){if(!h.name)throw new Error("Function declaration name is required.");if(f.has(h.name))throw new Error(`Duplicate tool declaration name: ${h.name}`);f.set(h.name,g)}}return f}async processAfcStream(t){var l,a,r;const f=(r=(a=(l=t.config)===null||l===void 0?void 0:l.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls)!==null&&r!==void 0?r:Eh;let m=!1,g=0;const y=await this.initAfcToolsMap(t);return(function(h,v,S){return Pt(this,arguments,function*(){for(var E,C,U,H,b,P;g0){m=!0;const W=new jo;W.candidates=[{content:{role:"user",parts:F}}],yield yield oe(W);const de=[];de.push(...he),de.push({role:"user",parts:F});const Ce=Ht(S.contents).concat(de);S.contents=Ce}else break}})})(this,y,t)}async generateContentInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=yh(this.apiClient,t);return g=Y("{model}:generateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=Th(v),E=new jo;return Object.assign(E,S),E})}else{const h=gh(this.apiClient,t);return g=Y("{model}:generateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=vh(v),E=new jo;return Object.assign(E,S),E})}}async generateContentStreamInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=yh(this.apiClient,t);return g=Y("{model}:streamGenerateContent?alt=sse",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}),m.then(function(S){return Pt(this,arguments,function*(){var E,C,U,H;try{for(var b=!0,P=kt(S),X;X=yield oe(P.next()),E=X.done,!E;b=!0){H=X.value,b=!1;const k=H,K=Th(yield oe(k.json()));K.sdkHttpResponse={headers:k.headers};const ee=new jo;Object.assign(ee,K),yield yield oe(ee)}}catch(k){C={error:k}}finally{try{!b&&!E&&(U=P.return)&&(yield oe(U.call(P)))}finally{if(C)throw C.error}}})})}else{const h=gh(this.apiClient,t);return g=Y("{model}:streamGenerateContent?alt=sse",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}),m.then(function(S){return Pt(this,arguments,function*(){var E,C,U,H;try{for(var b=!0,P=kt(S),X;X=yield oe(P.next()),E=X.done,!E;b=!0){H=X.value,b=!1;const k=H,K=vh(yield oe(k.json()));K.sdkHttpResponse={headers:k.headers};const ee=new jo;Object.assign(ee,K),yield yield oe(ee)}}catch(k){C={error:k}}finally{try{!b&&!E&&(U=P.return)&&(yield oe(U.call(P)))}finally{if(C)throw C.error}}})})}}async embedContent(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=jE(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=t_(v),E=new jm;return Object.assign(E,S),E})}else{const h=WE(this.apiClient,t);return g=Y("{model}:batchEmbedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=e_(v),E=new jm;return Object.assign(E,S),E})}}async generateImagesInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=d_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=m_(v),E=new eh;return Object.assign(E,S),E})}else{const h=f_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=p_(v),E=new eh;return Object.assign(E,S),E})}}async editImageInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=KE(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=QE(y),v=new iT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=dC(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=pC(y),v=new oT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=X_(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=K_(y),v=new lT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=eC(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=tC(y),v=new aT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=U_(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>_u(v))}else{const h=D_(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Eu(v))}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=B_(this.apiClient,t);return g=Y("{models_url}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=k_(v),E=new th;return Object.assign(E,S),E})}else{const h=z_(this.apiClient,t);return g=Y("{models_url}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=P_(v),E=new th;return Object.assign(E,S),E})}}async update(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=cC(this.apiClient,t);return g=Y("{model}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>_u(v))}else{const h=uC(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Eu(v))}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=FE(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=YE(v),E=new nh;return Object.assign(E,S),E})}else{const h=OE(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=JE(v),E=new nh;return Object.assign(E,S),E})}}async countTokens(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=BE(this.apiClient,t);return g=Y("{model}:countTokens",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=kE(v),E=new ih;return Object.assign(E,S),E})}else{const h=zE(this.apiClient,t);return g=Y("{model}:countTokens",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=PE(v),E=new ih;return Object.assign(E,S),E})}}async computeTokens(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=wE(this.apiClient,t);return f=Y("{model}:computeTokens",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=bE(y),v=new sT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=S_(this.apiClient,t);return g=Y("{model}:predictLongRunning",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>{const S=v_(v),E=new xa;return Object.assign(E,S),E})}else{const h=T_(this.apiClient,t);return g=Y("{model}:predictLongRunning",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>{const S=y_(v),E=new xa;return Object.assign(E,S),E})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class aA extends hn{constructor(t){super(),this.apiClient=t}async getVideosOperation(t){const l=t.operation,a=t.config;if(l.name===void 0||l.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=l.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const m=await this.fetchPredictVideosOperationInternal({operationName:l.name,resourceName:r,config:{httpOptions:f}});return l._fromAPIResponse({apiResponse:m,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:l.name,config:a});return l._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async get(t){const l=t.operation,a=t.config;if(l.name===void 0||l.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=l.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const m=await this.fetchPredictVideosOperationInternal({operationName:l.name,resourceName:r,config:{httpOptions:f}});return l._fromAPIResponse({apiResponse:m,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:l.name,config:a});return l._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async getVideosOperationInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=$0(t);return g=Y("{operationName}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m}else{const h=Z0(t);return g=Y("{operationName}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m}}async fetchPredictVideosOperationInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=O0(t);return f=Y("{resourceName}:fetchPredictOperation",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r}else throw new Error("This method is only supported by the Vertex AI.")}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function sA(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function rA(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>yA(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function uA(i,t,l){const a={},r=u(t,["expireTime"]);l!==void 0&&r!=null&&c(l,["expireTime"],r);const f=u(t,["newSessionExpireTime"]);l!==void 0&&f!=null&&c(l,["newSessionExpireTime"],f);const m=u(t,["uses"]);l!==void 0&&m!=null&&c(l,["uses"],m);const g=u(t,["liveConnectConstraints"]);l!==void 0&&g!=null&&c(l,["bidiGenerateContentSetup"],gA(i,g));const y=u(t,["lockAdditionalFields"]);return l!==void 0&&y!=null&&c(l,["fieldMask"],y),a}function cA(i,t){const l={},a=u(t,["config"]);return a!=null&&c(l,["config"],uA(i,a,l)),l}function fA(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function dA(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function pA(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function mA(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function hA(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const U=u(i,["systemInstruction"]);t!==void 0&&U!=null&&c(t,["setup","systemInstruction"],rA(it(U)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let te=to(H);Array.isArray(te)&&(te=te.map(F=>TA(eo(F)))),c(t,["setup","tools"],te)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],vA(b));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return l}function gA(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],hA(r,l)),l}function yA(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],fA(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],dA(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],sA(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function vA(i){const t={},l=u(i,["handle"]);if(l!=null&&c(t,["handle"],l),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function TA(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],pA(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],mA(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function SA(i){const t=[];for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const a=i[l];if(typeof a=="object"&&a!=null&&Object.keys(a).length>0){const r=Object.keys(a).map(f=>`${l}.${f}`);t.push(...r)}else t.push(l)}return t.join(",")}function EA(i,t){let l=null;const a=i.bidiGenerateContentSetup;if(typeof a=="object"&&a!==null&&"setup"in a){const f=a.setup;typeof f=="object"&&f!==null?(i.bidiGenerateContentSetup=f,l=f):delete i.bidiGenerateContentSetup}else a!==void 0&&delete i.bidiGenerateContentSetup;const r=i.fieldMask;if(l){const f=SA(l);if(Array.isArray(t==null?void 0:t.lockAdditionalFields)&&(t==null?void 0:t.lockAdditionalFields.length)===0)f?i.fieldMask=f:delete i.fieldMask;else if(t!=null&&t.lockAdditionalFields&&t.lockAdditionalFields.length>0&&r!==null&&Array.isArray(r)&&r.length>0){const m=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let g=[];r.length>0&&(g=r.map(h=>m.includes(h)?`generationConfig.${h}`:h));const y=[];f&&y.push(f),g.length>0&&y.push(...g),y.length>0?i.fieldMask=y.join(","):delete i.fieldMask}else delete i.fieldMask}else r!==null&&Array.isArray(r)&&r.length>0?i.fieldMask=r.join(","):delete i.fieldMask;return i}class _A extends hn{constructor(t){super(),this.apiClient=t}async create(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const g=cA(this.apiClient,t);f=Y("auth_tokens",g._url),m=g._query,delete g.config,delete g._url,delete g._query;const y=EA(g,t.config);return r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(h=>h.json()),r.then(h=>h)}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function CA(i,t){const l={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),l}function AA(i){const t={},l=u(i,["name"]);l!=null&&c(t,["_url","name"],l);const a=u(i,["config"]);return a!=null&&CA(a,t),t}function RA(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","name"],l),t}function MA(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function NA(i){const t={},l=u(i,["parent"]);l!=null&&c(t,["_url","parent"],l);const a=u(i,["config"]);return a!=null&&MA(a,t),t}function IA(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["documents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["documents"],f)}return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class xA extends hn{constructor(t){super(),this.apiClient=t,this.list=async l=>new ci(mn.PAGED_ITEM_DOCUMENTS,a=>this.listInternal({parent:l.parent,config:a.config}),await this.listInternal(l),l)}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=RA(t);return f=Y("{name}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const m=AA(t);r=Y("{name}",m._url),f=m._query,delete m._url,delete m._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=NA(t);return f=Y("{parent}/documents",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=IA(y),v=new rT;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class DA extends hn{constructor(t,l=new xA(t)){super(),this.apiClient=t,this.documents=l,this.list=async(a={})=>new ci(mn.PAGED_ITEM_FILE_SEARCH_STORES,r=>this.listInternal(r),await this.listInternal(a),a)}async uploadToFileSearchStore(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(t.fileSearchStoreName,t.file,t.config)}async create(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=SC(t);return f=Y("fileSearchStores",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=CC(t);return f=Y("{name}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const m=_C(t);r=Y("{name}",m._url),f=m._query,delete m._url,delete m._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=xC(t);return f=Y("fileSearchStores",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=DC(y),v=new uT;return Object.assign(v,h),v})}}async uploadToFileSearchStoreInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=UC(t);return f=Y("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=wC(y),v=new cT;return Object.assign(v,h),v})}}async importFile(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=MC(t);return f=Y("{file_search_store_name}:importFile",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=RC(y),v=new wu;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */let rg=function(){const{crypto:i}=globalThis;if(i!=null&&i.randomUUID)return rg=i.randomUUID.bind(i),i.randomUUID();const t=new Uint8Array(1),l=i?()=>i.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(+a^l()&15>>+a/4).toString(16))};const UA=()=>rg();/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Au(i){return typeof i=="object"&&i!==null&&("name"in i&&i.name==="AbortError"||"message"in i&&String(i.message).includes("FetchRequestCanceledException"))}const Ru=i=>{if(i instanceof Error)return i;if(typeof i=="object"&&i!==null){try{if(Object.prototype.toString.call(i)==="[object Error]"){const t=new Error(i.message,i.cause?{cause:i.cause}:{});return i.stack&&(t.stack=i.stack),i.cause&&!t.cause&&(t.cause=i.cause),i.name&&(t.name=i.name),t}}catch{}try{return new Error(JSON.stringify(i))}catch{}}return new Error(i)};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class qt extends Error{}class st extends qt{constructor(t,l,a,r){super(`${st.makeMessage(t,l,a)}`),this.status=t,this.headers=r,this.error=l}static makeMessage(t,l,a){const r=l!=null&&l.message?typeof l.message=="string"?l.message:JSON.stringify(l.message):l?JSON.stringify(l):a;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,l,a,r){if(!t||!r)return new Va({message:a,cause:Ru(l)});const f=l;return t===400?new cg(t,f,a,r):t===401?new fg(t,f,a,r):t===403?new dg(t,f,a,r):t===404?new pg(t,f,a,r):t===409?new mg(t,f,a,r):t===422?new hg(t,f,a,r):t===429?new gg(t,f,a,r):t>=500?new yg(t,f,a,r):new st(t,f,a,r)}}class Mu extends st{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class Va extends st{constructor({message:t,cause:l}){super(void 0,void 0,t||"Connection error.",void 0),l&&(this.cause=l)}}class ug extends Va{constructor({message:t}={}){super({message:t??"Request timed out."})}}class cg extends st{}class fg extends st{}class dg extends st{}class pg extends st{}class mg extends st{}class hg extends st{}class gg extends st{}class yg extends st{}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const wA=/^[a-z][a-z0-9+.-]*:/i,bA=i=>wA.test(i);let Nu=i=>(Nu=Array.isArray,Nu(i));const LA=Nu;let GA=LA;const Rh=GA;function HA(i){if(!i)return!0;for(const t in i)return!1;return!0}function qA(i,t){return Object.prototype.hasOwnProperty.call(i,t)}const VA=(i,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new qt(`${i} must be an integer`);if(t<0)throw new qt(`${i} must be a positive integer`);return t},zA=i=>{try{return JSON.parse(i)}catch{return}};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const BA=i=>new Promise(t=>setTimeout(t,i));/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Qi="0.0.1";/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function PA(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const kA=()=>{var i,t,l,a,r;const f=PA();if(f==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":Nh(Deno.build.os),"X-Stainless-Arch":Mh(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(t=(i=Deno.version)===null||i===void 0?void 0:i.deno)!==null&&t!==void 0?t:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(f==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":Nh((l=globalThis.process.platform)!==null&&l!==void 0?l:"unknown"),"X-Stainless-Arch":Mh((a=globalThis.process.arch)!==null&&a!==void 0?a:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(r=globalThis.process.version)!==null&&r!==void 0?r:"unknown"};const m=OA();return m?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${m.browser}`,"X-Stainless-Runtime-Version":m.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function OA(){if(typeof navigator>"u"||!navigator)return null;const i=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:l}of i){const a=l.exec(navigator.userAgent);if(a){const r=a[1]||0,f=a[2]||0,m=a[3]||0;return{browser:t,version:`${r}.${f}.${m}`}}}return null}const Mh=i=>i==="x32"?"x32":i==="x86_64"||i==="x64"?"x64":i==="arm"?"arm":i==="aarch64"||i==="arm64"?"arm64":i?`other:${i}`:"unknown",Nh=i=>(i=i.toLowerCase(),i.includes("ios")?"iOS":i==="android"?"Android":i==="darwin"?"MacOS":i==="win32"?"Windows":i==="freebsd"?"FreeBSD":i==="openbsd"?"OpenBSD":i==="linux"?"Linux":i?`Other:${i}`:"Unknown");let Ea;const FA=()=>Ea??(Ea=kA());/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function JA(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function vg(...i){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...i)}function YA(i){let t=Symbol.asyncIterator in i?i[Symbol.asyncIterator]():i[Symbol.iterator]();return vg({start(){},async pull(l){const{done:a,value:r}=await t.next();a?l.close():l.enqueue(r)},async cancel(){var l;await((l=t.return)===null||l===void 0?void 0:l.call(t))}})}function Tg(i){if(i[Symbol.asyncIterator])return i;const t=i.getReader();return{async next(){try{const l=await t.read();return l!=null&&l.done&&t.releaseLock(),l}catch(l){throw t.releaseLock(),l}},async return(){const l=t.cancel();return t.releaseLock(),await l,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function XA(i){var t,l;if(i===null||typeof i!="object")return;if(i[Symbol.asyncIterator]){await((l=(t=i[Symbol.asyncIterator]()).return)===null||l===void 0?void 0:l.call(t));return}const a=i.getReader(),r=a.cancel();a.releaseLock(),await r}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const KA=({headers:i,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Sg=()=>{var i;if(typeof File>"u"){const{process:t}=globalThis,l=typeof((i=t==null?void 0:t.versions)===null||i===void 0?void 0:i.node)=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(l?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function pu(i,t,l){return Sg(),new File(i,t??"unknown_file",l)}function QA(i){return(typeof i=="object"&&i!==null&&("name"in i&&i.name&&String(i.name)||"url"in i&&i.url&&String(i.url)||"filename"in i&&i.filename&&String(i.filename)||"path"in i&&i.path&&String(i.path))||"").split(/[\\/]/).pop()||void 0}const ZA=i=>i!=null&&typeof i=="object"&&typeof i[Symbol.asyncIterator]=="function";/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Eg=i=>i!=null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.type=="string"&&typeof i.text=="function"&&typeof i.slice=="function"&&typeof i.arrayBuffer=="function",$A=i=>i!=null&&typeof i=="object"&&typeof i.name=="string"&&typeof i.lastModified=="number"&&Eg(i),WA=i=>i!=null&&typeof i=="object"&&typeof i.url=="string"&&typeof i.blob=="function";async function jA(i,t,l){if(Sg(),i=await i,$A(i))return i instanceof File?i:pu([await i.arrayBuffer()],i.name);if(WA(i)){const r=await i.blob();return t||(t=new URL(i.url).pathname.split(/[\\/]/).pop()),pu(await Iu(r),t,l)}const a=await Iu(i);if(t||(t=QA(i)),!(l!=null&&l.type)){const r=a.find(f=>typeof f=="object"&&"type"in f&&f.type);typeof r=="string"&&(l=Object.assign(Object.assign({},l),{type:r}))}return pu(a,t,l)}async function Iu(i){var t,l,a,r,f;let m=[];if(typeof i=="string"||ArrayBuffer.isView(i)||i instanceof ArrayBuffer)m.push(i);else if(Eg(i))m.push(i instanceof Blob?i:await i.arrayBuffer());else if(ZA(i))try{for(var g=!0,y=kt(i),h;h=await y.next(),t=h.done,!t;g=!0){r=h.value,g=!1;const v=r;m.push(...await Iu(v))}}catch(v){l={error:v}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(l)throw l.error}}else{const v=(f=i==null?void 0:i.constructor)===null||f===void 0?void 0:f.name;throw new Error(`Unexpected data type: ${typeof i}${v?`; constructor: ${v}`:""}${eR(i)}`)}return m}function eR(i){return typeof i!="object"||i===null?"":`; props: [${Object.getOwnPropertyNames(i).map(l=>`"${l}"`).join(", ")}]`}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class _g{constructor(t){this._client=t}}_g._key=[];/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Cg(i){return i.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const Ih=Object.freeze(Object.create(null)),tR=(i=Cg)=>(function(l,...a){if(l.length===1)return l[0];let r=!1;const f=[],m=l.reduce((v,S,E)=>{var C,U,H;/[?#]/.test(S)&&(r=!0);const b=a[E];let P=(r?encodeURIComponent:i)(""+b);return E!==a.length&&(b==null||typeof b=="object"&&b.toString===((H=Object.getPrototypeOf((U=Object.getPrototypeOf((C=b.hasOwnProperty)!==null&&C!==void 0?C:Ih))!==null&&U!==void 0?U:Ih))===null||H===void 0?void 0:H.toString))&&(P=b+"",f.push({start:v.length+S.length,length:P.length,error:`Value of type ${Object.prototype.toString.call(b).slice(8,-1)} is not a valid path parameter`})),v+S+(E===a.length?"":P)},""),g=m.split(/[?#]/,1)[0],y=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let h;for(;(h=y.exec(g))!==null;)f.push({start:h.index,length:h[0].length,error:`Value "${h[0]}" can't be safely passed as a path parameter`});if(f.sort((v,S)=>v.start-S.start),f.length>0){let v=0;const S=f.reduce((E,C)=>{const U=" ".repeat(C.start-v),H="^".repeat(C.length);return v=C.start+C.length,E+U+H},"");throw new qt(`Path parameters result in path with invalid segments: +${f.map(E=>E.error).join(` +`)} +${m} +${S}`)}return m}),_a=tR(Cg);/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Ag extends _g{create(t,l){var a;const{api_version:r=this._client.apiVersion}=t,f=Ua(t,["api_version"]);if("model"in f&&"agent_config"in f)throw new qt("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in f&&"generation_config"in f)throw new qt("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(_a`/${r}/interactions`,Object.assign(Object.assign({body:f},l),{stream:(a=t.stream)!==null&&a!==void 0?a:!1}))}delete(t,l={},a){const{api_version:r=this._client.apiVersion}=l??{};return this._client.delete(_a`/${r}/interactions/${t}`,a)}cancel(t,l={},a){const{api_version:r=this._client.apiVersion}=l??{};return this._client.post(_a`/${r}/interactions/${t}/cancel`,a)}get(t,l={},a){var r;const f=l??{},{api_version:m=this._client.apiVersion}=f,g=Ua(f,["api_version"]);return this._client.get(_a`/${m}/interactions/${t}`,Object.assign(Object.assign({query:g},a),{stream:(r=l==null?void 0:l.stream)!==null&&r!==void 0?r:!1}))}}Ag._key=Object.freeze(["interactions"]);class Rg extends Ag{}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function nR(i){let t=0;for(const r of i)t+=r.length;const l=new Uint8Array(t);let a=0;for(const r of i)l.set(r,a),a+=r.length;return l}let Ca;function zu(i){let t;return(Ca??(t=new globalThis.TextEncoder,Ca=t.encode.bind(t)))(i)}let Aa;function xh(i){let t;return(Aa??(t=new globalThis.TextDecoder,Aa=t.decode.bind(t)))(i)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class za{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(t){if(t==null)return[];const l=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?zu(t):t;this.buffer=nR([this.buffer,l]);const a=[];let r;for(;(r=iR(this.buffer,this.carriageReturnIndex))!=null;){if(r.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=r.index;continue}if(this.carriageReturnIndex!=null&&(r.index!==this.carriageReturnIndex+1||r.carriage)){a.push(xh(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}const f=this.carriageReturnIndex!==null?r.preceding-1:r.preceding,m=xh(this.buffer.subarray(0,f));a.push(m),this.buffer=this.buffer.subarray(r.index),this.carriageReturnIndex=null}return a}flush(){return this.buffer.length?this.decode(` +`):[]}}za.NEWLINE_CHARS=new Set([` +`,"\r"]);za.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function iR(i,t){for(let r=t??0;r{if(i){if(qA(wa,i))return i;at(l).warn(`${t} was set to ${JSON.stringify(i)}, expected one of ${JSON.stringify(Object.keys(wa))}`)}};function tl(){}function Ra(i,t,l){return!t||wa[i]>wa[l]?tl:t[i].bind(t)}const lR={error:tl,warn:tl,info:tl,debug:tl};let Uh=new WeakMap;function at(i){var t;const l=i.logger,a=(t=i.logLevel)!==null&&t!==void 0?t:"off";if(!l)return lR;const r=Uh.get(l);if(r&&r[0]===a)return r[1];const f={error:Ra("error",l,a),warn:Ra("warn",l,a),info:Ra("info",l,a),debug:Ra("debug",l,a)};return Uh.set(l,[a,f]),f}const ui=i=>(i.options&&(i.options=Object.assign({},i.options),delete i.options.headers),i.headers&&(i.headers=Object.fromEntries((i.headers instanceof Headers?[...i.headers]:Object.entries(i.headers)).map(([t,l])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":l]))),"retryOfRequestLogID"in i&&(i.retryOfRequestLogID&&(i.retryOf=i.retryOfRequestLogID),delete i.retryOfRequestLogID),i);/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class $i{constructor(t,l,a){this.iterator=t,this.controller=l,this.client=a}static fromSSEResponse(t,l,a){let r=!1;const f=a?at(a):console;function m(){return Pt(this,arguments,function*(){var y,h,v,S;if(r)throw new qt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var C=!0,U=kt(aR(t,l)),H;H=yield oe(U.next()),y=H.done,!y;C=!0){S=H.value,C=!1;const b=S;if(!E)if(b.data.startsWith("[DONE]")){E=!0;continue}else try{yield yield oe(JSON.parse(b.data))}catch(P){throw f.error("Could not parse message into JSON:",b.data),f.error("From chunk:",b.raw),P}}}catch(b){h={error:b}}finally{try{!C&&!y&&(v=U.return)&&(yield oe(v.call(U)))}finally{if(h)throw h.error}}E=!0}catch(b){if(Au(b))return yield oe(void 0);throw b}finally{E||l.abort()}})}return new $i(m,l,a)}static fromReadableStream(t,l,a){let r=!1;function f(){return Pt(this,arguments,function*(){var y,h,v,S;const E=new za,C=Tg(t);try{for(var U=!0,H=kt(C),b;b=yield oe(H.next()),y=b.done,!y;U=!0){S=b.value,U=!1;const P=S;for(const X of E.decode(P))yield yield oe(X)}}catch(P){h={error:P}}finally{try{!U&&!y&&(v=H.return)&&(yield oe(v.call(H)))}finally{if(h)throw h.error}}for(const P of E.flush())yield yield oe(P)})}function m(){return Pt(this,arguments,function*(){var y,h,v,S;if(r)throw new qt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var C=!0,U=kt(f()),H;H=yield oe(U.next()),y=H.done,!y;C=!0){S=H.value,C=!1;const b=S;E||b&&(yield yield oe(JSON.parse(b)))}}catch(b){h={error:b}}finally{try{!C&&!y&&(v=U.return)&&(yield oe(v.call(U)))}finally{if(h)throw h.error}}E=!0}catch(b){if(Au(b))return yield oe(void 0);throw b}finally{E||l.abort()}})}return new $i(m,l,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],l=[],a=this.iterator(),r=f=>({next:()=>{if(f.length===0){const m=a.next();t.push(m),l.push(m)}return f.shift()}});return[new $i(()=>r(t),this.controller,this.client),new $i(()=>r(l),this.controller,this.client)]}toReadableStream(){const t=this;let l;return vg({async start(){l=t[Symbol.asyncIterator]()},async pull(a){try{const{value:r,done:f}=await l.next();if(f)return a.close();const m=zu(JSON.stringify(r)+` +`);a.enqueue(m)}catch(r){a.error(r)}},async cancel(){var a;await((a=l.return)===null||a===void 0?void 0:a.call(l))}})}}function aR(i,t){return Pt(this,arguments,function*(){var a,r,f,m;if(!i.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new qt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new qt("Attempted to iterate over a response with no body");const g=new rR,y=new za,h=Tg(i.body);try{for(var v=!0,S=kt(sR(h)),E;E=yield oe(S.next()),a=E.done,!a;v=!0){m=E.value,v=!1;const C=m;for(const U of y.decode(C)){const H=g.decode(U);H&&(yield yield oe(H))}}}catch(C){r={error:C}}finally{try{!v&&!a&&(f=S.return)&&(yield oe(f.call(S)))}finally{if(r)throw r.error}}for(const C of y.flush()){const U=g.decode(C);U&&(yield yield oe(U))}})}function sR(i){return Pt(this,arguments,function*(){var l,a,r,f;let m=new Uint8Array;try{for(var g=!0,y=kt(i),h;h=yield oe(y.next()),l=h.done,!l;g=!0){f=h.value,g=!1;const v=f;if(v==null)continue;const S=v instanceof ArrayBuffer?new Uint8Array(v):typeof v=="string"?zu(v):v;let E=new Uint8Array(m.length+S.length);E.set(m),E.set(S,m.length),m=E;let C;for(;(C=oR(m))!==-1;)yield yield oe(m.slice(0,C)),m=m.slice(C)}}catch(v){a={error:v}}finally{try{!g&&!l&&(r=y.return)&&(yield oe(r.call(y)))}finally{if(a)throw a.error}}m.length>0&&(yield yield oe(m))})}class rR{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;const f={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],f}if(this.chunks.push(t),t.startsWith(":"))return null;let[l,a,r]=uR(t,":");return r.startsWith(" ")&&(r=r.substring(1)),l==="event"?this.event=r:l==="data"&&this.data.push(r),null}}function uR(i,t){const l=i.indexOf(t);return l!==-1?[i.substring(0,l),t,i.substring(l+t.length)]:[i,"",""]}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */async function cR(i,t){const{response:l,requestLogID:a,retryOfRequestLogID:r,startTime:f}=t,m=await(async()=>{var g;if(t.options.stream)return at(i).debug("response",l.status,l.url,l.headers,l.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(l,t.controller,i):$i.fromSSEResponse(l,t.controller,i);if(l.status===204)return null;if(t.options.__binaryResponse)return l;const y=l.headers.get("content-type"),h=(g=y==null?void 0:y.split(";")[0])===null||g===void 0?void 0:g.trim();return(h==null?void 0:h.includes("application/json"))||(h==null?void 0:h.endsWith("+json"))?await l.json():await l.text()})();return at(i).debug(`[${a}] response parsed`,ui({retryOfRequestLogID:r,url:l.url,status:l.status,body:m,durationMs:Date.now()-f})),m}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Bu extends Promise{constructor(t,l,a=cR){super(r=>{r(null)}),this.responsePromise=l,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new Bu(this.client,this.responsePromise,async(l,a)=>t(await this.parseResponse(l,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){const[t,l]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:l}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,l){return this.parse().then(t,l)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Mg=Symbol("brand.privateNullableHeaders");function*fR(i){if(!i)return;if(Mg in i){const{values:a,nulls:r}=i;yield*a.entries();for(const f of r)yield[f,null];return}let t=!1,l;i instanceof Headers?l=i.entries():Rh(i)?l=i:(t=!0,l=Object.entries(i??{}));for(let a of l){const r=a[0];if(typeof r!="string")throw new TypeError("expected header name to be a string");const f=Rh(a[1])?a[1]:[a[1]];let m=!1;for(const g of f)g!==void 0&&(t&&!m&&(m=!0,yield[r,null]),yield[r,g])}}const el=i=>{const t=new Headers,l=new Set;for(const a of i){const r=new Set;for(const[f,m]of fR(a)){const g=f.toLowerCase();r.has(g)||(t.delete(f),r.add(g)),m===null?(t.delete(f),l.add(g)):(t.append(f,m),l.delete(g))}}return{[Mg]:!0,values:t,nulls:l}};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const mu=i=>{var t,l,a,r,f,m;if(typeof globalThis.process<"u")return(a=(l=(t=q0)===null||t===void 0?void 0:t[i])===null||l===void 0?void 0:l.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(m=(f=(r=globalThis.Deno.env)===null||r===void 0?void 0:r.get)===null||f===void 0?void 0:f.call(r,i))===null||m===void 0?void 0:m.trim()};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var Ng;class Ba{constructor(t){var l,a,r,f,m,g,y,{baseURL:h=mu("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:v=(l=mu("GEMINI_API_KEY"))!==null&&l!==void 0?l:null,apiVersion:S="v1beta"}=t,E=Ua(t,["baseURL","apiKey","apiVersion"]);const C=Object.assign(Object.assign({apiKey:v,apiVersion:S},E),{baseURL:h||"https://generativelanguage.googleapis.com"});this.baseURL=C.baseURL,this.timeout=(a=C.timeout)!==null&&a!==void 0?a:Ba.DEFAULT_TIMEOUT,this.logger=(r=C.logger)!==null&&r!==void 0?r:console;const U="warn";this.logLevel=U,this.logLevel=(m=(f=Dh(C.logLevel,"ClientOptions.logLevel",this))!==null&&f!==void 0?f:Dh(mu("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&m!==void 0?m:U,this.fetchOptions=C.fetchOptions,this.maxRetries=(g=C.maxRetries)!==null&&g!==void 0?g:2,this.fetch=(y=C.fetch)!==null&&y!==void 0?y:JA(),this.encoder=KA,this._options=C,this.apiKey=v,this.apiVersion=S,this.clientAdapter=C.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:l}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!l.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){const l=el([t.headers]);if(!(l.values.has("authorization")||l.values.has("x-goog-api-key"))){if(this.apiKey)return el([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return el([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([l,a])=>typeof a<"u").map(([l,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(l)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(l)}=`;throw new qt(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${Qi}`}defaultIdempotencyKey(){return`stainless-node-retry-${UA()}`}makeStatusError(t,l,a,r){return st.generate(t,l,a,r)}buildURL(t,l,a){const r=!this.baseURLOverridden()&&a||this.baseURL,f=bA(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),m=this.defaultQuery();return HA(m)||(l=Object.assign(Object.assign({},m),l)),typeof l=="object"&&l&&!Array.isArray(l)&&(f.search=this.stringifyQuery(l)),f.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){const l=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${l}`}}async prepareRequest(t,{url:l,options:a}){}get(t,l){return this.methodRequest("get",t,l)}post(t,l){return this.methodRequest("post",t,l)}patch(t,l){return this.methodRequest("patch",t,l)}put(t,l){return this.methodRequest("put",t,l)}delete(t,l){return this.methodRequest("delete",t,l)}methodRequest(t,l,a){return this.request(Promise.resolve(a).then(r=>Object.assign({method:t,path:l},r)))}request(t,l=null){return new Bu(this,this.makeRequest(t,l,void 0))}async makeRequest(t,l,a){var r,f,m;const g=await t,y=(r=g.maxRetries)!==null&&r!==void 0?r:this.maxRetries;l==null&&(l=y),await this.prepareOptions(g);const{req:h,url:v,timeout:S}=await this.buildRequest(g,{retryCount:y-l});await this.prepareRequest(h,{url:v,options:g});const E="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),C=a===void 0?"":`, retryOf: ${a}`,U=Date.now();if(at(this).debug(`[${E}] sending request`,ui({retryOfRequestLogID:a,method:g.method,url:v,options:g,headers:h.headers})),!((f=g.signal)===null||f===void 0)&&f.aborted)throw new Mu;const H=new AbortController,b=await this.fetchWithTimeout(v,h,S,H).catch(Ru),P=Date.now();if(b instanceof globalThis.Error){const k=`retrying, ${l} attempts remaining`;if(!((m=g.signal)===null||m===void 0)&&m.aborted)throw new Mu;const K=Au(b)||/timed? ?out/i.test(String(b)+("cause"in b?String(b.cause):""));if(l)return at(this).info(`[${E}] connection ${K?"timed out":"failed"} - ${k}`),at(this).debug(`[${E}] connection ${K?"timed out":"failed"} (${k})`,ui({retryOfRequestLogID:a,url:v,durationMs:P-U,message:b.message})),this.retryRequest(g,l,a??E);throw at(this).info(`[${E}] connection ${K?"timed out":"failed"} - error; no more retries left`),at(this).debug(`[${E}] connection ${K?"timed out":"failed"} (error; no more retries left)`,ui({retryOfRequestLogID:a,url:v,durationMs:P-U,message:b.message})),K?new ug:new Va({cause:b})}const X=`[${E}${C}] ${h.method} ${v} ${b.ok?"succeeded":"failed"} with status ${b.status} in ${P-U}ms`;if(!b.ok){const k=await this.shouldRetry(b);if(l&&k){const W=`retrying, ${l} attempts remaining`;return await XA(b.body),at(this).info(`${X} - ${W}`),at(this).debug(`[${E}] response error (${W})`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,durationMs:P-U})),this.retryRequest(g,l,a??E,b.headers)}const K=k?"error; no more retries left":"error; not retryable";at(this).info(`${X} - ${K}`);const ee=await b.text().catch(W=>Ru(W).message),te=zA(ee),F=te?void 0:ee;throw at(this).debug(`[${E}] response error (${K})`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,message:F,durationMs:Date.now()-U})),this.makeStatusError(b.status,te,F,b.headers)}return at(this).info(X),at(this).debug(`[${E}] response start`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,durationMs:P-U})),{response:b,options:g,controller:H,requestLogID:E,retryOfRequestLogID:a,startTime:U}}async fetchWithTimeout(t,l,a,r){const f=l||{},{signal:m,method:g}=f,y=Ua(f,["signal","method"]);m&&m.addEventListener("abort",()=>r.abort());const h=setTimeout(()=>r.abort(),a),v=globalThis.ReadableStream&&y.body instanceof globalThis.ReadableStream||typeof y.body=="object"&&y.body!==null&&Symbol.asyncIterator in y.body,S=Object.assign(Object.assign(Object.assign({signal:r.signal},v?{duplex:"half"}:{}),{method:"GET"}),y);g&&(S.method=g.toUpperCase());try{return await this.fetch.call(void 0,t,S)}finally{clearTimeout(h)}}async shouldRetry(t){const l=t.headers.get("x-should-retry");return l==="true"?!0:l==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,l,a,r){var f;let m;const g=r==null?void 0:r.get("retry-after-ms");if(g){const h=parseFloat(g);Number.isNaN(h)||(m=h)}const y=r==null?void 0:r.get("retry-after");if(y&&!m){const h=parseFloat(y);Number.isNaN(h)?m=Date.parse(y)-Date.now():m=h*1e3}if(!(m&&0<=m&&m<60*1e3)){const h=(f=t.maxRetries)!==null&&f!==void 0?f:this.maxRetries;m=this.calculateDefaultRetryTimeoutMillis(l,h)}return await BA(m),this.makeRequest(t,l-1,a)}calculateDefaultRetryTimeoutMillis(t,l){const f=l-t,m=Math.min(.5*Math.pow(2,f),8),g=1-Math.random()*.25;return m*g*1e3}async buildRequest(t,{retryCount:l=0}={}){var a,r,f;const m=Object.assign({},t),{method:g,path:y,query:h,defaultBaseURL:v}=m,S=this.buildURL(y,h,v);"timeout"in m&&VA("timeout",m.timeout),m.timeout=(a=m.timeout)!==null&&a!==void 0?a:this.timeout;const{bodyHeaders:E,body:C}=this.buildBody({options:m}),U=await this.buildHeaders({options:t,method:g,bodyHeaders:E,retryCount:l});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:g,headers:U},m.signal&&{signal:m.signal}),globalThis.ReadableStream&&C instanceof globalThis.ReadableStream&&{duplex:"half"}),C&&{body:C}),(r=this.fetchOptions)!==null&&r!==void 0?r:{}),(f=m.fetchOptions)!==null&&f!==void 0?f:{}),url:S,timeout:m.timeout}}async buildHeaders({options:t,method:l,bodyHeaders:a,retryCount:r}){let f={};this.idempotencyHeader&&l!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),f[this.idempotencyHeader]=t.idempotencyKey);const m=await this.authHeaders(t);let g=el([f,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),FA()),this._options.defaultHeaders,a,t.headers,m]);return this.validateHeaders(g),g.values}buildBody({options:{body:t,headers:l}}){if(!t)return{bodyHeaders:void 0,body:void 0};const a=el([l]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:YA(t)}:this.encoder({body:t,headers:a})}}Ba.DEFAULT_TIMEOUT=6e4;class Qe extends Ba{constructor(){super(...arguments),this.interactions=new Rg(this)}}Ng=Qe;Qe.GeminiNextGenAPIClient=Ng;Qe.GeminiNextGenAPIClientError=qt;Qe.APIError=st;Qe.APIConnectionError=Va;Qe.APIConnectionTimeoutError=ug;Qe.APIUserAbortError=Mu;Qe.NotFoundError=pg;Qe.ConflictError=mg;Qe.RateLimitError=gg;Qe.BadRequestError=cg;Qe.AuthenticationError=fg;Qe.InternalServerError=yg;Qe.PermissionDeniedError=dg;Qe.UnprocessableEntityError=hg;Qe.toFile=jA;Qe.Interactions=Rg;/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function dR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function pR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function mR(i,t){const l={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(l,["sdkHttpResponse"],a),l}function hR(i,t){const l={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(l,["sdkHttpResponse"],a),l}function gR(i,t,l){const a={};if(u(i,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const r=u(i,["tunedModelDisplayName"]);if(t!==void 0&&r!=null&&c(t,["displayName"],r),u(i,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const f=u(i,["epochCount"]);t!==void 0&&f!=null&&c(t,["tuningTask","hyperparameters","epochCount"],f);const m=u(i,["learningRateMultiplier"]);if(m!=null&&c(a,["tuningTask","hyperparameters","learningRateMultiplier"],m),u(i,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(u(i,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(u(i,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const g=u(i,["batchSize"]);t!==void 0&&g!=null&&c(t,["tuningTask","hyperparameters","batchSize"],g);const y=u(i,["learningRate"]);if(t!==void 0&&y!=null&&c(t,["tuningTask","hyperparameters","learningRate"],y),u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(u(i,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return a}function yR(i,t,l){const a={};let r=u(l,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const C=u(i,["validationDataset"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec"],wh(C))}else if(r==="PREFERENCE_TUNING"){const C=u(i,["validationDataset"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec"],wh(C))}const f=u(i,["tunedModelDisplayName"]);t!==void 0&&f!=null&&c(t,["tunedModelDisplayName"],f);const m=u(i,["description"]);t!==void 0&&m!=null&&c(t,["description"],m);let g=u(l,["config","method"]);if(g===void 0&&(g="SUPERVISED_FINE_TUNING"),g==="SUPERVISED_FINE_TUNING"){const C=u(i,["epochCount"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","epochCount"],C)}else if(g==="PREFERENCE_TUNING"){const C=u(i,["epochCount"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],C)}let y=u(l,["config","method"]);if(y===void 0&&(y="SUPERVISED_FINE_TUNING"),y==="SUPERVISED_FINE_TUNING"){const C=u(i,["learningRateMultiplier"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],C)}else if(y==="PREFERENCE_TUNING"){const C=u(i,["learningRateMultiplier"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],C)}let h=u(l,["config","method"]);if(h===void 0&&(h="SUPERVISED_FINE_TUNING"),h==="SUPERVISED_FINE_TUNING"){const C=u(i,["exportLastCheckpointOnly"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","exportLastCheckpointOnly"],C)}else if(h==="PREFERENCE_TUNING"){const C=u(i,["exportLastCheckpointOnly"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],C)}let v=u(l,["config","method"]);if(v===void 0&&(v="SUPERVISED_FINE_TUNING"),v==="SUPERVISED_FINE_TUNING"){const C=u(i,["adapterSize"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","adapterSize"],C)}else if(v==="PREFERENCE_TUNING"){const C=u(i,["adapterSize"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],C)}if(u(i,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(u(i,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const S=u(i,["labels"]);t!==void 0&&S!=null&&c(t,["labels"],S);const E=u(i,["beta"]);return t!==void 0&&E!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","beta"],E),a}function vR(i,t){const l={},a=u(i,["baseModel"]);a!=null&&c(l,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(l,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&xR(f);const m=u(i,["config"]);return m!=null&&gR(m,l),l}function TR(i,t){const l={},a=u(i,["baseModel"]);a!=null&&c(l,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(l,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&DR(f,l,t);const m=u(i,["config"]);return m!=null&&yR(m,l,t),l}function SR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function ER(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function _R(i,t,l){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const m=u(i,["filter"]);return t!==void 0&&m!=null&&c(t,["_query","filter"],m),a}function CR(i,t,l){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const m=u(i,["filter"]);return t!==void 0&&m!=null&&c(t,["_query","filter"],m),a}function AR(i,t){const l={},a=u(i,["config"]);return a!=null&&_R(a,l),l}function RR(i,t){const l={},a=u(i,["config"]);return a!=null&&CR(a,l),l}function MR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(l,["nextPageToken"],r);const f=u(i,["tunedModels"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>Ig(g))),c(l,["tuningJobs"],m)}return l}function NR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(l,["nextPageToken"],r);const f=u(i,["tuningJobs"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>xu(g))),c(l,["tuningJobs"],m)}return l}function IR(i,t){const l={},a=u(i,["name"]);a!=null&&c(l,["model"],a);const r=u(i,["name"]);return r!=null&&c(l,["endpoint"],r),l}function xR(i,t){const l={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(i,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const a=u(i,["examples"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(l,["examples","examples"],r)}return l}function DR(i,t,l){const a={};let r=u(l,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const m=u(i,["gcsUri"]);t!==void 0&&m!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],m)}else if(r==="PREFERENCE_TUNING"){const m=u(i,["gcsUri"]);t!==void 0&&m!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],m)}let f=u(l,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){const m=u(i,["vertexDatasetResource"]);t!==void 0&&m!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],m)}else if(f==="PREFERENCE_TUNING"){const m=u(i,["vertexDatasetResource"]);t!==void 0&&m!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],m)}if(u(i,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return a}function Ig(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["state"]);f!=null&&c(l,["state"],Fh(f));const m=u(i,["createTime"]);m!=null&&c(l,["createTime"],m);const g=u(i,["tuningTask","startTime"]);g!=null&&c(l,["startTime"],g);const y=u(i,["tuningTask","completeTime"]);y!=null&&c(l,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(l,["updateTime"],h);const v=u(i,["description"]);v!=null&&c(l,["description"],v);const S=u(i,["baseModel"]);S!=null&&c(l,["baseModel"],S);const E=u(i,["_self"]);return E!=null&&c(l,["tunedModel"],IR(E)),l}function xu(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["state"]);f!=null&&c(l,["state"],Fh(f));const m=u(i,["createTime"]);m!=null&&c(l,["createTime"],m);const g=u(i,["startTime"]);g!=null&&c(l,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(l,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(l,["updateTime"],h);const v=u(i,["error"]);v!=null&&c(l,["error"],v);const S=u(i,["description"]);S!=null&&c(l,["description"],S);const E=u(i,["baseModel"]);E!=null&&c(l,["baseModel"],E);const C=u(i,["tunedModel"]);C!=null&&c(l,["tunedModel"],C);const U=u(i,["preTunedModel"]);U!=null&&c(l,["preTunedModel"],U);const H=u(i,["supervisedTuningSpec"]);H!=null&&c(l,["supervisedTuningSpec"],H);const b=u(i,["preferenceOptimizationSpec"]);b!=null&&c(l,["preferenceOptimizationSpec"],b);const P=u(i,["tuningDataStats"]);P!=null&&c(l,["tuningDataStats"],P);const X=u(i,["encryptionSpec"]);X!=null&&c(l,["encryptionSpec"],X);const k=u(i,["partnerModelTuningSpec"]);k!=null&&c(l,["partnerModelTuningSpec"],k);const K=u(i,["customBaseModel"]);K!=null&&c(l,["customBaseModel"],K);const ee=u(i,["experiment"]);ee!=null&&c(l,["experiment"],ee);const te=u(i,["labels"]);te!=null&&c(l,["labels"],te);const F=u(i,["outputUri"]);F!=null&&c(l,["outputUri"],F);const he=u(i,["pipelineJob"]);he!=null&&c(l,["pipelineJob"],he);const W=u(i,["serviceAccount"]);W!=null&&c(l,["serviceAccount"],W);const de=u(i,["tunedModelDisplayName"]);de!=null&&c(l,["tunedModelDisplayName"],de);const Ce=u(i,["veoTuningSpec"]);return Ce!=null&&c(l,["veoTuningSpec"],Ce),l}function UR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["metadata"]);f!=null&&c(l,["metadata"],f);const m=u(i,["done"]);m!=null&&c(l,["done"],m);const g=u(i,["error"]);return g!=null&&c(l,["error"],g),l}function wh(i,t){const l={},a=u(i,["gcsUri"]);a!=null&&c(l,["validationDatasetUri"],a);const r=u(i,["vertexDatasetResource"]);return r!=null&&c(l,["validationDatasetUri"],r),l}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class wR extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_TUNING_JOBS,a=>this.listInternal(a),await this.listInternal(l),l),this.get=async l=>await this.getInternal(l),this.tune=async l=>{var a;if(this.apiClient.isVertexAI())if(l.baseModel.startsWith("projects/")){const r={tunedModelName:l.baseModel};!((a=l.config)===null||a===void 0)&&a.preTunedModelCheckpointId&&(r.checkpointId=l.config.preTunedModelCheckpointId);const f=Object.assign(Object.assign({},l),{preTunedModel:r});return f.baseModel=void 0,await this.tuneInternal(f)}else{const r=Object.assign({},l);return await this.tuneInternal(r)}else{const r=Object.assign({},l),f=await this.tuneMldevInternal(r);let m="";return f.metadata!==void 0&&f.metadata.tunedModel!==void 0?m=f.metadata.tunedModel:f.name!==void 0&&f.name.includes("/operations/")&&(m=f.name.split("/operations/")[0]),{name:m,state:yu.JOB_STATE_QUEUED}}}}async getInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=ER(t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>xu(v))}else{const h=SR(t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>Ig(v))}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=RR(t);return g=Y("tuningJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=NR(v),E=new oh;return Object.assign(E,S),E})}else{const h=AR(t);return g=Y("tunedModels",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=MR(v),E=new oh;return Object.assign(E,S),E})}}async cancel(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=pR(t);return g=Y("{name}:cancel",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=hR(v),E=new lh;return Object.assign(E,S),E})}else{const h=dR(t);return g=Y("{name}:cancel",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=mR(v),E=new lh;return Object.assign(E,S),E})}}async tuneInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=TR(t,t);return f=Y("tuningJobs",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>xu(y))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=vR(t);return f=Y("tunedModels",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>UR(y))}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class bR{async download(t,l){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an tag.")}}const LR=1024*1024*8,GR=3,HR=1e3,qR=2,ba="x-goog-upload-status";async function VR(i,t,l){var a;const r=await xg(i,t,l),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[ba])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function zR(i,t,l){var a;const r=await xg(i,t,l),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[ba])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const m=Vh(f),g=new bu;return Object.assign(g,m),g}async function xg(i,t,l){var a,r;let f=0,m=0,g=new vu(new Response),y="upload";for(f=i.size;m=f&&(y+=", finalize");let S=0,E=HR;for(;SsetTimeout(t,i))}class kR{async upload(t,l,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await VR(t,l,a)}async uploadToFileSearchStore(t,l,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await zR(t,l,a)}async stat(t){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await BR(t)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class OR{create(t,l,a){return new FR(t,l,a)}}class FR{constructor(t,l,a){this.url=t,this.headers=l,this.callbacks=a}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(t){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(t)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const bh="x-goog-api-key";class JR{constructor(t){this.apiKey=t}async addAuthHeaders(t,l){if(t.get(bh)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");t.append(bh,this.apiKey)}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const YR="gl-node/";class XR{get interactions(){if(this._interactions!==void 0)return this._interactions;console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.");const t=this.httpOptions;t!=null&&t.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");const l=new Qe({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:t==null?void 0:t.timeout});return this._interactions=l.interactions,this._interactions}constructor(t){var l;if(t.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(t.project||t.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(l=t.vertexai)!==null&&l!==void 0?l:!1,this.apiKey=t.apiKey;const a=P0(t.httpOptions,t.vertexai,void 0,void 0);a&&(t.httpOptions?t.httpOptions.baseUrl=a:t.httpOptions={baseUrl:a}),this.apiVersion=t.apiVersion,this.httpOptions=t.httpOptions;const r=new JR(this.apiKey);this.apiClient=new BC({auth:r,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:YR+"web",uploader:new kR,downloader:new bR}),this.models=new lA(this.apiClient),this.live=new jC(this.apiClient,r,new OR),this.batches=new gS(this.apiClient),this.chats=new $S(this.models,this.apiClient),this.caches=new KS(this.apiClient),this.files=new sE(this.apiClient),this.operations=new aA(this.apiClient),this.authTokens=new _A(this.apiClient),this.tunings=new wR(this.apiClient),this.fileSearchStores=new DA(this.apiClient)}}const KR=()=>{const i="PLACEHOLDER_API_KEY";return new XR({apiKey:i})},QR=async(i,t)=>{const l=KR();if(!l)return"错误: 未配置 API Key";try{const a=`Act as a creative songwriter assistant. + User is submitting lyrics for a song. + Song Style: ${t} + User Input (Title or Draft Lyrics): ${i} + + Task: Write or polish short song lyrics (about 4-8 lines) in Chinese based on the input. + Make it poetic and fitting for the style. + Return ONLY the lyrics text.`;return(await l.models.generateContent({model:"gemini-2.5-flash",contents:a})).text||"暂时无法生成歌词,请稍后重试。"}catch(a){return console.error("Gemini API Error:",a),"抱歉,AI 灵感枯竭了,请重试。"}},ZR=({onSubmit:i,initialValues:t})=>{const[l,a]=nt.useState({title:(t==null?void 0:t.title)||"",lyrics:(t==null?void 0:t.lyrics)||"",style:(t==null?void 0:t.style)||"",nickname:(t==null?void 0:t.nickname)||""}),[r,f]=nt.useState(!1),[m,g]=nt.useState(!1),y=async()=>{if(!l.title&&!l.lyrics){alert("请至少输入歌名或一点歌词内容!");return}f(!0);const v=await QR(l.title+(l.lyrics?` Content: ${l.lyrics}`:""),l.style||"流行");a(S=>({...S,lyrics:v})),f(!1)},h=v=>{v.preventDefault(),g(!0);const S={...l,nickname:l.nickname.trim()===""?"音乐共创人":l.nickname};i(S)};return B.jsxs("div",{className:"space-y-6",children:[B.jsxs("div",{className:"text-center mb-4",children:[B.jsx("h2",{className:"text-xl font-black text-brand-dark flex items-center justify-center gap-2",children:"填写创作信息"}),B.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"创作一首属于你自已的歌"})]}),B.jsxs("form",{onSubmit:h,className:"space-y-5",children:[B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["你的昵称 ",B.jsx("span",{className:"text-[10px] font-normal text-gray-400 bg-gray-100 px-1.5 py-0.5 rounded ml-1",children:"选填"})]}),B.jsx("input",{type:"text",value:l.nickname,onChange:v=>a({...l,nickname:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"例如: 阳光天地的朋友"})]}),B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["歌曲风格 ",B.jsx("span",{className:"text-brand-red",children:"*"})]}),B.jsx("input",{type:"text",required:!0,value:l.style,onChange:v=>a({...l,style:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"例如: 温暖感动、R&B、摇滚..."})]}),B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["歌曲名称 ",B.jsx("span",{className:"text-brand-red",children:"*"})]}),B.jsx("input",{type:"text",required:!0,value:l.title,onChange:v=>a({...l,title:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"为你的歌起个名字吧..."})]}),B.jsxs("div",{className:"relative",children:[B.jsxs("div",{className:"flex justify-between items-center mb-1 ml-1",children:[B.jsx("label",{className:"block text-xs font-bold text-gray-500",children:"歌词内容"}),B.jsxs("button",{type:"button",onClick:y,disabled:r,className:"flex items-center gap-1.5 text-[10px] font-bold text-brand-orange hover:text-brand-red transition-colors disabled:opacity-50",children:[B.jsx(qh,{className:"w-3 h-3"}),r?"AI 生成中...":"AI 帮我写词"]})]}),B.jsx("textarea",{required:!0,rows:5,value:l.lyrics,onChange:v=>a({...l,lyrics:v.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all text-sm leading-relaxed placeholder-gray-400 resize-none",placeholder:"写下你想说的话,或者具体的歌词..."})]}),B.jsx("button",{type:"submit",disabled:m||r,className:"w-full mt-6 bg-gradient-to-r from-brand-orange to-brand-red text-white font-bold py-4 rounded-xl shadow-lg shadow-brand-orange/30 flex items-center justify-center gap-2 hover:scale-[1.02] transition-all active:scale-95",children:m?B.jsx(Hh,{className:"animate-spin"}):B.jsxs(B.Fragment,{children:[B.jsx(x0,{className:"w-4 h-4"})," 确认提交创作"]})})]})]})},$R=({song:i})=>B.jsxs("div",{className:"space-y-6",children:[B.jsxs("div",{className:"text-center mb-4",children:[B.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-100 border border-green-200 text-green-600 text-xs font-bold mb-4 animate-bounce",children:[B.jsx(S0,{className:"w-4 h-4"})," 提交成功"]}),B.jsx("h2",{className:"text-1xl font-black text-brand-dark",children:"请截图保存下方凭证,等待工作人员联系"}),B.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"您的创作已收录,快来现场一起畅聊吧"})]}),B.jsxs("div",{className:"relative bg-orange-50 rounded-2xl border-2 border-brand-orange/20 overflow-hidden shadow-sm group",children:[B.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-5",children:B.jsx(R0,{className:"w-24 h-24 text-brand-orange"})}),B.jsxs("div",{className:"p-6 relative z-10",children:[B.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[B.jsx("div",{className:"w-10 h-10 rounded-full bg-white border border-brand-orange/20 flex items-center justify-center shadow-sm",children:B.jsx(L0,{className:"w-5 h-5 text-brand-orange"})}),B.jsxs("div",{children:[B.jsx("div",{className:"text-xs text-gray-400",children:"来自共创人"}),B.jsx("div",{className:"font-bold text-gray-800",children:i.nickname})]}),B.jsx("div",{className:"ml-auto bg-brand-orange/10 text-brand-orange px-2 py-1 rounded text-[10px] font-bold",children:i.style})]}),B.jsxs("div",{className:"bg-white rounded-xl p-4 shadow-sm border border-brand-orange/10 mb-4",children:[B.jsxs("h3",{className:"text-sm font-bold text-brand-dark mb-2 flex items-center gap-2 min-w-0",children:[B.jsx(qh,{className:"w-3.5 h-3.5 text-brand-yellow"}),B.jsx("span",{className:"flex-1 truncate",children:i.title})]}),B.jsxs("p",{className:"text-sm text-gray-600 italic leading-relaxed whitespace-pre-wrap",children:['"',i.lyrics,'"']})]}),B.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400 border-t border-brand-orange/10 pt-4",children:[B.jsxs("div",{className:"flex items-center gap-1",children:[B.jsx("span",{children:"凭证编号:"}),B.jsx("span",{className:"font-mono text-brand-orange",children:i.ticketNumber||"PENDING"})]}),B.jsx("div",{className:"flex items-center gap-1",children:B.jsx(_0,{className:"w-3.5 h-3.5"})})]})]})]}),B.jsxs("button",{onClick:()=>{localStorage.removeItem("ai_song_fest_songs"),window.location.reload()},className:"w-full py-4 text-xs text-gray-400 hover:text-brand-orange transition-colors flex items-center justify-center gap-2 group",children:[B.jsx(N0,{className:"w-3 h-3 group-hover:rotate-180 transition-transform duration-500"}),"提交新的创作"]})]});function WR(){const[i,t]=nt.useState("loading"),[l,a]=nt.useState(null),[r,f]=nt.useState(null);nt.useEffect(()=>{(async()=>{const v=hu.getCurrentUser();if(!v){t("login");return}a(v);const S=await Sa.getSongByPhone(v.phone);S?(f(S),t("result")):t("form")})()},[]);const m=async()=>{const h=hu.getCurrentUser();if(a(h),h){const v=await Sa.getSongByPhone(h.phone);v?(f(v),t("result")):t("form")}},g=async h=>{if(!l)return;const v=await Sa.submitSong(l.phone,h);f(v),t("result")},y=async()=>{if(l){const h=await Sa.getSongByPhone(l.phone);h&&f(h)}};return i==="loading"?B.jsx(jp,{children:B.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-white",children:[B.jsx("div",{className:"w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin"}),B.jsx("p",{className:"mt-6 text-sm font-bold tracking-widest animate-pulse",children:"正在进入..."})]})}):B.jsxs(jp,{children:[i==="login"&&B.jsx(H0,{onLoginSuccess:m}),i==="form"&&B.jsx(ZR,{onSubmit:g}),i==="result"&&r&&B.jsx($R,{song:r,onRefresh:y})]})}const Dg=document.getElementById("root");if(!Dg)throw new Error("Could not find root element to mount to");const jR=f0.createRoot(Dg);jR.render(B.jsx(i0.StrictMode,{children:B.jsx(WR,{})})); diff --git a/h5/together/assets/index-DrkVVizK.js b/h5/together/assets/index-DrkVVizK.js new file mode 100755 index 0000000..dd2c553 --- /dev/null +++ b/h5/together/assets/index-DrkVVizK.js @@ -0,0 +1,374 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const f of r)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&a(m)}).observe(document,{childList:!0,subtree:!0});function l(r){const f={};return r.integrity&&(f.integrity=r.integrity),r.referrerPolicy&&(f.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?f.credentials="include":r.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(r){if(r.ep)return;r.ep=!0;const f=l(r);fetch(r.href,f)}})();function Lh(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var au={exports:{}},$o={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Op;function e0(){if(Op)return $o;Op=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function l(a,r,f){var m=null;if(f!==void 0&&(m=""+f),r.key!==void 0&&(m=""+r.key),"key"in r){f={};for(var g in r)g!=="key"&&(f[g]=r[g])}else f=r;return r=f.ref,{$$typeof:i,type:a,key:m,ref:r!==void 0?r:null,props:f}}return $o.Fragment=t,$o.jsx=l,$o.jsxs=l,$o}var Fp;function t0(){return Fp||(Fp=1,au.exports=e0()),au.exports}var B=t0(),su={exports:{}},le={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Jp;function n0(){if(Jp)return le;Jp=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),E=Symbol.iterator;function C(M){return M===null||typeof M!="object"?null:(M=E&&M[E]||M["@@iterator"],typeof M=="function"?M:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,b={};function P(M,z,J){this.props=M,this.context=z,this.refs=b,this.updater=J||w}P.prototype.isReactComponent={},P.prototype.setState=function(M,z){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,z,"setState")},P.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function X(){}X.prototype=P.prototype;function k(M,z,J){this.props=M,this.context=z,this.refs=b,this.updater=J||w}var K=k.prototype=new X;K.constructor=k,H(K,P.prototype),K.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var F={H:null,A:null,T:null,S:null},he=Object.prototype.hasOwnProperty;function W(M,z,J){var Z=J.ref;return{$$typeof:i,type:M,key:z,ref:Z!==void 0?Z:null,props:J}}function de(M,z){return W(M.type,z,M.props)}function Ce(M){return typeof M=="object"&&M!==null&&M.$$typeof===i}function Ge(M){var z={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(J){return z[J]})}var Ee=/\/+/g;function Pe(M,z){return typeof M=="object"&&M!==null&&M.key!=null?Ge(""+M.key):z.toString(36)}function rt(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(te,te):(M.status="pending",M.then(function(z){M.status==="pending"&&(M.status="fulfilled",M.value=z)},function(z){M.status==="pending"&&(M.status="rejected",M.reason=z)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function L(M,z,J,Z,ae){var ue=typeof M;(ue==="undefined"||ue==="boolean")&&(M=null);var _e=!1;if(M===null)_e=!0;else switch(ue){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(M.$$typeof){case i:case t:_e=!0;break;case v:return _e=M._init,L(_e(M._payload),z,J,Z,ae)}}if(_e)return ae=ae(M),_e=Z===""?"."+Pe(M,0):Z,ee(ae)?(J="",_e!=null&&(J=_e.replace(Ee,"$&/")+"/"),L(ae,z,J,"",function(io){return io})):ae!=null&&(Ce(ae)&&(ae=de(ae,J+(ae.key==null||M&&M.key===ae.key?"":(""+ae.key).replace(Ee,"$&/")+"/")+_e)),z.push(ae)),1;_e=0;var ot=Z===""?".":Z+":";if(ee(M))for(var Ve=0;Ve>>1,De=L[Me];if(0>>1;Mer(J,ie))Zr(ae,J)?(L[Me]=ae,L[Z]=ie,Me=Z):(L[Me]=J,L[z]=ie,Me=z);else if(Zr(ae,ie))L[Me]=ae,L[Z]=ie,Me=Z;else break e}}return O}function r(L,O){var ie=L.sortIndex-O.sortIndex;return ie!==0?ie:L.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,g=m.now();i.unstable_now=function(){return m.now()-g}}var y=[],h=[],v=1,S=null,E=3,C=!1,w=!1,H=!1,b=!1,P=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function K(L){for(var O=l(h);O!==null;){if(O.callback===null)a(h);else if(O.startTime<=L)a(h),O.sortIndex=O.expirationTime,t(y,O);else break;O=l(h)}}function ee(L){if(H=!1,K(L),!w)if(l(y)!==null)w=!0,te||(te=!0,Ge());else{var O=l(h);O!==null&&rt(ee,O.startTime-L)}}var te=!1,F=-1,he=5,W=-1;function de(){return b?!0:!(i.unstable_now()-WL&&de());){var Me=S.callback;if(typeof Me=="function"){S.callback=null,E=S.priorityLevel;var De=Me(S.expirationTime<=L);if(L=i.unstable_now(),typeof De=="function"){S.callback=De,K(L),O=!0;break t}S===l(y)&&a(y),K(L)}else a(y);S=l(y)}if(S!==null)O=!0;else{var M=l(h);M!==null&&rt(ee,M.startTime-L),O=!1}}break e}finally{S=null,E=ie,C=!1}O=void 0}}finally{O?Ge():te=!1}}}var Ge;if(typeof k=="function")Ge=function(){k(Ce)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Pe=Ee.port2;Ee.port1.onmessage=Ce,Ge=function(){Pe.postMessage(null)}}else Ge=function(){P(Ce,0)};function rt(L,O){F=P(function(){L(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(L){L.callback=null},i.unstable_forceFrameRate=function(L){0>L||125Me?(L.sortIndex=ie,t(h,L),l(y)===null&&L===l(h)&&(H?(X(F),F=-1):H=!0,rt(ee,ie-Me))):(L.sortIndex=De,t(y,L),w||C||(w=!0,te||(te=!0,Ge()))),L},i.unstable_shouldYield=de,i.unstable_wrapCallback=function(L){var O=E;return function(){var ie=E;E=O;try{return L.apply(this,arguments)}finally{E=ie}}}})(cu)),cu}var Kp;function l0(){return Kp||(Kp=1,uu.exports=o0()),uu.exports}var fu={exports:{}},nt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Qp;function a0(){if(Qp)return nt;Qp=1;var i=Du();function t(y){var h="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),fu.exports=a0(),fu.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $p;function r0(){if($p)return Wo;$p=1;var i=l0(),t=Du(),l=s0();function a(e){var n="https://react.dev/errors/"+e;if(1De||(e.current=Me[De],Me[De]=null,De--)}function J(e,n){De++,Me[De]=e.current,e.current=n}var Z=M(null),ae=M(null),ue=M(null),_e=M(null);function ot(e,n){switch(J(ue,n),J(ae,e),J(Z,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=dp(n),e=pp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(Z),J(Z,e)}function Ve(){z(Z),z(ae),z(ue)}function io(e){e.memoizedState!==null&&J(_e,e);var n=Z.current,o=pp(n,e.type);n!==o&&(J(ae,e),J(Z,o))}function il(e){ae.current===e&&(z(Z),z(ae)),_e.current===e&&(z(_e),Xo._currentValue=ie)}var ka,Pu;function Fn(e){if(ka===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);ka=n&&n[1]||"",Pu=-1)":-1d||A[s]!==x[d]){var G=` +`+A[s].replace(" at new "," at ");return e.displayName&&G.includes("")&&(G=G.replace("",e.displayName)),G}while(1<=s&&0<=d);break}}}finally{Oa=!1,Error.prepareStackTrace=o}return(o=e?e.displayName||e.name:"")?Fn(o):""}function wg(e,n){switch(e.tag){case 26:case 27:case 5:return Fn(e.type);case 16:return Fn("Lazy");case 13:return e.child!==n&&n!==null?Fn("Suspense Fallback"):Fn("Suspense");case 19:return Fn("SuspenseList");case 0:case 15:return Fa(e.type,!1);case 11:return Fa(e.type.render,!1);case 1:return Fa(e.type,!0);case 31:return Fn("Activity");default:return""}}function ku(e){try{var n="",o=null;do n+=wg(e,o),o=e,e=e.return;while(e);return n}catch(s){return` +Error generating stack: `+s.message+` +`+s.stack}}var Ja=Object.prototype.hasOwnProperty,Ya=i.unstable_scheduleCallback,Xa=i.unstable_cancelCallback,Ug=i.unstable_shouldYield,bg=i.unstable_requestPaint,gt=i.unstable_now,Lg=i.unstable_getCurrentPriorityLevel,Ou=i.unstable_ImmediatePriority,Fu=i.unstable_UserBlockingPriority,ol=i.unstable_NormalPriority,Gg=i.unstable_LowPriority,Ju=i.unstable_IdlePriority,Hg=i.log,qg=i.unstable_setDisableYieldValue,oo=null,yt=null;function yn(e){if(typeof Hg=="function"&&qg(e),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(oo,e)}catch{}}var vt=Math.clz32?Math.clz32:Bg,Vg=Math.log,zg=Math.LN2;function Bg(e){return e>>>=0,e===0?32:31-(Vg(e)/zg|0)|0}var ll=256,al=262144,sl=4194304;function Jn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function rl(e,n,o){var s=e.pendingLanes;if(s===0)return 0;var d=0,p=e.suspendedLanes,T=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~p,s!==0?d=Jn(s):(T&=_,T!==0?d=Jn(T):o||(o=_&~e,o!==0&&(d=Jn(o))))):(_=s&~p,_!==0?d=Jn(_):T!==0?d=Jn(T):o||(o=s&~e,o!==0&&(d=Jn(o)))),d===0?0:n!==0&&n!==d&&(n&p)===0&&(p=d&-d,o=n&-n,p>=o||p===32&&(o&4194048)!==0)?n:d}function lo(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Pg(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yu(){var e=sl;return sl<<=1,(sl&62914560)===0&&(sl=4194304),e}function Ka(e){for(var n=[],o=0;31>o;o++)n.push(e);return n}function ao(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kg(e,n,o,s,d,p){var T=e.pendingLanes;e.pendingLanes=o,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=o,e.entangledLanes&=o,e.errorRecoveryDisabledLanes&=o,e.shellSuspendCounter=0;var _=e.entanglements,A=e.expirationTimes,x=e.hiddenUpdates;for(o=T&~o;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Kg=/[\n"\\]/g;function Nt(e){return e.replace(Kg,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function es(e,n,o,s,d,p,T,_){e.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.type=T:e.removeAttribute("type"),n!=null?T==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Mt(n)):e.value!==""+Mt(n)&&(e.value=""+Mt(n)):T!=="submit"&&T!=="reset"||e.removeAttribute("value"),n!=null?ts(e,T,Mt(n)):o!=null?ts(e,T,Mt(o)):s!=null&&e.removeAttribute("value"),d==null&&p!=null&&(e.defaultChecked=!!p),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.name=""+Mt(_):e.removeAttribute("name")}function lc(e,n,o,s,d,p,T,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){ja(e);return}o=o!=null?""+Mt(o):"",n=n!=null?""+Mt(n):o,_||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=_?e.checked:!!s,e.defaultChecked=!!s,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(e.name=T),ja(e)}function ts(e,n,o){n==="number"&&fl(e.ownerDocument)===e||e.defaultValue===""+o||(e.defaultValue=""+o)}function gi(e,n,o,s){if(e=e.options,n){n={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),as=!1;if($t)try{var co={};Object.defineProperty(co,"passive",{get:function(){as=!0}}),window.addEventListener("test",co,co),window.removeEventListener("test",co,co)}catch{as=!1}var Tn=null,ss=null,pl=null;function dc(){if(pl)return pl;var e,n=ss,o=n.length,s,d="value"in Tn?Tn.value:Tn.textContent,p=d.length;for(e=0;e=mo),vc=" ",Tc=!1;function Sc(e,n){switch(e){case"keyup":return _y.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Si=!1;function Ay(e,n){switch(e){case"compositionend":return Ec(n);case"keypress":return n.which!==32?null:(Tc=!0,vc);case"textInput":return e=n.data,e===vc&&Tc?null:e;default:return null}}function Ry(e,n){if(Si)return e==="compositionend"||!ds&&Sc(e,n)?(e=dc(),pl=ss=Tn=null,Si=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:o,offset:n-e};e=s}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=xc(o)}}function wc(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?wc(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Uc(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=fl(e.document);n instanceof e.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)e=n.contentWindow;else break;n=fl(e.document)}return n}function hs(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var by=$t&&"documentMode"in document&&11>=document.documentMode,Ei=null,gs=null,vo=null,ys=!1;function bc(e,n,o){var s=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;ys||Ei==null||Ei!==fl(s)||(s=Ei,"selectionStart"in s&&hs(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vo&&yo(vo,s)||(vo=s,s=aa(gs,"onSelect"),0>=T,d-=T,Ft=1<<32-vt(n)+d|o<re?(me=$,$=null):me=$.sibling;var ve=D(N,$,I[re],q);if(ve===null){$===null&&($=me);break}e&&$&&ve.alternate===null&&n(N,$),R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve,$=me}if(re===I.length)return o(N,$),ge&&jt(N,re),j;if($===null){for(;rere?(me=$,$=null):me=$.sibling;var Pn=D(N,$,ve.value,q);if(Pn===null){$===null&&($=me);break}e&&$&&Pn.alternate===null&&n(N,$),R=p(Pn,R,re),ye===null?j=Pn:ye.sibling=Pn,ye=Pn,$=me}if(ve.done)return o(N,$),ge&&jt(N,re),j;if($===null){for(;!ve.done;re++,ve=I.next())ve=V(N,ve.value,q),ve!==null&&(R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve);return ge&&jt(N,re),j}for($=s($);!ve.done;re++,ve=I.next())ve=U($,N,re,ve.value,q),ve!==null&&(e&&ve.alternate!==null&&$.delete(ve.key===null?re:ve.key),R=p(ve,R,re),ye===null?j=ve:ye.sibling=ve,ye=ve);return e&&$.forEach(function(jv){return n(N,jv)}),ge&&jt(N,re),j}function xe(N,R,I,q){if(typeof I=="object"&&I!==null&&I.type===H&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case C:e:{for(var j=I.key;R!==null;){if(R.key===j){if(j=I.type,j===H){if(R.tag===7){o(N,R.sibling),q=d(R,I.props.children),q.return=N,N=q;break e}}else if(R.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===he&&ni(j)===R.type){o(N,R.sibling),q=d(R,I.props),Ao(q,I),q.return=N,N=q;break e}o(N,R);break}else n(N,R);R=R.sibling}I.type===H?(q=$n(I.props.children,N.mode,q,I.key),q.return=N,N=q):(q=Cl(I.type,I.key,I.props,null,N.mode,q),Ao(q,I),q.return=N,N=q)}return T(N);case w:e:{for(j=I.key;R!==null;){if(R.key===j)if(R.tag===4&&R.stateNode.containerInfo===I.containerInfo&&R.stateNode.implementation===I.implementation){o(N,R.sibling),q=d(R,I.children||[]),q.return=N,N=q;break e}else{o(N,R);break}else n(N,R);R=R.sibling}q=As(I,N.mode,q),q.return=N,N=q}return T(N);case he:return I=ni(I),xe(N,R,I,q)}if(rt(I))return Q(N,R,I,q);if(Ge(I)){if(j=Ge(I),typeof j!="function")throw Error(a(150));return I=j.call(I),ne(N,R,I,q)}if(typeof I.then=="function")return xe(N,R,Dl(I),q);if(I.$$typeof===k)return xe(N,R,Ml(N,I),q);wl(N,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,R!==null&&R.tag===6?(o(N,R.sibling),q=d(R,I),q.return=N,N=q):(o(N,R),q=Cs(I,N.mode,q),q.return=N,N=q),T(N)):o(N,R)}return function(N,R,I,q){try{Co=0;var j=xe(N,R,I,q);return Ui=null,j}catch($){if($===wi||$===Il)throw $;var ye=St(29,$,null,N.mode);return ye.lanes=q,ye.return=N,ye}finally{}}}var oi=nf(!0),of=nf(!1),An=!1;function Hs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qs(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Rn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Mn(e,n,o){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Se&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=_l(e),Bc(e,null,o),n}return El(e,s,n,o),_l(e)}function Ro(e,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,o|=s,n.lanes=o,Ku(e,o)}}function Vs(e,n){var o=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,o===s)){var d=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var T={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};p===null?d=p=T:p=p.next=T,o=o.next}while(o!==null);p===null?d=p=n:p=p.next=n}else d=p=n;o={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=n:e.next=n,o.lastBaseUpdate=n}var zs=!1;function Mo(){if(zs){var e=Di;if(e!==null)throw e}}function No(e,n,o,s){zs=!1;var d=e.updateQueue;An=!1;var p=d.firstBaseUpdate,T=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var A=_,x=A.next;A.next=null,T===null?p=x:T.next=x,T=A;var G=e.alternate;G!==null&&(G=G.updateQueue,_=G.lastBaseUpdate,_!==T&&(_===null?G.firstBaseUpdate=x:_.next=x,G.lastBaseUpdate=A))}if(p!==null){var V=d.baseState;T=0,G=x=A=null,_=p;do{var D=_.lane&-536870913,U=D!==_.lane;if(U?(pe&D)===D:(s&D)===D){D!==0&&D===xi&&(zs=!0),G!==null&&(G=G.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Q=e,ne=_;D=n;var xe=o;switch(ne.tag){case 1:if(Q=ne.payload,typeof Q=="function"){V=Q.call(xe,V,D);break e}V=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=ne.payload,D=typeof Q=="function"?Q.call(xe,V,D):Q,D==null)break e;V=S({},V,D);break e;case 2:An=!0}}D=_.callback,D!==null&&(e.flags|=64,U&&(e.flags|=8192),U=d.callbacks,U===null?d.callbacks=[D]:U.push(D))}else U={lane:D,tag:_.tag,payload:_.payload,callback:_.callback,next:null},G===null?(x=G=U,A=V):G=G.next=U,T|=D;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;U=_,_=U.next,U.next=null,d.lastBaseUpdate=U,d.shared.pending=null}}while(!0);G===null&&(A=V),d.baseState=A,d.firstBaseUpdate=x,d.lastBaseUpdate=G,p===null&&(d.shared.lanes=0),wn|=T,e.lanes=T,e.memoizedState=V}}function lf(e,n){if(typeof e!="function")throw Error(a(191,e));e.call(n)}function af(e,n){var o=e.callbacks;if(o!==null)for(e.callbacks=null,e=0;ep?p:8;var T=L.T,_={};L.T=_,or(e,!1,n,o);try{var A=d(),x=L.S;if(x!==null&&x(_,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var G=ky(A,s);Do(e,n,G,Rt(e))}else Do(e,n,s,Rt(e))}catch(V){Do(e,n,{then:function(){},status:"rejected",reason:V},Rt())}finally{O.p=p,T!==null&&_.types!==null&&(T.types=_.types),L.T=T}}function Ky(){}function nr(e,n,o,s){if(e.tag!==5)throw Error(a(476));var d=Vf(e).queue;qf(e,d,n,ie,o===null?Ky:function(){return zf(e),o(s)})}function Vf(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:on,lastRenderedState:ie},next:null};var o={};return n.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:on,lastRenderedState:o},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function zf(e){var n=Vf(e);n.next===null&&(n=e.alternate.memoizedState),Do(e,n.next.queue,{},Rt())}function ir(){return je(Xo)}function Bf(){return Be().memoizedState}function Pf(){return Be().memoizedState}function Qy(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var o=Rt();e=Rn(o);var s=Mn(n,e,o);s!==null&&(ht(s,n,o),Ro(s,n,o)),n={cache:Us()},e.payload=n;return}n=n.return}}function Zy(e,n,o){var s=Rt();o={lane:s,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Pl(e)?Of(n,o):(o=Es(e,n,o,s),o!==null&&(ht(o,e,s),Ff(o,n,s)))}function kf(e,n,o){var s=Rt();Do(e,n,o,s)}function Do(e,n,o,s){var d={lane:s,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Pl(e))Of(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var T=n.lastRenderedState,_=p(T,o);if(d.hasEagerState=!0,d.eagerState=_,Tt(_,T))return El(e,n,d,0),we===null&&Sl(),!1}catch{}finally{}if(o=Es(e,n,d,s),o!==null)return ht(o,e,s),Ff(o,n,s),!0}return!1}function or(e,n,o,s){if(s={lane:2,revertLane:Hr(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Pl(e)){if(n)throw Error(a(479))}else n=Es(e,o,s,2),n!==null&&ht(n,e,2)}function Pl(e){var n=e.alternate;return e===se||n!==null&&n===se}function Of(e,n){Li=Ll=!0;var o=e.pending;o===null?n.next=n:(n.next=o.next,o.next=n),e.pending=n}function Ff(e,n,o){if((o&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,o|=s,n.lanes=o,Ku(e,o)}}var wo={readContext:je,use:ql,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useLayoutEffect:He,useInsertionEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useSyncExternalStore:He,useId:He,useHostTransitionStatus:He,useFormState:He,useActionState:He,useOptimistic:He,useMemoCache:He,useCacheRefresh:He};wo.useEffectEvent=He;var Jf={readContext:je,use:ql,useCallback:function(e,n){return lt().memoizedState=[e,n===void 0?null:n],e},useContext:je,useEffect:If,useImperativeHandle:function(e,n,o){o=o!=null?o.concat([e]):null,zl(4194308,4,Uf.bind(null,n,e),o)},useLayoutEffect:function(e,n){return zl(4194308,4,e,n)},useInsertionEffect:function(e,n){zl(4,2,e,n)},useMemo:function(e,n){var o=lt();n=n===void 0?null:n;var s=e();if(li){yn(!0);try{e()}finally{yn(!1)}}return o.memoizedState=[s,n],s},useReducer:function(e,n,o){var s=lt();if(o!==void 0){var d=o(n);if(li){yn(!0);try{o(n)}finally{yn(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=Zy.bind(null,se,e),[s.memoizedState,e]},useRef:function(e){var n=lt();return e={current:e},n.memoizedState=e},useState:function(e){e=$s(e);var n=e.queue,o=kf.bind(null,se,n);return n.dispatch=o,[e.memoizedState,o]},useDebugValue:er,useDeferredValue:function(e,n){var o=lt();return tr(o,e,n)},useTransition:function(){var e=$s(!1);return e=qf.bind(null,se,e.queue,!0,!1),lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,o){var s=se,d=lt();if(ge){if(o===void 0)throw Error(a(407));o=o()}else{if(o=n(),we===null)throw Error(a(349));(pe&127)!==0||df(s,n,o)}d.memoizedState=o;var p={value:o,getSnapshot:n};return d.queue=p,If(mf.bind(null,s,p,e),[e]),s.flags|=2048,Hi(9,{destroy:void 0},pf.bind(null,s,p,o,n),null),o},useId:function(){var e=lt(),n=we.identifierPrefix;if(ge){var o=Jt,s=Ft;o=(s&~(1<<32-vt(s)-1)).toString(32)+o,n="_"+n+"R_"+o,o=Gl++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?T.createElement("select",{is:s.is}):T.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?T.createElement(d,{is:s.is}):T.createElement(d)}}p[$e]=n,p[ut]=s;e:for(T=n.child;T!==null;){if(T.tag===5||T.tag===6)p.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===n)break e;for(;T.sibling===null;){if(T.return===null||T.return===n)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}n.stateNode=p;e:switch(tt(p,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&an(n)}}return be(n),vr(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,o),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&an(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(a(166));if(e=ue.current,Ni(n)){if(e=n.stateNode,o=n.memoizedProps,s=null,d=We,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[$e]=n,e=!!(e.nodeValue===o||s!==null&&s.suppressHydrationWarning===!0||cp(e.nodeValue,o)),e||_n(n,!0)}else e=sa(e).createTextNode(s),e[$e]=n,n.stateNode=e}return be(n),null;case 31:if(o=n.memoizedState,e===null||e.memoizedState!==null){if(s=Ni(n),o!==null){if(e===null){if(!s)throw Error(a(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[$e]=n}else Wn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;be(n),e=!1}else o=Is(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),e=!0;if(!e)return n.flags&256?(_t(n),n):(_t(n),null);if((n.flags&128)!==0)throw Error(a(558))}return be(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Ni(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(a(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));d[$e]=n}else Wn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;be(n),d=!1}else d=Is(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(_t(n),n):(_t(n),null)}return _t(n),(n.flags&128)!==0?(n.lanes=o,n):(o=s!==null,e=e!==null&&e.memoizedState!==null,o&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==d&&(s.flags|=2048)),o!==e&&o&&(n.child.flags|=8192),Yl(n,n.updateQueue),be(n),null);case 4:return Ve(),e===null&&Br(n.stateNode.containerInfo),be(n),null;case 10:return tn(n.type),be(n),null;case 19:if(z(ze),s=n.memoizedState,s===null)return be(n),null;if(d=(n.flags&128)!==0,p=s.rendering,p===null)if(d)bo(s,!1);else{if(qe!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=bl(e),p!==null){for(n.flags|=128,bo(s,!1),e=p.updateQueue,n.updateQueue=e,Yl(n,e),n.subtreeFlags=0,e=o,o=n.child;o!==null;)Pc(o,e),o=o.sibling;return J(ze,ze.current&1|2),ge&&jt(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&>()>$l&&(n.flags|=128,d=!0,bo(s,!1),n.lanes=4194304)}else{if(!d)if(e=bl(p),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,Yl(n,e),bo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ge)return be(n),null}else 2*gt()-s.renderingStartTime>$l&&o!==536870912&&(n.flags|=128,d=!0,bo(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=gt(),e.sibling=null,o=ze.current,J(ze,d?o&1|2:o&1),ge&&jt(n,s.treeForkCount),e):(be(n),null);case 22:case 23:return _t(n),Ps(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(o&536870912)!==0&&(n.flags&128)===0&&(be(n),n.subtreeFlags&6&&(n.flags|=8192)):be(n),o=n.updateQueue,o!==null&&Yl(n,o.retryQueue),o=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(o=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==o&&(n.flags|=2048),e!==null&&z(ti),null;case 24:return o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),tn(ke),be(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function tv(e,n){switch(Ms(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return tn(ke),Ve(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return il(n),null;case 31:if(n.memoizedState!==null){if(_t(n),n.alternate===null)throw Error(a(340));Wn()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(_t(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(a(340));Wn()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return z(ze),null;case 4:return Ve(),null;case 10:return tn(n.type),null;case 22:case 23:return _t(n),Ps(),e!==null&&z(ti),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return tn(ke),null;case 25:return null;default:return null}}function hd(e,n){switch(Ms(n),n.tag){case 3:tn(ke),Ve();break;case 26:case 27:case 5:il(n);break;case 4:Ve();break;case 31:n.memoizedState!==null&&_t(n);break;case 13:_t(n);break;case 19:z(ze);break;case 10:tn(n.type);break;case 22:case 23:_t(n),Ps(),e!==null&&z(ti);break;case 24:tn(ke)}}function Lo(e,n){try{var o=n.updateQueue,s=o!==null?o.lastEffect:null;if(s!==null){var d=s.next;o=d;do{if((o.tag&e)===e){s=void 0;var p=o.create,T=o.inst;s=p(),T.destroy=s}o=o.next}while(o!==d)}}catch(_){Re(n,n.return,_)}}function xn(e,n,o){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var p=d.next;s=p;do{if((s.tag&e)===e){var T=s.inst,_=T.destroy;if(_!==void 0){T.destroy=void 0,d=n;var A=o,x=_;try{x()}catch(G){Re(d,A,G)}}}s=s.next}while(s!==p)}}catch(G){Re(n,n.return,G)}}function gd(e){var n=e.updateQueue;if(n!==null){var o=e.stateNode;try{af(n,o)}catch(s){Re(e,e.return,s)}}}function yd(e,n,o){o.props=ai(e.type,e.memoizedProps),o.state=e.memoizedState;try{o.componentWillUnmount()}catch(s){Re(e,n,s)}}function Go(e,n){try{var o=e.ref;if(o!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof o=="function"?e.refCleanup=o(s):o.current=s}}catch(d){Re(e,n,d)}}function Yt(e,n){var o=e.ref,s=e.refCleanup;if(o!==null)if(typeof s=="function")try{s()}catch(d){Re(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(d){Re(e,n,d)}else o.current=null}function vd(e){var n=e.type,o=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":o.autoFocus&&s.focus();break e;case"img":o.src?s.src=o.src:o.srcSet&&(s.srcset=o.srcSet)}}catch(d){Re(e,e.return,d)}}function Tr(e,n,o){try{var s=e.stateNode;Cv(s,e.type,o,n),s[ut]=n}catch(d){Re(e,e.return,d)}}function Td(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Hn(e.type)||e.tag===4}function Sr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Td(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Hn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Er(e,n,o){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(e,n):(n=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,n.appendChild(e),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=Zt));else if(s!==4&&(s===27&&Hn(e.type)&&(o=e.stateNode,n=null),e=e.child,e!==null))for(Er(e,n,o),e=e.sibling;e!==null;)Er(e,n,o),e=e.sibling}function Xl(e,n,o){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?o.insertBefore(e,n):o.appendChild(e);else if(s!==4&&(s===27&&Hn(e.type)&&(o=e.stateNode),e=e.child,e!==null))for(Xl(e,n,o),e=e.sibling;e!==null;)Xl(e,n,o),e=e.sibling}function Sd(e){var n=e.stateNode,o=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);tt(n,s,o),n[$e]=e,n[ut]=o}catch(p){Re(e,e.return,p)}}var sn=!1,Je=!1,_r=!1,Ed=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function nv(e,n){if(e=e.containerInfo,Or=ma,e=Uc(e),hs(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var s=o.getSelection&&o.getSelection();if(s&&s.rangeCount!==0){o=s.anchorNode;var d=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var T=0,_=-1,A=-1,x=0,G=0,V=e,D=null;t:for(;;){for(var U;V!==o||d!==0&&V.nodeType!==3||(_=T+d),V!==p||s!==0&&V.nodeType!==3||(A=T+s),V.nodeType===3&&(T+=V.nodeValue.length),(U=V.firstChild)!==null;)D=V,V=U;for(;;){if(V===e)break t;if(D===o&&++x===d&&(_=T),D===p&&++G===s&&(A=T),(U=V.nextSibling)!==null)break;V=D,D=V.parentNode}V=U}o=_===-1||A===-1?null:{start:_,end:A}}else o=null}o=o||{start:0,end:0}}else o=null;for(Fr={focusedElem:e,selectionRange:o},ma=!1,Ke=n;Ke!==null;)if(n=Ke,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ke=e;else for(;Ke!==null;){switch(n=Ke,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(o=0;o title"))),tt(p,s,o),p[$e]=e,Xe(p),s=p;break e;case"link":var T=Np("link","href",d).get(s+(o.href||""));if(T){for(var _=0;_xe&&(T=xe,xe=ne,ne=T);var N=Dc(_,ne),R=Dc(_,xe);if(N&&R&&(U.rangeCount!==1||U.anchorNode!==N.node||U.anchorOffset!==N.offset||U.focusNode!==R.node||U.focusOffset!==R.offset)){var I=V.createRange();I.setStart(N.node,N.offset),U.removeAllRanges(),ne>xe?(U.addRange(I),U.extend(R.node,R.offset)):(I.setEnd(R.node,R.offset),U.addRange(I))}}}}for(V=[],U=_;U=U.parentNode;)U.nodeType===1&&V.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_o?32:o,L.T=null,o=xr,xr=null;var p=bn,T=dn;if(Ye=0,Pi=bn=null,dn=0,(Se&6)!==0)throw Error(a(331));var _=Se;if(Se|=4,Ud(p.current),xd(p,p.current,T,o),Se=_,Po(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(oo,p)}catch{}return!0}finally{O.p=d,L.T=s,Zd(e,n)}}function Wd(e,n,o){n=xt(o,n),n=rr(e.stateNode,n,2),e=Mn(e,n,2),e!==null&&(ao(e,2),Xt(e))}function Re(e,n,o){if(e.tag===3)Wd(e,e,o);else for(;n!==null;){if(n.tag===3){Wd(n,e,o);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Un===null||!Un.has(s))){e=xt(o,e),o=jf(2),s=Mn(n,o,2),s!==null&&(ed(o,s,n,e),ao(s,2),Xt(s));break}}n=n.return}}function br(e,n,o){var s=e.pingCache;if(s===null){s=e.pingCache=new lv;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(o)||(Rr=!0,d.add(o),e=cv.bind(null,e,n,o),n.then(e,e))}function cv(e,n,o){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&o,e.warmLanes&=~o,we===e&&(pe&o)===o&&(qe===4||qe===3&&(pe&62914560)===pe&&300>gt()-Zl?(Se&2)===0&&ki(e,0):Mr|=o,Bi===pe&&(Bi=0)),Xt(e)}function jd(e,n){n===0&&(n=Yu()),e=Zn(e,n),e!==null&&(ao(e,n),Xt(e))}function fv(e){var n=e.memoizedState,o=0;n!==null&&(o=n.retryLane),jd(e,o)}function dv(e,n){var o=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(o=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(a(314))}s!==null&&s.delete(n),jd(e,o)}function pv(e,n){return Ya(e,n)}var ia=null,Fi=null,Lr=!1,oa=!1,Gr=!1,Gn=0;function Xt(e){e!==Fi&&e.next===null&&(Fi===null?ia=Fi=e:Fi=Fi.next=e),oa=!0,Lr||(Lr=!0,hv())}function Po(e,n){if(!Gr&&oa){Gr=!0;do for(var o=!1,s=ia;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var p=0;else{var T=s.suspendedLanes,_=s.pingedLanes;p=(1<<31-vt(42|e)+1)-1,p&=d&~(T&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(o=!0,ip(s,p))}else p=pe,p=rl(s,s===we?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||lo(s,p)||(o=!0,ip(s,p));s=s.next}while(o);Gr=!1}}function mv(){ep()}function ep(){oa=Lr=!1;var e=0;Gn!==0&&Rv()&&(e=Gn);for(var n=gt(),o=null,s=ia;s!==null;){var d=s.next,p=tp(s,n);p===0?(s.next=null,o===null?ia=d:o.next=d,d===null&&(Fi=o)):(o=s,(e!==0||(p&3)!==0)&&(oa=!0)),s=d}Ye!==0&&Ye!==5||Po(e),Gn!==0&&(Gn=0)}function tp(e,n){for(var o=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes&-62914561;0_)break;var G=A.transferSize,V=A.initiatorType;G&&fp(V)&&(A=A.responseEnd,T+=G*(A<_?1:(_-x)/(A-x)))}if(--s,n+=8*(p+T)/(d.duration/1e3),e++,10"u"?null:document;function Cp(e,n,o){var s=Ji;if(s&&typeof n=="string"&&n){var d=Nt(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof o=="string"&&(d+='[crossorigin="'+o+'"]'),_p.has(d)||(_p.add(d),e={rel:e,crossOrigin:o,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),tt(n,"link",e),Xe(n),s.head.appendChild(n)))}}function Lv(e){pn.D(e),Cp("dns-prefetch",e,null)}function Gv(e,n){pn.C(e,n),Cp("preconnect",e,n)}function Hv(e,n,o){pn.L(e,n,o);var s=Ji;if(s&&e&&n){var d='link[rel="preload"][as="'+Nt(n)+'"]';n==="image"&&o&&o.imageSrcSet?(d+='[imagesrcset="'+Nt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(d+='[imagesizes="'+Nt(o.imageSizes)+'"]')):d+='[href="'+Nt(e)+'"]';var p=d;switch(n){case"style":p=Yi(e);break;case"script":p=Xi(e)}Gt.has(p)||(e=S({rel:"preload",href:n==="image"&&o&&o.imageSrcSet?void 0:e,as:n},o),Gt.set(p,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Jo(p))||n==="script"&&s.querySelector(Yo(p))||(n=s.createElement("link"),tt(n,"link",e),Xe(n),s.head.appendChild(n)))}}function qv(e,n){pn.m(e,n);var o=Ji;if(o&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+Nt(s)+'"][href="'+Nt(e)+'"]',p=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Xi(e)}if(!Gt.has(p)&&(e=S({rel:"modulepreload",href:e},n),Gt.set(p,e),o.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Yo(p)))return}s=o.createElement("link"),tt(s,"link",e),Xe(s),o.head.appendChild(s)}}}function Vv(e,n,o){pn.S(e,n,o);var s=Ji;if(s&&e){var d=mi(s).hoistableStyles,p=Yi(e);n=n||"default";var T=d.get(p);if(!T){var _={loading:0,preload:null};if(T=s.querySelector(Jo(p)))_.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":n},o),(o=Gt.get(p))&&$r(e,o);var A=T=s.createElement("link");Xe(A),tt(A,"link",e),A._p=new Promise(function(x,G){A.onload=x,A.onerror=G}),A.addEventListener("load",function(){_.loading|=1}),A.addEventListener("error",function(){_.loading|=2}),_.loading|=4,ua(T,n,s)}T={type:"stylesheet",instance:T,count:1,state:_},d.set(p,T)}}}function zv(e,n){pn.X(e,n);var o=Ji;if(o&&e){var s=mi(o).hoistableScripts,d=Xi(e),p=s.get(d);p||(p=o.querySelector(Yo(d)),p||(e=S({src:e,async:!0},n),(n=Gt.get(d))&&Wr(e,n),p=o.createElement("script"),Xe(p),tt(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Bv(e,n){pn.M(e,n);var o=Ji;if(o&&e){var s=mi(o).hoistableScripts,d=Xi(e),p=s.get(d);p||(p=o.querySelector(Yo(d)),p||(e=S({src:e,async:!0,type:"module"},n),(n=Gt.get(d))&&Wr(e,n),p=o.createElement("script"),Xe(p),tt(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Ap(e,n,o,s){var d=(d=ue.current)?ra(d):null;if(!d)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(n=Yi(o.href),o=mi(d).hoistableStyles,s=o.get(n),s||(s={type:"style",instance:null,count:0,state:null},o.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){e=Yi(o.href);var p=mi(d).hoistableStyles,T=p.get(e);if(T||(d=d.ownerDocument||d,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,T),(p=d.querySelector(Jo(e)))&&!p._p&&(T.instance=p,T.state.loading=5),Gt.has(e)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Gt.set(e,o),p||Pv(d,e,o,T.state))),n&&s===null)throw Error(a(528,""));return T}if(n&&s!==null)throw Error(a(529,""));return null;case"script":return n=o.async,o=o.src,typeof o=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Xi(o),o=mi(d).hoistableScripts,s=o.get(n),s||(s={type:"script",instance:null,count:0,state:null},o.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Yi(e){return'href="'+Nt(e)+'"'}function Jo(e){return'link[rel="stylesheet"]['+e+"]"}function Rp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Pv(e,n,o,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),tt(n,"link",o),Xe(n),e.head.appendChild(n))}function Xi(e){return'[src="'+Nt(e)+'"]'}function Yo(e){return"script[async]"+e}function Mp(e,n,o){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Nt(o.href)+'"]');if(s)return n.instance=s,Xe(s),s;var d=S({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Xe(s),tt(s,"style",d),ua(s,o.precedence,e),n.instance=s;case"stylesheet":d=Yi(o.href);var p=e.querySelector(Jo(d));if(p)return n.state.loading|=4,n.instance=p,Xe(p),p;s=Rp(o),(d=Gt.get(d))&&$r(s,d),p=(e.ownerDocument||e).createElement("link"),Xe(p);var T=p;return T._p=new Promise(function(_,A){T.onload=_,T.onerror=A}),tt(p,"link",s),n.state.loading|=4,ua(p,o.precedence,e),n.instance=p;case"script":return p=Xi(o.src),(d=e.querySelector(Yo(p)))?(n.instance=d,Xe(d),d):(s=o,(d=Gt.get(p))&&(s=S({},o),Wr(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),Xe(d),tt(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,ua(s,o.precedence,e));return n.instance}function ua(e,n,o){for(var s=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,p=d,T=0;T title"):null)}function kv(e,n,o){if(o===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ov(e,n,o,s){if(o.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var d=Yi(s.href),p=n.querySelector(Jo(d));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=fa.bind(e),n.then(e,e)),o.state.loading|=4,o.instance=p,Xe(p);return}p=n.ownerDocument||n,s=Rp(s),(d=Gt.get(d))&&$r(s,d),p=p.createElement("link"),Xe(p);var T=p;T._p=new Promise(function(_,A){T.onload=_,T.onerror=A}),tt(p,"link",s),o.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(o,n),(n=o.state.preload)&&(o.state.loading&3)===0&&(e.count++,o=fa.bind(e),n.addEventListener("load",o),n.addEventListener("error",o))}}var jr=0;function Fv(e,n){return e.stylesheets&&e.count===0&&pa(e,e.stylesheets),0jr?50:800)+n);return e.unsuspend=o,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function fa(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)pa(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var da=null;function pa(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,da=new Map,n.forEach(Jv,e),da=null,fa.call(e))}function Jv(e,n){if(!(n.state.loading&4)){var o=da.get(e);if(o)var s=o.get(null);else{o=new Map,da.set(e,o);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),ru.exports=r0(),ru.exports}var c0=u0();const f0=Lh(c0),jp=({children:i})=>B.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-start pt-8 pb-8 px-4 sm:px-6 max-w-md mx-auto w-full relative",children:[B.jsxs("div",{className:"fixed top-0 left-0 w-full h-full overflow-hidden pointer-events-none -z-10",children:[B.jsx("div",{className:"absolute top-10 right-10 w-20 h-20 border-4 border-white/20 rounded-full animate-float"}),B.jsx("div",{className:"absolute bottom-20 left-10 w-16 h-16 bg-brand-yellow/20 rounded-full blur-xl animate-pulse"})]}),B.jsxs("header",{className:"w-full flex flex-col items-center mb-6 text-center relative z-20",children:[B.jsx("div",{className:"inline-block bg-white text-brand-red px-3 py-1 rounded-full text-xs font-bold mb-3 shadow-lg transform -rotate-2",children:"🎵 歌词灵感 · 现场征集"}),B.jsxs("h1",{className:"text-4xl font-black italic tracking-tighter text-white drop-shadow-lg mb-2 transform -skew-x-3",children:["一起做首",B.jsx("br",{}),B.jsx("span",{className:"text-5xl",children:"我们的歌"})]}),B.jsxs("div",{className:"mt-6 space-y-1",children:[B.jsx("p",{className:"text-lg font-bold text-white border-b-2 border-white/30 inline-block pb-1",children:"门槛不高,不需要懂音乐"}),B.jsx("p",{className:"text-sm opacity-90",children:"聊聊咱们的故事,将灵感汇聚成歌"})]})]}),B.jsx("main",{className:"w-full bg-white rounded-3xl p-6 shadow-xl relative overflow-hidden text-gray-800",children:i}),B.jsxs("footer",{className:"mt-8 text-[10px] text-white/60 text-center uppercase tracking-wider",children:[B.jsx("p",{className:"mb-1",children:"朴见潮音"}),B.jsx("p",{children:"© 2025 COMMUNE Music Co-creation"})]})]});/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),p0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,l,a)=>a?a.toUpperCase():l.toLowerCase()),em=i=>{const t=p0(i);return t.charAt(0).toUpperCase()+t.slice(1)},Gh=(...i)=>i.filter((t,l,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===l).join(" ").trim(),m0=i=>{for(const t in i)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var h0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g0=Qe.forwardRef(({color:i="currentColor",size:t=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:r="",children:f,iconNode:m,...g},y)=>Qe.createElement("svg",{ref:y,...h0,width:t,height:t,stroke:i,strokeWidth:a?Number(l)*24/Number(t):l,className:Gh("lucide",r),...!f&&!m0(g)&&{"aria-hidden":"true"},...g},[...m.map(([h,v])=>Qe.createElement(h,v)),...Array.isArray(f)?f:[f]]));/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kt=(i,t)=>{const l=Qe.forwardRef(({className:a,...r},f)=>Qe.createElement(g0,{ref:f,iconNode:t,className:Gh(`lucide-${d0(em(i))}`,`lucide-${i}`,a),...r}));return l.displayName=em(i),l};/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],v0=Kt("arrow-right",y0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],S0=Kt("circle-check",T0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E0=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],_0=Kt("coffee",E0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Hh=Kt("loader-circle",C0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A0=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],R0=Kt("quote",A0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],N0=Kt("refresh-cw",M0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],x0=Kt("send",I0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D0=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],w0=Kt("smartphone",D0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U0=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],qh=Kt("sparkles",U0);/** + * @license lucide-react v0.561.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],L0=Kt("user",b0),du="ai_song_fest_user",pu="ai_song_fest_songs",G0=/^1[3-9]\d{9}$/,nl={login:async i=>{if(await new Promise(a=>setTimeout(a,800)),!G0.test(i))return{success:!1,error:"手机号格式不正确"};const t=`tk_${i}_${Date.now().toString(36)}`,l={phone:i,token:t};return localStorage.setItem(du,JSON.stringify(l)),{success:!0,token:t}},getCurrentUser:()=>{const i=localStorage.getItem(du);return i?JSON.parse(i):null},logout:()=>{localStorage.removeItem(du)},fetchServerToken:async()=>{const i=await fetch("https://form.x-php.com/api/getToken/i4WPLHbWCq9G",{method:"GET"}),t=await i.text();if(i.status!==200){let a="";try{a=JSON.parse(t||"{}").message||""}catch{}throw new Error(a||`获取 token 失败(状态码 ${i.status})`)}let l="";try{const a=JSON.parse(t||"{}");if(a.code===200&&a.data&&typeof a.data.token=="string")l=a.data.token;else throw new Error(a.message||"获取 token 失败(返回码非 200)")}catch(a){if(l)return localStorage.setItem("server_submit_token",l),l;const r=a;throw new Error(r.message||"获取 token 失败")}return localStorage.setItem("server_submit_token",l),l}},Ea={getSongByPhone:async i=>(await new Promise(l=>setTimeout(l,300)),JSON.parse(localStorage.getItem(pu)||"{}")[i]||null),submitSong:async(i,t)=>{const l=localStorage.getItem("server_submit_token"),a=nl.getCurrentUser(),f={token:l||(a==null?void 0:a.token)||"",data:{mobile:i,nickname:t.nickname||"",style:t.style||"",title:t.title||"",lyrics:t.lyrics||""}},m=await fetch("https://form.x-php.com/api/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});let g="";try{g=await m.text()}catch{}const y=JSON.parse(g||"{}");if(y.code!==200){const E=y.message||"";throw new Error(E||`提交失败(状态码 ${y.code})`)}const h=`TKT-${y.data.useruniqid}`,v={id:Date.now().toString(36),phone:i,title:t.title,lyrics:t.lyrics,style:t.style,nickname:t.nickname,status:"submitted",ticketNumber:h,createdAt:Date.now()},S=JSON.parse(localStorage.getItem(pu)||"{}");return S[i]=v,localStorage.setItem(pu,JSON.stringify(S)),v}},H0=({onLoginSuccess:i})=>{const[t,l]=Qe.useState(""),[a,r]=Qe.useState(!1),[f,m]=Qe.useState(""),g=async y=>{y.preventDefault(),r(!0),m("");try{const h=await nl.login(t);h.success?i():m(h.error||"验证失败")}catch{m("发生未知错误")}finally{r(!1)}};return B.jsxs("div",{className:"space-y-8 py-2",children:[B.jsxs("div",{className:"text-center space-y-2",children:[B.jsx("h2",{className:"text-2xl font-black text-brand-dark tracking-wide",children:"欢迎加入共创"}),B.jsx("p",{className:"text-gray-500 text-sm",children:"输入手机号,开始分享你的故事"})]}),B.jsxs("form",{onSubmit:g,className:"space-y-6",children:[B.jsxs("div",{className:"group",children:[B.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-2 uppercase tracking-wider ml-1",children:"手机号码"}),B.jsxs("div",{className:"relative transition-transform duration-300 focus-within:scale-[1.02]",children:[B.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-12 flex items-center justify-center text-gray-400 group-focus-within:text-brand-orange transition-colors",children:B.jsx(w0,{className:"w-5 h-5"})}),B.jsx("input",{type:"tel",value:t,onChange:y=>l(y.target.value),placeholder:"138 0000 0000",className:"w-full bg-gray-50 border border-gray-200 rounded-xl py-4 pl-12 pr-4 text-gray-800 placeholder-gray-400 focus:outline-none focus:border-brand-orange focus:ring-1 focus:ring-brand-orange transition-all font-mono text-lg",required:!0})]})]}),f&&B.jsxs("div",{className:"p-3 rounded-lg bg-red-50 border border-red-100 text-red-500 text-sm flex items-center gap-2 animate-pulse",children:[B.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),f]}),B.jsx("button",{type:"submit",disabled:a,className:"w-full bg-gradient-to-r from-brand-orange to-brand-red hover:shadow-lg hover:shadow-brand-orange/30 disabled:opacity-50 text-white font-bold py-4 rounded-xl transition-all transform active:scale-95 flex items-center justify-center gap-2",children:a?B.jsx(Hh,{className:"w-5 h-5 animate-spin"}):B.jsxs(B.Fragment,{children:["验证并开始 ",B.jsx(v0,{className:"w-5 h-5"})]})})]}),B.jsx("div",{className:"text-[10px] text-center text-gray-400 pt-4"})]})};var q0={};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */let V0,z0;function B0(){return{geminiUrl:V0,vertexUrl:z0}}function P0(i,t,l,a){var r,f;if(!(i!=null&&i.baseUrl)){const m=B0();return t?(r=m.vertexUrl)!==null&&r!==void 0?r:l:(f=m.geminiUrl)!==null&&f!==void 0?f:a}return i.baseUrl}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class hn{}function Y(i,t){const l=/\{([^}]+)\}/g;return i.replace(l,(a,r)=>{if(Object.prototype.hasOwnProperty.call(t,r)){const f=t[r];return f!=null?String(f):""}else throw new Error(`Key '${r}' not found in valueMap.`)})}function c(i,t,l){for(let f=0;f({}));else throw new Error(`Value must be a list given an array path ${m}`);if(Array.isArray(i[g])){const y=i[g];if(Array.isArray(l))for(let h=0;hu(g,t.slice(a+1),l)):l}else return l}else i=i[r]}return i}catch(a){if(a instanceof TypeError)return l;throw a}}function k0(i,t){for(const[l,a]of Object.entries(t)){const r=l.split("."),f=a.split("."),m=new Set;let g=-1;for(let y=0;yg)for(let y=g;y=t.length||typeof i!="object"||i===null)return;const f=t[a];if(f.endsWith("[]")){const m=f.slice(0,-2),g=i;if(m in g&&Array.isArray(g[m]))for(const y of g[m])gu(y,t,l,a+1,r)}else if(f==="*"){if(typeof i=="object"&&i!==null&&!Array.isArray(i)){const m=i,g=Object.keys(m).filter(h=>!h.startsWith("_")&&!r.has(h)),y={};for(const h of g)y[h]=m[h];for(const[h,v]of Object.entries(y)){const S=[];for(const E of l.slice(a))E==="*"?S.push(h):S.push(E);c(m,S,v)}for(const h of g)delete m[h]}}else{const m=i;f in m&&gu(m[f],t,l,a+1,r)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function wu(i){if(typeof i!="string")throw new Error("fromImageBytes must be a string");return i}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function O0(i){const t={},l=u(i,["operationName"]);l!=null&&c(t,["operationName"],l);const a=u(i,["resourceName"]);return a!=null&&c(t,["_url","resourceName"],a),t}function F0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response","generateVideoResponse"]);return m!=null&&c(t,["response"],Y0(m)),t}function J0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],X0(m)),t}function Y0(i){const t={},l=u(i,["generatedSamples"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>K0(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function X0(i){const t={},l=u(i,["videos"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>Q0(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function K0(i){const t={},l=u(i,["video"]);return l!=null&&c(t,["video"],tT(l)),t}function Q0(i){const t={},l=u(i,["_self"]);return l!=null&&c(t,["video"],nT(l)),t}function Z0(i){const t={},l=u(i,["operationName"]);return l!=null&&c(t,["_url","operationName"],l),t}function $0(i){const t={},l=u(i,["operationName"]);return l!=null&&c(t,["_url","operationName"],l),t}function W0(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],j0(m)),t}function j0(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function Vh(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],eT(m)),t}function eT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function tT(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],wu(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function nT(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["uri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],wu(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var tm;(function(i){i.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",i.OUTCOME_OK="OUTCOME_OK",i.OUTCOME_FAILED="OUTCOME_FAILED",i.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(tm||(tm={}));var nm;(function(i){i.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",i.PYTHON="PYTHON"})(nm||(nm={}));var im;(function(i){i.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",i.SILENT="SILENT",i.WHEN_IDLE="WHEN_IDLE",i.INTERRUPT="INTERRUPT"})(im||(im={}));var kn;(function(i){i.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",i.STRING="STRING",i.NUMBER="NUMBER",i.INTEGER="INTEGER",i.BOOLEAN="BOOLEAN",i.ARRAY="ARRAY",i.OBJECT="OBJECT",i.NULL="NULL"})(kn||(kn={}));var om;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(om||(om={}));var lm;(function(i){i.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",i.SIMPLE_SEARCH="SIMPLE_SEARCH",i.ELASTIC_SEARCH="ELASTIC_SEARCH"})(lm||(lm={}));var am;(function(i){i.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",i.NO_AUTH="NO_AUTH",i.API_KEY_AUTH="API_KEY_AUTH",i.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",i.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",i.OAUTH="OAUTH",i.OIDC_AUTH="OIDC_AUTH"})(am||(am={}));var sm;(function(i){i.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",i.HTTP_IN_QUERY="HTTP_IN_QUERY",i.HTTP_IN_HEADER="HTTP_IN_HEADER",i.HTTP_IN_PATH="HTTP_IN_PATH",i.HTTP_IN_BODY="HTTP_IN_BODY",i.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(sm||(sm={}));var rm;(function(i){i.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",i.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",i.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",i.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(rm||(rm={}));var um;(function(i){i.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH",i.MINIMAL="MINIMAL"})(um||(um={}));var cm;(function(i){i.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",i.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",i.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",i.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",i.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",i.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",i.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",i.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",i.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(cm||(cm={}));var fm;(function(i){i.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",i.SEVERITY="SEVERITY",i.PROBABILITY="PROBABILITY"})(fm||(fm={}));var dm;(function(i){i.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE",i.OFF="OFF"})(dm||(dm={}));var pm;(function(i){i.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",i.STOP="STOP",i.MAX_TOKENS="MAX_TOKENS",i.SAFETY="SAFETY",i.RECITATION="RECITATION",i.LANGUAGE="LANGUAGE",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.SPII="SPII",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.IMAGE_SAFETY="IMAGE_SAFETY",i.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",i.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",i.NO_IMAGE="NO_IMAGE",i.IMAGE_RECITATION="IMAGE_RECITATION",i.IMAGE_OTHER="IMAGE_OTHER"})(pm||(pm={}));var mm;(function(i){i.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",i.NEGLIGIBLE="NEGLIGIBLE",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH"})(mm||(mm={}));var hm;(function(i){i.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",i.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",i.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",i.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",i.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(hm||(hm={}));var gm;(function(i){i.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",i.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",i.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",i.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",i.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(gm||(gm={}));var ym;(function(i){i.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",i.SAFETY="SAFETY",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.IMAGE_SAFETY="IMAGE_SAFETY",i.MODEL_ARMOR="MODEL_ARMOR",i.JAILBREAK="JAILBREAK"})(ym||(ym={}));var vm;(function(i){i.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",i.ON_DEMAND="ON_DEMAND",i.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(vm||(vm={}));var xa;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.AUDIO="AUDIO"})(xa||(xa={}));var Tm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(Tm||(Tm={}));var Sm;(function(i){i.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",i.TUNING_MODE_FULL="TUNING_MODE_FULL",i.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(Sm||(Sm={}));var Em;(function(i){i.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",i.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",i.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",i.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",i.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",i.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",i.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(Em||(Em={}));var yu;(function(i){i.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",i.JOB_STATE_QUEUED="JOB_STATE_QUEUED",i.JOB_STATE_PENDING="JOB_STATE_PENDING",i.JOB_STATE_RUNNING="JOB_STATE_RUNNING",i.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",i.JOB_STATE_FAILED="JOB_STATE_FAILED",i.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",i.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",i.JOB_STATE_PAUSED="JOB_STATE_PAUSED",i.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",i.JOB_STATE_UPDATING="JOB_STATE_UPDATING",i.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(yu||(yu={}));var _m;(function(i){i.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",i.TUNING_TASK_I2V="TUNING_TASK_I2V",i.TUNING_TASK_T2V="TUNING_TASK_T2V",i.TUNING_TASK_R2V="TUNING_TASK_R2V"})(_m||(_m={}));var Cm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",i.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(Cm||(Cm={}));var Am;(function(i){i.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",i.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",i.BALANCED="BALANCED",i.PRIORITIZE_COST="PRIORITIZE_COST"})(Am||(Am={}));var Rm;(function(i){i.UNSPECIFIED="UNSPECIFIED",i.BLOCKING="BLOCKING",i.NON_BLOCKING="NON_BLOCKING"})(Rm||(Rm={}));var Mm;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(Mm||(Mm={}));var Nm;(function(i){i.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",i.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(Nm||(Nm={}));var Im;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.AUTO="AUTO",i.ANY="ANY",i.NONE="NONE",i.VALIDATED="VALIDATED"})(Im||(Im={}));var xm;(function(i){i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE"})(xm||(xm={}));var Dm;(function(i){i.DONT_ALLOW="DONT_ALLOW",i.ALLOW_ADULT="ALLOW_ADULT",i.ALLOW_ALL="ALLOW_ALL"})(Dm||(Dm={}));var wm;(function(i){i.auto="auto",i.en="en",i.ja="ja",i.ko="ko",i.hi="hi",i.zh="zh",i.pt="pt",i.es="es"})(wm||(wm={}));var Um;(function(i){i.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",i.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",i.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",i.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",i.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(Um||(Um={}));var bm;(function(i){i.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",i.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",i.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",i.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(bm||(bm={}));var Lm;(function(i){i.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",i.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",i.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",i.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Lm||(Lm={}));var Gm;(function(i){i.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",i.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",i.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",i.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",i.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",i.EDIT_MODE_STYLE="EDIT_MODE_STYLE",i.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",i.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(Gm||(Gm={}));var Hm;(function(i){i.FOREGROUND="FOREGROUND",i.BACKGROUND="BACKGROUND",i.PROMPT="PROMPT",i.SEMANTIC="SEMANTIC",i.INTERACTIVE="INTERACTIVE"})(Hm||(Hm={}));var qm;(function(i){i.ASSET="ASSET",i.STYLE="STYLE"})(qm||(qm={}));var Vm;(function(i){i.INSERT="INSERT",i.REMOVE="REMOVE",i.REMOVE_STATIC="REMOVE_STATIC",i.OUTPAINT="OUTPAINT"})(Vm||(Vm={}));var zm;(function(i){i.OPTIMIZED="OPTIMIZED",i.LOSSLESS="LOSSLESS"})(zm||(zm={}));var Bm;(function(i){i.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",i.PREFERENCE_TUNING="PREFERENCE_TUNING"})(Bm||(Bm={}));var Pm;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.STATE_PENDING="STATE_PENDING",i.STATE_ACTIVE="STATE_ACTIVE",i.STATE_FAILED="STATE_FAILED"})(Pm||(Pm={}));var km;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.PROCESSING="PROCESSING",i.ACTIVE="ACTIVE",i.FAILED="FAILED"})(km||(km={}));var Om;(function(i){i.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",i.UPLOADED="UPLOADED",i.GENERATED="GENERATED"})(Om||(Om={}));var Fm;(function(i){i.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.RESPONSE_REJECTED="RESPONSE_REJECTED",i.NEED_MORE_INPUT="NEED_MORE_INPUT"})(Fm||(Fm={}));var Jm;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.VIDEO="VIDEO",i.AUDIO="AUDIO",i.DOCUMENT="DOCUMENT"})(Jm||(Jm={}));var Ym;(function(i){i.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",i.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",i.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(Ym||(Ym={}));var Xm;(function(i){i.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",i.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",i.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Xm||(Xm={}));var Km;(function(i){i.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",i.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",i.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Km||(Km={}));var Qm;(function(i){i.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",i.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",i.NO_INTERRUPTION="NO_INTERRUPTION"})(Qm||(Qm={}));var Zm;(function(i){i.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",i.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",i.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(Zm||(Zm={}));var $m;(function(i){i.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",i.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",i.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",i.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",i.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",i.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",i.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",i.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",i.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",i.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",i.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",i.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",i.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})($m||($m={}));var Wm;(function(i){i.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",i.QUALITY="QUALITY",i.DIVERSITY="DIVERSITY",i.VOCALIZATION="VOCALIZATION"})(Wm||(Wm={}));var Zi;(function(i){i.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",i.PLAY="PLAY",i.PAUSE="PAUSE",i.STOP="STOP",i.RESET_CONTEXT="RESET_CONTEXT"})(Zi||(Zi={}));class vu{constructor(t){const l={};for(const a of t.headers.entries())l[a[0]]=a[1];this.headers=l,this.responseInternal=t}json(){return this.responseInternal.json()}}class jo{get text(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 h="",v=!1;const S=[];for(const E of(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[C,w]of Object.entries(E))C!=="text"&&C!=="thought"&&C!=="thoughtSignature"&&(w!==null||w!==void 0)&&S.push(C);if(typeof E.text=="string"){if(typeof E.thought=="boolean"&&E.thought)continue;v=!0,h+=E.text}}return S.length>0&&console.warn(`there are non-text parts ${S} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),v?h:void 0}get data(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 h="";const v=[];for(const S of(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[E,C]of Object.entries(S))E!=="inlineData"&&(C!==null||C!==void 0)&&v.push(E);S.inlineData&&typeof S.inlineData.data=="string"&&(h+=atob(S.inlineData.data))}return v.length>0&&console.warn(`there are non-data parts ${v} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),h.length>0?btoa(h):void 0}get functionCalls(){var t,l,a,r,f,m,g,y;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const h=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(v=>v.functionCall).map(v=>v.functionCall).filter(v=>v!==void 0);if((h==null?void 0:h.length)!==0)return h}get executableCode(){var t,l,a,r,f,m,g,y,h;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const v=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(S=>S.executableCode).map(S=>S.executableCode).filter(S=>S!==void 0);if((v==null?void 0:v.length)!==0)return(h=v==null?void 0:v[0])===null||h===void 0?void 0:h.code}get codeExecutionResult(){var t,l,a,r,f,m,g,y,h;if(((r=(a=(l=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||l===void 0?void 0:l.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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.");const v=(y=(g=(m=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(S=>S.codeExecutionResult).map(S=>S.codeExecutionResult).filter(S=>S!==void 0);if((v==null?void 0:v.length)!==0)return(h=v==null?void 0:v[0])===null||h===void 0?void 0:h.output}}class jm{}class eh{}class iT{}class oT{}class lT{}class aT{}class th{}class nh{}class ih{}class sT{}class Da{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new Da;let r;const f=t;return l?r=J0(f):r=F0(f),Object.assign(a,r),a}}class oh{}class lh{}class ah{}class sh{}class rT{}class uT{}class cT{}class Uu{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new Uu,f=W0(t);return Object.assign(a,f),a}}class fT{}class dT{}class pT{}class rh{}class mT{get text(){var t,l,a;let r="",f=!1;const m=[];for(const g of(a=(l=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[y,h]of Object.entries(g))y!=="text"&&y!=="thought"&&h!==null&&m.push(y);if(typeof g.text=="string"){if(typeof g.thought=="boolean"&&g.thought)continue;f=!0,r+=g.text}}return m.length>0&&console.warn(`there are non-text parts ${m} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),f?r:void 0}get data(){var t,l,a;let r="";const f=[];for(const m of(a=(l=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[g,y]of Object.entries(m))g!=="inlineData"&&y!==null&&f.push(g);m.inlineData&&typeof m.inlineData.data=="string"&&(r+=atob(m.inlineData.data))}return f.length>0&&console.warn(`there are non-data parts ${f} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),r.length>0?btoa(r):void 0}}class hT{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class bu{_fromAPIResponse({apiResponse:t,_isVertexAI:l}){const a=new bu,f=Vh(t);return Object.assign(a,f),a}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Te(i,t){if(!t||typeof t!="string")throw new Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw new Error("invalid model parameter");if(i.isVertexAI()){if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;if(t.indexOf("/")>=0){const l=t.split("/",2);return`publishers/${l[0]}/models/${l[1]}`}else return`publishers/google/models/${t}`}else return t.startsWith("models/")||t.startsWith("tunedModels/")?t:`models/${t}`}function zh(i,t){const l=Te(i,t);return l?l.startsWith("publishers/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/${l}`:l.startsWith("models/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/publishers/google/${l}`:l:""}function Bh(i){return Array.isArray(i)?i.map(t=>wa(t)):[wa(i)]}function wa(i){if(typeof i=="object"&&i!==null)return i;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof i}`)}function Ph(i){const t=wa(i);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function kh(i){const t=wa(i);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function uh(i){if(i==null)throw new Error("PartUnion is required");if(typeof i=="object")return i;if(typeof i=="string")return{text:i};throw new Error(`Unsupported part type: ${typeof i}`)}function Oh(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("PartListUnion is required");return Array.isArray(i)?i.map(t=>uh(t)):[uh(i)]}function Tu(i){return i!=null&&typeof i=="object"&&"parts"in i&&Array.isArray(i.parts)}function ch(i){return i!=null&&typeof i=="object"&&"functionCall"in i}function fh(i){return i!=null&&typeof i=="object"&&"functionResponse"in i}function it(i){if(i==null)throw new Error("ContentUnion is required");return Tu(i)?i:{role:"user",parts:Oh(i)}}function Lu(i,t){if(!t)return[];if(i.isVertexAI()&&Array.isArray(t))return t.flatMap(l=>{const a=it(l);return a.parts&&a.parts.length>0&&a.parts[0].text!==void 0?[a.parts[0].text]:[]});if(i.isVertexAI()){const l=it(t);return l.parts&&l.parts.length>0&&l.parts[0].text!==void 0?[l.parts[0].text]:[]}return Array.isArray(t)?t.map(l=>it(l)):[it(t)]}function Ht(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("contents are required");if(!Array.isArray(i)){if(ch(i)||fh(i))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[it(i)]}const t=[],l=[],a=Tu(i[0]);for(const r of i){const f=Tu(r);if(f!=a)throw new Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(f)t.push(r);else{if(ch(r)||fh(r))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");l.push(r)}}return a||t.push({role:"user",parts:Oh(l)}),t}function gT(i,t){i.includes("null")&&(t.nullable=!0);const l=i.filter(a=>a!=="null");if(l.length===1)t.type=Object.values(kn).includes(l[0].toUpperCase())?l[0].toUpperCase():kn.TYPE_UNSPECIFIED;else{t.anyOf=[];for(const a of l)t.anyOf.push({type:Object.values(kn).includes(a.toUpperCase())?a.toUpperCase():kn.TYPE_UNSPECIFIED})}}function Wi(i){const t={},l=["items"],a=["anyOf"],r=["properties"];if(i.type&&i.anyOf)throw new Error("type and anyOf cannot be both populated.");const f=i.anyOf;f!=null&&f.length==2&&(f[0].type==="null"?(t.nullable=!0,i=f[1]):f[1].type==="null"&&(t.nullable=!0,i=f[0])),i.type instanceof Array&&gT(i.type,t);for(const[m,g]of Object.entries(i))if(g!=null)if(m=="type"){if(g==="null")throw new Error("type: null can not be the only possible type for the field.");if(g instanceof Array)continue;t.type=Object.values(kn).includes(g.toUpperCase())?g.toUpperCase():kn.TYPE_UNSPECIFIED}else if(l.includes(m))t[m]=Wi(g);else if(a.includes(m)){const y=[];for(const h of g){if(h.type=="null"){t.nullable=!0;continue}y.push(Wi(h))}t[m]=y}else if(r.includes(m)){const y={};for(const[h,v]of Object.entries(g))y[h]=Wi(v);t[m]=y}else{if(m==="additionalProperties")continue;t[m]=g}return t}function Gu(i){return Wi(i)}function Hu(i){if(typeof i=="object")return i;if(typeof i=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:i}}};throw new Error(`Unsupported speechConfig type: ${typeof i}`)}function qu(i){if("multiSpeakerVoiceConfig"in i)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return i}function eo(i){if(i.functionDeclarations)for(const t of i.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes("$schema")?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=Wi(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=Wi(t.response));return i}function to(i){if(i==null)throw new Error("tools is required");if(!Array.isArray(i))throw new Error("tools is required and must be an array of Tools");const t=[];for(const l of i)t.push(l);return t}function yT(i,t,l,a=1){const r=!t.startsWith(`${l}/`)&&t.split("/").length===a;return i.isVertexAI()?t.startsWith("projects/")?t:t.startsWith("locations/")?`projects/${i.getProject()}/${t}`:t.startsWith(`${l}/`)?`projects/${i.getProject()}/locations/${i.getLocation()}/${t}`:r?`projects/${i.getProject()}/locations/${i.getLocation()}/${l}/${t}`:t:r?`${l}/${t}`:t}function gn(i,t){if(typeof t!="string")throw new Error("name must be a string");return yT(i,t,"cachedContents")}function Fh(i){switch(i){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 i}}function On(i){return wu(i)}function vT(i){return i!=null&&typeof i=="object"&&"name"in i}function TT(i){return i!=null&&typeof i=="object"&&"video"in i}function ST(i){return i!=null&&typeof i=="object"&&"uri"in i}function Jh(i){var t;let l;if(vT(i)&&(l=i.name),!(ST(i)&&(l=i.uri,l===void 0))&&!(TT(i)&&(l=(t=i.video)===null||t===void 0?void 0:t.uri,l===void 0))){if(typeof i=="string"&&(l=i),l===void 0)throw new Error("Could not extract file name from the provided input.");if(l.startsWith("https://")){const r=l.split("files/")[1].match(/[a-z0-9]+/);if(r===null)throw new Error(`Could not extract file name from URI ${l}`);l=r[0]}else l.startsWith("files/")&&(l=l.split("files/")[1]);return l}}function Yh(i,t){let l;return i.isVertexAI()?l=t?"publishers/google/models":"models":l=t?"models":"tunedModels",l}function Xh(i){for(const t of["models","tunedModels","publisherModels"])if(ET(i,t))return i[t];return[]}function ET(i,t){return i!==null&&typeof i=="object"&&t in i}function _T(i,t={}){const l=i,a={name:l.name,description:l.description,parametersJsonSchema:l.inputSchema};return l.outputSchema&&(a.responseJsonSchema=l.outputSchema),t.behavior&&(a.behavior=t.behavior),{functionDeclarations:[a]}}function CT(i,t={}){const l=[],a=new Set;for(const r of i){const f=r.name;if(a.has(f))throw new Error(`Duplicate function name ${f} found in MCP tools. Please ensure function names are unique.`);a.add(f);const m=_T(r,t);m.functionDeclarations&&l.push(...m.functionDeclarations)}return{functionDeclarations:l}}function Kh(i,t){let l;if(typeof t=="string")if(i.isVertexAI())if(t.startsWith("gs://"))l={format:"jsonl",gcsUri:[t]};else if(t.startsWith("bq://"))l={format:"bigquery",bigqueryUri:t};else throw new Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))l={fileName:t};else throw new Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(i.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");l={inlinedRequests:t}}else l=t;const a=[l.gcsUri,l.bigqueryUri].filter(Boolean).length,r=[l.inlinedRequests,l.fileName].filter(Boolean).length;if(i.isVertexAI()){if(r>0||a!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(a>0||r!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return l}function AT(i){if(typeof i!="string")return i;const t=i;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};throw new Error(`Unsupported destination: ${t}`)}function Qh(i){if(typeof i!="object"||i===null)return{};const t=i,l=t.inlinedResponses;if(typeof l!="object"||l===null)return i;const r=l.inlinedResponses;if(!Array.isArray(r)||r.length===0)return i;let f=!1;for(const m of r){if(typeof m!="object"||m===null)continue;const y=m.response;if(typeof y!="object"||y===null)continue;if(y.embedding!==void 0){f=!0;break}}return f&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),i}function no(i,t){const l=t;if(!i.isVertexAI()){if(/batches\/[^/]+$/.test(l))return l.split("/").pop();throw new Error(`Invalid batch job name: ${l}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(l))return l.split("/").pop();if(/^\d+$/.test(l))return l;throw new Error(`Invalid batch job name: ${l}.`)}function Zh(i){const t=i;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}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function RT(i){const t={},l=u(i,["responsesFile"]);l!=null&&c(t,["fileName"],l);const a=u(i,["inlinedResponses","inlinedResponses"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>lS(m))),c(t,["inlinedResponses"],f)}const r=u(i,["inlinedEmbedContentResponses","inlinedResponses"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["inlinedEmbedContentResponses"],f)}return t}function MT(i){const t={},l=u(i,["predictionsFormat"]);l!=null&&c(t,["format"],l);const a=u(i,["gcsDestination","outputUriPrefix"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigqueryDestination","outputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function NT(i){const t={},l=u(i,["format"]);l!=null&&c(t,["predictionsFormat"],l);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsDestination","outputUriPrefix"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigqueryDestination","outputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(u(i,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return t}function Na(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata","displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["metadata","state"]);r!=null&&c(t,["state"],Zh(r));const f=u(i,["metadata","createTime"]);f!=null&&c(t,["createTime"],f);const m=u(i,["metadata","endTime"]);m!=null&&c(t,["endTime"],m);const g=u(i,["metadata","updateTime"]);g!=null&&c(t,["updateTime"],g);const y=u(i,["metadata","model"]);y!=null&&c(t,["model"],y);const h=u(i,["metadata","output"]);return h!=null&&c(t,["dest"],RT(Qh(h))),t}function Su(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["state"]);r!=null&&c(t,["state"],Zh(r));const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["createTime"]);m!=null&&c(t,["createTime"],m);const g=u(i,["startTime"]);g!=null&&c(t,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(t,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(t,["updateTime"],h);const v=u(i,["model"]);v!=null&&c(t,["model"],v);const S=u(i,["inputConfig"]);S!=null&&c(t,["src"],IT(S));const E=u(i,["outputConfig"]);E!=null&&c(t,["dest"],MT(Qh(E)));const C=u(i,["completionStats"]);return C!=null&&c(t,["completionStats"],C),t}function IT(i){const t={},l=u(i,["instancesFormat"]);l!=null&&c(t,["format"],l);const a=u(i,["gcsSource","uris"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigquerySource","inputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function xT(i,t){const l={};if(u(t,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(u(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const a=u(t,["fileName"]);a!=null&&c(l,["fileName"],a);const r=u(t,["inlinedRequests"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>oS(i,m))),c(l,["requests","requests"],f)}return l}function DT(i){const t={},l=u(i,["format"]);l!=null&&c(t,["instancesFormat"],l);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsSource","uris"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigquerySource","inputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return t}function wT(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function UT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function bT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function LT(i){const t={},l=u(i,["content"]);l!=null&&c(t,["content"],l);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],GT(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const m=u(i,["avgLogprobs"]);m!=null&&c(t,["avgLogprobs"],m);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const h=u(i,["logprobsResult"]);h!=null&&c(t,["logprobsResult"],h);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(C=>C)),c(t,["safetyRatings"],E)}const S=u(i,["urlContextMetadata"]);return S!=null&&c(t,["urlContextMetadata"],S),t}function GT(i){const t={},l=u(i,["citationSources"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function $h(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>dS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function HT(i,t){const l={},a=u(i,["displayName"]);if(t!==void 0&&a!=null&&c(t,["batch","displayName"],a),u(i,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return l}function qT(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["dest"]);return t!==void 0&&r!=null&&c(t,["outputConfig"],NT(AT(r))),l}function dh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["batch","inputConfig"],xT(i,Kh(i,r)));const f=u(t,["config"]);return f!=null&&HT(f,l),l}function VT(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["inputConfig"],DT(Kh(i,r)));const f=u(t,["config"]);return f!=null&&qT(f,l),l}function zT(i,t){const l={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["batch","displayName"],a),l}function BT(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["src"]);r!=null&&c(l,["batch","inputConfig"],XT(i,r));const f=u(t,["config"]);return f!=null&&zT(f,l),l}function PT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function kT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function OT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function FT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function JT(i,t){const l={},a=u(t,["contents"]);if(a!=null){let f=Lu(i,a);Array.isArray(f)&&(f=f.map(m=>m)),c(l,["requests[]","request","content"],f)}const r=u(t,["config"]);return r!=null&&(c(l,["_self"],YT(r,l)),k0(l,{"requests[].*":"requests[].request.*"})),l}function YT(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return l}function XT(i,t){const l={},a=u(t,["fileName"]);a!=null&&c(l,["file_name"],a);const r=u(t,["inlinedRequests"]);return r!=null&&c(l,["requests"],JT(i,r)),l}function KT(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function QT(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function ZT(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function $T(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],$h(it(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const w=u(t,["frequencyPenalty"]);w!=null&&c(a,["frequencyPenalty"],w);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);if(X!=null&&c(a,["responseJsonSchema"],X),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const k=u(t,["safetySettings"]);if(l!==void 0&&k!=null){let Ee=k;Array.isArray(Ee)&&(Ee=Ee.map(Pe=>pS(Pe))),c(l,["safetySettings"],Ee)}const K=u(t,["tools"]);if(l!==void 0&&K!=null){let Ee=to(K);Array.isArray(Ee)&&(Ee=Ee.map(Pe=>hS(eo(Pe)))),c(l,["tools"],Ee)}const ee=u(t,["toolConfig"]);if(l!==void 0&&ee!=null&&c(l,["toolConfig"],mS(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const te=u(t,["cachedContent"]);l!==void 0&&te!=null&&c(l,["cachedContent"],gn(i,te));const F=u(t,["responseModalities"]);F!=null&&c(a,["responseModalities"],F);const he=u(t,["mediaResolution"]);he!=null&&c(a,["mediaResolution"],he);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],Hu(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const Ce=u(t,["imageConfig"]);Ce!=null&&c(a,["imageConfig"],iS(Ce));const Ge=u(t,["enableEnhancedCivicAnswers"]);return Ge!=null&&c(a,["enableEnhancedCivicAnswers"],Ge),a}function WT(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(h=>LT(h))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const m=u(i,["responseId"]);m!=null&&c(t,["responseId"],m);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function jT(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function eS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],no(i,a)),l}function tS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function nS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function iS(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function oS(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["request","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let g=Ht(r);Array.isArray(g)&&(g=g.map(y=>$h(y))),c(l,["request","contents"],g)}const f=u(t,["metadata"]);f!=null&&c(l,["metadata"],f);const m=u(t,["config"]);return m!=null&&c(l,["request","generationConfig"],$T(i,m,u(l,["request"],{}))),l}function lS(i){const t={},l=u(i,["response"]);l!=null&&c(t,["response"],WT(l));const a=u(i,["error"]);return a!=null&&c(t,["error"],a),t}function aS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);if(t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),u(i,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return l}function sS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);t!==void 0&&r!=null&&c(t,["_query","pageToken"],r);const f=u(i,["filter"]);return t!==void 0&&f!=null&&c(t,["_query","filter"],f),l}function rS(i){const t={},l=u(i,["config"]);return l!=null&&aS(l,t),t}function uS(i){const t={},l=u(i,["config"]);return l!=null&&sS(l,t),t}function cS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["operations"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>Na(m))),c(t,["batchJobs"],f)}return t}function fS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["batchPredictionJobs"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>Su(m))),c(t,["batchJobs"],f)}return t}function dS(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],KT(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],QT(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],wT(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function pS(i){const t={},l=u(i,["category"]);if(l!=null&&c(t,["category"],l),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function mS(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],ZT(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function hS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],tS(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],nS(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var mn;(function(i){i.PAGED_ITEM_BATCH_JOBS="batchJobs",i.PAGED_ITEM_MODELS="models",i.PAGED_ITEM_TUNING_JOBS="tuningJobs",i.PAGED_ITEM_FILES="files",i.PAGED_ITEM_CACHED_CONTENTS="cachedContents",i.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",i.PAGED_ITEM_DOCUMENTS="documents"})(mn||(mn={}));class ci{constructor(t,l,a,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=l,this.init(t,a,r)}init(t,l,a){var r,f;this.nameInternal=t,this.pageInternal=l[this.nameInternal]||[],this.sdkHttpResponseInternal=l==null?void 0:l.sdkHttpResponse,this.idxInternal=0;let m={config:{}};!a||Object.keys(a).length===0?m={config:{}}:typeof a=="object"?m=Object.assign({},a):m=a,m.config&&(m.config.pageToken=l.nextPageToken),this.paramsInternal=m,this.pageInternalSize=(f=(r=m.config)===null||r===void 0?void 0:r.pageSize)!==null&&f!==void 0?f:this.pageInternal.length}initNextPage(t){this.init(this.nameInternal,t,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(t){return this.pageInternal[t]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const t=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:t,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const t=await this.requestInternal(this.params);return this.initNextPage(t),this.page}hasNextPage(){var t;return((t=this.params.config)===null||t===void 0?void 0:t.pageToken)!==void 0}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class gS extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_BATCH_JOBS,a=>this.listInternal(a),await this.listInternal(l),l),this.create=async l=>(this.apiClient.isVertexAI()&&(l.config=this.formatDestination(l.src,l.config)),this.createInternal(l)),this.createEmbeddings=async l=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(l)}}createInlinedGenerateContentRequest(t){const l=dh(this.apiClient,t),a=l._url,r=Y("{model}:batchGenerateContent",a),g=l.batch.inputConfig.requests,y=g.requests,h=[];for(const v of y){const S=Object.assign({},v);if(S.systemInstruction){const E=S.systemInstruction;delete S.systemInstruction;const C=S.request;C.systemInstruction=E,S.request=C}h.push(S)}return g.requests=h,delete l.config,delete l._url,delete l._query,{path:r,body:l}}getGcsUri(t){if(typeof t=="string")return t.startsWith("gs://")?t:void 0;if(!Array.isArray(t)&&t.gcsUri&&t.gcsUri.length>0)return t.gcsUri[0]}getBigqueryUri(t){if(typeof t=="string")return t.startsWith("bq://")?t:void 0;if(!Array.isArray(t))return t.bigqueryUri}formatDestination(t,l){const a=l?Object.assign({},l):{},r=Date.now().toString();if(a.displayName||(a.displayName=`genaiBatchJob_${r}`),a.dest===void 0){const f=this.getGcsUri(t),m=this.getBigqueryUri(t);if(f)f.endsWith(".jsonl")?a.dest=`${f.slice(0,-6)}/dest`:a.dest=`${f}_dest_${r}`;else if(m)a.dest=`${m}_dest_${r}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return a}async createInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=VT(this.apiClient,t);return g=Y("batchPredictionJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>Su(v))}else{const h=dh(this.apiClient,t);return g=Y("{model}:batchGenerateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Na(v))}}async createEmbeddingsInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=BT(this.apiClient,t);return f=Y("{model}:asyncBatchEmbedContent",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>Na(y))}}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=eS(this.apiClient,t);return g=Y("batchPredictionJobs/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>Su(v))}else{const h=jT(this.apiClient,t);return g=Y("batches/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Na(v))}}async cancel(t){var l,a,r,f;let m="",g={};if(this.apiClient.isVertexAI()){const y=bT(this.apiClient,t);m=Y("batchPredictionJobs/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:m,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}else{const y=UT(this.apiClient,t);m=Y("batches/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:m,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal})}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=uS(t);return g=Y("batchPredictionJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=fS(v),E=new rh;return Object.assign(E,S),E})}else{const h=rS(t);return g=Y("batches",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=cS(v),E=new rh;return Object.assign(E,S),E})}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=kT(this.apiClient,t);return g=Y("batchPredictionJobs/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>FT(v))}else{const h=PT(this.apiClient,t);return g=Y("batches/{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>OT(v))}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function yS(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function ph(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>BS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function vS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const m=u(i,["contents"]);if(t!==void 0&&m!=null){let v=Ht(m);Array.isArray(v)&&(v=v.map(S=>ph(S))),c(t,["contents"],v)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],ph(it(g)));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let v=y;Array.isArray(v)&&(v=v.map(S=>kS(S))),c(t,["tools"],v)}const h=u(i,["toolConfig"]);if(t!==void 0&&h!=null&&c(t,["toolConfig"],PS(h)),u(i,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return l}function TS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const m=u(i,["contents"]);if(t!==void 0&&m!=null){let S=Ht(m);Array.isArray(S)&&(S=S.map(E=>E)),c(t,["contents"],S)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],it(g));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let S=y;Array.isArray(S)&&(S=S.map(E=>OS(E))),c(t,["tools"],S)}const h=u(i,["toolConfig"]);t!==void 0&&h!=null&&c(t,["toolConfig"],h);const v=u(i,["kmsKeyName"]);return t!==void 0&&v!=null&&c(t,["encryption_spec","kmsKeyName"],v),l}function SS(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],zh(i,a));const r=u(t,["config"]);return r!=null&&vS(r,l),l}function ES(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["model"],zh(i,a));const r=u(t,["config"]);return r!=null&&TS(r,l),l}function _S(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function CS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function AS(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function RS(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function MS(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function NS(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function IS(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function xS(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function DS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function wS(i,t){const l={},a=u(t,["name"]);return a!=null&&c(l,["_url","name"],gn(i,a)),l}function US(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function bS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function LS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function GS(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function HS(i){const t={},l=u(i,["config"]);return l!=null&&LS(l,t),t}function qS(i){const t={},l=u(i,["config"]);return l!=null&&GS(l,t),t}function VS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["cachedContents"],f)}return t}function zS(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["cachedContents"],f)}return t}function BS(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],MS(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],NS(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],yS(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function PS(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],IS(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function kS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],US(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],bS(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function OS(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>xS(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function FS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),l}function JS(i,t){const l={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),l}function YS(i,t){const l={},a=u(t,["name"]);a!=null&&c(l,["_url","name"],gn(i,a));const r=u(t,["config"]);return r!=null&&FS(r,l),l}function XS(i,t){const l={},a=u(t,["name"]);a!=null&&c(l,["_url","name"],gn(i,a));const r=u(t,["config"]);return r!=null&&JS(r,l),l}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class KS extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_CACHED_CONTENTS,a=>this.listInternal(a),await this.listInternal(l),l)}async create(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=ES(this.apiClient,t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=SS(this.apiClient,t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=wS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=DS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=CS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=RS(v),E=new ah;return Object.assign(E,S),E})}else{const h=_S(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=AS(v),E=new ah;return Object.assign(E,S),E})}}async update(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=XS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>v)}else{const h=YS(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>v)}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=qS(t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=zS(v),E=new sh;return Object.assign(E,S),E})}else{const h=HS(t);return g=Y("cachedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=VS(v),E=new sh;return Object.assign(E,S),E})}}}function Ua(i,t){var l={};for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&t.indexOf(a)<0&&(l[a]=i[a]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(i);r=i.length&&(i=void 0),{value:i&&i[a++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function oe(i){return this instanceof oe?(this.v=i,this):new oe(i)}function Pt(i,t,l){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=l.apply(i,t||[]),r,f=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),g("next"),g("throw"),g("return",m),r[Symbol.asyncIterator]=function(){return this},r;function m(C){return function(w){return Promise.resolve(w).then(C,S)}}function g(C,w){a[C]&&(r[C]=function(H){return new Promise(function(b,P){f.push([C,H,b,P])>1||y(C,H)})},w&&(r[C]=w(r[C])))}function y(C,w){try{h(a[C](w))}catch(H){E(f[0][3],H)}}function h(C){C.value instanceof oe?Promise.resolve(C.value.v).then(v,S):E(f[0][2],C)}function v(C){y("next",C)}function S(C){y("throw",C)}function E(C,w){C(w),f.shift(),f.length&&y(f[0][0],f[0][1])}}function kt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],l;return t?t.call(i):(i=typeof mh=="function"?mh(i):i[Symbol.iterator](),l={},a("next"),a("throw"),a("return"),l[Symbol.asyncIterator]=function(){return this},l);function a(f){l[f]=i[f]&&function(m){return new Promise(function(g,y){m=i[f](m),r(g,y,m.done,m.value)})}}function r(f,m,g,y){Promise.resolve(y).then(function(h){f({value:h,done:g})},m)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function QS(i){var t;if(i.candidates==null||i.candidates.length===0)return!1;const l=(t=i.candidates[0])===null||t===void 0?void 0:t.content;return l===void 0?!1:Wh(l)}function Wh(i){if(i.parts===void 0||i.parts.length===0)return!1;for(const t of i.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function ZS(i){if(i.length!==0){for(const t of i)if(t.role!=="user"&&t.role!=="model")throw new Error(`Role must be user or model, but got ${t.role}.`)}}function hh(i){if(i===void 0||i.length===0)return[];const t=[],l=i.length;let a=0;for(;a{var f,m,g;const y=await r,h=(m=(f=y.candidates)===null||f===void 0?void 0:f[0])===null||m===void 0?void 0:m.content,v=y.automaticFunctionCallingHistory,S=this.getHistory(!0).length;let E=[];v!=null&&(E=(g=v.slice(S))!==null&&g!==void 0?g:[]);const C=h?[h]:[];this.recordHistory(a,C,E)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),r}async sendMessageStream(t){var l;await this.sendPromise;const a=it(t.message),r=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(a),config:(l=t.config)!==null&&l!==void 0?l:this.config});this.sendPromise=r.then(()=>{}).catch(()=>{});const f=await r;return this.processStreamResponse(f,a)}getHistory(t=!1){const l=t?hh(this.history):this.history;return structuredClone(l)}processStreamResponse(t,l){return Pt(this,arguments,function*(){var r,f,m,g,y,h;const v=[];try{for(var S=!0,E=kt(t),C;C=yield oe(E.next()),r=C.done,!r;S=!0){g=C.value,S=!1;const w=g;if(QS(w)){const H=(h=(y=w.candidates)===null||y===void 0?void 0:y[0])===null||h===void 0?void 0:h.content;H!==void 0&&v.push(H)}yield yield oe(w)}}catch(w){f={error:w}}finally{try{!S&&!r&&(m=E.return)&&(yield oe(m.call(E)))}finally{if(f)throw f.error}}this.recordHistory(l,v)})}recordHistory(t,l,a){let r=[];l.length>0&&l.every(f=>f.role!==void 0)?r=l:r.push({role:"model",parts:[]}),a&&a.length>0?this.history.push(...hh(a)):this.history.push(t),this.history.push(...r)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Ga extends Error{constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,Ga.prototype)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function jS(i){const t={},l=u(i,["file"]);return l!=null&&c(t,["file"],l),t}function eE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function tE(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","file"],Jh(l)),t}function nE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function iE(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","file"],Jh(l)),t}function oE(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function lE(i){const t={},l=u(i,["config"]);return l!=null&&oE(l,t),t}function aE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["files"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["files"],f)}return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class sE extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_FILES,a=>this.listInternal(a),await this.listInternal(l),l)}async upload(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(t.file,t.config).then(l=>l)}async download(t){await this.apiClient.downloadFile(t)}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=lE(t);return f=Y("files",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=aE(y),v=new fT;return Object.assign(v,h),v})}}async createInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=jS(t);return f=Y("upload/v1beta/files",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=eE(y),v=new dT;return Object.assign(v,h),v})}}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=iE(t);return f=Y("files/{file}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=tE(t);return f=Y("files/{file}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=nE(y),v=new pT;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Ia(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function rE(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>AE(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function uE(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function cE(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function fE(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function dE(i){const t={},l=u(i,["modelSelectionConfig"]);l!=null&&c(t,["modelConfig"],l);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const m=u(i,["enableAffectiveDialog"]);m!=null&&c(t,["enableAffectiveDialog"],m);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const h=u(i,["maxOutputTokens"]);h!=null&&c(t,["maxOutputTokens"],h);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const S=u(i,["presencePenalty"]);S!=null&&c(t,["presencePenalty"],S);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const C=u(i,["responseMimeType"]);C!=null&&c(t,["responseMimeType"],C);const w=u(i,["responseModalities"]);w!=null&&c(t,["responseModalities"],w);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const b=u(i,["routingConfig"]);b!=null&&c(t,["routingConfig"],b);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const X=u(i,["speechConfig"]);X!=null&&c(t,["speechConfig"],X);const k=u(i,["stopSequences"]);k!=null&&c(t,["stopSequences"],k);const K=u(i,["temperature"]);K!=null&&c(t,["temperature"],K);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const te=u(i,["topK"]);te!=null&&c(t,["topK"],te);const F=u(i,["topP"]);if(F!=null&&c(t,["topP"],F),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function pE(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function mE(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function hE(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const w=u(i,["systemInstruction"]);t!==void 0&&w!=null&&c(t,["setup","systemInstruction"],rE(it(w)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let te=to(H);Array.isArray(te)&&(te=te.map(F=>ME(eo(F)))),c(t,["setup","tools"],te)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],RE(b));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return l}function gE(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],dE(a));const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const w=u(i,["systemInstruction"]);t!==void 0&&w!=null&&c(t,["setup","systemInstruction"],it(w));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let F=to(H);Array.isArray(F)&&(F=F.map(he=>NE(eo(he)))),c(t,["setup","tools"],F)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],b);const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee);const te=u(i,["explicitVadSignal"]);return t!==void 0&&te!=null&&c(t,["setup","explicitVadSignal"],te),l}function yE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],hE(r,l)),l}function vE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],gE(r,l)),l}function TE(i){const t={},l=u(i,["musicGenerationConfig"]);return l!=null&&c(t,["musicGenerationConfig"],l),t}function SE(i){const t={},l=u(i,["weightedPrompts"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["weightedPrompts"],a)}return t}function EE(i){const t={},l=u(i,["media"]);if(l!=null){let h=Bh(l);Array.isArray(h)&&(h=h.map(v=>Ia(v))),c(t,["mediaChunks"],h)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],Ia(kh(a)));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Ia(Ph(f)));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function _E(i){const t={},l=u(i,["media"]);if(l!=null){let h=Bh(l);Array.isArray(h)&&(h=h.map(v=>v)),c(t,["mediaChunks"],h)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],kh(a));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Ph(f));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function CE(i){const t={},l=u(i,["setupComplete"]);l!=null&&c(t,["setupComplete"],l);const a=u(i,["serverContent"]);a!=null&&c(t,["serverContent"],a);const r=u(i,["toolCall"]);r!=null&&c(t,["toolCall"],r);const f=u(i,["toolCallCancellation"]);f!=null&&c(t,["toolCallCancellation"],f);const m=u(i,["usageMetadata"]);m!=null&&c(t,["usageMetadata"],IE(m));const g=u(i,["goAway"]);g!=null&&c(t,["goAway"],g);const y=u(i,["sessionResumptionUpdate"]);y!=null&&c(t,["sessionResumptionUpdate"],y);const h=u(i,["voiceActivityDetectionSignal"]);return h!=null&&c(t,["voiceActivityDetectionSignal"],h),t}function AE(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],uE(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],cE(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],Ia(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function RE(i){const t={},l=u(i,["handle"]);if(l!=null&&c(t,["handle"],l),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function ME(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],pE(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],mE(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function NE(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>fE(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function IE(i){const t={},l=u(i,["promptTokenCount"]);l!=null&&c(t,["promptTokenCount"],l);const a=u(i,["cachedContentTokenCount"]);a!=null&&c(t,["cachedContentTokenCount"],a);const r=u(i,["candidatesTokenCount"]);r!=null&&c(t,["responseTokenCount"],r);const f=u(i,["toolUsePromptTokenCount"]);f!=null&&c(t,["toolUsePromptTokenCount"],f);const m=u(i,["thoughtsTokenCount"]);m!=null&&c(t,["thoughtsTokenCount"],m);const g=u(i,["totalTokenCount"]);g!=null&&c(t,["totalTokenCount"],g);const y=u(i,["promptTokensDetails"]);if(y!=null){let C=y;Array.isArray(C)&&(C=C.map(w=>w)),c(t,["promptTokensDetails"],C)}const h=u(i,["cacheTokensDetails"]);if(h!=null){let C=h;Array.isArray(C)&&(C=C.map(w=>w)),c(t,["cacheTokensDetails"],C)}const v=u(i,["candidatesTokensDetails"]);if(v!=null){let C=v;Array.isArray(C)&&(C=C.map(w=>w)),c(t,["responseTokensDetails"],C)}const S=u(i,["toolUsePromptTokensDetails"]);if(S!=null){let C=S;Array.isArray(C)&&(C=C.map(w=>w)),c(t,["toolUsePromptTokensDetails"],C)}const E=u(i,["trafficType"]);return E!=null&&c(t,["trafficType"],E),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function xE(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function DE(i){const t={},l=u(i,["content"]);l!=null&&c(t,["content"],l);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],wE(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const m=u(i,["avgLogprobs"]);m!=null&&c(t,["avgLogprobs"],m);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const h=u(i,["logprobsResult"]);h!=null&&c(t,["logprobsResult"],h);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(C=>C)),c(t,["safetyRatings"],E)}const S=u(i,["urlContextMetadata"]);return S!=null&&c(t,["urlContextMetadata"],S),t}function wE(i){const t={},l=u(i,["citationSources"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function UE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let f=Ht(r);Array.isArray(f)&&(f=f.map(m=>m)),c(l,["contents"],f)}return l}function bE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["tokensInfo"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["tokensInfo"],r)}return t}function LE(i){const t={},l=u(i,["values"]);l!=null&&c(t,["values"],l);const a=u(i,["statistics"]);return a!=null&&c(t,["statistics"],GE(a)),t}function GE(i){const t={},l=u(i,["truncated"]);l!=null&&c(t,["truncated"],l);const a=u(i,["token_count"]);return a!=null&&c(t,["tokenCount"],a),t}function Ha(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>F_(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function HE(i){const t={},l=u(i,["controlType"]);l!=null&&c(t,["controlType"],l);const a=u(i,["enableControlImageComputation"]);return a!=null&&c(t,["computeControl"],a),t}function qE(i){const t={};if(u(i,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(u(i,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(u(i,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return t}function VE(i,t){const l={},a=u(i,["systemInstruction"]);t!==void 0&&a!=null&&c(t,["systemInstruction"],it(a));const r=u(i,["tools"]);if(t!==void 0&&r!=null){let m=r;Array.isArray(m)&&(m=m.map(g=>ng(g))),c(t,["tools"],m)}const f=u(i,["generationConfig"]);return t!==void 0&&f!=null&&c(t,["generationConfig"],x_(f)),l}function zE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>Ha(g))),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&qE(f),l}function BE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&VE(f,l),l}function PE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["totalTokens"]);a!=null&&c(t,["totalTokens"],a);const r=u(i,["cachedContentTokenCount"]);return r!=null&&c(t,["cachedContentTokenCount"],r),t}function kE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["totalTokens"]);return a!=null&&c(t,["totalTokens"],a),t}function OE(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function FE(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function JE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function YE(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}function XE(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["negativePrompt"]);t!==void 0&&r!=null&&c(t,["parameters","negativePrompt"],r);const f=u(i,["numberOfImages"]);t!==void 0&&f!=null&&c(t,["parameters","sampleCount"],f);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const g=u(i,["guidanceScale"]);t!==void 0&&g!=null&&c(t,["parameters","guidanceScale"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const h=u(i,["safetyFilterLevel"]);t!==void 0&&h!=null&&c(t,["parameters","safetySetting"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["includeSafetyAttributes"]);t!==void 0&&S!=null&&c(t,["parameters","includeSafetyAttributes"],S);const E=u(i,["includeRaiReason"]);t!==void 0&&E!=null&&c(t,["parameters","includeRaiReason"],E);const C=u(i,["language"]);t!==void 0&&C!=null&&c(t,["parameters","language"],C);const w=u(i,["outputMimeType"]);t!==void 0&&w!=null&&c(t,["parameters","outputOptions","mimeType"],w);const H=u(i,["outputCompressionQuality"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","compressionQuality"],H);const b=u(i,["addWatermark"]);t!==void 0&&b!=null&&c(t,["parameters","addWatermark"],b);const P=u(i,["labels"]);t!==void 0&&P!=null&&c(t,["labels"],P);const X=u(i,["editMode"]);t!==void 0&&X!=null&&c(t,["parameters","editMode"],X);const k=u(i,["baseSteps"]);return t!==void 0&&k!=null&&c(t,["parameters","editConfig","baseSteps"],k),l}function KE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["referenceImages"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>Z_(y))),c(l,["instances[0]","referenceImages"],g)}const m=u(t,["config"]);return m!=null&&XE(m,l),l}function QE(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>qa(f))),c(t,["generatedImages"],r)}return t}function ZE(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return l}function $E(i,t){const l={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["instances[]","task_type"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["instances[]","title"],r);const f=u(i,["outputDimensionality"]);t!==void 0&&f!=null&&c(t,["parameters","outputDimensionality"],f);const m=u(i,["mimeType"]);t!==void 0&&m!=null&&c(t,["instances[]","mimeType"],m);const g=u(i,["autoTruncate"]);return t!==void 0&&g!=null&&c(t,["parameters","autoTruncate"],g),l}function WE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let g=Lu(i,r);Array.isArray(g)&&(g=g.map(y=>y)),c(l,["requests[]","content"],g)}const f=u(t,["config"]);f!=null&&ZE(f,l);const m=u(t,["model"]);return m!==void 0&&c(l,["requests[]","model"],Te(i,m)),l}function jE(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Lu(i,r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["instances[]","content"],m)}const f=u(t,["config"]);return f!=null&&$E(f,l),l}function e_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["embeddings"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["embeddings"],f)}const r=u(i,["metadata"]);return r!=null&&c(t,["metadata"],r),t}function t_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions[]","embeddings"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>LE(m))),c(t,["embeddings"],f)}const r=u(i,["metadata"]);return r!=null&&c(t,["metadata"],r),t}function n_(i){const t={},l=u(i,["endpoint"]);l!=null&&c(t,["name"],l);const a=u(i,["deployedModelId"]);return a!=null&&c(t,["deployedModelId"],a),t}function i_(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function o_(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function l_(i){const t={},l=u(i,["mode"]);l!=null&&c(t,["mode"],l);const a=u(i,["allowedFunctionNames"]);if(a!=null&&c(t,["allowedFunctionNames"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function a_(i){const t={};if(u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const l=u(i,["description"]);l!=null&&c(t,["description"],l);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const m=u(i,["response"]);m!=null&&c(t,["response"],m);const g=u(i,["responseJsonSchema"]);return g!=null&&c(t,["responseJsonSchema"],g),t}function s_(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],Ha(it(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const w=u(t,["frequencyPenalty"]);w!=null&&c(a,["frequencyPenalty"],w);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);if(X!=null&&c(a,["responseJsonSchema"],X),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const k=u(t,["safetySettings"]);if(l!==void 0&&k!=null){let Ee=k;Array.isArray(Ee)&&(Ee=Ee.map(Pe=>$_(Pe))),c(l,["safetySettings"],Ee)}const K=u(t,["tools"]);if(l!==void 0&&K!=null){let Ee=to(K);Array.isArray(Ee)&&(Ee=Ee.map(Pe=>oC(eo(Pe)))),c(l,["tools"],Ee)}const ee=u(t,["toolConfig"]);if(l!==void 0&&ee!=null&&c(l,["toolConfig"],iC(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const te=u(t,["cachedContent"]);l!==void 0&&te!=null&&c(l,["cachedContent"],gn(i,te));const F=u(t,["responseModalities"]);F!=null&&c(a,["responseModalities"],F);const he=u(t,["mediaResolution"]);he!=null&&c(a,["mediaResolution"],he);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],Hu(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const Ce=u(t,["imageConfig"]);Ce!=null&&c(a,["imageConfig"],L_(Ce));const Ge=u(t,["enableEnhancedCivicAnswers"]);return Ge!=null&&c(a,["enableEnhancedCivicAnswers"],Ge),a}function r_(i,t,l){const a={},r=u(t,["systemInstruction"]);l!==void 0&&r!=null&&c(l,["systemInstruction"],it(r));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const m=u(t,["topP"]);m!=null&&c(a,["topP"],m);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const h=u(t,["maxOutputTokens"]);h!=null&&c(a,["maxOutputTokens"],h);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const S=u(t,["responseLogprobs"]);S!=null&&c(a,["responseLogprobs"],S);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const C=u(t,["presencePenalty"]);C!=null&&c(a,["presencePenalty"],C);const w=u(t,["frequencyPenalty"]);w!=null&&c(a,["frequencyPenalty"],w);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const b=u(t,["responseMimeType"]);b!=null&&c(a,["responseMimeType"],b);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],Gu(P));const X=u(t,["responseJsonSchema"]);X!=null&&c(a,["responseJsonSchema"],X);const k=u(t,["routingConfig"]);k!=null&&c(a,["routingConfig"],k);const K=u(t,["modelSelectionConfig"]);K!=null&&c(a,["modelConfig"],K);const ee=u(t,["safetySettings"]);if(l!==void 0&&ee!=null){let L=ee;Array.isArray(L)&&(L=L.map(O=>O)),c(l,["safetySettings"],L)}const te=u(t,["tools"]);if(l!==void 0&&te!=null){let L=to(te);Array.isArray(L)&&(L=L.map(O=>ng(eo(O)))),c(l,["tools"],L)}const F=u(t,["toolConfig"]);l!==void 0&&F!=null&&c(l,["toolConfig"],F);const he=u(t,["labels"]);l!==void 0&&he!=null&&c(l,["labels"],he);const W=u(t,["cachedContent"]);l!==void 0&&W!=null&&c(l,["cachedContent"],gn(i,W));const de=u(t,["responseModalities"]);de!=null&&c(a,["responseModalities"],de);const Ce=u(t,["mediaResolution"]);Ce!=null&&c(a,["mediaResolution"],Ce);const Ge=u(t,["speechConfig"]);Ge!=null&&c(a,["speechConfig"],Hu(Ge));const Ee=u(t,["audioTimestamp"]);Ee!=null&&c(a,["audioTimestamp"],Ee);const Pe=u(t,["thinkingConfig"]);Pe!=null&&c(a,["thinkingConfig"],Pe);const rt=u(t,["imageConfig"]);if(rt!=null&&c(a,["imageConfig"],G_(rt)),u(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return a}function gh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>Ha(g))),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&c(l,["generationConfig"],s_(i,f,l)),l}function yh(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["contents"]);if(r!=null){let m=Ht(r);Array.isArray(m)&&(m=m.map(g=>g)),c(l,["contents"],m)}const f=u(t,["config"]);return f!=null&&c(l,["generationConfig"],r_(i,f,l)),l}function vh(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(h=>DE(h))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const m=u(i,["responseId"]);m!=null&&c(t,["responseId"],m);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function Th(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["candidates"]);if(a!=null){let h=a;Array.isArray(h)&&(h=h.map(v=>v)),c(t,["candidates"],h)}const r=u(i,["createTime"]);r!=null&&c(t,["createTime"],r);const f=u(i,["modelVersion"]);f!=null&&c(t,["modelVersion"],f);const m=u(i,["promptFeedback"]);m!=null&&c(t,["promptFeedback"],m);const g=u(i,["responseId"]);g!=null&&c(t,["responseId"],g);const y=u(i,["usageMetadata"]);return y!=null&&c(t,["usageMetadata"],y),t}function u_(i,t){const l={};if(u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const a=u(i,["numberOfImages"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["aspectRatio"]);t!==void 0&&r!=null&&c(t,["parameters","aspectRatio"],r);const f=u(i,["guidanceScale"]);if(t!==void 0&&f!=null&&c(t,["parameters","guidanceScale"],f),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const m=u(i,["safetyFilterLevel"]);t!==void 0&&m!=null&&c(t,["parameters","safetySetting"],m);const g=u(i,["personGeneration"]);t!==void 0&&g!=null&&c(t,["parameters","personGeneration"],g);const y=u(i,["includeSafetyAttributes"]);t!==void 0&&y!=null&&c(t,["parameters","includeSafetyAttributes"],y);const h=u(i,["includeRaiReason"]);t!==void 0&&h!=null&&c(t,["parameters","includeRaiReason"],h);const v=u(i,["language"]);t!==void 0&&v!=null&&c(t,["parameters","language"],v);const S=u(i,["outputMimeType"]);t!==void 0&&S!=null&&c(t,["parameters","outputOptions","mimeType"],S);const E=u(i,["outputCompressionQuality"]);if(t!==void 0&&E!=null&&c(t,["parameters","outputOptions","compressionQuality"],E),u(i,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const C=u(i,["imageSize"]);if(t!==void 0&&C!=null&&c(t,["parameters","sampleImageSize"],C),u(i,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return l}function c_(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["negativePrompt"]);t!==void 0&&r!=null&&c(t,["parameters","negativePrompt"],r);const f=u(i,["numberOfImages"]);t!==void 0&&f!=null&&c(t,["parameters","sampleCount"],f);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const g=u(i,["guidanceScale"]);t!==void 0&&g!=null&&c(t,["parameters","guidanceScale"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const h=u(i,["safetyFilterLevel"]);t!==void 0&&h!=null&&c(t,["parameters","safetySetting"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["includeSafetyAttributes"]);t!==void 0&&S!=null&&c(t,["parameters","includeSafetyAttributes"],S);const E=u(i,["includeRaiReason"]);t!==void 0&&E!=null&&c(t,["parameters","includeRaiReason"],E);const C=u(i,["language"]);t!==void 0&&C!=null&&c(t,["parameters","language"],C);const w=u(i,["outputMimeType"]);t!==void 0&&w!=null&&c(t,["parameters","outputOptions","mimeType"],w);const H=u(i,["outputCompressionQuality"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","compressionQuality"],H);const b=u(i,["addWatermark"]);t!==void 0&&b!=null&&c(t,["parameters","addWatermark"],b);const P=u(i,["labels"]);t!==void 0&&P!=null&&c(t,["labels"],P);const X=u(i,["imageSize"]);t!==void 0&&X!=null&&c(t,["parameters","sampleImageSize"],X);const k=u(i,["enhancePrompt"]);return t!==void 0&&k!=null&&c(t,["parameters","enhancePrompt"],k),l}function f_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["config"]);return f!=null&&u_(f,l),l}function d_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["config"]);return f!=null&&c_(f,l),l}function p_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>R_(m))),c(t,["generatedImages"],f)}const r=u(i,["positivePromptSafetyAttributes"]);return r!=null&&c(t,["positivePromptSafetyAttributes"],eg(r)),t}function m_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>qa(m))),c(t,["generatedImages"],f)}const r=u(i,["positivePromptSafetyAttributes"]);return r!=null&&c(t,["positivePromptSafetyAttributes"],tg(r)),t}function h_(i,t){const l={},a=u(i,["numberOfVideos"]);if(t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a),u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const r=u(i,["durationSeconds"]);if(t!==void 0&&r!=null&&c(t,["parameters","durationSeconds"],r),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const f=u(i,["aspectRatio"]);t!==void 0&&f!=null&&c(t,["parameters","aspectRatio"],f);const m=u(i,["resolution"]);t!==void 0&&m!=null&&c(t,["parameters","resolution"],m);const g=u(i,["personGeneration"]);if(t!==void 0&&g!=null&&c(t,["parameters","personGeneration"],g),u(i,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const y=u(i,["negativePrompt"]);t!==void 0&&y!=null&&c(t,["parameters","negativePrompt"],y);const h=u(i,["enhancePrompt"]);if(t!==void 0&&h!=null&&c(t,["parameters","enhancePrompt"],h),u(i,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const v=u(i,["lastFrame"]);t!==void 0&&v!=null&&c(t,["instances[0]","lastFrame"],Va(v));const S=u(i,["referenceImages"]);if(t!==void 0&&S!=null){let E=S;Array.isArray(E)&&(E=E.map(C=>yC(C))),c(t,["instances[0]","referenceImages"],E)}if(u(i,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(u(i,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return l}function g_(i,t){const l={},a=u(i,["numberOfVideos"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["outputGcsUri"]);t!==void 0&&r!=null&&c(t,["parameters","storageUri"],r);const f=u(i,["fps"]);t!==void 0&&f!=null&&c(t,["parameters","fps"],f);const m=u(i,["durationSeconds"]);t!==void 0&&m!=null&&c(t,["parameters","durationSeconds"],m);const g=u(i,["seed"]);t!==void 0&&g!=null&&c(t,["parameters","seed"],g);const y=u(i,["aspectRatio"]);t!==void 0&&y!=null&&c(t,["parameters","aspectRatio"],y);const h=u(i,["resolution"]);t!==void 0&&h!=null&&c(t,["parameters","resolution"],h);const v=u(i,["personGeneration"]);t!==void 0&&v!=null&&c(t,["parameters","personGeneration"],v);const S=u(i,["pubsubTopic"]);t!==void 0&&S!=null&&c(t,["parameters","pubsubTopic"],S);const E=u(i,["negativePrompt"]);t!==void 0&&E!=null&&c(t,["parameters","negativePrompt"],E);const C=u(i,["enhancePrompt"]);t!==void 0&&C!=null&&c(t,["parameters","enhancePrompt"],C);const w=u(i,["generateAudio"]);t!==void 0&&w!=null&&c(t,["parameters","generateAudio"],w);const H=u(i,["lastFrame"]);t!==void 0&&H!=null&&c(t,["instances[0]","lastFrame"],Ot(H));const b=u(i,["referenceImages"]);if(t!==void 0&&b!=null){let k=b;Array.isArray(k)&&(k=k.map(K=>vC(K))),c(t,["instances[0]","referenceImages"],k)}const P=u(i,["mask"]);t!==void 0&&P!=null&&c(t,["instances[0]","mask"],gC(P));const X=u(i,["compressionQuality"]);return t!==void 0&&X!=null&&c(t,["parameters","compressionQuality"],X),l}function y_(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response","generateVideoResponse"]);return m!=null&&c(t,["response"],E_(m)),t}function v_(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],__(m)),t}function T_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["image"]);f!=null&&c(l,["instances[0]","image"],Va(f));const m=u(t,["video"]);m!=null&&c(l,["instances[0]","video"],ig(m));const g=u(t,["source"]);g!=null&&C_(g,l);const y=u(t,["config"]);return y!=null&&h_(y,l),l}function S_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["prompt"]);r!=null&&c(l,["instances[0]","prompt"],r);const f=u(t,["image"]);f!=null&&c(l,["instances[0]","image"],Ot(f));const m=u(t,["video"]);m!=null&&c(l,["instances[0]","video"],og(m));const g=u(t,["source"]);g!=null&&A_(g,l);const y=u(t,["config"]);return y!=null&&g_(y,l),l}function E_(i){const t={},l=u(i,["generatedSamples"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>N_(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function __(i){const t={},l=u(i,["videos"]);if(l!=null){let f=l;Array.isArray(f)&&(f=f.map(m=>I_(m))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function C_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Va(r));const f=u(i,["video"]);return t!==void 0&&f!=null&&c(t,["instances[0]","video"],ig(f)),l}function A_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Ot(r));const f=u(i,["video"]);return t!==void 0&&f!=null&&c(t,["instances[0]","video"],og(f)),l}function R_(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["image"],H_(l));const a=u(i,["raiFilteredReason"]);a!=null&&c(t,["raiFilteredReason"],a);const r=u(i,["_self"]);return r!=null&&c(t,["safetyAttributes"],eg(r)),t}function qa(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["image"],jh(l));const a=u(i,["raiFilteredReason"]);a!=null&&c(t,["raiFilteredReason"],a);const r=u(i,["_self"]);r!=null&&c(t,["safetyAttributes"],tg(r));const f=u(i,["prompt"]);return f!=null&&c(t,["enhancedPrompt"],f),t}function M_(i){const t={},l=u(i,["_self"]);l!=null&&c(t,["mask"],jh(l));const a=u(i,["labels"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["labels"],r)}return t}function N_(i){const t={},l=u(i,["video"]);return l!=null&&c(t,["video"],mC(l)),t}function I_(i){const t={},l=u(i,["_self"]);return l!=null&&c(t,["video"],hC(l)),t}function x_(i){const t={},l=u(i,["modelSelectionConfig"]);l!=null&&c(t,["modelConfig"],l);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const m=u(i,["enableAffectiveDialog"]);m!=null&&c(t,["enableAffectiveDialog"],m);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const h=u(i,["maxOutputTokens"]);h!=null&&c(t,["maxOutputTokens"],h);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const S=u(i,["presencePenalty"]);S!=null&&c(t,["presencePenalty"],S);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const C=u(i,["responseMimeType"]);C!=null&&c(t,["responseMimeType"],C);const w=u(i,["responseModalities"]);w!=null&&c(t,["responseModalities"],w);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const b=u(i,["routingConfig"]);b!=null&&c(t,["routingConfig"],b);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const X=u(i,["speechConfig"]);X!=null&&c(t,["speechConfig"],X);const k=u(i,["stopSequences"]);k!=null&&c(t,["stopSequences"],k);const K=u(i,["temperature"]);K!=null&&c(t,["temperature"],K);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const te=u(i,["topK"]);te!=null&&c(t,["topK"],te);const F=u(i,["topP"]);if(F!=null&&c(t,["topP"],F),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function D_(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function w_(i,t){const l={},a=u(t,["model"]);return a!=null&&c(l,["_url","name"],Te(i,a)),l}function U_(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function b_(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function L_(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function G_(i){const t={},l=u(i,["aspectRatio"]);l!=null&&c(t,["aspectRatio"],l);const a=u(i,["imageSize"]);a!=null&&c(t,["imageSize"],a);const r=u(i,["outputMimeType"]);r!=null&&c(t,["imageOutputOptions","mimeType"],r);const f=u(i,["outputCompressionQuality"]);return f!=null&&c(t,["imageOutputOptions","compressionQuality"],f),t}function H_(i){const t={},l=u(i,["bytesBase64Encoded"]);l!=null&&c(t,["imageBytes"],On(l));const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function jh(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["imageBytes"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function Va(i){const t={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const l=u(i,["imageBytes"]);l!=null&&c(t,["bytesBase64Encoded"],On(l));const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function Ot(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["imageBytes"]);a!=null&&c(t,["bytesBase64Encoded"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function q_(i,t,l){const a={},r=u(t,["pageSize"]);l!==void 0&&r!=null&&c(l,["_query","pageSize"],r);const f=u(t,["pageToken"]);l!==void 0&&f!=null&&c(l,["_query","pageToken"],f);const m=u(t,["filter"]);l!==void 0&&m!=null&&c(l,["_query","filter"],m);const g=u(t,["queryBase"]);return l!==void 0&&g!=null&&c(l,["_url","models_url"],Yh(i,g)),a}function V_(i,t,l){const a={},r=u(t,["pageSize"]);l!==void 0&&r!=null&&c(l,["_query","pageSize"],r);const f=u(t,["pageToken"]);l!==void 0&&f!=null&&c(l,["_query","pageToken"],f);const m=u(t,["filter"]);l!==void 0&&m!=null&&c(l,["_query","filter"],m);const g=u(t,["queryBase"]);return l!==void 0&&g!=null&&c(l,["_url","models_url"],Yh(i,g)),a}function z_(i,t){const l={},a=u(t,["config"]);return a!=null&&q_(i,a,l),l}function B_(i,t){const l={},a=u(t,["config"]);return a!=null&&V_(i,a,l),l}function P_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["_self"]);if(r!=null){let f=Xh(r);Array.isArray(f)&&(f=f.map(m=>Eu(m))),c(t,["models"],f)}return t}function k_(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["_self"]);if(r!=null){let f=Xh(r);Array.isArray(f)&&(f=f.map(m=>_u(m))),c(t,["models"],f)}return t}function O_(i){const t={},l=u(i,["maskMode"]);l!=null&&c(t,["maskMode"],l);const a=u(i,["segmentationClasses"]);a!=null&&c(t,["maskClasses"],a);const r=u(i,["maskDilation"]);return r!=null&&c(t,["dilation"],r),t}function Eu(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);r!=null&&c(t,["description"],r);const f=u(i,["version"]);f!=null&&c(t,["version"],f);const m=u(i,["_self"]);m!=null&&c(t,["tunedModelInfo"],lC(m));const g=u(i,["inputTokenLimit"]);g!=null&&c(t,["inputTokenLimit"],g);const y=u(i,["outputTokenLimit"]);y!=null&&c(t,["outputTokenLimit"],y);const h=u(i,["supportedGenerationMethods"]);h!=null&&c(t,["supportedActions"],h);const v=u(i,["temperature"]);v!=null&&c(t,["temperature"],v);const S=u(i,["maxTemperature"]);S!=null&&c(t,["maxTemperature"],S);const E=u(i,["topP"]);E!=null&&c(t,["topP"],E);const C=u(i,["topK"]);C!=null&&c(t,["topK"],C);const w=u(i,["thinking"]);return w!=null&&c(t,["thinking"],w),t}function _u(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);r!=null&&c(t,["description"],r);const f=u(i,["versionId"]);f!=null&&c(t,["version"],f);const m=u(i,["deployedModels"]);if(m!=null){let S=m;Array.isArray(S)&&(S=S.map(E=>n_(E))),c(t,["endpoints"],S)}const g=u(i,["labels"]);g!=null&&c(t,["labels"],g);const y=u(i,["_self"]);y!=null&&c(t,["tunedModelInfo"],aC(y));const h=u(i,["defaultCheckpointId"]);h!=null&&c(t,["defaultCheckpointId"],h);const v=u(i,["checkpoints"]);if(v!=null){let S=v;Array.isArray(S)&&(S=S.map(E=>E)),c(t,["checkpoints"],S)}return t}function F_(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],i_(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],o_(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],xE(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function J_(i){const t={},l=u(i,["productImage"]);return l!=null&&c(t,["image"],Ot(l)),t}function Y_(i,t){const l={},a=u(i,["numberOfImages"]);t!==void 0&&a!=null&&c(t,["parameters","sampleCount"],a);const r=u(i,["baseSteps"]);t!==void 0&&r!=null&&c(t,["parameters","baseSteps"],r);const f=u(i,["outputGcsUri"]);t!==void 0&&f!=null&&c(t,["parameters","storageUri"],f);const m=u(i,["seed"]);t!==void 0&&m!=null&&c(t,["parameters","seed"],m);const g=u(i,["safetyFilterLevel"]);t!==void 0&&g!=null&&c(t,["parameters","safetySetting"],g);const y=u(i,["personGeneration"]);t!==void 0&&y!=null&&c(t,["parameters","personGeneration"],y);const h=u(i,["addWatermark"]);t!==void 0&&h!=null&&c(t,["parameters","addWatermark"],h);const v=u(i,["outputMimeType"]);t!==void 0&&v!=null&&c(t,["parameters","outputOptions","mimeType"],v);const S=u(i,["outputCompressionQuality"]);t!==void 0&&S!=null&&c(t,["parameters","outputOptions","compressionQuality"],S);const E=u(i,["enhancePrompt"]);t!==void 0&&E!=null&&c(t,["parameters","enhancePrompt"],E);const C=u(i,["labels"]);return t!==void 0&&C!=null&&c(t,["labels"],C),l}function X_(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["source"]);r!=null&&Q_(r,l);const f=u(t,["config"]);return f!=null&&Y_(f,l),l}function K_(i){const t={},l=u(i,["predictions"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>qa(r))),c(t,["generatedImages"],a)}return t}function Q_(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["personImage"]);t!==void 0&&r!=null&&c(t,["instances[0]","personImage","image"],Ot(r));const f=u(i,["productImages"]);if(t!==void 0&&f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>J_(g))),c(t,["instances[0]","productImages"],m)}return l}function Z_(i){const t={},l=u(i,["referenceImage"]);l!=null&&c(t,["referenceImage"],Ot(l));const a=u(i,["referenceId"]);a!=null&&c(t,["referenceId"],a);const r=u(i,["referenceType"]);r!=null&&c(t,["referenceType"],r);const f=u(i,["maskImageConfig"]);f!=null&&c(t,["maskImageConfig"],O_(f));const m=u(i,["controlImageConfig"]);m!=null&&c(t,["controlImageConfig"],HE(m));const g=u(i,["styleImageConfig"]);g!=null&&c(t,["styleImageConfig"],g);const y=u(i,["subjectImageConfig"]);return y!=null&&c(t,["subjectImageConfig"],y),t}function eg(i){const t={},l=u(i,["safetyAttributes","categories"]);l!=null&&c(t,["categories"],l);const a=u(i,["safetyAttributes","scores"]);a!=null&&c(t,["scores"],a);const r=u(i,["contentType"]);return r!=null&&c(t,["contentType"],r),t}function tg(i){const t={},l=u(i,["safetyAttributes","categories"]);l!=null&&c(t,["categories"],l);const a=u(i,["safetyAttributes","scores"]);a!=null&&c(t,["scores"],a);const r=u(i,["contentType"]);return r!=null&&c(t,["contentType"],r),t}function $_(i){const t={},l=u(i,["category"]);if(l!=null&&c(t,["category"],l),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function W_(i){const t={},l=u(i,["image"]);return l!=null&&c(t,["image"],Ot(l)),t}function j_(i,t){const l={},a=u(i,["mode"]);t!==void 0&&a!=null&&c(t,["parameters","mode"],a);const r=u(i,["maxPredictions"]);t!==void 0&&r!=null&&c(t,["parameters","maxPredictions"],r);const f=u(i,["confidenceThreshold"]);t!==void 0&&f!=null&&c(t,["parameters","confidenceThreshold"],f);const m=u(i,["maskDilation"]);t!==void 0&&m!=null&&c(t,["parameters","maskDilation"],m);const g=u(i,["binaryColorThreshold"]);t!==void 0&&g!=null&&c(t,["parameters","binaryColorThreshold"],g);const y=u(i,["labels"]);return t!==void 0&&y!=null&&c(t,["labels"],y),l}function eC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["source"]);r!=null&&nC(r,l);const f=u(t,["config"]);return f!=null&&j_(f,l),l}function tC(i){const t={},l=u(i,["predictions"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(r=>M_(r))),c(t,["generatedMasks"],a)}return t}function nC(i,t){const l={},a=u(i,["prompt"]);t!==void 0&&a!=null&&c(t,["instances[0]","prompt"],a);const r=u(i,["image"]);t!==void 0&&r!=null&&c(t,["instances[0]","image"],Ot(r));const f=u(i,["scribbleImage"]);return t!==void 0&&f!=null&&c(t,["instances[0]","scribble"],W_(f)),l}function iC(i){const t={},l=u(i,["functionCallingConfig"]);l!=null&&c(t,["functionCallingConfig"],l_(l));const a=u(i,["retrievalConfig"]);return a!=null&&c(t,["retrievalConfig"],a),t}function oC(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],U_(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],b_(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}function ng(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let S=l;Array.isArray(S)&&(S=S.map(E=>a_(E))),c(t,["functionDeclarations"],S)}const a=u(i,["retrieval"]);a!=null&&c(t,["retrieval"],a);const r=u(i,["googleSearchRetrieval"]);r!=null&&c(t,["googleSearchRetrieval"],r);const f=u(i,["computerUse"]);if(f!=null&&c(t,["computerUse"],f),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const m=u(i,["codeExecution"]);m!=null&&c(t,["codeExecution"],m);const g=u(i,["enterpriseWebSearch"]);g!=null&&c(t,["enterpriseWebSearch"],g);const y=u(i,["googleMaps"]);y!=null&&c(t,["googleMaps"],y);const h=u(i,["googleSearch"]);h!=null&&c(t,["googleSearch"],h);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function lC(i){const t={},l=u(i,["baseModel"]);l!=null&&c(t,["baseModel"],l);const a=u(i,["createTime"]);a!=null&&c(t,["createTime"],a);const r=u(i,["updateTime"]);return r!=null&&c(t,["updateTime"],r),t}function aC(i){const t={},l=u(i,["labels","google-vertex-llm-tuning-base-model-id"]);l!=null&&c(t,["baseModel"],l);const a=u(i,["createTime"]);a!=null&&c(t,["createTime"],a);const r=u(i,["updateTime"]);return r!=null&&c(t,["updateTime"],r),t}function sC(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);t!==void 0&&r!=null&&c(t,["description"],r);const f=u(i,["defaultCheckpointId"]);return t!==void 0&&f!=null&&c(t,["defaultCheckpointId"],f),l}function rC(i,t){const l={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["description"]);t!==void 0&&r!=null&&c(t,["description"],r);const f=u(i,["defaultCheckpointId"]);return t!==void 0&&f!=null&&c(t,["defaultCheckpointId"],f),l}function uC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","name"],Te(i,a));const r=u(t,["config"]);return r!=null&&sC(r,l),l}function cC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&rC(r,l),l}function fC(i,t){const l={},a=u(i,["outputGcsUri"]);t!==void 0&&a!=null&&c(t,["parameters","storageUri"],a);const r=u(i,["safetyFilterLevel"]);t!==void 0&&r!=null&&c(t,["parameters","safetySetting"],r);const f=u(i,["personGeneration"]);t!==void 0&&f!=null&&c(t,["parameters","personGeneration"],f);const m=u(i,["includeRaiReason"]);t!==void 0&&m!=null&&c(t,["parameters","includeRaiReason"],m);const g=u(i,["outputMimeType"]);t!==void 0&&g!=null&&c(t,["parameters","outputOptions","mimeType"],g);const y=u(i,["outputCompressionQuality"]);t!==void 0&&y!=null&&c(t,["parameters","outputOptions","compressionQuality"],y);const h=u(i,["enhanceInputImage"]);t!==void 0&&h!=null&&c(t,["parameters","upscaleConfig","enhanceInputImage"],h);const v=u(i,["imagePreservationFactor"]);t!==void 0&&v!=null&&c(t,["parameters","upscaleConfig","imagePreservationFactor"],v);const S=u(i,["labels"]);t!==void 0&&S!=null&&c(t,["labels"],S);const E=u(i,["numberOfImages"]);t!==void 0&&E!=null&&c(t,["parameters","sampleCount"],E);const C=u(i,["mode"]);return t!==void 0&&C!=null&&c(t,["parameters","mode"],C),l}function dC(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["_url","model"],Te(i,a));const r=u(t,["image"]);r!=null&&c(l,["instances[0]","image"],Ot(r));const f=u(t,["upscaleFactor"]);f!=null&&c(l,["parameters","upscaleConfig","upscaleFactor"],f);const m=u(t,["config"]);return m!=null&&fC(m,l),l}function pC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>qa(f))),c(t,["generatedImages"],r)}return t}function mC(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],On(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function hC(i){const t={},l=u(i,["gcsUri"]);l!=null&&c(t,["uri"],l);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}function gC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["_self"],Ot(l));const a=u(i,["maskMode"]);return a!=null&&c(t,["maskMode"],a),t}function yC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["image"],Va(l));const a=u(i,["referenceType"]);return a!=null&&c(t,["referenceType"],a),t}function vC(i){const t={},l=u(i,["image"]);l!=null&&c(t,["image"],Ot(l));const a=u(i,["referenceType"]);return a!=null&&c(t,["referenceType"],a),t}function ig(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["uri"],l);const a=u(i,["videoBytes"]);a!=null&&c(t,["encodedVideo"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["encoding"],r),t}function og(i){const t={},l=u(i,["uri"]);l!=null&&c(t,["gcsUri"],l);const a=u(i,["videoBytes"]);a!=null&&c(t,["bytesBase64Encoded"],On(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function TC(i,t){const l={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["displayName"],a),l}function SC(i){const t={},l=u(i,["config"]);return l!=null&&TC(l,t),t}function EC(i,t){const l={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),l}function _C(i){const t={},l=u(i,["name"]);l!=null&&c(t,["_url","name"],l);const a=u(i,["config"]);return a!=null&&EC(a,t),t}function CC(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","name"],l),t}function AC(i,t){const l={},a=u(i,["customMetadata"]);if(t!==void 0&&a!=null){let f=a;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["customMetadata"],f)}const r=u(i,["chunkingConfig"]);return t!==void 0&&r!=null&&c(t,["chunkingConfig"],r),l}function RC(i){const t={},l=u(i,["name"]);l!=null&&c(t,["name"],l);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const m=u(i,["response"]);return m!=null&&c(t,["response"],NC(m)),t}function MC(i){const t={},l=u(i,["fileSearchStoreName"]);l!=null&&c(t,["_url","file_search_store_name"],l);const a=u(i,["fileName"]);a!=null&&c(t,["fileName"],a);const r=u(i,["config"]);return r!=null&&AC(r,t),t}function NC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function IC(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function xC(i){const t={},l=u(i,["config"]);return l!=null&&IC(l,t),t}function DC(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["fileSearchStores"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["fileSearchStores"],f)}return t}function lg(i,t){const l={},a=u(i,["mimeType"]);t!==void 0&&a!=null&&c(t,["mimeType"],a);const r=u(i,["displayName"]);t!==void 0&&r!=null&&c(t,["displayName"],r);const f=u(i,["customMetadata"]);if(t!==void 0&&f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>y)),c(t,["customMetadata"],g)}const m=u(i,["chunkingConfig"]);return t!==void 0&&m!=null&&c(t,["chunkingConfig"],m),l}function wC(i){const t={},l=u(i,["fileSearchStoreName"]);l!=null&&c(t,["_url","file_search_store_name"],l);const a=u(i,["config"]);return a!=null&&lg(a,t),t}function UC(i){const t={},l=u(i,["sdkHttpResponse"]);return l!=null&&c(t,["sdkHttpResponse"],l),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const bC="Content-Type",LC="X-Server-Timeout",GC="User-Agent",Cu="x-goog-api-client",HC="1.34.0",qC=`google-genai-sdk/${HC}`,VC="v1beta1",zC="v1beta";class BC{constructor(t){var l,a;this.clientOptions=Object.assign(Object.assign({},t),{project:t.project,location:t.location,apiKey:t.apiKey,vertexai:t.vertexai});const r={};this.clientOptions.vertexai?(r.apiVersion=(l=this.clientOptions.apiVersion)!==null&&l!==void 0?l:VC,r.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(r.apiVersion=(a=this.clientOptions.apiVersion)!==null&&a!==void 0?a:zC,r.baseUrl="https://generativelanguage.googleapis.com/"),r.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=r,t.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(r,t.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var t;return(t=this.clientOptions.vertexai)!==null&&t!==void 0?t:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}async getAuthHeaders(){const t=new Headers;return await this.clientOptions.auth.addAuthHeaders(t),t}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(t){if(!t||t.baseUrl===void 0||t.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const a=[t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl];return t.apiVersion&&t.apiVersion!==""&&a.push(t.apiVersion),a.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const t=this.getBaseUrl(),l=new URL(t);return l.protocol=l.protocol=="http:"?"ws":"wss",l.toString()}setBaseUrl(t){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=t;else throw new Error("HTTP options are not correctly set.")}constructUrl(t,l,a){const r=[this.getRequestUrlInternal(l)];return a&&r.push(this.getBaseResourcePath()),t!==""&&r.push(t),new URL(`${r.join("/")}`)}shouldPrependVertexProjectPath(t){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||t.path.startsWith("projects/")||t.httpMethod==="GET"&&t.path.startsWith("publishers/google/models"))}async request(t){let l=this.clientOptions.httpOptions;t.httpOptions&&(l=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t),r=this.constructUrl(t.path,l,a);if(t.queryParams)for(const[m,g]of Object.entries(t.queryParams))r.searchParams.append(m,String(g));let f={};if(t.httpMethod==="GET"){if(t.body&&t.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else f.body=t.body;return f=await this.includeExtraHttpOptionsToRequestInit(f,l,r.toString(),t.abortSignal),this.unaryApiCall(r,f,t.httpMethod)}patchHttpOptions(t,l){const a=JSON.parse(JSON.stringify(t));for(const[r,f]of Object.entries(l))typeof f=="object"?a[r]=Object.assign(Object.assign({},a[r]),f):f!==void 0&&(a[r]=f);return a}async requestStream(t){let l=this.clientOptions.httpOptions;t.httpOptions&&(l=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t),r=this.constructUrl(t.path,l,a);(!r.searchParams.has("alt")||r.searchParams.get("alt")!=="sse")&&r.searchParams.set("alt","sse");let f={};return f.body=t.body,f=await this.includeExtraHttpOptionsToRequestInit(f,l,r.toString(),t.abortSignal),this.streamApiCall(r,f,t.httpMethod)}async includeExtraHttpOptionsToRequestInit(t,l,a,r){if(l&&l.timeout||r){const f=new AbortController,m=f.signal;if(l.timeout&&(l==null?void 0:l.timeout)>0){const g=setTimeout(()=>f.abort(),l.timeout);g&&typeof g.unref=="function"&&g.unref()}r&&r.addEventListener("abort",()=>{f.abort()}),t.signal=m}return l&&l.extraBody!==null&&PC(t,l.extraBody),t.headers=await this.getHeadersInternal(l,a),t}async unaryApiCall(t,l,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},l),{method:a})).then(async r=>(await Sh(r),new vu(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}async streamApiCall(t,l,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},l),{method:a})).then(async r=>(await Sh(r),this.processStreamResponse(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}processStreamResponse(t){return Pt(this,arguments,function*(){var a;const r=(a=t==null?void 0:t.body)===null||a===void 0?void 0:a.getReader(),f=new TextDecoder("utf-8");if(!r)throw new Error("Response body is empty");try{let m="";const g="data:",y=[` + +`,"\r\r",`\r +\r +`];for(;;){const{done:h,value:v}=yield oe(r.read());if(h){if(m.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const S=f.decode(v,{stream:!0});try{const w=JSON.parse(S);if("error"in w){const H=JSON.parse(JSON.stringify(w.error)),b=H.status,P=H.code,X=`got status: ${b}. ${JSON.stringify(w)}`;if(P>=400&&P<600)throw new Ga({message:X,status:P})}}catch(w){if(w.name==="ApiError")throw w}m+=S;let E=-1,C=0;for(;;){E=-1,C=0;for(const b of y){const P=m.indexOf(b);P!==-1&&(E===-1||P{throw new Error(`exception ${a} sending request`)})}getDefaultHeaders(){const t={},l=qC+" "+this.clientOptions.userAgentExtra;return t[GC]=l,t[Cu]=l,t[bC]="application/json",t}async getHeadersInternal(t,l){const a=new Headers;if(t&&t.headers){for(const[r,f]of Object.entries(t.headers))a.append(r,f);t.timeout&&t.timeout>0&&a.append(LC,String(Math.ceil(t.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(a,l),a}getFileName(t){var l;let a="";return typeof t=="string"&&(a=t.replace(/[/\\]+$/,""),a=(l=a.split(/[/\\]/).pop())!==null&&l!==void 0?l:""),a}async uploadFile(t,l){var a;const r={};l!=null&&(r.mimeType=l.mimeType,r.name=l.name,r.displayName=l.displayName),r.name&&!r.name.startsWith("files/")&&(r.name=`files/${r.name}`);const f=this.clientOptions.uploader,m=await f.stat(t);r.sizeBytes=String(m.size);const g=(a=l==null?void 0:l.mimeType)!==null&&a!==void 0?a:m.type;if(g===void 0||g==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");r.mimeType=g;const y={file:r},h=this.getFileName(t),v=Y("upload/v1beta/files",y._url),S=await this.fetchUploadUrl(v,r.sizeBytes,r.mimeType,h,y,l==null?void 0:l.httpOptions);return f.upload(t,S,this)}async uploadFileToFileSearchStore(t,l,a){var r;const f=this.clientOptions.uploader,m=await f.stat(l),g=String(m.size),y=(r=a==null?void 0:a.mimeType)!==null&&r!==void 0?r:m.type;if(y===void 0||y==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const h=`upload/v1beta/${t}:uploadToFileSearchStore`,v=this.getFileName(l),S={};a!=null&&lg(a,S);const E=await this.fetchUploadUrl(h,g,y,v,S,a==null?void 0:a.httpOptions);return f.uploadToFileSearchStore(l,E,this)}async downloadFile(t){await this.clientOptions.downloader.download(t,this)}async fetchUploadUrl(t,l,a,r,f,m){var g;let y={};m?y=m:y={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${l}`,"X-Goog-Upload-Header-Content-Type":`${a}`},r?{"X-Goog-Upload-File-Name":r}:{})};const h=await this.request({path:t,body:JSON.stringify(f),httpMethod:"POST",httpOptions:y});if(!h||!(h!=null&&h.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const v=(g=h==null?void 0:h.headers)===null||g===void 0?void 0:g["x-goog-upload-url"];if(v===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return v}}async function Sh(i){var t;if(i===void 0)throw new Error("response is undefined");if(!i.ok){const l=i.status;let a;!((t=i.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?a=await i.json():a={error:{message:await i.text(),code:i.status,status:i.statusText}};const r=JSON.stringify(a);throw l>=400&&l<600?new Ga({message:r,status:l}):new Error(r)}}function PC(i,t){if(!t||Object.keys(t).length===0)return;if(i.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let l={};if(typeof i.body=="string"&&i.body.length>0)try{const f=JSON.parse(i.body);if(typeof f=="object"&&f!==null&&!Array.isArray(f))l=f;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function a(f,m){const g=Object.assign({},f);for(const y in m)if(Object.prototype.hasOwnProperty.call(m,y)){const h=m[y],v=g[y];h&&typeof h=="object"&&!Array.isArray(h)&&v&&typeof v=="object"&&!Array.isArray(v)?g[y]=a(v,h):(v&&h&&typeof v!=typeof h&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${y}". Original type: ${typeof v}, New type: ${typeof h}. Overwriting.`),g[y]=h)}return g}const r=a(l,t);i.body=JSON.stringify(r)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const kC="mcp_used/unknown";let OC=!1;function ag(i){for(const t of i)if(FC(t)||typeof t=="object"&&"inputSchema"in t)return!0;return OC}function sg(i){var t;const l=(t=i[Cu])!==null&&t!==void 0?t:"";i[Cu]=(l+` ${kC}`).trimStart()}function FC(i){return i!==null&&typeof i=="object"&&i instanceof Vu}function JC(i){return Pt(this,arguments,function*(l,a=100){let r,f=0;for(;f0)return;const f={},m=[];for(const v of this.mcpClients)try{for(var g=!0,y=(l=void 0,kt(JC(v))),h;h=await y.next(),t=h.done,!t;g=!0){r=h.value,g=!1;const S=r;m.push(S);const E=S.name;if(f[E])throw new Error(`Duplicate function name ${E} found in MCP tools. Please ensure function names are unique.`);f[E]=v}}catch(S){l={error:S}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(l)throw l.error}}this.mcpTools=m,this.functionNameToMcpClient=f}async tool(){return await this.initialize(),CT(this.mcpTools,this.config)}async callTool(t){await this.initialize();const l=[];for(const a of t)if(a.name in this.functionNameToMcpClient){const r=this.functionNameToMcpClient[a.name];let f;this.config.timeout&&(f={timeout:this.config.timeout});const m=await r.callTool({name:a.name,arguments:a.args},void 0,f);l.push({functionResponse:{name:a.name,response:m.isError?{error:m}:m}})}return l}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */async function YC(i,t,l){const a=new hT;let r;l.data instanceof Blob?r=JSON.parse(await l.data.text()):r=JSON.parse(l.data),Object.assign(a,r),t(a)}class XC{constructor(t,l,a){this.apiClient=t,this.auth=l,this.webSocketFactory=a}async connect(t){var l,a;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const r=this.apiClient.getWebsocketBaseUrl(),f=this.apiClient.getApiVersion(),m=ZC(this.apiClient.getDefaultHeaders()),g=this.apiClient.getApiKey(),y=`${r}/ws/google.ai.generativelanguage.${f}.GenerativeService.BidiGenerateMusic?key=${g}`;let h=()=>{};const v=new Promise(k=>{h=k}),S=t.callbacks,E=function(){h({})},C=this.apiClient,w={onopen:E,onmessage:k=>{YC(C,S.onmessage,k)},onerror:(l=S==null?void 0:S.onerror)!==null&&l!==void 0?l:function(k){},onclose:(a=S==null?void 0:S.onclose)!==null&&a!==void 0?a:function(k){}},H=this.webSocketFactory.create(y,QC(m),w);H.connect(),await v;const X={setup:{model:Te(this.apiClient,t.model)}};return H.send(JSON.stringify(X)),new KC(H,this.apiClient)}}class KC{constructor(t,l){this.conn=t,this.apiClient=l}async setWeightedPrompts(t){if(!t.weightedPrompts||Object.keys(t.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const l=SE(t);this.conn.send(JSON.stringify({clientContent:l}))}async setMusicGenerationConfig(t){t.musicGenerationConfig||(t.musicGenerationConfig={});const l=TE(t);this.conn.send(JSON.stringify(l))}sendPlaybackControl(t){const l={playbackControl:t};this.conn.send(JSON.stringify(l))}play(){this.sendPlaybackControl(Zi.PLAY)}pause(){this.sendPlaybackControl(Zi.PAUSE)}stop(){this.sendPlaybackControl(Zi.STOP)}resetContext(){this.sendPlaybackControl(Zi.RESET_CONTEXT)}close(){this.conn.close()}}function QC(i){const t={};return i.forEach((l,a)=>{t[a]=l}),t}function ZC(i){const t=new Headers;for(const[l,a]of Object.entries(i))t.append(l,a);return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const $C="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function WC(i,t,l){const a=new mT;let r;l.data instanceof Blob?r=await l.data.text():l.data instanceof ArrayBuffer?r=new TextDecoder().decode(l.data):r=l.data;const f=JSON.parse(r);if(i.isVertexAI()){const m=CE(f);Object.assign(a,m)}else Object.assign(a,f);t(a)}class jC{constructor(t,l,a){this.apiClient=t,this.auth=l,this.webSocketFactory=a,this.music=new XC(this.apiClient,this.auth,this.webSocketFactory)}async connect(t){var l,a,r,f,m,g;if(t.config&&t.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const y=this.apiClient.getWebsocketBaseUrl(),h=this.apiClient.getApiVersion();let v;const S=this.apiClient.getHeaders();t.config&&t.config.tools&&ag(t.config.tools)&&sg(S);const E=iA(S);if(this.apiClient.isVertexAI())v=`${y}/ws/google.cloud.aiplatform.${h}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(E,v);else{const W=this.apiClient.getApiKey();let de="BidiGenerateContent",Ce="key";W!=null&&W.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),h!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),de="BidiGenerateContentConstrained",Ce="access_token"),v=`${y}/ws/google.ai.generativelanguage.${h}.GenerativeService.${de}?${Ce}=${W}`}let C=()=>{};const w=new Promise(W=>{C=W}),H=t.callbacks,b=function(){var W;(W=H==null?void 0:H.onopen)===null||W===void 0||W.call(H),C({})},P=this.apiClient,X={onopen:b,onmessage:W=>{WC(P,H.onmessage,W)},onerror:(l=H==null?void 0:H.onerror)!==null&&l!==void 0?l:function(W){},onclose:(a=H==null?void 0:H.onclose)!==null&&a!==void 0?a:function(W){}},k=this.webSocketFactory.create(v,nA(E),X);k.connect(),await w;let K=Te(this.apiClient,t.model);if(this.apiClient.isVertexAI()&&K.startsWith("publishers/")){const W=this.apiClient.getProject(),de=this.apiClient.getLocation();K=`projects/${W}/locations/${de}/`+K}let ee={};this.apiClient.isVertexAI()&&((r=t.config)===null||r===void 0?void 0:r.responseModalities)===void 0&&(t.config===void 0?t.config={responseModalities:[xa.AUDIO]}:t.config.responseModalities=[xa.AUDIO]),!((f=t.config)===null||f===void 0)&&f.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");const te=(g=(m=t.config)===null||m===void 0?void 0:m.tools)!==null&&g!==void 0?g:[],F=[];for(const W of te)if(this.isCallableTool(W)){const de=W;F.push(await de.tool())}else F.push(W);F.length>0&&(t.config.tools=F);const he={model:K,config:t.config,callbacks:t.callbacks};return this.apiClient.isVertexAI()?ee=vE(this.apiClient,he):ee=yE(this.apiClient,he),delete ee.config,k.send(JSON.stringify(ee)),new tA(k,this.apiClient)}isCallableTool(t){return"callTool"in t&&typeof t.callTool=="function"}}const eA={turnComplete:!0};class tA{constructor(t,l){this.conn=t,this.apiClient=l}tLiveClientContent(t,l){if(l.turns!==null&&l.turns!==void 0){let a=[];try{a=Ht(l.turns),t.isVertexAI()||(a=a.map(r=>Ha(r)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof l.turns}'`)}return{clientContent:{turns:a,turnComplete:l.turnComplete}}}return{clientContent:{turnComplete:l.turnComplete}}}tLiveClienttToolResponse(t,l){let a=[];if(l.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(l.functionResponses)?a=l.functionResponses:a=[l.functionResponses],a.length===0)throw new Error("functionResponses is required.");for(const f of a){if(typeof f!="object"||f===null||!("name"in f)||!("response"in f))throw new Error(`Could not parse function response, type '${typeof f}'.`);if(!t.isVertexAI()&&!("id"in f))throw new Error($C)}return{toolResponse:{functionResponses:a}}}sendClientContent(t){t=Object.assign(Object.assign({},eA),t);const l=this.tLiveClientContent(this.apiClient,t);this.conn.send(JSON.stringify(l))}sendRealtimeInput(t){let l={};this.apiClient.isVertexAI()?l={realtimeInput:_E(t)}:l={realtimeInput:EE(t)},this.conn.send(JSON.stringify(l))}sendToolResponse(t){if(t.functionResponses==null)throw new Error("Tool response parameters are required.");const l=this.tLiveClienttToolResponse(this.apiClient,t);this.conn.send(JSON.stringify(l))}close(){this.conn.close()}}function nA(i){const t={};return i.forEach((l,a)=>{t[a]=l}),t}function iA(i){const t=new Headers;for(const[l,a]of Object.entries(i))t.append(l,a);return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Eh=10;function _h(i){var t,l,a;if(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let r=!1;for(const m of(l=i==null?void 0:i.tools)!==null&&l!==void 0?l:[])if(ji(m)){r=!0;break}if(!r)return!0;const f=(a=i==null?void 0:i.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls;return f&&(f<0||!Number.isInteger(f))||f==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",f),!0):!1}function ji(i){return"callTool"in i&&typeof i.callTool=="function"}function oA(i){var t,l,a;return(a=(l=(t=i.config)===null||t===void 0?void 0:t.tools)===null||l===void 0?void 0:l.some(r=>ji(r)))!==null&&a!==void 0?a:!1}function Ch(i){var t;const l=[];return!((t=i==null?void 0:i.config)===null||t===void 0)&&t.tools&&i.config.tools.forEach((a,r)=>{if(ji(a))return;const f=a;f.functionDeclarations&&f.functionDeclarations.length>0&&l.push(r)}),l}function Ah(i){var t;return!(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.ignoreCallHistory)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class lA extends hn{constructor(t){super(),this.apiClient=t,this.generateContent=async l=>{var a,r,f,m,g;const y=await this.processParamsMaybeAddMcpUsage(l);if(this.maybeMoveToResponseJsonSchem(l),!oA(l)||_h(l.config))return await this.generateContentInternal(y);const h=Ch(l);if(h.length>0){const H=h.map(b=>`tools[${b}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${H}.`)}let v,S;const E=Ht(y.contents),C=(f=(r=(a=y.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls)!==null&&f!==void 0?f:Eh;let w=0;for(;w{var a,r,f,m,g;if(this.maybeMoveToResponseJsonSchem(l),_h(l.config)){const S=await this.processParamsMaybeAddMcpUsage(l);return await this.generateContentStreamInternal(S)}const y=Ch(l);if(y.length>0){const S=y.map(E=>`tools[${E}]`).join(", ");throw new Error(`Incompatible tools found at ${S}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const h=(f=(r=(a=l==null?void 0:l.config)===null||a===void 0?void 0:a.toolConfig)===null||r===void 0?void 0:r.functionCallingConfig)===null||f===void 0?void 0:f.streamFunctionCallArguments,v=(g=(m=l==null?void 0:l.config)===null||m===void 0?void 0:m.automaticFunctionCalling)===null||g===void 0?void 0:g.disable;if(h&&!v)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(l)},this.generateImages=async l=>await this.generateImagesInternal(l).then(a=>{var r;let f;const m=[];if(a!=null&&a.generatedImages)for(const y of a.generatedImages)y&&(y!=null&&y.safetyAttributes)&&((r=y==null?void 0:y.safetyAttributes)===null||r===void 0?void 0:r.contentType)==="Positive Prompt"?f=y==null?void 0:y.safetyAttributes:m.push(y);let g;return f?g={generatedImages:m,positivePromptSafetyAttributes:f,sdkHttpResponse:a.sdkHttpResponse}:g={generatedImages:m,sdkHttpResponse:a.sdkHttpResponse},g}),this.list=async l=>{var a;const m={config:Object.assign(Object.assign({},{queryBase:!0}),l==null?void 0:l.config)};if(this.apiClient.isVertexAI()&&!m.config.queryBase){if(!((a=m.config)===null||a===void 0)&&a.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");m.config.filter="labels.tune-type:*"}return new ci(mn.PAGED_ITEM_MODELS,g=>this.listInternal(g),await this.listInternal(m),m)},this.editImage=async l=>{const a={model:l.model,prompt:l.prompt,referenceImages:[],config:l.config};return l.referenceImages&&l.referenceImages&&(a.referenceImages=l.referenceImages.map(r=>r.toReferenceImageAPI())),await this.editImageInternal(a)},this.upscaleImage=async l=>{let a={numberOfImages:1,mode:"upscale"};l.config&&(a=Object.assign(Object.assign({},a),l.config));const r={model:l.model,image:l.image,upscaleFactor:l.upscaleFactor,config:a};return await this.upscaleImageInternal(r)},this.generateVideos=async l=>{var a,r,f,m,g,y;if((l.prompt||l.image||l.video)&&l.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((a=l.video)===null||a===void 0)&&a.uri&&(!((r=l.video)===null||r===void 0)&&r.videoBytes)?l.video={uri:l.video.uri,mimeType:l.video.mimeType}:!((m=(f=l.source)===null||f===void 0?void 0:f.video)===null||m===void 0)&&m.uri&&(!((y=(g=l.source)===null||g===void 0?void 0:g.video)===null||y===void 0)&&y.videoBytes)&&(l.source.video={uri:l.source.video.uri,mimeType:l.source.video.mimeType})),await this.generateVideosInternal(l)}}maybeMoveToResponseJsonSchem(t){t.config&&t.config.responseSchema&&(t.config.responseJsonSchema||Object.keys(t.config.responseSchema).includes("$schema")&&(t.config.responseJsonSchema=t.config.responseSchema,delete t.config.responseSchema))}async processParamsMaybeAddMcpUsage(t){var l,a,r;const f=(l=t.config)===null||l===void 0?void 0:l.tools;if(!f)return t;const m=await Promise.all(f.map(async y=>ji(y)?await y.tool():y)),g={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:m})};if(g.config.tools=m,t.config&&t.config.tools&&ag(t.config.tools)){const y=(r=(a=t.config.httpOptions)===null||a===void 0?void 0:a.headers)!==null&&r!==void 0?r:{};let h=Object.assign({},y);Object.keys(h).length===0&&(h=this.apiClient.getDefaultHeaders()),sg(h),g.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:h})}return g}async initAfcToolsMap(t){var l,a,r;const f=new Map;for(const m of(a=(l=t.config)===null||l===void 0?void 0:l.tools)!==null&&a!==void 0?a:[])if(ji(m)){const g=m,y=await g.tool();for(const h of(r=y.functionDeclarations)!==null&&r!==void 0?r:[]){if(!h.name)throw new Error("Function declaration name is required.");if(f.has(h.name))throw new Error(`Duplicate tool declaration name: ${h.name}`);f.set(h.name,g)}}return f}async processAfcStream(t){var l,a,r;const f=(r=(a=(l=t.config)===null||l===void 0?void 0:l.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls)!==null&&r!==void 0?r:Eh;let m=!1,g=0;const y=await this.initAfcToolsMap(t);return(function(h,v,S){return Pt(this,arguments,function*(){for(var E,C,w,H,b,P;g0){m=!0;const W=new jo;W.candidates=[{content:{role:"user",parts:F}}],yield yield oe(W);const de=[];de.push(...he),de.push({role:"user",parts:F});const Ce=Ht(S.contents).concat(de);S.contents=Ce}else break}})})(this,y,t)}async generateContentInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=yh(this.apiClient,t);return g=Y("{model}:generateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=Th(v),E=new jo;return Object.assign(E,S),E})}else{const h=gh(this.apiClient,t);return g=Y("{model}:generateContent",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=vh(v),E=new jo;return Object.assign(E,S),E})}}async generateContentStreamInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=yh(this.apiClient,t);return g=Y("{model}:streamGenerateContent?alt=sse",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}),m.then(function(S){return Pt(this,arguments,function*(){var E,C,w,H;try{for(var b=!0,P=kt(S),X;X=yield oe(P.next()),E=X.done,!E;b=!0){H=X.value,b=!1;const k=H,K=Th(yield oe(k.json()));K.sdkHttpResponse={headers:k.headers};const ee=new jo;Object.assign(ee,K),yield yield oe(ee)}}catch(k){C={error:k}}finally{try{!b&&!E&&(w=P.return)&&(yield oe(w.call(P)))}finally{if(C)throw C.error}}})})}else{const h=gh(this.apiClient,t);return g=Y("{model}:streamGenerateContent?alt=sse",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}),m.then(function(S){return Pt(this,arguments,function*(){var E,C,w,H;try{for(var b=!0,P=kt(S),X;X=yield oe(P.next()),E=X.done,!E;b=!0){H=X.value,b=!1;const k=H,K=vh(yield oe(k.json()));K.sdkHttpResponse={headers:k.headers};const ee=new jo;Object.assign(ee,K),yield yield oe(ee)}}catch(k){C={error:k}}finally{try{!b&&!E&&(w=P.return)&&(yield oe(w.call(P)))}finally{if(C)throw C.error}}})})}}async embedContent(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=jE(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=t_(v),E=new jm;return Object.assign(E,S),E})}else{const h=WE(this.apiClient,t);return g=Y("{model}:batchEmbedContents",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=e_(v),E=new jm;return Object.assign(E,S),E})}}async generateImagesInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=d_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=m_(v),E=new eh;return Object.assign(E,S),E})}else{const h=f_(this.apiClient,t);return g=Y("{model}:predict",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=p_(v),E=new eh;return Object.assign(E,S),E})}}async editImageInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=KE(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=QE(y),v=new iT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=dC(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=pC(y),v=new oT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=X_(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=K_(y),v=new lT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=eC(this.apiClient,t);return f=Y("{model}:predict",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=tC(y),v=new aT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async get(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=w_(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>_u(v))}else{const h=D_(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Eu(v))}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=B_(this.apiClient,t);return g=Y("{models_url}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=k_(v),E=new th;return Object.assign(E,S),E})}else{const h=z_(this.apiClient,t);return g=Y("{models_url}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=P_(v),E=new th;return Object.assign(E,S),E})}}async update(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=cC(this.apiClient,t);return g=Y("{model}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>_u(v))}else{const h=uC(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>Eu(v))}}async delete(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=FE(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=YE(v),E=new nh;return Object.assign(E,S),E})}else{const h=OE(this.apiClient,t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=JE(v),E=new nh;return Object.assign(E,S),E})}}async countTokens(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=BE(this.apiClient,t);return g=Y("{model}:countTokens",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=kE(v),E=new ih;return Object.assign(E,S),E})}else{const h=zE(this.apiClient,t);return g=Y("{model}:countTokens",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=PE(v),E=new ih;return Object.assign(E,S),E})}}async computeTokens(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=UE(this.apiClient,t);return f=Y("{model}:computeTokens",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const h=bE(y),v=new sT;return Object.assign(v,h),v})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=S_(this.apiClient,t);return g=Y("{model}:predictLongRunning",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m.then(v=>{const S=v_(v),E=new Da;return Object.assign(E,S),E})}else{const h=T_(this.apiClient,t);return g=Y("{model}:predictLongRunning",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m.then(v=>{const S=y_(v),E=new Da;return Object.assign(E,S),E})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class aA extends hn{constructor(t){super(),this.apiClient=t}async getVideosOperation(t){const l=t.operation,a=t.config;if(l.name===void 0||l.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=l.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const m=await this.fetchPredictVideosOperationInternal({operationName:l.name,resourceName:r,config:{httpOptions:f}});return l._fromAPIResponse({apiResponse:m,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:l.name,config:a});return l._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async get(t){const l=t.operation,a=t.config;if(l.name===void 0||l.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=l.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const m=await this.fetchPredictVideosOperationInternal({operationName:l.name,resourceName:r,config:{httpOptions:f}});return l._fromAPIResponse({apiResponse:m,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:l.name,config:a});return l._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async getVideosOperationInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=$0(t);return g=Y("{operationName}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),m}else{const h=Z0(t);return g=Y("{operationName}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),m}}async fetchPredictVideosOperationInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=O0(t);return f=Y("{resourceName}:fetchPredictOperation",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r}else throw new Error("This method is only supported by the Vertex AI.")}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function sA(i){const t={},l=u(i,["data"]);if(l!=null&&c(t,["data"],l),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function rA(i){const t={},l=u(i,["parts"]);if(l!=null){let r=l;Array.isArray(r)&&(r=r.map(f=>yA(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function uA(i,t,l){const a={},r=u(t,["expireTime"]);l!==void 0&&r!=null&&c(l,["expireTime"],r);const f=u(t,["newSessionExpireTime"]);l!==void 0&&f!=null&&c(l,["newSessionExpireTime"],f);const m=u(t,["uses"]);l!==void 0&&m!=null&&c(l,["uses"],m);const g=u(t,["liveConnectConstraints"]);l!==void 0&&g!=null&&c(l,["bidiGenerateContentSetup"],gA(i,g));const y=u(t,["lockAdditionalFields"]);return l!==void 0&&y!=null&&c(l,["fieldMask"],y),a}function cA(i,t){const l={},a=u(t,["config"]);return a!=null&&c(l,["config"],uA(i,a,l)),l}function fA(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const l=u(i,["fileUri"]);l!=null&&c(t,["fileUri"],l);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function dA(i){const t={},l=u(i,["id"]);l!=null&&c(t,["id"],l);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function pA(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const l=u(i,["enableWidget"]);return l!=null&&c(t,["enableWidget"],l),t}function mA(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const l=u(i,["timeRangeFilter"]);return l!=null&&c(t,["timeRangeFilter"],l),t}function hA(i,t){const l={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const m=u(i,["topP"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","topP"],m);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const h=u(i,["mediaResolution"]);t!==void 0&&h!=null&&c(t,["setup","generationConfig","mediaResolution"],h);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const S=u(i,["speechConfig"]);t!==void 0&&S!=null&&c(t,["setup","generationConfig","speechConfig"],qu(S));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const C=u(i,["enableAffectiveDialog"]);t!==void 0&&C!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],C);const w=u(i,["systemInstruction"]);t!==void 0&&w!=null&&c(t,["setup","systemInstruction"],rA(it(w)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let te=to(H);Array.isArray(te)&&(te=te.map(F=>TA(eo(F)))),c(t,["setup","tools"],te)}const b=u(i,["sessionResumption"]);t!==void 0&&b!=null&&c(t,["setup","sessionResumption"],vA(b));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const X=u(i,["outputAudioTranscription"]);t!==void 0&&X!=null&&c(t,["setup","outputAudioTranscription"],X);const k=u(i,["realtimeInputConfig"]);t!==void 0&&k!=null&&c(t,["setup","realtimeInputConfig"],k);const K=u(i,["contextWindowCompression"]);t!==void 0&&K!=null&&c(t,["setup","contextWindowCompression"],K);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return l}function gA(i,t){const l={},a=u(t,["model"]);a!=null&&c(l,["setup","model"],Te(i,a));const r=u(t,["config"]);return r!=null&&c(l,["config"],hA(r,l)),l}function yA(i){const t={},l=u(i,["mediaResolution"]);l!=null&&c(t,["mediaResolution"],l);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],fA(f));const m=u(i,["functionCall"]);m!=null&&c(t,["functionCall"],dA(m));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],sA(y));const h=u(i,["text"]);h!=null&&c(t,["text"],h);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const S=u(i,["thoughtSignature"]);S!=null&&c(t,["thoughtSignature"],S);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function vA(i){const t={},l=u(i,["handle"]);if(l!=null&&c(t,["handle"],l),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function TA(i){const t={},l=u(i,["functionDeclarations"]);if(l!=null){let v=l;Array.isArray(v)&&(v=v.map(S=>S)),c(t,["functionDeclarations"],v)}if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["googleSearchRetrieval"]);a!=null&&c(t,["googleSearchRetrieval"],a);const r=u(i,["computerUse"]);r!=null&&c(t,["computerUse"],r);const f=u(i,["fileSearch"]);f!=null&&c(t,["fileSearch"],f);const m=u(i,["codeExecution"]);if(m!=null&&c(t,["codeExecution"],m),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],pA(g));const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],mA(y));const h=u(i,["urlContext"]);return h!=null&&c(t,["urlContext"],h),t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function SA(i){const t=[];for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const a=i[l];if(typeof a=="object"&&a!=null&&Object.keys(a).length>0){const r=Object.keys(a).map(f=>`${l}.${f}`);t.push(...r)}else t.push(l)}return t.join(",")}function EA(i,t){let l=null;const a=i.bidiGenerateContentSetup;if(typeof a=="object"&&a!==null&&"setup"in a){const f=a.setup;typeof f=="object"&&f!==null?(i.bidiGenerateContentSetup=f,l=f):delete i.bidiGenerateContentSetup}else a!==void 0&&delete i.bidiGenerateContentSetup;const r=i.fieldMask;if(l){const f=SA(l);if(Array.isArray(t==null?void 0:t.lockAdditionalFields)&&(t==null?void 0:t.lockAdditionalFields.length)===0)f?i.fieldMask=f:delete i.fieldMask;else if(t!=null&&t.lockAdditionalFields&&t.lockAdditionalFields.length>0&&r!==null&&Array.isArray(r)&&r.length>0){const m=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let g=[];r.length>0&&(g=r.map(h=>m.includes(h)?`generationConfig.${h}`:h));const y=[];f&&y.push(f),g.length>0&&y.push(...g),y.length>0?i.fieldMask=y.join(","):delete i.fieldMask}else delete i.fieldMask}else r!==null&&Array.isArray(r)&&r.length>0?i.fieldMask=r.join(","):delete i.fieldMask;return i}class _A extends hn{constructor(t){super(),this.apiClient=t}async create(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const g=cA(this.apiClient,t);f=Y("auth_tokens",g._url),m=g._query,delete g.config,delete g._url,delete g._query;const y=EA(g,t.config);return r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(h=>h.json()),r.then(h=>h)}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function CA(i,t){const l={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),l}function AA(i){const t={},l=u(i,["name"]);l!=null&&c(t,["_url","name"],l);const a=u(i,["config"]);return a!=null&&CA(a,t),t}function RA(i){const t={},l=u(i,["name"]);return l!=null&&c(t,["_url","name"],l),t}function MA(i,t){const l={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),l}function NA(i){const t={},l=u(i,["parent"]);l!=null&&c(t,["_url","parent"],l);const a=u(i,["config"]);return a!=null&&MA(a,t),t}function IA(i){const t={},l=u(i,["sdkHttpResponse"]);l!=null&&c(t,["sdkHttpResponse"],l);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["documents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(m=>m)),c(t,["documents"],f)}return t}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class xA extends hn{constructor(t){super(),this.apiClient=t,this.list=async l=>new ci(mn.PAGED_ITEM_DOCUMENTS,a=>this.listInternal({parent:l.parent,config:a.config}),await this.listInternal(l),l)}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=RA(t);return f=Y("{name}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const m=AA(t);r=Y("{name}",m._url),f=m._query,delete m._url,delete m._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=NA(t);return f=Y("{parent}/documents",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=IA(y),v=new rT;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class DA extends hn{constructor(t,l=new xA(t)){super(),this.apiClient=t,this.documents=l,this.list=async(a={})=>new ci(mn.PAGED_ITEM_FILE_SEARCH_STORES,r=>this.listInternal(r),await this.listInternal(a),a)}async uploadToFileSearchStore(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(t.fileSearchStoreName,t.file,t.config)}async create(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=SC(t);return f=Y("fileSearchStores",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async get(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=CC(t);return f=Y("{name}",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var l,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const m=_C(t);r=Y("{name}",m._url),f=m._query,delete m._url,delete m._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=xC(t);return f=Y("fileSearchStores",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=DC(y),v=new uT;return Object.assign(v,h),v})}}async uploadToFileSearchStoreInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=wC(t);return f=Y("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=UC(y),v=new cT;return Object.assign(v,h),v})}}async importFile(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=MC(t);return f=Y("{file_search_store_name}:importFile",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const h=RC(y),v=new Uu;return Object.assign(v,h),v})}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */let rg=function(){const{crypto:i}=globalThis;if(i!=null&&i.randomUUID)return rg=i.randomUUID.bind(i),i.randomUUID();const t=new Uint8Array(1),l=i?()=>i.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(+a^l()&15>>+a/4).toString(16))};const wA=()=>rg();/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Au(i){return typeof i=="object"&&i!==null&&("name"in i&&i.name==="AbortError"||"message"in i&&String(i.message).includes("FetchRequestCanceledException"))}const Ru=i=>{if(i instanceof Error)return i;if(typeof i=="object"&&i!==null){try{if(Object.prototype.toString.call(i)==="[object Error]"){const t=new Error(i.message,i.cause?{cause:i.cause}:{});return i.stack&&(t.stack=i.stack),i.cause&&!t.cause&&(t.cause=i.cause),i.name&&(t.name=i.name),t}}catch{}try{return new Error(JSON.stringify(i))}catch{}}return new Error(i)};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class qt extends Error{}class st extends qt{constructor(t,l,a,r){super(`${st.makeMessage(t,l,a)}`),this.status=t,this.headers=r,this.error=l}static makeMessage(t,l,a){const r=l!=null&&l.message?typeof l.message=="string"?l.message:JSON.stringify(l.message):l?JSON.stringify(l):a;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,l,a,r){if(!t||!r)return new za({message:a,cause:Ru(l)});const f=l;return t===400?new cg(t,f,a,r):t===401?new fg(t,f,a,r):t===403?new dg(t,f,a,r):t===404?new pg(t,f,a,r):t===409?new mg(t,f,a,r):t===422?new hg(t,f,a,r):t===429?new gg(t,f,a,r):t>=500?new yg(t,f,a,r):new st(t,f,a,r)}}class Mu extends st{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class za extends st{constructor({message:t,cause:l}){super(void 0,void 0,t||"Connection error.",void 0),l&&(this.cause=l)}}class ug extends za{constructor({message:t}={}){super({message:t??"Request timed out."})}}class cg extends st{}class fg extends st{}class dg extends st{}class pg extends st{}class mg extends st{}class hg extends st{}class gg extends st{}class yg extends st{}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const UA=/^[a-z][a-z0-9+.-]*:/i,bA=i=>UA.test(i);let Nu=i=>(Nu=Array.isArray,Nu(i));const LA=Nu;let GA=LA;const Rh=GA;function HA(i){if(!i)return!0;for(const t in i)return!1;return!0}function qA(i,t){return Object.prototype.hasOwnProperty.call(i,t)}const VA=(i,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new qt(`${i} must be an integer`);if(t<0)throw new qt(`${i} must be a positive integer`);return t},zA=i=>{try{return JSON.parse(i)}catch{return}};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const BA=i=>new Promise(t=>setTimeout(t,i));/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Qi="0.0.1";/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function PA(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const kA=()=>{var i,t,l,a,r;const f=PA();if(f==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":Nh(Deno.build.os),"X-Stainless-Arch":Mh(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(t=(i=Deno.version)===null||i===void 0?void 0:i.deno)!==null&&t!==void 0?t:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(f==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":Nh((l=globalThis.process.platform)!==null&&l!==void 0?l:"unknown"),"X-Stainless-Arch":Mh((a=globalThis.process.arch)!==null&&a!==void 0?a:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(r=globalThis.process.version)!==null&&r!==void 0?r:"unknown"};const m=OA();return m?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${m.browser}`,"X-Stainless-Runtime-Version":m.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function OA(){if(typeof navigator>"u"||!navigator)return null;const i=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:l}of i){const a=l.exec(navigator.userAgent);if(a){const r=a[1]||0,f=a[2]||0,m=a[3]||0;return{browser:t,version:`${r}.${f}.${m}`}}}return null}const Mh=i=>i==="x32"?"x32":i==="x86_64"||i==="x64"?"x64":i==="arm"?"arm":i==="aarch64"||i==="arm64"?"arm64":i?`other:${i}`:"unknown",Nh=i=>(i=i.toLowerCase(),i.includes("ios")?"iOS":i==="android"?"Android":i==="darwin"?"MacOS":i==="win32"?"Windows":i==="freebsd"?"FreeBSD":i==="openbsd"?"OpenBSD":i==="linux"?"Linux":i?`Other:${i}`:"Unknown");let _a;const FA=()=>_a??(_a=kA());/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function JA(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function vg(...i){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...i)}function YA(i){let t=Symbol.asyncIterator in i?i[Symbol.asyncIterator]():i[Symbol.iterator]();return vg({start(){},async pull(l){const{done:a,value:r}=await t.next();a?l.close():l.enqueue(r)},async cancel(){var l;await((l=t.return)===null||l===void 0?void 0:l.call(t))}})}function Tg(i){if(i[Symbol.asyncIterator])return i;const t=i.getReader();return{async next(){try{const l=await t.read();return l!=null&&l.done&&t.releaseLock(),l}catch(l){throw t.releaseLock(),l}},async return(){const l=t.cancel();return t.releaseLock(),await l,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function XA(i){var t,l;if(i===null||typeof i!="object")return;if(i[Symbol.asyncIterator]){await((l=(t=i[Symbol.asyncIterator]()).return)===null||l===void 0?void 0:l.call(t));return}const a=i.getReader(),r=a.cancel();a.releaseLock(),await r}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const KA=({headers:i,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Sg=()=>{var i;if(typeof File>"u"){const{process:t}=globalThis,l=typeof((i=t==null?void 0:t.versions)===null||i===void 0?void 0:i.node)=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(l?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function mu(i,t,l){return Sg(),new File(i,t??"unknown_file",l)}function QA(i){return(typeof i=="object"&&i!==null&&("name"in i&&i.name&&String(i.name)||"url"in i&&i.url&&String(i.url)||"filename"in i&&i.filename&&String(i.filename)||"path"in i&&i.path&&String(i.path))||"").split(/[\\/]/).pop()||void 0}const ZA=i=>i!=null&&typeof i=="object"&&typeof i[Symbol.asyncIterator]=="function";/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Eg=i=>i!=null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.type=="string"&&typeof i.text=="function"&&typeof i.slice=="function"&&typeof i.arrayBuffer=="function",$A=i=>i!=null&&typeof i=="object"&&typeof i.name=="string"&&typeof i.lastModified=="number"&&Eg(i),WA=i=>i!=null&&typeof i=="object"&&typeof i.url=="string"&&typeof i.blob=="function";async function jA(i,t,l){if(Sg(),i=await i,$A(i))return i instanceof File?i:mu([await i.arrayBuffer()],i.name);if(WA(i)){const r=await i.blob();return t||(t=new URL(i.url).pathname.split(/[\\/]/).pop()),mu(await Iu(r),t,l)}const a=await Iu(i);if(t||(t=QA(i)),!(l!=null&&l.type)){const r=a.find(f=>typeof f=="object"&&"type"in f&&f.type);typeof r=="string"&&(l=Object.assign(Object.assign({},l),{type:r}))}return mu(a,t,l)}async function Iu(i){var t,l,a,r,f;let m=[];if(typeof i=="string"||ArrayBuffer.isView(i)||i instanceof ArrayBuffer)m.push(i);else if(Eg(i))m.push(i instanceof Blob?i:await i.arrayBuffer());else if(ZA(i))try{for(var g=!0,y=kt(i),h;h=await y.next(),t=h.done,!t;g=!0){r=h.value,g=!1;const v=r;m.push(...await Iu(v))}}catch(v){l={error:v}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(l)throw l.error}}else{const v=(f=i==null?void 0:i.constructor)===null||f===void 0?void 0:f.name;throw new Error(`Unexpected data type: ${typeof i}${v?`; constructor: ${v}`:""}${eR(i)}`)}return m}function eR(i){return typeof i!="object"||i===null?"":`; props: [${Object.getOwnPropertyNames(i).map(l=>`"${l}"`).join(", ")}]`}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class _g{constructor(t){this._client=t}}_g._key=[];/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function Cg(i){return i.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const Ih=Object.freeze(Object.create(null)),tR=(i=Cg)=>(function(l,...a){if(l.length===1)return l[0];let r=!1;const f=[],m=l.reduce((v,S,E)=>{var C,w,H;/[?#]/.test(S)&&(r=!0);const b=a[E];let P=(r?encodeURIComponent:i)(""+b);return E!==a.length&&(b==null||typeof b=="object"&&b.toString===((H=Object.getPrototypeOf((w=Object.getPrototypeOf((C=b.hasOwnProperty)!==null&&C!==void 0?C:Ih))!==null&&w!==void 0?w:Ih))===null||H===void 0?void 0:H.toString))&&(P=b+"",f.push({start:v.length+S.length,length:P.length,error:`Value of type ${Object.prototype.toString.call(b).slice(8,-1)} is not a valid path parameter`})),v+S+(E===a.length?"":P)},""),g=m.split(/[?#]/,1)[0],y=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let h;for(;(h=y.exec(g))!==null;)f.push({start:h.index,length:h[0].length,error:`Value "${h[0]}" can't be safely passed as a path parameter`});if(f.sort((v,S)=>v.start-S.start),f.length>0){let v=0;const S=f.reduce((E,C)=>{const w=" ".repeat(C.start-v),H="^".repeat(C.length);return v=C.start+C.length,E+w+H},"");throw new qt(`Path parameters result in path with invalid segments: +${f.map(E=>E.error).join(` +`)} +${m} +${S}`)}return m}),Ca=tR(Cg);/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Ag extends _g{create(t,l){var a;const{api_version:r=this._client.apiVersion}=t,f=Ua(t,["api_version"]);if("model"in f&&"agent_config"in f)throw new qt("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in f&&"generation_config"in f)throw new qt("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(Ca`/${r}/interactions`,Object.assign(Object.assign({body:f},l),{stream:(a=t.stream)!==null&&a!==void 0?a:!1}))}delete(t,l={},a){const{api_version:r=this._client.apiVersion}=l??{};return this._client.delete(Ca`/${r}/interactions/${t}`,a)}cancel(t,l={},a){const{api_version:r=this._client.apiVersion}=l??{};return this._client.post(Ca`/${r}/interactions/${t}/cancel`,a)}get(t,l={},a){var r;const f=l??{},{api_version:m=this._client.apiVersion}=f,g=Ua(f,["api_version"]);return this._client.get(Ca`/${m}/interactions/${t}`,Object.assign(Object.assign({query:g},a),{stream:(r=l==null?void 0:l.stream)!==null&&r!==void 0?r:!1}))}}Ag._key=Object.freeze(["interactions"]);class Rg extends Ag{}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function nR(i){let t=0;for(const r of i)t+=r.length;const l=new Uint8Array(t);let a=0;for(const r of i)l.set(r,a),a+=r.length;return l}let Aa;function zu(i){let t;return(Aa??(t=new globalThis.TextEncoder,Aa=t.encode.bind(t)))(i)}let Ra;function xh(i){let t;return(Ra??(t=new globalThis.TextDecoder,Ra=t.decode.bind(t)))(i)}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Ba{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(t){if(t==null)return[];const l=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?zu(t):t;this.buffer=nR([this.buffer,l]);const a=[];let r;for(;(r=iR(this.buffer,this.carriageReturnIndex))!=null;){if(r.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=r.index;continue}if(this.carriageReturnIndex!=null&&(r.index!==this.carriageReturnIndex+1||r.carriage)){a.push(xh(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}const f=this.carriageReturnIndex!==null?r.preceding-1:r.preceding,m=xh(this.buffer.subarray(0,f));a.push(m),this.buffer=this.buffer.subarray(r.index),this.carriageReturnIndex=null}return a}flush(){return this.buffer.length?this.decode(` +`):[]}}Ba.NEWLINE_CHARS=new Set([` +`,"\r"]);Ba.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function iR(i,t){for(let r=t??0;r{if(i){if(qA(ba,i))return i;at(l).warn(`${t} was set to ${JSON.stringify(i)}, expected one of ${JSON.stringify(Object.keys(ba))}`)}};function tl(){}function Ma(i,t,l){return!t||ba[i]>ba[l]?tl:t[i].bind(t)}const lR={error:tl,warn:tl,info:tl,debug:tl};let wh=new WeakMap;function at(i){var t;const l=i.logger,a=(t=i.logLevel)!==null&&t!==void 0?t:"off";if(!l)return lR;const r=wh.get(l);if(r&&r[0]===a)return r[1];const f={error:Ma("error",l,a),warn:Ma("warn",l,a),info:Ma("info",l,a),debug:Ma("debug",l,a)};return wh.set(l,[a,f]),f}const ui=i=>(i.options&&(i.options=Object.assign({},i.options),delete i.options.headers),i.headers&&(i.headers=Object.fromEntries((i.headers instanceof Headers?[...i.headers]:Object.entries(i.headers)).map(([t,l])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":l]))),"retryOfRequestLogID"in i&&(i.retryOfRequestLogID&&(i.retryOf=i.retryOfRequestLogID),delete i.retryOfRequestLogID),i);/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class $i{constructor(t,l,a){this.iterator=t,this.controller=l,this.client=a}static fromSSEResponse(t,l,a){let r=!1;const f=a?at(a):console;function m(){return Pt(this,arguments,function*(){var y,h,v,S;if(r)throw new qt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var C=!0,w=kt(aR(t,l)),H;H=yield oe(w.next()),y=H.done,!y;C=!0){S=H.value,C=!1;const b=S;if(!E)if(b.data.startsWith("[DONE]")){E=!0;continue}else try{yield yield oe(JSON.parse(b.data))}catch(P){throw f.error("Could not parse message into JSON:",b.data),f.error("From chunk:",b.raw),P}}}catch(b){h={error:b}}finally{try{!C&&!y&&(v=w.return)&&(yield oe(v.call(w)))}finally{if(h)throw h.error}}E=!0}catch(b){if(Au(b))return yield oe(void 0);throw b}finally{E||l.abort()}})}return new $i(m,l,a)}static fromReadableStream(t,l,a){let r=!1;function f(){return Pt(this,arguments,function*(){var y,h,v,S;const E=new Ba,C=Tg(t);try{for(var w=!0,H=kt(C),b;b=yield oe(H.next()),y=b.done,!y;w=!0){S=b.value,w=!1;const P=S;for(const X of E.decode(P))yield yield oe(X)}}catch(P){h={error:P}}finally{try{!w&&!y&&(v=H.return)&&(yield oe(v.call(H)))}finally{if(h)throw h.error}}for(const P of E.flush())yield yield oe(P)})}function m(){return Pt(this,arguments,function*(){var y,h,v,S;if(r)throw new qt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var C=!0,w=kt(f()),H;H=yield oe(w.next()),y=H.done,!y;C=!0){S=H.value,C=!1;const b=S;E||b&&(yield yield oe(JSON.parse(b)))}}catch(b){h={error:b}}finally{try{!C&&!y&&(v=w.return)&&(yield oe(v.call(w)))}finally{if(h)throw h.error}}E=!0}catch(b){if(Au(b))return yield oe(void 0);throw b}finally{E||l.abort()}})}return new $i(m,l,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],l=[],a=this.iterator(),r=f=>({next:()=>{if(f.length===0){const m=a.next();t.push(m),l.push(m)}return f.shift()}});return[new $i(()=>r(t),this.controller,this.client),new $i(()=>r(l),this.controller,this.client)]}toReadableStream(){const t=this;let l;return vg({async start(){l=t[Symbol.asyncIterator]()},async pull(a){try{const{value:r,done:f}=await l.next();if(f)return a.close();const m=zu(JSON.stringify(r)+` +`);a.enqueue(m)}catch(r){a.error(r)}},async cancel(){var a;await((a=l.return)===null||a===void 0?void 0:a.call(l))}})}}function aR(i,t){return Pt(this,arguments,function*(){var a,r,f,m;if(!i.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new qt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new qt("Attempted to iterate over a response with no body");const g=new rR,y=new Ba,h=Tg(i.body);try{for(var v=!0,S=kt(sR(h)),E;E=yield oe(S.next()),a=E.done,!a;v=!0){m=E.value,v=!1;const C=m;for(const w of y.decode(C)){const H=g.decode(w);H&&(yield yield oe(H))}}}catch(C){r={error:C}}finally{try{!v&&!a&&(f=S.return)&&(yield oe(f.call(S)))}finally{if(r)throw r.error}}for(const C of y.flush()){const w=g.decode(C);w&&(yield yield oe(w))}})}function sR(i){return Pt(this,arguments,function*(){var l,a,r,f;let m=new Uint8Array;try{for(var g=!0,y=kt(i),h;h=yield oe(y.next()),l=h.done,!l;g=!0){f=h.value,g=!1;const v=f;if(v==null)continue;const S=v instanceof ArrayBuffer?new Uint8Array(v):typeof v=="string"?zu(v):v;let E=new Uint8Array(m.length+S.length);E.set(m),E.set(S,m.length),m=E;let C;for(;(C=oR(m))!==-1;)yield yield oe(m.slice(0,C)),m=m.slice(C)}}catch(v){a={error:v}}finally{try{!g&&!l&&(r=y.return)&&(yield oe(r.call(y)))}finally{if(a)throw a.error}}m.length>0&&(yield yield oe(m))})}class rR{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;const f={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],f}if(this.chunks.push(t),t.startsWith(":"))return null;let[l,a,r]=uR(t,":");return r.startsWith(" ")&&(r=r.substring(1)),l==="event"?this.event=r:l==="data"&&this.data.push(r),null}}function uR(i,t){const l=i.indexOf(t);return l!==-1?[i.substring(0,l),t,i.substring(l+t.length)]:[i,"",""]}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */async function cR(i,t){const{response:l,requestLogID:a,retryOfRequestLogID:r,startTime:f}=t,m=await(async()=>{var g;if(t.options.stream)return at(i).debug("response",l.status,l.url,l.headers,l.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(l,t.controller,i):$i.fromSSEResponse(l,t.controller,i);if(l.status===204)return null;if(t.options.__binaryResponse)return l;const y=l.headers.get("content-type"),h=(g=y==null?void 0:y.split(";")[0])===null||g===void 0?void 0:g.trim();return(h==null?void 0:h.includes("application/json"))||(h==null?void 0:h.endsWith("+json"))?await l.json():await l.text()})();return at(i).debug(`[${a}] response parsed`,ui({retryOfRequestLogID:r,url:l.url,status:l.status,body:m,durationMs:Date.now()-f})),m}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class Bu extends Promise{constructor(t,l,a=cR){super(r=>{r(null)}),this.responsePromise=l,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new Bu(this.client,this.responsePromise,async(l,a)=>t(await this.parseResponse(l,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){const[t,l]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:l}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,l){return this.parse().then(t,l)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const Mg=Symbol("brand.privateNullableHeaders");function*fR(i){if(!i)return;if(Mg in i){const{values:a,nulls:r}=i;yield*a.entries();for(const f of r)yield[f,null];return}let t=!1,l;i instanceof Headers?l=i.entries():Rh(i)?l=i:(t=!0,l=Object.entries(i??{}));for(let a of l){const r=a[0];if(typeof r!="string")throw new TypeError("expected header name to be a string");const f=Rh(a[1])?a[1]:[a[1]];let m=!1;for(const g of f)g!==void 0&&(t&&!m&&(m=!0,yield[r,null]),yield[r,g])}}const el=i=>{const t=new Headers,l=new Set;for(const a of i){const r=new Set;for(const[f,m]of fR(a)){const g=f.toLowerCase();r.has(g)||(t.delete(f),r.add(g)),m===null?(t.delete(f),l.add(g)):(t.append(f,m),l.delete(g))}}return{[Mg]:!0,values:t,nulls:l}};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const hu=i=>{var t,l,a,r,f,m;if(typeof globalThis.process<"u")return(a=(l=(t=q0)===null||t===void 0?void 0:t[i])===null||l===void 0?void 0:l.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(m=(f=(r=globalThis.Deno.env)===null||r===void 0?void 0:r.get)===null||f===void 0?void 0:f.call(r,i))===null||m===void 0?void 0:m.trim()};/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */var Ng;class Pa{constructor(t){var l,a,r,f,m,g,y,{baseURL:h=hu("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:v=(l=hu("GEMINI_API_KEY"))!==null&&l!==void 0?l:null,apiVersion:S="v1beta"}=t,E=Ua(t,["baseURL","apiKey","apiVersion"]);const C=Object.assign(Object.assign({apiKey:v,apiVersion:S},E),{baseURL:h||"https://generativelanguage.googleapis.com"});this.baseURL=C.baseURL,this.timeout=(a=C.timeout)!==null&&a!==void 0?a:Pa.DEFAULT_TIMEOUT,this.logger=(r=C.logger)!==null&&r!==void 0?r:console;const w="warn";this.logLevel=w,this.logLevel=(m=(f=Dh(C.logLevel,"ClientOptions.logLevel",this))!==null&&f!==void 0?f:Dh(hu("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&m!==void 0?m:w,this.fetchOptions=C.fetchOptions,this.maxRetries=(g=C.maxRetries)!==null&&g!==void 0?g:2,this.fetch=(y=C.fetch)!==null&&y!==void 0?y:JA(),this.encoder=KA,this._options=C,this.apiKey=v,this.apiVersion=S,this.clientAdapter=C.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:l}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!l.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){const l=el([t.headers]);if(!(l.values.has("authorization")||l.values.has("x-goog-api-key"))){if(this.apiKey)return el([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return el([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([l,a])=>typeof a<"u").map(([l,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(l)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(l)}=`;throw new qt(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${Qi}`}defaultIdempotencyKey(){return`stainless-node-retry-${wA()}`}makeStatusError(t,l,a,r){return st.generate(t,l,a,r)}buildURL(t,l,a){const r=!this.baseURLOverridden()&&a||this.baseURL,f=bA(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),m=this.defaultQuery();return HA(m)||(l=Object.assign(Object.assign({},m),l)),typeof l=="object"&&l&&!Array.isArray(l)&&(f.search=this.stringifyQuery(l)),f.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){const l=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${l}`}}async prepareRequest(t,{url:l,options:a}){}get(t,l){return this.methodRequest("get",t,l)}post(t,l){return this.methodRequest("post",t,l)}patch(t,l){return this.methodRequest("patch",t,l)}put(t,l){return this.methodRequest("put",t,l)}delete(t,l){return this.methodRequest("delete",t,l)}methodRequest(t,l,a){return this.request(Promise.resolve(a).then(r=>Object.assign({method:t,path:l},r)))}request(t,l=null){return new Bu(this,this.makeRequest(t,l,void 0))}async makeRequest(t,l,a){var r,f,m;const g=await t,y=(r=g.maxRetries)!==null&&r!==void 0?r:this.maxRetries;l==null&&(l=y),await this.prepareOptions(g);const{req:h,url:v,timeout:S}=await this.buildRequest(g,{retryCount:y-l});await this.prepareRequest(h,{url:v,options:g});const E="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),C=a===void 0?"":`, retryOf: ${a}`,w=Date.now();if(at(this).debug(`[${E}] sending request`,ui({retryOfRequestLogID:a,method:g.method,url:v,options:g,headers:h.headers})),!((f=g.signal)===null||f===void 0)&&f.aborted)throw new Mu;const H=new AbortController,b=await this.fetchWithTimeout(v,h,S,H).catch(Ru),P=Date.now();if(b instanceof globalThis.Error){const k=`retrying, ${l} attempts remaining`;if(!((m=g.signal)===null||m===void 0)&&m.aborted)throw new Mu;const K=Au(b)||/timed? ?out/i.test(String(b)+("cause"in b?String(b.cause):""));if(l)return at(this).info(`[${E}] connection ${K?"timed out":"failed"} - ${k}`),at(this).debug(`[${E}] connection ${K?"timed out":"failed"} (${k})`,ui({retryOfRequestLogID:a,url:v,durationMs:P-w,message:b.message})),this.retryRequest(g,l,a??E);throw at(this).info(`[${E}] connection ${K?"timed out":"failed"} - error; no more retries left`),at(this).debug(`[${E}] connection ${K?"timed out":"failed"} (error; no more retries left)`,ui({retryOfRequestLogID:a,url:v,durationMs:P-w,message:b.message})),K?new ug:new za({cause:b})}const X=`[${E}${C}] ${h.method} ${v} ${b.ok?"succeeded":"failed"} with status ${b.status} in ${P-w}ms`;if(!b.ok){const k=await this.shouldRetry(b);if(l&&k){const W=`retrying, ${l} attempts remaining`;return await XA(b.body),at(this).info(`${X} - ${W}`),at(this).debug(`[${E}] response error (${W})`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,durationMs:P-w})),this.retryRequest(g,l,a??E,b.headers)}const K=k?"error; no more retries left":"error; not retryable";at(this).info(`${X} - ${K}`);const ee=await b.text().catch(W=>Ru(W).message),te=zA(ee),F=te?void 0:ee;throw at(this).debug(`[${E}] response error (${K})`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,message:F,durationMs:Date.now()-w})),this.makeStatusError(b.status,te,F,b.headers)}return at(this).info(X),at(this).debug(`[${E}] response start`,ui({retryOfRequestLogID:a,url:b.url,status:b.status,headers:b.headers,durationMs:P-w})),{response:b,options:g,controller:H,requestLogID:E,retryOfRequestLogID:a,startTime:w}}async fetchWithTimeout(t,l,a,r){const f=l||{},{signal:m,method:g}=f,y=Ua(f,["signal","method"]);m&&m.addEventListener("abort",()=>r.abort());const h=setTimeout(()=>r.abort(),a),v=globalThis.ReadableStream&&y.body instanceof globalThis.ReadableStream||typeof y.body=="object"&&y.body!==null&&Symbol.asyncIterator in y.body,S=Object.assign(Object.assign(Object.assign({signal:r.signal},v?{duplex:"half"}:{}),{method:"GET"}),y);g&&(S.method=g.toUpperCase());try{return await this.fetch.call(void 0,t,S)}finally{clearTimeout(h)}}async shouldRetry(t){const l=t.headers.get("x-should-retry");return l==="true"?!0:l==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,l,a,r){var f;let m;const g=r==null?void 0:r.get("retry-after-ms");if(g){const h=parseFloat(g);Number.isNaN(h)||(m=h)}const y=r==null?void 0:r.get("retry-after");if(y&&!m){const h=parseFloat(y);Number.isNaN(h)?m=Date.parse(y)-Date.now():m=h*1e3}if(!(m&&0<=m&&m<60*1e3)){const h=(f=t.maxRetries)!==null&&f!==void 0?f:this.maxRetries;m=this.calculateDefaultRetryTimeoutMillis(l,h)}return await BA(m),this.makeRequest(t,l-1,a)}calculateDefaultRetryTimeoutMillis(t,l){const f=l-t,m=Math.min(.5*Math.pow(2,f),8),g=1-Math.random()*.25;return m*g*1e3}async buildRequest(t,{retryCount:l=0}={}){var a,r,f;const m=Object.assign({},t),{method:g,path:y,query:h,defaultBaseURL:v}=m,S=this.buildURL(y,h,v);"timeout"in m&&VA("timeout",m.timeout),m.timeout=(a=m.timeout)!==null&&a!==void 0?a:this.timeout;const{bodyHeaders:E,body:C}=this.buildBody({options:m}),w=await this.buildHeaders({options:t,method:g,bodyHeaders:E,retryCount:l});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:g,headers:w},m.signal&&{signal:m.signal}),globalThis.ReadableStream&&C instanceof globalThis.ReadableStream&&{duplex:"half"}),C&&{body:C}),(r=this.fetchOptions)!==null&&r!==void 0?r:{}),(f=m.fetchOptions)!==null&&f!==void 0?f:{}),url:S,timeout:m.timeout}}async buildHeaders({options:t,method:l,bodyHeaders:a,retryCount:r}){let f={};this.idempotencyHeader&&l!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),f[this.idempotencyHeader]=t.idempotencyKey);const m=await this.authHeaders(t);let g=el([f,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),FA()),this._options.defaultHeaders,a,t.headers,m]);return this.validateHeaders(g),g.values}buildBody({options:{body:t,headers:l}}){if(!t)return{bodyHeaders:void 0,body:void 0};const a=el([l]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:YA(t)}:this.encoder({body:t,headers:a})}}Pa.DEFAULT_TIMEOUT=6e4;class Ze extends Pa{constructor(){super(...arguments),this.interactions=new Rg(this)}}Ng=Ze;Ze.GeminiNextGenAPIClient=Ng;Ze.GeminiNextGenAPIClientError=qt;Ze.APIError=st;Ze.APIConnectionError=za;Ze.APIConnectionTimeoutError=ug;Ze.APIUserAbortError=Mu;Ze.NotFoundError=pg;Ze.ConflictError=mg;Ze.RateLimitError=gg;Ze.BadRequestError=cg;Ze.AuthenticationError=fg;Ze.InternalServerError=yg;Ze.PermissionDeniedError=dg;Ze.UnprocessableEntityError=hg;Ze.toFile=jA;Ze.Interactions=Rg;/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */function dR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function pR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function mR(i,t){const l={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(l,["sdkHttpResponse"],a),l}function hR(i,t){const l={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(l,["sdkHttpResponse"],a),l}function gR(i,t,l){const a={};if(u(i,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const r=u(i,["tunedModelDisplayName"]);if(t!==void 0&&r!=null&&c(t,["displayName"],r),u(i,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const f=u(i,["epochCount"]);t!==void 0&&f!=null&&c(t,["tuningTask","hyperparameters","epochCount"],f);const m=u(i,["learningRateMultiplier"]);if(m!=null&&c(a,["tuningTask","hyperparameters","learningRateMultiplier"],m),u(i,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(u(i,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(u(i,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const g=u(i,["batchSize"]);t!==void 0&&g!=null&&c(t,["tuningTask","hyperparameters","batchSize"],g);const y=u(i,["learningRate"]);if(t!==void 0&&y!=null&&c(t,["tuningTask","hyperparameters","learningRate"],y),u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(u(i,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return a}function yR(i,t,l){const a={};let r=u(l,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const C=u(i,["validationDataset"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec"],Uh(C))}else if(r==="PREFERENCE_TUNING"){const C=u(i,["validationDataset"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec"],Uh(C))}const f=u(i,["tunedModelDisplayName"]);t!==void 0&&f!=null&&c(t,["tunedModelDisplayName"],f);const m=u(i,["description"]);t!==void 0&&m!=null&&c(t,["description"],m);let g=u(l,["config","method"]);if(g===void 0&&(g="SUPERVISED_FINE_TUNING"),g==="SUPERVISED_FINE_TUNING"){const C=u(i,["epochCount"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","epochCount"],C)}else if(g==="PREFERENCE_TUNING"){const C=u(i,["epochCount"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],C)}let y=u(l,["config","method"]);if(y===void 0&&(y="SUPERVISED_FINE_TUNING"),y==="SUPERVISED_FINE_TUNING"){const C=u(i,["learningRateMultiplier"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],C)}else if(y==="PREFERENCE_TUNING"){const C=u(i,["learningRateMultiplier"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],C)}let h=u(l,["config","method"]);if(h===void 0&&(h="SUPERVISED_FINE_TUNING"),h==="SUPERVISED_FINE_TUNING"){const C=u(i,["exportLastCheckpointOnly"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","exportLastCheckpointOnly"],C)}else if(h==="PREFERENCE_TUNING"){const C=u(i,["exportLastCheckpointOnly"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],C)}let v=u(l,["config","method"]);if(v===void 0&&(v="SUPERVISED_FINE_TUNING"),v==="SUPERVISED_FINE_TUNING"){const C=u(i,["adapterSize"]);t!==void 0&&C!=null&&c(t,["supervisedTuningSpec","hyperParameters","adapterSize"],C)}else if(v==="PREFERENCE_TUNING"){const C=u(i,["adapterSize"]);t!==void 0&&C!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],C)}if(u(i,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(u(i,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const S=u(i,["labels"]);t!==void 0&&S!=null&&c(t,["labels"],S);const E=u(i,["beta"]);return t!==void 0&&E!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","beta"],E),a}function vR(i,t){const l={},a=u(i,["baseModel"]);a!=null&&c(l,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(l,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&xR(f);const m=u(i,["config"]);return m!=null&&gR(m,l),l}function TR(i,t){const l={},a=u(i,["baseModel"]);a!=null&&c(l,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(l,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&DR(f,l,t);const m=u(i,["config"]);return m!=null&&yR(m,l,t),l}function SR(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function ER(i,t){const l={},a=u(i,["name"]);return a!=null&&c(l,["_url","name"],a),l}function _R(i,t,l){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const m=u(i,["filter"]);return t!==void 0&&m!=null&&c(t,["_query","filter"],m),a}function CR(i,t,l){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const m=u(i,["filter"]);return t!==void 0&&m!=null&&c(t,["_query","filter"],m),a}function AR(i,t){const l={},a=u(i,["config"]);return a!=null&&_R(a,l),l}function RR(i,t){const l={},a=u(i,["config"]);return a!=null&&CR(a,l),l}function MR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(l,["nextPageToken"],r);const f=u(i,["tunedModels"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>Ig(g))),c(l,["tuningJobs"],m)}return l}function NR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(l,["nextPageToken"],r);const f=u(i,["tuningJobs"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(g=>xu(g))),c(l,["tuningJobs"],m)}return l}function IR(i,t){const l={},a=u(i,["name"]);a!=null&&c(l,["model"],a);const r=u(i,["name"]);return r!=null&&c(l,["endpoint"],r),l}function xR(i,t){const l={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(i,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const a=u(i,["examples"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(l,["examples","examples"],r)}return l}function DR(i,t,l){const a={};let r=u(l,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const m=u(i,["gcsUri"]);t!==void 0&&m!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],m)}else if(r==="PREFERENCE_TUNING"){const m=u(i,["gcsUri"]);t!==void 0&&m!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],m)}let f=u(l,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){const m=u(i,["vertexDatasetResource"]);t!==void 0&&m!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],m)}else if(f==="PREFERENCE_TUNING"){const m=u(i,["vertexDatasetResource"]);t!==void 0&&m!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],m)}if(u(i,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return a}function Ig(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["state"]);f!=null&&c(l,["state"],Fh(f));const m=u(i,["createTime"]);m!=null&&c(l,["createTime"],m);const g=u(i,["tuningTask","startTime"]);g!=null&&c(l,["startTime"],g);const y=u(i,["tuningTask","completeTime"]);y!=null&&c(l,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(l,["updateTime"],h);const v=u(i,["description"]);v!=null&&c(l,["description"],v);const S=u(i,["baseModel"]);S!=null&&c(l,["baseModel"],S);const E=u(i,["_self"]);return E!=null&&c(l,["tunedModel"],IR(E)),l}function xu(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["state"]);f!=null&&c(l,["state"],Fh(f));const m=u(i,["createTime"]);m!=null&&c(l,["createTime"],m);const g=u(i,["startTime"]);g!=null&&c(l,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(l,["endTime"],y);const h=u(i,["updateTime"]);h!=null&&c(l,["updateTime"],h);const v=u(i,["error"]);v!=null&&c(l,["error"],v);const S=u(i,["description"]);S!=null&&c(l,["description"],S);const E=u(i,["baseModel"]);E!=null&&c(l,["baseModel"],E);const C=u(i,["tunedModel"]);C!=null&&c(l,["tunedModel"],C);const w=u(i,["preTunedModel"]);w!=null&&c(l,["preTunedModel"],w);const H=u(i,["supervisedTuningSpec"]);H!=null&&c(l,["supervisedTuningSpec"],H);const b=u(i,["preferenceOptimizationSpec"]);b!=null&&c(l,["preferenceOptimizationSpec"],b);const P=u(i,["tuningDataStats"]);P!=null&&c(l,["tuningDataStats"],P);const X=u(i,["encryptionSpec"]);X!=null&&c(l,["encryptionSpec"],X);const k=u(i,["partnerModelTuningSpec"]);k!=null&&c(l,["partnerModelTuningSpec"],k);const K=u(i,["customBaseModel"]);K!=null&&c(l,["customBaseModel"],K);const ee=u(i,["experiment"]);ee!=null&&c(l,["experiment"],ee);const te=u(i,["labels"]);te!=null&&c(l,["labels"],te);const F=u(i,["outputUri"]);F!=null&&c(l,["outputUri"],F);const he=u(i,["pipelineJob"]);he!=null&&c(l,["pipelineJob"],he);const W=u(i,["serviceAccount"]);W!=null&&c(l,["serviceAccount"],W);const de=u(i,["tunedModelDisplayName"]);de!=null&&c(l,["tunedModelDisplayName"],de);const Ce=u(i,["veoTuningSpec"]);return Ce!=null&&c(l,["veoTuningSpec"],Ce),l}function wR(i,t){const l={},a=u(i,["sdkHttpResponse"]);a!=null&&c(l,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(l,["name"],r);const f=u(i,["metadata"]);f!=null&&c(l,["metadata"],f);const m=u(i,["done"]);m!=null&&c(l,["done"],m);const g=u(i,["error"]);return g!=null&&c(l,["error"],g),l}function Uh(i,t){const l={},a=u(i,["gcsUri"]);a!=null&&c(l,["validationDatasetUri"],a);const r=u(i,["vertexDatasetResource"]);return r!=null&&c(l,["validationDatasetUri"],r),l}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class UR extends hn{constructor(t){super(),this.apiClient=t,this.list=async(l={})=>new ci(mn.PAGED_ITEM_TUNING_JOBS,a=>this.listInternal(a),await this.listInternal(l),l),this.get=async l=>await this.getInternal(l),this.tune=async l=>{var a;if(this.apiClient.isVertexAI())if(l.baseModel.startsWith("projects/")){const r={tunedModelName:l.baseModel};!((a=l.config)===null||a===void 0)&&a.preTunedModelCheckpointId&&(r.checkpointId=l.config.preTunedModelCheckpointId);const f=Object.assign(Object.assign({},l),{preTunedModel:r});return f.baseModel=void 0,await this.tuneInternal(f)}else{const r=Object.assign({},l);return await this.tuneInternal(r)}else{const r=Object.assign({},l),f=await this.tuneMldevInternal(r);let m="";return f.metadata!==void 0&&f.metadata.tunedModel!==void 0?m=f.metadata.tunedModel:f.name!==void 0&&f.name.includes("/operations/")&&(m=f.name.split("/operations/")[0]),{name:m,state:yu.JOB_STATE_QUEUED}}}}async getInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=ER(t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>xu(v))}else{const h=SR(t);return g=Y("{name}",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>Ig(v))}}async listInternal(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=RR(t);return g=Y("tuningJobs",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=NR(v),E=new oh;return Object.assign(E,S),E})}else{const h=AR(t);return g=Y("tunedModels",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=MR(v),E=new oh;return Object.assign(E,S),E})}}async cancel(t){var l,a,r,f;let m,g="",y={};if(this.apiClient.isVertexAI()){const h=pR(t);return g=Y("{name}:cancel",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=hR(v),E=new lh;return Object.assign(E,S),E})}else{const h=dR(t);return g=Y("{name}:cancel",h._url),y=h._query,delete h._url,delete h._query,m=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(h),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(S=>{const E=S;return E.sdkHttpResponse={headers:v.headers},E})),m.then(v=>{const S=mR(v),E=new lh;return Object.assign(E,S),E})}}async tuneInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI()){const g=TR(t,t);return f=Y("tuningJobs",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>xu(y))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(t){var l,a;let r,f="",m={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=vR(t);return f=Y("tunedModels",g._url),m=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:m,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(l=t.config)===null||l===void 0?void 0:l.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(h=>{const v=h;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>wR(y))}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class bR{async download(t,l){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an tag.")}}const LR=1024*1024*8,GR=3,HR=1e3,qR=2,La="x-goog-upload-status";async function VR(i,t,l){var a;const r=await xg(i,t,l),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[La])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function zR(i,t,l){var a;const r=await xg(i,t,l),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[La])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const m=Vh(f),g=new bu;return Object.assign(g,m),g}async function xg(i,t,l){var a,r;let f=0,m=0,g=new vu(new Response),y="upload";for(f=i.size;m=f&&(y+=", finalize");let S=0,E=HR;for(;SsetTimeout(t,i))}class kR{async upload(t,l,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await VR(t,l,a)}async uploadToFileSearchStore(t,l,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await zR(t,l,a)}async stat(t){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await BR(t)}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */class OR{create(t,l,a){return new FR(t,l,a)}}class FR{constructor(t,l,a){this.url=t,this.headers=l,this.callbacks=a}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(t){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(t)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const bh="x-goog-api-key";class JR{constructor(t){this.apiKey=t}async addAuthHeaders(t,l){if(t.get(bh)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");t.append(bh,this.apiKey)}}}/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const YR="gl-node/";class XR{get interactions(){if(this._interactions!==void 0)return this._interactions;console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.");const t=this.httpOptions;t!=null&&t.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");const l=new Ze({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:t==null?void 0:t.timeout});return this._interactions=l.interactions,this._interactions}constructor(t){var l;if(t.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(t.project||t.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(l=t.vertexai)!==null&&l!==void 0?l:!1,this.apiKey=t.apiKey;const a=P0(t.httpOptions,t.vertexai,void 0,void 0);a&&(t.httpOptions?t.httpOptions.baseUrl=a:t.httpOptions={baseUrl:a}),this.apiVersion=t.apiVersion,this.httpOptions=t.httpOptions;const r=new JR(this.apiKey);this.apiClient=new BC({auth:r,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:YR+"web",uploader:new kR,downloader:new bR}),this.models=new lA(this.apiClient),this.live=new jC(this.apiClient,r,new OR),this.batches=new gS(this.apiClient),this.chats=new $S(this.models,this.apiClient),this.caches=new KS(this.apiClient),this.files=new sE(this.apiClient),this.operations=new aA(this.apiClient),this.authTokens=new _A(this.apiClient),this.tunings=new UR(this.apiClient),this.fileSearchStores=new DA(this.apiClient)}}const KR=()=>{const i="PLACEHOLDER_API_KEY";return new XR({apiKey:i})},QR=async(i,t)=>{const l=KR();if(!l)return"错误: 未配置 API Key";try{const a=`Act as a creative songwriter assistant. + User is submitting lyrics for a song. + Song Style: ${t} + User Input (Title or Draft Lyrics): ${i} + + Task: Write or polish short song lyrics (about 4-8 lines) in Chinese based on the input. + Make it poetic and fitting for the style. + Return ONLY the lyrics text.`;return(await l.models.generateContent({model:"gemini-2.5-flash",contents:a})).text||"暂时无法生成歌词,请稍后重试。"}catch(a){return console.error("Gemini API Error:",a),"抱歉,AI 灵感枯竭了,请重试。"}},ZR=({onSubmit:i,initialValues:t,errorMessage:l})=>{const[a,r]=Qe.useState({title:(t==null?void 0:t.title)||"",lyrics:(t==null?void 0:t.lyrics)||"",style:(t==null?void 0:t.style)||"",nickname:(t==null?void 0:t.nickname)||""}),[f,m]=Qe.useState(!1),[g,y]=Qe.useState(!1),h=async()=>{if(!a.title&&!a.lyrics){alert("请至少输入歌名或一点歌词内容!");return}m(!0);const S=await QR(a.title+(a.lyrics?` Content: ${a.lyrics}`:""),a.style||"流行");r(E=>({...E,lyrics:S})),m(!1)},v=async S=>{S.preventDefault(),y(!0);const E={...a,nickname:a.nickname.trim()===""?"音乐共创人":a.nickname};try{await i(E)}finally{y(!1)}};return B.jsxs("div",{className:"space-y-6",children:[B.jsxs("div",{className:"text-center mb-4",children:[B.jsx("h2",{className:"text-xl font-black text-brand-dark flex items-center justify-center gap-2",children:"填写创作信息"}),B.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"创作一首属于你自已的歌"})]}),B.jsxs("form",{onSubmit:v,className:"space-y-5",children:[B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["你的昵称 ",B.jsx("span",{className:"text-[10px] font-normal text-gray-400 bg-gray-100 px-1.5 py-0.5 rounded ml-1",children:"选填"})]}),B.jsx("input",{type:"text",value:a.nickname,onChange:S=>r({...a,nickname:S.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"例如: 阳光天地的朋友"})]}),B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["歌曲风格 ",B.jsx("span",{className:"text-brand-red",children:"*"})]}),B.jsx("input",{type:"text",required:!0,value:a.style,onChange:S=>r({...a,style:S.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"例如: 温暖感动、R&B、摇滚..."})]}),B.jsxs("div",{children:[B.jsxs("label",{className:"block text-xs font-bold text-gray-500 mb-1 ml-1",children:["歌曲名称 ",B.jsx("span",{className:"text-brand-red",children:"*"})]}),B.jsx("input",{type:"text",required:!0,value:a.title,onChange:S=>r({...a,title:S.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all placeholder-gray-400",placeholder:"为你的歌起个名字吧..."})]}),B.jsxs("div",{className:"relative",children:[B.jsxs("div",{className:"flex justify-between items-center mb-1 ml-1",children:[B.jsx("label",{className:"block text-xs font-bold text-gray-500",children:"歌词内容"}),B.jsxs("button",{type:"button",onClick:h,disabled:f,className:"flex items-center gap-1.5 text-[10px] font-bold text-brand-orange hover:text-brand-red transition-colors disabled:opacity-50",children:[B.jsx(qh,{className:"w-3 h-3"}),f?"AI 生成中...":"AI 帮我写词"]})]}),B.jsx("textarea",{required:!0,rows:5,value:a.lyrics,onChange:S=>r({...a,lyrics:S.target.value}),className:"w-full bg-gray-50 border border-gray-200 rounded-lg py-3 px-4 text-gray-800 focus:outline-none focus:border-brand-orange focus:bg-white transition-all text-sm leading-relaxed placeholder-gray-400 resize-none",placeholder:"写下你想说的话,或者具体的歌词..."})]}),l&&B.jsxs("div",{className:"p-3 rounded-lg bg-red-50 border border-red-100 text-red-500 text-sm flex items-center gap-2",children:[B.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),l]}),B.jsx("button",{type:"submit",disabled:g||f,className:"w-full mt-6 bg-gradient-to-r from-brand-orange to-brand-red text-white font-bold py-4 rounded-xl shadow-lg shadow-brand-orange/30 flex items-center justify-center gap-2 hover:scale-[1.02] transition-all active:scale-95",children:g?B.jsx(Hh,{className:"animate-spin"}):B.jsxs(B.Fragment,{children:[B.jsx(x0,{className:"w-4 h-4"})," 确认提交创作"]})})]})]})},$R=({song:i})=>B.jsxs("div",{className:"space-y-6",children:[B.jsxs("div",{className:"text-center mb-4",children:[B.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-100 border border-green-200 text-green-600 text-xs font-bold mb-4 animate-bounce",children:[B.jsx(S0,{className:"w-4 h-4"})," 提交成功"]}),B.jsx("h2",{className:"text-1xl font-black text-brand-dark",children:"请截图保存下方凭证,等待工作人员联系"}),B.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"您的创作已收录,快来现场一起畅聊吧"})]}),B.jsxs("div",{className:"relative bg-orange-50 rounded-2xl border-2 border-brand-orange/20 overflow-hidden shadow-sm group",children:[B.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-5",children:B.jsx(R0,{className:"w-24 h-24 text-brand-orange"})}),B.jsxs("div",{className:"p-6 relative z-10",children:[B.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[B.jsx("div",{className:"w-10 h-10 rounded-full bg-white border border-brand-orange/20 flex items-center justify-center shadow-sm",children:B.jsx(L0,{className:"w-5 h-5 text-brand-orange"})}),B.jsxs("div",{children:[B.jsx("div",{className:"text-xs text-gray-400",children:"来自共创人"}),B.jsx("div",{className:"font-bold text-gray-800",children:i.nickname})]}),B.jsx("div",{className:"ml-auto bg-brand-orange/10 text-brand-orange px-2 py-1 rounded text-[10px] font-bold",children:i.style})]}),B.jsxs("div",{className:"bg-white rounded-xl p-4 shadow-sm border border-brand-orange/10 mb-4",children:[B.jsxs("h3",{className:"text-sm font-bold text-brand-dark mb-2 flex items-center gap-2 min-w-0",children:[B.jsx(qh,{className:"w-3.5 h-3.5 text-brand-yellow"}),B.jsx("span",{className:"flex-1 truncate",children:i.title})]}),B.jsxs("p",{className:"text-sm text-gray-600 italic leading-relaxed whitespace-pre-wrap",children:['"',i.lyrics,'"']})]}),B.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400 border-t border-brand-orange/10 pt-4",children:[B.jsxs("div",{className:"flex items-center gap-1",children:[B.jsx("span",{children:"凭证编号:"}),B.jsx("span",{className:"font-mono text-brand-orange",children:i.ticketNumber||"PENDING"})]}),B.jsx("div",{className:"flex items-center gap-1",children:B.jsx(_0,{className:"w-3.5 h-3.5"})})]})]})]}),B.jsxs("button",{onClick:()=>{localStorage.removeItem("ai_song_fest_songs"),window.location.reload()},className:"w-full py-4 text-xs text-gray-400 hover:text-brand-orange transition-colors flex items-center justify-center gap-2 group",children:[B.jsx(N0,{className:"w-3 h-3 group-hover:rotate-180 transition-transform duration-500"}),"提交新的创作"]})]});function WR(){const[i,t]=Qe.useState("loading"),[l,a]=Qe.useState(null),[r,f]=Qe.useState(null),[m,g]=Qe.useState(null);Qe.useEffect(()=>{(async()=>{const E=nl.getCurrentUser();if(!E){t("login");return}a(E);const C=await Ea.getSongByPhone(E.phone);C?(f(C),t("result")):t("form")})()},[]);const y=async()=>{const S=nl.getCurrentUser();if(a(S),S){const E=await Ea.getSongByPhone(S.phone);E?(f(E),t("result")):t("form")}},h=async S=>{if(l)try{const E=await Ea.submitSong(l.phone,S);g(null),f(E),t("result")}catch(E){const C=E instanceof Error?E.message:"提交失败,请稍后重试";g(C)}},v=async()=>{if(l){const S=await Ea.getSongByPhone(l.phone);S&&f(S)}};return Qe.useEffect(()=>{(async()=>{if(i==="form")try{await nl.fetchServerToken(),g(null)}catch(E){const C=E instanceof Error?E.message:"获取 token 失败";g(C)}})()},[i]),i==="loading"?B.jsx(jp,{children:B.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-white",children:[B.jsx("div",{className:"w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin"}),B.jsx("p",{className:"mt-6 text-sm font-bold tracking-widest animate-pulse",children:"正在进入..."})]})}):B.jsxs(jp,{children:[i==="login"&&B.jsx(H0,{onLoginSuccess:y}),i==="form"&&B.jsx(ZR,{onSubmit:h,errorMessage:m||void 0}),i==="result"&&r&&B.jsx($R,{song:r,onRefresh:v})]})}const Dg=document.getElementById("root");if(!Dg)throw new Error("Could not find root element to mount to");const jR=f0.createRoot(Dg);jR.render(B.jsx(i0.StrictMode,{children:B.jsx(WR,{})})); diff --git a/h5/together/index.html b/h5/together/index.html new file mode 100755 index 0000000..eb6d640 --- /dev/null +++ b/h5/together/index.html @@ -0,0 +1,163 @@ + + + + + + 一起做首我们的歌 - 歌词灵感征集 + + + + + + + + + + + + + + + +
+ + \ No newline at end of file