var yU=Object.defineProperty;var SU=(e,t,n)=>t in e?yU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hm=(e,t,n)=>SU(e,typeof t!="symbol"?t+"":t,n);function bU(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const s of l.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function Ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mm={exports:{}},as={};/** * @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 oT;function EU(){if(oT)return as;oT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,l){var s=null;if(l!==void 0&&(s=""+l),o.key!==void 0&&(s=""+o.key),"key"in o){l={};for(var c in o)c!=="key"&&(l[c]=o[c])}else l=o;return o=l.ref,{$$typeof:e,type:r,key:s,ref:o!==void 0?o:null,props:l}}return as.Fragment=t,as.jsx=n,as.jsxs=n,as}var aT;function _U(){return aT||(aT=1,mm.exports=EU()),mm.exports}var ne=_U(),vm={exports:{}},Te={};/** * @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 lT;function TU(){if(lT)return Te;lT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function E(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,A={};function w(U,J,ie){this.props=U,this.context=J,this.refs=A,this.updater=ie||_}w.prototype.isReactComponent={},w.prototype.setState=function(U,J){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,J,"setState")},w.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function R(){}R.prototype=w.prototype;function I(U,J,ie){this.props=U,this.context=J,this.refs=A,this.updater=ie||_}var P=I.prototype=new R;P.constructor=I,T(P,w.prototype),P.isPureReactComponent=!0;var N=Array.isArray;function O(){}var D={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function B(U,J,ie){var le=ie.ref;return{$$typeof:e,type:U,key:J,ref:le!==void 0?le:null,props:ie}}function Q(U,J){return B(U.type,J,U.props)}function te(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function $(U){var J={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(ie){return J[ie]})}var oe=/\/+/g;function se(U,J){return typeof U=="object"&&U!==null&&U.key!=null?$(""+U.key):J.toString(36)}function ye(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(O,O):(U.status="pending",U.then(function(J){U.status==="pending"&&(U.status="fulfilled",U.value=J)},function(J){U.status==="pending"&&(U.status="rejected",U.reason=J)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function V(U,J,ie,le,be){var Ae=typeof U;(Ae==="undefined"||Ae==="boolean")&&(U=null);var Ee=!1;if(U===null)Ee=!0;else switch(Ae){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(U.$$typeof){case e:case t:Ee=!0;break;case h:return Ee=U._init,V(Ee(U._payload),J,ie,le,be)}}if(Ee)return be=be(U),Ee=le===""?"."+se(U,0):le,N(be)?(ie="",Ee!=null&&(ie=Ee.replace(oe,"$&/")+"/"),V(be,J,ie,"",function(Ce){return Ce})):be!=null&&(te(be)&&(be=Q(be,ie+(be.key==null||U&&U.key===be.key?"":(""+be.key).replace(oe,"$&/")+"/")+Ee)),J.push(be)),1;Ee=0;var Et=le===""?".":le+":";if(N(U))for(var W=0;W>>1,ve=V[he];if(0>>1;heo(ie,ae))leo(be,ie)?(V[he]=be,V[le]=ae,he=le):(V[he]=ie,V[J]=ae,he=J);else if(leo(be,ae))V[he]=be,V[le]=ae,he=le;else break e}}return X}function o(V,X){var ae=V.sortIndex-X.sortIndex;return ae!==0?ae:V.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var s=Date,c=s.now();e.unstable_now=function(){return s.now()-c}}var d=[],f=[],h=1,v=null,y=3,E=!1,_=!1,T=!1,A=!1,w=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function P(V){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=V)r(f),X.sortIndex=X.expirationTime,t(d,X);else break;X=n(f)}}function N(V){if(T=!1,P(V),!_)if(n(d)!==null)_=!0,O||(O=!0,$());else{var X=n(f);X!==null&&ye(N,X.startTime-V)}}var O=!1,D=-1,G=5,B=-1;function Q(){return A?!0:!(e.unstable_now()-BV&&Q());){var he=v.callback;if(typeof he=="function"){v.callback=null,y=v.priorityLevel;var ve=he(v.expirationTime<=V);if(V=e.unstable_now(),typeof ve=="function"){v.callback=ve,P(V),X=!0;break t}v===n(d)&&r(d),P(V)}else r(d);v=n(d)}if(v!==null)X=!0;else{var U=n(f);U!==null&&ye(N,U.startTime-V),X=!1}}break e}finally{v=null,y=ae,E=!1}X=void 0}}finally{X?$():O=!1}}}var $;if(typeof I=="function")$=function(){I(te)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=te,$=function(){se.postMessage(null)}}else $=function(){w(te,0)};function ye(V,X){D=w(function(){V(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125he?(V.sortIndex=ae,t(f,V),n(d)===null&&V===n(f)&&(T?(R(D),D=-1):T=!0,ye(N,ae-he))):(V.sortIndex=ve,t(d,V),_||E||(_=!0,O||(O=!0,$()))),V},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(V){var X=y;return function(){var ae=y;y=X;try{return V.apply(this,arguments)}finally{y=ae}}}})(Sm)),Sm}var cT;function xU(){return cT||(cT=1,ym.exports=CU()),ym.exports}var bm={exports:{}},Jt={};/** * @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 fT;function wU(){if(fT)return Jt;fT=1;var e=el();function t(d){var f="https://react.dev/errors/"+d;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bm.exports=wU(),bm.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 pT;function MU(){if(pT)return ls;pT=1;var e=xU(),t=el(),n=VM();function r(i){var a="https://react.dev/errors/"+i;if(1ve||(i.current=he[ve],he[ve]=null,ve--)}function ie(i,a){ve++,he[ve]=i.current,i.current=a}var le=U(null),be=U(null),Ae=U(null),Ee=U(null);function Et(i,a){switch(ie(Ae,a),ie(be,i),ie(le,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?M_(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=M_(a),i=I_(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}J(le),ie(le,i)}function W(){J(le),J(be),J(Ae)}function Ce(i){i.memoizedState!==null&&ie(Ee,i);var a=le.current,u=I_(a,i.type);a!==u&&(ie(be,i),ie(le,u))}function Ie(i){be.current===i&&(J(le),J(be)),Ee.current===i&&(J(Ee),ns._currentValue=ae)}var re,Lt;function ke(i){if(re===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);re=a&&a[1]||"",Lt=-1)":-1S||k[p]!==H[S]){var j=` `+k[p].replace(" at new "," at ");return i.displayName&&j.includes("")&&(j=j.replace("",i.displayName)),j}while(1<=p&&0<=S);break}}}finally{zt=!1,Error.prepareStackTrace=u}return(u=i?i.displayName||i.name:"")?ke(u):""}function Nr(i,a){switch(i.tag){case 26:case 27:case 5:return ke(i.type);case 16:return ke("Lazy");case 13:return i.child!==a&&a!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Bt(i.type,!1);case 11:return Bt(i.type.render,!1);case 1:return Bt(i.type,!0);case 31:return ke("Activity");default:return""}}function pl(i){try{var a="",u=null;do a+=Nr(i,u),u=i,i=i.return;while(i);return a}catch(p){return` Error generating stack: `+p.message+` `+p.stack}}var Qd=Object.prototype.hasOwnProperty,ep=e.unstable_scheduleCallback,tp=e.unstable_cancelCallback,XD=e.unstable_shouldYield,WD=e.unstable_requestPaint,En=e.unstable_now,ZD=e.unstable_getCurrentPriorityLevel,aS=e.unstable_ImmediatePriority,lS=e.unstable_UserBlockingPriority,au=e.unstable_NormalPriority,QD=e.unstable_LowPriority,sS=e.unstable_IdlePriority,ek=e.log,tk=e.unstable_setDisableYieldValue,hl=null,_n=null;function Ei(i){if(typeof ek=="function"&&tk(i),_n&&typeof _n.setStrictMode=="function")try{_n.setStrictMode(hl,i)}catch{}}var Tn=Math.clz32?Math.clz32:ik,nk=Math.log,rk=Math.LN2;function ik(i){return i>>>=0,i===0?32:31-(nk(i)/rk|0)|0}var lu=256,su=262144,uu=4194304;function ro(i){var a=i&42;if(a!==0)return a;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function cu(i,a,u){var p=i.pendingLanes;if(p===0)return 0;var S=0,b=i.suspendedLanes,C=i.pingedLanes;i=i.warmLanes;var M=p&134217727;return M!==0?(p=M&~b,p!==0?S=ro(p):(C&=M,C!==0?S=ro(C):u||(u=M&~i,u!==0&&(S=ro(u))))):(M=p&~b,M!==0?S=ro(M):C!==0?S=ro(C):u||(u=p&~i,u!==0&&(S=ro(u)))),S===0?0:a!==0&&a!==S&&(a&b)===0&&(b=S&-S,u=a&-a,b>=u||b===32&&(u&4194048)!==0)?a:S}function ml(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function ok(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 uS(){var i=uu;return uu<<=1,(uu&62914560)===0&&(uu=4194304),i}function np(i){for(var a=[],u=0;31>u;u++)a.push(i);return a}function vl(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function ak(i,a,u,p,S,b){var C=i.pendingLanes;i.pendingLanes=u,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=u,i.entangledLanes&=u,i.errorRecoveryDisabledLanes&=u,i.shellSuspendCounter=0;var M=i.entanglements,k=i.expirationTimes,H=i.hiddenUpdates;for(u=C&~u;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var dk=/[\n"\\]/g;function Un(i){return i.replace(dk,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function sp(i,a,u,p,S,b,C,M){i.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.type=C:i.removeAttribute("type"),a!=null?C==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+kn(a)):i.value!==""+kn(a)&&(i.value=""+kn(a)):C!=="submit"&&C!=="reset"||i.removeAttribute("value"),a!=null?up(i,C,kn(a)):u!=null?up(i,C,kn(u)):p!=null&&i.removeAttribute("value"),S==null&&b!=null&&(i.defaultChecked=!!b),S!=null&&(i.checked=S&&typeof S!="function"&&typeof S!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?i.name=""+kn(M):i.removeAttribute("name")}function _S(i,a,u,p,S,b,C,M){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.type=b),a!=null||u!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){lp(i);return}u=u!=null?""+kn(u):"",a=a!=null?""+kn(a):u,M||a===i.value||(i.value=a),i.defaultValue=a}p=p??S,p=typeof p!="function"&&typeof p!="symbol"&&!!p,i.checked=M?i.checked:!!p,i.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(i.name=C),lp(i)}function up(i,a,u){a==="number"&&pu(i.ownerDocument)===i||i.defaultValue===""+u||(i.defaultValue=""+u)}function Qo(i,a,u,p){if(i=i.options,a){a={};for(var S=0;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hp=!1;if(Ur)try{var bl={};Object.defineProperty(bl,"passive",{get:function(){hp=!0}}),window.addEventListener("test",bl,bl),window.removeEventListener("test",bl,bl)}catch{hp=!1}var Ti=null,mp=null,mu=null;function IS(){if(mu)return mu;var i,a=mp,u=a.length,p,S="value"in Ti?Ti.value:Ti.textContent,b=S.length;for(i=0;i=Tl),kS=" ",US=!1;function LS(i,a){switch(i){case"keyup":return qk.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zS(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ra=!1;function Hk(i,a){switch(i){case"compositionend":return zS(a);case"keypress":return a.which!==32?null:(US=!0,kS);case"textInput":return i=a.data,i===kS&&US?null:i;default:return null}}function Vk(i,a){if(ra)return i==="compositionend"||!bp&&LS(i,a)?(i=IS(),mu=mp=Ti=null,ra=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:u,offset:a-i};i=p}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=YS(u)}}function JS(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?JS(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function jS(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=pu(i.document);a instanceof i.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)i=a.contentWindow;else break;a=pu(i.document)}return a}function Tp(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var Wk=Ur&&"documentMode"in document&&11>=document.documentMode,ia=null,Ap=null,wl=null,Cp=!1;function XS(i,a,u){var p=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Cp||ia==null||ia!==pu(p)||(p=ia,"selectionStart"in p&&Tp(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),wl&&xl(wl,p)||(wl=p,p=sc(Ap,"onSelect"),0>=C,S-=C,vr=1<<32-Tn(a)+S|u<we?(Ne=pe,pe=null):Ne=pe.sibling;var ze=F(z,pe,q[we],Z);if(ze===null){pe===null&&(pe=Ne);break}i&&pe&&ze.alternate===null&&a(z,pe),L=b(ze,L,we),Le===null?ge=ze:Le.sibling=ze,Le=ze,pe=Ne}if(we===q.length)return u(z,pe),De&&zr(z,we),ge;if(pe===null){for(;wewe?(Ne=pe,pe=null):Ne=pe.sibling;var $i=F(z,pe,ze.value,Z);if($i===null){pe===null&&(pe=Ne);break}i&&pe&&$i.alternate===null&&a(z,pe),L=b($i,L,we),Le===null?ge=$i:Le.sibling=$i,Le=$i,pe=Ne}if(ze.done)return u(z,pe),De&&zr(z,we),ge;if(pe===null){for(;!ze.done;we++,ze=q.next())ze=ee(z,ze.value,Z),ze!==null&&(L=b(ze,L,we),Le===null?ge=ze:Le.sibling=ze,Le=ze);return De&&zr(z,we),ge}for(pe=p(pe);!ze.done;we++,ze=q.next())ze=K(pe,z,we,ze.value,Z),ze!==null&&(i&&ze.alternate!==null&&pe.delete(ze.key===null?we:ze.key),L=b(ze,L,we),Le===null?ge=ze:Le.sibling=ze,Le=ze);return i&&pe.forEach(function(gU){return a(z,gU)}),De&&zr(z,we),ge}function Je(z,L,q,Z){if(typeof q=="object"&&q!==null&&q.type===T&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case E:e:{for(var ge=q.key;L!==null;){if(L.key===ge){if(ge=q.type,ge===T){if(L.tag===7){u(z,L.sibling),Z=S(L,q.props.children),Z.return=z,z=Z;break e}}else if(L.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===G&&mo(ge)===L.type){u(z,L.sibling),Z=S(L,q.props),Nl(Z,q),Z.return=z,z=Z;break e}u(z,L);break}else a(z,L);L=L.sibling}q.type===T?(Z=uo(q.props.children,z.mode,Z,q.key),Z.return=z,z=Z):(Z=Cu(q.type,q.key,q.props,null,z.mode,Z),Nl(Z,q),Z.return=z,z=Z)}return C(z);case _:e:{for(ge=q.key;L!==null;){if(L.key===ge)if(L.tag===4&&L.stateNode.containerInfo===q.containerInfo&&L.stateNode.implementation===q.implementation){u(z,L.sibling),Z=S(L,q.children||[]),Z.return=z,z=Z;break e}else{u(z,L);break}else a(z,L);L=L.sibling}Z=Op(q,z.mode,Z),Z.return=z,z=Z}return C(z);case G:return q=mo(q),Je(z,L,q,Z)}if(ye(q))return de(z,L,q,Z);if($(q)){if(ge=$(q),typeof ge!="function")throw Error(r(150));return q=ge.call(q),Se(z,L,q,Z)}if(typeof q.then=="function")return Je(z,L,Ou(q),Z);if(q.$$typeof===I)return Je(z,L,Mu(z,q),Z);Nu(z,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,L!==null&&L.tag===6?(u(z,L.sibling),Z=S(L,q),Z.return=z,z=Z):(u(z,L),Z=Rp(q,z.mode,Z),Z.return=z,z=Z),C(z)):u(z,L)}return function(z,L,q,Z){try{Ol=0;var ge=Je(z,L,q,Z);return ma=null,ge}catch(pe){if(pe===ha||pe===Pu)throw pe;var Le=Cn(29,pe,null,z.mode);return Le.lanes=Z,Le.return=z,Le}finally{}}}var go=Sb(!0),bb=Sb(!1),Mi=!1;function Fp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $p(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ii(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Pi(i,a,u){var p=i.updateQueue;if(p===null)return null;if(p=p.shared,(Ge&2)!==0){var S=p.pending;return S===null?a.next=a:(a.next=S.next,S.next=a),p.pending=a,a=Au(i),rb(i,null,u),a}return Tu(i,p,a,u),Au(i)}function Dl(i,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var p=a.lanes;p&=i.pendingLanes,u|=p,a.lanes=u,fS(i,u)}}function Yp(i,a){var u=i.updateQueue,p=i.alternate;if(p!==null&&(p=p.updateQueue,u===p)){var S=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var C={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};b===null?S=b=C:b=b.next=C,u=u.next}while(u!==null);b===null?S=b=a:b=b.next=a}else S=b=a;u={baseState:p.baseState,firstBaseUpdate:S,lastBaseUpdate:b,shared:p.shared,callbacks:p.callbacks},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=a:i.next=a,u.lastBaseUpdate=a}var Kp=!1;function kl(){if(Kp){var i=pa;if(i!==null)throw i}}function Ul(i,a,u,p){Kp=!1;var S=i.updateQueue;Mi=!1;var b=S.firstBaseUpdate,C=S.lastBaseUpdate,M=S.shared.pending;if(M!==null){S.shared.pending=null;var k=M,H=k.next;k.next=null,C===null?b=H:C.next=H,C=k;var j=i.alternate;j!==null&&(j=j.updateQueue,M=j.lastBaseUpdate,M!==C&&(M===null?j.firstBaseUpdate=H:M.next=H,j.lastBaseUpdate=k))}if(b!==null){var ee=S.baseState;C=0,j=H=k=null,M=b;do{var F=M.lane&-536870913,K=F!==M.lane;if(K?(Oe&F)===F:(p&F)===F){F!==0&&F===da&&(Kp=!0),j!==null&&(j=j.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var de=i,Se=M;F=a;var Je=u;switch(Se.tag){case 1:if(de=Se.payload,typeof de=="function"){ee=de.call(Je,ee,F);break e}ee=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=Se.payload,F=typeof de=="function"?de.call(Je,ee,F):de,F==null)break e;ee=v({},ee,F);break e;case 2:Mi=!0}}F=M.callback,F!==null&&(i.flags|=64,K&&(i.flags|=8192),K=S.callbacks,K===null?S.callbacks=[F]:K.push(F))}else K={lane:F,tag:M.tag,payload:M.payload,callback:M.callback,next:null},j===null?(H=j=K,k=ee):j=j.next=K,C|=F;if(M=M.next,M===null){if(M=S.shared.pending,M===null)break;K=M,M=K.next,K.next=null,S.lastBaseUpdate=K,S.shared.pending=null}}while(!0);j===null&&(k=ee),S.baseState=k,S.firstBaseUpdate=H,S.lastBaseUpdate=j,b===null&&(S.shared.lanes=0),ki|=C,i.lanes=C,i.memoizedState=ee}}function Eb(i,a){if(typeof i!="function")throw Error(r(191,i));i.call(a)}function _b(i,a){var u=i.callbacks;if(u!==null)for(i.callbacks=null,i=0;ib?b:8;var C=V.T,M={};V.T=M,dh(i,!1,a,u);try{var k=S(),H=V.S;if(H!==null&&H(M,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var j=a2(k,p);Bl(i,a,j,Pn(i))}else Bl(i,a,p,Pn(i))}catch(ee){Bl(i,a,{then:function(){},status:"rejected",reason:ee},Pn())}finally{X.p=b,C!==null&&M.types!==null&&(C.types=M.types),V.T=C}}function d2(){}function ch(i,a,u,p){if(i.tag!==5)throw Error(r(476));var S=eE(i).queue;Qb(i,S,a,ae,u===null?d2:function(){return tE(i),u(p)})}function eE(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:ae},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:u},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function tE(i){var a=eE(i);a.next===null&&(a=i.alternate.memoizedState),Bl(i,a.next.queue,{},Pn())}function fh(){return Ht(ns)}function nE(){return pt().memoizedState}function rE(){return pt().memoizedState}function p2(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var u=Pn();i=Ii(u);var p=Pi(a,i,u);p!==null&&(vn(p,a,u),Dl(p,a,u)),a={cache:qp()},i.payload=a;return}a=a.return}}function h2(i,a,u){var p=Pn();u={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Vu(i)?oE(a,u):(u=Ip(i,a,u,p),u!==null&&(vn(u,i,p),aE(u,a,p)))}function iE(i,a,u){var p=Pn();Bl(i,a,u,p)}function Bl(i,a,u,p){var S={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Vu(i))oE(a,S);else{var b=i.alternate;if(i.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var C=a.lastRenderedState,M=b(C,u);if(S.hasEagerState=!0,S.eagerState=M,An(M,C))return Tu(i,a,S,0),We===null&&_u(),!1}catch{}finally{}if(u=Ip(i,a,S,p),u!==null)return vn(u,i,p),aE(u,a,p),!0}return!1}function dh(i,a,u,p){if(p={lane:2,revertLane:Fh(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Vu(i)){if(a)throw Error(r(479))}else a=Ip(i,u,p,2),a!==null&&vn(a,i,2)}function Vu(i){var a=i.alternate;return i===xe||a!==null&&a===xe}function oE(i,a){ga=Uu=!0;var u=i.pending;u===null?a.next=a:(a.next=u.next,u.next=a),i.pending=a}function aE(i,a,u){if((u&4194048)!==0){var p=a.lanes;p&=i.pendingLanes,u|=p,a.lanes=u,fS(i,u)}}var ql={readContext:Ht,use:Bu,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};ql.useEffectEvent=lt;var lE={readContext:Ht,use:Bu,useCallback:function(i,a){return Qt().memoizedState=[i,a===void 0?null:a],i},useContext:Ht,useEffect:Fb,useImperativeHandle:function(i,a,u){u=u!=null?u.concat([i]):null,Gu(4194308,4,Jb.bind(null,a,i),u)},useLayoutEffect:function(i,a){return Gu(4194308,4,i,a)},useInsertionEffect:function(i,a){Gu(4,2,i,a)},useMemo:function(i,a){var u=Qt();a=a===void 0?null:a;var p=i();if(yo){Ei(!0);try{i()}finally{Ei(!1)}}return u.memoizedState=[p,a],p},useReducer:function(i,a,u){var p=Qt();if(u!==void 0){var S=u(a);if(yo){Ei(!0);try{u(a)}finally{Ei(!1)}}}else S=a;return p.memoizedState=p.baseState=S,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:S},p.queue=i,i=i.dispatch=h2.bind(null,xe,i),[p.memoizedState,i]},useRef:function(i){var a=Qt();return i={current:i},a.memoizedState=i},useState:function(i){i=oh(i);var a=i.queue,u=iE.bind(null,xe,a);return a.dispatch=u,[i.memoizedState,u]},useDebugValue:sh,useDeferredValue:function(i,a){var u=Qt();return uh(u,i,a)},useTransition:function(){var i=oh(!1);return i=Qb.bind(null,xe,i.queue,!0,!1),Qt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,u){var p=xe,S=Qt();if(De){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),We===null)throw Error(r(349));(Oe&127)!==0||Mb(p,a,u)}S.memoizedState=u;var b={value:u,getSnapshot:a};return S.queue=b,Fb(Pb.bind(null,p,b,i),[i]),p.flags|=2048,Sa(9,{destroy:void 0},Ib.bind(null,p,b,u,a),null),u},useId:function(){var i=Qt(),a=We.identifierPrefix;if(De){var u=gr,p=vr;u=(p&~(1<<32-Tn(p)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Lu++,0<\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?b.multiple=!0:p.size&&(b.size=p.size);break;default:b=typeof p.is=="string"?C.createElement(S,{is:p.is}):C.createElement(S)}}b[qt]=a,b[cn]=p;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)b.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=b;e:switch(Ft(b,S,p),S){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Fr(a)}}return tt(a),xh(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,u),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==p&&Fr(a);else{if(typeof p!="string"&&a.stateNode===null)throw Error(r(166));if(i=Ae.current,ca(a)){if(i=a.stateNode,u=a.memoizedProps,p=null,S=Gt,S!==null)switch(S.tag){case 27:case 5:p=S.memoizedProps}i[qt]=a,i=!!(i.nodeValue===u||p!==null&&p.suppressHydrationWarning===!0||x_(i.nodeValue,u)),i||xi(a,!0)}else i=uc(i).createTextNode(p),i[qt]=a,a.stateNode=i}return tt(a),null;case 31:if(u=a.memoizedState,i===null||i.memoizedState!==null){if(p=ca(a),u!==null){if(i===null){if(!p)throw Error(r(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[qt]=a}else co(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;tt(a),i=!1}else u=Up(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),i=!0;if(!i)return a.flags&256?(wn(a),a):(wn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return tt(a),null;case 13:if(p=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(S=ca(a),p!==null&&p.dehydrated!==null){if(i===null){if(!S)throw Error(r(318));if(S=a.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[qt]=a}else co(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;tt(a),S=!1}else S=Up(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=S),S=!0;if(!S)return a.flags&256?(wn(a),a):(wn(a),null)}return wn(a),(a.flags&128)!==0?(a.lanes=u,a):(u=p!==null,i=i!==null&&i.memoizedState!==null,u&&(p=a.child,S=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(S=p.alternate.memoizedState.cachePool.pool),b=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(b=p.memoizedState.cachePool.pool),b!==S&&(p.flags|=2048)),u!==i&&u&&(a.child.flags|=8192),Ju(a,a.updateQueue),tt(a),null);case 4:return W(),i===null&&Jh(a.stateNode.containerInfo),tt(a),null;case 10:return qr(a.type),tt(a),null;case 19:if(J(dt),p=a.memoizedState,p===null)return tt(a),null;if(S=(a.flags&128)!==0,b=p.rendering,b===null)if(S)Hl(p,!1);else{if(st!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(b=ku(i),b!==null){for(a.flags|=128,Hl(p,!1),i=b.updateQueue,a.updateQueue=i,Ju(a,i),a.subtreeFlags=0,i=u,u=a.child;u!==null;)ib(u,i),u=u.sibling;return ie(dt,dt.current&1|2),De&&zr(a,p.treeForkCount),a.child}i=i.sibling}p.tail!==null&&En()>Qu&&(a.flags|=128,S=!0,Hl(p,!1),a.lanes=4194304)}else{if(!S)if(i=ku(b),i!==null){if(a.flags|=128,S=!0,i=i.updateQueue,a.updateQueue=i,Ju(a,i),Hl(p,!0),p.tail===null&&p.tailMode==="hidden"&&!b.alternate&&!De)return tt(a),null}else 2*En()-p.renderingStartTime>Qu&&u!==536870912&&(a.flags|=128,S=!0,Hl(p,!1),a.lanes=4194304);p.isBackwards?(b.sibling=a.child,a.child=b):(i=p.last,i!==null?i.sibling=b:a.child=b,p.last=b)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=En(),i.sibling=null,u=dt.current,ie(dt,S?u&1|2:u&1),De&&zr(a,p.treeForkCount),i):(tt(a),null);case 22:case 23:return wn(a),jp(),p=a.memoizedState!==null,i!==null?i.memoizedState!==null!==p&&(a.flags|=8192):p&&(a.flags|=8192),p?(u&536870912)!==0&&(a.flags&128)===0&&(tt(a),a.subtreeFlags&6&&(a.flags|=8192)):tt(a),u=a.updateQueue,u!==null&&Ju(a,u.retryQueue),u=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),p=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(p=a.memoizedState.cachePool.pool),p!==u&&(a.flags|=2048),i!==null&&J(ho),null;case 24:return u=null,i!==null&&(u=i.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),qr(mt),tt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function S2(i,a){switch(Dp(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return qr(mt),W(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return Ie(a),null;case 31:if(a.memoizedState!==null){if(wn(a),a.alternate===null)throw Error(r(340));co()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(wn(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));co()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return J(dt),null;case 4:return W(),null;case 10:return qr(a.type),null;case 22:case 23:return wn(a),jp(),i!==null&&J(ho),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return qr(mt),null;case 25:return null;default:return null}}function RE(i,a){switch(Dp(a),a.tag){case 3:qr(mt),W();break;case 26:case 27:case 5:Ie(a);break;case 4:W();break;case 31:a.memoizedState!==null&&wn(a);break;case 13:wn(a);break;case 19:J(dt);break;case 10:qr(a.type);break;case 22:case 23:wn(a),jp(),i!==null&&J(ho);break;case 24:qr(mt)}}function Vl(i,a){try{var u=a.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var S=p.next;u=S;do{if((u.tag&i)===i){p=void 0;var b=u.create,C=u.inst;p=b(),C.destroy=p}u=u.next}while(u!==S)}}catch(M){Fe(a,a.return,M)}}function Ni(i,a,u){try{var p=a.updateQueue,S=p!==null?p.lastEffect:null;if(S!==null){var b=S.next;p=b;do{if((p.tag&i)===i){var C=p.inst,M=C.destroy;if(M!==void 0){C.destroy=void 0,S=a;var k=u,H=M;try{H()}catch(j){Fe(S,k,j)}}}p=p.next}while(p!==b)}}catch(j){Fe(a,a.return,j)}}function OE(i){var a=i.updateQueue;if(a!==null){var u=i.stateNode;try{_b(a,u)}catch(p){Fe(i,i.return,p)}}}function NE(i,a,u){u.props=So(i.type,i.memoizedProps),u.state=i.memoizedState;try{u.componentWillUnmount()}catch(p){Fe(i,a,p)}}function Fl(i,a){try{var u=i.ref;if(u!==null){switch(i.tag){case 26:case 27:case 5:var p=i.stateNode;break;case 30:p=i.stateNode;break;default:p=i.stateNode}typeof u=="function"?i.refCleanup=u(p):u.current=p}}catch(S){Fe(i,a,S)}}function yr(i,a){var u=i.ref,p=i.refCleanup;if(u!==null)if(typeof p=="function")try{p()}catch(S){Fe(i,a,S)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(S){Fe(i,a,S)}else u.current=null}function DE(i){var a=i.type,u=i.memoizedProps,p=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&p.focus();break e;case"img":u.src?p.src=u.src:u.srcSet&&(p.srcset=u.srcSet)}}catch(S){Fe(i,i.return,S)}}function wh(i,a,u){try{var p=i.stateNode;G2(p,i.type,u,a),p[cn]=a}catch(S){Fe(i,i.return,S)}}function kE(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&qi(i.type)||i.tag===4}function Mh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||kE(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&qi(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Ih(i,a,u){var p=i.tag;if(p===5||p===6)i=i.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(i,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(i),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=kr));else if(p!==4&&(p===27&&qi(i.type)&&(u=i.stateNode,a=null),i=i.child,i!==null))for(Ih(i,a,u),i=i.sibling;i!==null;)Ih(i,a,u),i=i.sibling}function ju(i,a,u){var p=i.tag;if(p===5||p===6)i=i.stateNode,a?u.insertBefore(i,a):u.appendChild(i);else if(p!==4&&(p===27&&qi(i.type)&&(u=i.stateNode),i=i.child,i!==null))for(ju(i,a,u),i=i.sibling;i!==null;)ju(i,a,u),i=i.sibling}function UE(i){var a=i.stateNode,u=i.memoizedProps;try{for(var p=i.type,S=a.attributes;S.length;)a.removeAttributeNode(S[0]);Ft(a,p,u),a[qt]=i,a[cn]=u}catch(b){Fe(i,i.return,b)}}var $r=!1,yt=!1,Ph=!1,LE=typeof WeakSet=="function"?WeakSet:Set,wt=null;function b2(i,a){if(i=i.containerInfo,Wh=vc,i=jS(i),Tp(i)){if("selectionStart"in i)var u={start:i.selectionStart,end:i.selectionEnd};else e:{u=(u=i.ownerDocument)&&u.defaultView||window;var p=u.getSelection&&u.getSelection();if(p&&p.rangeCount!==0){u=p.anchorNode;var S=p.anchorOffset,b=p.focusNode;p=p.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var C=0,M=-1,k=-1,H=0,j=0,ee=i,F=null;t:for(;;){for(var K;ee!==u||S!==0&&ee.nodeType!==3||(M=C+S),ee!==b||p!==0&&ee.nodeType!==3||(k=C+p),ee.nodeType===3&&(C+=ee.nodeValue.length),(K=ee.firstChild)!==null;)F=ee,ee=K;for(;;){if(ee===i)break t;if(F===u&&++H===S&&(M=C),F===b&&++j===p&&(k=C),(K=ee.nextSibling)!==null)break;ee=F,F=ee.parentNode}ee=K}u=M===-1||k===-1?null:{start:M,end:k}}else u=null}u=u||{start:0,end:0}}else u=null;for(Zh={focusedElem:i,selectionRange:u},vc=!1,wt=a;wt!==null;)if(a=wt,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,wt=i;else for(;wt!==null;){switch(a=wt,b=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(u=0;u title"))),Ft(b,p,u),b[qt]=i,xt(b),p=b;break e;case"link":var C=V_("link","href",S).get(p+(u.href||""));if(C){for(var M=0;MJe&&(C=Je,Je=Se,Se=C);var z=KS(M,Se),L=KS(M,Je);if(z&&L&&(K.rangeCount!==1||K.anchorNode!==z.node||K.anchorOffset!==z.offset||K.focusNode!==L.node||K.focusOffset!==L.offset)){var q=ee.createRange();q.setStart(z.node,z.offset),K.removeAllRanges(),Se>Je?(K.addRange(q),K.extend(L.node,L.offset)):(q.setEnd(L.node,L.offset),K.addRange(q))}}}}for(ee=[],K=M;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;Mu?32:u,V.T=null,u=Lh,Lh=null;var b=Li,C=Xr;if(_t=0,Aa=Li=null,Xr=0,(Ge&6)!==0)throw Error(r(331));var M=Ge;if(Ge|=4,JE(b.current),$E(b,b.current,C,u),Ge=M,Xl(0,!1),_n&&typeof _n.onPostCommitFiberRoot=="function")try{_n.onPostCommitFiberRoot(hl,b)}catch{}return!0}finally{X.p=S,V.T=p,d_(i,a)}}function h_(i,a,u){a=zn(u,a),a=vh(i.stateNode,a,2),i=Pi(i,a,2),i!==null&&(vl(i,2),Sr(i))}function Fe(i,a,u){if(i.tag===3)h_(i,i,u);else for(;a!==null;){if(a.tag===3){h_(a,i,u);break}else if(a.tag===1){var p=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Ui===null||!Ui.has(p))){i=zn(u,i),u=mE(2),p=Pi(a,u,2),p!==null&&(vE(u,p,a,i),vl(p,2),Sr(p));break}}a=a.return}}function Gh(i,a,u){var p=i.pingCache;if(p===null){p=i.pingCache=new T2;var S=new Set;p.set(a,S)}else S=p.get(a),S===void 0&&(S=new Set,p.set(a,S));S.has(u)||(Nh=!0,S.add(u),i=M2.bind(null,i,a,u),a.then(i,i))}function M2(i,a,u){var p=i.pingCache;p!==null&&p.delete(a),i.pingedLanes|=i.suspendedLanes&u,i.warmLanes&=~u,We===i&&(Oe&u)===u&&(st===4||st===3&&(Oe&62914560)===Oe&&300>En()-Zu?(Ge&2)===0&&Ca(i,0):Dh|=u,Ta===Oe&&(Ta=0)),Sr(i)}function m_(i,a){a===0&&(a=uS()),i=so(i,a),i!==null&&(vl(i,a),Sr(i))}function I2(i){var a=i.memoizedState,u=0;a!==null&&(u=a.retryLane),m_(i,u)}function P2(i,a){var u=0;switch(i.tag){case 31:case 13:var p=i.stateNode,S=i.memoizedState;S!==null&&(u=S.retryLane);break;case 19:p=i.stateNode;break;case 22:p=i.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(a),m_(i,u)}function R2(i,a){return ep(i,a)}var oc=null,wa=null,Hh=!1,ac=!1,Vh=!1,Bi=0;function Sr(i){i!==wa&&i.next===null&&(wa===null?oc=wa=i:wa=wa.next=i),ac=!0,Hh||(Hh=!0,N2())}function Xl(i,a){if(!Vh&&ac){Vh=!0;do for(var u=!1,p=oc;p!==null;){if(i!==0){var S=p.pendingLanes;if(S===0)var b=0;else{var C=p.suspendedLanes,M=p.pingedLanes;b=(1<<31-Tn(42|i)+1)-1,b&=S&~(C&~M),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(u=!0,S_(p,b))}else b=Oe,b=cu(p,p===We?b:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(b&3)===0||ml(p,b)||(u=!0,S_(p,b));p=p.next}while(u);Vh=!1}}function O2(){v_()}function v_(){ac=Hh=!1;var i=0;Bi!==0&&V2()&&(i=Bi);for(var a=En(),u=null,p=oc;p!==null;){var S=p.next,b=g_(p,a);b===0?(p.next=null,u===null?oc=S:u.next=S,S===null&&(wa=u)):(u=p,(i!==0||(b&3)!==0)&&(ac=!0)),p=S}_t!==0&&_t!==5||Xl(i),Bi!==0&&(Bi=0)}function g_(i,a){for(var u=i.suspendedLanes,p=i.pingedLanes,S=i.expirationTimes,b=i.pendingLanes&-62914561;0M)break;var j=k.transferSize,ee=k.initiatorType;j&&w_(ee)&&(k=k.responseEnd,C+=j*(k"u"?null:document;function B_(i,a,u){var p=Ma;if(p&&typeof a=="string"&&a){var S=Un(a);S='link[rel="'+i+'"][href="'+S+'"]',typeof u=="string"&&(S+='[crossorigin="'+u+'"]'),z_.has(S)||(z_.add(S),i={rel:i,crossOrigin:u,href:a},p.querySelector(S)===null&&(a=p.createElement("link"),Ft(a,"link",i),xt(a),p.head.appendChild(a)))}}function Z2(i){Wr.D(i),B_("dns-prefetch",i,null)}function Q2(i,a){Wr.C(i,a),B_("preconnect",i,a)}function eU(i,a,u){Wr.L(i,a,u);var p=Ma;if(p&&i&&a){var S='link[rel="preload"][as="'+Un(a)+'"]';a==="image"&&u&&u.imageSrcSet?(S+='[imagesrcset="'+Un(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(S+='[imagesizes="'+Un(u.imageSizes)+'"]')):S+='[href="'+Un(i)+'"]';var b=S;switch(a){case"style":b=Ia(i);break;case"script":b=Pa(i)}Fn.has(b)||(i=v({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:i,as:a},u),Fn.set(b,i),p.querySelector(S)!==null||a==="style"&&p.querySelector(es(b))||a==="script"&&p.querySelector(ts(b))||(a=p.createElement("link"),Ft(a,"link",i),xt(a),p.head.appendChild(a)))}}function tU(i,a){Wr.m(i,a);var u=Ma;if(u&&i){var p=a&&typeof a.as=="string"?a.as:"script",S='link[rel="modulepreload"][as="'+Un(p)+'"][href="'+Un(i)+'"]',b=S;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Pa(i)}if(!Fn.has(b)&&(i=v({rel:"modulepreload",href:i},a),Fn.set(b,i),u.querySelector(S)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ts(b)))return}p=u.createElement("link"),Ft(p,"link",i),xt(p),u.head.appendChild(p)}}}function nU(i,a,u){Wr.S(i,a,u);var p=Ma;if(p&&i){var S=Wo(p).hoistableStyles,b=Ia(i);a=a||"default";var C=S.get(b);if(!C){var M={loading:0,preload:null};if(C=p.querySelector(es(b)))M.loading=5;else{i=v({rel:"stylesheet",href:i,"data-precedence":a},u),(u=Fn.get(b))&&om(i,u);var k=C=p.createElement("link");xt(k),Ft(k,"link",i),k._p=new Promise(function(H,j){k.onload=H,k.onerror=j}),k.addEventListener("load",function(){M.loading|=1}),k.addEventListener("error",function(){M.loading|=2}),M.loading|=4,fc(C,a,p)}C={type:"stylesheet",instance:C,count:1,state:M},S.set(b,C)}}}function rU(i,a){Wr.X(i,a);var u=Ma;if(u&&i){var p=Wo(u).hoistableScripts,S=Pa(i),b=p.get(S);b||(b=u.querySelector(ts(S)),b||(i=v({src:i,async:!0},a),(a=Fn.get(S))&&am(i,a),b=u.createElement("script"),xt(b),Ft(b,"link",i),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(S,b))}}function iU(i,a){Wr.M(i,a);var u=Ma;if(u&&i){var p=Wo(u).hoistableScripts,S=Pa(i),b=p.get(S);b||(b=u.querySelector(ts(S)),b||(i=v({src:i,async:!0,type:"module"},a),(a=Fn.get(S))&&am(i,a),b=u.createElement("script"),xt(b),Ft(b,"link",i),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(S,b))}}function q_(i,a,u,p){var S=(S=Ae.current)?cc(S):null;if(!S)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Ia(u.href),u=Wo(S).hoistableStyles,p=u.get(a),p||(p={type:"style",instance:null,count:0,state:null},u.set(a,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){i=Ia(u.href);var b=Wo(S).hoistableStyles,C=b.get(i);if(C||(S=S.ownerDocument||S,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(i,C),(b=S.querySelector(es(i)))&&!b._p&&(C.instance=b,C.state.loading=5),Fn.has(i)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Fn.set(i,u),b||oU(S,i,u,C.state))),a&&p===null)throw Error(r(528,""));return C}if(a&&p!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Pa(u),u=Wo(S).hoistableScripts,p=u.get(a),p||(p={type:"script",instance:null,count:0,state:null},u.set(a,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ia(i){return'href="'+Un(i)+'"'}function es(i){return'link[rel="stylesheet"]['+i+"]"}function G_(i){return v({},i,{"data-precedence":i.precedence,precedence:null})}function oU(i,a,u,p){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?p.loading=1:(a=i.createElement("link"),p.preload=a,a.addEventListener("load",function(){return p.loading|=1}),a.addEventListener("error",function(){return p.loading|=2}),Ft(a,"link",u),xt(a),i.head.appendChild(a))}function Pa(i){return'[src="'+Un(i)+'"]'}function ts(i){return"script[async]"+i}function H_(i,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var p=i.querySelector('style[data-href~="'+Un(u.href)+'"]');if(p)return a.instance=p,xt(p),p;var S=v({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return p=(i.ownerDocument||i).createElement("style"),xt(p),Ft(p,"style",S),fc(p,u.precedence,i),a.instance=p;case"stylesheet":S=Ia(u.href);var b=i.querySelector(es(S));if(b)return a.state.loading|=4,a.instance=b,xt(b),b;p=G_(u),(S=Fn.get(S))&&om(p,S),b=(i.ownerDocument||i).createElement("link"),xt(b);var C=b;return C._p=new Promise(function(M,k){C.onload=M,C.onerror=k}),Ft(b,"link",p),a.state.loading|=4,fc(b,u.precedence,i),a.instance=b;case"script":return b=Pa(u.src),(S=i.querySelector(ts(b)))?(a.instance=S,xt(S),S):(p=u,(S=Fn.get(b))&&(p=v({},u),am(p,S)),i=i.ownerDocument||i,S=i.createElement("script"),xt(S),Ft(S,"link",p),i.head.appendChild(S),a.instance=S);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(p=a.instance,a.state.loading|=4,fc(p,u.precedence,i));return a.instance}function fc(i,a,u){for(var p=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=p.length?p[p.length-1]:null,b=S,C=0;C title"):null)}function aU(i,a,u){if(u===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function $_(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function lU(i,a,u,p){if(u.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var S=Ia(p.href),b=a.querySelector(es(S));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=pc.bind(i),a.then(i,i)),u.state.loading|=4,u.instance=b,xt(b);return}b=a.ownerDocument||a,p=G_(p),(S=Fn.get(S))&&om(p,S),b=b.createElement("link"),xt(b);var C=b;C._p=new Promise(function(M,k){C.onload=M,C.onerror=k}),Ft(b,"link",p),u.instance=b}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(i.count++,u=pc.bind(i),a.addEventListener("load",u),a.addEventListener("error",u))}}var lm=0;function sU(i,a){return i.stylesheets&&i.count===0&&mc(i,i.stylesheets),0lm?50:800)+a);return i.unsuspend=u,function(){i.unsuspend=null,clearTimeout(p),clearTimeout(S)}}:null}function pc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)mc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var hc=null;function mc(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,hc=new Map,a.forEach(uU,i),hc=null,pc.call(i))}function uU(i,a){if(!(a.state.loading&4)){var u=hc.get(i);if(u)var p=u.get(null);else{u=new Map,hc.set(i,u);for(var S=i.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),gm.exports=MU(),gm.exports}var PU=IU();const RU=Ir(PU),OU=e=>{const t=e.trim();if(!t)return{type:"transactions",data:[]};const n=f=>{const h=[];let v="",y=!1;for(let E=0;Ef.includes(","));if(o===-1)return{type:"transactions",data:[]};const l=n(r[o]),s=l.map(f=>f.toLowerCase().trim().replace(/[^a-z0-9]/g,"_")),c=r.slice(o+1).filter(f=>f.trim()!==""&&f.includes(",")).map(f=>{const h=n(f),v={},y={};l.forEach((_,T)=>{const A=h[T]||"",w=_.trim(),R=s[T];v[R]=A,y[w]=A}),v.metadata=y;const E=v.amount||v.value||v.balance||v.closing_ledger||v.total||v.price||v.volume||v.amount_cents||v.value_in_ftm||v.value_out_ftm||"0";return v.amount=parseFloat(String(E).replace(/[^0-9.-]/g,""))||0,v.effective_date=v.date||v.effective_date||v.timestamp||v.created_at||v.as_of_date_time||v.datetime||v.time||new Date().toISOString(),v.counterparty=v.counterparty||v.merchant||v.vendor||v.description||v.name||v.payee||v.receiver||v.sender||"Institutional Node",v.direction||(v.amount<0?v.direction="debit":v.amount>0?v.direction="credit":v.direction="balance"),v.status=v.status||v.state||"Settled",v.id=v.id||v.tx_hash||v.transaction_id||`node_${Math.random().toString(36).substr(2,9)}`,v});let d="transactions";return s.some(f=>f.includes("balance"))?d="balance_reports":s.some(f=>f.includes("email")||f.includes("party"))&&(d="accounts"),{type:d,data:c}};var NU={};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let DU,kU;function UU(){return{geminiUrl:DU,vertexUrl:kU}}function LU(e,t,n,r){var o,l;if(!(e!=null&&e.baseUrl)){const s=UU();return t?(o=s.vertexUrl)!==null&&o!==void 0?o:n:(l=s.geminiUrl)!==null&&l!==void 0?l:r}return e.baseUrl}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class di{}function ue(e,t){const n=/\{([^}]+)\}/g;return e.replace(n,(r,o)=>{if(Object.prototype.hasOwnProperty.call(t,o)){const l=t[o];return l!=null?String(l):""}else throw new Error(`Key '${o}' not found in valueMap.`)})}function g(e,t,n){for(let l=0;l({}));else throw new Error(`Value must be a list given an array path ${s}`);if(Array.isArray(e[c])){const d=e[c];if(Array.isArray(n))for(let f=0;fm(c,t.slice(r+1),n)):n}else return n}else e=e[o]}return e}catch(r){if(r instanceof TypeError)return n;throw r}}function zU(e,t){for(const[n,r]of Object.entries(t)){const o=n.split("."),l=r.split("."),s=new Set;let c=-1;for(let d=0;dc)for(let d=c;d=t.length||typeof e!="object"||e===null)return;const l=t[r];if(l.endsWith("[]")){const s=l.slice(0,-2),c=e;if(s in c&&Array.isArray(c[s]))for(const d of c[s])og(d,t,n,r+1,o)}else if(l==="*"){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){const s=e,c=Object.keys(s).filter(f=>!f.startsWith("_")&&!o.has(f)),d={};for(const f of c)d[f]=s[f];for(const[f,h]of Object.entries(d)){const v=[];for(const y of n.slice(r))y==="*"?v.push(f):v.push(y);g(s,v,h)}for(const f of c)delete s[f]}}else{const s=e;l in s&&og(s[l],t,n,r+1,o)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Ey(e){if(typeof e!="string")throw new Error("fromImageBytes must be a string");return e}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function BU(e){const t={},n=m(e,["operationName"]);n!=null&&g(t,["operationName"],n);const r=m(e,["resourceName"]);return r!=null&&g(t,["_url","resourceName"],r),t}function qU(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response","generateVideoResponse"]);return s!=null&&g(t,["response"],HU(s)),t}function GU(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response"]);return s!=null&&g(t,["response"],VU(s)),t}function HU(e){const t={},n=m(e,["generatedSamples"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(s=>FU(s))),g(t,["generatedVideos"],l)}const r=m(e,["raiMediaFilteredCount"]);r!=null&&g(t,["raiMediaFilteredCount"],r);const o=m(e,["raiMediaFilteredReasons"]);return o!=null&&g(t,["raiMediaFilteredReasons"],o),t}function VU(e){const t={},n=m(e,["videos"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(s=>$U(s))),g(t,["generatedVideos"],l)}const r=m(e,["raiMediaFilteredCount"]);r!=null&&g(t,["raiMediaFilteredCount"],r);const o=m(e,["raiMediaFilteredReasons"]);return o!=null&&g(t,["raiMediaFilteredReasons"],o),t}function FU(e){const t={},n=m(e,["video"]);return n!=null&&g(t,["video"],WU(n)),t}function $U(e){const t={},n=m(e,["_self"]);return n!=null&&g(t,["video"],ZU(n)),t}function YU(e){const t={},n=m(e,["operationName"]);return n!=null&&g(t,["_url","operationName"],n),t}function KU(e){const t={},n=m(e,["operationName"]);return n!=null&&g(t,["_url","operationName"],n),t}function JU(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response"]);return s!=null&&g(t,["response"],jU(s)),t}function jU(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["parent"]);r!=null&&g(t,["parent"],r);const o=m(e,["documentName"]);return o!=null&&g(t,["documentName"],o),t}function FM(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response"]);return s!=null&&g(t,["response"],XU(s)),t}function XU(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["parent"]);r!=null&&g(t,["parent"],r);const o=m(e,["documentName"]);return o!=null&&g(t,["documentName"],o),t}function WU(e){const t={},n=m(e,["uri"]);n!=null&&g(t,["uri"],n);const r=m(e,["encodedVideo"]);r!=null&&g(t,["videoBytes"],Ey(r));const o=m(e,["encoding"]);return o!=null&&g(t,["mimeType"],o),t}function ZU(e){const t={},n=m(e,["gcsUri"]);n!=null&&g(t,["uri"],n);const r=m(e,["bytesBase64Encoded"]);r!=null&&g(t,["videoBytes"],Ey(r));const o=m(e,["mimeType"]);return o!=null&&g(t,["mimeType"],o),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var mT;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(mT||(mT={}));var vT;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(vT||(vT={}));var gT;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(gT||(gT={}));var Ue;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.STRING="STRING",e.NUMBER="NUMBER",e.INTEGER="INTEGER",e.BOOLEAN="BOOLEAN",e.ARRAY="ARRAY",e.OBJECT="OBJECT",e.NULL="NULL"})(Ue||(Ue={}));var yT;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})(yT||(yT={}));var ST;(function(e){e.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",e.NO_AUTH="NO_AUTH",e.API_KEY_AUTH="API_KEY_AUTH",e.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",e.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",e.OAUTH="OAUTH",e.OIDC_AUTH="OIDC_AUTH"})(ST||(ST={}));var bT;(function(e){e.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",e.HTTP_IN_QUERY="HTTP_IN_QUERY",e.HTTP_IN_HEADER="HTTP_IN_HEADER",e.HTTP_IN_PATH="HTTP_IN_PATH",e.HTTP_IN_BODY="HTTP_IN_BODY",e.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(bT||(bT={}));var ET;(function(e){e.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",e.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",e.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",e.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(ET||(ET={}));var _T;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.BLOCKING="BLOCKING",e.NON_BLOCKING="NON_BLOCKING"})(_T||(_T={}));var TT;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(TT||(TT={}));var AT;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})(AT||(AT={}));var CT;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH",e.MINIMAL="MINIMAL"})(CT||(CT={}));var xT;(function(e){e.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",e.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",e.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",e.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",e.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",e.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",e.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",e.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",e.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(xT||(xT={}));var wT;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(wT||(wT={}));var MT;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE",e.OFF="OFF"})(MT||(MT={}));var IT;(function(e){e.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",e.STOP="STOP",e.MAX_TOKENS="MAX_TOKENS",e.SAFETY="SAFETY",e.RECITATION="RECITATION",e.LANGUAGE="LANGUAGE",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.SPII="SPII",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.IMAGE_SAFETY="IMAGE_SAFETY",e.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",e.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",e.NO_IMAGE="NO_IMAGE",e.IMAGE_RECITATION="IMAGE_RECITATION",e.IMAGE_OTHER="IMAGE_OTHER"})(IT||(IT={}));var PT;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(PT||(PT={}));var RT;(function(e){e.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",e.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",e.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",e.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",e.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(RT||(RT={}));var OT;(function(e){e.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",e.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",e.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",e.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",e.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(OT||(OT={}));var NT;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.IMAGE_SAFETY="IMAGE_SAFETY",e.MODEL_ARMOR="MODEL_ARMOR",e.JAILBREAK="JAILBREAK"})(NT||(NT={}));var DT;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",e.ON_DEMAND="ON_DEMAND",e.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(DT||(DT={}));var Qc;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO"})(Qc||(Qc={}));var kT;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",e.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",e.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",e.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(kT||(kT={}));var UT;(function(e){e.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",e.TUNING_MODE_FULL="TUNING_MODE_FULL",e.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(UT||(UT={}));var LT;(function(e){e.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",e.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",e.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",e.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",e.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",e.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",e.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(LT||(LT={}));var ag;(function(e){e.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",e.JOB_STATE_QUEUED="JOB_STATE_QUEUED",e.JOB_STATE_PENDING="JOB_STATE_PENDING",e.JOB_STATE_RUNNING="JOB_STATE_RUNNING",e.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",e.JOB_STATE_FAILED="JOB_STATE_FAILED",e.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",e.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",e.JOB_STATE_PAUSED="JOB_STATE_PAUSED",e.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",e.JOB_STATE_UPDATING="JOB_STATE_UPDATING",e.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(ag||(ag={}));var zT;(function(e){e.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",e.TUNING_TASK_I2V="TUNING_TASK_I2V",e.TUNING_TASK_T2V="TUNING_TASK_T2V",e.TUNING_TASK_R2V="TUNING_TASK_R2V"})(zT||(zT={}));var BT;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",e.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",e.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",e.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",e.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(BT||(BT={}));var lg;(function(e){e.COLLECTION="COLLECTION"})(lg||(lg={}));var qT;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(qT||(qT={}));var GT;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(GT||(GT={}));var HT;(function(e){e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE"})(HT||(HT={}));var VT;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(VT||(VT={}));var FT;(function(e){e.auto="auto",e.en="en",e.ja="ja",e.ko="ko",e.hi="hi",e.zh="zh",e.pt="pt",e.es="es"})(FT||(FT={}));var $T;(function(e){e.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",e.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",e.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",e.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",e.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})($T||($T={}));var YT;(function(e){e.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",e.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",e.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",e.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(YT||(YT={}));var KT;(function(e){e.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",e.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",e.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",e.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(KT||(KT={}));var JT;(function(e){e.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",e.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",e.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",e.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",e.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",e.EDIT_MODE_STYLE="EDIT_MODE_STYLE",e.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",e.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(JT||(JT={}));var jT;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(jT||(jT={}));var XT;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(XT||(XT={}));var WT;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(WT||(WT={}));var ZT;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(ZT||(ZT={}));var QT;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING"})(QT||(QT={}));var eA;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(eA||(eA={}));var tA;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(tA||(tA={}));var nA;(function(e){e.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",e.UPLOADED="UPLOADED",e.GENERATED="GENERATED",e.REGISTERED="REGISTERED"})(nA||(nA={}));var rA;(function(e){e.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.RESPONSE_REJECTED="RESPONSE_REJECTED",e.NEED_MORE_INPUT="NEED_MORE_INPUT"})(rA||(rA={}));var iA;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(iA||(iA={}));var oA;(function(e){e.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",e.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",e.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(oA||(oA={}));var aA;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(aA||(aA={}));var lA;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(lA||(lA={}));var sA;(function(e){e.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",e.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",e.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(sA||(sA={}));var uA;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",e.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",e.NO_INTERRUPTION="NO_INTERRUPTION"})(uA||(uA={}));var cA;(function(e){e.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",e.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",e.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(cA||(cA={}));var fA;(function(e){e.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",e.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",e.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",e.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",e.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",e.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",e.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",e.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",e.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",e.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",e.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",e.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",e.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(fA||(fA={}));var dA;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",e.QUALITY="QUALITY",e.DIVERSITY="DIVERSITY",e.VOCALIZATION="VOCALIZATION"})(dA||(dA={}));var za;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(za||(za={}));class sg{constructor(t){const n={};for(const r of t.headers.entries())n[r[0]]=r[1];this.headers=n,this.responseInternal=t}json(){return this.responseInternal.json()}}class ss{get text(){var t,n,r,o,l,s,c,d;if(((o=(r=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||r===void 0?void 0:r.parts)===null||o===void 0?void 0:o.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 f="",h=!1;const v=[];for(const y of(d=(c=(s=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||s===void 0?void 0:s.content)===null||c===void 0?void 0:c.parts)!==null&&d!==void 0?d:[]){for(const[E,_]of Object.entries(y))E!=="text"&&E!=="thought"&&E!=="thoughtSignature"&&(_!==null||_!==void 0)&&v.push(E);if(typeof y.text=="string"){if(typeof y.thought=="boolean"&&y.thought)continue;h=!0,f+=y.text}}return v.length>0&&console.warn(`there are non-text parts ${v} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),h?f:void 0}get data(){var t,n,r,o,l,s,c,d;if(((o=(r=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||r===void 0?void 0:r.parts)===null||o===void 0?void 0:o.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 f="";const h=[];for(const v of(d=(c=(s=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||s===void 0?void 0:s.content)===null||c===void 0?void 0:c.parts)!==null&&d!==void 0?d:[]){for(const[y,E]of Object.entries(v))y!=="inlineData"&&(E!==null||E!==void 0)&&h.push(y);v.inlineData&&typeof v.inlineData.data=="string"&&(f+=atob(v.inlineData.data))}return h.length>0&&console.warn(`there are non-data parts ${h} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),f.length>0?btoa(f):void 0}get functionCalls(){var t,n,r,o,l,s,c,d;if(((o=(r=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||r===void 0?void 0:r.parts)===null||o===void 0?void 0:o.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 f=(d=(c=(s=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||s===void 0?void 0:s.content)===null||c===void 0?void 0:c.parts)===null||d===void 0?void 0:d.filter(h=>h.functionCall).map(h=>h.functionCall).filter(h=>h!==void 0);if((f==null?void 0:f.length)!==0)return f}get executableCode(){var t,n,r,o,l,s,c,d,f;if(((o=(r=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||r===void 0?void 0:r.parts)===null||o===void 0?void 0:o.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 h=(d=(c=(s=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||s===void 0?void 0:s.content)===null||c===void 0?void 0:c.parts)===null||d===void 0?void 0:d.filter(v=>v.executableCode).map(v=>v.executableCode).filter(v=>v!==void 0);if((h==null?void 0:h.length)!==0)return(f=h==null?void 0:h[0])===null||f===void 0?void 0:f.code}get codeExecutionResult(){var t,n,r,o,l,s,c,d,f;if(((o=(r=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||r===void 0?void 0:r.parts)===null||o===void 0?void 0:o.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 h=(d=(c=(s=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||s===void 0?void 0:s.content)===null||c===void 0?void 0:c.parts)===null||d===void 0?void 0:d.filter(v=>v.codeExecutionResult).map(v=>v.codeExecutionResult).filter(v=>v!==void 0);if((h==null?void 0:h.length)!==0)return(f=h==null?void 0:h[0])===null||f===void 0?void 0:f.output}}class pA{}class hA{}class QU{}class eL{}class tL{}class nL{}class mA{}class vA{}class gA{}class rL{}class ef{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){const r=new ef;let o;const l=t;return n?o=GU(l):o=qU(l),Object.assign(r,o),r}}class yA{}class SA{}class bA{}class EA{}class iL{}class oL{}class aL{}class _y{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){const r=new _y,l=JU(t);return Object.assign(r,l),r}}class lL{}class sL{}class uL{}class _A{}class cL{get text(){var t,n,r;let o="",l=!1;const s=[];for(const c of(r=(n=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||n===void 0?void 0:n.parts)!==null&&r!==void 0?r:[]){for(const[d,f]of Object.entries(c))d!=="text"&&d!=="thought"&&f!==null&&s.push(d);if(typeof c.text=="string"){if(typeof c.thought=="boolean"&&c.thought)continue;l=!0,o+=c.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.`),l?o:void 0}get data(){var t,n,r;let o="";const l=[];for(const s of(r=(n=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||n===void 0?void 0:n.parts)!==null&&r!==void 0?r:[]){for(const[c,d]of Object.entries(s))c!=="inlineData"&&d!==null&&l.push(c);s.inlineData&&typeof s.inlineData.data=="string"&&(o+=atob(s.inlineData.data))}return l.length>0&&console.warn(`there are non-data parts ${l} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),o.length>0?btoa(o):void 0}}class fL{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class Ty{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){const r=new Ty,l=FM(t);return Object.assign(r,l),r}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Be(e,t){if(!t||typeof t!="string")throw new Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw new Error("invalid model parameter");if(e.isVertexAI()){if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;if(t.indexOf("/")>=0){const n=t.split("/",2);return`publishers/${n[0]}/models/${n[1]}`}else return`publishers/google/models/${t}`}else return t.startsWith("models/")||t.startsWith("tunedModels/")?t:`models/${t}`}function $M(e,t){const n=Be(e,t);return n?n.startsWith("publishers/")&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}`:n.startsWith("models/")&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/publishers/google/${n}`:n:""}function YM(e){return Array.isArray(e)?e.map(t=>tf(t)):[tf(e)]}function tf(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function KM(e){const t=tf(e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function JM(e){const t=tf(e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function TA(e){if(e==null)throw new Error("PartUnion is required");if(typeof e=="object")return e;if(typeof e=="string")return{text:e};throw new Error(`Unsupported part type: ${typeof e}`)}function jM(e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("PartListUnion is required");return Array.isArray(e)?e.map(t=>TA(t)):[TA(e)]}function ug(e){return e!=null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)}function AA(e){return e!=null&&typeof e=="object"&&"functionCall"in e}function CA(e){return e!=null&&typeof e=="object"&&"functionResponse"in e}function Wt(e){if(e==null)throw new Error("ContentUnion is required");return ug(e)?e:{role:"user",parts:jM(e)}}function Ay(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap(n=>{const r=Wt(n);return r.parts&&r.parts.length>0&&r.parts[0].text!==void 0?[r.parts[0].text]:[]});if(e.isVertexAI()){const n=Wt(t);return n.parts&&n.parts.length>0&&n.parts[0].text!==void 0?[n.parts[0].text]:[]}return Array.isArray(t)?t.map(n=>Wt(n)):[Wt(t)]}function jn(e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("contents are required");if(!Array.isArray(e)){if(AA(e)||CA(e))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[Wt(e)]}const t=[],n=[],r=ug(e[0]);for(const o of e){const l=ug(o);if(l!=r)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(l)t.push(o);else{if(AA(o)||CA(o))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");n.push(o)}}return r||t.push({role:"user",parts:jM(n)}),t}function dL(e,t){e.includes("null")&&(t.nullable=!0);const n=e.filter(r=>r!=="null");if(n.length===1)t.type=Object.values(Ue).includes(n[0].toUpperCase())?n[0].toUpperCase():Ue.TYPE_UNSPECIFIED;else{t.anyOf=[];for(const r of n)t.anyOf.push({type:Object.values(Ue).includes(r.toUpperCase())?r.toUpperCase():Ue.TYPE_UNSPECIFIED})}}function Va(e){const t={},n=["items"],r=["anyOf"],o=["properties"];if(e.type&&e.anyOf)throw new Error("type and anyOf cannot be both populated.");const l=e.anyOf;l!=null&&l.length==2&&(l[0].type==="null"?(t.nullable=!0,e=l[1]):l[1].type==="null"&&(t.nullable=!0,e=l[0])),e.type instanceof Array&&dL(e.type,t);for(const[s,c]of Object.entries(e))if(c!=null)if(s=="type"){if(c==="null")throw new Error("type: null can not be the only possible type for the field.");if(c instanceof Array)continue;t.type=Object.values(Ue).includes(c.toUpperCase())?c.toUpperCase():Ue.TYPE_UNSPECIFIED}else if(n.includes(s))t[s]=Va(c);else if(r.includes(s)){const d=[];for(const f of c){if(f.type=="null"){t.nullable=!0;continue}d.push(Va(f))}t[s]=d}else if(o.includes(s)){const d={};for(const[f,h]of Object.entries(c))d[f]=Va(h);t[s]=d}else{if(s==="additionalProperties")continue;t[s]=c}return t}function Cy(e){return Va(e)}function xy(e){if(typeof e=="object")return e;if(typeof e=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};throw new Error(`Unsupported speechConfig type: ${typeof e}`)}function wy(e){if("multiSpeakerVoiceConfig"in e)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return e}function tl(e){if(e.functionDeclarations)for(const t of e.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes("$schema")?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=Va(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=Va(t.response));return e}function nl(e){if(e==null)throw new Error("tools is required");if(!Array.isArray(e))throw new Error("tools is required and must be an array of Tools");const t=[];for(const n of e)t.push(n);return t}function pL(e,t,n,r=1){const o=!t.startsWith(`${n}/`)&&t.split("/").length===r;return e.isVertexAI()?t.startsWith("projects/")?t:t.startsWith("locations/")?`projects/${e.getProject()}/${t}`:t.startsWith(`${n}/`)?`projects/${e.getProject()}/locations/${e.getLocation()}/${t}`:o?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}/${t}`:t:o?`${n}/${t}`:t}function pi(e,t){if(typeof t!="string")throw new Error("name must be a string");return pL(e,t,"cachedContents")}function XM(e){switch(e){case"STATE_UNSPECIFIED":return"JOB_STATE_UNSPECIFIED";case"CREATING":return"JOB_STATE_RUNNING";case"ACTIVE":return"JOB_STATE_SUCCEEDED";case"FAILED":return"JOB_STATE_FAILED";default:return e}}function eo(e){return Ey(e)}function hL(e){return e!=null&&typeof e=="object"&&"name"in e}function mL(e){return e!=null&&typeof e=="object"&&"video"in e}function vL(e){return e!=null&&typeof e=="object"&&"uri"in e}function WM(e){var t;let n;if(hL(e)&&(n=e.name),!(vL(e)&&(n=e.uri,n===void 0))&&!(mL(e)&&(n=(t=e.video)===null||t===void 0?void 0:t.uri,n===void 0))){if(typeof e=="string"&&(n=e),n===void 0)throw new Error("Could not extract file name from the provided input.");if(n.startsWith("https://")){const o=n.split("files/")[1].match(/[a-z0-9]+/);if(o===null)throw new Error(`Could not extract file name from URI ${n}`);n=o[0]}else n.startsWith("files/")&&(n=n.split("files/")[1]);return n}}function ZM(e,t){let n;return e.isVertexAI()?n=t?"publishers/google/models":"models":n=t?"models":"tunedModels",n}function QM(e){for(const t of["models","tunedModels","publisherModels"])if(gL(e,t))return e[t];return[]}function gL(e,t){return e!==null&&typeof e=="object"&&t in e}function yL(e,t={}){const n=e,r={name:n.name,description:n.description,parametersJsonSchema:n.inputSchema};return n.outputSchema&&(r.responseJsonSchema=n.outputSchema),t.behavior&&(r.behavior=t.behavior),{functionDeclarations:[r]}}function SL(e,t={}){const n=[],r=new Set;for(const o of e){const l=o.name;if(r.has(l))throw new Error(`Duplicate function name ${l} found in MCP tools. Please ensure function names are unique.`);r.add(l);const s=yL(o,t);s.functionDeclarations&&n.push(...s.functionDeclarations)}return{functionDeclarations:n}}function eI(e,t){let n;if(typeof t=="string")if(e.isVertexAI())if(t.startsWith("gs://"))n={format:"jsonl",gcsUri:[t]};else if(t.startsWith("bq://"))n={format:"bigquery",bigqueryUri:t};else throw new Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))n={fileName:t};else throw new Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(e.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");n={inlinedRequests:t}}else n=t;const r=[n.gcsUri,n.bigqueryUri].filter(Boolean).length,o=[n.inlinedRequests,n.fileName].filter(Boolean).length;if(e.isVertexAI()){if(o>0||r!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(r>0||o!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return n}function bL(e){if(typeof e!="string")return e;const t=e;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};throw new Error(`Unsupported destination: ${t}`)}function tI(e){if(typeof e!="object"||e===null)return{};const t=e,n=t.inlinedResponses;if(typeof n!="object"||n===null)return e;const o=n.inlinedResponses;if(!Array.isArray(o)||o.length===0)return e;let l=!1;for(const s of o){if(typeof s!="object"||s===null)continue;const d=s.response;if(typeof d!="object"||d===null)continue;if(d.embedding!==void 0){l=!0;break}}return l&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),e}function rl(e,t){const n=t;if(!e.isVertexAI()){if(/batches\/[^/]+$/.test(n))return n.split("/").pop();throw new Error(`Invalid batch job name: ${n}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(n))return n.split("/").pop();if(/^\d+$/.test(n))return n;throw new Error(`Invalid batch job name: ${n}.`)}function nI(e){const t=e;return t==="BATCH_STATE_UNSPECIFIED"?"JOB_STATE_UNSPECIFIED":t==="BATCH_STATE_PENDING"?"JOB_STATE_PENDING":t==="BATCH_STATE_RUNNING"?"JOB_STATE_RUNNING":t==="BATCH_STATE_SUCCEEDED"?"JOB_STATE_SUCCEEDED":t==="BATCH_STATE_FAILED"?"JOB_STATE_FAILED":t==="BATCH_STATE_CANCELLED"?"JOB_STATE_CANCELLED":t==="BATCH_STATE_EXPIRED"?"JOB_STATE_EXPIRED":t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function EL(e){const t={},n=m(e,["responsesFile"]);n!=null&&g(t,["fileName"],n);const r=m(e,["inlinedResponses","inlinedResponses"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(s=>tz(s))),g(t,["inlinedResponses"],l)}const o=m(e,["inlinedEmbedContentResponses","inlinedResponses"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["inlinedEmbedContentResponses"],l)}return t}function _L(e){const t={},n=m(e,["predictionsFormat"]);n!=null&&g(t,["format"],n);const r=m(e,["gcsDestination","outputUriPrefix"]);r!=null&&g(t,["gcsUri"],r);const o=m(e,["bigqueryDestination","outputUri"]);return o!=null&&g(t,["bigqueryUri"],o),t}function TL(e){const t={},n=m(e,["format"]);n!=null&&g(t,["predictionsFormat"],n);const r=m(e,["gcsUri"]);r!=null&&g(t,["gcsDestination","outputUriPrefix"],r);const o=m(e,["bigqueryUri"]);if(o!=null&&g(t,["bigqueryDestination","outputUri"],o),m(e,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(m(e,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(m(e,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return t}function $c(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata","displayName"]);r!=null&&g(t,["displayName"],r);const o=m(e,["metadata","state"]);o!=null&&g(t,["state"],nI(o));const l=m(e,["metadata","createTime"]);l!=null&&g(t,["createTime"],l);const s=m(e,["metadata","endTime"]);s!=null&&g(t,["endTime"],s);const c=m(e,["metadata","updateTime"]);c!=null&&g(t,["updateTime"],c);const d=m(e,["metadata","model"]);d!=null&&g(t,["model"],d);const f=m(e,["metadata","output"]);return f!=null&&g(t,["dest"],EL(tI(f))),t}function cg(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["displayName"]);r!=null&&g(t,["displayName"],r);const o=m(e,["state"]);o!=null&&g(t,["state"],nI(o));const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["createTime"]);s!=null&&g(t,["createTime"],s);const c=m(e,["startTime"]);c!=null&&g(t,["startTime"],c);const d=m(e,["endTime"]);d!=null&&g(t,["endTime"],d);const f=m(e,["updateTime"]);f!=null&&g(t,["updateTime"],f);const h=m(e,["model"]);h!=null&&g(t,["model"],h);const v=m(e,["inputConfig"]);v!=null&&g(t,["src"],AL(v));const y=m(e,["outputConfig"]);y!=null&&g(t,["dest"],_L(tI(y)));const E=m(e,["completionStats"]);return E!=null&&g(t,["completionStats"],E),t}function AL(e){const t={},n=m(e,["instancesFormat"]);n!=null&&g(t,["format"],n);const r=m(e,["gcsSource","uris"]);r!=null&&g(t,["gcsUri"],r);const o=m(e,["bigquerySource","inputUri"]);return o!=null&&g(t,["bigqueryUri"],o),t}function CL(e,t){const n={};if(m(t,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(m(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(m(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const r=m(t,["fileName"]);r!=null&&g(n,["fileName"],r);const o=m(t,["inlinedRequests"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>ez(e,s))),g(n,["requests","requests"],l)}return n}function xL(e){const t={},n=m(e,["format"]);n!=null&&g(t,["instancesFormat"],n);const r=m(e,["gcsUri"]);r!=null&&g(t,["gcsSource","uris"],r);const o=m(e,["bigqueryUri"]);if(o!=null&&g(t,["bigquerySource","inputUri"],o),m(e,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(m(e,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return t}function wL(e){const t={},n=m(e,["data"]);if(n!=null&&g(t,["data"],n),m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function ML(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],rl(e,r)),n}function IL(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],rl(e,r)),n}function PL(e){const t={},n=m(e,["content"]);n!=null&&g(t,["content"],n);const r=m(e,["citationMetadata"]);r!=null&&g(t,["citationMetadata"],RL(r));const o=m(e,["tokenCount"]);o!=null&&g(t,["tokenCount"],o);const l=m(e,["finishReason"]);l!=null&&g(t,["finishReason"],l);const s=m(e,["avgLogprobs"]);s!=null&&g(t,["avgLogprobs"],s);const c=m(e,["groundingMetadata"]);c!=null&&g(t,["groundingMetadata"],c);const d=m(e,["index"]);d!=null&&g(t,["index"],d);const f=m(e,["logprobsResult"]);f!=null&&g(t,["logprobsResult"],f);const h=m(e,["safetyRatings"]);if(h!=null){let y=h;Array.isArray(y)&&(y=y.map(E=>E)),g(t,["safetyRatings"],y)}const v=m(e,["urlContextMetadata"]);return v!=null&&g(t,["urlContextMetadata"],v),t}function RL(e){const t={},n=m(e,["citationSources"]);if(n!=null){let r=n;Array.isArray(r)&&(r=r.map(o=>o)),g(t,["citations"],r)}return t}function rI(e){const t={},n=m(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(l=>sz(l))),g(t,["parts"],o)}const r=m(e,["role"]);return r!=null&&g(t,["role"],r),t}function OL(e,t){const n={},r=m(e,["displayName"]);if(t!==void 0&&r!=null&&g(t,["batch","displayName"],r),m(e,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return n}function NL(e,t){const n={},r=m(e,["displayName"]);t!==void 0&&r!=null&&g(t,["displayName"],r);const o=m(e,["dest"]);return t!==void 0&&o!=null&&g(t,["outputConfig"],TL(bL(o))),n}function xA(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["src"]);o!=null&&g(n,["batch","inputConfig"],CL(e,eI(e,o)));const l=m(t,["config"]);return l!=null&&OL(l,n),n}function DL(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["model"],Be(e,r));const o=m(t,["src"]);o!=null&&g(n,["inputConfig"],xL(eI(e,o)));const l=m(t,["config"]);return l!=null&&NL(l,n),n}function kL(e,t){const n={},r=m(e,["displayName"]);return t!==void 0&&r!=null&&g(t,["batch","displayName"],r),n}function UL(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["src"]);o!=null&&g(n,["batch","inputConfig"],VL(e,o));const l=m(t,["config"]);return l!=null&&kL(l,n),n}function LL(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],rl(e,r)),n}function zL(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],rl(e,r)),n}function BL(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["name"]);r!=null&&g(t,["name"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);return l!=null&&g(t,["error"],l),t}function qL(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["name"]);r!=null&&g(t,["name"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);return l!=null&&g(t,["error"],l),t}function GL(e,t){const n={},r=m(t,["contents"]);if(r!=null){let l=Ay(e,r);Array.isArray(l)&&(l=l.map(s=>s)),g(n,["requests[]","request","content"],l)}const o=m(t,["config"]);return o!=null&&(g(n,["_self"],HL(o,n)),zU(n,{"requests[].*":"requests[].request.*"})),n}function HL(e,t){const n={},r=m(e,["taskType"]);t!==void 0&&r!=null&&g(t,["requests[]","taskType"],r);const o=m(e,["title"]);t!==void 0&&o!=null&&g(t,["requests[]","title"],o);const l=m(e,["outputDimensionality"]);if(t!==void 0&&l!=null&&g(t,["requests[]","outputDimensionality"],l),m(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(m(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return n}function VL(e,t){const n={},r=m(t,["fileName"]);r!=null&&g(n,["file_name"],r);const o=m(t,["inlinedRequests"]);return o!=null&&g(n,["requests"],GL(e,o)),n}function FL(e){const t={};if(m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=m(e,["fileUri"]);n!=null&&g(t,["fileUri"],n);const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function $L(e){const t={},n=m(e,["id"]);n!=null&&g(t,["id"],n);const r=m(e,["args"]);r!=null&&g(t,["args"],r);const o=m(e,["name"]);if(o!=null&&g(t,["name"],o),m(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(m(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function YL(e){const t={},n=m(e,["allowedFunctionNames"]);n!=null&&g(t,["allowedFunctionNames"],n);const r=m(e,["mode"]);if(r!=null&&g(t,["mode"],r),m(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function KL(e,t,n){const r={},o=m(t,["systemInstruction"]);n!==void 0&&o!=null&&g(n,["systemInstruction"],rI(Wt(o)));const l=m(t,["temperature"]);l!=null&&g(r,["temperature"],l);const s=m(t,["topP"]);s!=null&&g(r,["topP"],s);const c=m(t,["topK"]);c!=null&&g(r,["topK"],c);const d=m(t,["candidateCount"]);d!=null&&g(r,["candidateCount"],d);const f=m(t,["maxOutputTokens"]);f!=null&&g(r,["maxOutputTokens"],f);const h=m(t,["stopSequences"]);h!=null&&g(r,["stopSequences"],h);const v=m(t,["responseLogprobs"]);v!=null&&g(r,["responseLogprobs"],v);const y=m(t,["logprobs"]);y!=null&&g(r,["logprobs"],y);const E=m(t,["presencePenalty"]);E!=null&&g(r,["presencePenalty"],E);const _=m(t,["frequencyPenalty"]);_!=null&&g(r,["frequencyPenalty"],_);const T=m(t,["seed"]);T!=null&&g(r,["seed"],T);const A=m(t,["responseMimeType"]);A!=null&&g(r,["responseMimeType"],A);const w=m(t,["responseSchema"]);w!=null&&g(r,["responseSchema"],Cy(w));const R=m(t,["responseJsonSchema"]);if(R!=null&&g(r,["responseJsonSchema"],R),m(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(m(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const I=m(t,["safetySettings"]);if(n!==void 0&&I!=null){let oe=I;Array.isArray(oe)&&(oe=oe.map(se=>uz(se))),g(n,["safetySettings"],oe)}const P=m(t,["tools"]);if(n!==void 0&&P!=null){let oe=nl(P);Array.isArray(oe)&&(oe=oe.map(se=>fz(tl(se)))),g(n,["tools"],oe)}const N=m(t,["toolConfig"]);if(n!==void 0&&N!=null&&g(n,["toolConfig"],cz(N)),m(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const O=m(t,["cachedContent"]);n!==void 0&&O!=null&&g(n,["cachedContent"],pi(e,O));const D=m(t,["responseModalities"]);D!=null&&g(r,["responseModalities"],D);const G=m(t,["mediaResolution"]);G!=null&&g(r,["mediaResolution"],G);const B=m(t,["speechConfig"]);if(B!=null&&g(r,["speechConfig"],xy(B)),m(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const Q=m(t,["thinkingConfig"]);Q!=null&&g(r,["thinkingConfig"],Q);const te=m(t,["imageConfig"]);te!=null&&g(r,["imageConfig"],QL(te));const $=m(t,["enableEnhancedCivicAnswers"]);if($!=null&&g(r,["enableEnhancedCivicAnswers"],$),m(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is not supported in Gemini API.");return r}function JL(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["candidates"]);if(r!=null){let d=r;Array.isArray(d)&&(d=d.map(f=>PL(f))),g(t,["candidates"],d)}const o=m(e,["modelVersion"]);o!=null&&g(t,["modelVersion"],o);const l=m(e,["promptFeedback"]);l!=null&&g(t,["promptFeedback"],l);const s=m(e,["responseId"]);s!=null&&g(t,["responseId"],s);const c=m(e,["usageMetadata"]);return c!=null&&g(t,["usageMetadata"],c),t}function jL(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],rl(e,r)),n}function XL(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],rl(e,r)),n}function WL(e){const t={};if(m(e,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=m(e,["enableWidget"]);return n!=null&&g(t,["enableWidget"],n),t}function ZL(e){const t={};if(m(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(m(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=m(e,["timeRangeFilter"]);return n!=null&&g(t,["timeRangeFilter"],n),t}function QL(e){const t={},n=m(e,["aspectRatio"]);n!=null&&g(t,["aspectRatio"],n);const r=m(e,["imageSize"]);if(r!=null&&g(t,["imageSize"],r),m(e,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is not supported in Gemini API.");if(m(e,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(m(e,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function ez(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["request","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let c=jn(o);Array.isArray(c)&&(c=c.map(d=>rI(d))),g(n,["request","contents"],c)}const l=m(t,["metadata"]);l!=null&&g(n,["metadata"],l);const s=m(t,["config"]);return s!=null&&g(n,["request","generationConfig"],KL(e,s,m(n,["request"],{}))),n}function tz(e){const t={},n=m(e,["response"]);n!=null&&g(t,["response"],JL(n));const r=m(e,["error"]);return r!=null&&g(t,["error"],r),t}function nz(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);if(t!==void 0&&o!=null&&g(t,["_query","pageToken"],o),m(e,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return n}function rz(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);t!==void 0&&o!=null&&g(t,["_query","pageToken"],o);const l=m(e,["filter"]);return t!==void 0&&l!=null&&g(t,["_query","filter"],l),n}function iz(e){const t={},n=m(e,["config"]);return n!=null&&nz(n,t),t}function oz(e){const t={},n=m(e,["config"]);return n!=null&&rz(n,t),t}function az(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["operations"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>$c(s))),g(t,["batchJobs"],l)}return t}function lz(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["batchPredictionJobs"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>cg(s))),g(t,["batchJobs"],l)}return t}function sz(e){const t={},n=m(e,["mediaResolution"]);n!=null&&g(t,["mediaResolution"],n);const r=m(e,["codeExecutionResult"]);r!=null&&g(t,["codeExecutionResult"],r);const o=m(e,["executableCode"]);o!=null&&g(t,["executableCode"],o);const l=m(e,["fileData"]);l!=null&&g(t,["fileData"],FL(l));const s=m(e,["functionCall"]);s!=null&&g(t,["functionCall"],$L(s));const c=m(e,["functionResponse"]);c!=null&&g(t,["functionResponse"],c);const d=m(e,["inlineData"]);d!=null&&g(t,["inlineData"],wL(d));const f=m(e,["text"]);f!=null&&g(t,["text"],f);const h=m(e,["thought"]);h!=null&&g(t,["thought"],h);const v=m(e,["thoughtSignature"]);v!=null&&g(t,["thoughtSignature"],v);const y=m(e,["videoMetadata"]);return y!=null&&g(t,["videoMetadata"],y),t}function uz(e){const t={},n=m(e,["category"]);if(n!=null&&g(t,["category"],n),m(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const r=m(e,["threshold"]);return r!=null&&g(t,["threshold"],r),t}function cz(e){const t={},n=m(e,["retrievalConfig"]);n!=null&&g(t,["retrievalConfig"],n);const r=m(e,["functionCallingConfig"]);return r!=null&&g(t,["functionCallingConfig"],YL(r)),t}function fz(e){const t={};if(m(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=m(e,["computerUse"]);n!=null&&g(t,["computerUse"],n);const r=m(e,["fileSearch"]);r!=null&&g(t,["fileSearch"],r);const o=m(e,["codeExecution"]);if(o!=null&&g(t,["codeExecution"],o),m(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=m(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(v=>v)),g(t,["functionDeclarations"],h)}const s=m(e,["googleMaps"]);s!=null&&g(t,["googleMaps"],WL(s));const c=m(e,["googleSearch"]);c!=null&&g(t,["googleSearch"],ZL(c));const d=m(e,["googleSearchRetrieval"]);d!=null&&g(t,["googleSearchRetrieval"],d);const f=m(e,["urlContext"]);return f!=null&&g(t,["urlContext"],f),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var ii;(function(e){e.PAGED_ITEM_BATCH_JOBS="batchJobs",e.PAGED_ITEM_MODELS="models",e.PAGED_ITEM_TUNING_JOBS="tuningJobs",e.PAGED_ITEM_FILES="files",e.PAGED_ITEM_CACHED_CONTENTS="cachedContents",e.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",e.PAGED_ITEM_DOCUMENTS="documents"})(ii||(ii={}));class Vo{constructor(t,n,r,o){this.pageInternal=[],this.paramsInternal={},this.requestInternal=n,this.init(t,r,o)}init(t,n,r){var o,l;this.nameInternal=t,this.pageInternal=n[this.nameInternal]||[],this.sdkHttpResponseInternal=n==null?void 0:n.sdkHttpResponse,this.idxInternal=0;let s={config:{}};!r||Object.keys(r).length===0?s={config:{}}:typeof r=="object"?s=Object.assign({},r):s=r,s.config&&(s.config.pageToken=n.nextPageToken),this.paramsInternal=s,this.pageInternalSize=(l=(o=s.config)===null||o===void 0?void 0:o.pageSize)!==null&&l!==void 0?l: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 dz extends di{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Vo(ii.PAGED_ITEM_BATCH_JOBS,r=>this.listInternal(r),await this.listInternal(n),n),this.create=async n=>(this.apiClient.isVertexAI()&&(n.config=this.formatDestination(n.src,n.config)),this.createInternal(n)),this.createEmbeddings=async n=>{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(n)}}createInlinedGenerateContentRequest(t){const n=xA(this.apiClient,t),r=n._url,o=ue("{model}:batchGenerateContent",r),c=n.batch.inputConfig.requests,d=c.requests,f=[];for(const h of d){const v=Object.assign({},h);if(v.systemInstruction){const y=v.systemInstruction;delete v.systemInstruction;const E=v.request;E.systemInstruction=y,v.request=E}f.push(v)}return c.requests=f,delete n.config,delete n._url,delete n._query,{path:o,body:n}}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,n){const r=n?Object.assign({},n):{},o=Date.now().toString();if(r.displayName||(r.displayName=`genaiBatchJob_${o}`),r.dest===void 0){const l=this.getGcsUri(t),s=this.getBigqueryUri(t);if(l)l.endsWith(".jsonl")?r.dest=`${l.slice(0,-6)}/dest`:r.dest=`${l}_dest_${o}`;else if(s)r.dest=`${s}_dest_${o}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return r}async createInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=DL(this.apiClient,t);return c=ue("batchPredictionJobs",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>cg(h))}else{const f=xA(this.apiClient,t);return c=ue("{model}:batchGenerateContent",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>$c(h))}}async createEmbeddingsInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=UL(this.apiClient,t);return l=ue("{model}:asyncBatchEmbedContent",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>$c(d))}}async get(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=XL(this.apiClient,t);return c=ue("batchPredictionJobs/{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>cg(h))}else{const f=jL(this.apiClient,t);return c=ue("batches/{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>$c(h))}}async cancel(t){var n,r,o,l;let s="",c={};if(this.apiClient.isVertexAI()){const d=IL(this.apiClient,t);s=ue("batchPredictionJobs/{name}:cancel",d._url),c=d._query,delete d._url,delete d._query,await this.apiClient.request({path:s,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal})}else{const d=ML(this.apiClient,t);s=ue("batches/{name}:cancel",d._url),c=d._query,delete d._url,delete d._query,await this.apiClient.request({path:s,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal})}}async listInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=oz(t);return c=ue("batchPredictionJobs",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=lz(h),y=new _A;return Object.assign(y,v),y})}else{const f=iz(t);return c=ue("batches",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=az(h),y=new _A;return Object.assign(y,v),y})}}async delete(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=zL(this.apiClient,t);return c=ue("batchPredictionJobs/{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>qL(h))}else{const f=LL(this.apiClient,t);return c=ue("batches/{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>BL(h))}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function pz(e){const t={},n=m(e,["data"]);if(n!=null&&g(t,["data"],n),m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function wA(e){const t={},n=m(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(l=>Uz(l))),g(t,["parts"],o)}const r=m(e,["role"]);return r!=null&&g(t,["role"],r),t}function hz(e,t){const n={},r=m(e,["ttl"]);t!==void 0&&r!=null&&g(t,["ttl"],r);const o=m(e,["expireTime"]);t!==void 0&&o!=null&&g(t,["expireTime"],o);const l=m(e,["displayName"]);t!==void 0&&l!=null&&g(t,["displayName"],l);const s=m(e,["contents"]);if(t!==void 0&&s!=null){let h=jn(s);Array.isArray(h)&&(h=h.map(v=>wA(v))),g(t,["contents"],h)}const c=m(e,["systemInstruction"]);t!==void 0&&c!=null&&g(t,["systemInstruction"],wA(Wt(c)));const d=m(e,["tools"]);if(t!==void 0&&d!=null){let h=d;Array.isArray(h)&&(h=h.map(v=>zz(v))),g(t,["tools"],h)}const f=m(e,["toolConfig"]);if(t!==void 0&&f!=null&&g(t,["toolConfig"],Lz(f)),m(e,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return n}function mz(e,t){const n={},r=m(e,["ttl"]);t!==void 0&&r!=null&&g(t,["ttl"],r);const o=m(e,["expireTime"]);t!==void 0&&o!=null&&g(t,["expireTime"],o);const l=m(e,["displayName"]);t!==void 0&&l!=null&&g(t,["displayName"],l);const s=m(e,["contents"]);if(t!==void 0&&s!=null){let v=jn(s);Array.isArray(v)&&(v=v.map(y=>y)),g(t,["contents"],v)}const c=m(e,["systemInstruction"]);t!==void 0&&c!=null&&g(t,["systemInstruction"],Wt(c));const d=m(e,["tools"]);if(t!==void 0&&d!=null){let v=d;Array.isArray(v)&&(v=v.map(y=>Bz(y))),g(t,["tools"],v)}const f=m(e,["toolConfig"]);t!==void 0&&f!=null&&g(t,["toolConfig"],f);const h=m(e,["kmsKeyName"]);return t!==void 0&&h!=null&&g(t,["encryption_spec","kmsKeyName"],h),n}function vz(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["model"],$M(e,r));const o=m(t,["config"]);return o!=null&&hz(o,n),n}function gz(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["model"],$M(e,r));const o=m(t,["config"]);return o!=null&&mz(o,n),n}function yz(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],pi(e,r)),n}function Sz(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],pi(e,r)),n}function bz(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}function Ez(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}function _z(e){const t={};if(m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=m(e,["fileUri"]);n!=null&&g(t,["fileUri"],n);const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function Tz(e){const t={},n=m(e,["id"]);n!=null&&g(t,["id"],n);const r=m(e,["args"]);r!=null&&g(t,["args"],r);const o=m(e,["name"]);if(o!=null&&g(t,["name"],o),m(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(m(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function Az(e){const t={},n=m(e,["allowedFunctionNames"]);n!=null&&g(t,["allowedFunctionNames"],n);const r=m(e,["mode"]);if(r!=null&&g(t,["mode"],r),m(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function Cz(e){const t={},n=m(e,["description"]);n!=null&&g(t,["description"],n);const r=m(e,["name"]);r!=null&&g(t,["name"],r);const o=m(e,["parameters"]);o!=null&&g(t,["parameters"],o);const l=m(e,["parametersJsonSchema"]);l!=null&&g(t,["parametersJsonSchema"],l);const s=m(e,["response"]);s!=null&&g(t,["response"],s);const c=m(e,["responseJsonSchema"]);if(c!=null&&g(t,["responseJsonSchema"],c),m(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");return t}function xz(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],pi(e,r)),n}function wz(e,t){const n={},r=m(t,["name"]);return r!=null&&g(n,["_url","name"],pi(e,r)),n}function Mz(e){const t={};if(m(e,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=m(e,["enableWidget"]);return n!=null&&g(t,["enableWidget"],n),t}function Iz(e){const t={};if(m(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(m(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=m(e,["timeRangeFilter"]);return n!=null&&g(t,["timeRangeFilter"],n),t}function Pz(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);return t!==void 0&&o!=null&&g(t,["_query","pageToken"],o),n}function Rz(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);return t!==void 0&&o!=null&&g(t,["_query","pageToken"],o),n}function Oz(e){const t={},n=m(e,["config"]);return n!=null&&Pz(n,t),t}function Nz(e){const t={},n=m(e,["config"]);return n!=null&&Rz(n,t),t}function Dz(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["cachedContents"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["cachedContents"],l)}return t}function kz(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["cachedContents"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["cachedContents"],l)}return t}function Uz(e){const t={},n=m(e,["mediaResolution"]);n!=null&&g(t,["mediaResolution"],n);const r=m(e,["codeExecutionResult"]);r!=null&&g(t,["codeExecutionResult"],r);const o=m(e,["executableCode"]);o!=null&&g(t,["executableCode"],o);const l=m(e,["fileData"]);l!=null&&g(t,["fileData"],_z(l));const s=m(e,["functionCall"]);s!=null&&g(t,["functionCall"],Tz(s));const c=m(e,["functionResponse"]);c!=null&&g(t,["functionResponse"],c);const d=m(e,["inlineData"]);d!=null&&g(t,["inlineData"],pz(d));const f=m(e,["text"]);f!=null&&g(t,["text"],f);const h=m(e,["thought"]);h!=null&&g(t,["thought"],h);const v=m(e,["thoughtSignature"]);v!=null&&g(t,["thoughtSignature"],v);const y=m(e,["videoMetadata"]);return y!=null&&g(t,["videoMetadata"],y),t}function Lz(e){const t={},n=m(e,["retrievalConfig"]);n!=null&&g(t,["retrievalConfig"],n);const r=m(e,["functionCallingConfig"]);return r!=null&&g(t,["functionCallingConfig"],Az(r)),t}function zz(e){const t={};if(m(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=m(e,["computerUse"]);n!=null&&g(t,["computerUse"],n);const r=m(e,["fileSearch"]);r!=null&&g(t,["fileSearch"],r);const o=m(e,["codeExecution"]);if(o!=null&&g(t,["codeExecution"],o),m(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=m(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(v=>v)),g(t,["functionDeclarations"],h)}const s=m(e,["googleMaps"]);s!=null&&g(t,["googleMaps"],Mz(s));const c=m(e,["googleSearch"]);c!=null&&g(t,["googleSearch"],Iz(c));const d=m(e,["googleSearchRetrieval"]);d!=null&&g(t,["googleSearchRetrieval"],d);const f=m(e,["urlContext"]);return f!=null&&g(t,["urlContext"],f),t}function Bz(e){const t={},n=m(e,["retrieval"]);n!=null&&g(t,["retrieval"],n);const r=m(e,["computerUse"]);if(r!=null&&g(t,["computerUse"],r),m(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=m(e,["codeExecution"]);o!=null&&g(t,["codeExecution"],o);const l=m(e,["enterpriseWebSearch"]);l!=null&&g(t,["enterpriseWebSearch"],l);const s=m(e,["functionDeclarations"]);if(s!=null){let v=s;Array.isArray(v)&&(v=v.map(y=>Cz(y))),g(t,["functionDeclarations"],v)}const c=m(e,["googleMaps"]);c!=null&&g(t,["googleMaps"],c);const d=m(e,["googleSearch"]);d!=null&&g(t,["googleSearch"],d);const f=m(e,["googleSearchRetrieval"]);f!=null&&g(t,["googleSearchRetrieval"],f);const h=m(e,["urlContext"]);return h!=null&&g(t,["urlContext"],h),t}function qz(e,t){const n={},r=m(e,["ttl"]);t!==void 0&&r!=null&&g(t,["ttl"],r);const o=m(e,["expireTime"]);return t!==void 0&&o!=null&&g(t,["expireTime"],o),n}function Gz(e,t){const n={},r=m(e,["ttl"]);t!==void 0&&r!=null&&g(t,["ttl"],r);const o=m(e,["expireTime"]);return t!==void 0&&o!=null&&g(t,["expireTime"],o),n}function Hz(e,t){const n={},r=m(t,["name"]);r!=null&&g(n,["_url","name"],pi(e,r));const o=m(t,["config"]);return o!=null&&qz(o,n),n}function Vz(e,t){const n={},r=m(t,["name"]);r!=null&&g(n,["_url","name"],pi(e,r));const o=m(t,["config"]);return o!=null&&Gz(o,n),n}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Fz extends di{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Vo(ii.PAGED_ITEM_CACHED_CONTENTS,r=>this.listInternal(r),await this.listInternal(n),n)}async create(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=gz(this.apiClient,t);return c=ue("cachedContents",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>h)}else{const f=vz(this.apiClient,t);return c=ue("cachedContents",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>h)}}async get(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=wz(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>h)}else{const f=xz(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>h)}}async delete(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=Sz(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=Ez(h),y=new bA;return Object.assign(y,v),y})}else{const f=yz(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=bz(h),y=new bA;return Object.assign(y,v),y})}}async update(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=Vz(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"PATCH",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>h)}else{const f=Hz(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>h)}}async listInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=Nz(t);return c=ue("cachedContents",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=kz(h),y=new EA;return Object.assign(y,v),y})}else{const f=Oz(t);return c=ue("cachedContents",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=Dz(h),y=new EA;return Object.assign(y,v),y})}}}function nf(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _e(e){return this instanceof _e?(this.v=e,this):new _e(e)}function sr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,l=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(E){return function(_){return Promise.resolve(_).then(E,v)}}function c(E,_){r[E]&&(o[E]=function(T){return new Promise(function(A,w){l.push([E,T,A,w])>1||d(E,T)})},_&&(o[E]=_(o[E])))}function d(E,_){try{f(r[E](_))}catch(T){y(l[0][3],T)}}function f(E){E.value instanceof _e?Promise.resolve(E.value.v).then(h,v):y(l[0][2],E)}function h(E){d("next",E)}function v(E){d("throw",E)}function y(E,_){E(_),l.shift(),l.length&&d(l[0][0],l[0][1])}}function ur(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof MA=="function"?MA(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(l){n[l]=e[l]&&function(s){return new Promise(function(c,d){s=e[l](s),o(c,d,s.done,s.value)})}}function o(l,s,c,d){Promise.resolve(d).then(function(f){l({value:f,done:c})},s)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function $z(e){var t;if(e.candidates==null||e.candidates.length===0)return!1;const n=(t=e.candidates[0])===null||t===void 0?void 0:t.content;return n===void 0?!1:iI(n)}function iI(e){if(e.parts===void 0||e.parts.length===0)return!1;for(const t of e.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function Yz(e){if(e.length!==0){for(const t of e)if(t.role!=="user"&&t.role!=="model")throw new Error(`Role must be user or model, but got ${t.role}.`)}}function IA(e){if(e===void 0||e.length===0)return[];const t=[],n=e.length;let r=0;for(;r{var l,s,c;const d=await o,f=(s=(l=d.candidates)===null||l===void 0?void 0:l[0])===null||s===void 0?void 0:s.content,h=d.automaticFunctionCallingHistory,v=this.getHistory(!0).length;let y=[];h!=null&&(y=(c=h.slice(v))!==null&&c!==void 0?c:[]);const E=f?[f]:[];this.recordHistory(r,E,y)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),o}async sendMessageStream(t){var n;await this.sendPromise;const r=Wt(t.message),o=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(r),config:(n=t.config)!==null&&n!==void 0?n:this.config});this.sendPromise=o.then(()=>{}).catch(()=>{});const l=await o;return this.processStreamResponse(l,r)}getHistory(t=!1){const n=t?IA(this.history):this.history;return structuredClone(n)}processStreamResponse(t,n){return sr(this,arguments,function*(){var o,l,s,c,d,f;const h=[];try{for(var v=!0,y=ur(t),E;E=yield _e(y.next()),o=E.done,!o;v=!0){c=E.value,v=!1;const _=c;if($z(_)){const T=(f=(d=_.candidates)===null||d===void 0?void 0:d[0])===null||f===void 0?void 0:f.content;T!==void 0&&h.push(T)}yield yield _e(_)}}catch(_){l={error:_}}finally{try{!v&&!o&&(s=y.return)&&(yield _e(s.call(y)))}finally{if(l)throw l.error}}this.recordHistory(n,h)})}recordHistory(t,n,r){let o=[];n.length>0&&n.every(l=>l.role!==void 0)?o=n:o.push({role:"model",parts:[]}),r&&r.length>0?this.history.push(...IA(r)):this.history.push(t),this.history.push(...o)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Cs extends Error{constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,Cs.prototype)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function jz(e){const t={},n=m(e,["file"]);return n!=null&&g(t,["file"],n),t}function Xz(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}function Wz(e){const t={},n=m(e,["name"]);return n!=null&&g(t,["_url","file"],WM(n)),t}function Zz(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}function Qz(e){const t={},n=m(e,["name"]);return n!=null&&g(t,["_url","file"],WM(n)),t}function eB(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);return t!==void 0&&o!=null&&g(t,["_query","pageToken"],o),n}function tB(e){const t={},n=m(e,["config"]);return n!=null&&eB(n,t),t}function nB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["files"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["files"],l)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class rB extends di{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Vo(ii.PAGED_ITEM_FILES,r=>this.listInternal(r),await this.listInternal(n),n)}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(n=>n)}async download(t){await this.apiClient.downloadFile(t)}async listInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=tB(t);return l=ue("files",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>{const f=nB(d),h=new lL;return Object.assign(h,f),h})}}async createInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=jz(t);return l=ue("upload/v1beta/files",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=Xz(d),h=new sL;return Object.assign(h,f),h})}}async get(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=Qz(t);return l=ue("files/{file}",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async delete(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=Wz(t);return l=ue("files/{file}",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>{const f=Zz(d),h=new uL;return Object.assign(h,f),h})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Yc(e){const t={},n=m(e,["data"]);if(n!=null&&g(t,["data"],n),m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function iB(e){const t={},n=m(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(l=>bB(l))),g(t,["parts"],o)}const r=m(e,["role"]);return r!=null&&g(t,["role"],r),t}function oB(e){const t={};if(m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=m(e,["fileUri"]);n!=null&&g(t,["fileUri"],n);const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function aB(e){const t={},n=m(e,["id"]);n!=null&&g(t,["id"],n);const r=m(e,["args"]);r!=null&&g(t,["args"],r);const o=m(e,["name"]);if(o!=null&&g(t,["name"],o),m(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(m(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function lB(e){const t={},n=m(e,["description"]);n!=null&&g(t,["description"],n);const r=m(e,["name"]);r!=null&&g(t,["name"],r);const o=m(e,["parameters"]);o!=null&&g(t,["parameters"],o);const l=m(e,["parametersJsonSchema"]);l!=null&&g(t,["parametersJsonSchema"],l);const s=m(e,["response"]);s!=null&&g(t,["response"],s);const c=m(e,["responseJsonSchema"]);if(c!=null&&g(t,["responseJsonSchema"],c),m(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");return t}function sB(e){const t={},n=m(e,["modelSelectionConfig"]);n!=null&&g(t,["modelConfig"],n);const r=m(e,["responseJsonSchema"]);r!=null&&g(t,["responseJsonSchema"],r);const o=m(e,["audioTimestamp"]);o!=null&&g(t,["audioTimestamp"],o);const l=m(e,["candidateCount"]);l!=null&&g(t,["candidateCount"],l);const s=m(e,["enableAffectiveDialog"]);s!=null&&g(t,["enableAffectiveDialog"],s);const c=m(e,["frequencyPenalty"]);c!=null&&g(t,["frequencyPenalty"],c);const d=m(e,["logprobs"]);d!=null&&g(t,["logprobs"],d);const f=m(e,["maxOutputTokens"]);f!=null&&g(t,["maxOutputTokens"],f);const h=m(e,["mediaResolution"]);h!=null&&g(t,["mediaResolution"],h);const v=m(e,["presencePenalty"]);v!=null&&g(t,["presencePenalty"],v);const y=m(e,["responseLogprobs"]);y!=null&&g(t,["responseLogprobs"],y);const E=m(e,["responseMimeType"]);E!=null&&g(t,["responseMimeType"],E);const _=m(e,["responseModalities"]);_!=null&&g(t,["responseModalities"],_);const T=m(e,["responseSchema"]);T!=null&&g(t,["responseSchema"],T);const A=m(e,["routingConfig"]);A!=null&&g(t,["routingConfig"],A);const w=m(e,["seed"]);w!=null&&g(t,["seed"],w);const R=m(e,["speechConfig"]);R!=null&&g(t,["speechConfig"],R);const I=m(e,["stopSequences"]);I!=null&&g(t,["stopSequences"],I);const P=m(e,["temperature"]);P!=null&&g(t,["temperature"],P);const N=m(e,["thinkingConfig"]);N!=null&&g(t,["thinkingConfig"],N);const O=m(e,["topK"]);O!=null&&g(t,["topK"],O);const D=m(e,["topP"]);if(D!=null&&g(t,["topP"],D),m(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function uB(e){const t={};if(m(e,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=m(e,["enableWidget"]);return n!=null&&g(t,["enableWidget"],n),t}function cB(e){const t={};if(m(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(m(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=m(e,["timeRangeFilter"]);return n!=null&&g(t,["timeRangeFilter"],n),t}function fB(e,t){const n={},r=m(e,["generationConfig"]);t!==void 0&&r!=null&&g(t,["setup","generationConfig"],r);const o=m(e,["responseModalities"]);t!==void 0&&o!=null&&g(t,["setup","generationConfig","responseModalities"],o);const l=m(e,["temperature"]);t!==void 0&&l!=null&&g(t,["setup","generationConfig","temperature"],l);const s=m(e,["topP"]);t!==void 0&&s!=null&&g(t,["setup","generationConfig","topP"],s);const c=m(e,["topK"]);t!==void 0&&c!=null&&g(t,["setup","generationConfig","topK"],c);const d=m(e,["maxOutputTokens"]);t!==void 0&&d!=null&&g(t,["setup","generationConfig","maxOutputTokens"],d);const f=m(e,["mediaResolution"]);t!==void 0&&f!=null&&g(t,["setup","generationConfig","mediaResolution"],f);const h=m(e,["seed"]);t!==void 0&&h!=null&&g(t,["setup","generationConfig","seed"],h);const v=m(e,["speechConfig"]);t!==void 0&&v!=null&&g(t,["setup","generationConfig","speechConfig"],wy(v));const y=m(e,["thinkingConfig"]);t!==void 0&&y!=null&&g(t,["setup","generationConfig","thinkingConfig"],y);const E=m(e,["enableAffectiveDialog"]);t!==void 0&&E!=null&&g(t,["setup","generationConfig","enableAffectiveDialog"],E);const _=m(e,["systemInstruction"]);t!==void 0&&_!=null&&g(t,["setup","systemInstruction"],iB(Wt(_)));const T=m(e,["tools"]);if(t!==void 0&&T!=null){let O=nl(T);Array.isArray(O)&&(O=O.map(D=>_B(tl(D)))),g(t,["setup","tools"],O)}const A=m(e,["sessionResumption"]);t!==void 0&&A!=null&&g(t,["setup","sessionResumption"],EB(A));const w=m(e,["inputAudioTranscription"]);t!==void 0&&w!=null&&g(t,["setup","inputAudioTranscription"],w);const R=m(e,["outputAudioTranscription"]);t!==void 0&&R!=null&&g(t,["setup","outputAudioTranscription"],R);const I=m(e,["realtimeInputConfig"]);t!==void 0&&I!=null&&g(t,["setup","realtimeInputConfig"],I);const P=m(e,["contextWindowCompression"]);t!==void 0&&P!=null&&g(t,["setup","contextWindowCompression"],P);const N=m(e,["proactivity"]);if(t!==void 0&&N!=null&&g(t,["setup","proactivity"],N),m(e,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return n}function dB(e,t){const n={},r=m(e,["generationConfig"]);t!==void 0&&r!=null&&g(t,["setup","generationConfig"],sB(r));const o=m(e,["responseModalities"]);t!==void 0&&o!=null&&g(t,["setup","generationConfig","responseModalities"],o);const l=m(e,["temperature"]);t!==void 0&&l!=null&&g(t,["setup","generationConfig","temperature"],l);const s=m(e,["topP"]);t!==void 0&&s!=null&&g(t,["setup","generationConfig","topP"],s);const c=m(e,["topK"]);t!==void 0&&c!=null&&g(t,["setup","generationConfig","topK"],c);const d=m(e,["maxOutputTokens"]);t!==void 0&&d!=null&&g(t,["setup","generationConfig","maxOutputTokens"],d);const f=m(e,["mediaResolution"]);t!==void 0&&f!=null&&g(t,["setup","generationConfig","mediaResolution"],f);const h=m(e,["seed"]);t!==void 0&&h!=null&&g(t,["setup","generationConfig","seed"],h);const v=m(e,["speechConfig"]);t!==void 0&&v!=null&&g(t,["setup","generationConfig","speechConfig"],wy(v));const y=m(e,["thinkingConfig"]);t!==void 0&&y!=null&&g(t,["setup","generationConfig","thinkingConfig"],y);const E=m(e,["enableAffectiveDialog"]);t!==void 0&&E!=null&&g(t,["setup","generationConfig","enableAffectiveDialog"],E);const _=m(e,["systemInstruction"]);t!==void 0&&_!=null&&g(t,["setup","systemInstruction"],Wt(_));const T=m(e,["tools"]);if(t!==void 0&&T!=null){let D=nl(T);Array.isArray(D)&&(D=D.map(G=>TB(tl(G)))),g(t,["setup","tools"],D)}const A=m(e,["sessionResumption"]);t!==void 0&&A!=null&&g(t,["setup","sessionResumption"],A);const w=m(e,["inputAudioTranscription"]);t!==void 0&&w!=null&&g(t,["setup","inputAudioTranscription"],w);const R=m(e,["outputAudioTranscription"]);t!==void 0&&R!=null&&g(t,["setup","outputAudioTranscription"],R);const I=m(e,["realtimeInputConfig"]);t!==void 0&&I!=null&&g(t,["setup","realtimeInputConfig"],I);const P=m(e,["contextWindowCompression"]);t!==void 0&&P!=null&&g(t,["setup","contextWindowCompression"],P);const N=m(e,["proactivity"]);t!==void 0&&N!=null&&g(t,["setup","proactivity"],N);const O=m(e,["explicitVadSignal"]);return t!==void 0&&O!=null&&g(t,["setup","explicitVadSignal"],O),n}function pB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["setup","model"],Be(e,r));const o=m(t,["config"]);return o!=null&&g(n,["config"],fB(o,n)),n}function hB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["setup","model"],Be(e,r));const o=m(t,["config"]);return o!=null&&g(n,["config"],dB(o,n)),n}function mB(e){const t={},n=m(e,["musicGenerationConfig"]);return n!=null&&g(t,["musicGenerationConfig"],n),t}function vB(e){const t={},n=m(e,["weightedPrompts"]);if(n!=null){let r=n;Array.isArray(r)&&(r=r.map(o=>o)),g(t,["weightedPrompts"],r)}return t}function gB(e){const t={},n=m(e,["media"]);if(n!=null){let f=YM(n);Array.isArray(f)&&(f=f.map(h=>Yc(h))),g(t,["mediaChunks"],f)}const r=m(e,["audio"]);r!=null&&g(t,["audio"],Yc(JM(r)));const o=m(e,["audioStreamEnd"]);o!=null&&g(t,["audioStreamEnd"],o);const l=m(e,["video"]);l!=null&&g(t,["video"],Yc(KM(l)));const s=m(e,["text"]);s!=null&&g(t,["text"],s);const c=m(e,["activityStart"]);c!=null&&g(t,["activityStart"],c);const d=m(e,["activityEnd"]);return d!=null&&g(t,["activityEnd"],d),t}function yB(e){const t={},n=m(e,["media"]);if(n!=null){let f=YM(n);Array.isArray(f)&&(f=f.map(h=>h)),g(t,["mediaChunks"],f)}const r=m(e,["audio"]);r!=null&&g(t,["audio"],JM(r));const o=m(e,["audioStreamEnd"]);o!=null&&g(t,["audioStreamEnd"],o);const l=m(e,["video"]);l!=null&&g(t,["video"],KM(l));const s=m(e,["text"]);s!=null&&g(t,["text"],s);const c=m(e,["activityStart"]);c!=null&&g(t,["activityStart"],c);const d=m(e,["activityEnd"]);return d!=null&&g(t,["activityEnd"],d),t}function SB(e){const t={},n=m(e,["setupComplete"]);n!=null&&g(t,["setupComplete"],n);const r=m(e,["serverContent"]);r!=null&&g(t,["serverContent"],r);const o=m(e,["toolCall"]);o!=null&&g(t,["toolCall"],o);const l=m(e,["toolCallCancellation"]);l!=null&&g(t,["toolCallCancellation"],l);const s=m(e,["usageMetadata"]);s!=null&&g(t,["usageMetadata"],AB(s));const c=m(e,["goAway"]);c!=null&&g(t,["goAway"],c);const d=m(e,["sessionResumptionUpdate"]);d!=null&&g(t,["sessionResumptionUpdate"],d);const f=m(e,["voiceActivityDetectionSignal"]);f!=null&&g(t,["voiceActivityDetectionSignal"],f);const h=m(e,["voiceActivity"]);return h!=null&&g(t,["voiceActivity"],CB(h)),t}function bB(e){const t={},n=m(e,["mediaResolution"]);n!=null&&g(t,["mediaResolution"],n);const r=m(e,["codeExecutionResult"]);r!=null&&g(t,["codeExecutionResult"],r);const o=m(e,["executableCode"]);o!=null&&g(t,["executableCode"],o);const l=m(e,["fileData"]);l!=null&&g(t,["fileData"],oB(l));const s=m(e,["functionCall"]);s!=null&&g(t,["functionCall"],aB(s));const c=m(e,["functionResponse"]);c!=null&&g(t,["functionResponse"],c);const d=m(e,["inlineData"]);d!=null&&g(t,["inlineData"],Yc(d));const f=m(e,["text"]);f!=null&&g(t,["text"],f);const h=m(e,["thought"]);h!=null&&g(t,["thought"],h);const v=m(e,["thoughtSignature"]);v!=null&&g(t,["thoughtSignature"],v);const y=m(e,["videoMetadata"]);return y!=null&&g(t,["videoMetadata"],y),t}function EB(e){const t={},n=m(e,["handle"]);if(n!=null&&g(t,["handle"],n),m(e,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function _B(e){const t={};if(m(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=m(e,["computerUse"]);n!=null&&g(t,["computerUse"],n);const r=m(e,["fileSearch"]);r!=null&&g(t,["fileSearch"],r);const o=m(e,["codeExecution"]);if(o!=null&&g(t,["codeExecution"],o),m(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=m(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(v=>v)),g(t,["functionDeclarations"],h)}const s=m(e,["googleMaps"]);s!=null&&g(t,["googleMaps"],uB(s));const c=m(e,["googleSearch"]);c!=null&&g(t,["googleSearch"],cB(c));const d=m(e,["googleSearchRetrieval"]);d!=null&&g(t,["googleSearchRetrieval"],d);const f=m(e,["urlContext"]);return f!=null&&g(t,["urlContext"],f),t}function TB(e){const t={},n=m(e,["retrieval"]);n!=null&&g(t,["retrieval"],n);const r=m(e,["computerUse"]);if(r!=null&&g(t,["computerUse"],r),m(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=m(e,["codeExecution"]);o!=null&&g(t,["codeExecution"],o);const l=m(e,["enterpriseWebSearch"]);l!=null&&g(t,["enterpriseWebSearch"],l);const s=m(e,["functionDeclarations"]);if(s!=null){let v=s;Array.isArray(v)&&(v=v.map(y=>lB(y))),g(t,["functionDeclarations"],v)}const c=m(e,["googleMaps"]);c!=null&&g(t,["googleMaps"],c);const d=m(e,["googleSearch"]);d!=null&&g(t,["googleSearch"],d);const f=m(e,["googleSearchRetrieval"]);f!=null&&g(t,["googleSearchRetrieval"],f);const h=m(e,["urlContext"]);return h!=null&&g(t,["urlContext"],h),t}function AB(e){const t={},n=m(e,["promptTokenCount"]);n!=null&&g(t,["promptTokenCount"],n);const r=m(e,["cachedContentTokenCount"]);r!=null&&g(t,["cachedContentTokenCount"],r);const o=m(e,["candidatesTokenCount"]);o!=null&&g(t,["responseTokenCount"],o);const l=m(e,["toolUsePromptTokenCount"]);l!=null&&g(t,["toolUsePromptTokenCount"],l);const s=m(e,["thoughtsTokenCount"]);s!=null&&g(t,["thoughtsTokenCount"],s);const c=m(e,["totalTokenCount"]);c!=null&&g(t,["totalTokenCount"],c);const d=m(e,["promptTokensDetails"]);if(d!=null){let E=d;Array.isArray(E)&&(E=E.map(_=>_)),g(t,["promptTokensDetails"],E)}const f=m(e,["cacheTokensDetails"]);if(f!=null){let E=f;Array.isArray(E)&&(E=E.map(_=>_)),g(t,["cacheTokensDetails"],E)}const h=m(e,["candidatesTokensDetails"]);if(h!=null){let E=h;Array.isArray(E)&&(E=E.map(_=>_)),g(t,["responseTokensDetails"],E)}const v=m(e,["toolUsePromptTokensDetails"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(_=>_)),g(t,["toolUsePromptTokensDetails"],E)}const y=m(e,["trafficType"]);return y!=null&&g(t,["trafficType"],y),t}function CB(e){const t={},n=m(e,["type"]);return n!=null&&g(t,["voiceActivityType"],n),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function xB(e){const t={},n=m(e,["data"]);if(n!=null&&g(t,["data"],n),m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function wB(e){const t={},n=m(e,["content"]);n!=null&&g(t,["content"],n);const r=m(e,["citationMetadata"]);r!=null&&g(t,["citationMetadata"],MB(r));const o=m(e,["tokenCount"]);o!=null&&g(t,["tokenCount"],o);const l=m(e,["finishReason"]);l!=null&&g(t,["finishReason"],l);const s=m(e,["avgLogprobs"]);s!=null&&g(t,["avgLogprobs"],s);const c=m(e,["groundingMetadata"]);c!=null&&g(t,["groundingMetadata"],c);const d=m(e,["index"]);d!=null&&g(t,["index"],d);const f=m(e,["logprobsResult"]);f!=null&&g(t,["logprobsResult"],f);const h=m(e,["safetyRatings"]);if(h!=null){let y=h;Array.isArray(y)&&(y=y.map(E=>E)),g(t,["safetyRatings"],y)}const v=m(e,["urlContextMetadata"]);return v!=null&&g(t,["urlContextMetadata"],v),t}function MB(e){const t={},n=m(e,["citationSources"]);if(n!=null){let r=n;Array.isArray(r)&&(r=r.map(o=>o)),g(t,["citations"],r)}return t}function IB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let l=jn(o);Array.isArray(l)&&(l=l.map(s=>s)),g(n,["contents"],l)}return n}function PB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["tokensInfo"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>l)),g(t,["tokensInfo"],o)}return t}function RB(e){const t={},n=m(e,["values"]);n!=null&&g(t,["values"],n);const r=m(e,["statistics"]);return r!=null&&g(t,["statistics"],OB(r)),t}function OB(e){const t={},n=m(e,["truncated"]);n!=null&&g(t,["truncated"],n);const r=m(e,["token_count"]);return r!=null&&g(t,["tokenCount"],r),t}function nd(e){const t={},n=m(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(l=>Gq(l))),g(t,["parts"],o)}const r=m(e,["role"]);return r!=null&&g(t,["role"],r),t}function NB(e){const t={},n=m(e,["controlType"]);n!=null&&g(t,["controlType"],n);const r=m(e,["enableControlImageComputation"]);return r!=null&&g(t,["computeControl"],r),t}function DB(e){const t={};if(m(e,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(m(e,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(m(e,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return t}function kB(e,t){const n={},r=m(e,["systemInstruction"]);t!==void 0&&r!=null&&g(t,["systemInstruction"],Wt(r));const o=m(e,["tools"]);if(t!==void 0&&o!=null){let s=o;Array.isArray(s)&&(s=s.map(c=>sI(c))),g(t,["tools"],s)}const l=m(e,["generationConfig"]);return t!==void 0&&l!=null&&g(t,["generationConfig"],xq(l)),n}function UB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let s=jn(o);Array.isArray(s)&&(s=s.map(c=>nd(c))),g(n,["contents"],s)}const l=m(t,["config"]);return l!=null&&DB(l),n}function LB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let s=jn(o);Array.isArray(s)&&(s=s.map(c=>c)),g(n,["contents"],s)}const l=m(t,["config"]);return l!=null&&kB(l,n),n}function zB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["totalTokens"]);r!=null&&g(t,["totalTokens"],r);const o=m(e,["cachedContentTokenCount"]);return o!=null&&g(t,["cachedContentTokenCount"],o),t}function BB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["totalTokens"]);return r!=null&&g(t,["totalTokens"],r),t}function qB(e,t){const n={},r=m(t,["model"]);return r!=null&&g(n,["_url","name"],Be(e,r)),n}function GB(e,t){const n={},r=m(t,["model"]);return r!=null&&g(n,["_url","name"],Be(e,r)),n}function HB(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}function VB(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}function FB(e,t){const n={},r=m(e,["outputGcsUri"]);t!==void 0&&r!=null&&g(t,["parameters","storageUri"],r);const o=m(e,["negativePrompt"]);t!==void 0&&o!=null&&g(t,["parameters","negativePrompt"],o);const l=m(e,["numberOfImages"]);t!==void 0&&l!=null&&g(t,["parameters","sampleCount"],l);const s=m(e,["aspectRatio"]);t!==void 0&&s!=null&&g(t,["parameters","aspectRatio"],s);const c=m(e,["guidanceScale"]);t!==void 0&&c!=null&&g(t,["parameters","guidanceScale"],c);const d=m(e,["seed"]);t!==void 0&&d!=null&&g(t,["parameters","seed"],d);const f=m(e,["safetyFilterLevel"]);t!==void 0&&f!=null&&g(t,["parameters","safetySetting"],f);const h=m(e,["personGeneration"]);t!==void 0&&h!=null&&g(t,["parameters","personGeneration"],h);const v=m(e,["includeSafetyAttributes"]);t!==void 0&&v!=null&&g(t,["parameters","includeSafetyAttributes"],v);const y=m(e,["includeRaiReason"]);t!==void 0&&y!=null&&g(t,["parameters","includeRaiReason"],y);const E=m(e,["language"]);t!==void 0&&E!=null&&g(t,["parameters","language"],E);const _=m(e,["outputMimeType"]);t!==void 0&&_!=null&&g(t,["parameters","outputOptions","mimeType"],_);const T=m(e,["outputCompressionQuality"]);t!==void 0&&T!=null&&g(t,["parameters","outputOptions","compressionQuality"],T);const A=m(e,["addWatermark"]);t!==void 0&&A!=null&&g(t,["parameters","addWatermark"],A);const w=m(e,["labels"]);t!==void 0&&w!=null&&g(t,["labels"],w);const R=m(e,["editMode"]);t!==void 0&&R!=null&&g(t,["parameters","editMode"],R);const I=m(e,["baseSteps"]);return t!==void 0&&I!=null&&g(t,["parameters","editConfig","baseSteps"],I),n}function $B(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["prompt"]);o!=null&&g(n,["instances[0]","prompt"],o);const l=m(t,["referenceImages"]);if(l!=null){let c=l;Array.isArray(c)&&(c=c.map(d=>Kq(d))),g(n,["instances[0]","referenceImages"],c)}const s=m(t,["config"]);return s!=null&&FB(s,n),n}function YB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["predictions"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>rd(l))),g(t,["generatedImages"],o)}return t}function KB(e,t){const n={},r=m(e,["taskType"]);t!==void 0&&r!=null&&g(t,["requests[]","taskType"],r);const o=m(e,["title"]);t!==void 0&&o!=null&&g(t,["requests[]","title"],o);const l=m(e,["outputDimensionality"]);if(t!==void 0&&l!=null&&g(t,["requests[]","outputDimensionality"],l),m(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(m(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return n}function JB(e,t){const n={},r=m(e,["taskType"]);t!==void 0&&r!=null&&g(t,["instances[]","task_type"],r);const o=m(e,["title"]);t!==void 0&&o!=null&&g(t,["instances[]","title"],o);const l=m(e,["outputDimensionality"]);t!==void 0&&l!=null&&g(t,["parameters","outputDimensionality"],l);const s=m(e,["mimeType"]);t!==void 0&&s!=null&&g(t,["instances[]","mimeType"],s);const c=m(e,["autoTruncate"]);return t!==void 0&&c!=null&&g(t,["parameters","autoTruncate"],c),n}function jB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let c=Ay(e,o);Array.isArray(c)&&(c=c.map(d=>d)),g(n,["requests[]","content"],c)}const l=m(t,["config"]);l!=null&&KB(l,n);const s=m(t,["model"]);return s!==void 0&&g(n,["requests[]","model"],Be(e,s)),n}function XB(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let s=Ay(e,o);Array.isArray(s)&&(s=s.map(c=>c)),g(n,["instances[]","content"],s)}const l=m(t,["config"]);return l!=null&&JB(l,n),n}function WB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["embeddings"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["embeddings"],l)}const o=m(e,["metadata"]);return o!=null&&g(t,["metadata"],o),t}function ZB(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["predictions[]","embeddings"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(s=>RB(s))),g(t,["embeddings"],l)}const o=m(e,["metadata"]);return o!=null&&g(t,["metadata"],o),t}function QB(e){const t={},n=m(e,["endpoint"]);n!=null&&g(t,["name"],n);const r=m(e,["deployedModelId"]);return r!=null&&g(t,["deployedModelId"],r),t}function eq(e){const t={};if(m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=m(e,["fileUri"]);n!=null&&g(t,["fileUri"],n);const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function tq(e){const t={},n=m(e,["id"]);n!=null&&g(t,["id"],n);const r=m(e,["args"]);r!=null&&g(t,["args"],r);const o=m(e,["name"]);if(o!=null&&g(t,["name"],o),m(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(m(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function nq(e){const t={},n=m(e,["allowedFunctionNames"]);n!=null&&g(t,["allowedFunctionNames"],n);const r=m(e,["mode"]);if(r!=null&&g(t,["mode"],r),m(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function rq(e){const t={},n=m(e,["description"]);n!=null&&g(t,["description"],n);const r=m(e,["name"]);r!=null&&g(t,["name"],r);const o=m(e,["parameters"]);o!=null&&g(t,["parameters"],o);const l=m(e,["parametersJsonSchema"]);l!=null&&g(t,["parametersJsonSchema"],l);const s=m(e,["response"]);s!=null&&g(t,["response"],s);const c=m(e,["responseJsonSchema"]);if(c!=null&&g(t,["responseJsonSchema"],c),m(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");return t}function iq(e,t,n){const r={},o=m(t,["systemInstruction"]);n!==void 0&&o!=null&&g(n,["systemInstruction"],nd(Wt(o)));const l=m(t,["temperature"]);l!=null&&g(r,["temperature"],l);const s=m(t,["topP"]);s!=null&&g(r,["topP"],s);const c=m(t,["topK"]);c!=null&&g(r,["topK"],c);const d=m(t,["candidateCount"]);d!=null&&g(r,["candidateCount"],d);const f=m(t,["maxOutputTokens"]);f!=null&&g(r,["maxOutputTokens"],f);const h=m(t,["stopSequences"]);h!=null&&g(r,["stopSequences"],h);const v=m(t,["responseLogprobs"]);v!=null&&g(r,["responseLogprobs"],v);const y=m(t,["logprobs"]);y!=null&&g(r,["logprobs"],y);const E=m(t,["presencePenalty"]);E!=null&&g(r,["presencePenalty"],E);const _=m(t,["frequencyPenalty"]);_!=null&&g(r,["frequencyPenalty"],_);const T=m(t,["seed"]);T!=null&&g(r,["seed"],T);const A=m(t,["responseMimeType"]);A!=null&&g(r,["responseMimeType"],A);const w=m(t,["responseSchema"]);w!=null&&g(r,["responseSchema"],Cy(w));const R=m(t,["responseJsonSchema"]);if(R!=null&&g(r,["responseJsonSchema"],R),m(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(m(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const I=m(t,["safetySettings"]);if(n!==void 0&&I!=null){let oe=I;Array.isArray(oe)&&(oe=oe.map(se=>Jq(se))),g(n,["safetySettings"],oe)}const P=m(t,["tools"]);if(n!==void 0&&P!=null){let oe=nl(P);Array.isArray(oe)&&(oe=oe.map(se=>tG(tl(se)))),g(n,["tools"],oe)}const N=m(t,["toolConfig"]);if(n!==void 0&&N!=null&&g(n,["toolConfig"],eG(N)),m(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const O=m(t,["cachedContent"]);n!==void 0&&O!=null&&g(n,["cachedContent"],pi(e,O));const D=m(t,["responseModalities"]);D!=null&&g(r,["responseModalities"],D);const G=m(t,["mediaResolution"]);G!=null&&g(r,["mediaResolution"],G);const B=m(t,["speechConfig"]);if(B!=null&&g(r,["speechConfig"],xy(B)),m(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const Q=m(t,["thinkingConfig"]);Q!=null&&g(r,["thinkingConfig"],Q);const te=m(t,["imageConfig"]);te!=null&&g(r,["imageConfig"],Rq(te));const $=m(t,["enableEnhancedCivicAnswers"]);if($!=null&&g(r,["enableEnhancedCivicAnswers"],$),m(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is not supported in Gemini API.");return r}function oq(e,t,n){const r={},o=m(t,["systemInstruction"]);n!==void 0&&o!=null&&g(n,["systemInstruction"],Wt(o));const l=m(t,["temperature"]);l!=null&&g(r,["temperature"],l);const s=m(t,["topP"]);s!=null&&g(r,["topP"],s);const c=m(t,["topK"]);c!=null&&g(r,["topK"],c);const d=m(t,["candidateCount"]);d!=null&&g(r,["candidateCount"],d);const f=m(t,["maxOutputTokens"]);f!=null&&g(r,["maxOutputTokens"],f);const h=m(t,["stopSequences"]);h!=null&&g(r,["stopSequences"],h);const v=m(t,["responseLogprobs"]);v!=null&&g(r,["responseLogprobs"],v);const y=m(t,["logprobs"]);y!=null&&g(r,["logprobs"],y);const E=m(t,["presencePenalty"]);E!=null&&g(r,["presencePenalty"],E);const _=m(t,["frequencyPenalty"]);_!=null&&g(r,["frequencyPenalty"],_);const T=m(t,["seed"]);T!=null&&g(r,["seed"],T);const A=m(t,["responseMimeType"]);A!=null&&g(r,["responseMimeType"],A);const w=m(t,["responseSchema"]);w!=null&&g(r,["responseSchema"],Cy(w));const R=m(t,["responseJsonSchema"]);R!=null&&g(r,["responseJsonSchema"],R);const I=m(t,["routingConfig"]);I!=null&&g(r,["routingConfig"],I);const P=m(t,["modelSelectionConfig"]);P!=null&&g(r,["modelConfig"],P);const N=m(t,["safetySettings"]);if(n!==void 0&&N!=null){let X=N;Array.isArray(X)&&(X=X.map(ae=>ae)),g(n,["safetySettings"],X)}const O=m(t,["tools"]);if(n!==void 0&&O!=null){let X=nl(O);Array.isArray(X)&&(X=X.map(ae=>sI(tl(ae)))),g(n,["tools"],X)}const D=m(t,["toolConfig"]);n!==void 0&&D!=null&&g(n,["toolConfig"],D);const G=m(t,["labels"]);n!==void 0&&G!=null&&g(n,["labels"],G);const B=m(t,["cachedContent"]);n!==void 0&&B!=null&&g(n,["cachedContent"],pi(e,B));const Q=m(t,["responseModalities"]);Q!=null&&g(r,["responseModalities"],Q);const te=m(t,["mediaResolution"]);te!=null&&g(r,["mediaResolution"],te);const $=m(t,["speechConfig"]);$!=null&&g(r,["speechConfig"],xy($));const oe=m(t,["audioTimestamp"]);oe!=null&&g(r,["audioTimestamp"],oe);const se=m(t,["thinkingConfig"]);se!=null&&g(r,["thinkingConfig"],se);const ye=m(t,["imageConfig"]);if(ye!=null&&g(r,["imageConfig"],Oq(ye)),m(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");const V=m(t,["modelArmorConfig"]);return n!==void 0&&V!=null&&g(n,["modelArmorConfig"],V),r}function PA(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let s=jn(o);Array.isArray(s)&&(s=s.map(c=>nd(c))),g(n,["contents"],s)}const l=m(t,["config"]);return l!=null&&g(n,["generationConfig"],iq(e,l,n)),n}function RA(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["contents"]);if(o!=null){let s=jn(o);Array.isArray(s)&&(s=s.map(c=>c)),g(n,["contents"],s)}const l=m(t,["config"]);return l!=null&&g(n,["generationConfig"],oq(e,l,n)),n}function OA(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["candidates"]);if(r!=null){let d=r;Array.isArray(d)&&(d=d.map(f=>wB(f))),g(t,["candidates"],d)}const o=m(e,["modelVersion"]);o!=null&&g(t,["modelVersion"],o);const l=m(e,["promptFeedback"]);l!=null&&g(t,["promptFeedback"],l);const s=m(e,["responseId"]);s!=null&&g(t,["responseId"],s);const c=m(e,["usageMetadata"]);return c!=null&&g(t,["usageMetadata"],c),t}function NA(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["candidates"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(h=>h)),g(t,["candidates"],f)}const o=m(e,["createTime"]);o!=null&&g(t,["createTime"],o);const l=m(e,["modelVersion"]);l!=null&&g(t,["modelVersion"],l);const s=m(e,["promptFeedback"]);s!=null&&g(t,["promptFeedback"],s);const c=m(e,["responseId"]);c!=null&&g(t,["responseId"],c);const d=m(e,["usageMetadata"]);return d!=null&&g(t,["usageMetadata"],d),t}function aq(e,t){const n={};if(m(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(m(e,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const r=m(e,["numberOfImages"]);t!==void 0&&r!=null&&g(t,["parameters","sampleCount"],r);const o=m(e,["aspectRatio"]);t!==void 0&&o!=null&&g(t,["parameters","aspectRatio"],o);const l=m(e,["guidanceScale"]);if(t!==void 0&&l!=null&&g(t,["parameters","guidanceScale"],l),m(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const s=m(e,["safetyFilterLevel"]);t!==void 0&&s!=null&&g(t,["parameters","safetySetting"],s);const c=m(e,["personGeneration"]);t!==void 0&&c!=null&&g(t,["parameters","personGeneration"],c);const d=m(e,["includeSafetyAttributes"]);t!==void 0&&d!=null&&g(t,["parameters","includeSafetyAttributes"],d);const f=m(e,["includeRaiReason"]);t!==void 0&&f!=null&&g(t,["parameters","includeRaiReason"],f);const h=m(e,["language"]);t!==void 0&&h!=null&&g(t,["parameters","language"],h);const v=m(e,["outputMimeType"]);t!==void 0&&v!=null&&g(t,["parameters","outputOptions","mimeType"],v);const y=m(e,["outputCompressionQuality"]);if(t!==void 0&&y!=null&&g(t,["parameters","outputOptions","compressionQuality"],y),m(e,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(m(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const E=m(e,["imageSize"]);if(t!==void 0&&E!=null&&g(t,["parameters","sampleImageSize"],E),m(e,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return n}function lq(e,t){const n={},r=m(e,["outputGcsUri"]);t!==void 0&&r!=null&&g(t,["parameters","storageUri"],r);const o=m(e,["negativePrompt"]);t!==void 0&&o!=null&&g(t,["parameters","negativePrompt"],o);const l=m(e,["numberOfImages"]);t!==void 0&&l!=null&&g(t,["parameters","sampleCount"],l);const s=m(e,["aspectRatio"]);t!==void 0&&s!=null&&g(t,["parameters","aspectRatio"],s);const c=m(e,["guidanceScale"]);t!==void 0&&c!=null&&g(t,["parameters","guidanceScale"],c);const d=m(e,["seed"]);t!==void 0&&d!=null&&g(t,["parameters","seed"],d);const f=m(e,["safetyFilterLevel"]);t!==void 0&&f!=null&&g(t,["parameters","safetySetting"],f);const h=m(e,["personGeneration"]);t!==void 0&&h!=null&&g(t,["parameters","personGeneration"],h);const v=m(e,["includeSafetyAttributes"]);t!==void 0&&v!=null&&g(t,["parameters","includeSafetyAttributes"],v);const y=m(e,["includeRaiReason"]);t!==void 0&&y!=null&&g(t,["parameters","includeRaiReason"],y);const E=m(e,["language"]);t!==void 0&&E!=null&&g(t,["parameters","language"],E);const _=m(e,["outputMimeType"]);t!==void 0&&_!=null&&g(t,["parameters","outputOptions","mimeType"],_);const T=m(e,["outputCompressionQuality"]);t!==void 0&&T!=null&&g(t,["parameters","outputOptions","compressionQuality"],T);const A=m(e,["addWatermark"]);t!==void 0&&A!=null&&g(t,["parameters","addWatermark"],A);const w=m(e,["labels"]);t!==void 0&&w!=null&&g(t,["labels"],w);const R=m(e,["imageSize"]);t!==void 0&&R!=null&&g(t,["parameters","sampleImageSize"],R);const I=m(e,["enhancePrompt"]);return t!==void 0&&I!=null&&g(t,["parameters","enhancePrompt"],I),n}function sq(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["prompt"]);o!=null&&g(n,["instances[0]","prompt"],o);const l=m(t,["config"]);return l!=null&&aq(l,n),n}function uq(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["prompt"]);o!=null&&g(n,["instances[0]","prompt"],o);const l=m(t,["config"]);return l!=null&&lq(l,n),n}function cq(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["predictions"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(s=>_q(s))),g(t,["generatedImages"],l)}const o=m(e,["positivePromptSafetyAttributes"]);return o!=null&&g(t,["positivePromptSafetyAttributes"],aI(o)),t}function fq(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["predictions"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(s=>rd(s))),g(t,["generatedImages"],l)}const o=m(e,["positivePromptSafetyAttributes"]);return o!=null&&g(t,["positivePromptSafetyAttributes"],lI(o)),t}function dq(e,t){const n={},r=m(e,["numberOfVideos"]);if(t!==void 0&&r!=null&&g(t,["parameters","sampleCount"],r),m(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(m(e,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const o=m(e,["durationSeconds"]);if(t!==void 0&&o!=null&&g(t,["parameters","durationSeconds"],o),m(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const l=m(e,["aspectRatio"]);t!==void 0&&l!=null&&g(t,["parameters","aspectRatio"],l);const s=m(e,["resolution"]);t!==void 0&&s!=null&&g(t,["parameters","resolution"],s);const c=m(e,["personGeneration"]);if(t!==void 0&&c!=null&&g(t,["parameters","personGeneration"],c),m(e,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const d=m(e,["negativePrompt"]);t!==void 0&&d!=null&&g(t,["parameters","negativePrompt"],d);const f=m(e,["enhancePrompt"]);if(t!==void 0&&f!=null&&g(t,["parameters","enhancePrompt"],f),m(e,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const h=m(e,["lastFrame"]);t!==void 0&&h!=null&&g(t,["instances[0]","lastFrame"],id(h));const v=m(e,["referenceImages"]);if(t!==void 0&&v!=null){let y=v;Array.isArray(y)&&(y=y.map(E=>hG(E))),g(t,["instances[0]","referenceImages"],y)}if(m(e,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(m(e,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return n}function pq(e,t){const n={},r=m(e,["numberOfVideos"]);t!==void 0&&r!=null&&g(t,["parameters","sampleCount"],r);const o=m(e,["outputGcsUri"]);t!==void 0&&o!=null&&g(t,["parameters","storageUri"],o);const l=m(e,["fps"]);t!==void 0&&l!=null&&g(t,["parameters","fps"],l);const s=m(e,["durationSeconds"]);t!==void 0&&s!=null&&g(t,["parameters","durationSeconds"],s);const c=m(e,["seed"]);t!==void 0&&c!=null&&g(t,["parameters","seed"],c);const d=m(e,["aspectRatio"]);t!==void 0&&d!=null&&g(t,["parameters","aspectRatio"],d);const f=m(e,["resolution"]);t!==void 0&&f!=null&&g(t,["parameters","resolution"],f);const h=m(e,["personGeneration"]);t!==void 0&&h!=null&&g(t,["parameters","personGeneration"],h);const v=m(e,["pubsubTopic"]);t!==void 0&&v!=null&&g(t,["parameters","pubsubTopic"],v);const y=m(e,["negativePrompt"]);t!==void 0&&y!=null&&g(t,["parameters","negativePrompt"],y);const E=m(e,["enhancePrompt"]);t!==void 0&&E!=null&&g(t,["parameters","enhancePrompt"],E);const _=m(e,["generateAudio"]);t!==void 0&&_!=null&&g(t,["parameters","generateAudio"],_);const T=m(e,["lastFrame"]);t!==void 0&&T!=null&&g(t,["instances[0]","lastFrame"],hr(T));const A=m(e,["referenceImages"]);if(t!==void 0&&A!=null){let I=A;Array.isArray(I)&&(I=I.map(P=>mG(P))),g(t,["instances[0]","referenceImages"],I)}const w=m(e,["mask"]);t!==void 0&&w!=null&&g(t,["instances[0]","mask"],pG(w));const R=m(e,["compressionQuality"]);return t!==void 0&&R!=null&&g(t,["parameters","compressionQuality"],R),n}function hq(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response","generateVideoResponse"]);return s!=null&&g(t,["response"],yq(s)),t}function mq(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response"]);return s!=null&&g(t,["response"],Sq(s)),t}function vq(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["prompt"]);o!=null&&g(n,["instances[0]","prompt"],o);const l=m(t,["image"]);l!=null&&g(n,["instances[0]","image"],id(l));const s=m(t,["video"]);s!=null&&g(n,["instances[0]","video"],uI(s));const c=m(t,["source"]);c!=null&&bq(c,n);const d=m(t,["config"]);return d!=null&&dq(d,n),n}function gq(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["prompt"]);o!=null&&g(n,["instances[0]","prompt"],o);const l=m(t,["image"]);l!=null&&g(n,["instances[0]","image"],hr(l));const s=m(t,["video"]);s!=null&&g(n,["instances[0]","video"],cI(s));const c=m(t,["source"]);c!=null&&Eq(c,n);const d=m(t,["config"]);return d!=null&&pq(d,n),n}function yq(e){const t={},n=m(e,["generatedSamples"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(s=>Aq(s))),g(t,["generatedVideos"],l)}const r=m(e,["raiMediaFilteredCount"]);r!=null&&g(t,["raiMediaFilteredCount"],r);const o=m(e,["raiMediaFilteredReasons"]);return o!=null&&g(t,["raiMediaFilteredReasons"],o),t}function Sq(e){const t={},n=m(e,["videos"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(s=>Cq(s))),g(t,["generatedVideos"],l)}const r=m(e,["raiMediaFilteredCount"]);r!=null&&g(t,["raiMediaFilteredCount"],r);const o=m(e,["raiMediaFilteredReasons"]);return o!=null&&g(t,["raiMediaFilteredReasons"],o),t}function bq(e,t){const n={},r=m(e,["prompt"]);t!==void 0&&r!=null&&g(t,["instances[0]","prompt"],r);const o=m(e,["image"]);t!==void 0&&o!=null&&g(t,["instances[0]","image"],id(o));const l=m(e,["video"]);return t!==void 0&&l!=null&&g(t,["instances[0]","video"],uI(l)),n}function Eq(e,t){const n={},r=m(e,["prompt"]);t!==void 0&&r!=null&&g(t,["instances[0]","prompt"],r);const o=m(e,["image"]);t!==void 0&&o!=null&&g(t,["instances[0]","image"],hr(o));const l=m(e,["video"]);return t!==void 0&&l!=null&&g(t,["instances[0]","video"],cI(l)),n}function _q(e){const t={},n=m(e,["_self"]);n!=null&&g(t,["image"],Nq(n));const r=m(e,["raiFilteredReason"]);r!=null&&g(t,["raiFilteredReason"],r);const o=m(e,["_self"]);return o!=null&&g(t,["safetyAttributes"],aI(o)),t}function rd(e){const t={},n=m(e,["_self"]);n!=null&&g(t,["image"],oI(n));const r=m(e,["raiFilteredReason"]);r!=null&&g(t,["raiFilteredReason"],r);const o=m(e,["_self"]);o!=null&&g(t,["safetyAttributes"],lI(o));const l=m(e,["prompt"]);return l!=null&&g(t,["enhancedPrompt"],l),t}function Tq(e){const t={},n=m(e,["_self"]);n!=null&&g(t,["mask"],oI(n));const r=m(e,["labels"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>l)),g(t,["labels"],o)}return t}function Aq(e){const t={},n=m(e,["video"]);return n!=null&&g(t,["video"],fG(n)),t}function Cq(e){const t={},n=m(e,["_self"]);return n!=null&&g(t,["video"],dG(n)),t}function xq(e){const t={},n=m(e,["modelSelectionConfig"]);n!=null&&g(t,["modelConfig"],n);const r=m(e,["responseJsonSchema"]);r!=null&&g(t,["responseJsonSchema"],r);const o=m(e,["audioTimestamp"]);o!=null&&g(t,["audioTimestamp"],o);const l=m(e,["candidateCount"]);l!=null&&g(t,["candidateCount"],l);const s=m(e,["enableAffectiveDialog"]);s!=null&&g(t,["enableAffectiveDialog"],s);const c=m(e,["frequencyPenalty"]);c!=null&&g(t,["frequencyPenalty"],c);const d=m(e,["logprobs"]);d!=null&&g(t,["logprobs"],d);const f=m(e,["maxOutputTokens"]);f!=null&&g(t,["maxOutputTokens"],f);const h=m(e,["mediaResolution"]);h!=null&&g(t,["mediaResolution"],h);const v=m(e,["presencePenalty"]);v!=null&&g(t,["presencePenalty"],v);const y=m(e,["responseLogprobs"]);y!=null&&g(t,["responseLogprobs"],y);const E=m(e,["responseMimeType"]);E!=null&&g(t,["responseMimeType"],E);const _=m(e,["responseModalities"]);_!=null&&g(t,["responseModalities"],_);const T=m(e,["responseSchema"]);T!=null&&g(t,["responseSchema"],T);const A=m(e,["routingConfig"]);A!=null&&g(t,["routingConfig"],A);const w=m(e,["seed"]);w!=null&&g(t,["seed"],w);const R=m(e,["speechConfig"]);R!=null&&g(t,["speechConfig"],R);const I=m(e,["stopSequences"]);I!=null&&g(t,["stopSequences"],I);const P=m(e,["temperature"]);P!=null&&g(t,["temperature"],P);const N=m(e,["thinkingConfig"]);N!=null&&g(t,["thinkingConfig"],N);const O=m(e,["topK"]);O!=null&&g(t,["topK"],O);const D=m(e,["topP"]);if(D!=null&&g(t,["topP"],D),m(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function wq(e,t){const n={},r=m(t,["model"]);return r!=null&&g(n,["_url","name"],Be(e,r)),n}function Mq(e,t){const n={},r=m(t,["model"]);return r!=null&&g(n,["_url","name"],Be(e,r)),n}function Iq(e){const t={};if(m(e,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=m(e,["enableWidget"]);return n!=null&&g(t,["enableWidget"],n),t}function Pq(e){const t={};if(m(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(m(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=m(e,["timeRangeFilter"]);return n!=null&&g(t,["timeRangeFilter"],n),t}function Rq(e){const t={},n=m(e,["aspectRatio"]);n!=null&&g(t,["aspectRatio"],n);const r=m(e,["imageSize"]);if(r!=null&&g(t,["imageSize"],r),m(e,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is not supported in Gemini API.");if(m(e,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(m(e,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function Oq(e){const t={},n=m(e,["aspectRatio"]);n!=null&&g(t,["aspectRatio"],n);const r=m(e,["imageSize"]);r!=null&&g(t,["imageSize"],r);const o=m(e,["personGeneration"]);o!=null&&g(t,["personGeneration"],o);const l=m(e,["outputMimeType"]);l!=null&&g(t,["imageOutputOptions","mimeType"],l);const s=m(e,["outputCompressionQuality"]);return s!=null&&g(t,["imageOutputOptions","compressionQuality"],s),t}function Nq(e){const t={},n=m(e,["bytesBase64Encoded"]);n!=null&&g(t,["imageBytes"],eo(n));const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function oI(e){const t={},n=m(e,["gcsUri"]);n!=null&&g(t,["gcsUri"],n);const r=m(e,["bytesBase64Encoded"]);r!=null&&g(t,["imageBytes"],eo(r));const o=m(e,["mimeType"]);return o!=null&&g(t,["mimeType"],o),t}function id(e){const t={};if(m(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const n=m(e,["imageBytes"]);n!=null&&g(t,["bytesBase64Encoded"],eo(n));const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function hr(e){const t={},n=m(e,["gcsUri"]);n!=null&&g(t,["gcsUri"],n);const r=m(e,["imageBytes"]);r!=null&&g(t,["bytesBase64Encoded"],eo(r));const o=m(e,["mimeType"]);return o!=null&&g(t,["mimeType"],o),t}function Dq(e,t,n){const r={},o=m(t,["pageSize"]);n!==void 0&&o!=null&&g(n,["_query","pageSize"],o);const l=m(t,["pageToken"]);n!==void 0&&l!=null&&g(n,["_query","pageToken"],l);const s=m(t,["filter"]);n!==void 0&&s!=null&&g(n,["_query","filter"],s);const c=m(t,["queryBase"]);return n!==void 0&&c!=null&&g(n,["_url","models_url"],ZM(e,c)),r}function kq(e,t,n){const r={},o=m(t,["pageSize"]);n!==void 0&&o!=null&&g(n,["_query","pageSize"],o);const l=m(t,["pageToken"]);n!==void 0&&l!=null&&g(n,["_query","pageToken"],l);const s=m(t,["filter"]);n!==void 0&&s!=null&&g(n,["_query","filter"],s);const c=m(t,["queryBase"]);return n!==void 0&&c!=null&&g(n,["_url","models_url"],ZM(e,c)),r}function Uq(e,t){const n={},r=m(t,["config"]);return r!=null&&Dq(e,r,n),n}function Lq(e,t){const n={},r=m(t,["config"]);return r!=null&&kq(e,r,n),n}function zq(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["_self"]);if(o!=null){let l=QM(o);Array.isArray(l)&&(l=l.map(s=>fg(s))),g(t,["models"],l)}return t}function Bq(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["_self"]);if(o!=null){let l=QM(o);Array.isArray(l)&&(l=l.map(s=>dg(s))),g(t,["models"],l)}return t}function qq(e){const t={},n=m(e,["maskMode"]);n!=null&&g(t,["maskMode"],n);const r=m(e,["segmentationClasses"]);r!=null&&g(t,["maskClasses"],r);const o=m(e,["maskDilation"]);return o!=null&&g(t,["dilation"],o),t}function fg(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["displayName"]);r!=null&&g(t,["displayName"],r);const o=m(e,["description"]);o!=null&&g(t,["description"],o);const l=m(e,["version"]);l!=null&&g(t,["version"],l);const s=m(e,["_self"]);s!=null&&g(t,["tunedModelInfo"],nG(s));const c=m(e,["inputTokenLimit"]);c!=null&&g(t,["inputTokenLimit"],c);const d=m(e,["outputTokenLimit"]);d!=null&&g(t,["outputTokenLimit"],d);const f=m(e,["supportedGenerationMethods"]);f!=null&&g(t,["supportedActions"],f);const h=m(e,["temperature"]);h!=null&&g(t,["temperature"],h);const v=m(e,["maxTemperature"]);v!=null&&g(t,["maxTemperature"],v);const y=m(e,["topP"]);y!=null&&g(t,["topP"],y);const E=m(e,["topK"]);E!=null&&g(t,["topK"],E);const _=m(e,["thinking"]);return _!=null&&g(t,["thinking"],_),t}function dg(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["displayName"]);r!=null&&g(t,["displayName"],r);const o=m(e,["description"]);o!=null&&g(t,["description"],o);const l=m(e,["versionId"]);l!=null&&g(t,["version"],l);const s=m(e,["deployedModels"]);if(s!=null){let v=s;Array.isArray(v)&&(v=v.map(y=>QB(y))),g(t,["endpoints"],v)}const c=m(e,["labels"]);c!=null&&g(t,["labels"],c);const d=m(e,["_self"]);d!=null&&g(t,["tunedModelInfo"],rG(d));const f=m(e,["defaultCheckpointId"]);f!=null&&g(t,["defaultCheckpointId"],f);const h=m(e,["checkpoints"]);if(h!=null){let v=h;Array.isArray(v)&&(v=v.map(y=>y)),g(t,["checkpoints"],v)}return t}function Gq(e){const t={},n=m(e,["mediaResolution"]);n!=null&&g(t,["mediaResolution"],n);const r=m(e,["codeExecutionResult"]);r!=null&&g(t,["codeExecutionResult"],r);const o=m(e,["executableCode"]);o!=null&&g(t,["executableCode"],o);const l=m(e,["fileData"]);l!=null&&g(t,["fileData"],eq(l));const s=m(e,["functionCall"]);s!=null&&g(t,["functionCall"],tq(s));const c=m(e,["functionResponse"]);c!=null&&g(t,["functionResponse"],c);const d=m(e,["inlineData"]);d!=null&&g(t,["inlineData"],xB(d));const f=m(e,["text"]);f!=null&&g(t,["text"],f);const h=m(e,["thought"]);h!=null&&g(t,["thought"],h);const v=m(e,["thoughtSignature"]);v!=null&&g(t,["thoughtSignature"],v);const y=m(e,["videoMetadata"]);return y!=null&&g(t,["videoMetadata"],y),t}function Hq(e){const t={},n=m(e,["productImage"]);return n!=null&&g(t,["image"],hr(n)),t}function Vq(e,t){const n={},r=m(e,["numberOfImages"]);t!==void 0&&r!=null&&g(t,["parameters","sampleCount"],r);const o=m(e,["baseSteps"]);t!==void 0&&o!=null&&g(t,["parameters","baseSteps"],o);const l=m(e,["outputGcsUri"]);t!==void 0&&l!=null&&g(t,["parameters","storageUri"],l);const s=m(e,["seed"]);t!==void 0&&s!=null&&g(t,["parameters","seed"],s);const c=m(e,["safetyFilterLevel"]);t!==void 0&&c!=null&&g(t,["parameters","safetySetting"],c);const d=m(e,["personGeneration"]);t!==void 0&&d!=null&&g(t,["parameters","personGeneration"],d);const f=m(e,["addWatermark"]);t!==void 0&&f!=null&&g(t,["parameters","addWatermark"],f);const h=m(e,["outputMimeType"]);t!==void 0&&h!=null&&g(t,["parameters","outputOptions","mimeType"],h);const v=m(e,["outputCompressionQuality"]);t!==void 0&&v!=null&&g(t,["parameters","outputOptions","compressionQuality"],v);const y=m(e,["enhancePrompt"]);t!==void 0&&y!=null&&g(t,["parameters","enhancePrompt"],y);const E=m(e,["labels"]);return t!==void 0&&E!=null&&g(t,["labels"],E),n}function Fq(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["source"]);o!=null&&Yq(o,n);const l=m(t,["config"]);return l!=null&&Vq(l,n),n}function $q(e){const t={},n=m(e,["predictions"]);if(n!=null){let r=n;Array.isArray(r)&&(r=r.map(o=>rd(o))),g(t,["generatedImages"],r)}return t}function Yq(e,t){const n={},r=m(e,["prompt"]);t!==void 0&&r!=null&&g(t,["instances[0]","prompt"],r);const o=m(e,["personImage"]);t!==void 0&&o!=null&&g(t,["instances[0]","personImage","image"],hr(o));const l=m(e,["productImages"]);if(t!==void 0&&l!=null){let s=l;Array.isArray(s)&&(s=s.map(c=>Hq(c))),g(t,["instances[0]","productImages"],s)}return n}function Kq(e){const t={},n=m(e,["referenceImage"]);n!=null&&g(t,["referenceImage"],hr(n));const r=m(e,["referenceId"]);r!=null&&g(t,["referenceId"],r);const o=m(e,["referenceType"]);o!=null&&g(t,["referenceType"],o);const l=m(e,["maskImageConfig"]);l!=null&&g(t,["maskImageConfig"],qq(l));const s=m(e,["controlImageConfig"]);s!=null&&g(t,["controlImageConfig"],NB(s));const c=m(e,["styleImageConfig"]);c!=null&&g(t,["styleImageConfig"],c);const d=m(e,["subjectImageConfig"]);return d!=null&&g(t,["subjectImageConfig"],d),t}function aI(e){const t={},n=m(e,["safetyAttributes","categories"]);n!=null&&g(t,["categories"],n);const r=m(e,["safetyAttributes","scores"]);r!=null&&g(t,["scores"],r);const o=m(e,["contentType"]);return o!=null&&g(t,["contentType"],o),t}function lI(e){const t={},n=m(e,["safetyAttributes","categories"]);n!=null&&g(t,["categories"],n);const r=m(e,["safetyAttributes","scores"]);r!=null&&g(t,["scores"],r);const o=m(e,["contentType"]);return o!=null&&g(t,["contentType"],o),t}function Jq(e){const t={},n=m(e,["category"]);if(n!=null&&g(t,["category"],n),m(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const r=m(e,["threshold"]);return r!=null&&g(t,["threshold"],r),t}function jq(e){const t={},n=m(e,["image"]);return n!=null&&g(t,["image"],hr(n)),t}function Xq(e,t){const n={},r=m(e,["mode"]);t!==void 0&&r!=null&&g(t,["parameters","mode"],r);const o=m(e,["maxPredictions"]);t!==void 0&&o!=null&&g(t,["parameters","maxPredictions"],o);const l=m(e,["confidenceThreshold"]);t!==void 0&&l!=null&&g(t,["parameters","confidenceThreshold"],l);const s=m(e,["maskDilation"]);t!==void 0&&s!=null&&g(t,["parameters","maskDilation"],s);const c=m(e,["binaryColorThreshold"]);t!==void 0&&c!=null&&g(t,["parameters","binaryColorThreshold"],c);const d=m(e,["labels"]);return t!==void 0&&d!=null&&g(t,["labels"],d),n}function Wq(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["source"]);o!=null&&Qq(o,n);const l=m(t,["config"]);return l!=null&&Xq(l,n),n}function Zq(e){const t={},n=m(e,["predictions"]);if(n!=null){let r=n;Array.isArray(r)&&(r=r.map(o=>Tq(o))),g(t,["generatedMasks"],r)}return t}function Qq(e,t){const n={},r=m(e,["prompt"]);t!==void 0&&r!=null&&g(t,["instances[0]","prompt"],r);const o=m(e,["image"]);t!==void 0&&o!=null&&g(t,["instances[0]","image"],hr(o));const l=m(e,["scribbleImage"]);return t!==void 0&&l!=null&&g(t,["instances[0]","scribble"],jq(l)),n}function eG(e){const t={},n=m(e,["retrievalConfig"]);n!=null&&g(t,["retrievalConfig"],n);const r=m(e,["functionCallingConfig"]);return r!=null&&g(t,["functionCallingConfig"],nq(r)),t}function tG(e){const t={};if(m(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=m(e,["computerUse"]);n!=null&&g(t,["computerUse"],n);const r=m(e,["fileSearch"]);r!=null&&g(t,["fileSearch"],r);const o=m(e,["codeExecution"]);if(o!=null&&g(t,["codeExecution"],o),m(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=m(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(v=>v)),g(t,["functionDeclarations"],h)}const s=m(e,["googleMaps"]);s!=null&&g(t,["googleMaps"],Iq(s));const c=m(e,["googleSearch"]);c!=null&&g(t,["googleSearch"],Pq(c));const d=m(e,["googleSearchRetrieval"]);d!=null&&g(t,["googleSearchRetrieval"],d);const f=m(e,["urlContext"]);return f!=null&&g(t,["urlContext"],f),t}function sI(e){const t={},n=m(e,["retrieval"]);n!=null&&g(t,["retrieval"],n);const r=m(e,["computerUse"]);if(r!=null&&g(t,["computerUse"],r),m(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=m(e,["codeExecution"]);o!=null&&g(t,["codeExecution"],o);const l=m(e,["enterpriseWebSearch"]);l!=null&&g(t,["enterpriseWebSearch"],l);const s=m(e,["functionDeclarations"]);if(s!=null){let v=s;Array.isArray(v)&&(v=v.map(y=>rq(y))),g(t,["functionDeclarations"],v)}const c=m(e,["googleMaps"]);c!=null&&g(t,["googleMaps"],c);const d=m(e,["googleSearch"]);d!=null&&g(t,["googleSearch"],d);const f=m(e,["googleSearchRetrieval"]);f!=null&&g(t,["googleSearchRetrieval"],f);const h=m(e,["urlContext"]);return h!=null&&g(t,["urlContext"],h),t}function nG(e){const t={},n=m(e,["baseModel"]);n!=null&&g(t,["baseModel"],n);const r=m(e,["createTime"]);r!=null&&g(t,["createTime"],r);const o=m(e,["updateTime"]);return o!=null&&g(t,["updateTime"],o),t}function rG(e){const t={},n=m(e,["labels","google-vertex-llm-tuning-base-model-id"]);n!=null&&g(t,["baseModel"],n);const r=m(e,["createTime"]);r!=null&&g(t,["createTime"],r);const o=m(e,["updateTime"]);return o!=null&&g(t,["updateTime"],o),t}function iG(e,t){const n={},r=m(e,["displayName"]);t!==void 0&&r!=null&&g(t,["displayName"],r);const o=m(e,["description"]);t!==void 0&&o!=null&&g(t,["description"],o);const l=m(e,["defaultCheckpointId"]);return t!==void 0&&l!=null&&g(t,["defaultCheckpointId"],l),n}function oG(e,t){const n={},r=m(e,["displayName"]);t!==void 0&&r!=null&&g(t,["displayName"],r);const o=m(e,["description"]);t!==void 0&&o!=null&&g(t,["description"],o);const l=m(e,["defaultCheckpointId"]);return t!==void 0&&l!=null&&g(t,["defaultCheckpointId"],l),n}function aG(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","name"],Be(e,r));const o=m(t,["config"]);return o!=null&&iG(o,n),n}function lG(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["config"]);return o!=null&&oG(o,n),n}function sG(e,t){const n={},r=m(e,["outputGcsUri"]);t!==void 0&&r!=null&&g(t,["parameters","storageUri"],r);const o=m(e,["safetyFilterLevel"]);t!==void 0&&o!=null&&g(t,["parameters","safetySetting"],o);const l=m(e,["personGeneration"]);t!==void 0&&l!=null&&g(t,["parameters","personGeneration"],l);const s=m(e,["includeRaiReason"]);t!==void 0&&s!=null&&g(t,["parameters","includeRaiReason"],s);const c=m(e,["outputMimeType"]);t!==void 0&&c!=null&&g(t,["parameters","outputOptions","mimeType"],c);const d=m(e,["outputCompressionQuality"]);t!==void 0&&d!=null&&g(t,["parameters","outputOptions","compressionQuality"],d);const f=m(e,["enhanceInputImage"]);t!==void 0&&f!=null&&g(t,["parameters","upscaleConfig","enhanceInputImage"],f);const h=m(e,["imagePreservationFactor"]);t!==void 0&&h!=null&&g(t,["parameters","upscaleConfig","imagePreservationFactor"],h);const v=m(e,["labels"]);t!==void 0&&v!=null&&g(t,["labels"],v);const y=m(e,["numberOfImages"]);t!==void 0&&y!=null&&g(t,["parameters","sampleCount"],y);const E=m(e,["mode"]);return t!==void 0&&E!=null&&g(t,["parameters","mode"],E),n}function uG(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["_url","model"],Be(e,r));const o=m(t,["image"]);o!=null&&g(n,["instances[0]","image"],hr(o));const l=m(t,["upscaleFactor"]);l!=null&&g(n,["parameters","upscaleConfig","upscaleFactor"],l);const s=m(t,["config"]);return s!=null&&sG(s,n),n}function cG(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["predictions"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>rd(l))),g(t,["generatedImages"],o)}return t}function fG(e){const t={},n=m(e,["uri"]);n!=null&&g(t,["uri"],n);const r=m(e,["encodedVideo"]);r!=null&&g(t,["videoBytes"],eo(r));const o=m(e,["encoding"]);return o!=null&&g(t,["mimeType"],o),t}function dG(e){const t={},n=m(e,["gcsUri"]);n!=null&&g(t,["uri"],n);const r=m(e,["bytesBase64Encoded"]);r!=null&&g(t,["videoBytes"],eo(r));const o=m(e,["mimeType"]);return o!=null&&g(t,["mimeType"],o),t}function pG(e){const t={},n=m(e,["image"]);n!=null&&g(t,["_self"],hr(n));const r=m(e,["maskMode"]);return r!=null&&g(t,["maskMode"],r),t}function hG(e){const t={},n=m(e,["image"]);n!=null&&g(t,["image"],id(n));const r=m(e,["referenceType"]);return r!=null&&g(t,["referenceType"],r),t}function mG(e){const t={},n=m(e,["image"]);n!=null&&g(t,["image"],hr(n));const r=m(e,["referenceType"]);return r!=null&&g(t,["referenceType"],r),t}function uI(e){const t={},n=m(e,["uri"]);n!=null&&g(t,["uri"],n);const r=m(e,["videoBytes"]);r!=null&&g(t,["encodedVideo"],eo(r));const o=m(e,["mimeType"]);return o!=null&&g(t,["encoding"],o),t}function cI(e){const t={},n=m(e,["uri"]);n!=null&&g(t,["gcsUri"],n);const r=m(e,["videoBytes"]);r!=null&&g(t,["bytesBase64Encoded"],eo(r));const o=m(e,["mimeType"]);return o!=null&&g(t,["mimeType"],o),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function vG(e,t){const n={},r=m(e,["displayName"]);return t!==void 0&&r!=null&&g(t,["displayName"],r),n}function gG(e){const t={},n=m(e,["config"]);return n!=null&&vG(n,t),t}function yG(e,t){const n={},r=m(e,["force"]);return t!==void 0&&r!=null&&g(t,["_query","force"],r),n}function SG(e){const t={},n=m(e,["name"]);n!=null&&g(t,["_url","name"],n);const r=m(e,["config"]);return r!=null&&yG(r,t),t}function bG(e){const t={},n=m(e,["name"]);return n!=null&&g(t,["_url","name"],n),t}function EG(e,t){const n={},r=m(e,["customMetadata"]);if(t!==void 0&&r!=null){let l=r;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["customMetadata"],l)}const o=m(e,["chunkingConfig"]);return t!==void 0&&o!=null&&g(t,["chunkingConfig"],o),n}function _G(e){const t={},n=m(e,["name"]);n!=null&&g(t,["name"],n);const r=m(e,["metadata"]);r!=null&&g(t,["metadata"],r);const o=m(e,["done"]);o!=null&&g(t,["done"],o);const l=m(e,["error"]);l!=null&&g(t,["error"],l);const s=m(e,["response"]);return s!=null&&g(t,["response"],AG(s)),t}function TG(e){const t={},n=m(e,["fileSearchStoreName"]);n!=null&&g(t,["_url","file_search_store_name"],n);const r=m(e,["fileName"]);r!=null&&g(t,["fileName"],r);const o=m(e,["config"]);return o!=null&&EG(o,t),t}function AG(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["parent"]);r!=null&&g(t,["parent"],r);const o=m(e,["documentName"]);return o!=null&&g(t,["documentName"],o),t}function CG(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);return t!==void 0&&o!=null&&g(t,["_query","pageToken"],o),n}function xG(e){const t={},n=m(e,["config"]);return n!=null&&CG(n,t),t}function wG(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["fileSearchStores"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["fileSearchStores"],l)}return t}function fI(e,t){const n={},r=m(e,["mimeType"]);t!==void 0&&r!=null&&g(t,["mimeType"],r);const o=m(e,["displayName"]);t!==void 0&&o!=null&&g(t,["displayName"],o);const l=m(e,["customMetadata"]);if(t!==void 0&&l!=null){let c=l;Array.isArray(c)&&(c=c.map(d=>d)),g(t,["customMetadata"],c)}const s=m(e,["chunkingConfig"]);return t!==void 0&&s!=null&&g(t,["chunkingConfig"],s),n}function MG(e){const t={},n=m(e,["fileSearchStoreName"]);n!=null&&g(t,["_url","file_search_store_name"],n);const r=m(e,["config"]);return r!=null&&fI(r,t),t}function IG(e){const t={},n=m(e,["sdkHttpResponse"]);return n!=null&&g(t,["sdkHttpResponse"],n),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const PG="Content-Type",RG="X-Server-Timeout",OG="User-Agent",pg="x-goog-api-client",NG="1.38.0",DG=`google-genai-sdk/${NG}`,kG="v1beta1",UG="v1beta";class LG{constructor(t){var n,r,o;this.clientOptions=Object.assign({},t),this.customBaseUrl=(n=t.httpOptions)===null||n===void 0?void 0:n.baseUrl,this.clientOptions.vertexai&&(this.clientOptions.project&&this.clientOptions.location?this.clientOptions.apiKey=void 0:this.clientOptions.apiKey&&(this.clientOptions.project=void 0,this.clientOptions.location=void 0));const l={};if(this.clientOptions.vertexai){if(!this.clientOptions.location&&!this.clientOptions.apiKey&&!this.customBaseUrl&&(this.clientOptions.location="global"),!(this.clientOptions.project&&this.clientOptions.location||this.clientOptions.apiKey)&&!this.customBaseUrl)throw new Error("Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.");const c=t.project&&t.location||!!t.apiKey;this.customBaseUrl&&!c?(l.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||this.clientOptions.location==="global"?l.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&(l.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),l.apiVersion=(r=this.clientOptions.apiVersion)!==null&&r!==void 0?r:kG}else{if(!this.clientOptions.apiKey)throw new Cs({message:"API key must be set when using the Gemini API.",status:403});l.apiVersion=(o=this.clientOptions.apiVersion)!==null&&o!==void 0?o:UG,l.baseUrl="https://generativelanguage.googleapis.com/"}l.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=l,t.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(l,t.httpOptions))}isVertexAI(){var t;return(t=this.clientOptions.vertexai)!==null&&t!==void 0?t:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}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 r=[t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl];return t.apiVersion&&t.apiVersion!==""&&r.push(t.apiVersion),r.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const t=this.getBaseUrl(),n=new URL(t);return n.protocol=n.protocol=="http:"?"ws":"wss",n.toString()}setBaseUrl(t){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=t;else throw new Error("HTTP options are not correctly set.")}constructUrl(t,n,r){const o=[this.getRequestUrlInternal(n)];return r&&o.push(this.getBaseResourcePath()),t!==""&&o.push(t),new URL(`${o.join("/")}`)}shouldPrependVertexProjectPath(t,n){return!(n.baseUrl&&n.baseUrlResourceScope===lg.COLLECTION||this.clientOptions.apiKey||!this.clientOptions.vertexai||t.path.startsWith("projects/")||t.httpMethod==="GET"&&t.path.startsWith("publishers/google/models"))}async request(t){let n=this.clientOptions.httpOptions;t.httpOptions&&(n=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const r=this.shouldPrependVertexProjectPath(t,n),o=this.constructUrl(t.path,n,r);if(t.queryParams)for(const[s,c]of Object.entries(t.queryParams))o.searchParams.append(s,String(c));let l={};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 l.body=t.body;return l=await this.includeExtraHttpOptionsToRequestInit(l,n,o.toString(),t.abortSignal),this.unaryApiCall(o,l,t.httpMethod)}patchHttpOptions(t,n){const r=JSON.parse(JSON.stringify(t));for(const[o,l]of Object.entries(n))typeof l=="object"?r[o]=Object.assign(Object.assign({},r[o]),l):l!==void 0&&(r[o]=l);return r}async requestStream(t){let n=this.clientOptions.httpOptions;t.httpOptions&&(n=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const r=this.shouldPrependVertexProjectPath(t,n),o=this.constructUrl(t.path,n,r);(!o.searchParams.has("alt")||o.searchParams.get("alt")!=="sse")&&o.searchParams.set("alt","sse");let l={};return l.body=t.body,l=await this.includeExtraHttpOptionsToRequestInit(l,n,o.toString(),t.abortSignal),this.streamApiCall(o,l,t.httpMethod)}async includeExtraHttpOptionsToRequestInit(t,n,r,o){if(n&&n.timeout||o){const l=new AbortController,s=l.signal;if(n.timeout&&(n==null?void 0:n.timeout)>0){const c=setTimeout(()=>l.abort(),n.timeout);c&&typeof c.unref=="function"&&c.unref()}o&&o.addEventListener("abort",()=>{l.abort()}),t.signal=s}return n&&n.extraBody!==null&&zG(t,n.extraBody),t.headers=await this.getHeadersInternal(n,r),t}async unaryApiCall(t,n,r){return this.apiCall(t.toString(),Object.assign(Object.assign({},n),{method:r})).then(async o=>(await DA(o),new sg(o))).catch(o=>{throw o instanceof Error?o:new Error(JSON.stringify(o))})}async streamApiCall(t,n,r){return this.apiCall(t.toString(),Object.assign(Object.assign({},n),{method:r})).then(async o=>(await DA(o),this.processStreamResponse(o))).catch(o=>{throw o instanceof Error?o:new Error(JSON.stringify(o))})}processStreamResponse(t){return sr(this,arguments,function*(){var r;const o=(r=t==null?void 0:t.body)===null||r===void 0?void 0:r.getReader(),l=new TextDecoder("utf-8");if(!o)throw new Error("Response body is empty");try{let s="";const c="data:",d=[` `,"\r\r",`\r \r `];for(;;){const{done:f,value:h}=yield _e(o.read());if(f){if(s.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const v=l.decode(h,{stream:!0});try{const _=JSON.parse(v);if("error"in _){const T=JSON.parse(JSON.stringify(_.error)),A=T.status,w=T.code,R=`got status: ${A}. ${JSON.stringify(_)}`;if(w>=400&&w<600)throw new Cs({message:R,status:w})}}catch(_){if(_.name==="ApiError")throw _}s+=v;let y=-1,E=0;for(;;){y=-1,E=0;for(const A of d){const w=s.indexOf(A);w!==-1&&(y===-1||w{throw new Error(`exception ${r} sending request`)})}getDefaultHeaders(){const t={},n=DG+" "+this.clientOptions.userAgentExtra;return t[OG]=n,t[pg]=n,t[PG]="application/json",t}async getHeadersInternal(t,n){const r=new Headers;if(t&&t.headers){for(const[o,l]of Object.entries(t.headers))r.append(o,l);t.timeout&&t.timeout>0&&r.append(RG,String(Math.ceil(t.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(r,n),r}getFileName(t){var n;let r="";return typeof t=="string"&&(r=t.replace(/[/\\]+$/,""),r=(n=r.split(/[/\\]/).pop())!==null&&n!==void 0?n:""),r}async uploadFile(t,n){var r;const o={};n!=null&&(o.mimeType=n.mimeType,o.name=n.name,o.displayName=n.displayName),o.name&&!o.name.startsWith("files/")&&(o.name=`files/${o.name}`);const l=this.clientOptions.uploader,s=await l.stat(t);o.sizeBytes=String(s.size);const c=(r=n==null?void 0:n.mimeType)!==null&&r!==void 0?r:s.type;if(c===void 0||c==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");o.mimeType=c;const d={file:o},f=this.getFileName(t),h=ue("upload/v1beta/files",d._url),v=await this.fetchUploadUrl(h,o.sizeBytes,o.mimeType,f,d,n==null?void 0:n.httpOptions);return l.upload(t,v,this)}async uploadFileToFileSearchStore(t,n,r){var o;const l=this.clientOptions.uploader,s=await l.stat(n),c=String(s.size),d=(o=r==null?void 0:r.mimeType)!==null&&o!==void 0?o:s.type;if(d===void 0||d==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const f=`upload/v1beta/${t}:uploadToFileSearchStore`,h=this.getFileName(n),v={};r!=null&&fI(r,v);const y=await this.fetchUploadUrl(f,c,d,h,v,r==null?void 0:r.httpOptions);return l.uploadToFileSearchStore(n,y,this)}async downloadFile(t){await this.clientOptions.downloader.download(t,this)}async fetchUploadUrl(t,n,r,o,l,s){var c;let d={};s?d=s:d={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${n}`,"X-Goog-Upload-Header-Content-Type":`${r}`},o?{"X-Goog-Upload-File-Name":o}:{})};const f=await this.request({path:t,body:JSON.stringify(l),httpMethod:"POST",httpOptions:d});if(!f||!(f!=null&&f.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const h=(c=f==null?void 0:f.headers)===null||c===void 0?void 0:c["x-goog-upload-url"];if(h===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return h}}async function DA(e){var t;if(e===void 0)throw new Error("response is undefined");if(!e.ok){const n=e.status;let r;!((t=e.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?r=await e.json():r={error:{message:await e.text(),code:e.status,status:e.statusText}};const o=JSON.stringify(r);throw n>=400&&n<600?new Cs({message:o,status:n}):new Error(o)}}function zG(e,t){if(!t||Object.keys(t).length===0)return;if(e.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let n={};if(typeof e.body=="string"&&e.body.length>0)try{const l=JSON.parse(e.body);if(typeof l=="object"&&l!==null&&!Array.isArray(l))n=l;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 r(l,s){const c=Object.assign({},l);for(const d in s)if(Object.prototype.hasOwnProperty.call(s,d)){const f=s[d],h=c[d];f&&typeof f=="object"&&!Array.isArray(f)&&h&&typeof h=="object"&&!Array.isArray(h)?c[d]=r(h,f):(h&&f&&typeof h!=typeof f&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${d}". Original type: ${typeof h}, New type: ${typeof f}. Overwriting.`),c[d]=f)}return c}const o=r(n,t);e.body=JSON.stringify(o)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const BG="mcp_used/unknown";let qG=!1;function dI(e){for(const t of e)if(GG(t)||typeof t=="object"&&"inputSchema"in t)return!0;return qG}function pI(e){var t;const n=(t=e[pg])!==null&&t!==void 0?t:"";e[pg]=(n+` ${BG}`).trimStart()}function GG(e){return e!==null&&typeof e=="object"&&e instanceof My}function HG(e){return sr(this,arguments,function*(n,r=100){let o,l=0;for(;l0)return;const l={},s=[];for(const h of this.mcpClients)try{for(var c=!0,d=(n=void 0,ur(HG(h))),f;f=await d.next(),t=f.done,!t;c=!0){o=f.value,c=!1;const v=o;s.push(v);const y=v.name;if(l[y])throw new Error(`Duplicate function name ${y} found in MCP tools. Please ensure function names are unique.`);l[y]=h}}catch(v){n={error:v}}finally{try{!c&&!t&&(r=d.return)&&await r.call(d)}finally{if(n)throw n.error}}this.mcpTools=s,this.functionNameToMcpClient=l}async tool(){return await this.initialize(),SL(this.mcpTools,this.config)}async callTool(t){await this.initialize();const n=[];for(const r of t)if(r.name in this.functionNameToMcpClient){const o=this.functionNameToMcpClient[r.name];let l;this.config.timeout&&(l={timeout:this.config.timeout});const s=await o.callTool({name:r.name,arguments:r.args},void 0,l);n.push({functionResponse:{name:r.name,response:s.isError?{error:s}:s}})}return n}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */async function VG(e,t,n){const r=new fL;let o;n.data instanceof Blob?o=JSON.parse(await n.data.text()):o=JSON.parse(n.data),Object.assign(r,o),t(r)}class FG{constructor(t,n,r){this.apiClient=t,this.auth=n,this.webSocketFactory=r}async connect(t){var n,r;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const o=this.apiClient.getWebsocketBaseUrl(),l=this.apiClient.getApiVersion(),s=KG(this.apiClient.getDefaultHeaders()),c=this.apiClient.getApiKey(),d=`${o}/ws/google.ai.generativelanguage.${l}.GenerativeService.BidiGenerateMusic?key=${c}`;let f=()=>{};const h=new Promise(I=>{f=I}),v=t.callbacks,y=function(){f({})},E=this.apiClient,_={onopen:y,onmessage:I=>{VG(E,v.onmessage,I)},onerror:(n=v==null?void 0:v.onerror)!==null&&n!==void 0?n:function(I){},onclose:(r=v==null?void 0:v.onclose)!==null&&r!==void 0?r:function(I){}},T=this.webSocketFactory.create(d,YG(s),_);T.connect(),await h;const R={setup:{model:Be(this.apiClient,t.model)}};return T.send(JSON.stringify(R)),new $G(T,this.apiClient)}}class $G{constructor(t,n){this.conn=t,this.apiClient=n}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 n=vB(t);this.conn.send(JSON.stringify({clientContent:n}))}async setMusicGenerationConfig(t){t.musicGenerationConfig||(t.musicGenerationConfig={});const n=mB(t);this.conn.send(JSON.stringify(n))}sendPlaybackControl(t){const n={playbackControl:t};this.conn.send(JSON.stringify(n))}play(){this.sendPlaybackControl(za.PLAY)}pause(){this.sendPlaybackControl(za.PAUSE)}stop(){this.sendPlaybackControl(za.STOP)}resetContext(){this.sendPlaybackControl(za.RESET_CONTEXT)}close(){this.conn.close()}}function YG(e){const t={};return e.forEach((n,r)=>{t[r]=n}),t}function KG(e){const t=new Headers;for(const[n,r]of Object.entries(e))t.append(n,r);return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const JG="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function jG(e,t,n){const r=new cL;let o;n.data instanceof Blob?o=await n.data.text():n.data instanceof ArrayBuffer?o=new TextDecoder().decode(n.data):o=n.data;const l=JSON.parse(o);if(e.isVertexAI()){const s=SB(l);Object.assign(r,s)}else Object.assign(r,l);t(r)}class XG{constructor(t,n,r){this.apiClient=t,this.auth=n,this.webSocketFactory=r,this.music=new FG(this.apiClient,this.auth,this.webSocketFactory)}async connect(t){var n,r,o,l,s,c;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 d=this.apiClient.getWebsocketBaseUrl(),f=this.apiClient.getApiVersion();let h;const v=this.apiClient.getHeaders();t.config&&t.config.tools&&dI(t.config.tools)&&pI(v);const y=eH(v);if(this.apiClient.isVertexAI()){const B=this.apiClient.getProject(),Q=this.apiClient.getLocation(),te=this.apiClient.getApiKey(),$=!!B&&!!Q||!!te;this.apiClient.getCustomBaseUrl()&&!$?h=d:(h=`${d}/ws/google.cloud.aiplatform.${f}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(y,h))}else{const B=this.apiClient.getApiKey();let Q="BidiGenerateContent",te="key";B!=null&&B.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),f!=="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."),Q="BidiGenerateContentConstrained",te="access_token"),h=`${d}/ws/google.ai.generativelanguage.${f}.GenerativeService.${Q}?${te}=${B}`}let E=()=>{};const _=new Promise(B=>{E=B}),T=t.callbacks,A=function(){var B;(B=T==null?void 0:T.onopen)===null||B===void 0||B.call(T),E({})},w=this.apiClient,R={onopen:A,onmessage:B=>{jG(w,T.onmessage,B)},onerror:(n=T==null?void 0:T.onerror)!==null&&n!==void 0?n:function(B){},onclose:(r=T==null?void 0:T.onclose)!==null&&r!==void 0?r:function(B){}},I=this.webSocketFactory.create(h,QG(y),R);I.connect(),await _;let P=Be(this.apiClient,t.model);if(this.apiClient.isVertexAI()&&P.startsWith("publishers/")){const B=this.apiClient.getProject(),Q=this.apiClient.getLocation();B&&Q&&(P=`projects/${B}/locations/${Q}/`+P)}let N={};this.apiClient.isVertexAI()&&((o=t.config)===null||o===void 0?void 0:o.responseModalities)===void 0&&(t.config===void 0?t.config={responseModalities:[Qc.AUDIO]}:t.config.responseModalities=[Qc.AUDIO]),!((l=t.config)===null||l===void 0)&&l.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 O=(c=(s=t.config)===null||s===void 0?void 0:s.tools)!==null&&c!==void 0?c:[],D=[];for(const B of O)if(this.isCallableTool(B)){const Q=B;D.push(await Q.tool())}else D.push(B);D.length>0&&(t.config.tools=D);const G={model:P,config:t.config,callbacks:t.callbacks};return this.apiClient.isVertexAI()?N=hB(this.apiClient,G):N=pB(this.apiClient,G),delete N.config,I.send(JSON.stringify(N)),new ZG(I,this.apiClient)}isCallableTool(t){return"callTool"in t&&typeof t.callTool=="function"}}const WG={turnComplete:!0};class ZG{constructor(t,n){this.conn=t,this.apiClient=n}tLiveClientContent(t,n){if(n.turns!==null&&n.turns!==void 0){let r=[];try{r=jn(n.turns),t.isVertexAI()||(r=r.map(o=>nd(o)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof n.turns}'`)}return{clientContent:{turns:r,turnComplete:n.turnComplete}}}return{clientContent:{turnComplete:n.turnComplete}}}tLiveClienttToolResponse(t,n){let r=[];if(n.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(n.functionResponses)?r=n.functionResponses:r=[n.functionResponses],r.length===0)throw new Error("functionResponses is required.");for(const l of r){if(typeof l!="object"||l===null||!("name"in l)||!("response"in l))throw new Error(`Could not parse function response, type '${typeof l}'.`);if(!t.isVertexAI()&&!("id"in l))throw new Error(JG)}return{toolResponse:{functionResponses:r}}}sendClientContent(t){t=Object.assign(Object.assign({},WG),t);const n=this.tLiveClientContent(this.apiClient,t);this.conn.send(JSON.stringify(n))}sendRealtimeInput(t){let n={};this.apiClient.isVertexAI()?n={realtimeInput:yB(t)}:n={realtimeInput:gB(t)},this.conn.send(JSON.stringify(n))}sendToolResponse(t){if(t.functionResponses==null)throw new Error("Tool response parameters are required.");const n=this.tLiveClienttToolResponse(this.apiClient,t);this.conn.send(JSON.stringify(n))}close(){this.conn.close()}}function QG(e){const t={};return e.forEach((n,r)=>{t[r]=n}),t}function eH(e){const t=new Headers;for(const[n,r]of Object.entries(e))t.append(n,r);return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const kA=10;function UA(e){var t,n,r;if(!((t=e==null?void 0:e.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let o=!1;for(const s of(n=e==null?void 0:e.tools)!==null&&n!==void 0?n:[])if(Fa(s)){o=!0;break}if(!o)return!0;const l=(r=e==null?void 0:e.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls;return l&&(l<0||!Number.isInteger(l))||l==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:",l),!0):!1}function Fa(e){return"callTool"in e&&typeof e.callTool=="function"}function tH(e){var t,n,r;return(r=(n=(t=e.config)===null||t===void 0?void 0:t.tools)===null||n===void 0?void 0:n.some(o=>Fa(o)))!==null&&r!==void 0?r:!1}function LA(e){var t;const n=[];return!((t=e==null?void 0:e.config)===null||t===void 0)&&t.tools&&e.config.tools.forEach((r,o)=>{if(Fa(r))return;const l=r;l.functionDeclarations&&l.functionDeclarations.length>0&&n.push(o)}),n}function zA(e){var t;return!(!((t=e==null?void 0:e.automaticFunctionCalling)===null||t===void 0)&&t.ignoreCallHistory)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class nH extends di{constructor(t){super(),this.apiClient=t,this.generateContent=async n=>{var r,o,l,s,c;const d=await this.processParamsMaybeAddMcpUsage(n);if(this.maybeMoveToResponseJsonSchem(n),!tH(n)||UA(n.config))return await this.generateContentInternal(d);const f=LA(n);if(f.length>0){const T=f.map(A=>`tools[${A}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${T}.`)}let h,v;const y=jn(d.contents),E=(l=(o=(r=d.config)===null||r===void 0?void 0:r.automaticFunctionCalling)===null||o===void 0?void 0:o.maximumRemoteCalls)!==null&&l!==void 0?l:kA;let _=0;for(;_{var r,o,l,s,c;if(this.maybeMoveToResponseJsonSchem(n),UA(n.config)){const v=await this.processParamsMaybeAddMcpUsage(n);return await this.generateContentStreamInternal(v)}const d=LA(n);if(d.length>0){const v=d.map(y=>`tools[${y}]`).join(", ");throw new Error(`Incompatible tools found at ${v}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const f=(l=(o=(r=n==null?void 0:n.config)===null||r===void 0?void 0:r.toolConfig)===null||o===void 0?void 0:o.functionCallingConfig)===null||l===void 0?void 0:l.streamFunctionCallArguments,h=(c=(s=n==null?void 0:n.config)===null||s===void 0?void 0:s.automaticFunctionCalling)===null||c===void 0?void 0:c.disable;if(f&&!h)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(n)},this.generateImages=async n=>await this.generateImagesInternal(n).then(r=>{var o;let l;const s=[];if(r!=null&&r.generatedImages)for(const d of r.generatedImages)d&&(d!=null&&d.safetyAttributes)&&((o=d==null?void 0:d.safetyAttributes)===null||o===void 0?void 0:o.contentType)==="Positive Prompt"?l=d==null?void 0:d.safetyAttributes:s.push(d);let c;return l?c={generatedImages:s,positivePromptSafetyAttributes:l,sdkHttpResponse:r.sdkHttpResponse}:c={generatedImages:s,sdkHttpResponse:r.sdkHttpResponse},c}),this.list=async n=>{var r;const s={config:Object.assign(Object.assign({},{queryBase:!0}),n==null?void 0:n.config)};if(this.apiClient.isVertexAI()&&!s.config.queryBase){if(!((r=s.config)===null||r===void 0)&&r.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");s.config.filter="labels.tune-type:*"}return new Vo(ii.PAGED_ITEM_MODELS,c=>this.listInternal(c),await this.listInternal(s),s)},this.editImage=async n=>{const r={model:n.model,prompt:n.prompt,referenceImages:[],config:n.config};return n.referenceImages&&n.referenceImages&&(r.referenceImages=n.referenceImages.map(o=>o.toReferenceImageAPI())),await this.editImageInternal(r)},this.upscaleImage=async n=>{let r={numberOfImages:1,mode:"upscale"};n.config&&(r=Object.assign(Object.assign({},r),n.config));const o={model:n.model,image:n.image,upscaleFactor:n.upscaleFactor,config:r};return await this.upscaleImageInternal(o)},this.generateVideos=async n=>{var r,o,l,s,c,d;if((n.prompt||n.image||n.video)&&n.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((r=n.video)===null||r===void 0)&&r.uri&&(!((o=n.video)===null||o===void 0)&&o.videoBytes)?n.video={uri:n.video.uri,mimeType:n.video.mimeType}:!((s=(l=n.source)===null||l===void 0?void 0:l.video)===null||s===void 0)&&s.uri&&(!((d=(c=n.source)===null||c===void 0?void 0:c.video)===null||d===void 0)&&d.videoBytes)&&(n.source.video={uri:n.source.video.uri,mimeType:n.source.video.mimeType})),await this.generateVideosInternal(n)}}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 n,r,o;const l=(n=t.config)===null||n===void 0?void 0:n.tools;if(!l)return t;const s=await Promise.all(l.map(async d=>Fa(d)?await d.tool():d)),c={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:s})};if(c.config.tools=s,t.config&&t.config.tools&&dI(t.config.tools)){const d=(o=(r=t.config.httpOptions)===null||r===void 0?void 0:r.headers)!==null&&o!==void 0?o:{};let f=Object.assign({},d);Object.keys(f).length===0&&(f=this.apiClient.getDefaultHeaders()),pI(f),c.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:f})}return c}async initAfcToolsMap(t){var n,r,o;const l=new Map;for(const s of(r=(n=t.config)===null||n===void 0?void 0:n.tools)!==null&&r!==void 0?r:[])if(Fa(s)){const c=s,d=await c.tool();for(const f of(o=d.functionDeclarations)!==null&&o!==void 0?o:[]){if(!f.name)throw new Error("Function declaration name is required.");if(l.has(f.name))throw new Error(`Duplicate tool declaration name: ${f.name}`);l.set(f.name,c)}}return l}async processAfcStream(t){var n,r,o;const l=(o=(r=(n=t.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls)!==null&&o!==void 0?o:kA;let s=!1,c=0;const d=await this.initAfcToolsMap(t);return(function(f,h,v){return sr(this,arguments,function*(){for(var y,E,_,T,A,w;c0){s=!0;const B=new ss;B.candidates=[{content:{role:"user",parts:D}}],yield yield _e(B);const Q=[];Q.push(...G),Q.push({role:"user",parts:D});const te=jn(v.contents).concat(Q);v.contents=te}else break}})})(this,d,t)}async generateContentInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=RA(this.apiClient,t);return c=ue("{model}:generateContent",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=NA(h),y=new ss;return Object.assign(y,v),y})}else{const f=PA(this.apiClient,t);return c=ue("{model}:generateContent",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=OA(h),y=new ss;return Object.assign(y,v),y})}}async generateContentStreamInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=RA(this.apiClient,t);return c=ue("{model}:streamGenerateContent?alt=sse",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.requestStream({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}),s.then(function(v){return sr(this,arguments,function*(){var y,E,_,T;try{for(var A=!0,w=ur(v),R;R=yield _e(w.next()),y=R.done,!y;A=!0){T=R.value,A=!1;const I=T,P=NA(yield _e(I.json()));P.sdkHttpResponse={headers:I.headers};const N=new ss;Object.assign(N,P),yield yield _e(N)}}catch(I){E={error:I}}finally{try{!A&&!y&&(_=w.return)&&(yield _e(_.call(w)))}finally{if(E)throw E.error}}})})}else{const f=PA(this.apiClient,t);return c=ue("{model}:streamGenerateContent?alt=sse",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.requestStream({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}),s.then(function(v){return sr(this,arguments,function*(){var y,E,_,T;try{for(var A=!0,w=ur(v),R;R=yield _e(w.next()),y=R.done,!y;A=!0){T=R.value,A=!1;const I=T,P=OA(yield _e(I.json()));P.sdkHttpResponse={headers:I.headers};const N=new ss;Object.assign(N,P),yield yield _e(N)}}catch(I){E={error:I}}finally{try{!A&&!y&&(_=w.return)&&(yield _e(_.call(w)))}finally{if(E)throw E.error}}})})}}async embedContent(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=XB(this.apiClient,t);return c=ue("{model}:predict",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=ZB(h),y=new pA;return Object.assign(y,v),y})}else{const f=jB(this.apiClient,t);return c=ue("{model}:batchEmbedContents",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=WB(h),y=new pA;return Object.assign(y,v),y})}}async generateImagesInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=uq(this.apiClient,t);return c=ue("{model}:predict",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=fq(h),y=new hA;return Object.assign(y,v),y})}else{const f=sq(this.apiClient,t);return c=ue("{model}:predict",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=cq(h),y=new hA;return Object.assign(y,v),y})}}async editImageInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=$B(this.apiClient,t);return l=ue("{model}:predict",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>{const f=YB(d),h=new QU;return Object.assign(h,f),h})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=uG(this.apiClient,t);return l=ue("{model}:predict",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>{const f=cG(d),h=new eL;return Object.assign(h,f),h})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=Fq(this.apiClient,t);return l=ue("{model}:predict",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=$q(d),h=new tL;return Object.assign(h,f),h})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=Wq(this.apiClient,t);return l=ue("{model}:predict",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=Zq(d),h=new nL;return Object.assign(h,f),h})}else throw new Error("This method is only supported by the Vertex AI.")}async get(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=Mq(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>dg(h))}else{const f=wq(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>fg(h))}}async listInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=Lq(this.apiClient,t);return c=ue("{models_url}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=Bq(h),y=new mA;return Object.assign(y,v),y})}else{const f=Uq(this.apiClient,t);return c=ue("{models_url}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=zq(h),y=new mA;return Object.assign(y,v),y})}}async update(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=lG(this.apiClient,t);return c=ue("{model}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"PATCH",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>dg(h))}else{const f=aG(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>fg(h))}}async delete(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=GB(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=VB(h),y=new vA;return Object.assign(y,v),y})}else{const f=qB(this.apiClient,t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=HB(h),y=new vA;return Object.assign(y,v),y})}}async countTokens(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=LB(this.apiClient,t);return c=ue("{model}:countTokens",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=BB(h),y=new gA;return Object.assign(y,v),y})}else{const f=UB(this.apiClient,t);return c=ue("{model}:countTokens",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=zB(h),y=new gA;return Object.assign(y,v),y})}}async computeTokens(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=IB(this.apiClient,t);return l=ue("{model}:computeTokens",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>{const f=PB(d),h=new rL;return Object.assign(h,f),h})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=gq(this.apiClient,t);return c=ue("{model}:predictLongRunning",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s.then(h=>{const v=mq(h),y=new ef;return Object.assign(y,v),y})}else{const f=vq(this.apiClient,t);return c=ue("{model}:predictLongRunning",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s.then(h=>{const v=hq(h),y=new ef;return Object.assign(y,v),y})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class rH extends di{constructor(t){super(),this.apiClient=t}async getVideosOperation(t){const n=t.operation,r=t.config;if(n.name===void 0||n.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const o=n.name.split("/operations/")[0];let l;r&&"httpOptions"in r&&(l=r.httpOptions);const s=await this.fetchPredictVideosOperationInternal({operationName:n.name,resourceName:o,config:{httpOptions:l}});return n._fromAPIResponse({apiResponse:s,_isVertexAI:!0})}else{const o=await this.getVideosOperationInternal({operationName:n.name,config:r});return n._fromAPIResponse({apiResponse:o,_isVertexAI:!1})}}async get(t){const n=t.operation,r=t.config;if(n.name===void 0||n.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const o=n.name.split("/operations/")[0];let l;r&&"httpOptions"in r&&(l=r.httpOptions);const s=await this.fetchPredictVideosOperationInternal({operationName:n.name,resourceName:o,config:{httpOptions:l}});return n._fromAPIResponse({apiResponse:s,_isVertexAI:!0})}else{const o=await this.getVideosOperationInternal({operationName:n.name,config:r});return n._fromAPIResponse({apiResponse:o,_isVertexAI:!1})}}async getVideosOperationInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=KU(t);return c=ue("{operationName}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json()),s}else{const f=YU(t);return c=ue("{operationName}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json()),s}}async fetchPredictVideosOperationInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=BU(t);return l=ue("{resourceName}:fetchPredictOperation",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o}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 iH(e){const t={},n=m(e,["data"]);if(n!=null&&g(t,["data"],n),m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function oH(e){const t={},n=m(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(l=>hH(l))),g(t,["parts"],o)}const r=m(e,["role"]);return r!=null&&g(t,["role"],r),t}function aH(e,t,n){const r={},o=m(t,["expireTime"]);n!==void 0&&o!=null&&g(n,["expireTime"],o);const l=m(t,["newSessionExpireTime"]);n!==void 0&&l!=null&&g(n,["newSessionExpireTime"],l);const s=m(t,["uses"]);n!==void 0&&s!=null&&g(n,["uses"],s);const c=m(t,["liveConnectConstraints"]);n!==void 0&&c!=null&&g(n,["bidiGenerateContentSetup"],pH(e,c));const d=m(t,["lockAdditionalFields"]);return n!==void 0&&d!=null&&g(n,["fieldMask"],d),r}function lH(e,t){const n={},r=m(t,["config"]);return r!=null&&g(n,["config"],aH(e,r,n)),n}function sH(e){const t={};if(m(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=m(e,["fileUri"]);n!=null&&g(t,["fileUri"],n);const r=m(e,["mimeType"]);return r!=null&&g(t,["mimeType"],r),t}function uH(e){const t={},n=m(e,["id"]);n!=null&&g(t,["id"],n);const r=m(e,["args"]);r!=null&&g(t,["args"],r);const o=m(e,["name"]);if(o!=null&&g(t,["name"],o),m(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(m(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function cH(e){const t={};if(m(e,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=m(e,["enableWidget"]);return n!=null&&g(t,["enableWidget"],n),t}function fH(e){const t={};if(m(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(m(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=m(e,["timeRangeFilter"]);return n!=null&&g(t,["timeRangeFilter"],n),t}function dH(e,t){const n={},r=m(e,["generationConfig"]);t!==void 0&&r!=null&&g(t,["setup","generationConfig"],r);const o=m(e,["responseModalities"]);t!==void 0&&o!=null&&g(t,["setup","generationConfig","responseModalities"],o);const l=m(e,["temperature"]);t!==void 0&&l!=null&&g(t,["setup","generationConfig","temperature"],l);const s=m(e,["topP"]);t!==void 0&&s!=null&&g(t,["setup","generationConfig","topP"],s);const c=m(e,["topK"]);t!==void 0&&c!=null&&g(t,["setup","generationConfig","topK"],c);const d=m(e,["maxOutputTokens"]);t!==void 0&&d!=null&&g(t,["setup","generationConfig","maxOutputTokens"],d);const f=m(e,["mediaResolution"]);t!==void 0&&f!=null&&g(t,["setup","generationConfig","mediaResolution"],f);const h=m(e,["seed"]);t!==void 0&&h!=null&&g(t,["setup","generationConfig","seed"],h);const v=m(e,["speechConfig"]);t!==void 0&&v!=null&&g(t,["setup","generationConfig","speechConfig"],wy(v));const y=m(e,["thinkingConfig"]);t!==void 0&&y!=null&&g(t,["setup","generationConfig","thinkingConfig"],y);const E=m(e,["enableAffectiveDialog"]);t!==void 0&&E!=null&&g(t,["setup","generationConfig","enableAffectiveDialog"],E);const _=m(e,["systemInstruction"]);t!==void 0&&_!=null&&g(t,["setup","systemInstruction"],oH(Wt(_)));const T=m(e,["tools"]);if(t!==void 0&&T!=null){let O=nl(T);Array.isArray(O)&&(O=O.map(D=>vH(tl(D)))),g(t,["setup","tools"],O)}const A=m(e,["sessionResumption"]);t!==void 0&&A!=null&&g(t,["setup","sessionResumption"],mH(A));const w=m(e,["inputAudioTranscription"]);t!==void 0&&w!=null&&g(t,["setup","inputAudioTranscription"],w);const R=m(e,["outputAudioTranscription"]);t!==void 0&&R!=null&&g(t,["setup","outputAudioTranscription"],R);const I=m(e,["realtimeInputConfig"]);t!==void 0&&I!=null&&g(t,["setup","realtimeInputConfig"],I);const P=m(e,["contextWindowCompression"]);t!==void 0&&P!=null&&g(t,["setup","contextWindowCompression"],P);const N=m(e,["proactivity"]);if(t!==void 0&&N!=null&&g(t,["setup","proactivity"],N),m(e,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return n}function pH(e,t){const n={},r=m(t,["model"]);r!=null&&g(n,["setup","model"],Be(e,r));const o=m(t,["config"]);return o!=null&&g(n,["config"],dH(o,n)),n}function hH(e){const t={},n=m(e,["mediaResolution"]);n!=null&&g(t,["mediaResolution"],n);const r=m(e,["codeExecutionResult"]);r!=null&&g(t,["codeExecutionResult"],r);const o=m(e,["executableCode"]);o!=null&&g(t,["executableCode"],o);const l=m(e,["fileData"]);l!=null&&g(t,["fileData"],sH(l));const s=m(e,["functionCall"]);s!=null&&g(t,["functionCall"],uH(s));const c=m(e,["functionResponse"]);c!=null&&g(t,["functionResponse"],c);const d=m(e,["inlineData"]);d!=null&&g(t,["inlineData"],iH(d));const f=m(e,["text"]);f!=null&&g(t,["text"],f);const h=m(e,["thought"]);h!=null&&g(t,["thought"],h);const v=m(e,["thoughtSignature"]);v!=null&&g(t,["thoughtSignature"],v);const y=m(e,["videoMetadata"]);return y!=null&&g(t,["videoMetadata"],y),t}function mH(e){const t={},n=m(e,["handle"]);if(n!=null&&g(t,["handle"],n),m(e,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function vH(e){const t={};if(m(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=m(e,["computerUse"]);n!=null&&g(t,["computerUse"],n);const r=m(e,["fileSearch"]);r!=null&&g(t,["fileSearch"],r);const o=m(e,["codeExecution"]);if(o!=null&&g(t,["codeExecution"],o),m(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=m(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(v=>v)),g(t,["functionDeclarations"],h)}const s=m(e,["googleMaps"]);s!=null&&g(t,["googleMaps"],cH(s));const c=m(e,["googleSearch"]);c!=null&&g(t,["googleSearch"],fH(c));const d=m(e,["googleSearchRetrieval"]);d!=null&&g(t,["googleSearchRetrieval"],d);const f=m(e,["urlContext"]);return f!=null&&g(t,["urlContext"],f),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function gH(e){const t=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n];if(typeof r=="object"&&r!=null&&Object.keys(r).length>0){const o=Object.keys(r).map(l=>`${n}.${l}`);t.push(...o)}else t.push(n)}return t.join(",")}function yH(e,t){let n=null;const r=e.bidiGenerateContentSetup;if(typeof r=="object"&&r!==null&&"setup"in r){const l=r.setup;typeof l=="object"&&l!==null?(e.bidiGenerateContentSetup=l,n=l):delete e.bidiGenerateContentSetup}else r!==void 0&&delete e.bidiGenerateContentSetup;const o=e.fieldMask;if(n){const l=gH(n);if(Array.isArray(t==null?void 0:t.lockAdditionalFields)&&(t==null?void 0:t.lockAdditionalFields.length)===0)l?e.fieldMask=l:delete e.fieldMask;else if(t!=null&&t.lockAdditionalFields&&t.lockAdditionalFields.length>0&&o!==null&&Array.isArray(o)&&o.length>0){const s=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let c=[];o.length>0&&(c=o.map(f=>s.includes(f)?`generationConfig.${f}`:f));const d=[];l&&d.push(l),c.length>0&&d.push(...c),d.length>0?e.fieldMask=d.join(","):delete e.fieldMask}else delete e.fieldMask}else o!==null&&Array.isArray(o)&&o.length>0?e.fieldMask=o.join(","):delete e.fieldMask;return e}class SH extends di{constructor(t){super(),this.apiClient=t}async create(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const c=lH(this.apiClient,t);l=ue("auth_tokens",c._url),s=c._query,delete c.config,delete c._url,delete c._query;const d=yH(c,t.config);return o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(f=>f.json()),o.then(f=>f)}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function bH(e,t){const n={},r=m(e,["force"]);return t!==void 0&&r!=null&&g(t,["_query","force"],r),n}function EH(e){const t={},n=m(e,["name"]);n!=null&&g(t,["_url","name"],n);const r=m(e,["config"]);return r!=null&&bH(r,t),t}function _H(e){const t={},n=m(e,["name"]);return n!=null&&g(t,["_url","name"],n),t}function TH(e,t){const n={},r=m(e,["pageSize"]);t!==void 0&&r!=null&&g(t,["_query","pageSize"],r);const o=m(e,["pageToken"]);return t!==void 0&&o!=null&&g(t,["_query","pageToken"],o),n}function AH(e){const t={},n=m(e,["parent"]);n!=null&&g(t,["_url","parent"],n);const r=m(e,["config"]);return r!=null&&TH(r,t),t}function CH(e){const t={},n=m(e,["sdkHttpResponse"]);n!=null&&g(t,["sdkHttpResponse"],n);const r=m(e,["nextPageToken"]);r!=null&&g(t,["nextPageToken"],r);const o=m(e,["documents"]);if(o!=null){let l=o;Array.isArray(l)&&(l=l.map(s=>s)),g(t,["documents"],l)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class xH extends di{constructor(t){super(),this.apiClient=t,this.list=async n=>new Vo(ii.PAGED_ITEM_DOCUMENTS,r=>this.listInternal({parent:n.parent,config:r.config}),await this.listInternal(n),n)}async get(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=_H(t);return l=ue("{name}",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async delete(t){var n,r;let o="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const s=EH(t);o=ue("{name}",s._url),l=s._query,delete s._url,delete s._query,await this.apiClient.request({path:o,queryParams:l,body:JSON.stringify(s),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal})}}async listInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=AH(t);return l=ue("{parent}/documents",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=CH(d),h=new iL;return Object.assign(h,f),h})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class wH extends di{constructor(t,n=new xH(t)){super(),this.apiClient=t,this.documents=n,this.list=async(r={})=>new Vo(ii.PAGED_ITEM_FILE_SEARCH_STORES,o=>this.listInternal(o),await this.listInternal(r),r)}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 n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=gG(t);return l=ue("fileSearchStores",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async get(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=bG(t);return l=ue("{name}",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>d)}}async delete(t){var n,r;let o="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const s=SG(t);o=ue("{name}",s._url),l=s._query,delete s._url,delete s._query,await this.apiClient.request({path:o,queryParams:l,body:JSON.stringify(s),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal})}}async listInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=xG(t);return l=ue("fileSearchStores",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=wG(d),h=new oL;return Object.assign(h,f),h})}}async uploadToFileSearchStoreInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=MG(t);return l=ue("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=IG(d),h=new aL;return Object.assign(h,f),h})}}async importFile(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=TG(t);return l=ue("{file_search_store_name}:importFile",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const f=_G(d),h=new _y;return Object.assign(h,f),h})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let hI=function(){const{crypto:e}=globalThis;if(e!=null&&e.randomUUID)return hI=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^n()&15>>+r/4).toString(16))};const MH=()=>hI();/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function hg(e){return typeof e=="object"&&e!==null&&("name"in e&&e.name==="AbortError"||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}const mg=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Xn extends Error{}class rn extends Xn{constructor(t,n,r,o){super(`${rn.makeMessage(t,n,r)}`),this.status=t,this.headers=o,this.error=n}static makeMessage(t,n,r){const o=n!=null&&n.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):r;return t&&o?`${t} ${o}`:t?`${t} status code (no body)`:o||"(no status code or body)"}static generate(t,n,r,o){if(!t||!o)return new od({message:r,cause:mg(n)});const l=n;return t===400?new vI(t,l,r,o):t===401?new gI(t,l,r,o):t===403?new yI(t,l,r,o):t===404?new SI(t,l,r,o):t===409?new bI(t,l,r,o):t===422?new EI(t,l,r,o):t===429?new _I(t,l,r,o):t>=500?new TI(t,l,r,o):new rn(t,l,r,o)}}class vg extends rn{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class od extends rn{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}}class mI extends od{constructor({message:t}={}){super({message:t??"Request timed out."})}}class vI extends rn{}class gI extends rn{}class yI extends rn{}class SI extends rn{}class bI extends rn{}class EI extends rn{}class _I extends rn{}class TI extends rn{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const IH=/^[a-z][a-z0-9+.-]*:/i,PH=e=>IH.test(e);let gg=e=>(gg=Array.isArray,gg(e));const RH=gg;let OH=RH;const BA=OH;function NH(e){if(!e)return!0;for(const t in e)return!1;return!0}function DH(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const kH=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new Xn(`${e} must be an integer`);if(t<0)throw new Xn(`${e} must be a positive integer`);return t},UH=e=>{try{return JSON.parse(e)}catch{return}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const LH=e=>new Promise(t=>setTimeout(t,e));/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Ua="0.0.1";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function zH(){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 BH=()=>{var e,t,n,r,o;const l=zH();if(l==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ua,"X-Stainless-OS":GA(Deno.build.os),"X-Stainless-Arch":qA(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(t=(e=Deno.version)===null||e===void 0?void 0:e.deno)!==null&&t!==void 0?t:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(l==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ua,"X-Stainless-OS":GA((n=globalThis.process.platform)!==null&&n!==void 0?n:"unknown"),"X-Stainless-Arch":qA((r=globalThis.process.arch)!==null&&r!==void 0?r:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(o=globalThis.process.version)!==null&&o!==void 0?o:"unknown"};const s=qH();return s?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${s.browser}`,"X-Stainless-Runtime-Version":s.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function qH(){if(typeof navigator>"u"||!navigator)return null;const e=[{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:n}of e){const r=n.exec(navigator.userAgent);if(r){const o=r[1]||0,l=r[2]||0,s=r[3]||0;return{browser:t,version:`${o}.${l}.${s}`}}}return null}const qA=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",GA=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown");let Tc;const GH=()=>Tc??(Tc=BH());/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function HH(){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 AI(...e){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(...e)}function VH(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return AI({start(){},async pull(n){const{done:r,value:o}=await t.next();r?n.close():n.enqueue(o)},async cancel(){var n;await((n=t.return)===null||n===void 0?void 0:n.call(t))}})}function CI(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const n=await t.read();return n!=null&&n.done&&t.releaseLock(),n}catch(n){throw t.releaseLock(),n}},async return(){const n=t.cancel();return t.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function FH(e){var t,n;if(e===null||typeof e!="object")return;if(e[Symbol.asyncIterator]){await((n=(t=e[Symbol.asyncIterator]()).return)===null||n===void 0?void 0:n.call(t));return}const r=e.getReader(),o=r.cancel();r.releaseLock(),await o}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const $H=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const xI=()=>{var e;if(typeof File>"u"){const{process:t}=globalThis,n=typeof((e=t==null?void 0:t.versions)===null||e===void 0?void 0:e.node)=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(n?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Em(e,t,n){return xI(),new File(e,t??"unknown_file",n)}function YH(e){return(typeof e=="object"&&e!==null&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}const KH=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const wI=e=>e!=null&&typeof e=="object"&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.text=="function"&&typeof e.slice=="function"&&typeof e.arrayBuffer=="function",JH=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&wI(e),jH=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function";async function XH(e,t,n){if(xI(),e=await e,JH(e))return e instanceof File?e:Em([await e.arrayBuffer()],e.name);if(jH(e)){const o=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),Em(await yg(o),t,n)}const r=await yg(e);if(t||(t=YH(e)),!(n!=null&&n.type)){const o=r.find(l=>typeof l=="object"&&"type"in l&&l.type);typeof o=="string"&&(n=Object.assign(Object.assign({},n),{type:o}))}return Em(r,t,n)}async function yg(e){var t,n,r,o,l;let s=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s.push(e);else if(wI(e))s.push(e instanceof Blob?e:await e.arrayBuffer());else if(KH(e))try{for(var c=!0,d=ur(e),f;f=await d.next(),t=f.done,!t;c=!0){o=f.value,c=!1;const h=o;s.push(...await yg(h))}}catch(h){n={error:h}}finally{try{!c&&!t&&(r=d.return)&&await r.call(d)}finally{if(n)throw n.error}}else{const h=(l=e==null?void 0:e.constructor)===null||l===void 0?void 0:l.name;throw new Error(`Unexpected data type: ${typeof e}${h?`; constructor: ${h}`:""}${WH(e)}`)}return s}function WH(e){return typeof e!="object"||e===null?"":`; props: [${Object.getOwnPropertyNames(e).map(n=>`"${n}"`).join(", ")}]`}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class MI{constructor(t){this._client=t}}MI._key=[];/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function II(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const HA=Object.freeze(Object.create(null)),ZH=(e=II)=>(function(n,...r){if(n.length===1)return n[0];let o=!1;const l=[],s=n.reduce((h,v,y)=>{var E,_,T;/[?#]/.test(v)&&(o=!0);const A=r[y];let w=(o?encodeURIComponent:e)(""+A);return y!==r.length&&(A==null||typeof A=="object"&&A.toString===((T=Object.getPrototypeOf((_=Object.getPrototypeOf((E=A.hasOwnProperty)!==null&&E!==void 0?E:HA))!==null&&_!==void 0?_:HA))===null||T===void 0?void 0:T.toString))&&(w=A+"",l.push({start:h.length+v.length,length:w.length,error:`Value of type ${Object.prototype.toString.call(A).slice(8,-1)} is not a valid path parameter`})),h+v+(y===r.length?"":w)},""),c=s.split(/[?#]/,1)[0],d=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let f;for(;(f=d.exec(c))!==null;)l.push({start:f.index,length:f[0].length,error:`Value "${f[0]}" can't be safely passed as a path parameter`});if(l.sort((h,v)=>h.start-v.start),l.length>0){let h=0;const v=l.reduce((y,E)=>{const _=" ".repeat(E.start-h),T="^".repeat(E.length);return h=E.start+E.length,y+_+T},"");throw new Xn(`Path parameters result in path with invalid segments: ${l.map(y=>y.error).join(` `)} ${s} ${v}`)}return s}),Ac=ZH(II);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class PI extends MI{create(t,n){var r;const{api_version:o=this._client.apiVersion}=t,l=nf(t,["api_version"]);if("model"in l&&"agent_config"in l)throw new Xn("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in l&&"generation_config"in l)throw new Xn("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(Ac`/${o}/interactions`,Object.assign(Object.assign({body:l},n),{stream:(r=t.stream)!==null&&r!==void 0?r:!1}))}delete(t,n={},r){const{api_version:o=this._client.apiVersion}=n??{};return this._client.delete(Ac`/${o}/interactions/${t}`,r)}cancel(t,n={},r){const{api_version:o=this._client.apiVersion}=n??{};return this._client.post(Ac`/${o}/interactions/${t}/cancel`,r)}get(t,n={},r){var o;const l=n??{},{api_version:s=this._client.apiVersion}=l,c=nf(l,["api_version"]);return this._client.get(Ac`/${s}/interactions/${t}`,Object.assign(Object.assign({query:c},r),{stream:(o=n==null?void 0:n.stream)!==null&&o!==void 0?o:!1}))}}PI._key=Object.freeze(["interactions"]);class RI extends PI{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function QH(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}let Cc;function Iy(e){let t;return(Cc??(t=new globalThis.TextEncoder,Cc=t.encode.bind(t)))(e)}let xc;function VA(e){let t;return(xc??(t=new globalThis.TextDecoder,xc=t.decode.bind(t)))(e)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class ad{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(t){if(t==null)return[];const n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?Iy(t):t;this.buffer=QH([this.buffer,n]);const r=[];let o;for(;(o=e3(this.buffer,this.carriageReturnIndex))!=null;){if(o.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=o.index;continue}if(this.carriageReturnIndex!=null&&(o.index!==this.carriageReturnIndex+1||o.carriage)){r.push(VA(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}const l=this.carriageReturnIndex!==null?o.preceding-1:o.preceding,s=VA(this.buffer.subarray(0,l));r.push(s),this.buffer=this.buffer.subarray(o.index),this.carriageReturnIndex=null}return r}flush(){return this.buffer.length?this.decode(` `):[]}}ad.NEWLINE_CHARS=new Set([` `,"\r"]);ad.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function e3(e,t){for(let o=t??0;o{if(e){if(DH(rf,e))return e;en(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(rf))}`)}};function Ss(){}function wc(e,t,n){return!t||rf[e]>rf[n]?Ss:t[e].bind(t)}const n3={error:Ss,warn:Ss,info:Ss,debug:Ss};let $A=new WeakMap;function en(e){var t;const n=e.logger,r=(t=e.logLevel)!==null&&t!==void 0?t:"off";if(!n)return n3;const o=$A.get(n);if(o&&o[0]===r)return o[1];const l={error:wc("error",n,r),warn:wc("warn",n,r),info:wc("info",n,r),debug:wc("debug",n,r)};return $A.set(n,[r,l]),l}const To=e=>(e.options&&(e.options=Object.assign({},e.options),delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Ba{constructor(t,n,r){this.iterator=t,this.controller=n,this.client=r}static fromSSEResponse(t,n,r){let o=!1;const l=r?en(r):console;function s(){return sr(this,arguments,function*(){var d,f,h,v;if(o)throw new Xn("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let y=!1;try{try{for(var E=!0,_=ur(r3(t,n)),T;T=yield _e(_.next()),d=T.done,!d;E=!0){v=T.value,E=!1;const A=v;if(!y)if(A.data.startsWith("[DONE]")){y=!0;continue}else try{yield yield _e(JSON.parse(A.data))}catch(w){throw l.error("Could not parse message into JSON:",A.data),l.error("From chunk:",A.raw),w}}}catch(A){f={error:A}}finally{try{!E&&!d&&(h=_.return)&&(yield _e(h.call(_)))}finally{if(f)throw f.error}}y=!0}catch(A){if(hg(A))return yield _e(void 0);throw A}finally{y||n.abort()}})}return new Ba(s,n,r)}static fromReadableStream(t,n,r){let o=!1;function l(){return sr(this,arguments,function*(){var d,f,h,v;const y=new ad,E=CI(t);try{for(var _=!0,T=ur(E),A;A=yield _e(T.next()),d=A.done,!d;_=!0){v=A.value,_=!1;const w=v;for(const R of y.decode(w))yield yield _e(R)}}catch(w){f={error:w}}finally{try{!_&&!d&&(h=T.return)&&(yield _e(h.call(T)))}finally{if(f)throw f.error}}for(const w of y.flush())yield yield _e(w)})}function s(){return sr(this,arguments,function*(){var d,f,h,v;if(o)throw new Xn("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let y=!1;try{try{for(var E=!0,_=ur(l()),T;T=yield _e(_.next()),d=T.done,!d;E=!0){v=T.value,E=!1;const A=v;y||A&&(yield yield _e(JSON.parse(A)))}}catch(A){f={error:A}}finally{try{!E&&!d&&(h=_.return)&&(yield _e(h.call(_)))}finally{if(f)throw f.error}}y=!0}catch(A){if(hg(A))return yield _e(void 0);throw A}finally{y||n.abort()}})}return new Ba(s,n,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],n=[],r=this.iterator(),o=l=>({next:()=>{if(l.length===0){const s=r.next();t.push(s),n.push(s)}return l.shift()}});return[new Ba(()=>o(t),this.controller,this.client),new Ba(()=>o(n),this.controller,this.client)]}toReadableStream(){const t=this;let n;return AI({async start(){n=t[Symbol.asyncIterator]()},async pull(r){try{const{value:o,done:l}=await n.next();if(l)return r.close();const s=Iy(JSON.stringify(o)+` `);r.enqueue(s)}catch(o){r.error(o)}},async cancel(){var r;await((r=n.return)===null||r===void 0?void 0:r.call(n))}})}}function r3(e,t){return sr(this,arguments,function*(){var r,o,l,s;if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Xn("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 Xn("Attempted to iterate over a response with no body");const c=new o3,d=new ad,f=CI(e.body);try{for(var h=!0,v=ur(i3(f)),y;y=yield _e(v.next()),r=y.done,!r;h=!0){s=y.value,h=!1;const E=s;for(const _ of d.decode(E)){const T=c.decode(_);T&&(yield yield _e(T))}}}catch(E){o={error:E}}finally{try{!h&&!r&&(l=v.return)&&(yield _e(l.call(v)))}finally{if(o)throw o.error}}for(const E of d.flush()){const _=c.decode(E);_&&(yield yield _e(_))}})}function i3(e){return sr(this,arguments,function*(){var n,r,o,l;let s=new Uint8Array;try{for(var c=!0,d=ur(e),f;f=yield _e(d.next()),n=f.done,!n;c=!0){l=f.value,c=!1;const h=l;if(h==null)continue;const v=h instanceof ArrayBuffer?new Uint8Array(h):typeof h=="string"?Iy(h):h;let y=new Uint8Array(s.length+v.length);y.set(s),y.set(v,s.length),s=y;let E;for(;(E=t3(s))!==-1;)yield yield _e(s.slice(0,E)),s=s.slice(E)}}catch(h){r={error:h}}finally{try{!c&&!n&&(o=d.return)&&(yield _e(o.call(d)))}finally{if(r)throw r.error}}s.length>0&&(yield yield _e(s))})}class o3{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 l={event:this.event,data:this.data.join(` `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],l}if(this.chunks.push(t),t.startsWith(":"))return null;let[n,r,o]=a3(t,":");return o.startsWith(" ")&&(o=o.substring(1)),n==="event"?this.event=o:n==="data"&&this.data.push(o),null}}function a3(e,t){const n=e.indexOf(t);return n!==-1?[e.substring(0,n),t,e.substring(n+t.length)]:[e,"",""]}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */async function l3(e,t){const{response:n,requestLogID:r,retryOfRequestLogID:o,startTime:l}=t,s=await(async()=>{var c;if(t.options.stream)return en(e).debug("response",n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller,e):Ba.fromSSEResponse(n,t.controller,e);if(n.status===204)return null;if(t.options.__binaryResponse)return n;const d=n.headers.get("content-type"),f=(c=d==null?void 0:d.split(";")[0])===null||c===void 0?void 0:c.trim();return(f==null?void 0:f.includes("application/json"))||(f==null?void 0:f.endsWith("+json"))?await n.json():await n.text()})();return en(e).debug(`[${r}] response parsed`,To({retryOfRequestLogID:o,url:n.url,status:n.status,body:s,durationMs:Date.now()-l})),s}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Py extends Promise{constructor(t,n,r=l3){super(o=>{o(null)}),this.responsePromise=n,this.parseResponse=r,this.client=t}_thenUnwrap(t){return new Py(this.client,this.responsePromise,async(n,r)=>t(await this.parseResponse(n,r),r))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){const[t,n]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:n}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,n){return this.parse().then(t,n)}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 OI=Symbol("brand.privateNullableHeaders");function*s3(e){if(!e)return;if(OI in e){const{values:r,nulls:o}=e;yield*r.entries();for(const l of o)yield[l,null];return}let t=!1,n;e instanceof Headers?n=e.entries():BA(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let r of n){const o=r[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");const l=BA(r[1])?r[1]:[r[1]];let s=!1;for(const c of l)c!==void 0&&(t&&!s&&(s=!0,yield[o,null]),yield[o,c])}}const us=e=>{const t=new Headers,n=new Set;for(const r of e){const o=new Set;for(const[l,s]of s3(r)){const c=l.toLowerCase();o.has(c)||(t.delete(l),o.add(c)),s===null?(t.delete(l),n.add(c)):(t.append(l,s),n.delete(c))}}return{[OI]:!0,values:t,nulls:n}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const _m=e=>{var t,n,r,o,l,s;if(typeof globalThis.process<"u")return(r=(n=(t=NU)===null||t===void 0?void 0:t[e])===null||n===void 0?void 0:n.trim())!==null&&r!==void 0?r:void 0;if(typeof globalThis.Deno<"u")return(s=(l=(o=globalThis.Deno.env)===null||o===void 0?void 0:o.get)===null||l===void 0?void 0:l.call(o,e))===null||s===void 0?void 0:s.trim()};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var NI;class ld{constructor(t){var n,r,o,l,s,c,d,{baseURL:f=_m("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:h=(n=_m("GEMINI_API_KEY"))!==null&&n!==void 0?n:null,apiVersion:v="v1beta"}=t,y=nf(t,["baseURL","apiKey","apiVersion"]);const E=Object.assign(Object.assign({apiKey:h,apiVersion:v},y),{baseURL:f||"https://generativelanguage.googleapis.com"});this.baseURL=E.baseURL,this.timeout=(r=E.timeout)!==null&&r!==void 0?r:ld.DEFAULT_TIMEOUT,this.logger=(o=E.logger)!==null&&o!==void 0?o:console;const _="warn";this.logLevel=_,this.logLevel=(s=(l=FA(E.logLevel,"ClientOptions.logLevel",this))!==null&&l!==void 0?l:FA(_m("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&s!==void 0?s:_,this.fetchOptions=E.fetchOptions,this.maxRetries=(c=E.maxRetries)!==null&&c!==void 0?c:2,this.fetch=(d=E.fetch)!==null&&d!==void 0?d:HH(),this.encoder=$H,this._options=E,this.apiKey=h,this.apiVersion=v,this.clientAdapter=E.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:n}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!n.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 n=us([t.headers]);if(!(n.values.has("authorization")||n.values.has("x-goog-api-key"))){if(this.apiKey)return us([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return us([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([n,r])=>typeof r<"u").map(([n,r])=>{if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return`${encodeURIComponent(n)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(n)}=`;throw new Xn(`Cannot stringify type ${typeof r}; 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 ${Ua}`}defaultIdempotencyKey(){return`stainless-node-retry-${MH()}`}makeStatusError(t,n,r,o){return rn.generate(t,n,r,o)}buildURL(t,n,r){const o=!this.baseURLOverridden()&&r||this.baseURL,l=PH(t)?new URL(t):new URL(o+(o.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),s=this.defaultQuery();return NH(s)||(n=Object.assign(Object.assign({},s),n)),typeof n=="object"&&n&&!Array.isArray(n)&&(l.search=this.stringifyQuery(n)),l.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){const n=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${n}`}}async prepareRequest(t,{url:n,options:r}){}get(t,n){return this.methodRequest("get",t,n)}post(t,n){return this.methodRequest("post",t,n)}patch(t,n){return this.methodRequest("patch",t,n)}put(t,n){return this.methodRequest("put",t,n)}delete(t,n){return this.methodRequest("delete",t,n)}methodRequest(t,n,r){return this.request(Promise.resolve(r).then(o=>Object.assign({method:t,path:n},o)))}request(t,n=null){return new Py(this,this.makeRequest(t,n,void 0))}async makeRequest(t,n,r){var o,l,s;const c=await t,d=(o=c.maxRetries)!==null&&o!==void 0?o:this.maxRetries;n==null&&(n=d),await this.prepareOptions(c);const{req:f,url:h,timeout:v}=await this.buildRequest(c,{retryCount:d-n});await this.prepareRequest(f,{url:h,options:c});const y="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),E=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(en(this).debug(`[${y}] sending request`,To({retryOfRequestLogID:r,method:c.method,url:h,options:c,headers:f.headers})),!((l=c.signal)===null||l===void 0)&&l.aborted)throw new vg;const T=new AbortController,A=await this.fetchWithTimeout(h,f,v,T).catch(mg),w=Date.now();if(A instanceof globalThis.Error){const I=`retrying, ${n} attempts remaining`;if(!((s=c.signal)===null||s===void 0)&&s.aborted)throw new vg;const P=hg(A)||/timed? ?out/i.test(String(A)+("cause"in A?String(A.cause):""));if(n)return en(this).info(`[${y}] connection ${P?"timed out":"failed"} - ${I}`),en(this).debug(`[${y}] connection ${P?"timed out":"failed"} (${I})`,To({retryOfRequestLogID:r,url:h,durationMs:w-_,message:A.message})),this.retryRequest(c,n,r??y);throw en(this).info(`[${y}] connection ${P?"timed out":"failed"} - error; no more retries left`),en(this).debug(`[${y}] connection ${P?"timed out":"failed"} (error; no more retries left)`,To({retryOfRequestLogID:r,url:h,durationMs:w-_,message:A.message})),P?new mI:new od({cause:A})}const R=`[${y}${E}] ${f.method} ${h} ${A.ok?"succeeded":"failed"} with status ${A.status} in ${w-_}ms`;if(!A.ok){const I=await this.shouldRetry(A);if(n&&I){const B=`retrying, ${n} attempts remaining`;return await FH(A.body),en(this).info(`${R} - ${B}`),en(this).debug(`[${y}] response error (${B})`,To({retryOfRequestLogID:r,url:A.url,status:A.status,headers:A.headers,durationMs:w-_})),this.retryRequest(c,n,r??y,A.headers)}const P=I?"error; no more retries left":"error; not retryable";en(this).info(`${R} - ${P}`);const N=await A.text().catch(B=>mg(B).message),O=UH(N),D=O?void 0:N;throw en(this).debug(`[${y}] response error (${P})`,To({retryOfRequestLogID:r,url:A.url,status:A.status,headers:A.headers,message:D,durationMs:Date.now()-_})),this.makeStatusError(A.status,O,D,A.headers)}return en(this).info(R),en(this).debug(`[${y}] response start`,To({retryOfRequestLogID:r,url:A.url,status:A.status,headers:A.headers,durationMs:w-_})),{response:A,options:c,controller:T,requestLogID:y,retryOfRequestLogID:r,startTime:_}}async fetchWithTimeout(t,n,r,o){const l=n||{},{signal:s,method:c}=l,d=nf(l,["signal","method"]);s&&s.addEventListener("abort",()=>o.abort());const f=setTimeout(()=>o.abort(),r),h=globalThis.ReadableStream&&d.body instanceof globalThis.ReadableStream||typeof d.body=="object"&&d.body!==null&&Symbol.asyncIterator in d.body,v=Object.assign(Object.assign(Object.assign({signal:o.signal},h?{duplex:"half"}:{}),{method:"GET"}),d);c&&(v.method=c.toUpperCase());try{return await this.fetch.call(void 0,t,v)}finally{clearTimeout(f)}}async shouldRetry(t){const n=t.headers.get("x-should-retry");return n==="true"?!0:n==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,n,r,o){var l;let s;const c=o==null?void 0:o.get("retry-after-ms");if(c){const f=parseFloat(c);Number.isNaN(f)||(s=f)}const d=o==null?void 0:o.get("retry-after");if(d&&!s){const f=parseFloat(d);Number.isNaN(f)?s=Date.parse(d)-Date.now():s=f*1e3}if(!(s&&0<=s&&s<60*1e3)){const f=(l=t.maxRetries)!==null&&l!==void 0?l:this.maxRetries;s=this.calculateDefaultRetryTimeoutMillis(n,f)}return await LH(s),this.makeRequest(t,n-1,r)}calculateDefaultRetryTimeoutMillis(t,n){const l=n-t,s=Math.min(.5*Math.pow(2,l),8),c=1-Math.random()*.25;return s*c*1e3}async buildRequest(t,{retryCount:n=0}={}){var r,o,l;const s=Object.assign({},t),{method:c,path:d,query:f,defaultBaseURL:h}=s,v=this.buildURL(d,f,h);"timeout"in s&&kH("timeout",s.timeout),s.timeout=(r=s.timeout)!==null&&r!==void 0?r:this.timeout;const{bodyHeaders:y,body:E}=this.buildBody({options:s}),_=await this.buildHeaders({options:t,method:c,bodyHeaders:y,retryCount:n});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:c,headers:_},s.signal&&{signal:s.signal}),globalThis.ReadableStream&&E instanceof globalThis.ReadableStream&&{duplex:"half"}),E&&{body:E}),(o=this.fetchOptions)!==null&&o!==void 0?o:{}),(l=s.fetchOptions)!==null&&l!==void 0?l:{}),url:v,timeout:s.timeout}}async buildHeaders({options:t,method:n,bodyHeaders:r,retryCount:o}){let l={};this.idempotencyHeader&&n!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),l[this.idempotencyHeader]=t.idempotencyKey);const s=await this.authHeaders(t);let c=us([l,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),GH()),this._options.defaultHeaders,r,t.headers,s]);return this.validateHeaders(c),c.values}buildBody({options:{body:t,headers:n}}){if(!t)return{bodyHeaders:void 0,body:void 0};const r=us([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&r.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:VH(t)}:this.encoder({body:t,headers:r})}}ld.DEFAULT_TIMEOUT=6e4;class Ot extends ld{constructor(){super(...arguments),this.interactions=new RI(this)}}NI=Ot;Ot.GeminiNextGenAPIClient=NI;Ot.GeminiNextGenAPIClientError=Xn;Ot.APIError=rn;Ot.APIConnectionError=od;Ot.APIConnectionTimeoutError=mI;Ot.APIUserAbortError=vg;Ot.NotFoundError=SI;Ot.ConflictError=bI;Ot.RateLimitError=_I;Ot.BadRequestError=vI;Ot.AuthenticationError=gI;Ot.InternalServerError=TI;Ot.PermissionDeniedError=yI;Ot.UnprocessableEntityError=EI;Ot.toFile=XH;Ot.Interactions=RI;/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function u3(e,t){const n={},r=m(e,["name"]);return r!=null&&g(n,["_url","name"],r),n}function c3(e,t){const n={},r=m(e,["name"]);return r!=null&&g(n,["_url","name"],r),n}function f3(e,t){const n={},r=m(e,["sdkHttpResponse"]);return r!=null&&g(n,["sdkHttpResponse"],r),n}function d3(e,t){const n={},r=m(e,["sdkHttpResponse"]);return r!=null&&g(n,["sdkHttpResponse"],r),n}function p3(e,t,n){const r={};if(m(e,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const o=m(e,["tunedModelDisplayName"]);if(t!==void 0&&o!=null&&g(t,["displayName"],o),m(e,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const l=m(e,["epochCount"]);t!==void 0&&l!=null&&g(t,["tuningTask","hyperparameters","epochCount"],l);const s=m(e,["learningRateMultiplier"]);if(s!=null&&g(r,["tuningTask","hyperparameters","learningRateMultiplier"],s),m(e,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(m(e,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(m(e,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const c=m(e,["batchSize"]);t!==void 0&&c!=null&&g(t,["tuningTask","hyperparameters","batchSize"],c);const d=m(e,["learningRate"]);if(t!==void 0&&d!=null&&g(t,["tuningTask","hyperparameters","learningRate"],d),m(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(m(e,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return r}function h3(e,t,n){const r={};let o=m(n,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){const E=m(e,["validationDataset"]);t!==void 0&&E!=null&&g(t,["supervisedTuningSpec"],YA(E))}else if(o==="PREFERENCE_TUNING"){const E=m(e,["validationDataset"]);t!==void 0&&E!=null&&g(t,["preferenceOptimizationSpec"],YA(E))}const l=m(e,["tunedModelDisplayName"]);t!==void 0&&l!=null&&g(t,["tunedModelDisplayName"],l);const s=m(e,["description"]);t!==void 0&&s!=null&&g(t,["description"],s);let c=m(n,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){const E=m(e,["epochCount"]);t!==void 0&&E!=null&&g(t,["supervisedTuningSpec","hyperParameters","epochCount"],E)}else if(c==="PREFERENCE_TUNING"){const E=m(e,["epochCount"]);t!==void 0&&E!=null&&g(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],E)}let d=m(n,["config","method"]);if(d===void 0&&(d="SUPERVISED_FINE_TUNING"),d==="SUPERVISED_FINE_TUNING"){const E=m(e,["learningRateMultiplier"]);t!==void 0&&E!=null&&g(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],E)}else if(d==="PREFERENCE_TUNING"){const E=m(e,["learningRateMultiplier"]);t!==void 0&&E!=null&&g(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],E)}let f=m(n,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){const E=m(e,["exportLastCheckpointOnly"]);t!==void 0&&E!=null&&g(t,["supervisedTuningSpec","exportLastCheckpointOnly"],E)}else if(f==="PREFERENCE_TUNING"){const E=m(e,["exportLastCheckpointOnly"]);t!==void 0&&E!=null&&g(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],E)}let h=m(n,["config","method"]);if(h===void 0&&(h="SUPERVISED_FINE_TUNING"),h==="SUPERVISED_FINE_TUNING"){const E=m(e,["adapterSize"]);t!==void 0&&E!=null&&g(t,["supervisedTuningSpec","hyperParameters","adapterSize"],E)}else if(h==="PREFERENCE_TUNING"){const E=m(e,["adapterSize"]);t!==void 0&&E!=null&&g(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],E)}if(m(e,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(m(e,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const v=m(e,["labels"]);t!==void 0&&v!=null&&g(t,["labels"],v);const y=m(e,["beta"]);return t!==void 0&&y!=null&&g(t,["preferenceOptimizationSpec","hyperParameters","beta"],y),r}function m3(e,t){const n={},r=m(e,["baseModel"]);r!=null&&g(n,["baseModel"],r);const o=m(e,["preTunedModel"]);o!=null&&g(n,["preTunedModel"],o);const l=m(e,["trainingDataset"]);l!=null&&x3(l);const s=m(e,["config"]);return s!=null&&p3(s,n),n}function v3(e,t){const n={},r=m(e,["baseModel"]);r!=null&&g(n,["baseModel"],r);const o=m(e,["preTunedModel"]);o!=null&&g(n,["preTunedModel"],o);const l=m(e,["trainingDataset"]);l!=null&&w3(l,n,t);const s=m(e,["config"]);return s!=null&&h3(s,n,t),n}function g3(e,t){const n={},r=m(e,["name"]);return r!=null&&g(n,["_url","name"],r),n}function y3(e,t){const n={},r=m(e,["name"]);return r!=null&&g(n,["_url","name"],r),n}function S3(e,t,n){const r={},o=m(e,["pageSize"]);t!==void 0&&o!=null&&g(t,["_query","pageSize"],o);const l=m(e,["pageToken"]);t!==void 0&&l!=null&&g(t,["_query","pageToken"],l);const s=m(e,["filter"]);return t!==void 0&&s!=null&&g(t,["_query","filter"],s),r}function b3(e,t,n){const r={},o=m(e,["pageSize"]);t!==void 0&&o!=null&&g(t,["_query","pageSize"],o);const l=m(e,["pageToken"]);t!==void 0&&l!=null&&g(t,["_query","pageToken"],l);const s=m(e,["filter"]);return t!==void 0&&s!=null&&g(t,["_query","filter"],s),r}function E3(e,t){const n={},r=m(e,["config"]);return r!=null&&S3(r,n),n}function _3(e,t){const n={},r=m(e,["config"]);return r!=null&&b3(r,n),n}function T3(e,t){const n={},r=m(e,["sdkHttpResponse"]);r!=null&&g(n,["sdkHttpResponse"],r);const o=m(e,["nextPageToken"]);o!=null&&g(n,["nextPageToken"],o);const l=m(e,["tunedModels"]);if(l!=null){let s=l;Array.isArray(s)&&(s=s.map(c=>DI(c))),g(n,["tuningJobs"],s)}return n}function A3(e,t){const n={},r=m(e,["sdkHttpResponse"]);r!=null&&g(n,["sdkHttpResponse"],r);const o=m(e,["nextPageToken"]);o!=null&&g(n,["nextPageToken"],o);const l=m(e,["tuningJobs"]);if(l!=null){let s=l;Array.isArray(s)&&(s=s.map(c=>Sg(c))),g(n,["tuningJobs"],s)}return n}function C3(e,t){const n={},r=m(e,["name"]);r!=null&&g(n,["model"],r);const o=m(e,["name"]);return o!=null&&g(n,["endpoint"],o),n}function x3(e,t){const n={};if(m(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(m(e,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const r=m(e,["examples"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>l)),g(n,["examples","examples"],o)}return n}function w3(e,t,n){const r={};let o=m(n,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){const s=m(e,["gcsUri"]);t!==void 0&&s!=null&&g(t,["supervisedTuningSpec","trainingDatasetUri"],s)}else if(o==="PREFERENCE_TUNING"){const s=m(e,["gcsUri"]);t!==void 0&&s!=null&&g(t,["preferenceOptimizationSpec","trainingDatasetUri"],s)}let l=m(n,["config","method"]);if(l===void 0&&(l="SUPERVISED_FINE_TUNING"),l==="SUPERVISED_FINE_TUNING"){const s=m(e,["vertexDatasetResource"]);t!==void 0&&s!=null&&g(t,["supervisedTuningSpec","trainingDatasetUri"],s)}else if(l==="PREFERENCE_TUNING"){const s=m(e,["vertexDatasetResource"]);t!==void 0&&s!=null&&g(t,["preferenceOptimizationSpec","trainingDatasetUri"],s)}if(m(e,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return r}function DI(e,t){const n={},r=m(e,["sdkHttpResponse"]);r!=null&&g(n,["sdkHttpResponse"],r);const o=m(e,["name"]);o!=null&&g(n,["name"],o);const l=m(e,["state"]);l!=null&&g(n,["state"],XM(l));const s=m(e,["createTime"]);s!=null&&g(n,["createTime"],s);const c=m(e,["tuningTask","startTime"]);c!=null&&g(n,["startTime"],c);const d=m(e,["tuningTask","completeTime"]);d!=null&&g(n,["endTime"],d);const f=m(e,["updateTime"]);f!=null&&g(n,["updateTime"],f);const h=m(e,["description"]);h!=null&&g(n,["description"],h);const v=m(e,["baseModel"]);v!=null&&g(n,["baseModel"],v);const y=m(e,["_self"]);return y!=null&&g(n,["tunedModel"],C3(y)),n}function Sg(e,t){const n={},r=m(e,["sdkHttpResponse"]);r!=null&&g(n,["sdkHttpResponse"],r);const o=m(e,["name"]);o!=null&&g(n,["name"],o);const l=m(e,["state"]);l!=null&&g(n,["state"],XM(l));const s=m(e,["createTime"]);s!=null&&g(n,["createTime"],s);const c=m(e,["startTime"]);c!=null&&g(n,["startTime"],c);const d=m(e,["endTime"]);d!=null&&g(n,["endTime"],d);const f=m(e,["updateTime"]);f!=null&&g(n,["updateTime"],f);const h=m(e,["error"]);h!=null&&g(n,["error"],h);const v=m(e,["description"]);v!=null&&g(n,["description"],v);const y=m(e,["baseModel"]);y!=null&&g(n,["baseModel"],y);const E=m(e,["tunedModel"]);E!=null&&g(n,["tunedModel"],E);const _=m(e,["preTunedModel"]);_!=null&&g(n,["preTunedModel"],_);const T=m(e,["supervisedTuningSpec"]);T!=null&&g(n,["supervisedTuningSpec"],T);const A=m(e,["preferenceOptimizationSpec"]);A!=null&&g(n,["preferenceOptimizationSpec"],A);const w=m(e,["tuningDataStats"]);w!=null&&g(n,["tuningDataStats"],w);const R=m(e,["encryptionSpec"]);R!=null&&g(n,["encryptionSpec"],R);const I=m(e,["partnerModelTuningSpec"]);I!=null&&g(n,["partnerModelTuningSpec"],I);const P=m(e,["customBaseModel"]);P!=null&&g(n,["customBaseModel"],P);const N=m(e,["experiment"]);N!=null&&g(n,["experiment"],N);const O=m(e,["labels"]);O!=null&&g(n,["labels"],O);const D=m(e,["outputUri"]);D!=null&&g(n,["outputUri"],D);const G=m(e,["pipelineJob"]);G!=null&&g(n,["pipelineJob"],G);const B=m(e,["serviceAccount"]);B!=null&&g(n,["serviceAccount"],B);const Q=m(e,["tunedModelDisplayName"]);Q!=null&&g(n,["tunedModelDisplayName"],Q);const te=m(e,["veoTuningSpec"]);return te!=null&&g(n,["veoTuningSpec"],te),n}function M3(e,t){const n={},r=m(e,["sdkHttpResponse"]);r!=null&&g(n,["sdkHttpResponse"],r);const o=m(e,["name"]);o!=null&&g(n,["name"],o);const l=m(e,["metadata"]);l!=null&&g(n,["metadata"],l);const s=m(e,["done"]);s!=null&&g(n,["done"],s);const c=m(e,["error"]);return c!=null&&g(n,["error"],c),n}function YA(e,t){const n={},r=m(e,["gcsUri"]);r!=null&&g(n,["validationDatasetUri"],r);const o=m(e,["vertexDatasetResource"]);return o!=null&&g(n,["validationDatasetUri"],o),n}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class I3 extends di{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Vo(ii.PAGED_ITEM_TUNING_JOBS,r=>this.listInternal(r),await this.listInternal(n),n),this.get=async n=>await this.getInternal(n),this.tune=async n=>{var r;if(this.apiClient.isVertexAI())if(n.baseModel.startsWith("projects/")){const o={tunedModelName:n.baseModel};!((r=n.config)===null||r===void 0)&&r.preTunedModelCheckpointId&&(o.checkpointId=n.config.preTunedModelCheckpointId);const l=Object.assign(Object.assign({},n),{preTunedModel:o});return l.baseModel=void 0,await this.tuneInternal(l)}else{const o=Object.assign({},n);return await this.tuneInternal(o)}else{const o=Object.assign({},n),l=await this.tuneMldevInternal(o);let s="";return l.metadata!==void 0&&l.metadata.tunedModel!==void 0?s=l.metadata.tunedModel:l.name!==void 0&&l.name.includes("/operations/")&&(s=l.name.split("/operations/")[0]),{name:s,state:ag.JOB_STATE_QUEUED}}}}async getInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=y3(t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>Sg(h))}else{const f=g3(t);return c=ue("{name}",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>DI(h))}}async listInternal(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=_3(t);return c=ue("tuningJobs",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=A3(h),y=new yA;return Object.assign(y,v),y})}else{const f=E3(t);return c=ue("tunedModels",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=T3(h),y=new yA;return Object.assign(y,v),y})}}async cancel(t){var n,r,o,l;let s,c="",d={};if(this.apiClient.isVertexAI()){const f=c3(t);return c=ue("{name}:cancel",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=d3(h),y=new SA;return Object.assign(y,v),y})}else{const f=u3(t);return c=ue("{name}:cancel",f._url),d=f._query,delete f._url,delete f._query,s=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(f),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(l=t.config)===null||l===void 0?void 0:l.abortSignal}).then(h=>h.json().then(v=>{const y=v;return y.sdkHttpResponse={headers:h.headers},y})),s.then(h=>{const v=f3(h),y=new SA;return Object.assign(y,v),y})}}async tuneInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI()){const c=v3(t,t);return l=ue("tuningJobs",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>Sg(d))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(t){var n,r;let o,l="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const c=m3(t);return l=ue("tunedModels",c._url),s=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:s,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(r=t.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:d.headers},h})),o.then(d=>M3(d))}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class P3{async download(t,n){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an tag.")}}const R3=1024*1024*8,O3=3,N3=1e3,D3=2,of="x-goog-upload-status";async function k3(e,t,n){var r;const o=await kI(e,t,n),l=await(o==null?void 0:o.json());if(((r=o==null?void 0:o.headers)===null||r===void 0?void 0:r[of])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return l.file}async function U3(e,t,n){var r;const o=await kI(e,t,n),l=await(o==null?void 0:o.json());if(((r=o==null?void 0:o.headers)===null||r===void 0?void 0:r[of])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const s=FM(l),c=new Ty;return Object.assign(c,s),c}async function kI(e,t,n){var r,o;let l=0,s=0,c=new sg(new Response),d="upload";for(l=e.size;s=l&&(d+=", finalize");let v=0,y=N3;for(;vsetTimeout(t,e))}class B3{async upload(t,n,r){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await k3(t,n,r)}async uploadToFileSearchStore(t,n,r){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await U3(t,n,r)}async stat(t){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await L3(t)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class q3{create(t,n,r){return new G3(t,n,r)}}class G3{constructor(t,n,r){this.url=t,this.headers=n,this.callbacks=r}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 KA="x-goog-api-key";class H3{constructor(t){this.apiKey=t}async addAuthHeaders(t,n){if(t.get(KA)===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(KA,this.apiKey)}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const V3="gl-node/";class F3{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 n=new Ot({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=n.interactions,this._interactions}constructor(t){var n;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=(n=t.vertexai)!==null&&n!==void 0?n:!1,this.apiKey=t.apiKey;const r=LU(t.httpOptions,t.vertexai,void 0,void 0);r&&(t.httpOptions?t.httpOptions.baseUrl=r:t.httpOptions={baseUrl:r}),this.apiVersion=t.apiVersion,this.httpOptions=t.httpOptions;const o=new H3(this.apiKey);this.apiClient=new LG({auth:o,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:V3+"web",uploader:new B3,downloader:new P3}),this.models=new nH(this.apiClient),this.live=new XG(this.apiClient,o,new q3),this.batches=new dz(this.apiClient),this.chats=new Kz(this.models,this.apiClient),this.caches=new Fz(this.apiClient),this.files=new rB(this.apiClient),this.operations=new rH(this.apiClient),this.authTokens=new SH(this.apiClient),this.tunings=new I3(this.apiClient),this.fileSearchStores=new wH(this.apiClient)}}const $3=[{name:"crossLedgerReconciliation",description:"Connects dots between multiple uploaded files to identify hidden transfers and link disparate counterparties.",parameters:{type:Ue.OBJECT,properties:{targetFiles:{type:Ue.ARRAY,items:{type:Ue.STRING},description:"IDs of files to correlate"},method:{type:Ue.STRING,enum:["blockchain_match","name_fuzzy","amount_delta"]}}}},{name:"executeYieldOptimization",description:"Triggers treasury movement for unallocated liquidity into high-yield sovereign buckets.",parameters:{type:Ue.OBJECT,properties:{volume:{type:Ue.NUMBER},targetPool:{type:Ue.STRING}}}},{name:"mapInstitutionalMetadata",description:"Analyzes alos, eth_signatures, and invoice numbers to verify institutional authenticity.",parameters:{type:Ue.OBJECT,properties:{sampleIds:{type:Ue.ARRAY,items:{type:Ue.STRING}}}}}];class Y3{constructor(){this.ai=new F3({apiKey:"AIzaSyA3PJewelAp0BSiWX4LhsRwlr6a2hqbqik"})}async processCommand(t,n){const o=` System: You are the Vertex Sovereign Intelligence Node. Capabilities: Multi-source synthesis, forensic ledger audit, yield execution. Active Corpus: $${(n.transactions.reduce((l,s)=>l+(Number(s.amount)||0),0)/1e12).toFixed(4)}T across ${n.files.length} data provisions. User Context: ${t} Data Intelligence: - Files: ${n.files.map(l=>l.name).join(", ")} - High Entropy Flows: Detected in alos/eth_signature metadata. Role: Act as a high-stakes institutional advisor. Execute tools if the user requests action. Synthesize "KPIs no one else has" (e.g. Shadow Velocity, Metadata Integrity Score, Sovereign Decay). `;try{const l=await this.ai.models.generateContent({model:"gemini-3-pro-preview",contents:o,config:{tools:[{functionDeclarations:$3}]}});return{text:l.text||"Directives acknowledged. Commencing sovereign analysis...",toolCalls:l.functionCalls}}catch(l){return console.error(l),{text:"Protocol interference detected. Intelligence link running on backup nodes."}}}async getDynamicKPIs(t){const n=`Analyze these trillion-dollar scale transactions and generate 3 unique institutional KPIs: ${JSON.stringify(t.slice(0,20))}. Return as JSON object with { kpis: [{label, value, trend}] }.`;try{const r=await this.ai.models.generateContent({model:"gemini-3-flash-preview",contents:n,config:{responseMimeType:"application/json",responseSchema:{type:Ue.OBJECT,properties:{kpis:{type:Ue.ARRAY,items:{type:Ue.OBJECT,properties:{label:{type:Ue.STRING},value:{type:Ue.STRING},trend:{type:Ue.STRING}},required:["label","value","trend"]}}},required:["kpis"]}}});return JSON.parse(r.text||'{"kpis": []}')}catch{return{kpis:[]}}}async analyzeTransactions(t){const n=`Perform a forensic treasury audit on these transactions. Focus on liquidity concentration, risk patterns, and institutional flow health. Data: ${JSON.stringify(t.slice(0,50))}`;try{return(await this.ai.models.generateContent({model:"gemini-3-flash-preview",contents:n})).text||"Report generation failed."}catch(r){return console.error(r),"Unable to access forensic analysis nodes."}}async chatAboutData(t,n){const r=`As the Vertex Intelligence Node, answer the following query using the provided institutional ledger sample. Query: ${t} Ledger Sample: ${JSON.stringify(n.slice(0,20))} `;try{return(await this.ai.models.generateContent({model:"gemini-3-flash-preview",contents:r})).text||"Query resolution timed out."}catch(o){return console.error(o),"Direct interface to data clusters is currently unstable."}}async onboardingAssistant(t,n){const r=`Institutional Onboarding Interface. User request: ${t}. Active Counterparties: ${JSON.stringify(n.slice(0,10))}. Assist the user in provisioning new entities or analyzing existing ones for compliance.`;try{return(await this.ai.models.generateContent({model:"gemini-3-flash-preview",contents:r})).text||"Onboarding protocol on standby."}catch(o){return console.error(o),"Compliance engine is currently offline."}}async getCommandCenterInsights(t,n){const r=`Strategic Command Center Analysis. Analyze the following institutional data and suggest high-impact treasury actions. Accounts: ${JSON.stringify(t.slice(0,10))} Transactions: ${JSON.stringify(n.slice(0,20))} Return a valid JSON object with: - "report": A markdown assessment of treasury health and risks. - "actions": A list of recommended AIAction objects. `;try{const o=await this.ai.models.generateContent({model:"gemini-3-pro-preview",contents:r,config:{responseMimeType:"application/json",responseSchema:{type:Ue.OBJECT,properties:{report:{type:Ue.STRING},actions:{type:Ue.ARRAY,items:{type:Ue.OBJECT,properties:{id:{type:Ue.STRING},type:{type:Ue.STRING,enum:["reconcile","verify_kyc","optimize_yield","investigate","map_metadata"]},label:{type:Ue.STRING},description:{type:Ue.STRING},impact:{type:Ue.STRING},status:{type:Ue.STRING}},required:["id","type","label","description","impact","status"]}}},required:["report","actions"]}}});return JSON.parse(o.text||'{"report": "No insights available.", "actions": []}')}catch(o){return console.error(o),{report:"Strategic link severed. Manual audit required.",actions:[]}}}}const K3=new Y3;function UI(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{var{children:n,width:r,height:o,viewBox:l,className:s,style:c,title:d,desc:f}=e,h=Q3(e,Z3),v=l||{width:r,height:o,x:0,y:0},y=Xe("recharts-surface",s);return x.createElement("svg",bg({},on(h),{className:y,width:r,height:o,style:c,viewBox:"".concat(v.x," ").concat(v.y," ").concat(v.width," ").concat(v.height),ref:t}),x.createElement("title",null,d),x.createElement("desc",null,f),n)}),tV=["children","className"];function Eg(){return Eg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,o=nV(e,tV),l=Xe("recharts-layer",r);return x.createElement("g",Eg({className:l},on(o),{ref:t}),n)}),qI=VM(),iV=x.createContext(null);function Qe(e){return function(){return e}}const GI=Math.cos,af=Math.sin,mr=Math.sqrt,lf=Math.PI,sd=2*lf,_g=Math.PI,Tg=2*_g,Ao=1e-6,oV=Tg-Ao;function HI(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return HI;const n=10**t;return function(r){this._+=r[0];for(let o=1,l=r.length;oAo)if(!(Math.abs(v*d-f*h)>Ao)||!l)this._append`L${this._x1=t},${this._y1=n}`;else{let E=r-s,_=o-c,T=d*d+f*f,A=E*E+_*_,w=Math.sqrt(T),R=Math.sqrt(y),I=l*Math.tan((_g-Math.acos((T+y-A)/(2*w*R)))/2),P=I/R,N=I/w;Math.abs(P-1)>Ao&&this._append`L${t+P*h},${n+P*v}`,this._append`A${l},${l},0,0,${+(v*E>h*_)},${this._x1=t+N*d},${this._y1=n+N*f}`}}arc(t,n,r,o,l,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(o),d=r*Math.sin(o),f=t+c,h=n+d,v=1^s,y=s?o-l:l-o;this._x1===null?this._append`M${f},${h}`:(Math.abs(this._x1-f)>Ao||Math.abs(this._y1-h)>Ao)&&this._append`L${f},${h}`,r&&(y<0&&(y=y%Tg+Tg),y>oV?this._append`A${r},${r},0,1,${v},${t-c},${n-d}A${r},${r},0,1,${v},${this._x1=f},${this._y1=h}`:y>Ao&&this._append`A${r},${r},0,${+(y>=_g)},${v},${this._x1=t+r*Math.cos(l)},${this._y1=n+r*Math.sin(l)}`)}rect(t,n,r,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+o}h${-r}Z`}toString(){return this._}}function Oy(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new lV(t)}function Ny(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function VI(e){this._context=e}VI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ud(e){return new VI(e)}function FI(e){return e[0]}function $I(e){return e[1]}function YI(e,t){var n=Qe(!0),r=null,o=ud,l=null,s=Oy(c);e=typeof e=="function"?e:e===void 0?FI:Qe(e),t=typeof t=="function"?t:t===void 0?$I:Qe(t);function c(d){var f,h=(d=Ny(d)).length,v,y=!1,E;for(r==null&&(l=o(E=s())),f=0;f<=h;++f)!(f=E;--_)c.point(I[_],P[_]);c.lineEnd(),c.areaEnd()}w&&(I[y]=+e(A,y,v),P[y]=+t(A,y,v),c.point(r?+r(A,y,v):I[y],n?+n(A,y,v):P[y]))}if(R)return c=null,R+""||null}function h(){return YI().defined(o).curve(s).context(l)}return f.x=function(v){return arguments.length?(e=typeof v=="function"?v:Qe(+v),r=null,f):e},f.x0=function(v){return arguments.length?(e=typeof v=="function"?v:Qe(+v),f):e},f.x1=function(v){return arguments.length?(r=v==null?null:typeof v=="function"?v:Qe(+v),f):r},f.y=function(v){return arguments.length?(t=typeof v=="function"?v:Qe(+v),n=null,f):t},f.y0=function(v){return arguments.length?(t=typeof v=="function"?v:Qe(+v),f):t},f.y1=function(v){return arguments.length?(n=v==null?null:typeof v=="function"?v:Qe(+v),f):n},f.lineX0=f.lineY0=function(){return h().x(e).y(t)},f.lineY1=function(){return h().x(e).y(n)},f.lineX1=function(){return h().x(r).y(t)},f.defined=function(v){return arguments.length?(o=typeof v=="function"?v:Qe(!!v),f):o},f.curve=function(v){return arguments.length?(s=v,l!=null&&(c=s(l)),f):s},f.context=function(v){return arguments.length?(v==null?l=c=null:c=s(l=v),f):l},f}class KI{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function sV(e){return new KI(e,!0)}function uV(e){return new KI(e,!1)}const Dy={draw(e,t){const n=mr(t/lf);e.moveTo(n,0),e.arc(0,0,n,0,sd)}},cV={draw(e,t){const n=mr(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},JI=mr(1/3),fV=JI*2,dV={draw(e,t){const n=mr(t/fV),r=n*JI;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},pV={draw(e,t){const n=mr(t),r=-n/2;e.rect(r,r,n,n)}},hV=.8908130915292852,jI=af(lf/10)/af(7*lf/10),mV=af(sd/10)*jI,vV=-GI(sd/10)*jI,gV={draw(e,t){const n=mr(t*hV),r=mV*n,o=vV*n;e.moveTo(0,-n),e.lineTo(r,o);for(let l=1;l<5;++l){const s=sd*l/5,c=GI(s),d=af(s);e.lineTo(d*n,-c*n),e.lineTo(c*r-d*o,d*r+c*o)}e.closePath()}},Tm=mr(3),yV={draw(e,t){const n=-mr(t/(Tm*3));e.moveTo(0,n*2),e.lineTo(-Tm*n,-n),e.lineTo(Tm*n,-n),e.closePath()}},$n=-.5,Yn=mr(3)/2,Ag=1/mr(12),SV=(Ag/2+1)*3,bV={draw(e,t){const n=mr(t/SV),r=n/2,o=n*Ag,l=r,s=n*Ag+n,c=-l,d=s;e.moveTo(r,o),e.lineTo(l,s),e.lineTo(c,d),e.lineTo($n*r-Yn*o,Yn*r+$n*o),e.lineTo($n*l-Yn*s,Yn*l+$n*s),e.lineTo($n*c-Yn*d,Yn*c+$n*d),e.lineTo($n*r+Yn*o,$n*o-Yn*r),e.lineTo($n*l+Yn*s,$n*s-Yn*l),e.lineTo($n*c+Yn*d,$n*d-Yn*c),e.closePath()}};function EV(e,t){let n=null,r=Oy(o);e=typeof e=="function"?e:Qe(e||Dy),t=typeof t=="function"?t:Qe(t===void 0?64:+t);function o(){let l;if(n||(n=l=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),l)return n=null,l+""||null}return o.type=function(l){return arguments.length?(e=typeof l=="function"?l:Qe(l),o):e},o.size=function(l){return arguments.length?(t=typeof l=="function"?l:Qe(+l),o):t},o.context=function(l){return arguments.length?(n=l??null,o):n},o}function sf(){}function uf(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function XI(e){this._context=e}XI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:uf(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:uf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function _V(e){return new XI(e)}function WI(e){this._context=e}WI.prototype={areaStart:sf,areaEnd:sf,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:uf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function TV(e){return new WI(e)}function ZI(e){this._context=e}ZI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:uf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function AV(e){return new ZI(e)}function QI(e){this._context=e}QI.prototype={areaStart:sf,areaEnd:sf,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function CV(e){return new QI(e)}function JA(e){return e<0?-1:1}function jA(e,t,n){var r=e._x1-e._x0,o=t-e._x1,l=(e._y1-e._y0)/(r||o<0&&-0),s=(n-e._y1)/(o||r<0&&-0),c=(l*o+s*r)/(r+o);return(JA(l)+JA(s))*Math.min(Math.abs(l),Math.abs(s),.5*Math.abs(c))||0}function XA(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Am(e,t,n){var r=e._x0,o=e._y0,l=e._x1,s=e._y1,c=(l-r)/3;e._context.bezierCurveTo(r+c,o+c*t,l-c,s-c*n,l,s)}function cf(e){this._context=e}cf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Am(this,this._t0,XA(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Am(this,XA(this,n=jA(this,e,t)),n);break;default:Am(this,this._t0,n=jA(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function eP(e){this._context=new tP(e)}(eP.prototype=Object.create(cf.prototype)).point=function(e,t){cf.prototype.point.call(this,t,e)};function tP(e){this._context=e}tP.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,o,l){this._context.bezierCurveTo(t,e,r,n,l,o)}};function xV(e){return new cf(e)}function wV(e){return new eP(e)}function nP(e){this._context=e}nP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=WA(e),o=WA(t),l=0,s=1;s=0;--t)o[t]=(s[t]-o[t+1])/l[t];for(l[n-1]=(e[n]+o[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function IV(e){return new cd(e,.5)}function PV(e){return new cd(e,0)}function RV(e){return new cd(e,1)}function ko(e,t){if((s=e.length)>1)for(var n=1,r,o,l=e[t[0]],s,c=l.length;n=0;)n[t]=t;return n}function OV(e,t){return e[t]}function NV(e){const t=[];return t.key=e,t}function DV(){var e=Qe([]),t=Cg,n=ko,r=OV;function o(l){var s=Array.from(e.apply(this,arguments),NV),c,d=s.length,f=-1,h;for(const v of l)for(c=0,++f;c0){for(var n,r,o=0,l=e[0].length,s;o0){for(var n=0,r=e[t[0]],o,l=r.length;n0)||!((l=(o=e[t[0]]).length)>0))){for(var n=0,r=1,o,l,s;r1&&arguments[1]!==void 0?arguments[1]:HV,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function ct(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var c=n[s-1];return typeof c=="string"?o+c+l:c!==void 0?o+ji(c)+l:o+l},"")}var gn=e=>e===0?0:e>0?1:-1,fr=e=>typeof e=="number"&&e!=+e,Uo=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ce=e=>(typeof e=="number"||e instanceof Number)&&!fr(e),xr=e=>ce(e)||typeof e=="string",VV=0,xs=e=>{var t=++VV;return"".concat(e||"").concat(t)},dr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ce(t)&&typeof t!="string")return r;var l;if(Uo(t)){if(n==null)return r;var s=t.indexOf("%");l=n*parseFloat(t.slice(0,s))/100}else l=+t;return fr(l)&&(l=r),o&&n!=null&&l>n&&(l=n),l},iP=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Ka(r,t))===n)}var ft=e=>e===null||typeof e>"u",Hs=e=>ft(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function yn(e){return e!=null}function Fo(){}var FV=["type","size","sizeType"];function xg(){return xg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Hs(e));return aP[t]||Dy},ZV=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*XV;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},QV=(e,t)=>{aP["symbol".concat(Hs(e))]=t},lP=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,o=JV(e,FV),l=aC(aC({},o),{},{type:t,size:n,sizeType:r}),s="circle";typeof t=="string"&&(s=t);var c=()=>{var y=WV(s),E=EV().type(y).size(ZV(n,r,s)),_=E();if(_!==null)return _},{className:d,cx:f,cy:h}=l,v=on(l);return ce(f)&&ce(h)&&ce(n)?x.createElement("path",xg({},v,{className:Xe("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(h,")"),d:c()})):null};lP.registerSymbol=QV;var sP=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,zy=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(x.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(o=>{Ry(o)&&(r[o]=(l=>n[o](n,l)))}),r},e4=(e,t,n)=>r=>(e(t,n,r),null),By=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(o=>{var l=e[o];Ry(o)&&typeof l=="function"&&(r||(r={}),r[o]=e4(l,t,n))}),r};function lC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function t4(e){for(var t=1;t(s[c]===void 0&&r[c]!==void 0&&(s[c]=r[c]),s),n);return l}var Om={},Nm={},sC;function o4(){return sC||(sC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const o=new Map;for(let l=0;l=0}e.isLength=t})(zm)),zm}var dC;function qy(){return dC||(dC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=l4();function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(Lm)),Lm}var Bm={},pC;function s4(){return pC||(pC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(Bm)),Bm}var hC;function u4(){return hC||(hC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=qy(),n=s4();function r(o){return n.isObjectLike(o)&&t.isArrayLike(o)}e.isArrayLikeObject=r})(Um)),Um}var qm={},Gm={},mC;function c4(){return mC||(mC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ly();function n(r){return function(o){return t.get(o,r)}}e.property=n})(Gm)),Gm}var Hm={},Vm={},Fm={},$m={},vC;function cP(){return vC||(vC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})($m)),$m}var Ym={},gC;function fP(){return gC||(gC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Ym)),Ym}var Km={},yC;function dP(){return yC||(yC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Km)),Km}var SC;function f4(){return SC||(SC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=cP(),n=fP(),r=dP();function o(h,v,y){return typeof y!="function"?o(h,v,()=>{}):l(h,v,function E(_,T,A,w,R,I){const P=y(_,T,A,w,R,I);return P!==void 0?!!P:l(_,T,E,I)},new Map)}function l(h,v,y,E){if(v===h)return!0;switch(typeof v){case"object":return s(h,v,y,E);case"function":return Object.keys(v).length>0?l(h,{...v},y,E):r.isEqualsSameValueZero(h,v);default:return t.isObject(h)?typeof v=="string"?v==="":!0:r.isEqualsSameValueZero(h,v)}}function s(h,v,y,E){if(v==null)return!0;if(Array.isArray(v))return d(h,v,y,E);if(v instanceof Map)return c(h,v,y,E);if(v instanceof Set)return f(h,v,y,E);const _=Object.keys(v);if(h==null||n.isPrimitive(h))return _.length===0;if(_.length===0)return!0;if(E!=null&&E.has(v))return E.get(v)===h;E==null||E.set(v,h);try{for(let T=0;T<_.length;T++){const A=_[T];if(!n.isPrimitive(h)&&!(A in h)||v[A]===void 0&&h[A]!==void 0||v[A]===null&&h[A]!==null||!y(h[A],v[A],A,h,v,E))return!1}return!0}finally{E==null||E.delete(v)}}function c(h,v,y,E){if(v.size===0)return!0;if(!(h instanceof Map))return!1;for(const[_,T]of v.entries()){const A=h.get(_);if(y(A,T,_,h,v,E)===!1)return!1}return!0}function d(h,v,y,E){if(v.length===0)return!0;if(!Array.isArray(h))return!1;const _=new Set;for(let T=0;T{})}e.isMatch=n})(Vm)),Vm}var Jm={},jm={},Xm={},EC;function d4(){return EC||(EC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(Xm)),Xm}var Wm={},_C;function Gy(){return _C||(_C=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(Wm)),Wm}var Zm={},TC;function hP(){return TC||(TC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",o="[object Boolean]",l="[object Arguments]",s="[object Symbol]",c="[object Date]",d="[object Map]",f="[object Set]",h="[object Array]",v="[object Function]",y="[object ArrayBuffer]",E="[object Object]",_="[object Error]",T="[object DataView]",A="[object Uint8Array]",w="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]",P="[object BigUint64Array]",N="[object Int8Array]",O="[object Int16Array]",D="[object Int32Array]",G="[object BigInt64Array]",B="[object Float32Array]",Q="[object Float64Array]";e.argumentsTag=l,e.arrayBufferTag=y,e.arrayTag=h,e.bigInt64ArrayTag=G,e.bigUint64ArrayTag=P,e.booleanTag=o,e.dataViewTag=T,e.dateTag=c,e.errorTag=_,e.float32ArrayTag=B,e.float64ArrayTag=Q,e.functionTag=v,e.int16ArrayTag=O,e.int32ArrayTag=D,e.int8ArrayTag=N,e.mapTag=d,e.numberTag=r,e.objectTag=E,e.regexpTag=t,e.setTag=f,e.stringTag=n,e.symbolTag=s,e.uint16ArrayTag=R,e.uint32ArrayTag=I,e.uint8ArrayTag=A,e.uint8ClampedArrayTag=w})(Zm)),Zm}var Qm={},AC;function p4(){return AC||(AC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(Qm)),Qm}var CC;function mP(){return CC||(CC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=d4(),n=Gy(),r=hP(),o=fP(),l=p4();function s(h,v){return c(h,void 0,h,new Map,v)}function c(h,v,y,E=new Map,_=void 0){const T=_==null?void 0:_(h,v,y,E);if(T!==void 0)return T;if(o.isPrimitive(h))return h;if(E.has(h))return E.get(h);if(Array.isArray(h)){const A=new Array(h.length);E.set(h,A);for(let w=0;wt.isMatch(l,o)}e.matches=r})(Hm)),Hm}var ev={},tv={},nv={},MC;function v4(){return MC||(MC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=mP(),n=Gy(),r=hP();function o(l,s){return t.cloneDeepWith(l,(c,d,f,h)=>{const v=s==null?void 0:s(c,d,f,h);if(v!==void 0)return v;if(typeof l=="object"){if(n.getTag(l)===r.objectTag&&typeof l.constructor!="function"){const y={};return h.set(l,y),t.copyProperties(y,l,f,h),y}switch(Object.prototype.toString.call(l)){case r.numberTag:case r.stringTag:case r.booleanTag:{const y=new l.constructor(l==null?void 0:l.valueOf());return t.copyProperties(y,l),y}case r.argumentsTag:{const y={};return t.copyProperties(y,l),y.length=l.length,y[Symbol.iterator]=l[Symbol.iterator],y}default:return}}})}e.cloneDeepWith=o})(nv)),nv}var IC;function g4(){return IC||(IC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=v4();function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(tv)),tv}var rv={},iv={},PC;function vP(){return PC||(PC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,o=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return cv.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,cv}var BC;function w4(){return BC||(BC=1,uv.exports=x4()),uv.exports}/** * @license React * use-sync-external-store-shim/with-selector.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 qC;function M4(){if(qC)return sv;qC=1;var e=el(),t=w4();function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,l=e.useRef,s=e.useEffect,c=e.useMemo,d=e.useDebugValue;return sv.useSyncExternalStoreWithSelector=function(f,h,v,y,E){var _=l(null);if(_.current===null){var T={hasValue:!1,value:null};_.current=T}else T=_.current;_=c(function(){function w(O){if(!R){if(R=!0,I=O,O=y(O),E!==void 0&&T.hasValue){var D=T.value;if(E(D,O))return P=D}return P=O}if(D=P,r(I,O))return D;var G=y(O);return E!==void 0&&E(D,G)?(I=O,D):(I=O,P=G)}var R=!1,I,P,N=v===void 0?null:v;return[function(){return w(h())},N===null?void 0:function(){return w(N())}]},[h,v,y,E]);var A=o(f,_[0],_[1]);return s(function(){T.hasValue=!0,T.value=A},[A]),d(A),A},sv}var GC;function I4(){return GC||(GC=1,lv.exports=M4()),lv.exports}var P4=I4(),Hy=x.createContext(null),R4=e=>e,ht=()=>{var e=x.useContext(Hy);return e?e.store.dispatch:R4},Kc=()=>{},O4=()=>Kc,N4=(e,t)=>e===t;function me(e){var t=x.useContext(Hy),n=x.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Kc,[t,e]);return P4.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:O4,t?t.store.getState:Kc,t?t.store.getState:Kc,n,N4)}function D4(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function k4(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function U4(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var HC=e=>Array.isArray(e)?e:[e];function L4(e){const t=Array.isArray(e[0])?e[0]:e;return U4(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function z4(e,t){const n=[],{length:r}=e;for(let o=0;o{n=Ic(),s.resetResultsCount()},s.resultsCount=()=>l,s.resetResultsCount=()=>{l=0},s}function H4(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let l=0,s=0,c,d={},f=o.pop();typeof f=="object"&&(d=f,f=o.pop()),D4(f,`createSelector expects an output function after the inputs, but received: [${typeof f}]`);const h={...n,...d},{memoize:v,memoizeOptions:y=[],argsMemoize:E=gP,argsMemoizeOptions:_=[]}=h,T=HC(y),A=HC(_),w=L4(o),R=v(function(){return l++,f.apply(null,arguments)},...T),I=E(function(){s++;const N=z4(w,arguments);return c=R.apply(null,N),c},...A);return Object.assign(I,{resultFunc:f,memoizedResultFunc:R,dependencies:w,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>c,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:v,argsMemoize:E})};return Object.assign(r,{withTypes:()=>r}),r}var Y=H4(gP),V4=Object.assign((e,t=Y)=>{k4(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(l=>e[l]);return t(r,(...l)=>l.reduce((s,c,d)=>(s[n[d]]=c,s),{}))},{withTypes:()=>V4}),fv={},dv={},pv={},FC;function F4(){return FC||(FC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,o,l)=>{if(r!==o){const s=t(r),c=t(o);if(s===c&&s===0){if(ro)return l==="desc"?-1:1}return l==="desc"?c-s:s-c}return 0};e.compareValues=n})(pv)),pv}var hv={},mv={},$C;function yP(){return $C||($C=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(mv)),mv}var YC;function $4(){return YC||(YC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yP(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function o(l,s){return Array.isArray(l)?!1:typeof l=="number"||typeof l=="boolean"||l==null||t.isSymbol(l)?!0:typeof l=="string"&&(r.test(l)||!n.test(l))||s!=null&&Object.hasOwn(s,l)}e.isKey=o})(hv)),hv}var KC;function Y4(){return KC||(KC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=F4(),n=$4(),r=Uy();function o(l,s,c,d){if(l==null)return[];c=d?void 0:c,Array.isArray(l)||(l=Object.values(l)),Array.isArray(s)||(s=s==null?[null]:[s]),s.length===0&&(s=[null]),Array.isArray(c)||(c=c==null?[]:[c]),c=c.map(E=>String(E));const f=(E,_)=>{let T=E;for(let A=0;A<_.length&&T!=null;++A)T=T[_[A]];return T},h=(E,_)=>_==null||E==null?_:typeof E=="object"&&"key"in E?Object.hasOwn(_,E.key)?_[E.key]:f(_,E.path):typeof E=="function"?E(_):Array.isArray(E)?f(_,E):typeof _=="object"?_[E]:_,v=s.map(E=>(Array.isArray(E)&&E.length===1&&(E=E[0]),E==null||typeof E=="function"||Array.isArray(E)||n.isKey(E)?E:{key:E,path:r.toPath(E)}));return l.map(E=>({original:E,criteria:v.map(_=>h(_,E))})).slice().sort((E,_)=>{for(let T=0;TE.original)}e.orderBy=o})(dv)),dv}var vv={},JC;function K4(){return JC||(JC=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const o=[],l=Math.floor(r),s=(c,d)=>{for(let f=0;f1&&r.isIterateeCall(l,s[0],s[1])?s=[]:c>2&&r.isIterateeCall(s[0],s[1],s[2])&&(s=[s[0]]),t.orderBy(l,n.flatten(s),["asc"])}e.sortBy=o})(fv)),fv}var yv,WC;function j4(){return WC||(WC=1,yv=J4().sortBy),yv}var X4=j4();const fd=Ir(X4);var bP=e=>e.legend.settings,W4=e=>e.legend.size,Z4=e=>e.legend.payload;Y([Z4,bP],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?fd(r,n):r});var Pc=1;function Q4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=x.useState({height:0,left:0,top:0,width:0}),r=x.useCallback(o=>{if(o!=null){var l=o.getBoundingClientRect(),s={height:l.height,left:l.left,top:l.top,width:l.width};(Math.abs(s.height-t.height)>Pc||Math.abs(s.left-t.left)>Pc||Math.abs(s.top-t.top)>Pc||Math.abs(s.width-t.width)>Pc)&&n({height:s.height,left:s.left,top:s.top,width:s.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function $t(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var eF=typeof Symbol=="function"&&Symbol.observable||"@@observable",ZC=eF,Sv=()=>Math.random().toString(36).substring(7).split("").join("."),tF={INIT:`@@redux/INIT${Sv()}`,REPLACE:`@@redux/REPLACE${Sv()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Sv()}`},ff=tF;function Vy(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function EP(e,t,n){if(typeof e!="function")throw new Error($t(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error($t(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error($t(1));return n(EP)(e,t)}let r=e,o=t,l=new Map,s=l,c=0,d=!1;function f(){s===l&&(s=new Map,l.forEach((A,w)=>{s.set(w,A)}))}function h(){if(d)throw new Error($t(3));return o}function v(A){if(typeof A!="function")throw new Error($t(4));if(d)throw new Error($t(5));let w=!0;f();const R=c++;return s.set(R,A),function(){if(w){if(d)throw new Error($t(6));w=!1,f(),s.delete(R),l=null}}}function y(A){if(!Vy(A))throw new Error($t(7));if(typeof A.type>"u")throw new Error($t(8));if(typeof A.type!="string")throw new Error($t(17));if(d)throw new Error($t(9));try{d=!0,o=r(o,A)}finally{d=!1}return(l=s).forEach(R=>{R()}),A}function E(A){if(typeof A!="function")throw new Error($t(10));r=A,y({type:ff.REPLACE})}function _(){const A=v;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error($t(11));function R(){const P=w;P.next&&P.next(h())}return R(),{unsubscribe:A(R)}},[ZC](){return this}}}return y({type:ff.INIT}),{dispatch:y,subscribe:v,getState:h,replaceReducer:E,[ZC]:_}}function nF(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:ff.INIT})>"u")throw new Error($t(12));if(typeof n(void 0,{type:ff.PROBE_UNKNOWN_ACTION()})>"u")throw new Error($t(13))})}function _P(e){const t=Object.keys(e),n={};for(let l=0;l"u")throw c&&c.type,new Error($t(14));f[v]=_,d=d||_!==E}return d=d||r.length!==Object.keys(s).length,d?f:s}}function df(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function rF(...e){return t=>(n,r)=>{const o=t(n,r);let l=()=>{throw new Error($t(15))};const s={getState:o.getState,dispatch:(d,...f)=>l(d,...f)},c=e.map(d=>d(s));return l=df(...c)(o.dispatch),{...o,dispatch:l}}}function TP(e){return Vy(e)&&"type"in e&&typeof e.type=="string"}var AP=Symbol.for("immer-nothing"),QC=Symbol.for("immer-draftable"),ln=Symbol.for("immer-state");function or(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var On=Object,Ja=On.getPrototypeOf,pf="constructor",dd="prototype",wg="configurable",hf="enumerable",Jc="writable",ws="value",oi=e=>!!e&&!!e[ln];function pr(e){var t;return e?CP(e)||hd(e)||!!e[QC]||!!((t=e[pf])!=null&&t[QC])||md(e)||vd(e):!1}var iF=On[dd][pf].toString(),ex=new WeakMap;function CP(e){if(!e||!Fy(e))return!1;const t=Ja(e);if(t===null||t===On[dd])return!0;const n=On.hasOwnProperty.call(t,pf)&&t[pf];if(n===Object)return!0;if(!La(n))return!1;let r=ex.get(n);return r===void 0&&(r=Function.toString.call(n),ex.set(n,r)),r===iF}function pd(e,t,n=!0){Vs(e)===0?(n?Reflect.ownKeys(e):On.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((r,o)=>t(o,r,e))}function Vs(e){const t=e[ln];return t?t.type_:hd(e)?1:md(e)?2:vd(e)?3:0}var tx=(e,t,n=Vs(e))=>n===2?e.has(t):On[dd].hasOwnProperty.call(e,t),Mg=(e,t,n=Vs(e))=>n===2?e.get(t):e[t],mf=(e,t,n,r=Vs(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function oF(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var hd=Array.isArray,md=e=>e instanceof Map,vd=e=>e instanceof Set,Fy=e=>typeof e=="object",La=e=>typeof e=="function",bv=e=>typeof e=="boolean";function aF(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Zr=e=>e.copy_||e.base_,$y=e=>e.modified_?e.copy_:e.base_;function Ig(e,t){if(md(e))return new Map(e);if(vd(e))return new Set(e);if(hd(e))return Array[dd].slice.call(e);const n=CP(e);if(t===!0||t==="class_only"&&!n){const r=On.getOwnPropertyDescriptors(e);delete r[ln];let o=Reflect.ownKeys(r);for(let l=0;l1&&On.defineProperties(e,{set:Rc,add:Rc,clear:Rc,delete:Rc}),On.freeze(e),t&&pd(e,(n,r)=>{Yy(r,!0)},!1)),e}function lF(){or(2)}var Rc={[ws]:lF};function gd(e){return e===null||!Fy(e)?!0:On.isFrozen(e)}var vf="MapSet",Pg="Patches",nx="ArrayMethods",xP={};function Lo(e){const t=xP[e];return t||or(0,e),t}var rx=e=>!!xP[e],Ms,wP=()=>Ms,sF=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:rx(vf)?Lo(vf):void 0,arrayMethodsPlugin_:rx(nx)?Lo(nx):void 0});function ix(e,t){t&&(e.patchPlugin_=Lo(Pg),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rg(e){Og(e),e.drafts_.forEach(uF),e.drafts_=null}function Og(e){e===Ms&&(Ms=e.parent_)}var ox=e=>Ms=sF(Ms,e);function uF(e){const t=e[ln];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ax(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[ln].modified_&&(Rg(t),or(4)),pr(e)&&(e=lx(t,e));const{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(n[ln].base_,e,t)}else e=lx(t,n);return cF(t,e,!0),Rg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==AP?e:void 0}function lx(e,t){if(gd(t))return t;const n=t[ln];if(!n)return gf(t,e.handledSet_,e);if(!yd(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);PP(n,e)}return n.copy_}function cF(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Yy(t,n)}function MP(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var yd=(e,t)=>e.scope_===t,fF=[];function IP(e,t,n,r){const o=Zr(e),l=e.type_;if(r!==void 0&&Mg(o,r,l)===t){mf(o,r,n,l);return}if(!e.draftLocations_){const c=e.draftLocations_=new Map;pd(o,(d,f)=>{if(oi(f)){const h=c.get(f)||[];h.push(d),c.set(f,h)}})}const s=e.draftLocations_.get(t)??fF;for(const c of s)mf(o,c,n,l)}function dF(e,t,n){e.callbacks_.push(function(o){var c;const l=t;if(!l||!yd(l,o))return;(c=o.mapSetPlugin_)==null||c.fixSetContents(l);const s=$y(l);IP(e,l.draft_??l,s,n),PP(l,o)})}function PP(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:o}=t;if(o){const l=o.getPath(e);l&&o.generatePatches_(e,l,t)}MP(e)}}function pF(e,t,n){const{scope_:r}=e;if(oi(n)){const o=n[ln];yd(o,r)&&o.callbacks_.push(function(){jc(e);const s=$y(o);IP(e,n,s,t)})}else pr(n)&&e.callbacks_.push(function(){const l=Zr(e);e.type_===3?l.has(n)&&gf(n,r.handledSet_,r):Mg(l,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&gf(Mg(e.copy_,t,e.type_),r.handledSet_,r)})}function gf(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||oi(e)||t.has(e)||!pr(e)||gd(e)||(t.add(e),pd(e,(r,o)=>{if(oi(o)){const l=o[ln];if(yd(l,n)){const s=$y(l);mf(e,r,s,e.type_),MP(l)}}else pr(o)&&gf(o,t,n)})),e}function hF(e,t){const n=hd(e),r={type_:n?1:0,scope_:t?t.scope_:wP(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,l=yf;n&&(o=[r],l=Is);const{revoke:s,proxy:c}=Proxy.revocable(o,l);return r.draft_=c,r.revoke_=s,[c,r]}var yf={get(e,t){if(t===ln)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const o=Zr(e);if(!tx(o,t,e.type_))return mF(e,o,t);const l=o[t];if(e.finalized_||!pr(l)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&aF(t))return l;if(l===Ev(e.base_,t)){jc(e);const s=e.type_===1?+t:t,c=Dg(e.scope_,l,e,s);return e.copy_[s]=c}return l},has(e,t){return t in Zr(e)},ownKeys(e){return Reflect.ownKeys(Zr(e))},set(e,t,n){const r=RP(Zr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Ev(Zr(e),t),l=o==null?void 0:o[ln];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(oF(n,o)&&(n!==void 0||tx(e.base_,t,e.type_)))return!0;jc(e),Ng(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),pF(e,t,n)),!0},deleteProperty(e,t){return jc(e),Ev(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ng(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Zr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Jc]:!0,[wg]:e.type_!==1||t!=="length",[hf]:r[hf],[ws]:n[t]}},defineProperty(){or(11)},getPrototypeOf(e){return Ja(e.base_)},setPrototypeOf(){or(12)}},Is={};for(let e in yf){let t=yf[e];Is[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Is.deleteProperty=function(e,t){return Is.set.call(this,e,t,void 0)};Is.set=function(e,t,n){return yf.set.call(this,e[0],t,n,e[0])};function Ev(e,t){const n=e[ln];return(n?Zr(n):e)[t]}function mF(e,t,n){var o;const r=RP(t,n);return r?ws in r?r[ws]:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function RP(e,t){if(!(t in e))return;let n=Ja(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ja(n)}}function Ng(e){e.modified_||(e.modified_=!0,e.parent_&&Ng(e.parent_))}function jc(e){e.copy_||(e.assigned_=new Map,e.copy_=Ig(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var vF=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,o)=>{if(La(n)&&!La(r)){const s=r;r=n;const c=this;return function(f=s,...h){return c.produce(f,v=>r.call(this,v,...h))}}La(r)||or(6),o!==void 0&&!La(o)&&or(7);let l;if(pr(n)){const s=ox(this),c=Dg(s,n,void 0);let d=!0;try{l=r(c),d=!1}finally{d?Rg(s):Og(s)}return ix(s,o),ax(l,s)}else if(!n||!Fy(n)){if(l=r(n),l===void 0&&(l=n),l===AP&&(l=void 0),this.autoFreeze_&&Yy(l,!0),o){const s=[],c=[];Lo(Pg).generateReplacementPatches_(n,l,{patches_:s,inversePatches_:c}),o(s,c)}return l}else or(1,n)},this.produceWithPatches=(n,r)=>{if(La(n))return(c,...d)=>this.produceWithPatches(c,f=>n(f,...d));let o,l;return[this.produce(n,r,(c,d)=>{o=c,l=d}),o,l]},bv(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),bv(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),bv(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){pr(t)||or(8),oi(t)&&(t=cr(t));const n=ox(this),r=Dg(n,t,void 0);return r[ln].isManual_=!0,Og(n),r}finishDraft(t,n){const r=t&&t[ln];(!r||!r.isManual_)&&or(9);const{scope_:o}=r;return ix(o,n),ax(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const l=n[r];if(l.path.length===0&&l.op==="replace"){t=l.value;break}}r>-1&&(n=n.slice(r+1));const o=Lo(Pg).applyPatches_;return oi(t)?o(t,n):this.produce(t,l=>o(l,n))}};function Dg(e,t,n,r){const[o,l]=md(t)?Lo(vf).proxyMap_(t,n):vd(t)?Lo(vf).proxySet_(t,n):hF(t,n);return((n==null?void 0:n.scope_)??wP()).drafts_.push(o),l.callbacks_=(n==null?void 0:n.callbacks_)??[],l.key_=r,n&&r!==void 0?dF(n,l,r):l.callbacks_.push(function(d){var h;(h=d.mapSetPlugin_)==null||h.fixSetContents(l);const{patchPlugin_:f}=d;l.modified_&&f&&f.generatePatches_(l,[],d)}),o}function cr(e){return oi(e)||or(10,e),OP(e)}function OP(e){if(!pr(e)||gd(e))return e;const t=e[ln];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ig(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Ig(e,!0);return pd(n,(o,l)=>{mf(n,o,OP(l))},r),t&&(t.finalized_=!1),n}var gF=new vF,NP=gF.produce;function DP(e){return({dispatch:n,getState:r})=>o=>l=>typeof l=="function"?l(n,r,e):o(l)}var yF=DP(),SF=DP,bF=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?df:df.apply(null,arguments)};function Zn(e,t){function n(...r){if(t){let o=t(...r);if(!o)throw new Error(Nn(0));return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>TP(r)&&r.type===e,n}var kP=class bs extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,bs.prototype)}static get[Symbol.species](){return bs}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new bs(...t[0].concat(this)):new bs(...t.concat(this))}};function sx(e){return pr(e)?NP(e,()=>{}):e}function Oc(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function EF(e){return typeof e=="boolean"}var _F=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:o=!0,actionCreatorCheck:l=!0}=t??{};let s=new kP;return n&&(EF(n)?s.push(yF):s.push(SF(n.extraArgument))),s},UP="RTK_autoBatch",it=()=>e=>({payload:e,meta:{[UP]:!0}}),ux=e=>t=>{setTimeout(t,e)},LP=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,l=!1,s=!1;const c=new Set,d=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:ux(10):e.type==="callback"?e.queueNotification:ux(e.timeout),f=()=>{s=!1,l&&(l=!1,c.forEach(h=>h()))};return Object.assign({},r,{subscribe(h){const v=()=>o&&h(),y=r.subscribe(v);return c.add(h),()=>{y(),c.delete(h)}},dispatch(h){var v;try{return o=!((v=h==null?void 0:h.meta)!=null&&v[UP]),l=!o,l&&(s||(s=!0,d(f))),r.dispatch(h)}finally{o=!0}}})},TF=e=>function(n){const{autoBatch:r=!0}=n??{};let o=new kP(e);return r&&o.push(LP(typeof r=="object"?r:void 0)),o};function AF(e){const t=_F(),{reducer:n=void 0,middleware:r,devTools:o=!0,preloadedState:l=void 0,enhancers:s=void 0}=e||{};let c;if(typeof n=="function")c=n;else if(Vy(n))c=_P(n);else throw new Error(Nn(1));let d;typeof r=="function"?d=r(t):d=t();let f=df;o&&(f=bF({trace:!1,...typeof o=="object"&&o}));const h=rF(...d),v=TF(h);let y=typeof s=="function"?s(v):v();const E=f(...y);return EP(c,l,E)}function zP(e){const t={},n=[];let r;const o={addCase(l,s){const c=typeof l=="string"?l:l.type;if(!c)throw new Error(Nn(28));if(c in t)throw new Error(Nn(29));return t[c]=s,o},addAsyncThunk(l,s){return s.pending&&(t[l.pending.type]=s.pending),s.rejected&&(t[l.rejected.type]=s.rejected),s.fulfilled&&(t[l.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:l.settled,reducer:s.settled}),o},addMatcher(l,s){return n.push({matcher:l,reducer:s}),o},addDefaultCase(l){return r=l,o}};return e(o),[t,n,r]}function CF(e){return typeof e=="function"}function xF(e,t){let[n,r,o]=zP(t),l;if(CF(e))l=()=>sx(e());else{const c=sx(e);l=()=>c}function s(c=l(),d){let f=[n[d.type],...r.filter(({matcher:h})=>h(d)).map(({reducer:h})=>h)];return f.filter(h=>!!h).length===0&&(f=[o]),f.reduce((h,v)=>{if(v)if(oi(h)){const E=v(h,d);return E===void 0?h:E}else{if(pr(h))return NP(h,y=>v(y,d));{const y=v(h,d);if(y===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return y}}return h},c)}return s.getInitialState=l,s}var wF="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",MF=(e=21)=>{let t="",n=e;for(;n--;)t+=wF[Math.random()*64|0];return t},IF=Symbol.for("rtk-slice-createasyncthunk");function PF(e,t){return`${e}/${t}`}function RF({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[IF];return function(o){const{name:l,reducerPath:s=l}=o;if(!l)throw new Error(Nn(11));const c=(typeof o.reducers=="function"?o.reducers(NF()):o.reducers)||{},d=Object.keys(c),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},h={addCase(P,N){const O=typeof P=="string"?P:P.type;if(!O)throw new Error(Nn(12));if(O in f.sliceCaseReducersByType)throw new Error(Nn(13));return f.sliceCaseReducersByType[O]=N,h},addMatcher(P,N){return f.sliceMatchers.push({matcher:P,reducer:N}),h},exposeAction(P,N){return f.actionCreators[P]=N,h},exposeCaseReducer(P,N){return f.sliceCaseReducersByName[P]=N,h}};d.forEach(P=>{const N=c[P],O={reducerName:P,type:PF(l,P),createNotation:typeof o.reducers=="function"};kF(N)?LF(O,N,h,t):DF(O,N,h)});function v(){const[P={},N=[],O=void 0]=typeof o.extraReducers=="function"?zP(o.extraReducers):[o.extraReducers],D={...P,...f.sliceCaseReducersByType};return xF(o.initialState,G=>{for(let B in D)G.addCase(B,D[B]);for(let B of f.sliceMatchers)G.addMatcher(B.matcher,B.reducer);for(let B of N)G.addMatcher(B.matcher,B.reducer);O&&G.addDefaultCase(O)})}const y=P=>P,E=new Map,_=new WeakMap;let T;function A(P,N){return T||(T=v()),T(P,N)}function w(){return T||(T=v()),T.getInitialState()}function R(P,N=!1){function O(G){let B=G[P];return typeof B>"u"&&N&&(B=Oc(_,O,w)),B}function D(G=y){const B=Oc(E,N,()=>new WeakMap);return Oc(B,G,()=>{const Q={};for(const[te,$]of Object.entries(o.selectors??{}))Q[te]=OF($,G,()=>Oc(_,G,w),N);return Q})}return{reducerPath:P,getSelectors:D,get selectors(){return D(O)},selectSlice:O}}const I={name:l,reducer:A,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...R(s),injectInto(P,{reducerPath:N,...O}={}){const D=N??s;return P.inject({reducerPath:D,reducer:A},O),{...I,...R(D,!0)}}};return I}}function OF(e,t,n,r){function o(l,...s){let c=t(l);return typeof c>"u"&&r&&(c=n()),e(c,...s)}return o.unwrapped=e,o}var bn=RF();function NF(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function DF({type:e,reducerName:t,createNotation:n},r,o){let l,s;if("reducer"in r){if(n&&!UF(r))throw new Error(Nn(17));l=r.reducer,s=r.prepare}else l=r;o.addCase(e,l).exposeCaseReducer(t,l).exposeAction(t,s?Zn(e,s):Zn(e))}function kF(e){return e._reducerDefinitionType==="asyncThunk"}function UF(e){return e._reducerDefinitionType==="reducerWithPrepare"}function LF({type:e,reducerName:t},n,r,o){if(!o)throw new Error(Nn(18));const{payloadCreator:l,fulfilled:s,pending:c,rejected:d,settled:f,options:h}=n,v=o(e,l,h);r.exposeAction(t,v),s&&r.addCase(v.fulfilled,s),c&&r.addCase(v.pending,c),d&&r.addCase(v.rejected,d),f&&r.addMatcher(v.settled,f),r.exposeCaseReducer(t,{fulfilled:s||Nc,pending:c||Nc,rejected:d||Nc,settled:f||Nc})}function Nc(){}var zF="task",BP="listener",qP="completed",Ky="cancelled",BF=`task-${Ky}`,qF=`task-${qP}`,kg=`${BP}-${Ky}`,GF=`${BP}-${qP}`,Sd=class{constructor(e){hm(this,"name","TaskAbortError");hm(this,"message");this.code=e,this.message=`${zF} ${Ky} (reason: ${e})`}},Jy=(e,t)=>{if(typeof e!="function")throw new TypeError(Nn(32))},Sf=()=>{},GP=(e,t=Sf)=>(e.catch(t),e),HP=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ro=e=>{if(e.aborted)throw new Sd(e.reason)};function VP(e,t){let n=Sf;return new Promise((r,o)=>{const l=()=>o(new Sd(e.reason));if(e.aborted){l();return}n=HP(e,l),t.finally(()=>n()).then(r,o)}).finally(()=>{n=Sf})}var HF=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Sd?"cancelled":"rejected",error:n}}finally{t==null||t()}},bf=e=>t=>GP(VP(e,t).then(n=>(Ro(e),n))),FP=e=>{const t=bf(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:$a}=Object,cx={},bd="listenerMiddleware",VF=(e,t)=>{const n=r=>HP(e,()=>r.abort(e.reason));return(r,o)=>{Jy(r);const l=new AbortController;n(l);const s=HF(async()=>{Ro(e),Ro(l.signal);const c=await r({pause:bf(l.signal),delay:FP(l.signal),signal:l.signal});return Ro(l.signal),c},()=>l.abort(qF));return o!=null&&o.autoJoin&&t.push(s.catch(Sf)),{result:bf(e)(s),cancel(){l.abort(BF)}}}},FF=(e,t)=>{const n=async(r,o)=>{Ro(t);let l=()=>{};const c=[new Promise((d,f)=>{let h=e({predicate:r,effect:(v,y)=>{y.unsubscribe(),d([v,y.getState(),y.getOriginalState()])}});l=()=>{h(),f()}})];o!=null&&c.push(new Promise(d=>setTimeout(d,o,null)));try{const d=await VP(t,Promise.race(c));return Ro(t),d}finally{l()}};return(r,o)=>GP(n(r,o))},$P=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:l}=e;if(t)o=Zn(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(Nn(21));return Jy(l),{predicate:o,type:t,effect:l}},YP=$a(e=>{const{type:t,predicate:n,effect:r}=$P(e);return{id:MF(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Nn(22))}}},{withTypes:()=>YP}),fx=(e,t)=>{const{type:n,effect:r,predicate:o}=$P(t);return Array.from(e.values()).find(l=>(typeof n=="string"?l.type===n:l.predicate===o)&&l.effect===r)},Ug=e=>{e.pending.forEach(t=>{t.abort(kg)})},$F=(e,t)=>()=>{for(const n of t.keys())Ug(n);e.clear()},dx=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},KP=$a(Zn(`${bd}/add`),{withTypes:()=>KP}),YF=Zn(`${bd}/removeAll`),JP=$a(Zn(`${bd}/remove`),{withTypes:()=>JP}),KF=(...e)=>{console.error(`${bd}/error`,...e)},Fs=(e={})=>{const t=new Map,n=new Map,r=E=>{const _=n.get(E)??0;n.set(E,_+1)},o=E=>{const _=n.get(E)??1;_===1?n.delete(E):n.set(E,_-1)},{extra:l,onError:s=KF}=e;Jy(s);const c=E=>(E.unsubscribe=()=>t.delete(E.id),t.set(E.id,E),_=>{E.unsubscribe(),_!=null&&_.cancelActive&&Ug(E)}),d=E=>{const _=fx(t,E)??YP(E);return c(_)};$a(d,{withTypes:()=>d});const f=E=>{const _=fx(t,E);return _&&(_.unsubscribe(),E.cancelActive&&Ug(_)),!!_};$a(f,{withTypes:()=>f});const h=async(E,_,T,A)=>{const w=new AbortController,R=FF(d,w.signal),I=[];try{E.pending.add(w),r(E),await Promise.resolve(E.effect(_,$a({},T,{getOriginalState:A,condition:(P,N)=>R(P,N).then(Boolean),take:R,delay:FP(w.signal),pause:bf(w.signal),extra:l,signal:w.signal,fork:VF(w.signal,I),unsubscribe:E.unsubscribe,subscribe:()=>{t.set(E.id,E)},cancelActiveListeners:()=>{E.pending.forEach((P,N,O)=>{P!==w&&(P.abort(kg),O.delete(P))})},cancel:()=>{w.abort(kg),E.pending.delete(w)},throwIfCancelled:()=>{Ro(w.signal)}})))}catch(P){P instanceof Sd||dx(s,P,{raisedBy:"effect"})}finally{await Promise.all(I),w.abort(GF),o(E),E.pending.delete(w)}},v=$F(t,n);return{middleware:E=>_=>T=>{if(!TP(T))return _(T);if(KP.match(T))return d(T.payload);if(YF.match(T)){v();return}if(JP.match(T))return f(T.payload);let A=E.getState();const w=()=>{if(A===cx)throw new Error(Nn(23));return A};let R;try{if(R=_(T),t.size>0){const I=E.getState(),P=Array.from(t.values());for(const N of P){let O=!1;try{O=N.predicate(T,I,A)}catch(D){O=!1,dx(s,D,{raisedBy:"predicate"})}O&&h(N,T,E,w)}}}finally{A=cx}return R},startListening:d,stopListening:f,clearListeners:v}};function Nn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var JF={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},jP=bn({name:"chartLayout",initialState:JF,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,o,l;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(o=t.payload.bottom)!==null&&o!==void 0?o:0,e.margin.left=(l=t.payload.left)!==null&&l!==void 0?l:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:jF,setLayout:XF,setChartSize:WF,setScale:ZF}=jP.actions,QF=jP.reducer;function XP(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Me(e){return Number.isFinite(e)}function wr(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function px(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function qa(e){for(var t=1;t{if(t&&n){var{width:r,height:o}=n,{align:l,verticalAlign:s,layout:c}=t;if((c==="vertical"||c==="horizontal"&&s==="middle")&&l!=="center"&&ce(e[l]))return qa(qa({},e),{},{[l]:e[l]+(r||0)});if((c==="horizontal"||c==="vertical"&&l==="center")&&s!=="middle"&&ce(e[s]))return qa(qa({},e),{},{[s]:e[s]+(o||0)})}return e},Pr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",WP=(e,t,n,r)=>{if(r)return e.map(c=>c.coordinate);var o,l,s=e.map(c=>(c.coordinate===t&&(o=!0),c.coordinate===n&&(l=!0),c.coordinate));return o||s.push(t),l||s.push(n),s},ZP=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:o,range:l,scale:s,realScaleType:c,isCategorical:d,categoricalDomain:f,tickCount:h,ticks:v,niceTicks:y,axisType:E}=e;if(!s)return null;var _=c==="scaleBand"&&s.bandwidth?s.bandwidth()/2:2,T=o==="category"&&s.bandwidth?s.bandwidth()/_:0;if(T=E==="angleAxis"&&l&&l.length>=2?gn(l[0]-l[1])*2*T:T,v||y){var A=(v||y||[]).map((w,R)=>{var I=r?r.indexOf(w):w,P=s.map(I);return Me(P)?{coordinate:P+T,value:w,offset:T,index:R}:null}).filter(yn);return A}return d&&f?f.map((w,R)=>{var I=s.map(w);return Me(I)?{coordinate:I+T,value:w,index:R,offset:T}:null}).filter(yn):s.ticks&&h!=null?s.ticks(h).map((w,R)=>{var I=s.map(w);return Me(I)?{coordinate:I+T,value:w,index:R,offset:T}:null}).filter(yn):s.domain().map((w,R)=>{var I=s.map(w);return Me(I)?{coordinate:I+T,value:r?r[w]:w,index:R,offset:T}:null}).filter(yn)},i6=(e,t)=>{if(!t||t.length!==2||!ce(t[0])||!ce(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),o=[e[0],e[1]];return(!ce(e[0])||e[0]r)&&(o[1]=r),o[0]>r&&(o[0]=r),o[1]{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var o=0;o=0?(f[0]=l,l+=y,f[1]=l):(f[0]=s,s+=y,f[1]=s)}}}},a6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var o=0;o=0?(d[0]=l,l+=f,d[1]=l):(d[0]=0,d[1]=0)}}}},l6={sign:o6,expand:kV,none:ko,silhouette:UV,wiggle:LV,positive:a6},s6=(e,t,n)=>{var r,o=(r=l6[n])!==null&&r!==void 0?r:ko,l=DV().keys(t).value((c,d)=>Number(St(c,d,0))).order(Cg).offset(o),s=l(e);return s.forEach((c,d)=>{c.forEach((f,h)=>{var v=St(e[h],t[d],0);Array.isArray(v)&&v.length===2&&ce(v[0])&&ce(v[1])&&(f[0]=v[0],f[1]=v[1])})}),s};function QP(e){return e==null?void 0:String(e)}function hx(e){var{axis:t,ticks:n,bandSize:r,entry:o,index:l,dataKey:s}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ft(o[t.dataKey])){var c=oP(n,"value",o[t.dataKey]);if(c)return c.coordinate+r/2}return n!=null&&n[l]?n[l].coordinate+r/2:null}var d=St(o,ft(s)?t.dataKey:s),f=t.scale.map(d);return ce(f)?f:null}var mx=e=>{var{axis:t,ticks:n,offset:r,bandSize:o,entry:l,index:s}=e;if(t.type==="category")return n[s]?n[s].coordinate+r:null;var c=St(l,t.dataKey,t.scale.domain()[s]);if(ft(c))return null;var d=t.scale.map(c);return ce(d)?d-o/2+r:null},u6=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type==="number"){var r=Math.min(n[0],n[1]),o=Math.max(n[0],n[1]);return r<=0&&o>=0?0:o<0?o:r}return n[0]},c6=e=>{var t=e.flat(2).filter(ce);return[Math.min(...t),Math.max(...t)]},f6=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],d6=(e,t,n)=>{if(e!=null)return f6(Object.keys(e).reduce((r,o)=>{var l=e[o];if(!l)return r;var{stackedData:s}=l,c=s.reduce((d,f)=>{var h=XP(f,t,n),v=c6(h);return!Me(v[0])||!Me(v[1])?d:[Math.min(d[0],v[0]),Math.max(d[1],v[1])]},[1/0,-1/0]);return[Math.min(c[0],r[0]),Math.max(c[1],r[1])]},[1/0,-1/0]))},vx=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gx=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ja=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var o=fd(t,h=>h.coordinate),l=1/0,s=1,c=o.length;s{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},h6=(e,t)=>t==="centric"?e.angle:e.radius,hi=e=>e.layout.width,mi=e=>e.layout.height,m6=e=>e.layout.scale,eR=e=>e.layout.margin,_d=Y(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Td=Y(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),v6="data-recharts-item-index",g6="data-recharts-item-id",$s=60;function Sx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Dc(e){for(var t=1;te.brush.height;function _6(e){var t=Td(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var o=typeof r.width=="number"?r.width:$s;return n+o}return n},0)}function T6(e){var t=Td(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var o=typeof r.width=="number"?r.width:$s;return n+o}return n},0)}function A6(e){var t=_d(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function C6(e){var t=_d(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Nt=Y([hi,mi,eR,E6,_6,T6,A6,C6,bP,W4],(e,t,n,r,o,l,s,c,d,f)=>{var h={left:(n.left||0)+o,right:(n.right||0)+l},v={top:(n.top||0)+s,bottom:(n.bottom||0)+c},y=Dc(Dc({},v),h),E=y.bottom;y.bottom+=r,y=r6(y,d,f);var _=e-y.left-y.right,T=t-y.top-y.bottom;return Dc(Dc({brushBottom:E},y),{},{width:Math.max(_,0),height:Math.max(T,0)})}),x6=Y(Nt,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),jy=Y(hi,mi,(e,t)=>({x:0,y:0,width:e,height:t})),w6=x.createContext(null),Zt=()=>x.useContext(w6)!=null,Ad=e=>e.brush,Cd=Y([Ad,Nt,eR],(e,t,n)=>({height:e.height,x:ce(e.x)?e.x:t.left,y:ce(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ce(e.width)?e.width:t.width})),_v={},Tv={},Av={},bx;function M6(){return bx||(bx=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:o,edges:l}={}){let s,c=null;const d=l!=null&&l.includes("leading"),f=l==null||l.includes("trailing"),h=()=>{c!==null&&(n.apply(s,c),s=void 0,c=null)},v=()=>{f&&h(),T()};let y=null;const E=()=>{y!=null&&clearTimeout(y),y=setTimeout(()=>{y=null,v()},r)},_=()=>{y!==null&&(clearTimeout(y),y=null)},T=()=>{_(),s=void 0,c=null},A=()=>{h()},w=function(...R){if(o!=null&&o.aborted)return;s=this,c=R;const I=y==null;E(),d&&I&&h()};return w.schedule=E,w.cancel=T,w.flush=A,o==null||o.addEventListener("abort",T,{once:!0}),w}e.debounce=t})(Av)),Av}var Ex;function I6(){return Ex||(Ex=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=M6();function n(r,o=0,l={}){typeof l!="object"&&(l={});const{leading:s=!1,trailing:c=!0,maxWait:d}=l,f=Array(2);s&&(f[0]="leading"),c&&(f[1]="trailing");let h,v=null;const y=t.debounce(function(...T){h=r.apply(this,T),v=null},o,{edges:f}),E=function(...T){return d!=null&&(v===null&&(v=Date.now()),Date.now()-v>=d)?(h=r.apply(this,T),v=Date.now(),y.cancel(),y.schedule(),h):(y.apply(this,T),h)},_=()=>(y.flush(),h);return E.cancel=y.cancel,E.flush=_,E}e.debounce=n})(Tv)),Tv}var _x;function P6(){return _x||(_x=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=I6();function n(r,o=0,l={}){const{leading:s=!0,trailing:c=!0}=l;return t.debounce(r,o,{leading:s,maxWait:o,trailing:c})}e.throttle=n})(_v)),_v}var Cv,Tx;function R6(){return Tx||(Tx=1,Cv=P6().throttle),Cv}var O6=R6();const N6=Ir(O6);var Ef=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),l=2;lo[s++]))}},Tr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},tR=(e,t,n)=>{var{width:r=Tr.width,height:o=Tr.height,aspect:l,maxHeight:s}=n,c=Uo(r)?e:Number(r),d=Uo(o)?t:Number(o);return l&&l>0&&(c?d=c/l:d&&(c=d*l),s&&d!=null&&d>s&&(d=s)),{calculatedWidth:c,calculatedHeight:d}},D6={width:0,height:0,overflow:"visible"},k6={width:0,overflowX:"visible"},U6={height:0,overflowY:"visible"},L6={},z6=e=>{var{width:t,height:n}=e,r=Uo(t),o=Uo(n);return r&&o?D6:r?k6:o?U6:L6};function B6(e){var{width:t,height:n,aspect:r}=e,o=t,l=n;return o===void 0&&l===void 0?(o=Tr.width,l=Tr.height):o===void 0?o=r&&r>0?void 0:Tr.width:l===void 0&&(l=r&&r>0?void 0:Tr.height),{width:o,height:l}}function Lg(){return Lg=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return V6(o)?x.createElement(nR.Provider,{value:o},t):null}var Xy=()=>x.useContext(nR),F6=x.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=Tr.initialDimension,width:o,height:l,minWidth:s=Tr.minWidth,minHeight:c,maxHeight:d,children:f,debounce:h=Tr.debounce,id:v,className:y,onResize:E,style:_={}}=e,T=x.useRef(null),A=x.useRef();A.current=E,x.useImperativeHandle(t,()=>T.current);var[w,R]=x.useState({containerWidth:r.width,containerHeight:r.height}),I=x.useCallback((G,B)=>{R(Q=>{var te=Math.round(G),$=Math.round(B);return Q.containerWidth===te&&Q.containerHeight===$?Q:{containerWidth:te,containerHeight:$}})},[]);x.useEffect(()=>{if(T.current==null||typeof ResizeObserver>"u")return Fo;var G=$=>{var oe,se=$[0];if(se!=null){var{width:ye,height:V}=se.contentRect;I(ye,V),(oe=A.current)===null||oe===void 0||oe.call(A,ye,V)}};h>0&&(G=N6(G,h,{trailing:!0,leading:!1}));var B=new ResizeObserver(G),{width:Q,height:te}=T.current.getBoundingClientRect();return I(Q,te),B.observe(T.current),()=>{B.disconnect()}},[I,h]);var{containerWidth:P,containerHeight:N}=w;Ef(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:O,calculatedHeight:D}=tR(P,N,{width:o,height:l,aspect:n,maxHeight:d});return Ef(O!=null&&O>0||D!=null&&D>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,O,D,o,l,s,c,n),x.createElement("div",{id:v?"".concat(v):void 0,className:Xe("recharts-responsive-container",y),style:Cx(Cx({},_),{},{width:o,height:l,minWidth:s,minHeight:c,maxHeight:d}),ref:T},x.createElement("div",{style:z6({width:o,height:l})},x.createElement(rR,{width:O,height:D},f)))}),xx=x.forwardRef((e,t)=>{var n=Xy();if(wr(n.width)&&wr(n.height))return e.children;var{width:r,height:o}=B6({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:l,calculatedHeight:s}=tR(void 0,void 0,{width:r,height:o,aspect:e.aspect,maxHeight:e.maxHeight});return ce(l)&&ce(s)?x.createElement(rR,{width:l,height:s},e.children):x.createElement(F6,Lg({},e,{width:r,height:o,ref:t}))});function Wy(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var xd=()=>{var e,t=Zt(),n=me(x6),r=me(Cd),o=(e=me(Ad))===null||e===void 0?void 0:e.padding;return!t||!r||!o?n:{width:r.width-o.left-o.right,height:r.height-o.top-o.bottom,x:o.left,y:o.top}},$6={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},iR=()=>{var e;return(e=me(Nt))!==null&&e!==void 0?e:$6},oR=()=>me(hi),aR=()=>me(mi),He=e=>e.layout.layoutType,$o=()=>me(He),Zy=()=>{var e=$o();if(e==="horizontal"||e==="vertical")return e},lR=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},Y6=()=>{var e=$o();return e!==void 0},Ys=e=>{var t=ht(),n=Zt(),{width:r,height:o}=e,l=Xy(),s=r,c=o;return l&&(s=l.width>0?l.width:r,c=l.height>0?l.height:o),x.useEffect(()=>{!n&&wr(s)&&wr(c)&&t(WF({width:s,height:c}))},[t,n,s,c]),null},sR=Symbol.for("immer-nothing"),wx=Symbol.for("immer-draftable"),Dn=Symbol.for("immer-state");function ar(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ps=Object.getPrototypeOf;function Xa(e){return!!e&&!!e[Dn]}function zo(e){var t;return e?uR(e)||Array.isArray(e)||!!e[wx]||!!((t=e.constructor)!=null&&t[wx])||Ks(e)||Md(e):!1}var K6=Object.prototype.constructor.toString(),Mx=new WeakMap;function uR(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Mx.get(n);return r===void 0&&(r=Function.toString.call(n),Mx.set(n,r)),r===K6}function _f(e,t,n=!0){wd(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((r,o)=>t(o,r,e))}function wd(e){const t=e[Dn];return t?t.type_:Array.isArray(e)?1:Ks(e)?2:Md(e)?3:0}function zg(e,t){return wd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function cR(e,t,n){const r=wd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function J6(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ks(e){return e instanceof Map}function Md(e){return e instanceof Set}function Co(e){return e.copy_||e.base_}function Bg(e,t){if(Ks(e))return new Map(e);if(Md(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=uR(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Dn];let o=Reflect.ownKeys(r);for(let l=0;l1&&Object.defineProperties(e,{set:kc,add:kc,clear:kc,delete:kc}),Object.freeze(e),t&&Object.values(e).forEach(n=>Qy(n,!0))),e}function j6(){ar(2)}var kc={value:j6};function Id(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var X6={};function Bo(e){const t=X6[e];return t||ar(0,e),t}var Rs;function fR(){return Rs}function W6(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ix(e,t){t&&(Bo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qg(e){Gg(e),e.drafts_.forEach(Z6),e.drafts_=null}function Gg(e){e===Rs&&(Rs=e.parent_)}function Px(e){return Rs=W6(Rs,e)}function Z6(e){const t=e[Dn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Rx(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Dn].modified_&&(qg(t),ar(4)),zo(e)&&(e=Tf(t,e),t.parent_||Af(t,e)),t.patches_&&Bo("Patches").generateReplacementPatches_(n[Dn].base_,e,t.patches_,t.inversePatches_)):e=Tf(t,n,[]),qg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sR?e:void 0}function Tf(e,t,n){if(Id(t))return t;const r=e.immer_.shouldUseStrictIteration(),o=t[Dn];if(!o)return _f(t,(l,s)=>Ox(e,o,t,l,s,n),r),t;if(o.scope_!==e)return t;if(!o.modified_)return Af(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const l=o.copy_;let s=l,c=!1;o.type_===3&&(s=new Set(l),l.clear(),c=!0),_f(s,(d,f)=>Ox(e,o,l,d,f,n,c),r),Af(e,l,!1),n&&e.patches_&&Bo("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Ox(e,t,n,r,o,l,s){if(o==null||typeof o!="object"&&!s)return;const c=Id(o);if(!(c&&!s)){if(Xa(o)){const d=l&&t&&t.type_!==3&&!zg(t.assigned_,r)?l.concat(r):void 0,f=Tf(e,o,d);if(cR(n,r,f),Xa(f))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(zo(o)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===o&&c)return;Tf(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Ks(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Af(e,o)}}}function Af(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Qy(t,n)}function Q6(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:fR(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,l=e0;n&&(o=[r],l=Os);const{revoke:s,proxy:c}=Proxy.revocable(o,l);return r.draft_=c,r.revoke_=s,c}var e0={get(e,t){if(t===Dn)return e;const n=Co(e);if(!zg(n,t))return e$(e,n,t);const r=n[t];return e.finalized_||!zo(r)?r:r===xv(e.base_,t)?(wv(e),e.copy_[t]=Vg(r,e)):r},has(e,t){return t in Co(e)},ownKeys(e){return Reflect.ownKeys(Co(e))},set(e,t,n){const r=dR(Co(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=xv(Co(e),t),l=o==null?void 0:o[Dn];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(J6(n,o)&&(n!==void 0||zg(e.base_,t)))return!0;wv(e),Hg(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return xv(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,wv(e),Hg(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Co(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){ar(11)},getPrototypeOf(e){return Ps(e.base_)},setPrototypeOf(){ar(12)}},Os={};_f(e0,(e,t)=>{Os[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Os.deleteProperty=function(e,t){return Os.set.call(this,e,t,void 0)};Os.set=function(e,t,n){return e0.set.call(this,e[0],t,n,e[0])};function xv(e,t){const n=e[Dn];return(n?Co(n):e)[t]}function e$(e,t,n){var o;const r=dR(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function dR(e,t){if(!(t in e))return;let n=Ps(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ps(n)}}function Hg(e){e.modified_||(e.modified_=!0,e.parent_&&Hg(e.parent_))}function wv(e){e.copy_||(e.copy_=Bg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var t$=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const l=n;n=t;const s=this;return function(d=l,...f){return s.produce(d,h=>n.call(this,h,...f))}}typeof n!="function"&&ar(6),r!==void 0&&typeof r!="function"&&ar(7);let o;if(zo(t)){const l=Px(this),s=Vg(t,void 0);let c=!0;try{o=n(s),c=!1}finally{c?qg(l):Gg(l)}return Ix(l,r),Rx(o,l)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===sR&&(o=void 0),this.autoFreeze_&&Qy(o,!0),r){const l=[],s=[];Bo("Patches").generateReplacementPatches_(t,o,l,s),r(l,s)}return o}else ar(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...c)=>this.produceWithPatches(s,d=>t(d,...c));let r,o;return[this.produce(t,n,(s,c)=>{r=s,o=c}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){zo(e)||ar(8),Xa(e)&&(e=n$(e));const t=Px(this),n=Vg(e,void 0);return n[Dn].isManual_=!0,Gg(t),n}finishDraft(e,t){const n=e&&e[Dn];(!n||!n.isManual_)&&ar(9);const{scope_:r}=n;return Ix(r,t),Rx(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=Bo("Patches").applyPatches_;return Xa(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Vg(e,t){const n=Ks(e)?Bo("MapSet").proxyMap_(e,t):Md(e)?Bo("MapSet").proxySet_(e,t):Q6(e,t);return(t?t.scope_:fR()).drafts_.push(n),n}function n$(e){return Xa(e)||ar(10,e),pR(e)}function pR(e){if(!zo(e)||Id(e))return e;const t=e[Dn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Bg(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Bg(e,!0);return _f(n,(o,l)=>{cR(n,o,pR(l))},r),t&&(t.finalized_=!1),n}var r$=new t$;r$.produce;var i$={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},hR=bn({name:"legend",initialState:i$,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:it()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,o=cr(e).payload.indexOf(n);o>-1&&(e.payload[o]=r)},prepare:it()},removeLegendPayload:{reducer(e,t){var n=cr(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:it()}}}),{setLegendSize:hte,setLegendSettings:mte,addLegendPayload:o$,replaceLegendPayload:a$,removeLegendPayload:l$}=hR.actions,s$=hR.reducer;function Fg(){return Fg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Oa.separator,contentStyle:n,itemStyle:r,labelStyle:o=Oa.labelStyle,payload:l,formatter:s,itemSorter:c,wrapperClassName:d,labelClassName:f,label:h,labelFormatter:v,accessibilityLayer:y=Oa.accessibilityLayer}=e,E=()=>{if(l&&l.length){var N={padding:0,margin:0},O=(c?fd(l,c):l).map((D,G)=>{if(D.type==="none")return null;var B=D.formatter||s||d$,{value:Q,name:te}=D,$=Q,oe=te;if(B){var se=B(Q,te,D,G,l);if(Array.isArray(se))[$,oe]=se;else if(se!=null)$=se;else return null}var ye=cs(cs({},Oa.itemStyle),{},{color:D.color||Oa.itemStyle.color},r);return x.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(G),style:ye},xr(oe)?x.createElement("span",{className:"recharts-tooltip-item-name"},oe):null,xr(oe)?x.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,x.createElement("span",{className:"recharts-tooltip-item-value"},$),x.createElement("span",{className:"recharts-tooltip-item-unit"},D.unit||""))});return x.createElement("ul",{className:"recharts-tooltip-item-list",style:N},O)}return null},_=cs(cs({},Oa.contentStyle),n),T=cs({margin:0},o),A=!ft(h),w=A?h:"",R=Xe("recharts-default-tooltip",d),I=Xe("recharts-tooltip-label",f);A&&v&&l!==void 0&&l!==null&&(w=v(h,l));var P=y?{role:"status","aria-live":"assertive"}:{};return x.createElement("div",Fg({className:R,style:_},P),x.createElement("p",{className:I,style:T},x.isValidElement(w)?w:"".concat(w)),E())},fs="recharts-tooltip-wrapper",h$={visibility:"hidden"};function m$(e){var{coordinate:t,translateX:n,translateY:r}=e;return Xe(fs,{["".concat(fs,"-right")]:ce(n)&&t&&ce(t.x)&&n>=t.x,["".concat(fs,"-left")]:ce(n)&&t&&ce(t.x)&&n=t.y,["".concat(fs,"-top")]:ce(r)&&t&&ce(t.y)&&r0?o:0),v=n[r]+o;if(t[r])return s[r]?h:v;var y=d[r];if(y==null)return 0;if(s[r]){var E=h,_=y;return E<_?Math.max(v,y):Math.max(h,y)}if(f==null)return 0;var T=v+c,A=y+f;return T>A?Math.max(h,y):Math.max(v,y)}function v$(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function g$(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:o,position:l,reverseDirection:s,tooltipBox:c,useTranslate3d:d,viewBox:f}=e,h,v,y;return c.height>0&&c.width>0&&n?(v=Dx({allowEscapeViewBox:t,coordinate:n,key:"x",offset:o,position:l,reverseDirection:s,tooltipDimension:c.width,viewBox:f,viewBoxDimension:f.width}),y=Dx({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:l,reverseDirection:s,tooltipDimension:c.height,viewBox:f,viewBoxDimension:f.height}),h=v$({translateX:v,translateY:y,useTranslate3d:d})):h=h$,{cssProperties:h,cssClasses:m$({translateX:v,translateY:y,coordinate:n})}}function kx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Uc(e){for(var t=1;t{if(t.key==="Escape"){var n,r,o,l;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(o=(l=this.props.coordinate)===null||l===void 0?void 0:l.y)!==null&&o!==void 0?o:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:o,children:l,coordinate:s,hasPayload:c,isAnimationActive:d,offset:f,position:h,reverseDirection:v,useTranslate3d:y,viewBox:E,wrapperStyle:_,lastBoundingBox:T,innerRef:A,hasPortalFromProps:w}=this.props,R=typeof f=="number"?f:f.x,I=typeof f=="number"?f:f.y,{cssClasses:P,cssProperties:N}=g$({allowEscapeViewBox:n,coordinate:s,offsetLeft:R,offsetTop:I,position:h,reverseDirection:v,tooltipBox:{height:T.height,width:T.width},useTranslate3d:y,viewBox:E}),O=w?{}:Uc(Uc({transition:d&&t?"transform ".concat(r,"ms ").concat(o):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&c?"visible":"hidden",position:"absolute",top:0,left:0}),D=Uc(Uc({},O),{},{visibility:!this.state.dismissed&&t&&c?"visible":"hidden"},_);return x.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:P,style:D,ref:A},l)}}var mR=()=>{var e;return(e=me(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Yg(){return Yg=Object.assign?Object.assign.bind():function(e){for(var t=1;tMe(e.x)&&Me(e.y),Bx=e=>e.base!=null&&Cf(e.base)&&Cf(e),ds=e=>e.x,ps=e=>e.y,A$=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Hs(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=zx["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return zx[n]||ud},qx={connectNulls:!1,type:"linear"},C$=e=>{var{type:t=qx.type,points:n=[],baseLine:r,layout:o,connectNulls:l=qx.connectNulls}=e,s=A$(t,o),c=l?n.filter(Cf):n;if(Array.isArray(r)){var d,f=n.map((_,T)=>Lx(Lx({},_),{},{base:r[T]}));o==="vertical"?d=Mc().y(ps).x1(ds).x0(_=>_.base.x):d=Mc().x(ds).y1(ps).y0(_=>_.base.y);var h=d.defined(Bx).curve(s),v=l?f.filter(Bx):f;return h(v)}var y;o==="vertical"&&ce(r)?y=Mc().y(ps).x1(ds).x0(r):ce(r)?y=Mc().x(ds).y1(ps).y0(r):y=YI().x(ds).y(ps);var E=y.defined(Cf).curve(s);return E(c)},Ts=e=>{var{className:t,points:n,path:r,pathRef:o}=e,l=$o();if((!n||!n.length)&&!r)return null;var s={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||l,connectNulls:e.connectNulls},c=n&&n.length?C$(s):r;return x.createElement("path",Yg({},Wn(e),zy(e),{className:Xe("recharts-curve",t),d:c===null?void 0:c,ref:o}))},x$=["x","y","top","left","width","height","className"];function Kg(){return Kg=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(o,"v").concat(r,"M").concat(l,",").concat(t,"h").concat(n),D$=e=>{var{x:t=0,y:n=0,top:r=0,left:o=0,width:l=0,height:s=0,className:c}=e,d=R$(e,x$),f=w$({x:t,y:n,top:r,left:o,width:l,height:s},d);return!ce(t)||!ce(n)||!ce(l)||!ce(s)||!ce(r)||!ce(o)?null:x.createElement("path",Kg({},on(f),{className:Xe("recharts-cross",c),d:N$(t,n,l,s,r,o)}))};function k$(e,t,n,r){var o=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-o:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-o,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Hx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vx(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),vR=(e,t,n)=>e.map(r=>"".concat(B$(r)," ").concat(t,"ms ").concat(n)).join(","),q$=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(o=>r.includes(o))),Ns=(e,t)=>Object.keys(t).reduce((n,r)=>Vx(Vx({},n),{},{[r]:e(r,t[r])}),{});function Fx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;te+(t-e)*n,Jg=e=>{var{from:t,to:n}=e;return t!==n},gR=(e,t,n)=>{var r=Ns((o,l)=>{if(Jg(l)){var[s,c]=e(l.from,l.to,l.velocity);return Tt(Tt({},l),{},{from:s,velocity:c})}return l},t);return n<1?Ns((o,l)=>Jg(l)&&r[o]!=null?Tt(Tt({},l),{},{velocity:xf(l.velocity,r[o].velocity,n),from:xf(l.from,r[o].from,n)}):l,t):gR(e,r,n-1)};function F$(e,t,n,r,o,l){var s,c=r.reduce((y,E)=>Tt(Tt({},y),{},{[E]:{from:e[E],velocity:0,to:t[E]}}),{}),d=()=>Ns((y,E)=>E.from,c),f=()=>!Object.values(c).filter(Jg).length,h=null,v=y=>{s||(s=y);var E=y-s,_=E/n.dt;c=gR(n,c,_),o(Tt(Tt(Tt({},e),t),d())),s=y,f()||(h=l.setTimeout(v))};return()=>(h=l.setTimeout(v),()=>{var y;(y=h)===null||y===void 0||y()})}function $$(e,t,n,r,o,l,s){var c=null,d=o.reduce((v,y)=>{var E=e[y],_=t[y];return E==null||_==null?v:Tt(Tt({},v),{},{[y]:[E,_]})},{}),f,h=v=>{f||(f=v);var y=(v-f)/r,E=Ns((T,A)=>xf(...A,n(y)),d);if(l(Tt(Tt(Tt({},e),t),E)),y<1)c=s.setTimeout(h);else{var _=Ns((T,A)=>xf(...A,n(1)),d);l(Tt(Tt(Tt({},e),t),_))}};return()=>(c=s.setTimeout(h),()=>{var v;(v=c)===null||v===void 0||v()})}const Y$=(e,t,n,r,o,l)=>{var s=q$(e,t);return n==null?()=>(o(Tt(Tt({},e),t)),()=>{}):n.isStepper===!0?F$(e,t,n,s,o,l):$$(e,t,n,r,s,o,l)};var wf=1e-4,yR=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],SR=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),$x=(e,t)=>n=>{var r=yR(e,t);return SR(r,n)},K$=(e,t)=>n=>{var r=yR(e,t),o=[...r.map((l,s)=>l*s).slice(1),0];return SR(o,n)},J$=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var o=r.map(l=>parseFloat(l));return[o[0],o[1],o[2],o[3]]},j$=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var o=$x(e,n),l=$x(t,r),s=K$(e,n),c=f=>f>1?1:f<0?0:f,d=f=>{for(var h=f>1?1:f,v=h,y=0;y<8;++y){var E=o(v)-h,_=s(v);if(Math.abs(E-h)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:o=17}=t,l=(s,c,d)=>{var f=-(s-c)*n,h=d*r,v=d+(f-h)*o/1e3,y=d*o/1e3+s;return Math.abs(y-c){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Yx(e);case"spring":return W$();default:if(e.split("(")[0]==="cubic-bezier")return Yx(e)}return typeof e=="function"?e:null};function Q$(e){var t,n=()=>null,r=!1,o=null,l=s=>{if(!r){if(Array.isArray(s)){if(!s.length)return;var c=s,[d,...f]=c;if(typeof d=="number"){o=e.setTimeout(l.bind(null,f),d);return}l(d),o=e.setTimeout(l.bind(null,f));return}typeof s=="string"&&(t=s,n(t)),typeof s=="object"&&(t=s,n(t)),typeof s=="function"&&s()}};return{stop:()=>{r=!0},start:s=>{r=!1,o&&(o(),o=null),l(s)},subscribe:s=>(n=s,()=>{n=()=>null}),getTimeoutController:()=>e}}class e5{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),o=null,l=s=>{s-r>=n?t(s):typeof requestAnimationFrame=="function"&&(o=requestAnimationFrame(l))};return o=requestAnimationFrame(l),()=>{o!=null&&cancelAnimationFrame(o)}}}function t5(){return Q$(new e5)}var n5=x.createContext(t5);function r5(e,t){var n=x.useContext(n5);return x.useMemo(()=>t??n(e),[e,t,n])}var i5=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Js={isSsr:i5()},o5={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Kx={t:0},Mv={t:1};function Pd(e){var t=sn(e,o5),{isActive:n,canBegin:r,duration:o,easing:l,begin:s,onAnimationEnd:c,onAnimationStart:d,children:f}=t,h=n==="auto"?!Js.isSsr:n,v=r5(t.animationId,t.animationManager),[y,E]=x.useState(h?Kx:Mv),_=x.useRef(null);return x.useEffect(()=>{h||E(Mv)},[h]),x.useEffect(()=>{if(!h||!r)return Fo;var T=Y$(Kx,Mv,Z$(l),o,E,v.getTimeoutController()),A=()=>{_.current=T()};return v.start([d,s,A,o,c]),()=>{v.stop(),_.current&&_.current(),c()}},[h,r,o,l,s,d,c,v]),f(y.t)}function Rd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=x.useRef(xs(t)),r=x.useRef(e);return r.current!==e&&(n.current=xs(t),r.current=e),n.current}var a5=["radius"],l5=["radius"],Jx,jx,Xx,Wx,Zx,Qx,ew,tw,nw,rw;function iw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ow(e){for(var t=1;t{var l=ji(n),s=ji(r),c=Math.min(Math.abs(l)/2,Math.abs(s)/2),d=s>=0?1:-1,f=l>=0?1:-1,h=s>=0&&l>=0||s<0&&l<0?1:0,v;if(c>0&&Array.isArray(o)){for(var y=[0,0,0,0],E=0,_=4;E<_;E++){var T,A=(T=o[E])!==null&&T!==void 0?T:0;y[E]=A>c?c:A}v=ct(Jx||(Jx=br(["M",",",""])),e,t+d*y[0]),y[0]>0&&(v+=ct(jx||(jx=br(["A ",",",",0,0,",",",",",""])),y[0],y[0],h,e+f*y[0],t)),v+=ct(Xx||(Xx=br(["L ",",",""])),e+n-f*y[1],t),y[1]>0&&(v+=ct(Wx||(Wx=br(["A ",",",",0,0,",`, `,",",""])),y[1],y[1],h,e+n,t+d*y[1])),v+=ct(Zx||(Zx=br(["L ",",",""])),e+n,t+r-d*y[2]),y[2]>0&&(v+=ct(Qx||(Qx=br(["A ",",",",0,0,",`, `,",",""])),y[2],y[2],h,e+n-f*y[2],t+r)),v+=ct(ew||(ew=br(["L ",",",""])),e+f*y[3],t+r),y[3]>0&&(v+=ct(tw||(tw=br(["A ",",",",0,0,",`, `,",",""])),y[3],y[3],h,e,t+r-d*y[3])),v+="Z"}else if(c>0&&o===+o&&o>0){var w=Math.min(c,o);v=ct(nw||(nw=br(["M ",",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",","," Z"])),e,t+d*w,w,w,h,e+f*w,t,e+n-f*w,t,w,w,h,e+n,t+d*w,e+n,t+r-d*w,w,w,h,e+n-f*w,t+r,e+f*w,t+r,w,w,h,e,t+r-d*w)}else v=ct(rw||(rw=br(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return v},sw={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},bR=e=>{var t=sn(e,sw),n=x.useRef(null),[r,o]=x.useState(-1);x.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var X=n.current.getTotalLength();X&&o(X)}catch{}},[]);var{x:l,y:s,width:c,height:d,radius:f,className:h}=t,{animationEasing:v,animationDuration:y,animationBegin:E,isAnimationActive:_,isUpdateAnimationActive:T}=t,A=x.useRef(c),w=x.useRef(d),R=x.useRef(l),I=x.useRef(s),P=x.useMemo(()=>({x:l,y:s,width:c,height:d,radius:f}),[l,s,c,d,f]),N=Rd(P,"rectangle-");if(l!==+l||s!==+s||c!==+c||d!==+d||c===0||d===0)return null;var O=Xe("recharts-rectangle",h);if(!T){var D=on(t),{radius:G}=D,B=aw(D,a5);return x.createElement("path",Mf({},B,{x:ji(l),y:ji(s),width:ji(c),height:ji(d),radius:typeof f=="number"?f:void 0,className:O,d:lw(l,s,c,d,f)}))}var Q=A.current,te=w.current,$=R.current,oe=I.current,se="0px ".concat(r===-1?1:r,"px"),ye="".concat(r,"px 0px"),V=vR(["strokeDasharray"],y,typeof v=="string"?v:sw.animationEasing);return x.createElement(Pd,{animationId:N,key:N,canBegin:r>0,duration:y,easing:v,isActive:T,begin:E},X=>{var ae=at(Q,c,X),he=at(te,d,X),ve=at($,l,X),U=at(oe,s,X);n.current&&(A.current=ae,w.current=he,R.current=ve,I.current=U);var J;_?X>0?J={transition:V,strokeDasharray:ye}:J={strokeDasharray:se}:J={strokeDasharray:ye};var ie=on(t),{radius:le}=ie,be=aw(ie,l5);return x.createElement("path",Mf({},be,{radius:typeof f=="number"?f:void 0,className:O,d:lw(ve,U,ae,he,f),ref:n,style:ow(ow({},J),t.style)}))})};function uw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function cw(e){for(var t=1;te*180/Math.PI,Kt=(e,t,n,r)=>({x:e+Math.cos(-If*r)*n,y:t+Math.sin(-If*r)*n}),v5=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},g5=(e,t)=>{var{x:n,y:r}=e,{x:o,y:l}=t;return Math.sqrt((n-o)**2+(r-l)**2)},y5=(e,t)=>{var{x:n,y:r}=e,{cx:o,cy:l}=t,s=g5({x:n,y:r},{x:o,y:l});if(s<=0)return{radius:s,angle:0};var c=(n-o)/s,d=Math.acos(c);return r>l&&(d=2*Math.PI-d),{radius:s,angle:m5(d),angleInRadian:d}},S5=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),o=Math.floor(n/360),l=Math.min(r,o);return{startAngle:t-l*360,endAngle:n-l*360}},b5=(e,t)=>{var{startAngle:n,endAngle:r}=t,o=Math.floor(n/360),l=Math.floor(r/360),s=Math.min(o,l);return e+s*360},E5=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:o,angle:l}=y5({x:n,y:r},t),{innerRadius:s,outerRadius:c}=t;if(oc||o===0)return null;var{startAngle:d,endAngle:f}=S5(t),h=l,v;if(d<=f){for(;h>f;)h-=360;for(;h=d&&h<=f}else{for(;h>d;)h-=360;for(;h=f&&h<=d}return v?cw(cw({},t),{},{radius:o,angle:b5(h,t)}):null};function ER(e){var{cx:t,cy:n,radius:r,startAngle:o,endAngle:l}=e,s=Kt(t,n,r,o),c=Kt(t,n,r,l);return{points:[s,c],cx:t,cy:n,radius:r,startAngle:o,endAngle:l}}var fw,dw,pw,hw,mw,vw,gw;function jg(){return jg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=gn(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Lc=e=>{var{cx:t,cy:n,radius:r,angle:o,sign:l,isExternal:s,cornerRadius:c,cornerIsExternal:d}=e,f=c*(s?1:-1)+r,h=Math.asin(c/f)/If,v=d?o:o+l*h,y=Kt(t,n,f,v),E=Kt(t,n,r,v),_=d?o-l*h:o,T=Kt(t,n,f*Math.cos(h*If),_);return{center:y,circleTangency:E,lineTangency:T,theta:h}},_R=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:l,endAngle:s}=e,c=_5(l,s),d=l+c,f=Kt(t,n,o,l),h=Kt(t,n,o,d),v=ct(fw||(fw=wo(["M ",",",` A `,",",`,0, `,",",`, `,",",` `])),f.x,f.y,o,o,+(Math.abs(c)>180),+(l>d),h.x,h.y);if(r>0){var y=Kt(t,n,r,l),E=Kt(t,n,r,d);v+=ct(dw||(dw=wo(["L ",",",` A `,",",`,0, `,",",`, `,","," Z"])),E.x,E.y,r,r,+(Math.abs(c)>180),+(l<=d),y.x,y.y)}else v+=ct(pw||(pw=wo(["L ",","," Z"])),t,n);return v},T5=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:o,cornerRadius:l,forceCornerRadius:s,cornerIsExternal:c,startAngle:d,endAngle:f}=e,h=gn(f-d),{circleTangency:v,lineTangency:y,theta:E}=Lc({cx:t,cy:n,radius:o,angle:d,sign:h,cornerRadius:l,cornerIsExternal:c}),{circleTangency:_,lineTangency:T,theta:A}=Lc({cx:t,cy:n,radius:o,angle:f,sign:-h,cornerRadius:l,cornerIsExternal:c}),w=c?Math.abs(d-f):Math.abs(d-f)-E-A;if(w<0)return s?ct(hw||(hw=wo(["M ",",",` a`,",",",0,0,1,",`,0 a`,",",",0,0,1,",`,0 `])),y.x,y.y,l,l,l*2,l,l,-l*2):_R({cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:d,endAngle:f});var R=ct(mw||(mw=wo(["M ",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` A`,",",",0,0,",",",",",` `])),y.x,y.y,l,l,+(h<0),v.x,v.y,o,o,+(w>180),+(h<0),_.x,_.y,l,l,+(h<0),T.x,T.y);if(r>0){var{circleTangency:I,lineTangency:P,theta:N}=Lc({cx:t,cy:n,radius:r,angle:d,sign:h,isExternal:!0,cornerRadius:l,cornerIsExternal:c}),{circleTangency:O,lineTangency:D,theta:G}=Lc({cx:t,cy:n,radius:r,angle:f,sign:-h,isExternal:!0,cornerRadius:l,cornerIsExternal:c}),B=c?Math.abs(d-f):Math.abs(d-f)-N-G;if(B<0&&l===0)return"".concat(R,"L").concat(t,",").concat(n,"Z");R+=ct(vw||(vw=wo(["L",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` A`,",",",0,0,",",",",","Z"])),D.x,D.y,l,l,+(h<0),O.x,O.y,r,r,+(B>180),+(h>0),I.x,I.y,l,l,+(h<0),P.x,P.y)}else R+=ct(gw||(gw=wo(["L",",","Z"])),t,n);return R},A5={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},TR=e=>{var t=sn(e,A5),{cx:n,cy:r,innerRadius:o,outerRadius:l,cornerRadius:s,forceCornerRadius:c,cornerIsExternal:d,startAngle:f,endAngle:h,className:v}=t;if(l0&&Math.abs(f-h)<360?T=T5({cx:n,cy:r,innerRadius:o,outerRadius:l,cornerRadius:Math.min(_,E/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:f,endAngle:h}):T=_R({cx:n,cy:r,innerRadius:o,outerRadius:l,startAngle:f,endAngle:h}),x.createElement("path",jg({},on(t),{className:y,d:T}))};function C5(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(sP(t)){if(e==="centric"){var{cx:r,cy:o,innerRadius:l,outerRadius:s,angle:c}=t,d=Kt(r,o,l,c),f=Kt(r,o,s,c);return[{x:d.x,y:d.y},{x:f.x,y:f.y}]}return ER(t)}}var Iv={},Pv={},Rv={},yw;function x5(){return yw||(yw=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yP();function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(Rv)),Rv}var Sw;function w5(){return Sw||(Sw=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=x5();function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(Pv)),Pv}var bw;function M5(){return bw||(bw=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SP(),n=w5();function r(o,l,s){s&&typeof s!="number"&&t.isIterateeCall(o,l,s)&&(l=s=void 0),o=n.toFinite(o),l===void 0?(l=o,o=0):l=n.toFinite(l),s=s===void 0?ot?1:e>=t?0:NaN}function R5(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function t0(e){let t,n,r;e.length!==2?(t=Xi,n=(c,d)=>Xi(e(c),d),r=(c,d)=>e(c)-d):(t=e===Xi||e===R5?e:O5,n=e,r=e);function o(c,d,f=0,h=c.length){if(f>>1;n(c[v],d)<0?f=v+1:h=v}while(f>>1;n(c[v],d)<=0?f=v+1:h=v}while(ff&&r(c[v-1],d)>-r(c[v],d)?v-1:v}return{left:o,center:s,right:l}}function O5(){return 0}function CR(e){return e===null?NaN:+e}function*N5(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const D5=t0(Xi),js=D5.right;t0(CR).center;class _w extends Map{constructor(t,n=L5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,o]of t)this.set(r,o)}get(t){return super.get(Tw(this,t))}has(t){return super.has(Tw(this,t))}set(t,n){return super.set(k5(this,t),n)}delete(t){return super.delete(U5(this,t))}}function Tw({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function k5({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function U5({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function L5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function z5(e=Xi){if(e===Xi)return xR;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function xR(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const B5=Math.sqrt(50),q5=Math.sqrt(10),G5=Math.sqrt(2);function Pf(e,t,n){const r=(t-e)/Math.max(0,n),o=Math.floor(Math.log10(r)),l=r/Math.pow(10,o),s=l>=B5?10:l>=q5?5:l>=G5?2:1;let c,d,f;return o<0?(f=Math.pow(10,-o)/s,c=Math.round(e*f),d=Math.round(t*f),c/ft&&--d,f=-f):(f=Math.pow(10,o)*s,c=Math.round(e/f),d=Math.round(t/f),c*ft&&--d),d0))return[];if(e===t)return[e];const r=t=o))return[];const c=l-o+1,d=new Array(c);if(r)if(s<0)for(let f=0;f=r)&&(n=r);return n}function Cw(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function wR(e,t,n=0,r=1/0,o){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(o=o===void 0?xR:z5(o);r>n;){if(r-n>600){const d=r-n+1,f=t-n+1,h=Math.log(d),v=.5*Math.exp(2*h/3),y=.5*Math.sqrt(h*v*(d-v)/d)*(f-d/2<0?-1:1),E=Math.max(n,Math.floor(t-f*v/d+y)),_=Math.min(r,Math.floor(t+(d-f)*v/d+y));wR(e,t,E,_,o)}const l=e[t];let s=n,c=r;for(hs(e,n,t),o(e[r],l)>0&&hs(e,n,r);s0;)--c}o(e[n],l)===0?hs(e,n,c):(++c,hs(e,c,r)),c<=t&&(n=c+1),t<=c&&(r=c-1)}return e}function hs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function H5(e,t,n){if(e=Float64Array.from(N5(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Cw(e);if(t>=1)return Aw(e);var r,o=(r-1)*t,l=Math.floor(o),s=Aw(wR(e,l).subarray(0,l+1)),c=Cw(e.subarray(l+1));return s+(c-s)*(o-l)}}function V5(e,t,n=CR){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,o=(r-1)*t,l=Math.floor(o),s=+n(e[l],l,e),c=+n(e[l+1],l+1,e);return s+(c-s)*(o-l)}}function F5(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((t-e)/n))|0,l=new Array(o);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?zc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?zc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=K5.exec(e))?new Sn(t[1],t[2],t[3],1):(t=J5.exec(e))?new Sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=j5.exec(e))?zc(t[1],t[2],t[3],t[4]):(t=X5.exec(e))?zc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=W5.exec(e))?Ow(t[1],t[2]/100,t[3]/100,1):(t=Z5.exec(e))?Ow(t[1],t[2]/100,t[3]/100,t[4]):xw.hasOwnProperty(e)?Iw(xw[e]):e==="transparent"?new Sn(NaN,NaN,NaN,0):null}function Iw(e){return new Sn(e>>16&255,e>>8&255,e&255,1)}function zc(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sn(e,t,n,r)}function t8(e){return e instanceof Xs||(e=Us(e)),e?(e=e.rgb(),new Sn(e.r,e.g,e.b,e.opacity)):new Sn}function ey(e,t,n,r){return arguments.length===1?t8(e):new Sn(e,t,n,r??1)}function Sn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}i0(Sn,ey,IR(Xs,{brighter(e){return e=e==null?Rf:Math.pow(Rf,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ds:Math.pow(Ds,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sn(Oo(this.r),Oo(this.g),Oo(this.b),Of(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Pw,formatHex:Pw,formatHex8:n8,formatRgb:Rw,toString:Rw}));function Pw(){return`#${Mo(this.r)}${Mo(this.g)}${Mo(this.b)}`}function n8(){return`#${Mo(this.r)}${Mo(this.g)}${Mo(this.b)}${Mo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rw(){const e=Of(this.opacity);return`${e===1?"rgb(":"rgba("}${Oo(this.r)}, ${Oo(this.g)}, ${Oo(this.b)}${e===1?")":`, ${e})`}`}function Of(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mo(e){return e=Oo(e),(e<16?"0":"")+e.toString(16)}function Ow(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new lr(e,t,n,r)}function PR(e){if(e instanceof lr)return new lr(e.h,e.s,e.l,e.opacity);if(e instanceof Xs||(e=Us(e)),!e)return new lr;if(e instanceof lr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),l=Math.max(t,n,r),s=NaN,c=l-o,d=(l+o)/2;return c?(t===l?s=(n-r)/c+(n0&&d<1?0:s,new lr(s,c,d,e.opacity)}function r8(e,t,n,r){return arguments.length===1?PR(e):new lr(e,t,n,r??1)}function lr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}i0(lr,r8,IR(Xs,{brighter(e){return e=e==null?Rf:Math.pow(Rf,e),new lr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ds:Math.pow(Ds,e),new lr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Sn(Nv(e>=240?e-240:e+120,o,r),Nv(e,o,r),Nv(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new lr(Nw(this.h),Bc(this.s),Bc(this.l),Of(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Of(this.opacity);return`${e===1?"hsl(":"hsla("}${Nw(this.h)}, ${Bc(this.s)*100}%, ${Bc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Nw(e){return e=(e||0)%360,e<0?e+360:e}function Bc(e){return Math.max(0,Math.min(1,e||0))}function Nv(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const o0=e=>()=>e;function i8(e,t){return function(n){return e+n*t}}function o8(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function a8(e){return(e=+e)==1?RR:function(t,n){return n-t?o8(t,n,e):o0(isNaN(t)?n:t)}}function RR(e,t){var n=t-e;return n?i8(e,n):o0(isNaN(e)?t:e)}const Dw=(function e(t){var n=a8(t);function r(o,l){var s=n((o=ey(o)).r,(l=ey(l)).r),c=n(o.g,l.g),d=n(o.b,l.b),f=RR(o.opacity,l.opacity);return function(h){return o.r=s(h),o.g=c(h),o.b=d(h),o.opacity=f(h),o+""}}return r.gamma=e,r})(1);function l8(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(l){for(o=0;on&&(l=t.slice(n,l),c[s]?c[s]+=l:c[++s]=l),(r=r[0])===(o=o[0])?c[s]?c[s]+=o:c[++s]=o:(c[++s]=null,d.push({i:s,x:Nf(r,o)})),n=Dv.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function y8(e,t,n){var r=e[0],o=e[1],l=t[0],s=t[1];return o2?S8:y8,d=f=null,v}function v(y){return y==null||isNaN(y=+y)?l:(d||(d=c(e.map(r),t,n)))(r(s(y)))}return v.invert=function(y){return s(o((f||(f=c(t,e.map(r),Nf)))(y)))},v.domain=function(y){return arguments.length?(e=Array.from(y,Df),h()):e.slice()},v.range=function(y){return arguments.length?(t=Array.from(y),h()):t.slice()},v.rangeRound=function(y){return t=Array.from(y),n=a0,h()},v.clamp=function(y){return arguments.length?(s=y?!0:nn,h()):s!==nn},v.interpolate=function(y){return arguments.length?(n=y,h()):n},v.unknown=function(y){return arguments.length?(l=y,v):l},function(y,E){return r=y,o=E,h()}}function l0(){return Od()(nn,nn)}function b8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function kf(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Wa(e){return e=kf(Math.abs(e)),e?e[1]:NaN}function E8(e,t){return function(n,r){for(var o=n.length,l=[],s=0,c=e[0],d=0;o>0&&c>0&&(d+c+1>r&&(c=Math.max(1,r-d)),l.push(n.substring(o-=c,o+c)),!((d+=c+1)>r));)c=e[s=(s+1)%e.length];return l.reverse().join(t)}}function _8(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var T8=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ls(e){if(!(t=T8.exec(e)))throw new Error("invalid format: "+e);var t;return new s0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Ls.prototype=s0.prototype;function s0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}s0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function A8(e){e:for(var t=e.length,n=1,r=-1,o;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(o+1):e}var Uf;function C8(e,t){var n=kf(e,t);if(!n)return Uf=void 0,e.toPrecision(t);var r=n[0],o=n[1],l=o-(Uf=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=r.length;return l===s?r:l>s?r+new Array(l-s+1).join("0"):l>0?r.slice(0,l)+"."+r.slice(l):"0."+new Array(1-l).join("0")+kf(e,Math.max(0,t+l-1))[0]}function Uw(e,t){var n=kf(e,t);if(!n)return e+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}const Lw={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:b8,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Uw(e*100,t),r:Uw,s:C8,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function zw(e){return e}var Bw=Array.prototype.map,qw=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function x8(e){var t=e.grouping===void 0||e.thousands===void 0?zw:E8(Bw.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",l=e.numerals===void 0?zw:_8(Bw.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",c=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function f(v,y){v=Ls(v);var E=v.fill,_=v.align,T=v.sign,A=v.symbol,w=v.zero,R=v.width,I=v.comma,P=v.precision,N=v.trim,O=v.type;O==="n"?(I=!0,O="g"):Lw[O]||(P===void 0&&(P=12),N=!0,O="g"),(w||E==="0"&&_==="=")&&(w=!0,E="0",_="=");var D=(y&&y.prefix!==void 0?y.prefix:"")+(A==="$"?n:A==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():""),G=(A==="$"?r:/[%p]/.test(O)?s:"")+(y&&y.suffix!==void 0?y.suffix:""),B=Lw[O],Q=/[defgprs%]/.test(O);P=P===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function te($){var oe=D,se=G,ye,V,X;if(O==="c")se=B($)+se,$="";else{$=+$;var ae=$<0||1/$<0;if($=isNaN($)?d:B(Math.abs($),P),N&&($=A8($)),ae&&+$==0&&T!=="+"&&(ae=!1),oe=(ae?T==="("?T:c:T==="-"||T==="("?"":T)+oe,se=(O==="s"&&!isNaN($)&&Uf!==void 0?qw[8+Uf/3]:"")+se+(ae&&T==="("?")":""),Q){for(ye=-1,V=$.length;++yeX||X>57){se=(X===46?o+$.slice(ye+1):$.slice(ye))+se,$=$.slice(0,ye);break}}}I&&!w&&($=t($,1/0));var he=oe.length+$.length+se.length,ve=he>1)+oe+$+se+ve.slice(he);break;default:$=ve+oe+$+se;break}return l($)}return te.toString=function(){return v+""},te}function h(v,y){var E=Math.max(-8,Math.min(8,Math.floor(Wa(y)/3)))*3,_=Math.pow(10,-E),T=f((v=Ls(v),v.type="f",v),{suffix:qw[8+E/3]});return function(A){return T(_*A)}}return{format:f,formatPrefix:h}}var qc,u0,OR;w8({thousands:",",grouping:[3],currency:["$",""]});function w8(e){return qc=x8(e),u0=qc.format,OR=qc.formatPrefix,qc}function M8(e){return Math.max(0,-Wa(Math.abs(e)))}function I8(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Wa(t)/3)))*3-Wa(Math.abs(e)))}function P8(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Wa(t)-Wa(e))+1}function NR(e,t,n,r){var o=Zg(e,t,n),l;switch(r=Ls(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(l=I8(o,s))&&(r.precision=l),OR(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(l=P8(o,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=l-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(l=M8(o))&&(r.precision=l-(r.type==="%")*2);break}}return u0(r)}function to(e){var t=e.domain;return e.ticks=function(n){var r=t();return Xg(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var o=t();return NR(o[0],o[o.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),o=0,l=r.length-1,s=r[o],c=r[l],d,f,h=10;for(c0;){if(f=Wg(s,c,n),f===d)return r[o]=s,r[l]=c,t(r);if(f>0)s=Math.floor(s/f)*f,c=Math.ceil(c/f)*f;else if(f<0)s=Math.ceil(s*f)/f,c=Math.floor(c*f)/f;else break;d=f}return e},e}function DR(){var e=l0();return e.copy=function(){return Ws(e,DR())},er.apply(e,arguments),to(e)}function kR(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Df),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return kR(e).unknown(t)},e=arguments.length?Array.from(e,Df):[0,1],to(n)}function UR(e,t){e=e.slice();var n=0,r=e.length-1,o=e[n],l=e[r],s;return lMath.pow(e,t)}function k8(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Vw(e){return(t,n)=>-e(-t,n)}function c0(e){const t=e(Gw,Hw),n=t.domain;let r=10,o,l;function s(){return o=k8(r),l=D8(r),n()[0]<0?(o=Vw(o),l=Vw(l),e(R8,O8)):e(Gw,Hw),t}return t.base=function(c){return arguments.length?(r=+c,s()):r},t.domain=function(c){return arguments.length?(n(c),s()):n()},t.ticks=c=>{const d=n();let f=d[0],h=d[d.length-1];const v=h0){for(;y<=E;++y)for(_=1;_h)break;w.push(T)}}else for(;y<=E;++y)for(_=r-1;_>=1;--_)if(T=y>0?_/l(-y):_*l(y),!(Th)break;w.push(T)}w.length*2{if(c==null&&(c=10),d==null&&(d=r===10?"s":","),typeof d!="function"&&(!(r%1)&&(d=Ls(d)).precision==null&&(d.trim=!0),d=u0(d)),c===1/0)return d;const f=Math.max(1,r*c/t.ticks().length);return h=>{let v=h/l(Math.round(o(h)));return v*rn(UR(n(),{floor:c=>l(Math.floor(o(c))),ceil:c=>l(Math.ceil(o(c)))})),t}function LR(){const e=c0(Od()).domain([1,10]);return e.copy=()=>Ws(e,LR()).base(e.base()),er.apply(e,arguments),e}function Fw(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function $w(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function f0(e){var t=1,n=e(Fw(t),$w(t));return n.constant=function(r){return arguments.length?e(Fw(t=+r),$w(t)):t},to(n)}function zR(){var e=f0(Od());return e.copy=function(){return Ws(e,zR()).constant(e.constant())},er.apply(e,arguments)}function Yw(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function U8(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function L8(e){return e<0?-e*e:e*e}function d0(e){var t=e(nn,nn),n=1;function r(){return n===1?e(nn,nn):n===.5?e(U8,L8):e(Yw(n),Yw(1/n))}return t.exponent=function(o){return arguments.length?(n=+o,r()):n},to(t)}function p0(){var e=d0(Od());return e.copy=function(){return Ws(e,p0()).exponent(e.exponent())},er.apply(e,arguments),e}function z8(){return p0.apply(null,arguments).exponent(.5)}function Kw(e){return Math.sign(e)*e*e}function B8(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function BR(){var e=l0(),t=[0,1],n=!1,r;function o(l){var s=B8(e(l));return isNaN(s)?r:n?Math.round(s):s}return o.invert=function(l){return e.invert(Kw(l))},o.domain=function(l){return arguments.length?(e.domain(l),o):e.domain()},o.range=function(l){return arguments.length?(e.range((t=Array.from(l,Df)).map(Kw)),o):t.slice()},o.rangeRound=function(l){return o.range(l).round(!0)},o.round=function(l){return arguments.length?(n=!!l,o):n},o.clamp=function(l){return arguments.length?(e.clamp(l),o):e.clamp()},o.unknown=function(l){return arguments.length?(r=l,o):r},o.copy=function(){return BR(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},er.apply(o,arguments),to(o)}function qR(){var e=[],t=[],n=[],r;function o(){var s=0,c=Math.max(1,t.length);for(n=new Array(c-1);++s0?n[c-1]:e[0],c=n?[r[n-1],t]:[r[f-1],r[f]]},s.unknown=function(d){return arguments.length&&(l=d),s},s.thresholds=function(){return r.slice()},s.copy=function(){return GR().domain([e,t]).range(o).unknown(l)},er.apply(to(s),arguments)}function HR(){var e=[.5],t=[0,1],n,r=1;function o(l){return l!=null&&l<=l?t[js(e,l,0,r)]:n}return o.domain=function(l){return arguments.length?(e=Array.from(l),r=Math.min(e.length,t.length-1),o):e.slice()},o.range=function(l){return arguments.length?(t=Array.from(l),r=Math.min(e.length,t.length-1),o):t.slice()},o.invertExtent=function(l){var s=t.indexOf(l);return[e[s-1],e[s]]},o.unknown=function(l){return arguments.length?(n=l,o):n},o.copy=function(){return HR().domain(e).range(t).unknown(n)},er.apply(o,arguments)}const kv=new Date,Uv=new Date;function At(e,t,n,r){function o(l){return e(l=arguments.length===0?new Date:new Date(+l)),l}return o.floor=l=>(e(l=new Date(+l)),l),o.ceil=l=>(e(l=new Date(l-1)),t(l,1),e(l),l),o.round=l=>{const s=o(l),c=o.ceil(l);return l-s(t(l=new Date(+l),s==null?1:Math.floor(s)),l),o.range=(l,s,c)=>{const d=[];if(l=o.ceil(l),c=c==null?1:Math.floor(c),!(l0))return d;let f;do d.push(f=new Date(+l)),t(l,c),e(l);while(fAt(s=>{if(s>=s)for(;e(s),!l(s);)s.setTime(s-1)},(s,c)=>{if(s>=s)if(c<0)for(;++c<=0;)for(;t(s,-1),!l(s););else for(;--c>=0;)for(;t(s,1),!l(s););}),n&&(o.count=(l,s)=>(kv.setTime(+l),Uv.setTime(+s),e(kv),e(Uv),Math.floor(n(kv,Uv))),o.every=l=>(l=Math.floor(l),!isFinite(l)||!(l>0)?null:l>1?o.filter(r?s=>r(s)%l===0:s=>o.count(0,s)%l===0):o)),o}const Lf=At(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Lf.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?At(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Lf);Lf.range;const ei=1e3,Jn=ei*60,ti=Jn*60,ai=ti*24,h0=ai*7,Jw=ai*30,Lv=ai*365,Io=At(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ei)},(e,t)=>(t-e)/ei,e=>e.getUTCSeconds());Io.range;const m0=At(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ei)},(e,t)=>{e.setTime(+e+t*Jn)},(e,t)=>(t-e)/Jn,e=>e.getMinutes());m0.range;const v0=At(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Jn)},(e,t)=>(t-e)/Jn,e=>e.getUTCMinutes());v0.range;const g0=At(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ei-e.getMinutes()*Jn)},(e,t)=>{e.setTime(+e+t*ti)},(e,t)=>(t-e)/ti,e=>e.getHours());g0.range;const y0=At(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ti)},(e,t)=>(t-e)/ti,e=>e.getUTCHours());y0.range;const Zs=At(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Jn)/ai,e=>e.getDate()-1);Zs.range;const Nd=At(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ai,e=>e.getUTCDate()-1);Nd.range;const VR=At(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ai,e=>Math.floor(e/ai));VR.range;function Yo(e){return At(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Jn)/h0)}const Dd=Yo(0),zf=Yo(1),q8=Yo(2),G8=Yo(3),Za=Yo(4),H8=Yo(5),V8=Yo(6);Dd.range;zf.range;q8.range;G8.range;Za.range;H8.range;V8.range;function Ko(e){return At(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/h0)}const kd=Ko(0),Bf=Ko(1),F8=Ko(2),$8=Ko(3),Qa=Ko(4),Y8=Ko(5),K8=Ko(6);kd.range;Bf.range;F8.range;$8.range;Qa.range;Y8.range;K8.range;const S0=At(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());S0.range;const b0=At(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());b0.range;const li=At(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());li.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:At(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});li.range;const si=At(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());si.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:At(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});si.range;function FR(e,t,n,r,o,l){const s=[[Io,1,ei],[Io,5,5*ei],[Io,15,15*ei],[Io,30,30*ei],[l,1,Jn],[l,5,5*Jn],[l,15,15*Jn],[l,30,30*Jn],[o,1,ti],[o,3,3*ti],[o,6,6*ti],[o,12,12*ti],[r,1,ai],[r,2,2*ai],[n,1,h0],[t,1,Jw],[t,3,3*Jw],[e,1,Lv]];function c(f,h,v){const y=hA).right(s,y);if(E===s.length)return e.every(Zg(f/Lv,h/Lv,v));if(E===0)return Lf.every(Math.max(Zg(f,h,v),1));const[_,T]=s[y/s[E-1][2]53)return null;"w"in re||(re.w=1),"Z"in re?(ke=Bv(ms(re.y,0,1)),zt=ke.getUTCDay(),ke=zt>4||zt===0?Bf.ceil(ke):Bf(ke),ke=Nd.offset(ke,(re.V-1)*7),re.y=ke.getUTCFullYear(),re.m=ke.getUTCMonth(),re.d=ke.getUTCDate()+(re.w+6)%7):(ke=zv(ms(re.y,0,1)),zt=ke.getDay(),ke=zt>4||zt===0?zf.ceil(ke):zf(ke),ke=Zs.offset(ke,(re.V-1)*7),re.y=ke.getFullYear(),re.m=ke.getMonth(),re.d=ke.getDate()+(re.w+6)%7)}else("W"in re||"U"in re)&&("w"in re||(re.w="u"in re?re.u%7:"W"in re?1:0),zt="Z"in re?Bv(ms(re.y,0,1)).getUTCDay():zv(ms(re.y,0,1)).getDay(),re.m=0,re.d="W"in re?(re.w+6)%7+re.W*7-(zt+5)%7:re.w+re.U*7-(zt+6)%7);return"Z"in re?(re.H+=re.Z/100|0,re.M+=re.Z%100,Bv(re)):zv(re)}}function G(W,Ce,Ie,re){for(var Lt=0,ke=Ce.length,zt=Ie.length,Bt,Nr;Lt=zt)return-1;if(Bt=Ce.charCodeAt(Lt++),Bt===37){if(Bt=Ce.charAt(Lt++),Nr=N[Bt in jw?Ce.charAt(Lt++):Bt],!Nr||(re=Nr(W,Ie,re))<0)return-1}else if(Bt!=Ie.charCodeAt(re++))return-1}return re}function B(W,Ce,Ie){var re=f.exec(Ce.slice(Ie));return re?(W.p=h.get(re[0].toLowerCase()),Ie+re[0].length):-1}function Q(W,Ce,Ie){var re=E.exec(Ce.slice(Ie));return re?(W.w=_.get(re[0].toLowerCase()),Ie+re[0].length):-1}function te(W,Ce,Ie){var re=v.exec(Ce.slice(Ie));return re?(W.w=y.get(re[0].toLowerCase()),Ie+re[0].length):-1}function $(W,Ce,Ie){var re=w.exec(Ce.slice(Ie));return re?(W.m=R.get(re[0].toLowerCase()),Ie+re[0].length):-1}function oe(W,Ce,Ie){var re=T.exec(Ce.slice(Ie));return re?(W.m=A.get(re[0].toLowerCase()),Ie+re[0].length):-1}function se(W,Ce,Ie){return G(W,t,Ce,Ie)}function ye(W,Ce,Ie){return G(W,n,Ce,Ie)}function V(W,Ce,Ie){return G(W,r,Ce,Ie)}function X(W){return s[W.getDay()]}function ae(W){return l[W.getDay()]}function he(W){return d[W.getMonth()]}function ve(W){return c[W.getMonth()]}function U(W){return o[+(W.getHours()>=12)]}function J(W){return 1+~~(W.getMonth()/3)}function ie(W){return s[W.getUTCDay()]}function le(W){return l[W.getUTCDay()]}function be(W){return d[W.getUTCMonth()]}function Ae(W){return c[W.getUTCMonth()]}function Ee(W){return o[+(W.getUTCHours()>=12)]}function Et(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var Ce=O(W+="",I);return Ce.toString=function(){return W},Ce},parse:function(W){var Ce=D(W+="",!1);return Ce.toString=function(){return W},Ce},utcFormat:function(W){var Ce=O(W+="",P);return Ce.toString=function(){return W},Ce},utcParse:function(W){var Ce=D(W+="",!0);return Ce.toString=function(){return W},Ce}}}var jw={"-":"",_:" ",0:"0"},Dt=/^\s*\d+/,Q8=/^%/,eY=/[\\^$*+?|[\]().{}]/g;function qe(e,t,n){var r=e<0?"-":"",o=(r?-e:e)+"",l=o.length;return r+(l[t.toLowerCase(),n]))}function nY(e,t,n){var r=Dt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function rY(e,t,n){var r=Dt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function iY(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function oY(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function aY(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Xw(e,t,n){var r=Dt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ww(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function lY(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function sY(e,t,n){var r=Dt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function uY(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Zw(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function cY(e,t,n){var r=Dt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Qw(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function fY(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function dY(e,t,n){var r=Dt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function pY(e,t,n){var r=Dt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function hY(e,t,n){var r=Dt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function mY(e,t,n){var r=Q8.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function vY(e,t,n){var r=Dt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function gY(e,t,n){var r=Dt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function e1(e,t){return qe(e.getDate(),t,2)}function yY(e,t){return qe(e.getHours(),t,2)}function SY(e,t){return qe(e.getHours()%12||12,t,2)}function bY(e,t){return qe(1+Zs.count(li(e),e),t,3)}function $R(e,t){return qe(e.getMilliseconds(),t,3)}function EY(e,t){return $R(e,t)+"000"}function _Y(e,t){return qe(e.getMonth()+1,t,2)}function TY(e,t){return qe(e.getMinutes(),t,2)}function AY(e,t){return qe(e.getSeconds(),t,2)}function CY(e){var t=e.getDay();return t===0?7:t}function xY(e,t){return qe(Dd.count(li(e)-1,e),t,2)}function YR(e){var t=e.getDay();return t>=4||t===0?Za(e):Za.ceil(e)}function wY(e,t){return e=YR(e),qe(Za.count(li(e),e)+(li(e).getDay()===4),t,2)}function MY(e){return e.getDay()}function IY(e,t){return qe(zf.count(li(e)-1,e),t,2)}function PY(e,t){return qe(e.getFullYear()%100,t,2)}function RY(e,t){return e=YR(e),qe(e.getFullYear()%100,t,2)}function OY(e,t){return qe(e.getFullYear()%1e4,t,4)}function NY(e,t){var n=e.getDay();return e=n>=4||n===0?Za(e):Za.ceil(e),qe(e.getFullYear()%1e4,t,4)}function DY(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+qe(t/60|0,"0",2)+qe(t%60,"0",2)}function t1(e,t){return qe(e.getUTCDate(),t,2)}function kY(e,t){return qe(e.getUTCHours(),t,2)}function UY(e,t){return qe(e.getUTCHours()%12||12,t,2)}function LY(e,t){return qe(1+Nd.count(si(e),e),t,3)}function KR(e,t){return qe(e.getUTCMilliseconds(),t,3)}function zY(e,t){return KR(e,t)+"000"}function BY(e,t){return qe(e.getUTCMonth()+1,t,2)}function qY(e,t){return qe(e.getUTCMinutes(),t,2)}function GY(e,t){return qe(e.getUTCSeconds(),t,2)}function HY(e){var t=e.getUTCDay();return t===0?7:t}function VY(e,t){return qe(kd.count(si(e)-1,e),t,2)}function JR(e){var t=e.getUTCDay();return t>=4||t===0?Qa(e):Qa.ceil(e)}function FY(e,t){return e=JR(e),qe(Qa.count(si(e),e)+(si(e).getUTCDay()===4),t,2)}function $Y(e){return e.getUTCDay()}function YY(e,t){return qe(Bf.count(si(e)-1,e),t,2)}function KY(e,t){return qe(e.getUTCFullYear()%100,t,2)}function JY(e,t){return e=JR(e),qe(e.getUTCFullYear()%100,t,2)}function jY(e,t){return qe(e.getUTCFullYear()%1e4,t,4)}function XY(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Qa(e):Qa.ceil(e),qe(e.getUTCFullYear()%1e4,t,4)}function WY(){return"+0000"}function n1(){return"%"}function r1(e){return+e}function i1(e){return Math.floor(+e/1e3)}var Na,jR,XR;ZY({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function ZY(e){return Na=Z8(e),jR=Na.format,Na.parse,XR=Na.utcFormat,Na.utcParse,Na}function QY(e){return new Date(e)}function eK(e){return e instanceof Date?+e:+new Date(+e)}function E0(e,t,n,r,o,l,s,c,d,f){var h=l0(),v=h.invert,y=h.domain,E=f(".%L"),_=f(":%S"),T=f("%I:%M"),A=f("%I %p"),w=f("%a %d"),R=f("%b %d"),I=f("%B"),P=f("%Y");function N(O){return(d(O)t(o/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(o,l)=>H5(e,l/r))},n.copy=function(){return eO(t).domain(e)},vi.apply(n,arguments)}function Ld(){var e=0,t=.5,n=1,r=1,o,l,s,c,d,f=nn,h,v=!1,y;function E(T){return isNaN(T=+T)?y:(T=.5+((T=+h(T))-l)*(r*Te.chartData,iO=Y([gi],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),oO=(e,t,n,r)=>r?iO(e):gi(e),aO=(e,t,n)=>n?iO(e):gi(e);function ui(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Me(t)&&Me(n))return!0}return!1}function o1(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function lO(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,o,l;if(Me(n))o=n;else if(typeof n=="function")return;if(Me(r))l=r;else if(typeof r=="function")return;var s=[o,l];if(ui(s))return s}}function oK(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(ui(r))return o1(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[o,l]=e,s,c;if(o==="auto")t!=null&&(s=Math.min(...t));else if(ce(o))s=o;else if(typeof o=="function")try{t!=null&&(s=o(t==null?void 0:t[0]))}catch{}else if(typeof o=="string"&&vx.test(o)){var d=vx.exec(o);if(d==null||d[1]==null||t==null)s=void 0;else{var f=+d[1];s=t[0]-f}}else s=t==null?void 0:t[0];if(l==="auto")t!=null&&(c=Math.max(...t));else if(ce(l))c=l;else if(typeof l=="function")try{t!=null&&(c=l(t==null?void 0:t[1]))}catch{}else if(typeof l=="string"&&gx.test(l)){var h=gx.exec(l);if(h==null||h[1]==null||t==null)c=void 0;else{var v=+h[1];c=t[1]+v}}else c=t==null?void 0:t[1];var y=[s,c];if(ui(y))return t==null?y:o1(y,t,n)}}}var ol=1e9,aK={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},C0,ot=!0,Qn="[DecimalError] ",No=Qn+"Invalid argument: ",A0=Qn+"Exponent out of range: ",al=Math.floor,xo=Math.pow,lK=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Rn,Pt=1e7,nt=7,sO=9007199254740991,qf=al(sO/nt),fe={};fe.absoluteValue=fe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};fe.comparedTo=fe.cmp=function(e){var t,n,r,o,l=this;if(e=new l.constructor(e),l.s!==e.s)return l.s||-e.s;if(l.e!==e.e)return l.e>e.e^l.s<0?1:-1;for(r=l.d.length,o=e.d.length,t=0,n=re.d[t]^l.s<0?1:-1;return r===o?0:r>o^l.s<0?1:-1};fe.decimalPlaces=fe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*nt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};fe.dividedBy=fe.div=function(e){return ni(this,new this.constructor(e))};fe.dividedToIntegerBy=fe.idiv=function(e){var t=this,n=t.constructor;return Ze(ni(t,new n(e),0,1),n.precision)};fe.equals=fe.eq=function(e){return!this.cmp(e)};fe.exponent=function(){return bt(this)};fe.greaterThan=fe.gt=function(e){return this.cmp(e)>0};fe.greaterThanOrEqualTo=fe.gte=function(e){return this.cmp(e)>=0};fe.isInteger=fe.isint=function(){return this.e>this.d.length-2};fe.isNegative=fe.isneg=function(){return this.s<0};fe.isPositive=fe.ispos=function(){return this.s>0};fe.isZero=function(){return this.s===0};fe.lessThan=fe.lt=function(e){return this.cmp(e)<0};fe.lessThanOrEqualTo=fe.lte=function(e){return this.cmp(e)<1};fe.logarithm=fe.log=function(e){var t,n=this,r=n.constructor,o=r.precision,l=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Rn))throw Error(Qn+"NaN");if(n.s<1)throw Error(Qn+(n.s?"NaN":"-Infinity"));return n.eq(Rn)?new r(0):(ot=!1,t=ni(zs(n,l),zs(e,l),l),ot=!0,Ze(t,o))};fe.minus=fe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?fO(t,e):uO(t,(e.s=-e.s,e))};fe.modulo=fe.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(Qn+"NaN");return n.s?(ot=!1,t=ni(n,e,0,1).times(e),ot=!0,n.minus(t)):Ze(new r(n),o)};fe.naturalExponential=fe.exp=function(){return cO(this)};fe.naturalLogarithm=fe.ln=function(){return zs(this)};fe.negated=fe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};fe.plus=fe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?uO(t,e):fO(t,(e.s=-e.s,e))};fe.precision=fe.sd=function(e){var t,n,r,o=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(No+e);if(t=bt(o)+1,r=o.d.length-1,n=r*nt+1,r=o.d[r],r){for(;r%10==0;r/=10)n--;for(r=o.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};fe.squareRoot=fe.sqrt=function(){var e,t,n,r,o,l,s,c=this,d=c.constructor;if(c.s<1){if(!c.s)return new d(0);throw Error(Qn+"NaN")}for(e=bt(c),ot=!1,o=Math.sqrt(+c),o==0||o==1/0?(t=Ar(c.d),(t.length+e)%2==0&&(t+="0"),o=Math.sqrt(t),e=al((e+1)/2)-(e<0||e%2),o==1/0?t="5e"+e:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=s=n+3;;)if(l=r,r=l.plus(ni(c,l,s+2)).times(.5),Ar(l.d).slice(0,s)===(t=Ar(r.d)).slice(0,s)){if(t=t.slice(s-3,s+1),o==s&&t=="4999"){if(Ze(l,n+1,0),l.times(l).eq(c)){r=l;break}}else if(t!="9999")break;s+=4}return ot=!0,Ze(r,n)};fe.times=fe.mul=function(e){var t,n,r,o,l,s,c,d,f,h=this,v=h.constructor,y=h.d,E=(e=new v(e)).d;if(!h.s||!e.s)return new v(0);for(e.s*=h.s,n=h.e+e.e,d=y.length,f=E.length,d=0;){for(t=0,o=d+r;o>r;)c=l[o]+E[r]*y[o-r-1]+t,l[o--]=c%Pt|0,t=c/Pt|0;l[o]=(l[o]+t)%Pt|0}for(;!l[--s];)l.pop();return t?++n:l.shift(),e.d=l,e.e=n,ot?Ze(e,v.precision):e};fe.toDecimalPlaces=fe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Mr(e,0,ol),t===void 0?t=r.rounding:Mr(t,0,8),Ze(n,e+bt(n)+1,t))};fe.toExponential=function(e,t){var n,r=this,o=r.constructor;return e===void 0?n=qo(r,!0):(Mr(e,0,ol),t===void 0?t=o.rounding:Mr(t,0,8),r=Ze(new o(r),e+1,t),n=qo(r,!0,e+1)),n};fe.toFixed=function(e,t){var n,r,o=this,l=o.constructor;return e===void 0?qo(o):(Mr(e,0,ol),t===void 0?t=l.rounding:Mr(t,0,8),r=Ze(new l(o),e+bt(o)+1,t),n=qo(r.abs(),!1,e+bt(r)+1),o.isneg()&&!o.isZero()?"-"+n:n)};fe.toInteger=fe.toint=function(){var e=this,t=e.constructor;return Ze(new t(e),bt(e)+1,t.rounding)};fe.toNumber=function(){return+this};fe.toPower=fe.pow=function(e){var t,n,r,o,l,s,c=this,d=c.constructor,f=12,h=+(e=new d(e));if(!e.s)return new d(Rn);if(c=new d(c),!c.s){if(e.s<1)throw Error(Qn+"Infinity");return c}if(c.eq(Rn))return c;if(r=d.precision,e.eq(Rn))return Ze(c,r);if(t=e.e,n=e.d.length-1,s=t>=n,l=c.s,s){if((n=h<0?-h:h)<=sO){for(o=new d(Rn),t=Math.ceil(r/nt+4),ot=!1;n%2&&(o=o.times(c),l1(o.d,t)),n=al(n/2),n!==0;)c=c.times(c),l1(c.d,t);return ot=!0,e.s<0?new d(Rn).div(o):Ze(o,r)}}else if(l<0)throw Error(Qn+"NaN");return l=l<0&&e.d[Math.max(t,n)]&1?-1:1,c.s=1,ot=!1,o=e.times(zs(c,r+f)),ot=!0,o=cO(o),o.s=l,o};fe.toPrecision=function(e,t){var n,r,o=this,l=o.constructor;return e===void 0?(n=bt(o),r=qo(o,n<=l.toExpNeg||n>=l.toExpPos)):(Mr(e,1,ol),t===void 0?t=l.rounding:Mr(t,0,8),o=Ze(new l(o),e,t),n=bt(o),r=qo(o,e<=n||n<=l.toExpNeg,e)),r};fe.toSignificantDigits=fe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Mr(e,1,ol),t===void 0?t=r.rounding:Mr(t,0,8)),Ze(new r(n),e,t)};fe.toString=fe.valueOf=fe.val=fe.toJSON=fe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=bt(e),n=e.constructor;return qo(e,t<=n.toExpNeg||t>=n.toExpPos)};function uO(e,t){var n,r,o,l,s,c,d,f,h=e.constructor,v=h.precision;if(!e.s||!t.s)return t.s||(t=new h(e)),ot?Ze(t,v):t;if(d=e.d,f=t.d,s=e.e,o=t.e,d=d.slice(),l=s-o,l){for(l<0?(r=d,l=-l,c=f.length):(r=f,o=s,c=d.length),s=Math.ceil(v/nt),c=s>c?s+1:c+1,l>c&&(l=c,r.length=1),r.reverse();l--;)r.push(0);r.reverse()}for(c=d.length,l=f.length,c-l<0&&(l=c,r=f,f=d,d=r),n=0;l;)n=(d[--l]=d[l]+f[l]+n)/Pt|0,d[l]%=Pt;for(n&&(d.unshift(n),++o),c=d.length;d[--c]==0;)d.pop();return t.d=d,t.e=o,ot?Ze(t,v):t}function Mr(e,t,n){if(e!==~~e||en)throw Error(No+e)}function Ar(e){var t,n,r,o=e.length-1,l="",s=e[0];if(o>0){for(l+=s,t=1;ts?1:-1;else for(c=d=0;co[c]?1:-1;break}return d}function n(r,o,l){for(var s=0;l--;)r[l]-=s,s=r[l]1;)r.shift()}return function(r,o,l,s){var c,d,f,h,v,y,E,_,T,A,w,R,I,P,N,O,D,G,B=r.constructor,Q=r.s==o.s?1:-1,te=r.d,$=o.d;if(!r.s)return new B(r);if(!o.s)throw Error(Qn+"Division by zero");for(d=r.e-o.e,D=$.length,N=te.length,E=new B(Q),_=E.d=[],f=0;$[f]==(te[f]||0);)++f;if($[f]>(te[f]||0)&&--d,l==null?R=l=B.precision:s?R=l+(bt(r)-bt(o))+1:R=l,R<0)return new B(0);if(R=R/nt+2|0,f=0,D==1)for(h=0,$=$[0],R++;(f1&&($=e($,h),te=e(te,h),D=$.length,N=te.length),P=D,T=te.slice(0,D),A=T.length;A=Pt/2&&++O;do h=0,c=t($,T,D,A),c<0?(w=T[0],D!=A&&(w=w*Pt+(T[1]||0)),h=w/O|0,h>1?(h>=Pt&&(h=Pt-1),v=e($,h),y=v.length,A=T.length,c=t(v,T,y,A),c==1&&(h--,n(v,D16)throw Error(A0+bt(e));if(!e.s)return new h(Rn);for(ot=!1,c=v,s=new h(.03125);e.abs().gte(.1);)e=e.times(s),f+=5;for(r=Math.log(xo(2,f))/Math.LN10*2+5|0,c+=r,n=o=l=new h(Rn),h.precision=c;;){if(o=Ze(o.times(e),c),n=n.times(++d),s=l.plus(ni(o,n,c)),Ar(s.d).slice(0,c)===Ar(l.d).slice(0,c)){for(;f--;)l=Ze(l.times(l),c);return h.precision=v,t==null?(ot=!0,Ze(l,v)):l}l=s}}function bt(e){for(var t=e.e*nt,n=e.d[0];n>=10;n/=10)t++;return t}function qv(e,t,n){if(t>e.LN10.sd())throw ot=!0,n&&(e.precision=n),Error(Qn+"LN10 precision limit exceeded");return Ze(new e(e.LN10),t)}function Yi(e){for(var t="";e--;)t+="0";return t}function zs(e,t){var n,r,o,l,s,c,d,f,h,v=1,y=10,E=e,_=E.d,T=E.constructor,A=T.precision;if(E.s<1)throw Error(Qn+(E.s?"NaN":"-Infinity"));if(E.eq(Rn))return new T(0);if(t==null?(ot=!1,f=A):f=t,E.eq(10))return t==null&&(ot=!0),qv(T,f);if(f+=y,T.precision=f,n=Ar(_),r=n.charAt(0),l=bt(E),Math.abs(l)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)E=E.times(e),n=Ar(E.d),r=n.charAt(0),v++;l=bt(E),r>1?(E=new T("0."+n),l++):E=new T(r+"."+n.slice(1))}else return d=qv(T,f+2,A).times(l+""),E=zs(new T(r+"."+n.slice(1)),f-y).plus(d),T.precision=A,t==null?(ot=!0,Ze(E,A)):E;for(c=s=E=ni(E.minus(Rn),E.plus(Rn),f),h=Ze(E.times(E),f),o=3;;){if(s=Ze(s.times(h),f),d=c.plus(ni(s,new T(o),f)),Ar(d.d).slice(0,f)===Ar(c.d).slice(0,f))return c=c.times(2),l!==0&&(c=c.plus(qv(T,f+2,A).times(l+""))),c=ni(c,new T(v),f),T.precision=A,t==null?(ot=!0,Ze(c,A)):c;c=d,o+=2}}function a1(e,t){var n,r,o;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(o=t.length;t.charCodeAt(o-1)===48;)--o;if(t=t.slice(r,o),t){if(o-=r,n=n-r-1,e.e=al(n/nt),e.d=[],r=(n+1)%nt,n<0&&(r+=nt),rqf||e.e<-qf))throw Error(A0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ze(e,t,n){var r,o,l,s,c,d,f,h,v=e.d;for(s=1,l=v[0];l>=10;l/=10)s++;if(r=t-s,r<0)r+=nt,o=t,f=v[h=0];else{if(h=Math.ceil((r+1)/nt),l=v.length,h>=l)return e;for(f=l=v[h],s=1;l>=10;l/=10)s++;r%=nt,o=r-nt+s}if(n!==void 0&&(l=xo(10,s-o-1),c=f/l%10|0,d=t<0||v[h+1]!==void 0||f%l,d=n<4?(c||d)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||d||n==6&&(r>0?o>0?f/xo(10,s-o):0:v[h-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return d?(l=bt(e),v.length=1,t=t-l-1,v[0]=xo(10,(nt-t%nt)%nt),e.e=al(-t/nt)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=h,l=1,h--):(v.length=h+1,l=xo(10,nt-r),v[h]=o>0?(f/xo(10,s-o)%xo(10,o)|0)*l:0),d)for(;;)if(h==0){(v[0]+=l)==Pt&&(v[0]=1,++e.e);break}else{if(v[h]+=l,v[h]!=Pt)break;v[h--]=0,l=1}for(r=v.length;v[--r]===0;)v.pop();if(ot&&(e.e>qf||e.e<-qf))throw Error(A0+bt(e));return e}function fO(e,t){var n,r,o,l,s,c,d,f,h,v,y=e.constructor,E=y.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new y(e),ot?Ze(t,E):t;if(d=e.d,v=t.d,r=t.e,f=e.e,d=d.slice(),s=f-r,s){for(h=s<0,h?(n=d,s=-s,c=v.length):(n=v,r=f,c=d.length),o=Math.max(Math.ceil(E/nt),c)+2,s>o&&(s=o,n.length=1),n.reverse(),o=s;o--;)n.push(0);n.reverse()}else{for(o=d.length,c=v.length,h=o0;--o)d[c++]=0;for(o=v.length;o>s;){if(d[--o]0?l=l.charAt(0)+"."+l.slice(1)+Yi(r):s>1&&(l=l.charAt(0)+"."+l.slice(1)),l=l+(o<0?"e":"e+")+o):o<0?(l="0."+Yi(-o-1)+l,n&&(r=n-s)>0&&(l+=Yi(r))):o>=s?(l+=Yi(o+1-s),n&&(r=n-o-1)>0&&(l=l+"."+Yi(r))):((r=o+1)0&&(o+1===s&&(l+="."),l+=Yi(r))),e.s<0?"-"+l:l}function l1(e,t){if(e.length>t)return e.length=t,!0}function dO(e){var t,n,r;function o(l){var s=this;if(!(s instanceof o))return new o(l);if(s.constructor=o,l instanceof o){s.s=l.s,s.e=l.e,s.d=(l=l.d)?l.slice():l;return}if(typeof l=="number"){if(l*0!==0)throw Error(No+l);if(l>0)s.s=1;else if(l<0)l=-l,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(l===~~l&&l<1e7){s.e=0,s.d=[l];return}return a1(s,l.toString())}else if(typeof l!="string")throw Error(No+l);if(l.charCodeAt(0)===45?(l=l.slice(1),s.s=-1):s.s=1,lK.test(l))a1(s,l);else throw Error(No+l)}if(o.prototype=fe,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=dO,o.config=o.set=sK,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=o[t+1]&&r<=o[t+2])this[n]=r;else throw Error(No+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(No+n+": "+r);return this}var C0=dO(aK);Rn=new C0(1);const $e=C0;function pO(e){var t;return e===0?t=1:t=Math.floor(new $e(e).abs().log(10).toNumber())+1,t}function hO(e,t,n){for(var r=new $e(e),o=0,l=[];r.lt(t)&&o<1e5;)l.push(r.toNumber()),r=r.add(n),o++;return l}var mO=e=>{var[t,n]=e,[r,o]=[t,n];return t>n&&([r,o]=[n,t]),[r,o]},vO=(e,t,n)=>{if(e.lte(0))return new $e(0);var r=pO(e.toNumber()),o=new $e(10).pow(r),l=e.div(o),s=r!==1?.05:.1,c=new $e(Math.ceil(l.div(s).toNumber())).add(n).mul(s),d=c.mul(o);return t?new $e(d.toNumber()):new $e(Math.ceil(d.toNumber()))},uK=(e,t,n)=>{var r=new $e(1),o=new $e(e);if(!o.isint()&&n){var l=Math.abs(e);l<1?(r=new $e(10).pow(pO(e)-1),o=new $e(Math.floor(o.div(r).toNumber())).mul(r)):l>1&&(o=new $e(Math.floor(e)))}else e===0?o=new $e(Math.floor((t-1)/2)):n||(o=new $e(Math.floor(e)));for(var s=Math.floor((t-1)/2),c=[],d=0;d4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new $e(0),tickMin:new $e(0),tickMax:new $e(0)};var s=vO(new $e(n).sub(t).div(r-1),o,l),c;t<=0&&n>=0?c=new $e(0):(c=new $e(t).add(n).div(2),c=c.sub(new $e(c).mod(s)));var d=Math.ceil(c.sub(t).div(s).toNumber()),f=Math.ceil(new $e(n).sub(c).div(s).toNumber()),h=d+f+1;return h>r?gO(t,n,r,o,l+1):(h0?f+(r-h):f,d=n>0?d:d+(r-h)),{step:s,tickMin:c.sub(new $e(d).mul(s)),tickMax:c.add(new $e(f).mul(s))})},cK=function(t){var[n,r]=t,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(o,2),[c,d]=mO([n,r]);if(c===-1/0||d===1/0){var f=d===1/0?[c,...Array(o-1).fill(1/0)]:[...Array(o-1).fill(-1/0),d];return n>r?f.reverse():f}if(c===d)return uK(c,o,l);var{step:h,tickMin:v,tickMax:y}=gO(c,d,s,l,0),E=hO(v,y.add(new $e(.1).mul(h)),h);return n>r?E.reverse():E},fK=function(t,n){var[r,o]=t,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[s,c]=mO([r,o]);if(s===-1/0||c===1/0)return[r,o];if(s===c)return[s];var d=Math.max(n,2),f=vO(new $e(c).sub(s).div(d-1),l,0),h=[...hO(new $e(s),new $e(c),f),c];return l===!1&&(h=h.map(v=>Math.round(v))),r>o?h.reverse():h},yO=e=>e.rootProps.maxBarSize,dK=e=>e.rootProps.barGap,SO=e=>e.rootProps.barCategoryGap,pK=e=>e.rootProps.barSize,zd=e=>e.rootProps.stackOffset,bO=e=>e.rootProps.reverseStackOrder,x0=e=>e.options.chartName,w0=e=>e.rootProps.syncId,EO=e=>e.rootProps.syncMethod,M0=e=>e.options.eventEmitter,hK=e=>e.rootProps.baseValue,Rt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},_o={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Er={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},Bd=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function qd(e,t,n){if(n!=="auto")return n;if(e!=null)return Pr(e,t)?"category":"number"}function s1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Gf(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},I0=Y([yK,lR],(e,t)=>{var n;if(e!=null)return e;var r=(n=qd(t,"angleAxis",u1.type))!==null&&n!==void 0?n:"category";return Gf(Gf({},u1),{},{type:r})}),SK=(e,t)=>e.polarAxis.radiusAxis[t],P0=Y([SK,lR],(e,t)=>{var n;if(e!=null)return e;var r=(n=qd(t,"radiusAxis",c1.type))!==null&&n!==void 0?n:"category";return Gf(Gf({},c1),{},{type:r})}),Gd=e=>e.polarOptions,R0=Y([hi,mi,Nt],v5),_O=Y([Gd,R0],(e,t)=>{if(e!=null)return dr(e.innerRadius,t,0)}),TO=Y([Gd,R0],(e,t)=>{if(e!=null)return dr(e.outerRadius,t,t*.8)}),bK=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},AO=Y([Gd],bK);Y([I0,AO],Bd);var CO=Y([R0,_O,TO],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});Y([P0,CO],Bd);var xO=Y([He,Gd,_O,TO,hi,mi],(e,t,n,r,o,l)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:s,cy:c,startAngle:d,endAngle:f}=t;return{cx:dr(s,o,o/2),cy:dr(c,l,l/2),innerRadius:n,outerRadius:r,startAngle:d,endAngle:f,clockWise:!1}}}),kt=(e,t)=>t,Hd=(e,t,n)=>n;function Vd(e){return e==null?void 0:e.id}function wO(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:o,dataKey:l}=n,s=new Map;return e.forEach(c=>{var d,f=(d=c.data)!==null&&d!==void 0?d:r;if(!(f==null||f.length===0)){var h=Vd(c);f.forEach((v,y)=>{var E=l==null||o?y:String(St(v,l,null)),_=St(v,c.dataKey,0),T;s.has(E)?T=s.get(E):T={},Object.assign(T,{[h]:_}),s.set(E,T)})}}),Array.from(s.values())}function Fd(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var $d=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Yd(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function EK(e,t){if(e.length===t.length){for(var n=0;n{var t=He(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},ll=e=>e.tooltip.settings.axisId;function _K(e){if(e in Es)return Es[e]();var t="scale".concat(Hs(e));if(t in Es)return Es[t]()}function f1(e){var t=e.ticks,n=e.bandwidth,r=e.range(),o=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:(function(l){function s(){return l.apply(this,arguments)}return s.toString=function(){return l.toString()},s})(()=>o),rangeMin:()=>o[0],rangeMax:()=>o[1],isInRange(l){var s=o[0],c=o[1];return s<=c?l>=s&&l<=c:l>=c&&l<=s},bandwidth:n?()=>n.call(e):void 0,ticks:t?l=>t.call(e,l):void 0,map:(l,s)=>{var c=e(l);if(c!=null){if(e.bandwidth&&s!==null&&s!==void 0&&s.position){var d=e.bandwidth();switch(s.position){case"middle":c+=d/2;break;case"end":c+=d;break}}return c}}}}function d1(e,t,n){if(typeof e=="function")return f1(e.copy().domain(t).range(n));if(e!=null){var r=_K(e);if(r!=null)return r.domain(t).range(n),f1(r)}}var TK=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!ui(t)){for(var n,r,o=0;or)&&(r=l))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function p1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Hf(e){for(var t=1;te.cartesianAxis.xAxis[t],yi=(e,t)=>{var n=MO(e,t);return n??Mt},It={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:ry,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:$s},IO=(e,t)=>e.cartesianAxis.yAxis[t],Si=(e,t)=>{var n=IO(e,t);return n??It},wK={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},O0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??wK},un=(e,t,n)=>{switch(t){case"xAxis":return yi(e,n);case"yAxis":return Si(e,n);case"zAxis":return O0(e,n);case"angleAxis":return I0(e,n);case"radiusAxis":return P0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},MK=(e,t,n)=>{switch(t){case"xAxis":return yi(e,n);case"yAxis":return Si(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Qs=(e,t,n)=>{switch(t){case"xAxis":return yi(e,n);case"yAxis":return Si(e,n);case"angleAxis":return I0(e,n);case"radiusAxis":return P0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},PO=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function RO(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Kd=e=>e.graphicalItems.cartesianItems,IK=Y([kt,Hd],RO),OO=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),eu=Y([Kd,un,IK],OO,{memoizeOptions:{resultEqualityCheck:Yd}}),NO=Y([eu],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(Fd)),DO=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),PK=Y([eu],DO),kO=e=>e.map(t=>t.data).filter(Boolean).flat(1),RK=Y([eu],kO,{memoizeOptions:{resultEqualityCheck:Yd}}),UO=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:o}=t;return e.length>0?e:n.slice(r,o+1)},N0=Y([RK,oO],UO),LO=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:St(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(o=>({value:St(o,r)}))):e.map(r=>({value:r})),Jd=Y([N0,un,eu],LO);function zO(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function Xc(e){if(xr(e)||e instanceof Date){var t=Number(e);if(Me(t))return t}}function h1(e){if(Array.isArray(e)){var t=[Xc(e[0]),Xc(e[1])];return ui(t)?t:void 0}var n=Xc(e);if(n!=null)return[n,n]}function ci(e){return e.map(Xc).filter(yn)}function OK(e,t,n){return!n||typeof t!="number"||fr(t)?[]:n.length?ci(n.flatMap(r=>{var o=St(e,r.dataKey),l,s;if(Array.isArray(o)?[l,s]=o:l=s=o,!(!Me(l)||!Me(s)))return[t-l,t+s]})):[]}var Ct=e=>{var t=Ut(e),n=ll(e);return Qs(e,t,n)},tu=Y([Ct],e=>e==null?void 0:e.dataKey),NK=Y([NO,oO,Ct],wO),BO=(e,t,n,r)=>{var o={},l=t.reduce((s,c)=>{if(c.stackId==null)return s;var d=s[c.stackId];return d==null&&(d=[]),d.push(c),s[c.stackId]=d,s},o);return Object.fromEntries(Object.entries(l).map(s=>{var[c,d]=s,f=r?[...d].reverse():d,h=f.map(Vd);return[c,{stackedData:s6(e,h,n),graphicalItems:f}]}))},Vf=Y([NK,NO,zd,bO],BO),qO=(e,t,n,r)=>{var{dataStartIndex:o,dataEndIndex:l}=t;if(r==null&&n!=="zAxis"){var s=d6(e,o,l);if(!(s!=null&&s[0]===0&&s[1]===0))return s}},DK=Y([un],e=>e.allowDataOverflow),D0=e=>{var t;if(e==null||!("domain"in e))return ry;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=ci(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:ry},GO=Y([un],D0),HO=Y([GO,DK],lO),kK=Y([Vf,gi,kt,HO],qO,{memoizeOptions:{resultEqualityCheck:$d}}),k0=e=>e.errorBars,UK=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>zO(n,r)),Ff=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var l,s;if(n.length>0&&e.forEach(c=>{n.forEach(d=>{var f,h,v=(f=r[d.id])===null||f===void 0?void 0:f.filter(w=>zO(o,w)),y=St(c,(h=t.dataKey)!==null&&h!==void 0?h:d.dataKey),E=OK(c,y,v);if(E.length>=2){var _=Math.min(...E),T=Math.max(...E);(l==null||_s)&&(s=T)}var A=h1(y);A!=null&&(l=l==null?A[0]:Math.min(l,A[0]),s=s==null?A[1]:Math.max(s,A[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(c=>{var d=h1(St(c,t.dataKey));d!=null&&(l=l==null?d[0]:Math.min(l,d[0]),s=s==null?d[1]:Math.max(s,d[1]))}),Me(l)&&Me(s))return[l,s]},LK=Y([N0,un,PK,k0,kt],VO,{memoizeOptions:{resultEqualityCheck:$d}});function zK(e){var{value:t}=e;if(xr(t)||t instanceof Date)return t}var BK=(e,t,n)=>{var r=e.map(zK).filter(o=>o!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&iP(r))?AR(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},FO=e=>e.referenceElements.dots,sl=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),qK=Y([FO,kt,Hd],sl),$O=e=>e.referenceElements.areas,GK=Y([$O,kt,Hd],sl),YO=e=>e.referenceElements.lines,HK=Y([YO,kt,Hd],sl),KO=(e,t)=>{if(e!=null){var n=ci(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},VK=Y(qK,kt,KO),JO=(e,t)=>{if(e!=null){var n=ci(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},FK=Y([GK,kt],JO);function $K(e){var t;if(e.x!=null)return ci([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:ci(n)}function YK(e){var t;if(e.y!=null)return ci([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:ci(n)}var jO=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?$K(r):YK(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},KK=Y([HK,kt],jO),JK=Y(VK,KK,FK,(e,t,n)=>Ff(e,n,t)),XO=(e,t,n,r,o,l,s,c)=>{if(n!=null)return n;var d=s==="vertical"&&c==="xAxis"||s==="horizontal"&&c==="yAxis",f=d?Ff(r,l,o):Ff(l,o);return oK(t,f,e.allowDataOverflow)},jK=Y([un,GO,HO,kK,LK,JK,He,kt],XO,{memoizeOptions:{resultEqualityCheck:$d}}),XK=[0,1],WO=(e,t,n,r,o,l,s)=>{if(!((e==null||n==null||n.length===0)&&s===void 0)){var{dataKey:c,type:d}=e,f=Pr(t,l);if(f&&c==null){var h;return AR(0,(h=n==null?void 0:n.length)!==null&&h!==void 0?h:0)}return d==="category"?BK(r,e,f):o==="expand"?XK:s}},U0=Y([un,He,N0,Jd,zd,kt,jK],WO);function WK(e){return e in Es}var ZO=(e,t,n)=>{if(e!=null){var{scale:r,type:o}=e;if(r==="auto")return o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":o==="category"?"band":"linear";if(typeof r=="string"){var l="scale".concat(Hs(r));return WK(l)?l:"point"}}},ul=Y([un,PO,x0],ZO);function L0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?d1(e.scale,n,r):d1(t,n,r)}var QO=(e,t,n)=>{var r=D0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&ui(e))return cK(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&ui(e))return fK(e,t.tickCount,t.allowDecimals)}},z0=Y([U0,Qs,ul],QO),eN=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&ui(t)&&Array.isArray(n)&&n.length>0){var o,l,s=t[0],c=(o=n[0])!==null&&o!==void 0?o:0,d=t[1],f=(l=n[n.length-1])!==null&&l!==void 0?l:0;return[Math.min(s,c),Math.max(d,f)]}return t},ZK=Y([un,U0,z0,kt],eN),QK=Y(Jd,un,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(ci(e.map(v=>v.value))).sort((v,y)=>v-y),o=r[0],l=r[r.length-1];if(o==null||l==null)return 1/0;var s=l-o;if(s===0)return 1/0;for(var c=0;co,(e,t,n,r,o)=>{if(!Me(e))return 0;var l=t==="vertical"?r.height:r.width;if(o==="gap")return e*l/2;if(o==="no-gap"){var s=dr(n,e*l),c=e*l/2;return c-s-(c-s)/l*s}return 0}),e9=(e,t,n)=>{var r=yi(e,t);return r==null||typeof r.padding!="string"?0:tN(e,"xAxis",t,n,r.padding)},t9=(e,t,n)=>{var r=Si(e,t);return r==null||typeof r.padding!="string"?0:tN(e,"yAxis",t,n,r.padding)},n9=Y(yi,e9,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:o}=e;return typeof o=="string"?{left:t,right:t}:{left:((n=o.left)!==null&&n!==void 0?n:0)+t,right:((r=o.right)!==null&&r!==void 0?r:0)+t}}),r9=Y(Si,t9,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:o}=e;return typeof o=="string"?{top:t,bottom:t}:{top:((n=o.top)!==null&&n!==void 0?n:0)+t,bottom:((r=o.bottom)!==null&&r!==void 0?r:0)+t}}),i9=Y([Nt,n9,Cd,Ad,(e,t,n)=>n],(e,t,n,r,o)=>{var{padding:l}=r;return o?[l.left,n.width-l.right]:[e.left+t.left,e.left+e.width-t.right]}),o9=Y([Nt,He,r9,Cd,Ad,(e,t,n)=>n],(e,t,n,r,o,l)=>{var{padding:s}=o;return l?[r.height-s.bottom,s.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),nu=(e,t,n,r)=>{var o;switch(t){case"xAxis":return i9(e,n,r);case"yAxis":return o9(e,n,r);case"zAxis":return(o=O0(e,n))===null||o===void 0?void 0:o.range;case"angleAxis":return AO(e);case"radiusAxis":return CO(e,n);default:return}},nN=Y([un,nu],Bd),a9=Y([ul,ZK],TK),jd=Y([un,ul,a9,nN],L0);Y([eu,k0,kt],UK);function rN(e,t){return e.idt.id?1:0}var Xd=(e,t)=>t,Wd=(e,t,n)=>n,l9=Y(_d,Xd,Wd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(rN)),s9=Y(Td,Xd,Wd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(rN)),iN=(e,t)=>({width:e.width,height:t.height}),u9=(e,t)=>{var n=typeof t.width=="number"?t.width:$s;return{width:n,height:e.height}},oN=Y(Nt,yi,iN),c9=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},f9=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},d9=Y(mi,Nt,l9,Xd,Wd,(e,t,n,r,o)=>{var l={},s;return n.forEach(c=>{var d=iN(t,c);s==null&&(s=c9(t,r,e));var f=r==="top"&&!o||r==="bottom"&&o;l[c.id]=s-Number(f)*d.height,s+=(f?-1:1)*d.height}),l}),p9=Y(hi,Nt,s9,Xd,Wd,(e,t,n,r,o)=>{var l={},s;return n.forEach(c=>{var d=u9(t,c);s==null&&(s=f9(t,r,e));var f=r==="left"&&!o||r==="right"&&o;l[c.id]=s-Number(f)*d.width,s+=(f?-1:1)*d.width}),l}),h9=(e,t)=>{var n=yi(e,t);if(n!=null)return d9(e,n.orientation,n.mirror)},m9=Y([Nt,yi,h9,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var o=n==null?void 0:n[r];return o==null?{x:e.left,y:0}:{x:e.left,y:o}}}),v9=(e,t)=>{var n=Si(e,t);if(n!=null)return p9(e,n.orientation,n.mirror)},g9=Y([Nt,Si,v9,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var o=n==null?void 0:n[r];return o==null?{x:0,y:e.top}:{x:o,y:e.top}}}),aN=Y(Nt,Si,(e,t)=>{var n=typeof t.width=="number"?t.width:$s;return{width:n,height:e.height}}),m1=(e,t,n)=>{switch(t){case"xAxis":return oN(e,n).width;case"yAxis":return aN(e,n).height;default:return}},lN=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:o,type:l,dataKey:s}=n,c=Pr(e,r),d=t.map(f=>f.value);if(s&&c&&l==="category"&&o&&iP(d))return d}},B0=Y([He,Jd,un,kt],lN),sN=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:o,scale:l}=n,s=Pr(e,r);if(s&&(o==="number"||l!=="auto"))return t.map(c=>c.value)}},q0=Y([He,Jd,Qs,kt],sN),v1=Y([He,MK,ul,jd,B0,q0,nu,z0,kt],(e,t,n,r,o,l,s,c,d)=>{if(t!=null){var f=Pr(e,d);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:d,categoricalDomain:l,duplicateDomain:o,isCategorical:f,niceTicks:c,range:s,realScaleType:n,scale:r}}}),y9=(e,t,n,r,o,l,s,c,d)=>{if(!(t==null||r==null)){var f=Pr(e,d),{type:h,ticks:v,tickCount:y}=t,E=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,_=h==="category"&&r.bandwidth?r.bandwidth()/E:0;_=d==="angleAxis"&&l!=null&&l.length>=2?gn(l[0]-l[1])*2*_:_;var T=v||o;return T?T.map((A,w)=>{var R=s?s.indexOf(A):A,I=r.map(R);return Me(I)?{index:w,coordinate:I+_,value:A,offset:_}:null}).filter(yn):f&&c?c.map((A,w)=>{var R=r.map(A);return Me(R)?{coordinate:R+_,value:A,index:w,offset:_}:null}).filter(yn):r.ticks?r.ticks(y).map((A,w)=>{var R=r.map(A);return Me(R)?{coordinate:R+_,value:A,index:w,offset:_}:null}).filter(yn):r.domain().map((A,w)=>{var R=r.map(A);return Me(R)?{coordinate:R+_,value:s?s[A]:A,index:w,offset:_}:null}).filter(yn)}},uN=Y([He,Qs,ul,jd,z0,nu,B0,q0,kt],y9),S9=(e,t,n,r,o,l,s)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var c=Pr(e,s),{tickCount:d}=t,f=0;return f=s==="angleAxis"&&(r==null?void 0:r.length)>=2?gn(r[0]-r[1])*2*f:f,c&&l?l.map((h,v)=>{var y=n.map(h);return Me(y)?{coordinate:y+f,value:h,index:v,offset:f}:null}).filter(yn):n.ticks?n.ticks(d).map((h,v)=>{var y=n.map(h);return Me(y)?{coordinate:y+f,value:h,index:v,offset:f}:null}).filter(yn):n.domain().map((h,v)=>{var y=n.map(h);return Me(y)?{coordinate:y+f,value:o?o[h]:h,index:v,offset:f}:null}).filter(yn)}},Zi=Y([He,Qs,jd,nu,B0,q0,kt],S9),Qi=Y(un,jd,(e,t)=>{if(!(e==null||t==null))return Hf(Hf({},e),{},{scale:t})}),b9=Y([un,ul,U0,nN],L0);Y((e,t,n)=>O0(e,n),b9,(e,t)=>{if(!(e==null||t==null))return Hf(Hf({},e),{},{scale:t})});var E9=Y([He,_d,Td],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),cN=e=>e.options.defaultTooltipEventType,fN=e=>e.options.validateTooltipEventTypes;function dN(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function G0(e,t){var n=cN(e),r=fN(e);return dN(t,n,r)}function _9(e){return me(t=>G0(t,e))}var pN=(e,t)=>{var n,r=Number(t);if(!(fr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},T9=e=>e.tooltip.settings,Ji={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},A9={itemInteraction:{click:Ji,hover:Ji},axisInteraction:{click:Ji,hover:Ji},keyboardInteraction:Ji,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},hN=bn({name:"tooltip",initialState:A9,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:it()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,o=cr(e).tooltipItemPayloads.indexOf(n);o>-1&&(e.tooltipItemPayloads[o]=r)},prepare:it()},removeTooltipEntrySettings:{reducer(e,t){var n=cr(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:it()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:C9,replaceTooltipEntrySettings:x9,removeTooltipEntrySettings:w9,setTooltipSettingsState:M9,setActiveMouseOverItemIndex:mN,mouseLeaveItem:I9,mouseLeaveChart:vN,setActiveClickItemIndex:P9,setMouseOverAxisIndex:gN,setMouseClickAxisIndex:R9,setSyncInteraction:iy,setKeyboardInteraction:oy}=hN.actions,O9=hN.reducer;function g1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Gc(e){for(var t=1;t{if(t==null)return Ji;var o=U9(e,t,n);if(o==null)return Ji;if(o.active)return o;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var l=e.settings.active===!0;if(L9(o)){if(l)return Gc(Gc({},o),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Gc(Gc({},Ji),{},{coordinate:o.coordinate})};function z9(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function B9(e,t){var n=z9(e),r=t[0],o=t[1];if(n===void 0)return!1;var l=Math.min(r,o),s=Math.max(r,o);return n>=l&&n<=s}function q9(e,t,n){if(n==null||t==null)return!0;var r=St(e,t);return r==null||!ui(n)?!0:B9(r,n)}var H0=(e,t,n,r)=>{var o=e==null?void 0:e.index;if(o==null)return null;var l=Number(o);if(!Me(l))return o;var s=0,c=1/0;t.length>0&&(c=t.length-1);var d=Math.max(s,Math.min(l,c)),f=t[d];return f==null||q9(f,n,r)?String(d):null},SN=(e,t,n,r,o,l,s)=>{if(l!=null){var c=s[0],d=c==null?void 0:c.getPosition(l);if(d!=null)return d;var f=o==null?void 0:o[Number(l)];if(f)switch(n){case"horizontal":return{x:f.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:f.coordinate}}}},bN=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var o;if(n==="hover"?o=e.itemInteraction.hover.graphicalItemId:o=e.itemInteraction.click.graphicalItemId,o==null&&r!=null){var l=e.tooltipItemPayloads[0];return l!=null?[l]:[]}return e.tooltipItemPayloads.filter(s=>{var c;return((c=s.settings)===null||c===void 0?void 0:c.graphicalItemId)===o})},EN=e=>e.options.tooltipPayloadSearcher,cl=e=>e.tooltip;function y1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function S1(e){for(var t=1;t{if(!(t==null||l==null)){var{chartData:c,computedData:d,dataStartIndex:f,dataEndIndex:h}=n,v=[];return e.reduce((y,E)=>{var _,{dataDefinedOnItem:T,settings:A}=E,w=F9(T,c),R=Array.isArray(w)?XP(w,f,h):w,I=(_=A==null?void 0:A.dataKey)!==null&&_!==void 0?_:r,P=A==null?void 0:A.nameKey,N;if(r&&Array.isArray(R)&&!Array.isArray(R[0])&&s==="axis"?N=oP(R,r,o):N=l(R,t,d,P),Array.isArray(N))N.forEach(D=>{var G=S1(S1({},A),{},{name:D.name,unit:D.unit,color:void 0,fill:void 0});y.push(yx({tooltipEntrySettings:G,dataKey:D.dataKey,payload:D.payload,value:St(D.payload,D.dataKey),name:D.name}))});else{var O;y.push(yx({tooltipEntrySettings:A,dataKey:I,payload:N,value:St(N,I),name:(O=St(N,P))!==null&&O!==void 0?O:A==null?void 0:A.name}))}return y},v)}},V0=Y([Ct,PO,x0],ZO),$9=Y([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Y9=Y([Ut,ll],RO),fl=Y([$9,Ct,Y9],OO,{memoizeOptions:{resultEqualityCheck:Yd}}),K9=Y([fl],e=>e.filter(Fd)),J9=Y([fl],kO,{memoizeOptions:{resultEqualityCheck:Yd}}),dl=Y([J9,gi],UO),j9=Y([K9,gi,Ct],wO),F0=Y([dl,Ct,fl],LO),TN=Y([Ct],D0),X9=Y([Ct],e=>e.allowDataOverflow),AN=Y([TN,X9],lO),W9=Y([fl],e=>e.filter(Fd)),Z9=Y([j9,W9,zd,bO],BO),Q9=Y([Z9,gi,Ut,AN],qO),e7=Y([fl],DO),t7=Y([dl,Ct,e7,k0,Ut],VO,{memoizeOptions:{resultEqualityCheck:$d}}),n7=Y([FO,Ut,ll],sl),r7=Y([n7,Ut],KO),i7=Y([$O,Ut,ll],sl),o7=Y([i7,Ut],JO),a7=Y([YO,Ut,ll],sl),l7=Y([a7,Ut],jO),s7=Y([r7,l7,o7],Ff),u7=Y([Ct,TN,AN,Q9,t7,s7,He,Ut],XO),ru=Y([Ct,He,dl,F0,zd,Ut,u7],WO),c7=Y([ru,Ct,V0],QO),f7=Y([Ct,ru,c7,Ut],eN),CN=e=>{var t=Ut(e),n=ll(e),r=!1;return nu(e,t,n,r)},xN=Y([Ct,CN],Bd),wN=Y([Ct,V0,f7,xN],L0),d7=Y([He,F0,Ct,Ut],lN),p7=Y([He,F0,Ct,Ut],sN),h7=(e,t,n,r,o,l,s,c)=>{if(t){var{type:d}=t,f=Pr(e,c);if(r){var h=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,v=d==="category"&&r.bandwidth?r.bandwidth()/h:0;return v=c==="angleAxis"&&o!=null&&(o==null?void 0:o.length)>=2?gn(o[0]-o[1])*2*v:v,f&&s?s.map((y,E)=>{var _=r.map(y);return Me(_)?{coordinate:_+v,value:y,index:E,offset:v}:null}).filter(yn):r.domain().map((y,E)=>{var _=r.map(y);return Me(_)?{coordinate:_+v,value:l?l[y]:y,index:E,offset:v}:null}).filter(yn)}}},bi=Y([He,Ct,V0,wN,CN,d7,p7,Ut],h7),$0=Y([cN,fN,T9],(e,t,n)=>dN(n.shared,e,t)),MN=e=>e.tooltip.settings.trigger,Y0=e=>e.tooltip.settings.defaultIndex,iu=Y([cl,$0,MN,Y0],yN),Go=Y([iu,dl,tu,ru],H0),IN=Y([bi,Go],pN),PN=Y([iu],e=>{if(e)return e.dataKey});Y([iu],e=>{if(e)return e.graphicalItemId});var RN=Y([cl,$0,MN,Y0],bN),m7=Y([hi,mi,He,Nt,bi,Y0,RN],SN),v7=Y([iu,m7],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),g7=Y([iu],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),y7=Y([RN,Go,gi,tu,IN,EN,$0],_N),S7=Y([y7],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function b1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function E1(e){for(var t=1;tme(Ct),A7=()=>{var e=T7(),t=me(bi),n=me(wN);return ja(!e||!n?void 0:E1(E1({},e),{},{scale:n}),t)};function _1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Da(e){for(var t=1;t{var o=t.find(l=>l&&l.index===n);if(o){if(e==="horizontal")return{x:o.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:o.coordinate}}return{x:0,y:0}},I7=(e,t,n,r)=>{var o=t.find(f=>f&&f.index===n);if(o){if(e==="centric"){var l=o.coordinate,{radius:s}=r;return Da(Da(Da({},r),Kt(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}var c=o.coordinate,{angle:d}=r;return Da(Da(Da({},r),Kt(r.cx,r.cy,c,d)),{},{angle:d,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function P7(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var ON=(e,t,n,r,o)=>{var l,s=(l=t==null?void 0:t.length)!==null&&l!==void 0?l:0;if(s<=1||e==null)return 0;if(r==="angleAxis"&&o!=null&&Math.abs(Math.abs(o[1]-o[0])-360)<=1e-6)for(var c=0;c0?(d=n[c-1])===null||d===void 0?void 0:d.coordinate:(f=n[s-1])===null||f===void 0?void 0:f.coordinate,_=(h=n[c])===null||h===void 0?void 0:h.coordinate,T=c>=s-1?(v=n[0])===null||v===void 0?void 0:v.coordinate:(y=n[c+1])===null||y===void 0?void 0:y.coordinate,A=void 0;if(!(E==null||_==null||T==null))if(gn(_-E)!==gn(T-_)){var w=[];if(gn(T-_)===gn(o[1]-o[0])){A=T;var R=_+o[1]-o[0];w[0]=Math.min(R,(R+E)/2),w[1]=Math.max(R,(R+E)/2)}else{A=E;var I=T+o[1]-o[0];w[0]=Math.min(_,(I+_)/2),w[1]=Math.max(_,(I+_)/2)}var P=[Math.min(_,(A+_)/2),Math.max(_,(A+_)/2)];if(e>P[0]&&e<=P[1]||e>=w[0]&&e<=w[1]){var N;return(N=n[c])===null||N===void 0?void 0:N.index}}else{var O=Math.min(E,T),D=Math.max(E,T);if(e>(O+_)/2&&e<=(D+_)/2){var G;return(G=n[c])===null||G===void 0?void 0:G.index}}}else if(t)for(var B=0;B(Q.coordinate+$.coordinate)/2||B>0&&B(Q.coordinate+$.coordinate)/2&&e<=(Q.coordinate+te.coordinate)/2)return Q.index}}return-1},NN=()=>me(x0),K0=(e,t)=>t,DN=(e,t,n)=>n,J0=(e,t,n,r)=>r,R7=Y(bi,e=>fd(e,t=>t.coordinate)),j0=Y([cl,K0,DN,J0],yN),X0=Y([j0,dl,tu,ru],H0),O7=(e,t,n)=>{if(t!=null){var r=cl(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},kN=Y([cl,K0,DN,J0],bN),$f=Y([hi,mi,He,Nt,bi,J0,kN],SN),N7=Y([j0,$f],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),UN=Y([bi,X0],pN),D7=Y([kN,X0,gi,tu,UN,EN,K0],_N),k7=Y([j0,X0],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),U7=(e,t,n,r,o,l,s)=>{if(!(!e||!n||!r||!o)&&P7(e,s)){var c=p6(e,t),d=ON(c,l,o,n,r),f=M7(t,o,d,e);return{activeIndex:String(d),activeCoordinate:f}}},L7=(e,t,n,r,o,l,s)=>{if(!(!e||!r||!o||!l||!n)){var c=E5(e,n);if(c){var d=h6(c,t),f=ON(d,s,l,r,o),h=I7(t,l,f,c);return{activeIndex:String(f),activeCoordinate:h}}}},z7=(e,t,n,r,o,l,s,c)=>{if(!(!e||!t||!r||!o||!l))return t==="horizontal"||t==="vertical"?U7(e,t,r,o,l,s,c):L7(e,t,n,r,o,l,s)},B7=Y(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),q7=Y(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Rt)),n=Array.from(new Set(t));return n.sort((r,o)=>r-o)},{memoizeOptions:{resultEqualityCheck:EK}});function T1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function A1(e){for(var t=1;tA1(A1({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),F7)},Y7=new Set(Object.values(Rt));function K7(e){return Y7.has(e)}var LN=bn({name:"zIndex",initialState:$7,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:it()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!K7(n)&&delete e.zIndexMap[n])},prepare:it()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:o}=t.payload;e.zIndexMap[n]?o?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:o?void 0:r,panoramaElement:o?r:void 0}},prepare:it()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:it()}}}),{registerZIndexPortal:J7,unregisterZIndexPortal:j7,registerZIndexPortalElement:X7,unregisterZIndexPortalElement:W7}=LN.actions,Z7=LN.reducer;function tr(e){var{zIndex:t,children:n}=e,r=Y6(),o=r&&t!==void 0&&t!==0,l=Zt(),s=ht();x.useLayoutEffect(()=>o?(s(J7({zIndex:t})),()=>{s(j7({zIndex:t}))}):Fo,[s,t,o]);var c=me(d=>B7(d,t,l));return o?c?qI.createPortal(n,c):null:n}function ay(){return ay=Object.assign?Object.assign.bind():function(e){for(var t=1;tx.useContext(zN),Gv={exports:{}},x1;function aJ(){return x1||(x1=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(d,f,h){this.fn=d,this.context=f,this.once=h||!1}function l(d,f,h,v,y){if(typeof h!="function")throw new TypeError("The listener must be a function");var E=new o(h,v||d,y),_=n?n+f:f;return d._events[_]?d._events[_].fn?d._events[_]=[d._events[_],E]:d._events[_].push(E):(d._events[_]=E,d._eventsCount++),d}function s(d,f){--d._eventsCount===0?d._events=new r:delete d._events[f]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var f=[],h,v;if(this._eventsCount===0)return f;for(v in h=this._events)t.call(h,v)&&f.push(n?v.slice(1):v);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(h)):f},c.prototype.listeners=function(f){var h=n?n+f:f,v=this._events[h];if(!v)return[];if(v.fn)return[v.fn];for(var y=0,E=v.length,_=new Array(E);y{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!fr(n))return e[n]}},uJ={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},qN=bn({name:"options",initialState:uJ,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),cJ=qN.reducer,{createEventEmitter:fJ}=qN.actions;function dJ(e){return e.tooltip.syncInteraction}var pJ={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},GN=bn({name:"chartData",initialState:pJ,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:M1,setDataStartEndIndexes:hJ,setComputedData:vte}=GN.actions,mJ=GN.reducer,vJ=["x","y"];function I1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ka(e){for(var t=1;td.rootProps.className);x.useEffect(()=>{if(e==null)return Fo;var d=(f,h,v)=>{if(t!==v&&e===f){if(r==="index"){var y;if(s&&h!==null&&h!==void 0&&(y=h.payload)!==null&&y!==void 0&&y.coordinate&&h.payload.sourceViewBox){var E=h.payload.coordinate,{x:_,y:T}=E,A=bJ(E,vJ),{x:w,y:R,width:I,height:P}=h.payload.sourceViewBox,N=ka(ka({},A),{},{x:s.x+(I?(_-w)/I:0)*s.width,y:s.y+(P?(T-R)/P:0)*s.height});n(ka(ka({},h),{},{payload:ka(ka({},h.payload),{},{coordinate:N})}))}else n(h);return}if(o!=null){var O;if(typeof r=="function"){var D={activeTooltipIndex:h.payload.index==null?void 0:Number(h.payload.index),isTooltipActive:h.payload.active,activeIndex:h.payload.index==null?void 0:Number(h.payload.index),activeLabel:h.payload.label,activeDataKey:h.payload.dataKey,activeCoordinate:h.payload.coordinate},G=r(o,D);O=o[G]}else r==="value"&&(O=o.find(V=>String(V.value)===h.payload.label));var{coordinate:B}=h.payload;if(O==null||h.payload.active===!1||B==null||s==null){n(iy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:Q,y:te}=B,$=Math.min(Q,s.x+s.width),oe=Math.min(te,s.y+s.height),se={x:l==="horizontal"?O.coordinate:$,y:l==="horizontal"?oe:O.coordinate},ye=iy({active:h.payload.active,coordinate:se,dataKey:h.payload.dataKey,index:String(O.index),label:h.payload.label,sourceViewBox:h.payload.sourceViewBox,graphicalItemId:h.payload.graphicalItemId});n(ye)}}};return Bs.on(ly,d),()=>{Bs.off(ly,d)}},[c,n,t,e,r,o,l,s])}function TJ(){var e=me(w0),t=me(M0),n=ht();x.useEffect(()=>{if(e==null)return Fo;var r=(o,l,s)=>{t!==s&&e===o&&n(hJ(l))};return Bs.on(w1,r),()=>{Bs.off(w1,r)}},[n,t,e])}function AJ(){var e=ht();x.useEffect(()=>{e(fJ())},[e]),_J(),TJ()}function CJ(e,t,n,r,o,l){var s=me(E=>O7(E,e,t)),c=me(M0),d=me(w0),f=me(EO),h=me(dJ),v=h==null?void 0:h.active,y=xd();x.useEffect(()=>{if(!v&&d!=null&&c!=null){var E=iy({active:l,coordinate:n,dataKey:s,index:o,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:void 0});Bs.emit(ly,d,E,c)}},[v,n,s,o,r,c,d,f,l,y])}function P1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function R1(e){for(var t=1;t{D(M9({shared:R,trigger:I,axisId:O,active:o,defaultIndex:G}))},[D,R,I,O,o,G]);var B=xd(),Q=mR(),te=_9(R),{activeIndex:$,isActive:oe}=(t=me(Ee=>k7(Ee,te,I,G)))!==null&&t!==void 0?t:{},se=me(Ee=>D7(Ee,te,I,G)),ye=me(Ee=>UN(Ee,te,I,G)),V=me(Ee=>N7(Ee,te,I,G)),X=se,ae=oJ(),he=(n=o??oe)!==null&&n!==void 0?n:!1,[ve,U]=Q4([X,he]),J=te==="axis"?ye:void 0;CJ(te,I,V,J,$,he);var ie=N??ae;if(ie==null||B==null||te==null)return null;var le=X??O1;he||(le=O1),f&&le.length&&(le=C4(le.filter(Ee=>Ee.value!=null&&(Ee.hide!==!0||r.includeHidden)),y,IJ));var be=le.length>0,Ae=x.createElement(b$,{allowEscapeViewBox:l,animationDuration:s,animationEasing:c,isAnimationActive:h,active:he,coordinate:V,hasPayload:be,offset:v,position:E,reverseDirection:_,useTranslate3d:T,viewBox:B,wrapperStyle:A,lastBoundingBox:ve,innerRef:U,hasPortalFromProps:!!N},PJ(d,R1(R1({},r),{},{payload:le,label:J,active:he,activeIndex:$,coordinate:V,accessibilityLayer:Q})));return x.createElement(x.Fragment,null,qI.createPortal(Ae,ie),he&&x.createElement(iJ,{cursor:w,tooltipEventType:te,coordinate:V,payload:le,index:$}))}var HN=e=>null;HN.displayName="Cell";function NJ(e,t,n){return(t=DJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DJ(e){var t=kJ(e,"string");return typeof t=="symbol"?t:t+""}function kJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class UJ{constructor(t){NJ(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function N1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function LJ(e){for(var t=1;t{try{var n=document.getElementById(k1);n||(n=document.createElement("span"),n.setAttribute("id",k1),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,HJ,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},As=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Js.isSsr)return{width:0,height:0};if(!VN.enableCache)return U1(t,n);var r=VJ(t,n),o=D1.get(r);if(o)return o;var l=U1(t,n);return D1.set(r,l),l},FN;function FJ(e,t,n){return(t=$J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $J(e){var t=YJ(e,"string");return typeof t=="symbol"?t:t+""}function YJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var L1=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,z1=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,KJ=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,JJ=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,jJ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},XJ=["cm","mm","pt","pc","in","Q","px"];function WJ(e){return XJ.includes(e)}var Ga="NaN";function ZJ(e,t){return e*jJ[t]}class Yt{static parse(t){var n,[,r,o]=(n=JJ.exec(t))!==null&&n!==void 0?n:[];return r==null?Yt.NaN:new Yt(parseFloat(r),o??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,fr(t)&&(this.unit=""),n!==""&&!KJ.test(n)&&(this.num=NaN,this.unit=""),WJ(n)&&(this.num=ZJ(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new Yt(NaN,""):new Yt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Yt(NaN,""):new Yt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Yt(NaN,""):new Yt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Yt(NaN,""):new Yt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return fr(this.num)}}FN=Yt;FJ(Yt,"NaN",new FN(NaN,""));function $N(e){if(e==null||e.includes(Ga))return Ga;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,o,l]=(n=L1.exec(t))!==null&&n!==void 0?n:[],s=Yt.parse(r??""),c=Yt.parse(l??""),d=o==="*"?s.multiply(c):s.divide(c);if(d.isNaN())return Ga;t=t.replace(L1,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,[,h,v,y]=(f=z1.exec(t))!==null&&f!==void 0?f:[],E=Yt.parse(h??""),_=Yt.parse(y??""),T=v==="+"?E.add(_):E.subtract(_);if(T.isNaN())return Ga;t=t.replace(z1,T.toString())}return t}var B1=/\(([^()]*)\)/;function QJ(e){for(var t=e,n;(n=B1.exec(t))!=null;){var[,r]=n;t=t.replace(B1,$N(r))}return t}function ej(e){var t=e.replace(/\s+/g,"");return t=QJ(t),t=$N(t),t}function tj(e){try{return ej(e)}catch{return Ga}}function Hv(e){var t=tj(e.slice(5,-1));return t===Ga?"":t}var nj=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],rj=["dx","dy","angle","className","breakAll"];function sy(){return sy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var o=[];ft(t)||(n?o=t.toString().split(""):o=t.toString().split(YN));var l=o.map(c=>({word:c,width:As(c,r).width})),s=n?0:As(" ",r).width;return{wordsWithComputedWidth:l,spaceWidth:s}}catch{return null}};function oj(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var JN=(e,t,n,r)=>e.reduce((o,l)=>{var{word:s,width:c}=l,d=o[o.length-1];if(d&&c!=null&&(t==null||r||d.width+c+ne.reduce((t,n)=>t.width>n.width?t:n),aj="…",G1=(e,t,n,r,o,l,s,c)=>{var d=e.slice(0,t),f=KN({breakAll:n,style:r,children:d+aj});if(!f)return[!1,[]];var h=JN(f.wordsWithComputedWidth,l,s,c),v=h.length>o||jN(h).width>Number(l);return[v,h]},lj=(e,t,n,r,o)=>{var{maxLines:l,children:s,style:c,breakAll:d}=e,f=ce(l),h=String(s),v=JN(t,r,n,o);if(!f||o)return v;var y=v.length>l||jN(v).width>Number(r);if(!y)return v;for(var E=0,_=h.length-1,T=0,A;E<=_&&T<=h.length-1;){var w=Math.floor((E+_)/2),R=w-1,[I,P]=G1(h,R,d,c,l,r,n,o),[N]=G1(h,w,d,c,l,r,n,o);if(!I&&!N&&(E=w+1),I&&N&&(_=w-1),!I&&N){A=P;break}T++}return A||v},H1=e=>{var t=ft(e)?[]:e.toString().split(YN);return[{words:t,width:void 0}]},sj=e=>{var{width:t,scaleToFit:n,children:r,style:o,breakAll:l,maxLines:s}=e;if((t||n)&&!Js.isSsr){var c,d,f=KN({breakAll:l,children:r,style:o});if(f){var{wordsWithComputedWidth:h,spaceWidth:v}=f;c=h,d=v}else return H1(r);return lj({breakAll:l,children:r,maxLines:s,style:o},c,d,t,!!n)}return H1(r)},XN="#808080",uj={angle:0,breakAll:!1,capHeight:"0.71em",fill:XN,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},W0=x.forwardRef((e,t)=>{var n=sn(e,uj),{x:r,y:o,lineHeight:l,capHeight:s,fill:c,scaleToFit:d,textAnchor:f,verticalAnchor:h}=n,v=q1(n,nj),y=x.useMemo(()=>sj({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:d,style:v.style,width:v.width}),[v.breakAll,v.children,v.maxLines,d,v.style,v.width]),{dx:E,dy:_,angle:T,className:A,breakAll:w}=v,R=q1(v,rj);if(!xr(r)||!xr(o)||y.length===0)return null;var I=Number(r)+(ce(E)?E:0),P=Number(o)+(ce(_)?_:0);if(!Me(I)||!Me(P))return null;var N;switch(h){case"start":N=Hv("calc(".concat(s,")"));break;case"middle":N=Hv("calc(".concat((y.length-1)/2," * -").concat(l," + (").concat(s," / 2))"));break;default:N=Hv("calc(".concat(y.length-1," * -").concat(l,")"));break}var O=[],D=y[0];if(d&&D!=null){var G=D.width,{width:B}=v;O.push("scale(".concat(ce(B)&&ce(G)?B/G:1,")"))}return T&&O.push("rotate(".concat(T,", ").concat(I,", ").concat(P,")")),O.length&&(R.transform=O.join(" ")),x.createElement("text",sy({},on(R),{ref:t,x:I,y:P,className:Xe("recharts-text",A),textAnchor:f,fill:c.includes("url")?XN:c}),y.map((Q,te)=>{var $=Q.words.join(w?"":" ");return x.createElement("tspan",{x:I,dy:te===0?N:l,key:"".concat($,"-").concat(te)},$)}))});W0.displayName="Text";function V1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function _r(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:o}=e,{x:l,y:s,height:c,upperWidth:d,lowerWidth:f}=Wy(t),h=l,v=l+(d-f)/2,y=(h+v)/2,E=(d+f)/2,_=h+d/2,T=c>=0?1:-1,A=T*r,w=T>0?"end":"start",R=T>0?"start":"end",I=d>=0?1:-1,P=I*r,N=I>0?"end":"start",O=I>0?"start":"end",D=o;if(n==="top"){var G={x:h+d/2,y:s-A,horizontalAnchor:"middle",verticalAnchor:w};return D&&(G.height=Math.max(s-D.y,0),G.width=d),G}if(n==="bottom"){var B={x:v+f/2,y:s+c+A,horizontalAnchor:"middle",verticalAnchor:R};return D&&(B.height=Math.max(D.y+D.height-(s+c),0),B.width=f),B}if(n==="left"){var Q={x:y-P,y:s+c/2,horizontalAnchor:N,verticalAnchor:"middle"};return D&&(Q.width=Math.max(Q.x-D.x,0),Q.height=c),Q}if(n==="right"){var te={x:y+E+P,y:s+c/2,horizontalAnchor:O,verticalAnchor:"middle"};return D&&(te.width=Math.max(D.x+D.width-te.x,0),te.height=c),te}var $=D?{width:E,height:c}:{};return n==="insideLeft"?_r({x:y+P,y:s+c/2,horizontalAnchor:O,verticalAnchor:"middle"},$):n==="insideRight"?_r({x:y+E-P,y:s+c/2,horizontalAnchor:N,verticalAnchor:"middle"},$):n==="insideTop"?_r({x:h+d/2,y:s+A,horizontalAnchor:"middle",verticalAnchor:R},$):n==="insideBottom"?_r({x:v+f/2,y:s+c-A,horizontalAnchor:"middle",verticalAnchor:w},$):n==="insideTopLeft"?_r({x:h+P,y:s+A,horizontalAnchor:O,verticalAnchor:R},$):n==="insideTopRight"?_r({x:h+d-P,y:s+A,horizontalAnchor:N,verticalAnchor:R},$):n==="insideBottomLeft"?_r({x:v+P,y:s+c-A,horizontalAnchor:O,verticalAnchor:w},$):n==="insideBottomRight"?_r({x:v+f-P,y:s+c-A,horizontalAnchor:N,verticalAnchor:w},$):n&&typeof n=="object"&&(ce(n.x)||Uo(n.x))&&(ce(n.y)||Uo(n.y))?_r({x:l+dr(n.x,E),y:s+dr(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},$):_r({x:_,y:s+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},$)},hj=["labelRef"],mj=["content"];function F1(e,t){if(e==null)return{};var n,r,o=vj(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r{var{x:t,y:n,upperWidth:r,lowerWidth:o,width:l,height:s,children:c}=e,d=x.useMemo(()=>({x:t,y:n,upperWidth:r,lowerWidth:o,width:l,height:s}),[t,n,r,o,l,s]);return x.createElement(WN.Provider,{value:d},c)},ZN=()=>{var e=x.useContext(WN),t=xd();return e||(t?Wy(t):void 0)},Ej=x.createContext(null),_j=()=>{var e=x.useContext(Ej),t=me(xO);return e||t},Tj=e=>{var{value:t,formatter:n}=e,r=ft(e.children)?t:e.children;return typeof n=="function"?n(r):r},Z0=e=>e!=null&&typeof e=="function",Aj=(e,t)=>{var n=gn(t-e),r=Math.min(Math.abs(t-e),360);return n*r},Cj=(e,t,n,r,o)=>{var{offset:l,className:s}=e,{cx:c,cy:d,innerRadius:f,outerRadius:h,startAngle:v,endAngle:y,clockWise:E}=o,_=(f+h)/2,T=Aj(v,y),A=T>=0?1:-1,w,R;switch(t){case"insideStart":w=v+A*l,R=E;break;case"insideEnd":w=y-A*l,R=!E;break;case"end":w=y+A*l,R=E;break;default:throw new Error("Unsupported position ".concat(t))}R=T<=0?R:!R;var I=Kt(c,d,_,w),P=Kt(c,d,_,w+(R?1:-1)*359),N="M".concat(I.x,",").concat(I.y,` A`).concat(_,",").concat(_,",0,1,").concat(R?0:1,`, `).concat(P.x,",").concat(P.y),O=ft(e.id)?xs("recharts-radial-line-"):e.id;return x.createElement("text",Qr({},r,{dominantBaseline:"central",className:Xe("recharts-radial-bar-label",s)}),x.createElement("defs",null,x.createElement("path",{id:O,d:N})),x.createElement("textPath",{xlinkHref:"#".concat(O)},n))},xj=(e,t,n)=>{var{cx:r,cy:o,innerRadius:l,outerRadius:s,startAngle:c,endAngle:d}=e,f=(c+d)/2;if(n==="outside"){var{x:h,y:v}=Kt(r,o,s+t,f);return{x:h,y:v,textAnchor:h>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:o,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:o,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:o,textAnchor:"middle",verticalAnchor:"end"};var y=(l+s)/2,{x:E,y:_}=Kt(r,o,y,f);return{x:E,y:_,textAnchor:"middle",verticalAnchor:"middle"}},Wc=e=>e!=null&&"cx"in e&&ce(e.cx),wj={angle:0,offset:5,zIndex:Rt.label,position:"middle",textBreakAll:!1};function Mj(e){if(!Wc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,o=r*2;return{x:t-r,y:n-r,width:o,upperWidth:o,lowerWidth:o,height:o}}function Ki(e){var t=sn(e,wj),{viewBox:n,parentViewBox:r,position:o,value:l,children:s,content:c,className:d="",textBreakAll:f,labelRef:h}=t,v=_j(),y=ZN(),E=o==="center"?y:v??y,_,T,A;n==null?_=E:Wc(n)?_=n:_=Wy(n);var w=Mj(_);if(!_||ft(l)&&ft(s)&&!x.isValidElement(c)&&typeof c!="function")return null;var R=_s(_s({},t),{},{viewBox:_});if(x.isValidElement(c)){var{labelRef:I}=R,P=F1(R,hj);return x.cloneElement(c,P)}if(typeof c=="function"){var{content:N}=R,O=F1(R,mj);if(T=x.createElement(c,O),x.isValidElement(T))return T}else T=Tj(t);var D=on(t);if(Wc(_)){if(o==="insideStart"||o==="insideEnd"||o==="end")return Cj(t,o,T,D,_);A=xj(_,t.offset,t.position)}else{if(!w)return null;var G=pj({viewBox:w,position:o,offset:t.offset,parentViewBox:Wc(r)?void 0:r});A=_s(_s({x:G.x,y:G.y,textAnchor:G.horizontalAnchor,verticalAnchor:G.verticalAnchor},G.width!==void 0?{width:G.width}:{}),G.height!==void 0?{height:G.height}:{})}return x.createElement(tr,{zIndex:t.zIndex},x.createElement(W0,Qr({ref:h,className:Xe("recharts-label",d)},D,A,{textAnchor:oj(D.textAnchor)?D.textAnchor:A.textAnchor,breakAll:f}),T))}Ki.displayName="Label";var Ij=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?x.createElement(Ki,Qr({key:"label-implicit"},r)):xr(e)?x.createElement(Ki,Qr({key:"label-implicit",value:e},r)):x.isValidElement(e)?e.type===Ki?x.cloneElement(e,_s({key:"label-implicit"},r)):x.createElement(Ki,Qr({key:"label-implicit",content:e},r)):Z0(e)?x.createElement(Ki,Qr({key:"label-implicit",content:e},r)):e&&typeof e=="object"?x.createElement(Ki,Qr({},e,{key:"label-implicit"},r)):null};function Pj(e){var{label:t,labelRef:n}=e,r=ZN();return Ij(t,r,n)||null}var Vv={},Fv={},Y1;function Rj(){return Y1||(Y1=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(Fv)),Fv}var $v={},K1;function Oj(){return K1||(K1=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})($v)),$v}var J1;function Nj(){return J1||(J1=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Rj(),n=Oj(),r=qy();function o(l){if(r.isArrayLike(l))return t.last(n.toArray(l))}e.last=o})(Vv)),Vv}var Yv,j1;function Dj(){return j1||(j1=1,Yv=Nj().last),Yv}var kj=Dj();const Uj=Ir(kj);var Lj=["valueAccessor"],zj=["dataKey","clockWise","id","textBreakAll","zIndex"];function Yf(){return Yf=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?Uj(e.value):e.value,QN=x.createContext(void 0),eD=QN.Provider,tD=x.createContext(void 0);tD.Provider;function Gj(){return x.useContext(QN)}function Hj(){return x.useContext(tD)}function Zc(e){var{valueAccessor:t=qj}=e,n=X1(e,Lj),{dataKey:r,clockWise:o,id:l,textBreakAll:s,zIndex:c}=n,d=X1(n,zj),f=Gj(),h=Hj(),v=f||h;return!v||!v.length?null:x.createElement(tr,{zIndex:c??Rt.label},x.createElement(an,{className:"recharts-label-list"},v.map((y,E)=>{var _,T=ft(r)?t(y,E):St(y.payload,r),A=ft(l)?{}:{id:"".concat(l,"-").concat(E)};return x.createElement(Ki,Yf({key:"label-".concat(E)},on(y),d,A,{fill:(_=n.fill)!==null&&_!==void 0?_:y.fill,parentViewBox:y.parentViewBox,value:T,textBreakAll:s,viewBox:y.viewBox,index:E,zIndex:0}))})))}Zc.displayName="LabelList";function nD(e){var{label:t}=e;return t?t===!0?x.createElement(Zc,{key:"labelList-implicit"}):x.isValidElement(t)||Z0(t)?x.createElement(Zc,{key:"labelList-implicit",content:t}):typeof t=="object"?x.createElement(Zc,Yf({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function uy(){return uy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:o}=e,l=Xe("recharts-dot",o);return ce(t)&&ce(n)&&ce(r)?x.createElement("circle",uy({},Wn(e),zy(e),{className:l,cx:t,cy:n,r})):null},Vj={radiusAxis:{},angleAxis:{}},iD=bn({name:"polarAxis",initialState:Vj,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:gte,removeRadiusAxis:yte,addAngleAxis:Ste,removeAngleAxis:bte}=iD.actions,Fj=iD.reducer;function $j(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var Kv={exports:{}},je={};/** * @license React * react-is.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 W1;function Yj(){if(W1)return je;W1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.view_transition"),E=Symbol.for("react.client.reference");function _(T){if(typeof T=="object"&&T!==null){var A=T.$$typeof;switch(A){case e:switch(T=T.type,T){case n:case o:case r:case d:case f:case y:return T;default:switch(T=T&&T.$$typeof,T){case s:case c:case v:case h:return T;case l:return T;default:return A}}case t:return A}}}return je.ContextConsumer=l,je.ContextProvider=s,je.Element=e,je.ForwardRef=c,je.Fragment=n,je.Lazy=v,je.Memo=h,je.Portal=t,je.Profiler=o,je.StrictMode=r,je.Suspense=d,je.SuspenseList=f,je.isContextConsumer=function(T){return _(T)===l},je.isContextProvider=function(T){return _(T)===s},je.isElement=function(T){return typeof T=="object"&&T!==null&&T.$$typeof===e},je.isForwardRef=function(T){return _(T)===c},je.isFragment=function(T){return _(T)===n},je.isLazy=function(T){return _(T)===v},je.isMemo=function(T){return _(T)===h},je.isPortal=function(T){return _(T)===t},je.isProfiler=function(T){return _(T)===o},je.isStrictMode=function(T){return _(T)===r},je.isSuspense=function(T){return _(T)===d},je.isSuspenseList=function(T){return _(T)===f},je.isValidElementType=function(T){return typeof T=="string"||typeof T=="function"||T===n||T===o||T===r||T===d||T===f||typeof T=="object"&&T!==null&&(T.$$typeof===v||T.$$typeof===h||T.$$typeof===s||T.$$typeof===l||T.$$typeof===c||T.$$typeof===E||T.getModuleId!==void 0)},je.typeOf=_,je}var Z1;function Kj(){return Z1||(Z1=1,Kv.exports=Yj()),Kv.exports}var Jj=Kj(),Q1=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",eM=null,Jv=null,oD=e=>{if(e===eM&&Array.isArray(Jv))return Jv;var t=[];return x.Children.forEach(e,n=>{ft(n)||(Jj.isFragment(n)?t=t.concat(oD(n.props.children)):t.push(n))}),Jv=t,eM=e,t};function jj(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(o=>Q1(o)):r=[Q1(t)],oD(e).forEach(o=>{var l=Ka(o,"type.displayName")||Ka(o,"type.name");l&&r.indexOf(l)!==-1&&n.push(o)}),n}var aD=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,jv={},tM;function Xj(){return tM||(tM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var o;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const l=n[Symbol.toStringTag];return l==null||!((o=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&o.writable)?!1:n.toString()===`[object ${l}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(jv)),jv}var Xv,nM;function Wj(){return nM||(nM=1,Xv=Xj().isPlainObject),Xv}var Zj=Wj();const Qj=Ir(Zj);var rM,iM,oM,aM,lM;function sM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function uM(e){for(var t=1;t{var l=n-r,s;return s=ct(rM||(rM=ys(["M ",",",""])),e,t),s+=ct(iM||(iM=ys(["L ",",",""])),e+n,t),s+=ct(oM||(oM=ys(["L ",",",""])),e+n-l/2,t+o),s+=ct(aM||(aM=ys(["L ",",",""])),e+n-l/2-r,t+o),s+=ct(lM||(lM=ys(["L ",","," Z"])),e,t),s},rX={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},iX=e=>{var t=sn(e,rX),{x:n,y:r,upperWidth:o,lowerWidth:l,height:s,className:c}=t,{animationEasing:d,animationDuration:f,animationBegin:h,isUpdateAnimationActive:v}=t,y=x.useRef(null),[E,_]=x.useState(-1),T=x.useRef(o),A=x.useRef(l),w=x.useRef(s),R=x.useRef(n),I=x.useRef(r),P=Rd(e,"trapezoid-");if(x.useEffect(()=>{if(y.current&&y.current.getTotalLength)try{var se=y.current.getTotalLength();se&&_(se)}catch{}},[]),n!==+n||r!==+r||o!==+o||l!==+l||s!==+s||o===0&&l===0||s===0)return null;var N=Xe("recharts-trapezoid",c);if(!v)return x.createElement("g",null,x.createElement("path",Kf({},on(t),{className:N,d:cM(n,r,o,l,s)})));var O=T.current,D=A.current,G=w.current,B=R.current,Q=I.current,te="0px ".concat(E===-1?1:E,"px"),$="".concat(E,"px 0px"),oe=vR(["strokeDasharray"],f,d);return x.createElement(Pd,{animationId:P,key:P,canBegin:E>0,duration:f,easing:d,isActive:v,begin:h},se=>{var ye=at(O,o,se),V=at(D,l,se),X=at(G,s,se),ae=at(B,n,se),he=at(Q,r,se);y.current&&(T.current=ye,A.current=V,w.current=X,R.current=ae,I.current=he);var ve=se>0?{transition:oe,strokeDasharray:$}:{strokeDasharray:te};return x.createElement("path",Kf({},on(t),{className:N,d:cM(ae,he,ye,V,X),ref:y,style:uM(uM({},ve),t.style)}))})},oX=["option","shapeType","activeClassName"];function aX(e,t){if(e==null)return{};var n,r,o=lX(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r{var r=ht();return(o,l)=>s=>{e==null||e(o,l,s),r(mN({activeIndex:String(l),activeDataKey:t,activeCoordinate:o.tooltipPosition,activeGraphicalItemId:n}))}},sD=e=>{var t=ht();return(n,r)=>o=>{e==null||e(n,r,o),t(I9())}},uD=(e,t,n)=>{var r=ht();return(o,l)=>s=>{e==null||e(o,l,s),r(P9({activeIndex:String(l),activeDataKey:t,activeCoordinate:o.tooltipPosition,activeGraphicalItemId:n}))}};function cD(e){var{tooltipEntrySettings:t}=e,n=ht(),r=Zt(),o=x.useRef(null);return x.useLayoutEffect(()=>{r||(o.current===null?n(C9(t)):o.current!==t&&n(x9({prev:o.current,next:t})),o.current=t)},[t,n,r]),x.useLayoutEffect(()=>()=>{o.current&&(n(w9(o.current)),o.current=null)},[n]),null}function fD(e){var{legendPayload:t}=e,n=ht(),r=Zt(),o=x.useRef(null);return x.useLayoutEffect(()=>{r||(o.current===null?n(o$(t)):o.current!==t&&n(a$({prev:o.current,next:t})),o.current=t)},[n,r,t]),x.useLayoutEffect(()=>()=>{o.current&&(n(l$(o.current)),o.current=null)},[n]),null}var Wv,mX=()=>{var[e]=x.useState(()=>xs("uid-"));return e},vX=(Wv=AU.useId)!==null&&Wv!==void 0?Wv:mX;function gX(e,t){var n=vX();return t||(e?"".concat(e,"-").concat(n):n)}var yX=x.createContext(void 0),dD=e=>{var{id:t,type:n,children:r}=e,o=gX("recharts-".concat(n),t);return x.createElement(yX.Provider,{value:o},r(o))},SX={cartesianItems:[],polarItems:[]},pD=bn({name:"graphicalItems",initialState:SX,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:it()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,o=cr(e).cartesianItems.indexOf(n);o>-1&&(e.cartesianItems[o]=r)},prepare:it()},removeCartesianGraphicalItem:{reducer(e,t){var n=cr(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:it()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:it()},removePolarGraphicalItem:{reducer(e,t){var n=cr(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:it()}}}),{addCartesianGraphicalItem:bX,replaceCartesianGraphicalItem:EX,removeCartesianGraphicalItem:_X,addPolarGraphicalItem:Ete,removePolarGraphicalItem:_te}=pD.actions,TX=pD.reducer,AX=e=>{var t=ht(),n=x.useRef(null);return x.useLayoutEffect(()=>{n.current===null?t(bX(e)):n.current!==e&&t(EX({prev:n.current,next:e})),n.current=e},[t,e]),x.useLayoutEffect(()=>()=>{n.current&&(t(_X(n.current)),n.current=null)},[t]),null},hD=x.memo(AX),CX=["points"];function pM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Zv(e){for(var t=1;t{var A,w,R=Zv(Zv(Zv({r:3},s),v),{},{index:T,cx:(A=_.x)!==null&&A!==void 0?A:void 0,cy:(w=_.y)!==null&&w!==void 0?w:void 0,dataKey:l,value:_.value,payload:_.payload,points:t});return x.createElement(RX,{key:"dot-".concat(T),option:n,dotProps:R,className:o})}),E={};return c&&d!=null&&(E.clipPath="url(#clipPath-".concat(h?"":"dots-").concat(d,")")),x.createElement(tr,{zIndex:f},x.createElement(an,jf({className:r},E),y))}function hM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function mM(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),KX=Y([YX,hi,mi],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Q0=()=>me(KX),JX=()=>me(S7);function vM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Qv(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:o,dataKey:l,clipPath:s}=e;if(o===!1||t.x==null||t.y==null)return null;var c={index:n,dataKey:l,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},d=Qv(Qv(Qv({},c),Gs(o)),zy(o)),f;return x.isValidElement(o)?f=x.cloneElement(o,d):typeof o=="function"?f=o(d):f=x.createElement(rD,d),x.createElement(an,{className:"recharts-active-dot",clipPath:s},f)};function gM(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:o,clipPath:l,zIndex:s=Rt.activeDot}=e,c=me(Go),d=JX();if(t==null||d==null)return null;var f=t.find(h=>d.includes(h.payload));return ft(f)?null:x.createElement(tr,{zIndex:s},x.createElement(ZX,{point:f,childIndex:Number(c),mainColor:n,dataKey:o,activeDot:r,clipPath:l}))}var yM=(e,t,n)=>{var r=n??e;if(!ft(r))return dr(r,t,0)},QX=(e,t,n)=>{var r={},o=e.filter(Fd),l=e.filter(f=>f.stackId==null),s=o.reduce((f,h)=>{var v=f[h.stackId];return v==null&&(v=[]),v.push(h),f[h.stackId]=v,f},r),c=Object.entries(s).map(f=>{var h,[v,y]=f,E=y.map(T=>T.dataKey),_=yM(t,n,(h=y[0])===null||h===void 0?void 0:h.barSize);return{stackId:v,dataKeys:E,barSize:_}}),d=l.map(f=>{var h=[f.dataKey].filter(y=>y!=null),v=yM(t,n,f.barSize);return{stackId:void 0,dataKeys:h,barSize:v}});return[...c,...d]};function SM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vc(e){for(var t=1;tR+(I.barSize||0),0);y+=(s-1)*c,y>=n&&(y-=(s-1)*c,c=0),y>=n&&v>0&&(h=!0,v*=.9,y=s*v);var E=(n-y)/2>>0,_={offset:E-c,size:0};d=r.reduce((R,I)=>{var P,N={stackId:I.stackId,dataKeys:I.dataKeys,position:{offset:_.offset+_.size+c,size:h?v:(P=I.barSize)!==null&&P!==void 0?P:0}},O=[...R,N];return _=N.position,O},f)}else{var T=dr(t,n,0,!0);n-2*T-(s-1)*c<=0&&(c=0);var A=(n-2*T-(s-1)*c)/s;A>1&&(A>>=0);var w=Me(o)?Math.min(A,o):A;d=r.reduce((R,I,P)=>[...R,{stackId:I.stackId,dataKeys:I.dataKeys,position:{offset:T+(A+c)*P+(A-w)/2,size:w}}],f)}return d}}var iW=(e,t,n,r,o,l,s)=>{var c=ft(s)?t:s,d=rW(n,r,o!==l?o:l,e,c);return o!==l&&d!=null&&(d=d.map(f=>Vc(Vc({},f),{},{position:Vc(Vc({},f.position),{},{offset:f.position.offset-o/2})}))),d},oW=(e,t)=>{var n=Vd(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var o=e[r];if(o){var{stackedData:l}=o;if(l)return l.find(s=>s.key===n)}}}},aW=(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function lW(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Me(e.zIndex)?e.zIndex:t}var sW=e=>{var{chartData:t}=e,n=ht(),r=Zt();return x.useEffect(()=>r?()=>{}:(n(M1(t)),()=>{n(M1(void 0))}),[t,n,r]),null},bM={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},gD=bn({name:"brush",initialState:bM,reducers:{setBrushSettings(e,t){return t.payload==null?bM:t.payload}}}),{setBrushSettings:xte}=gD.actions,uW=gD.reducer;function cW(e){return(e%180+180)%180}var fW=function(t){var{width:n,height:r}=t,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=cW(o),s=l*Math.PI/180,c=Math.atan(r/n),d=s>c&&s{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=cr(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=cr(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=cr(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:wte,removeDot:Mte,addArea:Ite,removeArea:Pte,addLine:Rte,removeLine:Ote}=yD.actions,pW=yD.reducer,hW=x.createContext(void 0),mW=e=>{var{children:t}=e,[n]=x.useState("".concat(xs("recharts"),"-clip")),r=Q0();if(r==null)return null;var{x:o,y:l,width:s,height:c}=r;return x.createElement(hW.Provider,{value:n},x.createElement("defs",null,x.createElement("clipPath",{id:n},x.createElement("rect",{x:o,y:l,height:c,width:s}))),t)};function SD(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;re*o)return!1;var l=n();return e*(t-e*l/2-r)>=0&&e*(t+e*l/2-o)<=0}function yW(e,t){return SD(e,t+1)}function SW(e,t,n,r,o){for(var l=(r||[]).slice(),{start:s,end:c}=t,d=0,f=1,h=s,v=function(){var _=r==null?void 0:r[d];if(_===void 0)return{v:SD(r,f)};var T=d,A,w=()=>(A===void 0&&(A=n(_,T)),A),R=_.coordinate,I=d===0||qs(e,R,w,h,c);I||(d=0,h=s,f+=1),I&&(h=R+e*(w()/2+o),d+=f)},y;f<=l.length;)if(y=v(),y)return y.v;return[]}function bW(e,t,n,r,o){var l=(r||[]).slice(),s=l.length;if(s===0)return[];for(var{start:c,end:d}=t,f=1;f<=s;f++){for(var h=(s-1)%f,v=c,y=!0,E=function(){var P=r[T];if(P==null)return 0;var N=T,O,D=()=>(O===void 0&&(O=n(P,N)),O),G=P.coordinate,B=T===h||qs(e,G,D,v,d);if(!B)return y=!1,1;B&&(v=G+e*(D()/2+o))},_,T=h;T(T===void 0&&(T=n(E,y)),T);if(y===s-1){var w=e*(_.coordinate+e*A()/2-d);l[y]=_=jt(jt({},_),{},{tickCoord:w>0?_.coordinate-w*e:_.coordinate})}else l[y]=_=jt(jt({},_),{},{tickCoord:_.coordinate});if(_.tickCoord!=null){var R=qs(e,_.tickCoord,A,c,d);R&&(d=_.tickCoord-e*(A()/2+o),l[y]=jt(jt({},_),{},{isShow:!0}))}},h=s-1;h>=0;h--)f(h);return l}function CW(e,t,n,r,o,l){var s=(r||[]).slice(),c=s.length,{start:d,end:f}=t;if(l){var h=r[c-1];if(h!=null){var v=n(h,c-1),y=e*(h.coordinate+e*v/2-f);if(s[c-1]=h=jt(jt({},h),{},{tickCoord:y>0?h.coordinate-y*e:h.coordinate}),h.tickCoord!=null){var E=qs(e,h.tickCoord,()=>v,d,f);E&&(f=h.tickCoord-e*(v/2+o),s[c-1]=jt(jt({},h),{},{isShow:!0}))}}}for(var _=l?c-1:c,T=function(R){var I=s[R];if(I==null)return 1;var P=I,N,O=()=>(N===void 0&&(N=n(I,R)),N);if(R===0){var D=e*(P.coordinate-e*O()/2-d);s[R]=P=jt(jt({},P),{},{tickCoord:D<0?P.coordinate-D*e:P.coordinate})}else s[R]=P=jt(jt({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var G=qs(e,P.tickCoord,O,d,f);G&&(d=P.tickCoord+e*(O()/2+o),s[R]=jt(jt({},P),{},{isShow:!0}))}},A=0;A<_;A++)T(A);return s}function eS(e,t,n){var{tick:r,ticks:o,viewBox:l,minTickGap:s,orientation:c,interval:d,tickFormatter:f,unit:h,angle:v}=e;if(!o||!o.length||!r)return[];if(ce(d)||Js.isSsr){var y;return(y=yW(o,ce(d)?d:0))!==null&&y!==void 0?y:[]}var E=[],_=c==="top"||c==="bottom"?"width":"height",T=h&&_==="width"?As(h,{fontSize:t,letterSpacing:n}):{width:0,height:0},A=(N,O)=>{var D=typeof f=="function"?f(N.value,O):N.value;return _==="width"?vW(As(D,{fontSize:t,letterSpacing:n}),T,v):As(D,{fontSize:t,letterSpacing:n})[_]},w=o[0],R=o[1],I=o.length>=2&&w!=null&&R!=null?gn(R.coordinate-w.coordinate):1,P=gW(l,I,_);return d==="equidistantPreserveStart"?SW(I,P,A,o,s):d==="equidistantPreserveEnd"?bW(I,P,A,o,s):(d==="preserveStart"||d==="preserveStartEnd"?E=CW(I,P,A,o,s,d==="preserveStartEnd"):E=AW(I,P,A,o,s),E.filter(N=>N.isShow))}var xW=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:o=0,tickMargin:l=0}=e,s=0;if(t){Array.from(t).forEach(h=>{if(h){var v=h.getBoundingClientRect();v.width>s&&(s=v.width)}});var c=n?n.getBoundingClientRect().width:0,d=o+l,f=s+d+c+(n?r:0);return Math.round(f)}return 0},wW=["axisLine","width","height","className","hide","ticks","axisType"];function MW(e,t){if(e==null)return{};var n,r,o=IW(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r{var{ticks:n=[],tick:r,tickLine:o,stroke:l,tickFormatter:s,unit:c,padding:d,tickTextProps:f,orientation:h,mirror:v,x:y,y:E,width:_,height:T,tickSize:A,tickMargin:w,fontSize:R,letterSpacing:I,getTicksConfig:P,events:N,axisType:O}=e,D=eS(ut(ut({},P),{},{ticks:n}),R,I),G=kW(h,v),B=UW(h,v),Q=Wn(P),te=Gs(r),$={};typeof o=="object"&&($=o);var oe=ut(ut({},Q),{},{fill:"none"},$),se=D.map(X=>ut({entry:X},DW(X,y,E,_,T,h,A,v,w))),ye=se.map(X=>{var{entry:ae,line:he}=X;return x.createElement(an,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(ae.value,"-").concat(ae.coordinate,"-").concat(ae.tickCoord)},o&&x.createElement("line",Ho({},oe,he,{className:Xe("recharts-cartesian-axis-tick-line",Ka(o,"className"))})))}),V=se.map((X,ae)=>{var he,ve,{entry:U,tick:J}=X,ie=ut(ut(ut(ut({verticalAnchor:B},Q),{},{textAnchor:G,stroke:"none",fill:l},J),{},{index:ae,payload:U,visibleTicksCount:D.length,tickFormatter:s,padding:d},f),{},{angle:(he=(ve=f==null?void 0:f.angle)!==null&&ve!==void 0?ve:Q.angle)!==null&&he!==void 0?he:0}),le=ut(ut({},ie),te);return x.createElement(an,Ho({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(U.value,"-").concat(U.coordinate,"-").concat(U.tickCoord)},By(N,U,ae)),r&&x.createElement(LW,{option:r,tickProps:le,value:"".concat(typeof s=="function"?s(U.value,ae):U.value).concat(c||"")}))});return x.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(O,"-ticks")},V.length>0&&x.createElement(tr,{zIndex:Rt.label},x.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(O,"-tick-labels"),ref:t},V)),ye.length>0&&x.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(O,"-tick-lines")},ye))}),BW=x.forwardRef((e,t)=>{var{axisLine:n,width:r,height:o,className:l,hide:s,ticks:c,axisType:d}=e,f=MW(e,wW),[h,v]=x.useState(""),[y,E]=x.useState(""),_=x.useRef(null);x.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var A;return xW({ticks:_.current,label:(A=e.labelRef)===null||A===void 0?void 0:A.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var T=x.useCallback(A=>{if(A){var w=A.getElementsByClassName("recharts-cartesian-axis-tick-value");_.current=w;var R=w[0];if(R){var I=window.getComputedStyle(R),P=I.fontSize,N=I.letterSpacing;(P!==h||N!==y)&&(v(P),E(N))}}},[h,y]);return s||r!=null&&r<=0||o!=null&&o<=0?null:x.createElement(tr,{zIndex:e.zIndex},x.createElement(an,{className:Xe("recharts-cartesian-axis",l)},x.createElement(NW,{x:e.x,y:e.y,width:r,height:o,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Wn(e)}),x.createElement(zW,{ref:T,axisType:d,events:f,fontSize:h,getTicksConfig:e,height:e.height,letterSpacing:y,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y}),x.createElement(bj,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},x.createElement(Pj,{label:e.label,labelRef:e.labelRef}),e.children)))}),tS=x.forwardRef((e,t)=>{var n=sn(e,ri);return x.createElement(BW,Ho({},n,{ref:t}))});tS.displayName="CartesianAxis";var qW=["x1","y1","x2","y2","key"],GW=["offset"],HW=["xAxisId","yAxisId"],VW=["xAxisId","yAxisId"];function TM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:o,width:l,height:s,ry:c}=e;return x.createElement("rect",{x:r,y:o,ry:c,width:l,height:s,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function bD(e){var{option:t,lineItemProps:n}=e,r;if(x.isValidElement(t))r=x.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var o,{x1:l,y1:s,x2:c,y2:d,key:f}=n,h=Xf(n,qW),v=(o=Wn(h))!==null&&o!==void 0?o:{},{offset:y}=v,E=Xf(v,GW);r=x.createElement("line",Po({},E,{x1:l,y1:s,x2:c,y2:d,fill:"none",key:f}))}return r}function jW(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:o}=e;if(!r||!o||!o.length)return null;var{xAxisId:l,yAxisId:s}=e,c=Xf(e,HW),d=o.map((f,h)=>{var v=Xt(Xt({},c),{},{x1:t,y1:f,x2:t+n,y2:f,key:"line-".concat(h),index:h});return x.createElement(bD,{key:"line-".concat(h),option:r,lineItemProps:v})});return x.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function XW(e){var{y:t,height:n,vertical:r=!0,verticalPoints:o}=e;if(!r||!o||!o.length)return null;var{xAxisId:l,yAxisId:s}=e,c=Xf(e,VW),d=o.map((f,h)=>{var v=Xt(Xt({},c),{},{x1:f,y1:t,x2:f,y2:t+n,key:"line-".concat(h),index:h});return x.createElement(bD,{option:r,lineItemProps:v,key:"line-".concat(h)})});return x.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function WW(e){var{horizontalFill:t,fillOpacity:n,x:r,y:o,width:l,height:s,horizontalPoints:c,horizontal:d=!0}=e;if(!d||!t||!t.length||c==null)return null;var f=c.map(v=>Math.round(v+o-o)).sort((v,y)=>v-y);o!==f[0]&&f.unshift(0);var h=f.map((v,y)=>{var E=f[y+1],_=E==null,T=_?o+s-v:E-v;if(T<=0)return null;var A=y%t.length;return x.createElement("rect",{key:"react-".concat(y),y:v,x:r,height:T,width:l,stroke:"none",fill:t[A],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return x.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function ZW(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:o,y:l,width:s,height:c,verticalPoints:d}=e;if(!t||!n||!n.length)return null;var f=d.map(v=>Math.round(v+o-o)).sort((v,y)=>v-y);o!==f[0]&&f.unshift(0);var h=f.map((v,y)=>{var E=f[y+1],_=E==null,T=_?o+s-v:E-v;if(T<=0)return null;var A=y%n.length;return x.createElement("rect",{key:"react-".concat(y),x:v,y:l,width:T,height:c,stroke:"none",fill:n[A],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return x.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}var QW=(e,t)=>{var{xAxis:n,width:r,height:o,offset:l}=e;return WP(eS(Xt(Xt(Xt({},ri),n),{},{ticks:ZP(n),viewBox:{x:0,y:0,width:r,height:o}})),l.left,l.left+l.width,t)},eZ=(e,t)=>{var{yAxis:n,width:r,height:o,offset:l}=e;return WP(eS(Xt(Xt(Xt({},ri),n),{},{ticks:ZP(n),viewBox:{x:0,y:0,width:r,height:o}})),l.top,l.top+l.height,t)},tZ={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Rt.grid};function cy(e){var t=oR(),n=aR(),r=iR(),o=Xt(Xt({},sn(e,tZ)),{},{x:ce(e.x)?e.x:r.left,y:ce(e.y)?e.y:r.top,width:ce(e.width)?e.width:r.width,height:ce(e.height)?e.height:r.height}),{xAxisId:l,yAxisId:s,x:c,y:d,width:f,height:h,syncWithTicks:v,horizontalValues:y,verticalValues:E}=o,_=Zt(),T=me(B=>v1(B,"xAxis",l,_)),A=me(B=>v1(B,"yAxis",s,_));if(!wr(f)||!wr(h)||!ce(c)||!ce(d))return null;var w=o.verticalCoordinatesGenerator||QW,R=o.horizontalCoordinatesGenerator||eZ,{horizontalPoints:I,verticalPoints:P}=o;if((!I||!I.length)&&typeof R=="function"){var N=y&&y.length,O=R({yAxis:A?Xt(Xt({},A),{},{ticks:N?y:A.ticks}):void 0,width:t??f,height:n??h,offset:r},N?!0:v);Ef(Array.isArray(O),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof O,"]")),Array.isArray(O)&&(I=O)}if((!P||!P.length)&&typeof w=="function"){var D=E&&E.length,G=w({xAxis:T?Xt(Xt({},T),{},{ticks:D?E:T.ticks}):void 0,width:t??f,height:n??h,offset:r},D?!0:v);Ef(Array.isArray(G),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof G,"]")),Array.isArray(G)&&(P=G)}return x.createElement(tr,{zIndex:o.zIndex},x.createElement("g",{className:"recharts-cartesian-grid"},x.createElement(JW,{fill:o.fill,fillOpacity:o.fillOpacity,x:o.x,y:o.y,width:o.width,height:o.height,ry:o.ry}),x.createElement(WW,Po({},o,{horizontalPoints:I})),x.createElement(ZW,Po({},o,{verticalPoints:P})),x.createElement(jW,Po({},o,{offset:r,horizontalPoints:I,xAxis:T,yAxis:A})),x.createElement(XW,Po({},o,{offset:r,verticalPoints:P,xAxis:T,yAxis:A}))))}cy.displayName="CartesianGrid";var nZ={},ED=bn({name:"errorBars",initialState:nZ,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:o}=t.payload;e[n]&&(e[n]=e[n].map(l=>l.dataKey===r.dataKey&&l.direction===r.direction?o:l))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(o=>o.dataKey!==r.dataKey||o.direction!==r.direction))}}}),{addErrorBar:Nte,replaceErrorBar:Dte,removeErrorBar:kte}=ED.actions,rZ=ED.reducer,iZ=["children"];function oZ(e,t){if(e==null)return{};var n,r,o=aZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0},sZ=x.createContext(lZ);function uZ(e){var{children:t}=e,n=oZ(e,iZ);return x.createElement(sZ.Provider,{value:n},t)}function nS(e,t){var n,r,o=me(f=>yi(f,e)),l=me(f=>Si(f,t)),s=(n=o==null?void 0:o.allowDataOverflow)!==null&&n!==void 0?n:Mt.allowDataOverflow,c=(r=l==null?void 0:l.allowDataOverflow)!==null&&r!==void 0?r:It.allowDataOverflow,d=s||c;return{needClip:d,needClipX:s,needClipY:c}}function _D(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,o=Q0(),{needClipX:l,needClipY:s,needClip:c}=nS(t,n);if(!c||!o)return null;var{x:d,y:f,width:h,height:v}=o;return x.createElement("clipPath",{id:"clipPath-".concat(r)},x.createElement("rect",{x:l?d:d-h/2,y:s?f:f-v/2,width:l?h:h*2,height:s?v:v*2}))}function cZ(e){var t=Gs(e),n=3,r=2;if(t!=null){var{r:o,strokeWidth:l}=t,s=Number(o),c=Number(l);return(Number.isNaN(s)||s<0)&&(s=n),(Number.isNaN(c)||c<0)&&(c=r),{r:s,strokeWidth:c}}return{r:n,strokeWidth:r}}var eg={exports:{}},tg={};/** * @license React * use-sync-external-store-with-selector.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 AM;function fZ(){if(AM)return tg;AM=1;var e=el();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,l=e.useEffect,s=e.useMemo,c=e.useDebugValue;return tg.useSyncExternalStoreWithSelector=function(d,f,h,v,y){var E=o(null);if(E.current===null){var _={hasValue:!1,value:null};E.current=_}else _=E.current;E=s(function(){function A(N){if(!w){if(w=!0,R=N,N=v(N),y!==void 0&&_.hasValue){var O=_.value;if(y(O,N))return I=O}return I=N}if(O=I,n(R,N))return O;var D=v(N);return y!==void 0&&y(O,D)?(R=N,O):(R=N,I=D)}var w=!1,R,I,P=h===void 0?null:h;return[function(){return A(f())},P===null?void 0:function(){return A(P())}]},[f,h,v,y]);var T=r(d,E[0],E[1]);return l(function(){_.hasValue=!0,_.value=T},[T]),c(T),T},tg}var CM;function dZ(){return CM||(CM=1,eg.exports=fZ()),eg.exports}dZ();function pZ(e){e()}function hZ(){let e=null,t=null;return{clear(){e=null,t=null},notify(){pZ(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const o=t={callback:n,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){!r||e===null||(r=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}var xM={notify(){},get:()=>[]};function mZ(e,t){let n,r=xM,o=0,l=!1;function s(T){h();const A=r.subscribe(T);let w=!1;return()=>{w||(w=!0,A(),v())}}function c(){r.notify()}function d(){_.onStateChange&&_.onStateChange()}function f(){return l}function h(){o++,n||(n=e.subscribe(d),r=hZ())}function v(){o--,n&&o===0&&(n(),n=void 0,r.clear(),r=xM)}function y(){l||(l=!0,h())}function E(){l&&(l=!1,v())}const _={addNestedSub:s,notifyNestedSubs:c,handleChangeWrapper:d,isSubscribed:f,trySubscribe:y,tryUnsubscribe:E,getListeners:()=>r};return _}var vZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gZ=vZ(),yZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",SZ=yZ(),bZ=()=>gZ||SZ?x.useLayoutEffect:x.useEffect,EZ=bZ();function wM(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function _Z(e,t){if(wM(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=0;o{const d=mZ(o);return{store:o,subscription:d,getServerState:r?()=>r:void 0}},[o,r]),s=x.useMemo(()=>o.getState(),[o]);EZ(()=>{const{subscription:d}=l;return d.onStateChange=d.notifyNestedSubs,d.trySubscribe(),s!==o.getState()&&d.notifyNestedSubs(),()=>{d.tryUnsubscribe(),d.onStateChange=void 0}},[l,s]);const c=n||AZ;return x.createElement(c.Provider,{value:l},t)}var xZ=CZ,wZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function MZ(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Zd(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(wZ.has(r)){if(e[r]==null&&t[r]==null)continue;if(!_Z(e[r],t[r]))return!1}else if(!MZ(e[r],t[r]))return!1;return!0}function Rr(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(o=>o.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:mD}function Or(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(o=>o.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:mD}var TD=(e,t,n)=>Qi(e,"xAxis",Rr(e,t),n),AD=(e,t,n)=>Zi(e,"xAxis",Rr(e,t),n),CD=(e,t,n)=>Qi(e,"yAxis",Or(e,t),n),xD=(e,t,n)=>Zi(e,"yAxis",Or(e,t),n),IZ=Y([He,TD,CD,AD,xD],(e,t,n,r,o)=>Pr(e,"xAxis")?ja(t,r,!1):ja(n,o,!1)),PZ=(e,t)=>t,wD=Y([Kd,PZ],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),MD=e=>{var t=He(e),n=Pr(t,"xAxis");return n?"yAxis":"xAxis"},RZ=(e,t)=>{var n=MD(e);return n==="yAxis"?Or(e,t):Rr(e,t)},OZ=(e,t,n)=>Vf(e,MD(e),RZ(e,t),n),NZ=Y([wD,OZ],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,o=Vd(e);if(!(r==null||o==null)){var l=(n=t[r])===null||n===void 0?void 0:n.stackedData,s=l==null?void 0:l.find(c=>c.key===o);if(s!=null)return s.map(c=>[c[0],c[1]])}}}),DZ=Y([He,TD,CD,AD,xD,NZ,aO,IZ,wD,hK],(e,t,n,r,o,l,s,c,d,f)=>{var{chartData:h,dataStartIndex:v,dataEndIndex:y}=s;if(!(d==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||o==null||r.length===0||o.length===0||c==null)){var{data:E}=d,_;if(E&&E.length>0?_=E:_=h==null?void 0:h.slice(v,y+1),_!=null)return QZ({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:o,dataStartIndex:v,areaSettings:d,stackedData:l,displayedData:_,chartBaseValue:f,bandSize:c})}}),kZ=["id"],UZ=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Do(){return Do=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:o,legendType:l,hide:s}=e;return[{inactive:s,dataKey:t,type:l,color:Wf(r,o),value:Ed(n,t),payload:e}]},HZ=x.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:o,fill:l,name:s,hide:c,unit:d,tooltipType:f,id:h}=e,v={dataDefinedOnItem:n,getPosition:Fo,settings:{stroke:r,strokeWidth:o,fill:l,dataKey:t,nameKey:void 0,name:Ed(s,t),hide:c,type:f,color:Wf(r,l),unit:d,graphicalItemId:h}};return x.createElement(cD,{tooltipEntrySettings:v})});function VZ(e){var{clipPathId:t,points:n,props:r}=e,{needClip:o,dot:l,dataKey:s}=r,c=Wn(r);return x.createElement(NX,{points:n,dot:l,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:s,baseProps:c,needClip:o,clipPathId:t})}function FZ(e){var{showLabels:t,children:n,points:r}=e,o=r.map(l=>{var s,c,d={x:(s=l.x)!==null&&s!==void 0?s:0,y:(c=l.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ha(Ha({},d),{},{value:l.value,payload:l.payload,parentViewBox:void 0,viewBox:d,fill:void 0})});return x.createElement(eD,{value:t?o:void 0},n)}function IM(e){var{points:t,baseLine:n,needClip:r,clipPathId:o,props:l}=e,{layout:s,type:c,stroke:d,connectNulls:f,isRange:h}=l,{id:v}=l,y=ID(l,kZ),E=Wn(y),_=on(y);return x.createElement(x.Fragment,null,(t==null?void 0:t.length)>1&&x.createElement(an,{clipPath:r?"url(#clipPath-".concat(o,")"):void 0},x.createElement(Ts,Do({},_,{id:v,points:t,connectNulls:f,type:c,baseLine:n,layout:s,stroke:"none",className:"recharts-area-area"})),d!=="none"&&x.createElement(Ts,Do({},E,{className:"recharts-area-curve",layout:s,type:c,connectNulls:f,fill:"none",points:t})),d!=="none"&&h&&x.createElement(Ts,Do({},E,{className:"recharts-area-curve",layout:s,type:c,connectNulls:f,fill:"none",points:n}))),x.createElement(VZ,{points:t,props:y,clipPathId:o}))}function $Z(e){var t,n,{alpha:r,baseLine:o,points:l,strokeWidth:s}=e,c=(t=l[0])===null||t===void 0?void 0:t.y,d=(n=l[l.length-1])===null||n===void 0?void 0:n.y;if(!Me(c)||!Me(d))return null;var f=r*Math.abs(c-d),h=Math.max(...l.map(v=>v.x||0));return ce(o)?h=Math.max(o,h):o&&Array.isArray(o)&&o.length&&(h=Math.max(...o.map(v=>v.x||0),h)),ce(h)?x.createElement("rect",{x:0,y:cv.y||0));return ce(o)?h=Math.max(o,h):o&&Array.isArray(o)&&o.length&&(h=Math.max(...o.map(v=>v.y||0),h)),ce(h)?x.createElement("rect",{x:c({points:s,baseLine:c}),[s,c]),T=Rd(_,"recharts-area-"),A=Zy(),[w,R]=x.useState(!1),I=!w,P=x.useCallback(()=>{typeof E=="function"&&E(),R(!1)},[E]),N=x.useCallback(()=>{typeof y=="function"&&y(),R(!0)},[y]);if(A==null)return null;var O=o.current,D=l.current;return x.createElement(FZ,{showLabels:I,points:s},r.children,x.createElement(Pd,{animationId:T,begin:f,duration:h,isActive:d,easing:v,onAnimationEnd:P,onAnimationStart:N,key:T},G=>{if(O){var B=O.length/s.length,Q=G===1?s:s.map(($,oe)=>{var se=Math.floor(oe*B);if(O[se]){var ye=O[se];return Ha(Ha({},$),{},{x:at(ye.x,$.x,G),y:at(ye.y,$.y,G)})}return $}),te;return ce(c)?te=at(D,c,G):ft(c)||fr(c)?te=at(D,0,G):te=c.map(($,oe)=>{var se=Math.floor(oe*B);if(Array.isArray(D)&&D[se]){var ye=D[se];return Ha(Ha({},$),{},{x:at(ye.x,$.x,G),y:at(ye.y,$.y,G)})}return $}),G>0&&(o.current=Q,l.current=te),x.createElement(IM,{points:Q,baseLine:te,needClip:t,clipPathId:n,props:r})}return G>0&&(o.current=s,l.current=c),x.createElement(an,null,d&&x.createElement("defs",null,x.createElement("clipPath",{id:"animationClipPath-".concat(n)},x.createElement(KZ,{alpha:G,points:s,baseLine:c,layout:A,strokeWidth:r.strokeWidth}))),x.createElement(an,{clipPath:"url(#animationClipPath-".concat(n,")")},x.createElement(IM,{points:s,baseLine:c,needClip:t,clipPathId:n,props:r})))}),x.createElement(nD,{label:r.label}))}function jZ(e){var{needClip:t,clipPathId:n,props:r}=e,o=x.useRef(null),l=x.useRef();return x.createElement(JZ,{needClip:t,clipPathId:n,props:r,previousPointsRef:o,previousBaselineRef:l})}class XZ extends x.PureComponent{render(){var{hide:t,dot:n,points:r,className:o,top:l,left:s,needClip:c,xAxisId:d,yAxisId:f,width:h,height:v,id:y,baseLine:E,zIndex:_}=this.props;if(t)return null;var T=Xe("recharts-area",o),A=y,{r:w,strokeWidth:R}=cZ(n),I=aD(n),P=w*2+R,N=c?"url(#clipPath-".concat(I?"":"dots-").concat(A,")"):void 0;return x.createElement(tr,{zIndex:_},x.createElement(an,{className:T},c&&x.createElement("defs",null,x.createElement(_D,{clipPathId:A,xAxisId:d,yAxisId:f}),!I&&x.createElement("clipPath",{id:"clipPath-dots-".concat(A)},x.createElement("rect",{x:s-P/2,y:l-P/2,width:h+P,height:v+P}))),x.createElement(jZ,{needClip:c,clipPathId:A,props:this.props})),x.createElement(gM,{points:r,mainColor:Wf(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(E)&&x.createElement(gM,{points:E,mainColor:Wf(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var PD={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Rt.area};function WZ(e){var t,n=sn(e,PD),{activeDot:r,animationBegin:o,animationDuration:l,animationEasing:s,connectNulls:c,dot:d,fill:f,fillOpacity:h,hide:v,isAnimationActive:y,legendType:E,stroke:_,xAxisId:T,yAxisId:A}=n,w=ID(n,UZ),R=$o(),I=NN(),{needClip:P}=nS(T,A),N=Zt(),{points:O,isRange:D,baseLine:G}=(t=me(se=>DZ(se,e.id,N)))!==null&&t!==void 0?t:{},B=Q0();if(R!=="horizontal"&&R!=="vertical"||B==null||I!=="AreaChart"&&I!=="ComposedChart")return null;var{height:Q,width:te,x:$,y:oe}=B;return!O||!O.length?null:x.createElement(XZ,Do({},w,{activeDot:r,animationBegin:o,animationDuration:l,animationEasing:s,baseLine:G,connectNulls:c,dot:d,fill:f,fillOpacity:h,height:Q,hide:v,layout:R,isAnimationActive:y==="auto"?!Js.isSsr:y,isRange:D,legendType:E,needClip:P,points:O,stroke:_,width:te,left:$,top:oe,xAxisId:T,yAxisId:A}))}var ZZ=(e,t,n,r,o)=>{var l=n??t;if(ce(l))return l;var s=e==="horizontal"?o:r,c=s.scale.domain();if(s.type==="number"){var d=Math.max(c[0],c[1]),f=Math.min(c[0],c[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(c[0],c[1]),0)}return l==="dataMin"?c[0]:l==="dataMax"?c[1]:c[0]};function QZ(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:o,layout:l,chartBaseValue:s,xAxis:c,yAxis:d,displayedData:f,dataStartIndex:h,xAxisTicks:v,yAxisTicks:y,bandSize:E}=e,_=o&&o.length,T=ZZ(l,s,n,c,d),A=l==="horizontal",w=!1,R=f.map((P,N)=>{var O,D,G,B;if(_)B=o[h+N];else{var Q=St(P,r);Array.isArray(Q)?(B=Q,w=!0):B=[T,Q]}var te=(O=(D=B)===null||D===void 0?void 0:D[1])!==null&&O!==void 0?O:null,$=te==null||_&&!t&&St(P,r)==null;if(A){var oe;return{x:hx({axis:c,ticks:v,bandSize:E,entry:P,index:N}),y:$?null:(oe=d.scale.map(te))!==null&&oe!==void 0?oe:null,value:B,payload:P}}return{x:$?null:(G=c.scale.map(te))!==null&&G!==void 0?G:null,y:hx({axis:d,ticks:y,bandSize:E,entry:P,index:N}),value:B,payload:P}}),I;return _||w?I=R.map(P=>{var N,O=Array.isArray(P.value)?P.value[0]:null;if(A){var D;return{x:P.x,y:O!=null&&P.y!=null&&(D=d.scale.map(O))!==null&&D!==void 0?D:null,payload:P.payload}}return{x:O!=null&&(N=c.scale.map(O))!==null&&N!==void 0?N:null,y:P.y,payload:P.payload}}):I=A?d.scale.map(T):c.scale.map(T),{points:R,baseLine:I??0,isRange:w}}function eQ(e){var t=sn(e,PD),n=Zt();return x.createElement(dD,{id:t.id,type:"area"},r=>x.createElement(x.Fragment,null,x.createElement(fD,{legendPayload:GZ(t)}),x.createElement(HZ,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),x.createElement(hD,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:QP(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),x.createElement(WZ,Do({},t,{id:r}))))}var RD=x.memo(eQ,Zd);RD.displayName="Area";var tQ="Invariant failed";function nQ(e,t){throw new Error(tQ)}function fy(){return fy=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(r,o)=>{if(ce(t))return t;var l=ce(r)||ft(r);return l?t(r,o):(l||nQ(),n)}},iQ=(e,t,n)=>n,oQ=(e,t)=>t,ou=Y([Kd,oQ],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),aQ=Y([ou],e=>e==null?void 0:e.maxBarSize),lQ=(e,t,n,r)=>r,sQ=Y([He,Kd,Rr,Or,iQ],(e,t,n,r,o)=>t.filter(l=>e==="horizontal"?l.xAxisId===n:l.yAxisId===r).filter(l=>l.isPanorama===o).filter(l=>l.hide===!1).filter(l=>l.type==="bar")),uQ=(e,t,n)=>{var r=He(e),o=Rr(e,t),l=Or(e,t);if(!(o==null||l==null))return r==="horizontal"?Vf(e,"yAxis",l,n):Vf(e,"xAxis",o,n)},cQ=(e,t)=>{var n=He(e),r=Rr(e,t),o=Or(e,t);if(!(r==null||o==null))return n==="horizontal"?m1(e,"xAxis",r):m1(e,"yAxis",o)},fQ=Y([sQ,pK,cQ],QX),dQ=(e,t,n)=>{var r,o,l=ou(e,t);if(l==null)return 0;var s=Rr(e,t),c=Or(e,t);if(s==null||c==null)return 0;var d=He(e),f=yO(e),{maxBarSize:h}=l,v=ft(h)?f:h,y,E;return d==="horizontal"?(y=Qi(e,"xAxis",s,n),E=Zi(e,"xAxis",s,n)):(y=Qi(e,"yAxis",c,n),E=Zi(e,"yAxis",c,n)),(r=(o=ja(y,E,!0))!==null&&o!==void 0?o:v)!==null&&r!==void 0?r:0},OD=(e,t,n)=>{var r=He(e),o=Rr(e,t),l=Or(e,t);if(!(o==null||l==null)){var s,c;return r==="horizontal"?(s=Qi(e,"xAxis",o,n),c=Zi(e,"xAxis",o,n)):(s=Qi(e,"yAxis",l,n),c=Zi(e,"yAxis",l,n)),ja(s,c)}},pQ=Y([fQ,yO,dK,SO,dQ,OD,aQ],iW),hQ=(e,t,n)=>{var r=Rr(e,t);if(r!=null)return Qi(e,"xAxis",r,n)},mQ=(e,t,n)=>{var r=Or(e,t);if(r!=null)return Qi(e,"yAxis",r,n)},vQ=(e,t,n)=>{var r=Rr(e,t);if(r!=null)return Zi(e,"xAxis",r,n)},gQ=(e,t,n)=>{var r=Or(e,t);if(r!=null)return Zi(e,"yAxis",r,n)},yQ=Y([pQ,ou],aW),SQ=Y([uQ,ou],oW),bQ=Y([Nt,jy,hQ,mQ,vQ,gQ,yQ,He,aO,OD,SQ,ou,lQ],(e,t,n,r,o,l,s,c,d,f,h,v,y)=>{var{chartData:E,dataStartIndex:_,dataEndIndex:T}=d;if(!(v==null||s==null||t==null||c!=="horizontal"&&c!=="vertical"||n==null||r==null||o==null||l==null||f==null)){var{data:A}=v,w;if(A!=null&&A.length>0?w=A:w=E==null?void 0:E.slice(_,T+1),w!=null)return JQ({layout:c,barSettings:v,pos:s,parentViewBox:t,bandSize:f,xAxis:n,yAxis:r,xAxisTicks:o,yAxisTicks:l,stackedData:h,displayedData:w,offset:e,cells:y,dataStartIndex:_})}}),EQ=["index"];function dy(){return dy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=x.useContext(ND);if(t!=null)return t.stackId;if(e!=null)return QP(e)},CQ=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),xQ=e=>{var t=x.useContext(ND);if(t!=null){var{stackId:n}=t;return"url(#".concat(CQ(n,e),")")}},DD=e=>{var{index:t}=e,n=_Q(e,EQ),r=xQ(t);return x.createElement(an,dy({className:"recharts-bar-stack-layer",clipPath:r},n))},wQ=["onMouseEnter","onMouseLeave","onClick"],MQ=["value","background","tooltipPosition"],IQ=["id"],PQ=["onMouseEnter","onClick","onMouseLeave"];function fi(){return fi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,fill:r,legendType:o,hide:l}=e;return[{inactive:l,dataKey:t,type:o,color:r,value:Ed(n,t),payload:e}]},UQ=x.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:o,name:l,hide:s,unit:c,tooltipType:d,id:f}=e,h={dataDefinedOnItem:void 0,getPosition:Fo,settings:{stroke:n,strokeWidth:r,fill:o,dataKey:t,nameKey:void 0,name:Ed(l,t),hide:s,type:d,color:o,unit:c,graphicalItemId:f}};return x.createElement(cD,{tooltipEntrySettings:h})});function LQ(e){var t=me(Go),{data:n,dataKey:r,background:o,allOtherBarProps:l}=e,{onMouseEnter:s,onMouseLeave:c,onClick:d}=l,f=Qf(l,wQ),h=lD(s,r,l.id),v=sD(c),y=uD(d,r,l.id);if(!o||n==null)return null;var E=Gs(o);return x.createElement(tr,{zIndex:lW(o,Rt.barBackground)},n.map((_,T)=>{var{value:A,background:w,tooltipPosition:R}=_,I=Qf(_,MQ);if(!w)return null;var P=h(_,T),N=v(_,T),O=y(_,T),D=tn(tn(tn(tn(tn({option:o,isActive:String(T)===t},I),{},{fill:"#eee"},w),E),By(f,_,T)),{},{onMouseEnter:P,onMouseLeave:N,onClick:O,dataKey:r,index:T,className:"recharts-bar-background-rectangle"});return x.createElement(Zf,fi({key:"background-bar-".concat(T)},D))}))}function zQ(e){var{showLabels:t,children:n,rects:r}=e,o=r==null?void 0:r.map(l=>{var s={x:l.x,y:l.y,width:l.width,lowerWidth:l.width,upperWidth:l.width,height:l.height};return tn(tn({},s),{},{value:l.value,payload:l.payload,parentViewBox:l.parentViewBox,viewBox:s,fill:l.fill})});return x.createElement(eD,{value:t?o:void 0},n)}function BQ(e){var{shape:t,activeBar:n,baseProps:r,entry:o,index:l,dataKey:s}=e,c=me(Go),d=me(PN),f=n&&String(l)===c&&(d==null||s===d),h=f?n:t;return f?x.createElement(tr,{zIndex:Rt.activeBar},x.createElement(DD,{index:l},x.createElement(Zf,fi({},r,{name:String(r.name)},o,{isActive:f,option:h,index:l,dataKey:s})))):x.createElement(Zf,fi({},r,{name:String(r.name)},o,{isActive:f,option:h,index:l,dataKey:s}))}function qQ(e){var{shape:t,baseProps:n,entry:r,index:o,dataKey:l}=e;return x.createElement(Zf,fi({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:o,dataKey:l}))}function GQ(e){var t,{data:n,props:r}=e,o=(t=Wn(r))!==null&&t!==void 0?t:{},{id:l}=o,s=Qf(o,IQ),{shape:c,dataKey:d,activeBar:f}=r,{onMouseEnter:h,onClick:v,onMouseLeave:y}=r,E=Qf(r,PQ),_=lD(h,d,l),T=sD(y),A=uD(v,d,l);return n?x.createElement(x.Fragment,null,n.map((w,R)=>x.createElement(DD,fi({index:R,key:"rectangle-".concat(w==null?void 0:w.x,"-").concat(w==null?void 0:w.y,"-").concat(w==null?void 0:w.value,"-").concat(R),className:"recharts-bar-rectangle"},By(E,w,R),{onMouseEnter:_(w,R),onMouseLeave:T(w,R),onClick:A(w,R)}),f?x.createElement(BQ,{shape:c,activeBar:f,baseProps:s,entry:w,index:R,dataKey:d}):x.createElement(qQ,{shape:c,baseProps:s,entry:w,index:R,dataKey:d})))):null}function HQ(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:o,isAnimationActive:l,animationBegin:s,animationDuration:c,animationEasing:d,onAnimationEnd:f,onAnimationStart:h}=t,v=n.current,y=Rd(t,"recharts-bar-"),[E,_]=x.useState(!1),T=!E,A=x.useCallback(()=>{typeof f=="function"&&f(),_(!1)},[f]),w=x.useCallback(()=>{typeof h=="function"&&h(),_(!0)},[h]);return x.createElement(zQ,{showLabels:T,rects:r},x.createElement(Pd,{animationId:y,begin:s,duration:c,isActive:l,easing:d,onAnimationEnd:A,onAnimationStart:w,key:y},R=>{var I=R===1?r:r==null?void 0:r.map((P,N)=>{var O=v&&v[N];if(O)return tn(tn({},P),{},{x:at(O.x,P.x,R),y:at(O.y,P.y,R),width:at(O.width,P.width,R),height:at(O.height,P.height,R)});if(o==="horizontal"){var D=at(0,P.height,R),G=at(P.stackedBarStart,P.y,R);return tn(tn({},P),{},{y:G,height:D})}var B=at(0,P.width,R),Q=at(P.stackedBarStart,P.x,R);return tn(tn({},P),{},{width:B,x:Q})});return R>0&&(n.current=I??null),I==null?null:x.createElement(an,null,x.createElement(GQ,{props:t,data:I}))}),x.createElement(nD,{label:t.label}),t.children)}function VQ(e){var t=x.useRef(null);return x.createElement(HQ,{previousRectanglesRef:t,props:e})}var kD=0,FQ=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:St(e,t)}};class $Q extends x.PureComponent{render(){var{hide:t,data:n,dataKey:r,className:o,xAxisId:l,yAxisId:s,needClip:c,background:d,id:f}=this.props;if(t||n==null)return null;var h=Xe("recharts-bar",o),v=f;return x.createElement(an,{className:h,id:f},c&&x.createElement("defs",null,x.createElement(_D,{clipPathId:v,xAxisId:l,yAxisId:s})),x.createElement(an,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(v,")"):void 0},x.createElement(LQ,{data:n,dataKey:r,background:d,allOtherBarProps:this.props}),x.createElement(VQ,this.props)))}}var YQ={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:kD,xAxisId:0,yAxisId:0,zIndex:Rt.bar};function KQ(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:o,minPointSize:l,activeBar:s,animationBegin:c,animationDuration:d,animationEasing:f,isAnimationActive:h}=e,{needClip:v}=nS(t,n),y=$o(),E=Zt(),_=jj(e.children,HN),T=me(R=>bQ(R,e.id,E,_));if(y!=="vertical"&&y!=="horizontal")return null;var A,w=T==null?void 0:T[0];return w==null||w.height==null||w.width==null?A=0:A=y==="vertical"?w.height/2:w.width/2,x.createElement(uZ,{xAxisId:t,yAxisId:n,data:T,dataPointFormatter:FQ,errorBarOffset:A},x.createElement($Q,fi({},e,{layout:y,needClip:v,data:T,xAxisId:t,yAxisId:n,hide:r,legendType:o,minPointSize:l,activeBar:s,animationBegin:c,animationDuration:d,animationEasing:f,isAnimationActive:h})))}function JQ(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r},pos:o,bandSize:l,xAxis:s,yAxis:c,xAxisTicks:d,yAxisTicks:f,stackedData:h,displayedData:v,offset:y,cells:E,parentViewBox:_,dataStartIndex:T}=e,A=t==="horizontal"?c:s,w=h?A.scale.domain():null,R=u6({numericAxis:A}),I=A.scale.map(R);return v.map((P,N)=>{var O,D,G,B,Q,te;if(h){var $=h[N+T];if($==null)return null;O=i6($,w)}else O=St(P,n),Array.isArray(O)||(O=[R,O]);var oe=rQ(r,kD)(O[1],N);if(t==="horizontal"){var se,ye=c.scale.map(O[0]),V=c.scale.map(O[1]);if(ye==null||V==null)return null;D=mx({axis:s,ticks:d,bandSize:l,offset:o.offset,entry:P,index:N}),G=(se=V??ye)!==null&&se!==void 0?se:void 0,B=o.size;var X=ye-V;if(Q=fr(X)?0:X,te={x:D,y:y.top,width:B,height:y.height},Math.abs(oe)>0&&Math.abs(Q)0&&Math.abs(B)x.createElement(x.Fragment,null,x.createElement(fD,{legendPayload:kQ(t)}),x.createElement(UQ,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:o}),x.createElement(hD,{type:"bar",id:o,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r}),x.createElement(tr,{zIndex:t.zIndex},x.createElement(KQ,fi({},t,{id:o})))))}var UD=x.memo(jQ,Zd);UD.displayName="Bar";var XQ=["domain","range"],WQ=["domain","range"];function RM(e,t){if(e==null)return{};var n,r,o=ZQ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r{if(s!=null)return DM(DM({},l),{},{type:s})},[l,s]);return x.useLayoutEffect(()=>{c!=null&&(n.current===null?t(zX(c)):n.current!==c&&t(BX({prev:n.current,next:c})),n.current=c)},[c,t]),x.useLayoutEffect(()=>()=>{n.current&&(t(qX(n.current)),n.current=null)},[t]),null}var lee=e=>{var{xAxisId:t,className:n}=e,r=me(jy),o=Zt(),l="xAxis",s=me(w=>uN(w,l,t,o)),c=me(w=>oN(w,t)),d=me(w=>m9(w,t)),f=me(w=>MO(w,t));if(c==null||d==null||f==null)return null;var{dangerouslySetInnerHTML:h,ticks:v,scale:y}=e,E=hy(e,eee),{id:_,scale:T}=f,A=hy(f,tee);return x.createElement(tS,py({},E,A,{x:d.x,y:d.y,width:c.width,height:c.height,className:Xe("recharts-".concat(l," ").concat(l),n),viewBox:r,ticks:s,axisType:l}))},see={allowDataOverflow:Mt.allowDataOverflow,allowDecimals:Mt.allowDecimals,allowDuplicatedCategory:Mt.allowDuplicatedCategory,angle:Mt.angle,axisLine:ri.axisLine,height:Mt.height,hide:!1,includeHidden:Mt.includeHidden,interval:Mt.interval,label:!1,minTickGap:Mt.minTickGap,mirror:Mt.mirror,orientation:Mt.orientation,padding:Mt.padding,reversed:Mt.reversed,scale:Mt.scale,tick:Mt.tick,tickCount:Mt.tickCount,tickLine:ri.tickLine,tickSize:ri.tickSize,type:Mt.type,xAxisId:0},uee=e=>{var t=sn(e,see);return x.createElement(x.Fragment,null,x.createElement(aee,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),x.createElement(lee,t))},my=x.memo(uee,LD);my.displayName="XAxis";var cee=["type"],fee=["dangerouslySetInnerHTML","ticks","scale"],dee=["id","scale"];function vy(){return vy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(s!=null)return UM(UM({},l),{},{type:s})},[s,l]);return x.useLayoutEffect(()=>{c!=null&&(n.current===null?t(GX(c)):n.current!==c&&t(HX({prev:n.current,next:c})),n.current=c)},[c,t]),x.useLayoutEffect(()=>()=>{n.current&&(t(VX(n.current)),n.current=null)},[t]),null}function yee(e){var{yAxisId:t,className:n,width:r,label:o}=e,l=x.useRef(null),s=x.useRef(null),c=me(jy),d=Zt(),f=ht(),h="yAxis",v=me(O=>aN(O,t)),y=me(O=>g9(O,t)),E=me(O=>uN(O,h,t,d)),_=me(O=>IO(O,t));if(x.useLayoutEffect(()=>{if(!(r!=="auto"||!v||Z0(o)||x.isValidElement(o)||_==null)){var O=l.current;if(O){var D=O.getCalculatedWidth();Math.round(v.width)!==Math.round(D)&&f(FX({id:t,width:D}))}}},[E,v,f,o,t,r,_]),v==null||y==null||_==null)return null;var{dangerouslySetInnerHTML:T,ticks:A,scale:w}=e,R=gy(e,fee),{id:I,scale:P}=_,N=gy(_,dee);return x.createElement(tS,vy({},R,N,{ref:l,labelRef:s,x:y.x,y:y.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:v.width,height:v.height,className:Xe("recharts-".concat(h," ").concat(h),n),viewBox:c,ticks:E,axisType:h}))}var See={allowDataOverflow:It.allowDataOverflow,allowDecimals:It.allowDecimals,allowDuplicatedCategory:It.allowDuplicatedCategory,angle:It.angle,axisLine:ri.axisLine,hide:!1,includeHidden:It.includeHidden,interval:It.interval,label:!1,minTickGap:It.minTickGap,mirror:It.mirror,orientation:It.orientation,padding:It.padding,reversed:It.reversed,scale:It.scale,tick:It.tick,tickCount:It.tickCount,tickLine:ri.tickLine,tickSize:ri.tickSize,type:It.type,width:It.width,yAxisId:0},bee=e=>{var t=sn(e,See);return x.createElement(x.Fragment,null,x.createElement(gee,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),x.createElement(yee,t))},yy=x.memo(bee,LD);yy.displayName="YAxis";var Eee=(e,t)=>t,rS=Y([Eee,He,xO,Ut,xN,bi,R7,Nt],z7),iS=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},zD=Zn("mouseClick"),BD=Fs();BD.startListening({actionCreator:zD,effect:(e,t)=>{var n=e.payload,r=rS(t.getState(),iS(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(R9({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Sy=Zn("mouseMove"),qD=Fs(),Fc=null;qD.startListening({actionCreator:Sy,effect:(e,t)=>{var n=e.payload;Fc!==null&&cancelAnimationFrame(Fc);var r=iS(n);Fc=requestAnimationFrame(()=>{var o=t.getState(),l=G0(o,o.tooltip.settings.shared);if(l==="axis"){var s=rS(o,r);(s==null?void 0:s.activeIndex)!=null?t.dispatch(gN({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate})):t.dispatch(vN())}Fc=null})}});function _ee(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var LM={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},GD=bn({name:"rootProps",initialState:LM,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:LM.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),Tee=GD.reducer,{updateOptions:Aee}=GD.actions,Cee=null,xee={updatePolarOptions:(e,t)=>t.payload},HD=bn({name:"polarOptions",initialState:Cee,reducers:xee}),{updatePolarOptions:Ute}=HD.actions,wee=HD.reducer,VD=Zn("keyDown"),FD=Zn("focus"),oS=Fs();oS.startListening({actionCreator:VD,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:o}=n.tooltip,l=e.payload;if(!(l!=="ArrowRight"&&l!=="ArrowLeft"&&l!=="Enter")){var s=H0(o,dl(n),tu(n),ru(n)),c=s==null?-1:Number(s);if(!(!Number.isFinite(c)||c<0)){var d=bi(n);if(l==="Enter"){var f=$f(n,"axis","hover",String(o.index));t.dispatch(oy({active:!o.active,activeIndex:o.index,activeCoordinate:f}));return}var h=E9(n),v=h==="left-to-right"?1:-1,y=l==="ArrowRight"?1:-1,E=c+y*v;if(!(d==null||E>=d.length||E<0)){var _=$f(n,"axis","hover",String(E));t.dispatch(oy({active:!0,activeIndex:E.toString(),activeCoordinate:_}))}}}}}});oS.startListening({actionCreator:FD,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:o}=n.tooltip;if(!o.active&&o.index==null){var l="0",s=$f(n,"axis","hover",String(l));t.dispatch(oy({active:!0,activeIndex:l,activeCoordinate:s}))}}}});var Kn=Zn("externalEvent"),$D=Fs(),ig=new Map;$D.startListening({actionCreator:Kn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var o=r.type,l=ig.get(o);l!==void 0&&cancelAnimationFrame(l);var s=requestAnimationFrame(()=>{try{var c=t.getState(),d={activeCoordinate:v7(c),activeDataKey:PN(c),activeIndex:Go(c),activeLabel:IN(c),activeTooltipIndex:Go(c),isTooltipActive:g7(c)};n(d,r)}finally{ig.delete(o)}});ig.set(o,s)}}});var Mee=Y([cl],e=>e.tooltipItemPayloads),Iee=Y([Mee,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(l=>l.settings.graphicalItemId===n);if(r!=null){var{getPosition:o}=r;if(o!=null)return o(t)}}}),YD=Zn("touchMove"),KD=Fs();KD.startListening({actionCreator:YD,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),o=G0(r,r.tooltip.settings.shared);if(o==="axis"){var l=n.touches[0];if(l==null)return;var s=rS(r,iS({clientX:l.clientX,clientY:l.clientY,currentTarget:n.currentTarget}));(s==null?void 0:s.activeIndex)!=null&&t.dispatch(gN({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate}))}else if(o==="item"){var c,d=n.touches[0];if(document.elementFromPoint==null||d==null)return;var f=document.elementFromPoint(d.clientX,d.clientY);if(!f||!f.getAttribute)return;var h=f.getAttribute(v6),v=(c=f.getAttribute(g6))!==null&&c!==void 0?c:void 0,y=fl(r).find(T=>T.id===v);if(h==null||y==null||v==null)return;var{dataKey:E}=y,_=Iee(r,h,v);t.dispatch(mN({activeDataKey:E,activeIndex:h,activeCoordinate:_,activeGraphicalItemId:v}))}}}});var Pee=_P({brush:uW,cartesianAxis:$X,chartData:mJ,errorBars:rZ,graphicalItems:TX,layout:QF,legend:s$,options:cJ,polarAxis:Fj,polarOptions:wee,referenceElements:pW,rootProps:Tee,tooltip:O9,zIndex:Z7}),Ree=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return AF({reducer:Pee,preloadedState:t,middleware:r=>{var o;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((o="es6")!==null&&o!==void 0?o:"")}).concat([BD.middleware,qD.middleware,oS.middleware,$D.middleware,KD.middleware])},enhancers:r=>{var o=r;return typeof r=="function"&&(o=r()),o.concat(LP({type:"raf"}))},devTools:{serialize:{replacer:_ee},name:"recharts-".concat(n)}})};function Oee(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,o=Zt(),l=x.useRef(null);if(o)return n;l.current==null&&(l.current=Ree(t,r));var s=Hy;return x.createElement(xZ,{context:s,store:l.current},n)}function Nee(e){var{layout:t,margin:n}=e,r=ht(),o=Zt();return x.useEffect(()=>{o||(r(XF(t)),r(jF(n)))},[r,o,t,n]),null}var Dee=x.memo(Nee,Zd);function kee(e){var t=ht();return x.useEffect(()=>{t(Aee(e))},[t,e]),null}function zM(e){var{zIndex:t,isPanorama:n}=e,r=x.useRef(null),o=ht();return x.useLayoutEffect(()=>(r.current&&o(X7({zIndex:t,element:r.current,isPanorama:n})),()=>{o(W7({zIndex:t,isPanorama:n}))}),[o,t,n]),x.createElement("g",{tabIndex:-1,ref:r})}function BM(e){var{children:t,isPanorama:n}=e,r=me(q7);if(!r||r.length===0)return t;var o=r.filter(s=>s<0),l=r.filter(s=>s>0);return x.createElement(x.Fragment,null,o.map(s=>x.createElement(zM,{key:s,zIndex:s,isPanorama:n})),t,l.map(s=>x.createElement(zM,{key:s,zIndex:s,isPanorama:n})))}var Uee=["children"];function Lee(e,t){if(e==null)return{};var n,r,o=zee(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r{var n=oR(),r=aR(),o=mR();if(!wr(n)||!wr(r))return null;var{children:l,otherAttributes:s,title:c,desc:d}=e,f,h;return s!=null&&(typeof s.tabIndex=="number"?f=s.tabIndex:f=o?0:void 0,typeof s.role=="string"?h=s.role:h=o?"application":void 0),x.createElement(BI,ed({},s,{title:c,desc:d,role:h,tabIndex:f,width:n,height:r,style:Bee,ref:t}),l)}),Gee=e=>{var{children:t}=e,n=me(Cd);if(!n)return null;var{width:r,height:o,y:l,x:s}=n;return x.createElement(BI,{width:r,height:o,x:s,y:l},t)},qM=x.forwardRef((e,t)=>{var{children:n}=e,r=Lee(e,Uee),o=Zt();return o?x.createElement(Gee,null,x.createElement(BM,{isPanorama:!0},n)):x.createElement(qee,ed({ref:t},r),x.createElement(BM,{isPanorama:!1},n))});function Hee(){var e=ht(),[t,n]=x.useState(null),r=me(m6);return x.useEffect(()=>{if(t!=null){var o=t.getBoundingClientRect(),l=o.width/t.offsetWidth;Me(l)&&l!==r&&e(ZF(l))}},[t,e,r]),n}function GM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vee(e){for(var t=1;t(AJ(),null);function td(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Jee=x.forwardRef((e,t)=>{var n,r,o=x.useRef(null),[l,s]=x.useState({containerWidth:td((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:td((r=e.style)===null||r===void 0?void 0:r.height)}),c=x.useCallback((f,h)=>{s(v=>{var y=Math.round(f),E=Math.round(h);return v.containerWidth===y&&v.containerHeight===E?v:{containerWidth:y,containerHeight:E}})},[]),d=x.useCallback(f=>{if(typeof t=="function"&&t(f),f!=null&&typeof ResizeObserver<"u"){var{width:h,height:v}=f.getBoundingClientRect();c(h,v);var y=_=>{var T=_[0];if(T!=null){var{width:A,height:w}=T.contentRect;c(A,w)}},E=new ResizeObserver(y);E.observe(f),o.current=E}},[t,c]);return x.useEffect(()=>()=>{var f=o.current;f!=null&&f.disconnect()},[c]),x.createElement(x.Fragment,null,x.createElement(Ys,{width:l.containerWidth,height:l.containerHeight}),x.createElement("div",Wi({ref:d},e)))}),jee=x.forwardRef((e,t)=>{var{width:n,height:r}=e,[o,l]=x.useState({containerWidth:td(n),containerHeight:td(r)}),s=x.useCallback((d,f)=>{l(h=>{var v=Math.round(d),y=Math.round(f);return h.containerWidth===v&&h.containerHeight===y?h:{containerWidth:v,containerHeight:y}})},[]),c=x.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null){var{width:f,height:h}=d.getBoundingClientRect();s(f,h)}},[t,s]);return x.createElement(x.Fragment,null,x.createElement(Ys,{width:o.containerWidth,height:o.containerHeight}),x.createElement("div",Wi({ref:c},e)))}),Xee=x.forwardRef((e,t)=>{var{width:n,height:r}=e;return x.createElement(x.Fragment,null,x.createElement(Ys,{width:n,height:r}),x.createElement("div",Wi({ref:t},e)))}),Wee=x.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?x.createElement(jee,Wi({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?x.createElement(Xee,Wi({},e,{width:n,height:r,ref:t})):x.createElement(x.Fragment,null,x.createElement(Ys,{width:n,height:r}),x.createElement("div",Wi({ref:t},e)))});function Zee(e){return e?Jee:Wee}var Qee=x.forwardRef((e,t)=>{var{children:n,className:r,height:o,onClick:l,onContextMenu:s,onDoubleClick:c,onMouseDown:d,onMouseEnter:f,onMouseLeave:h,onMouseMove:v,onMouseUp:y,onTouchEnd:E,onTouchMove:_,onTouchStart:T,style:A,width:w,responsive:R,dispatchTouchEvents:I=!0}=e,P=x.useRef(null),N=ht(),[O,D]=x.useState(null),[G,B]=x.useState(null),Q=Hee(),te=Xy(),$=(te==null?void 0:te.width)>0?te.width:w,oe=(te==null?void 0:te.height)>0?te.height:o,se=x.useCallback(W=>{Q(W),typeof t=="function"&&t(W),D(W),B(W),W!=null&&(P.current=W)},[Q,t,D,B]),ye=x.useCallback(W=>{N(zD(W)),N(Kn({handler:l,reactEvent:W}))},[N,l]),V=x.useCallback(W=>{N(Sy(W)),N(Kn({handler:f,reactEvent:W}))},[N,f]),X=x.useCallback(W=>{N(vN()),N(Kn({handler:h,reactEvent:W}))},[N,h]),ae=x.useCallback(W=>{N(Sy(W)),N(Kn({handler:v,reactEvent:W}))},[N,v]),he=x.useCallback(()=>{N(FD())},[N]),ve=x.useCallback(W=>{N(VD(W.key))},[N]),U=x.useCallback(W=>{N(Kn({handler:s,reactEvent:W}))},[N,s]),J=x.useCallback(W=>{N(Kn({handler:c,reactEvent:W}))},[N,c]),ie=x.useCallback(W=>{N(Kn({handler:d,reactEvent:W}))},[N,d]),le=x.useCallback(W=>{N(Kn({handler:y,reactEvent:W}))},[N,y]),be=x.useCallback(W=>{N(Kn({handler:T,reactEvent:W}))},[N,T]),Ae=x.useCallback(W=>{I&&N(YD(W)),N(Kn({handler:_,reactEvent:W}))},[N,I,_]),Ee=x.useCallback(W=>{N(Kn({handler:E,reactEvent:W}))},[N,E]),Et=Zee(R);return x.createElement(zN.Provider,{value:O},x.createElement(iV.Provider,{value:G},x.createElement(Et,{width:$??(A==null?void 0:A.width),height:oe??(A==null?void 0:A.height),className:Xe("recharts-wrapper",r),style:Vee({position:"relative",cursor:"default",width:$,height:oe},A),onClick:ye,onContextMenu:U,onDoubleClick:J,onFocus:he,onKeyDown:ve,onMouseDown:ie,onMouseEnter:V,onMouseLeave:X,onMouseMove:ae,onMouseUp:le,onTouchEnd:Ee,onTouchMove:Ae,onTouchStart:be,ref:se},x.createElement(Kee,null),n)))}),ete=["width","height","responsive","children","className","style","compact","title","desc"];function tte(e,t){if(e==null)return{};var n,r,o=nte(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:o,children:l,className:s,style:c,compact:d,title:f,desc:h}=e,v=tte(e,ete),y=Wn(v);return d?x.createElement(x.Fragment,null,x.createElement(Ys,{width:n,height:r}),x.createElement(qM,{otherAttributes:y,title:f,desc:h},l)):x.createElement(Qee,{className:s,style:c,width:n,height:r,responsive:o??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},x.createElement(qM,{otherAttributes:y,title:f,desc:h,ref:t},x.createElement(mW,null,l)))});function by(){return by=Object.assign?Object.assign.bind():function(e){for(var t=1;tx.createElement(JD,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:ate,tooltipPayloadSearcher:BN,categoricalChartProps:e,ref:t})),ste=["axis"],ute=x.forwardRef((e,t)=>x.createElement(JD,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:ste,tooltipPayloadSearcher:BN,categoricalChartProps:e,ref:t}));const cte=()=>{const[e,t]=x.useState({files:[],accounts:[],transactions:[],windows:[],focusedWindowId:null,activeView:"dashboard",chatHistory:[{role:"ai",content:'VERTEX NODE ONLINE. Provision your CSV or click "SIMULATE" to see the forensic engine in action. All data is localized to this blueprint.',timestamp:new Date().toISOString()}],notebookCells:[],terminalHistory:[],isLoading:!1,error:null,actions:[]}),[n,r]=x.useState(""),[o,l]=x.useState(!1),[s,c]=x.useState(1),d=20,[f,h]=x.useState(""),v=I=>{var N;const P=(N=I.target.files)==null?void 0:N[0];if(P){const O=new FileReader;O.onload=D=>{var Q;const{type:G,data:B}=OU((Q=D.target)==null?void 0:Q.result);y(G,B,P.name)},O.readAsText(P)}},y=(I,P,N)=>{const O=Math.random().toString(36).substr(2,9),D={id:O,name:N,timestamp:new Date().toISOString(),rowCount:P.length,type:I},G=P.map(B=>({...B,fileOrigin:O}));t(B=>({...B,files:[...B.files,D],transactions:I==="transactions"?[...B.transactions,...G]:B.transactions,accounts:I==="accounts"?[...B.accounts,...G]:B.accounts})),c(1)},E=()=>{const I=[],P=["AMZN_CORE","GCP_NEXUS","VAULT_7","SVR_TREASURY","INTEL_NODE"];for(let N=0;N<5e3;N++){const O=Math.random()>.6;I.push({id:`TX-${1e5+N}`,amount:Math.random()*1e4*(O?1:-1),effective_date:new Date(Date.now()-N*18e5).toISOString(),counterparty:P[Math.floor(Math.random()*P.length)],direction:O?"credit":"debit",status:"Settled",metadata:{hash:Math.random().toString(16).substr(2,8)}})}y("transactions",I,"INSTITUTIONAL_DUMP.csv")},_=async I=>{if(I.preventDefault(),!n.trim()||o)return;const P={role:"user",content:n,timestamp:new Date().toISOString()},N=[...e.chatHistory,P];t(G=>({...G,chatHistory:N})),r(""),l(!0);const D={role:"ai",content:(await K3.processCommand(n,e)).text,timestamp:new Date().toISOString()};t(G=>({...G,chatHistory:[...N,D]})),l(!1)},T=x.useMemo(()=>{const I=f.toLowerCase();return e.transactions.filter(P=>{var N;return((N=P.counterparty)==null?void 0:N.toLowerCase().includes(I))||P.id.toLowerCase().includes(I)||P.status.toLowerCase().includes(I)})},[e.transactions,f]),A=Math.ceil(T.length/d),w=T.slice((s-1)*d,s*d),R=x.useMemo(()=>{const I={};return e.transactions.slice(0,200).forEach(P=>{const N=P.effective_date.split("T")[0];I[N]=(I[N]||0)+Math.abs(P.amount)}),Object.entries(I).map(([P,N])=>({date:P,amount:N})).sort((P,N)=>P.date.localeCompare(N.date)).slice(-30)},[e.transactions]);return ne.jsxs("div",{className:"h-screen w-screen flex flex-col p-4 bg-white overflow-hidden text-black font-['Architects_Daughter']",children:[ne.jsxs("header",{className:"flex flex-col md:flex-row justify-between items-start md:items-center mb-6 gap-4",children:[ne.jsxs("div",{className:"sketch-border sketch-shadow p-4 bg-white scribble-hover",children:[ne.jsx("h1",{className:"text-3xl font-black uppercase tracking-tighter",children:"Sovereign Data blueprint v1.0"}),ne.jsx("p",{className:"text-xs uppercase font-bold opacity-60",children:"Vertex Institutional Terminal • B&W Protocol"})]}),ne.jsxs("div",{className:"flex gap-4",children:[ne.jsx("button",{onClick:E,className:"sketch-btn sketch-border sketch-shadow px-6 py-2 font-bold uppercase hover:bg-black hover:text-white transition-all text-sm",children:"Simulate 5,000 Vectors"}),ne.jsxs("label",{className:"sketch-btn sketch-border sketch-shadow px-6 py-2 font-bold uppercase cursor-pointer hover:bg-black hover:text-white transition-all text-sm",children:["Ingest CSV",ne.jsx("input",{type:"file",className:"hidden",accept:".csv",onChange:v})]})]})]}),ne.jsxs("div",{className:"flex-1 grid grid-cols-1 lg:grid-cols-12 gap-6 overflow-hidden",children:[ne.jsxs("div",{className:"lg:col-span-3 flex flex-col gap-6 overflow-hidden",children:[ne.jsxs("div",{className:"sketch-border sketch-shadow p-5 bg-white flex flex-col flex-1 overflow-hidden",children:[ne.jsx("h2",{className:"text-lg font-black uppercase mb-4 border-b-2 border-black",children:"Intelligence Interface"}),ne.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 mb-4 pr-2",children:[e.chatHistory.map((I,P)=>ne.jsxs("div",{className:`p-3 sketch-border ${I.role==="user"?"bg-black text-white":"bg-white"}`,children:[ne.jsx("p",{className:"text-[9px] font-black uppercase opacity-50 mb-1",children:I.role}),ne.jsx("p",{className:"text-sm leading-tight",children:I.content})]},P)),o&&ne.jsx("div",{className:"text-xs animate-pulse font-black italic",children:"Vertex is scribbling response..."})]}),ne.jsx("form",{onSubmit:_,children:ne.jsx("input",{value:n,onChange:I=>r(I.target.value),placeholder:"Query provision status...",className:"w-full sketch-border p-2 outline-none text-sm font-bold focus:bg-black focus:text-white transition-all"})})]}),ne.jsxs("div",{className:"sketch-border sketch-shadow p-5 bg-white",children:[ne.jsx("h2",{className:"text-lg font-black uppercase mb-3 border-b-2 border-black",children:"Terms Explained"}),ne.jsxs("div",{className:"space-y-3 text-xs font-bold leading-tight",children:[ne.jsxs("div",{children:[ne.jsx("p",{className:"underline uppercase italic",children:"Sovereign Entropy"}),ne.jsx("p",{className:"opacity-70",children:"Detects suspicious randomness in high-volume institutional flows."})]}),ne.jsxs("div",{children:[ne.jsx("p",{className:"underline uppercase italic",children:"Magnitude Vector"}),ne.jsx("p",{className:"opacity-70",children:"The raw power of a transaction relative to treasury depth."})]}),ne.jsxs("div",{children:[ne.jsx("p",{className:"underline uppercase italic",children:"Node Drift"}),ne.jsx("p",{className:"opacity-70",children:"Identifies when a counterparty starts diverging from historical behavior."})]})]})]})]}),ne.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-6 overflow-hidden",children:[ne.jsxs("div",{className:"sketch-border sketch-shadow p-5 bg-white h-1/2 flex flex-col",children:[ne.jsx("h2",{className:"text-lg font-black uppercase mb-4 border-b-2 border-black",children:"Volatility Map"}),ne.jsx("div",{className:"flex-1 w-full grayscale contrast-125",children:ne.jsx(xx,{width:"100%",height:"100%",children:ne.jsxs(ute,{data:R,children:[ne.jsx(cy,{strokeDasharray:"3 3",stroke:"#000",vertical:!1}),ne.jsx(my,{dataKey:"date",hide:!0}),ne.jsx(yy,{hide:!0}),ne.jsx(OJ,{contentStyle:{border:"2px solid black",borderRadius:"0",fontFamily:"Architects Daughter"}}),ne.jsx(RD,{type:"monotone",dataKey:"amount",stroke:"#000",fill:"#000",fillOpacity:.1,strokeWidth:3})]})})}),ne.jsx("p",{className:"text-[10px] mt-2 font-bold uppercase text-center italic",children:"Institutional magnitude over 30 cycles"})]}),ne.jsxs("div",{className:"sketch-border sketch-shadow p-5 bg-white h-1/2 flex flex-col",children:[ne.jsx("h2",{className:"text-lg font-black uppercase mb-4 border-b-2 border-black",children:"Provision Density"}),ne.jsx("div",{className:"flex-1 w-full grayscale contrast-150",children:ne.jsx(xx,{width:"100%",height:"100%",children:ne.jsxs(lte,{data:R,children:[ne.jsx(cy,{strokeDasharray:"5 5",stroke:"#000",vertical:!1}),ne.jsx(my,{dataKey:"date",hide:!0}),ne.jsx(yy,{hide:!0}),ne.jsx(UD,{dataKey:"amount",fill:"#000"})]})})}),ne.jsx("p",{className:"text-[10px] mt-2 font-bold uppercase text-center italic",children:"Node saturation metrics (Simulated)"})]})]}),ne.jsx("div",{className:"lg:col-span-5 flex flex-col gap-6 overflow-hidden",children:ne.jsxs("div",{className:"sketch-border sketch-shadow p-5 bg-white flex-1 flex flex-col overflow-hidden relative",children:[ne.jsxs("div",{className:"flex justify-between items-center mb-4 border-b-2 border-black",children:[ne.jsx("h2",{className:"text-lg font-black uppercase",children:"Institutional Ledger"}),ne.jsx("input",{placeholder:"Search...",className:"sketch-border px-2 py-0.5 text-xs outline-none",value:f,onChange:I=>h(I.target.value)})]}),ne.jsx("div",{className:"flex-1 overflow-auto",children:ne.jsxs("table",{className:"w-full text-[10px] font-bold text-left border-collapse",children:[ne.jsx("thead",{className:"sticky top-0 bg-white border-b-2 border-black",children:ne.jsxs("tr",{children:[ne.jsx("th",{className:"p-2 uppercase italic",children:"ID"}),ne.jsx("th",{className:"p-2 uppercase italic",children:"Counterparty"}),ne.jsx("th",{className:"p-2 uppercase italic text-right",children:"Amount"}),ne.jsx("th",{className:"p-2 uppercase italic",children:"Status"})]})}),ne.jsxs("tbody",{className:"divide-y divide-black/10",children:[w.map((I,P)=>ne.jsxs("tr",{className:"hover:bg-black hover:text-white transition-colors",children:[ne.jsx("td",{className:"p-2 font-mono uppercase",children:I.id.slice(0,8)}),ne.jsx("td",{className:"p-2 truncate max-w-[120px]",children:I.counterparty}),ne.jsx("td",{className:`p-2 text-right ${I.amount>0?"bg-gray-100 text-black":""}`,children:I.amount.toLocaleString(void 0,{minimumFractionDigits:2})}),ne.jsx("td",{className:"p-2",children:ne.jsx("span",{className:"border border-black px-1 text-[8px]",children:I.status})})]},P)),e.transactions.length===0&&ne.jsx("tr",{children:ne.jsx("td",{colSpan:4,className:"p-20 text-center italic uppercase opacity-50",children:"Empty Ledger Node"})})]})]})}),ne.jsxs("div",{className:"mt-4 pt-4 border-t-2 border-black flex justify-between items-center text-[10px] font-black uppercase",children:[ne.jsx("button",{onClick:()=>c(I=>Math.max(1,I-1)),disabled:s===1,className:"sketch-border px-3 py-1 hover:bg-black hover:text-white disabled:opacity-20",children:"Back"}),ne.jsxs("span",{children:["Page ",s," of ",A||1]}),ne.jsx("button",{onClick:()=>c(I=>Math.min(A,I+1)),disabled:s===A||A===0,className:"sketch-border px-3 py-1 hover:bg-black hover:text-white disabled:opacity-20",children:"Next"})]})]})})]}),ne.jsxs("footer",{className:"mt-6 pt-4 border-t-2 border-black flex justify-between items-center font-bold text-[10px] uppercase",children:[ne.jsxs("div",{className:"flex gap-6",children:[ne.jsxs("span",{children:["Active Nodes: ",e.files.length]}),ne.jsxs("span",{children:["Vector Count: ",e.transactions.length.toLocaleString()]}),ne.jsxs("span",{children:["Integrity: ",e.transactions.length>0?"Verified":"Pending"]})]}),ne.jsxs("div",{className:"flex items-center gap-4",children:[ne.jsxs("div",{className:"flex gap-1",children:[ne.jsx("div",{className:"w-2 h-2 bg-black rounded-full"}),ne.jsx("div",{className:"w-2 h-2 bg-black rounded-full"}),ne.jsx("div",{className:"w-2 h-2 bg-white border border-black rounded-full"})]}),ne.jsx("span",{className:"italic",children:"Auth: Global Vault-7 Nexus"})]})]}),ne.jsx("div",{className:"absolute top-20 right-10 rotate-12 opacity-30 pointer-events-none select-none text-[8px] font-black",children:ne.jsx("div",{className:"sketch-border p-2 bg-white",children:'"Check Magnitude Vectors for 0x drift"'})})]})},jD=document.getElementById("root");if(!jD)throw new Error("Could not find root element to mount to");const fte=RU.createRoot(jD);fte.render(ne.jsx(HM.StrictMode,{children:ne.jsx(cte,{})}));