var yy=Object.defineProperty;var _y=(e,t,n)=>t in e?yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var nt=(e,t,n)=>_y(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();const ts=globalThis||void 0||self;/** * @vue/shared v3.5.34 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function _c(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Xt={},Yi=[],En=()=>{},Gp=()=>!1,tl=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),el=e=>e.startsWith("onUpdate:"),xe=Object.assign,vc=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},vy=Object.prototype.hasOwnProperty,zt=(e,t)=>vy.call(e,t),bt=Array.isArray,Xi=e=>ps(e)==="[object Map]",uo=e=>ps(e)==="[object Set]",_u=e=>ps(e)==="[object Date]",St=e=>typeof e=="function",le=e=>typeof e=="string",Tn=e=>typeof e=="symbol",Jt=e=>e!==null&&typeof e=="object",Hp=e=>(Jt(e)||St(e))&&St(e.then)&&St(e.catch),$p=Object.prototype.toString,ps=e=>$p.call(e),xy=e=>ps(e).slice(8,-1),qp=e=>ps(e)==="[object Object]",xc=e=>le(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ho=_c(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),nl=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},by=/-\w/g,Ne=nl(e=>e.replace(by,t=>t.slice(1).toUpperCase())),Ey=/\B([A-Z])/g,fi=nl(e=>e.replace(Ey,"-$1").toLowerCase()),il=nl(e=>e.charAt(0).toUpperCase()+e.slice(1)),Nl=nl(e=>e?`on${il(e)}`:""),xn=(e,t)=>!Object.is(e,t),ar=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:i,value:n})},ol=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let vu;const sl=()=>vu||(vu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof ts<"u"?ts:{});function bc(e){if(bt(e)){const t={};for(let n=0;n{if(n){const i=n.split(Ty);i.length>1&&(t[i[0].trim()]=i[1].trim())}}),t}function $t(e){let t="";if(le(e))t=e;else if(bt(e))for(let n=0;nli(n,t))}const Jp=e=>!!(e&&e.__v_isRef===!0),q=e=>le(e)?e:e==null?"":bt(e)||Jt(e)&&(e.toString===$p||!St(e.toString))?Jp(e)?q(e.value):JSON.stringify(e,Kp,2):String(e),Kp=(e,t)=>Jp(t)?Kp(e,t.value):Xi(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[i,o],s)=>(n[Ll(i,s)+" =>"]=o,n),{})}:uo(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Ll(n))}:Tn(t)?Ll(t):Jt(t)&&!bt(t)&&!qp(t)?String(t):t,Ll=(e,t="")=>{var n;return Tn(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/** * @vue/reactivity v3.5.34 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let ve;class My{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&ve&&(ve.active?(this.parent=ve,this.index=(ve.scopes||(ve.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0&&--this._on===0){if(ve===this)ve=this.prevScope;else{let t=ve;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,i;for(n=0,i=this.effects.length;n0)return;if(qo){let t=qo;for(qo=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$o;){let t=$o;for($o=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(i){e||(e=i)}t=n}}if(e)throw e}function Zp(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function jp(e){let t,n=e.depsTail,i=n;for(;i;){const o=i.prevDep;i.version===-1?(i===n&&(n=o),Cc(i),ky(i)):t=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=o}e.deps=t,e.depsTail=n}function va(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(tg(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function tg(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===es)||(e.globalVersion=es,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!va(e))))return;e.flags|=2;const t=e.dep,n=te,i=on;te=e,on=!0;try{Zp(e);const o=e.fn(e._value);(t.version===0||xn(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{te=n,on=i,jp(e),e.flags&=-3}}function Cc(e,t=!1){const{dep:n,prevSub:i,nextSub:o}=e;if(i&&(i.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=i,e.nextSub=void 0),n.subs===e&&(n.subs=i,!i&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)Cc(s,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ky(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let on=!0;const eg=[];function Gn(){eg.push(on),on=!1}function Hn(){const e=eg.pop();on=e===void 0?!0:e}function xu(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=te;te=void 0;try{t()}finally{te=n}}}let es=0;class Dy{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Sc{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!te||!on||te===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==te)n=this.activeLink=new Dy(te,this),te.deps?(n.prevDep=te.depsTail,te.depsTail.nextDep=n,te.depsTail=n):te.deps=te.depsTail=n,ng(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const i=n.nextDep;i.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=i),n.prevDep=te.depsTail,n.nextDep=void 0,te.depsTail.nextDep=n,te.depsTail=n,te.deps===n&&(te.deps=i)}return n}trigger(t){this.version++,es++,this.notify(t)}notify(t){wc();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Tc()}}}function ng(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let i=t.deps;i;i=i.nextDep)ng(i)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const xa=new WeakMap,Pi=Symbol(""),ba=Symbol(""),ns=Symbol("");function we(e,t,n){if(on&&te){let i=xa.get(e);i||xa.set(e,i=new Map);let o=i.get(n);o||(i.set(n,o=new Sc),o.map=i,o.key=n),o.track()}}function Nn(e,t,n,i,o,s){const r=xa.get(e);if(!r){es++;return}const l=a=>{a&&a.trigger()};if(wc(),t==="clear")r.forEach(l);else{const a=bt(e),c=a&&xc(n);if(a&&n==="length"){const u=Number(i);r.forEach((h,p)=>{(p==="length"||p===ns||!Tn(p)&&p>=u)&&l(h)})}else switch((n!==void 0||r.has(void 0))&&l(r.get(n)),c&&l(r.get(ns)),t){case"add":a?c&&l(r.get("length")):(l(r.get(Pi)),Xi(e)&&l(r.get(ba)));break;case"delete":a||(l(r.get(Pi)),Xi(e)&&l(r.get(ba)));break;case"set":Xi(e)&&l(r.get(Pi));break}}Tc()}function Vi(e){const t=qt(e);return t===e?t:(we(t,"iterate",ns),Ze(e)?t:t.map(an))}function rl(e){return we(e=qt(e),"iterate",ns),e}function yn(e,t){return $n(e)?io(ki(e)?an(t):t):an(t)}const Ny={__proto__:null,[Symbol.iterator](){return Ul(this,Symbol.iterator,e=>yn(this,e))},concat(...e){return Vi(this).concat(...e.map(t=>bt(t)?Vi(t):t))},entries(){return Ul(this,"entries",e=>(e[1]=yn(this,e[1]),e))},every(e,t){return Sn(this,"every",e,t,void 0,arguments)},filter(e,t){return Sn(this,"filter",e,t,n=>n.map(i=>yn(this,i)),arguments)},find(e,t){return Sn(this,"find",e,t,n=>yn(this,n),arguments)},findIndex(e,t){return Sn(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Sn(this,"findLast",e,t,n=>yn(this,n),arguments)},findLastIndex(e,t){return Sn(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Sn(this,"forEach",e,t,void 0,arguments)},includes(...e){return Bl(this,"includes",e)},indexOf(...e){return Bl(this,"indexOf",e)},join(e){return Vi(this).join(e)},lastIndexOf(...e){return Bl(this,"lastIndexOf",e)},map(e,t){return Sn(this,"map",e,t,void 0,arguments)},pop(){return yo(this,"pop")},push(...e){return yo(this,"push",e)},reduce(e,...t){return bu(this,"reduce",e,t)},reduceRight(e,...t){return bu(this,"reduceRight",e,t)},shift(){return yo(this,"shift")},some(e,t){return Sn(this,"some",e,t,void 0,arguments)},splice(...e){return yo(this,"splice",e)},toReversed(){return Vi(this).toReversed()},toSorted(e){return Vi(this).toSorted(e)},toSpliced(...e){return Vi(this).toSpliced(...e)},unshift(...e){return yo(this,"unshift",e)},values(){return Ul(this,"values",e=>yn(this,e))}};function Ul(e,t,n){const i=rl(e),o=i[t]();return i!==e&&!Ze(e)&&(o._next=o.next,o.next=()=>{const s=o._next();return s.done||(s.value=n(s.value)),s}),o}const Ly=Array.prototype;function Sn(e,t,n,i,o,s){const r=rl(e),l=r!==e&&!Ze(e),a=r[t];if(a!==Ly[t]){const h=a.apply(e,s);return l?an(h):h}let c=n;r!==e&&(l?c=function(h,p){return n.call(this,yn(e,h),p,e)}:n.length>2&&(c=function(h,p){return n.call(this,h,p,e)}));const u=a.call(r,c,i);return l&&o?o(u):u}function bu(e,t,n,i){const o=rl(e),s=o!==e&&!Ze(e);let r=n,l=!1;o!==e&&(s?(l=i.length===0,r=function(c,u,h){return l&&(l=!1,c=yn(e,c)),n.call(this,c,yn(e,u),h,e)}):n.length>3&&(r=function(c,u,h){return n.call(this,c,u,h,e)}));const a=o[t](r,...i);return l?yn(e,a):a}function Bl(e,t,n){const i=qt(e);we(i,"iterate",ns);const o=i[t](...n);return(o===-1||o===!1)&&Mc(n[0])?(n[0]=qt(n[0]),i[t](...n)):o}function yo(e,t,n=[]){Gn(),wc();const i=qt(e)[t].apply(e,n);return Tc(),Hn(),i}const Fy=_c("__proto__,__v_isRef,__isVue"),ig=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Tn));function Uy(e){Tn(e)||(e=String(e));const t=qt(this);return we(t,"has",e),t.hasOwnProperty(e)}class og{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,i){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return s;if(n==="__v_raw")return i===(o?s?Jy:ag:s?lg:rg).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(i)?t:void 0;const r=bt(t);if(!o){let a;if(r&&(a=Ny[n]))return a;if(n==="hasOwnProperty")return Uy}const l=Reflect.get(t,n,Ae(t)?t:i);if((Tn(n)?ig.has(n):Fy(n))||(o||we(t,"get",n),s))return l;if(Ae(l)){const a=r&&xc(n)?l:l.value;return o&&Jt(a)?wa(a):a}return Jt(l)?o?wa(l):Ic(l):l}}class sg extends og{constructor(t=!1){super(!1,t)}set(t,n,i,o){let s=t[n];const r=bt(t)&&xc(n);if(!this._isShallow){const c=$n(s);if(!Ze(i)&&!$n(i)&&(s=qt(s),i=qt(i)),!r&&Ae(s)&&!Ae(i))return c||(s.value=i),!0}const l=r?Number(n)e,Ns=e=>Reflect.getPrototypeOf(e);function Hy(e,t,n){return function(...i){const o=this.__v_raw,s=qt(o),r=Xi(s),l=e==="entries"||e===Symbol.iterator&&r,a=e==="keys"&&r,c=o[e](...i),u=n?Ea:t?io:an;return!t&&we(s,"iterate",a?ba:Pi),xe(Object.create(c),{next(){const{value:h,done:p}=c.next();return p?{value:h,done:p}:{value:l?[u(h[0]),u(h[1])]:u(h),done:p}}})}}function Ls(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function $y(e,t){const n={get(o){const s=this.__v_raw,r=qt(s),l=qt(o);e||(xn(o,l)&&we(r,"get",o),we(r,"get",l));const{has:a}=Ns(r),c=t?Ea:e?io:an;if(a.call(r,o))return c(s.get(o));if(a.call(r,l))return c(s.get(l));s!==r&&s.get(o)},get size(){const o=this.__v_raw;return!e&&we(qt(o),"iterate",Pi),o.size},has(o){const s=this.__v_raw,r=qt(s),l=qt(o);return e||(xn(o,l)&&we(r,"has",o),we(r,"has",l)),o===l?s.has(o):s.has(o)||s.has(l)},forEach(o,s){const r=this,l=r.__v_raw,a=qt(l),c=t?Ea:e?io:an;return!e&&we(a,"iterate",Pi),l.forEach((u,h)=>o.call(s,c(u),c(h),r))}};return xe(n,e?{add:Ls("add"),set:Ls("set"),delete:Ls("delete"),clear:Ls("clear")}:{add(o){const s=qt(this),r=Ns(s),l=qt(o),a=!t&&!Ze(o)&&!$n(o)?l:o;return r.has.call(s,a)||xn(o,a)&&r.has.call(s,o)||xn(l,a)&&r.has.call(s,l)||(s.add(a),Nn(s,"add",a,a)),this},set(o,s){!t&&!Ze(s)&&!$n(s)&&(s=qt(s));const r=qt(this),{has:l,get:a}=Ns(r);let c=l.call(r,o);c||(o=qt(o),c=l.call(r,o));const u=a.call(r,o);return r.set(o,s),c?xn(s,u)&&Nn(r,"set",o,s):Nn(r,"add",o,s),this},delete(o){const s=qt(this),{has:r,get:l}=Ns(s);let a=r.call(s,o);a||(o=qt(o),a=r.call(s,o)),l&&l.call(s,o);const c=s.delete(o);return a&&Nn(s,"delete",o,void 0),c},clear(){const o=qt(this),s=o.size!==0,r=o.clear();return s&&Nn(o,"clear",void 0,void 0),r}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=Hy(o,e,t)}),n}function Ac(e,t){const n=$y(e,t);return(i,o,s)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?i:Reflect.get(zt(n,o)&&o in i?n:i,o,s)}const qy={get:Ac(!1,!1)},zy={get:Ac(!1,!0)},Wy={get:Ac(!0,!1)};const rg=new WeakMap,lg=new WeakMap,ag=new WeakMap,Jy=new WeakMap;function Ky(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Yy(e){return e.__v_skip||!Object.isExtensible(e)?0:Ky(xy(e))}function Ic(e){return $n(e)?e:Rc(e,!1,Oy,qy,rg)}function Xy(e){return Rc(e,!1,Gy,zy,lg)}function wa(e){return Rc(e,!0,Vy,Wy,ag)}function Rc(e,t,n,i,o){if(!Jt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const s=Yy(e);if(s===0)return e;const r=o.get(e);if(r)return r;const l=new Proxy(e,s===2?i:n);return o.set(e,l),l}function ki(e){return $n(e)?ki(e.__v_raw):!!(e&&e.__v_isReactive)}function $n(e){return!!(e&&e.__v_isReadonly)}function Ze(e){return!!(e&&e.__v_isShallow)}function Mc(e){return e?!!e.__v_raw:!1}function qt(e){const t=e&&e.__v_raw;return t?qt(t):e}function Qy(e){return!zt(e,"__v_skip")&&Object.isExtensible(e)&&zp(e,"__v_skip",!0),e}const an=e=>Jt(e)?Ic(e):e,io=e=>Jt(e)?wa(e):e;function Ae(e){return e?e.__v_isRef===!0:!1}function _t(e){return Zy(e,!1)}function Zy(e,t){return Ae(e)?e:new jy(e,t)}class jy{constructor(t,n){this.dep=new Sc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:qt(t),this._value=n?t:an(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,i=this.__v_isShallow||Ze(t)||$n(t);t=i?t:qt(t),xn(t,n)&&(this._rawValue=t,this._value=i?t:an(t),this.dep.trigger())}}function Q(e){return Ae(e)?e.value:e}const t_={get:(e,t,n)=>t==="__v_raw"?e:Q(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return Ae(o)&&!Ae(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function cg(e){return ki(e)?e:new Proxy(e,t_)}class e_{constructor(t,n,i){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Sc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=es-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&te!==this)return Qp(this,!0),!0}get value(){const t=this.dep.track();return tg(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function n_(e,t,n=!1){let i,o;return St(e)?i=e:(i=e.get,o=e.set),new e_(i,o,n)}const Fs={},Ir=new WeakMap;let wi;function i_(e,t=!1,n=wi){if(n){let i=Ir.get(n);i||Ir.set(n,i=[]),i.push(e)}}function o_(e,t,n=Xt){const{immediate:i,deep:o,once:s,scheduler:r,augmentJob:l,call:a}=n,c=M=>o?M:Ze(M)||o===!1||o===0?Ln(M,1):Ln(M);let u,h,p,g,v=!1,x=!1;if(Ae(e)?(h=()=>e.value,v=Ze(e)):ki(e)?(h=()=>c(e),v=!0):bt(e)?(x=!0,v=e.some(M=>ki(M)||Ze(M)),h=()=>e.map(M=>{if(Ae(M))return M.value;if(ki(M))return c(M);if(St(M))return a?a(M,2):M()})):St(e)?t?h=a?()=>a(e,2):e:h=()=>{if(p){Gn();try{p()}finally{Hn()}}const M=wi;wi=u;try{return a?a(e,3,[g]):e(g)}finally{wi=M}}:h=En,t&&o){const M=h,D=o===!0?1/0:o;h=()=>Ln(M(),D)}const E=Py(),T=()=>{u.stop(),E&&E.active&&vc(E.effects,u)};if(s&&t){const M=t;t=(...D)=>{M(...D),T()}}let A=x?new Array(e.length).fill(Fs):Fs;const I=M=>{if(!(!(u.flags&1)||!u.dirty&&!M))if(t){const D=u.run();if(o||v||(x?D.some((P,B)=>xn(P,A[B])):xn(D,A))){p&&p();const P=wi;wi=u;try{const B=[D,A===Fs?void 0:x&&A[0]===Fs?[]:A,g];A=D,a?a(t,3,B):t(...B)}finally{wi=P}}}else u.run()};return l&&l(I),u=new Yp(h),u.scheduler=r?()=>r(I,!1):I,g=M=>i_(M,!1,u),p=u.onStop=()=>{const M=Ir.get(u);if(M){if(a)a(M,4);else for(const D of M)D();Ir.delete(u)}},t?i?I(!0):A=u.run():r?r(I.bind(null,!0),!0):u.run(),T.pause=u.pause.bind(u),T.resume=u.resume.bind(u),T.stop=T,T}function Ln(e,t=1/0,n){if(t<=0||!Jt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Ae(e))Ln(e.value,t,n);else if(bt(e))for(let i=0;i{Ln(i,t,n)});else if(qp(e)){for(const i in e)Ln(e[i],t,n);for(const i of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,i)&&Ln(e[i],t,n)}return e}/** * @vue/runtime-core v3.5.34 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function gs(e,t,n,i){try{return i?e(...i):e()}catch(o){ll(o,t,n)}}function Cn(e,t,n,i){if(St(e)){const o=gs(e,t,n,i);return o&&Hp(o)&&o.catch(s=>{ll(s,t,n)}),o}if(bt(e)){const o=[];for(let s=0;s>>1,o=De[i],s=is(o);s=is(n)?De.push(e):De.splice(r_(t),0,e),e.flags|=1,dg()}}function dg(){Rr||(Rr=ug.then(hg))}function l_(e){bt(e)?Qi.push(...e):Qn&&e.id===-1?Qn.splice(Wi+1,0,e):e.flags&1||(Qi.push(e),e.flags|=1),dg()}function Eu(e,t,n=hn+1){for(;nis(n)-is(i));if(Qi.length=0,Qn){Qn.push(...t);return}for(Qn=t,Wi=0;Wie.id==null?e.flags&2?-1:1/0:e.id;function hg(e){try{for(hn=0;hn{i._d&&Nr(-1);const s=Pr(t);let r;try{r=e(...o)}finally{Pr(s),i._d&&Nr(1)}return r};return i._n=!0,i._c=!0,i._d=!0,i}function Mt(e,t){if(We===null)return e;const n=dl(We),i=e.dirs||(e.dirs=[]);for(let o=0;o1)return n&&St(t)?t.call(i&&i.proxy):t}}const u_=Symbol.for("v-scx"),d_=()=>cr(u_);function Zn(e,t,n){return gg(e,t,n)}function gg(e,t,n=Xt){const{immediate:i,deep:o,flush:s,once:r}=n,l=xe({},n),a=t&&i||!t&&s!=="post";let c;if(ss){if(s==="sync"){const g=d_();c=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=En,g.resume=En,g.pause=En,g}}const u=Te;l.call=(g,v,x)=>Cn(g,u,v,x);let h=!1;s==="post"?l.scheduler=g=>{Ve(g,u&&u.suspense)}:s!=="sync"&&(h=!0,l.scheduler=(g,v)=>{v?g():Pc(g)}),l.augmentJob=g=>{t&&(g.flags|=4),h&&(g.flags|=2,u&&(g.id=u.uid,g.i=u))};const p=o_(e,t,l);return ss&&(c?c.push(p):a&&p()),p}function f_(e,t,n){const i=this.proxy,o=le(e)?e.includes(".")?mg(i,e):()=>i[e]:e.bind(i,i);let s;St(t)?s=t:(s=t.handler,n=t);const r=ms(this),l=gg(o,s.bind(i),n);return r(),l}function mg(e,t){const n=t.split(".");return()=>{let i=e;for(let o=0;oe.__isTeleport,g_=Symbol("_leaveCb");function kc(e,t){e.shapeFlag&6&&e.component?(e.transition=t,kc(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function yg(e,t){return St(e)?xe({name:e.name},t,{setup:e}):e}function _g(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function wu(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const kr=new WeakMap;function zo(e,t,n,i,o=!1){if(bt(e)){e.forEach((x,E)=>zo(x,t&&(bt(t)?t[E]:t),n,i,o));return}if(Wo(i)&&!o){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&zo(e,t,n,i.component.subTree);return}const s=i.shapeFlag&4?dl(i.component):i.el,r=o?null:s,{i:l,r:a}=e,c=t&&t.r,u=l.refs===Xt?l.refs={}:l.refs,h=l.setupState,p=qt(h),g=h===Xt?Gp:x=>wu(u,x)?!1:zt(p,x),v=(x,E)=>!(E&&wu(u,E));if(c!=null&&c!==a){if(Tu(t),le(c))u[c]=null,g(c)&&(h[c]=null);else if(Ae(c)){const x=t;v(c,x.k)&&(c.value=null),x.k&&(u[x.k]=null)}}if(St(a))gs(a,l,12,[r,u]);else{const x=le(a),E=Ae(a);if(x||E){const T=()=>{if(e.f){const A=x?g(a)?h[a]:u[a]:v()||!e.k?a.value:u[e.k];if(o)bt(A)&&vc(A,s);else if(bt(A))A.includes(s)||A.push(s);else if(x)u[a]=[s],g(a)&&(h[a]=u[a]);else{const I=[s];v(a,e.k)&&(a.value=I),e.k&&(u[e.k]=I)}}else x?(u[a]=r,g(a)&&(h[a]=r)):E&&(v(a,e.k)&&(a.value=r),e.k&&(u[e.k]=r))};if(r){const A=()=>{T(),kr.delete(e)};A.id=-1,kr.set(e,A),Ve(A,n)}else Tu(e),T()}}}function Tu(e){const t=kr.get(e);t&&(t.flags|=8,kr.delete(e))}sl().requestIdleCallback;sl().cancelIdleCallback;const Wo=e=>!!e.type.__asyncLoader,vg=e=>e.type.__isKeepAlive;function m_(e,t){xg(e,"a",t)}function y_(e,t){xg(e,"da",t)}function xg(e,t,n=Te){const i=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(al(t,i,n),n){let o=n.parent;for(;o&&o.parent;)vg(o.parent.vnode)&&__(i,t,n,o),o=o.parent}}function __(e,t,n,i){const o=al(t,e,i,!0);bg(()=>{vc(i[t],o)},n)}function al(e,t,n=Te,i=!1){if(n){const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...r)=>{Gn();const l=ms(n),a=Cn(t,n,e,r);return l(),Hn(),a});return i?o.unshift(s):o.push(s),s}}const zn=e=>(t,n=Te)=>{(!ss||e==="sp")&&al(e,(...i)=>t(...i),n)},v_=zn("bm"),Dc=zn("m"),x_=zn("bu"),b_=zn("u"),E_=zn("bum"),bg=zn("um"),w_=zn("sp"),T_=zn("rtg"),C_=zn("rtc");function S_(e,t=Te){al("ec",e,t)}const A_="components",Eg=Symbol.for("v-ndc");function _o(e){return le(e)?I_(A_,e,!1)||e:e||Eg}function I_(e,t,n=!0,i=!1){const o=We||Te;if(o){const s=o.type;{const l=hv(s,!1);if(l&&(l===t||l===Ne(t)||l===il(Ne(t))))return s}const r=Cu(o[e]||s[e],t)||Cu(o.appContext[e],t);return!r&&i?s:r}}function Cu(e,t){return e&&(e[t]||e[Ne(t)]||e[il(Ne(t))])}function ue(e,t,n,i){let o;const s=n,r=bt(e);if(r||le(e)){const l=r&&ki(e);let a=!1,c=!1;l&&(a=!Ze(e),c=$n(e),e=rl(e)),o=new Array(e.length);for(let u=0,h=e.length;ut(l,a,void 0,s));else{const l=Object.keys(e);o=new Array(l.length);for(let a=0,c=l.length;ae?Hg(e)?dl(e):Ta(e.parent):null,Jo=xe(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ta(e.parent),$root:e=>Ta(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Tg(e),$forceUpdate:e=>e.f||(e.f=()=>{Pc(e.update)}),$nextTick:e=>e.n||(e.n=Mr.bind(e.proxy)),$watch:e=>f_.bind(e)}),Ol=(e,t)=>e!==Xt&&!e.__isScriptSetup&&zt(e,t),R_={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:i,data:o,props:s,accessCache:r,type:l,appContext:a}=e;if(t[0]!=="$"){const p=r[t];if(p!==void 0)switch(p){case 1:return i[t];case 2:return o[t];case 4:return n[t];case 3:return s[t]}else{if(Ol(i,t))return r[t]=1,i[t];if(o!==Xt&&zt(o,t))return r[t]=2,o[t];if(zt(s,t))return r[t]=3,s[t];if(n!==Xt&&zt(n,t))return r[t]=4,n[t];Ca&&(r[t]=0)}}const c=Jo[t];let u,h;if(c)return t==="$attrs"&&we(e.attrs,"get",""),c(e);if((u=l.__cssModules)&&(u=u[t]))return u;if(n!==Xt&&zt(n,t))return r[t]=4,n[t];if(h=a.config.globalProperties,zt(h,t))return h[t]},set({_:e},t,n){const{data:i,setupState:o,ctx:s}=e;return Ol(o,t)?(o[t]=n,!0):i!==Xt&&zt(i,t)?(i[t]=n,!0):zt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:o,props:s,type:r}},l){let a;return!!(n[l]||e!==Xt&&l[0]!=="$"&&zt(e,l)||Ol(t,l)||zt(s,l)||zt(i,l)||zt(Jo,l)||zt(o.config.globalProperties,l)||(a=r.__cssModules)&&a[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:zt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Su(e){return bt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ca=!0;function M_(e){const t=Tg(e),n=e.proxy,i=e.ctx;Ca=!1,t.beforeCreate&&Au(t.beforeCreate,e,"bc");const{data:o,computed:s,methods:r,watch:l,provide:a,inject:c,created:u,beforeMount:h,mounted:p,beforeUpdate:g,updated:v,activated:x,deactivated:E,beforeDestroy:T,beforeUnmount:A,destroyed:I,unmounted:M,render:D,renderTracked:P,renderTriggered:B,errorCaptured:U,serverPrefetch:V,expose:W,inheritAttrs:et,components:at,directives:Ct,filters:gt}=t;if(c&&P_(c,i,null),r)for(const ft in r){const rt=r[ft];St(rt)&&(i[ft]=rt.bind(n))}if(o){const ft=o.call(n,n);Jt(ft)&&(e.data=Ic(ft))}if(Ca=!0,s)for(const ft in s){const rt=s[ft],xt=St(rt)?rt.bind(n,n):St(rt.get)?rt.get.bind(n,n):En,Nt=!St(rt)&&St(rt.set)?rt.set.bind(n):En,Kt=In({get:xt,set:Nt});Object.defineProperty(i,ft,{enumerable:!0,configurable:!0,get:()=>Kt.value,set:ie=>Kt.value=ie})}if(l)for(const ft in l)wg(l[ft],i,n,ft);if(a){const ft=St(a)?a.call(n):a;Reflect.ownKeys(ft).forEach(rt=>{c_(rt,ft[rt])})}u&&Au(u,e,"c");function ut(ft,rt){bt(rt)?rt.forEach(xt=>ft(xt.bind(n))):rt&&ft(rt.bind(n))}if(ut(v_,h),ut(Dc,p),ut(x_,g),ut(b_,v),ut(m_,x),ut(y_,E),ut(S_,U),ut(C_,P),ut(T_,B),ut(E_,A),ut(bg,M),ut(w_,V),bt(W))if(W.length){const ft=e.exposed||(e.exposed={});W.forEach(rt=>{Object.defineProperty(ft,rt,{get:()=>n[rt],set:xt=>n[rt]=xt,enumerable:!0})})}else e.exposed||(e.exposed={});D&&e.render===En&&(e.render=D),et!=null&&(e.inheritAttrs=et),at&&(e.components=at),Ct&&(e.directives=Ct),V&&_g(e)}function P_(e,t,n=En){bt(e)&&(e=Sa(e));for(const i in e){const o=e[i];let s;Jt(o)?"default"in o?s=cr(o.from||i,o.default,!0):s=cr(o.from||i):s=cr(o),Ae(s)?Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get:()=>s.value,set:r=>s.value=r}):t[i]=s}}function Au(e,t,n){Cn(bt(e)?e.map(i=>i.bind(t.proxy)):e.bind(t.proxy),t,n)}function wg(e,t,n,i){let o=i.includes(".")?mg(n,i):()=>n[i];if(le(e)){const s=t[e];St(s)&&Zn(o,s)}else if(St(e))Zn(o,e.bind(n));else if(Jt(e))if(bt(e))e.forEach(s=>wg(s,t,n,i));else{const s=St(e.handler)?e.handler.bind(n):t[e.handler];St(s)&&Zn(o,s,e)}}function Tg(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:r}}=e.appContext,l=s.get(t);let a;return l?a=l:!o.length&&!n&&!i?a=t:(a={},o.length&&o.forEach(c=>Dr(a,c,r,!0)),Dr(a,t,r)),Jt(t)&&s.set(t,a),a}function Dr(e,t,n,i=!1){const{mixins:o,extends:s}=t;s&&Dr(e,s,n,!0),o&&o.forEach(r=>Dr(e,r,n,!0));for(const r in t)if(!(i&&r==="expose")){const l=k_[r]||n&&n[r];e[r]=l?l(e[r],t[r]):t[r]}return e}const k_={data:Iu,props:Ru,emits:Ru,methods:ko,computed:ko,beforeCreate:Pe,created:Pe,beforeMount:Pe,mounted:Pe,beforeUpdate:Pe,updated:Pe,beforeDestroy:Pe,beforeUnmount:Pe,destroyed:Pe,unmounted:Pe,activated:Pe,deactivated:Pe,errorCaptured:Pe,serverPrefetch:Pe,components:ko,directives:ko,watch:N_,provide:Iu,inject:D_};function Iu(e,t){return t?e?function(){return xe(St(e)?e.call(this,this):e,St(t)?t.call(this,this):t)}:t:e}function D_(e,t){return ko(Sa(e),Sa(t))}function Sa(e){if(bt(e)){const t={};for(let n=0;nt==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Ne(t)}Modifiers`]||e[`${fi(t)}Modifiers`];function B_(e,t,...n){if(e.isUnmounted)return;const i=e.vnode.props||Xt;let o=n;const s=t.startsWith("update:"),r=s&&U_(i,t.slice(7));r&&(r.trim&&(o=n.map(u=>le(u)?u.trim():u)),r.number&&(o=n.map(ol)));let l,a=i[l=Nl(t)]||i[l=Nl(Ne(t))];!a&&s&&(a=i[l=Nl(fi(t))]),a&&Cn(a,e,6,o);const c=i[l+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Cn(c,e,6,o)}}const O_=new WeakMap;function Sg(e,t,n=!1){const i=n?O_:t.emitsCache,o=i.get(e);if(o!==void 0)return o;const s=e.emits;let r={},l=!1;if(!St(e)){const a=c=>{const u=Sg(c,t,!0);u&&(l=!0,xe(r,u))};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}return!s&&!l?(Jt(e)&&i.set(e,null),null):(bt(s)?s.forEach(a=>r[a]=null):xe(r,s),Jt(e)&&i.set(e,r),r)}function cl(e,t){return!e||!tl(t)?!1:(t=t.slice(2).replace(/Once$/,""),zt(e,t[0].toLowerCase()+t.slice(1))||zt(e,fi(t))||zt(e,t))}function Mu(e){const{type:t,vnode:n,proxy:i,withProxy:o,propsOptions:[s],slots:r,attrs:l,emit:a,render:c,renderCache:u,props:h,data:p,setupState:g,ctx:v,inheritAttrs:x}=e,E=Pr(e);let T,A;try{if(n.shapeFlag&4){const M=o||i,D=M;T=_n(c.call(D,M,u,h,g,p,v)),A=l}else{const M=t;T=_n(M.length>1?M(h,{attrs:l,slots:r,emit:a}):M(h,null)),A=t.props?l:V_(l)}}catch(M){Ko.length=0,ll(M,e,1),T=Z(ai)}let I=T;if(A&&x!==!1){const M=Object.keys(A),{shapeFlag:D}=I;M.length&&D&7&&(s&&M.some(el)&&(A=G_(A,s)),I=oo(I,A,!1,!0))}return n.dirs&&(I=oo(I,null,!1,!0),I.dirs=I.dirs?I.dirs.concat(n.dirs):n.dirs),n.transition&&kc(I,n.transition),T=I,Pr(E),T}const V_=e=>{let t;for(const n in e)(n==="class"||n==="style"||tl(n))&&((t||(t={}))[n]=e[n]);return t},G_=(e,t)=>{const n={};for(const i in e)(!el(i)||!(i.slice(9)in t))&&(n[i]=e[i]);return n};function H_(e,t,n){const{props:i,children:o,component:s}=e,{props:r,children:l,patchFlag:a}=t,c=s.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return i?Pu(i,r,c):!!r;if(a&8){const u=t.dynamicProps;for(let h=0;hObject.create(Ig),Mg=e=>Object.getPrototypeOf(e)===Ig;function q_(e,t,n,i=!1){const o={},s=Rg();e.propsDefaults=Object.create(null),Pg(e,t,o,s);for(const r in e.propsOptions[0])r in o||(o[r]=void 0);n?e.props=i?o:Xy(o):e.type.props?e.props=o:e.props=s,e.attrs=s}function z_(e,t,n,i){const{props:o,attrs:s,vnode:{patchFlag:r}}=e,l=qt(o),[a]=e.propsOptions;let c=!1;if((i||r>0)&&!(r&16)){if(r&8){const u=e.vnode.dynamicProps;for(let h=0;h{a=!0;const[p,g]=kg(h,t,!0);xe(r,p),g&&l.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!s&&!a)return Jt(e)&&i.set(e,Yi),Yi;if(bt(s))for(let u=0;ue==="_"||e==="_ctx"||e==="$stable",Lc=e=>bt(e)?e.map(_n):[_n(e)],J_=(e,t,n)=>{if(t._n)return t;const i=a_((...o)=>Lc(t(...o)),n);return i._c=!1,i},Dg=(e,t,n)=>{const i=e._ctx;for(const o in e){if(Nc(o))continue;const s=e[o];if(St(s))t[o]=J_(o,s,i);else if(s!=null){const r=Lc(s);t[o]=()=>r}}},Ng=(e,t)=>{const n=Lc(t);e.slots.default=()=>n},Lg=(e,t,n)=>{for(const i in t)(n||!Nc(i))&&(e[i]=t[i])},K_=(e,t,n)=>{const i=e.slots=Rg();if(e.vnode.shapeFlag&32){const o=t._;o?(Lg(i,t,n),n&&zp(i,"_",o,!0)):Dg(t,i)}else t&&Ng(e,t)},Y_=(e,t,n)=>{const{vnode:i,slots:o}=e;let s=!0,r=Xt;if(i.shapeFlag&32){const l=t._;l?n&&l===1?s=!1:Lg(o,t,n):(s=!t.$stable,Dg(t,o)),r=t}else t&&(Ng(e,t),r={default:1});if(s)for(const l in o)!Nc(l)&&r[l]==null&&delete o[l]},Ve=tv;function X_(e){return Q_(e)}function Q_(e,t){const n=sl();n.__VUE__=!0;const{insert:i,remove:o,patchProp:s,createElement:r,createText:l,createComment:a,setText:c,setElementText:u,parentNode:h,nextSibling:p,setScopeId:g=En,insertStaticContent:v}=e,x=(R,k,O,J=null,$=null,H=null,it=void 0,tt=null,X=!!k.dynamicChildren)=>{if(R===k)return;R&&!vo(R,k)&&(J=pe(R),ie(R,$,H,!0),R=null),k.patchFlag===-2&&(X=!1,k.dynamicChildren=null);const{type:z,ref:pt,shapeFlag:ot}=k;switch(z){case ul:E(R,k,O,J);break;case ai:T(R,k,O,J);break;case ur:R==null&&A(k,O,J,it);break;case kt:at(R,k,O,J,$,H,it,tt,X);break;default:ot&1?D(R,k,O,J,$,H,it,tt,X):ot&6?Ct(R,k,O,J,$,H,it,tt,X):(ot&64||ot&128)&&z.process(R,k,O,J,$,H,it,tt,X,Me)}pt!=null&&$?zo(pt,R&&R.ref,H,k||R,!k):pt==null&&R&&R.ref!=null&&zo(R.ref,null,H,R,!0)},E=(R,k,O,J)=>{if(R==null)i(k.el=l(k.children),O,J);else{const $=k.el=R.el;k.children!==R.children&&c($,k.children)}},T=(R,k,O,J)=>{R==null?i(k.el=a(k.children||""),O,J):k.el=R.el},A=(R,k,O,J)=>{[R.el,R.anchor]=v(R.children,k,O,J,R.el,R.anchor)},I=({el:R,anchor:k},O,J)=>{let $;for(;R&&R!==k;)$=p(R),i(R,O,J),R=$;i(k,O,J)},M=({el:R,anchor:k})=>{let O;for(;R&&R!==k;)O=p(R),o(R),R=O;o(k)},D=(R,k,O,J,$,H,it,tt,X)=>{if(k.type==="svg"?it="svg":k.type==="math"&&(it="mathml"),R==null)P(k,O,J,$,H,it,tt,X);else{const z=R.el&&R.el._isVueCE?R.el:null;try{z&&z._beginPatch(),V(R,k,$,H,it,tt,X)}finally{z&&z._endPatch()}}},P=(R,k,O,J,$,H,it,tt)=>{let X,z;const{props:pt,shapeFlag:ot,transition:ht,dirs:dt}=R;if(X=R.el=r(R.type,H,pt&&pt.is,pt),ot&8?u(X,R.children):ot&16&&U(R.children,X,null,J,$,Vl(R,H),it,tt),dt&&mi(R,null,J,"created"),B(X,R,R.scopeId,it,J),pt){for(const Vt in pt)Vt!=="value"&&!Ho(Vt)&&s(X,Vt,null,pt[Vt],H,J);"value"in pt&&s(X,"value",null,pt.value,H),(z=pt.onVnodeBeforeMount)&&dn(z,J,R)}dt&&mi(R,null,J,"beforeMount");const Pt=Z_($,ht);Pt&&ht.beforeEnter(X),i(X,k,O),((z=pt&&pt.onVnodeMounted)||Pt||dt)&&Ve(()=>{try{z&&dn(z,J,R),Pt&&ht.enter(X),dt&&mi(R,null,J,"mounted")}finally{}},$)},B=(R,k,O,J,$)=>{if(O&&g(R,O),J)for(let H=0;H{for(let z=X;z{const tt=k.el=R.el;let{patchFlag:X,dynamicChildren:z,dirs:pt}=k;X|=R.patchFlag&16;const ot=R.props||Xt,ht=k.props||Xt;let dt;if(O&&yi(O,!1),(dt=ht.onVnodeBeforeUpdate)&&dn(dt,O,k,R),pt&&mi(k,R,O,"beforeUpdate"),O&&yi(O,!0),(ot.innerHTML&&ht.innerHTML==null||ot.textContent&&ht.textContent==null)&&u(tt,""),z?W(R.dynamicChildren,z,tt,O,J,Vl(k,$),H):it||rt(R,k,tt,null,O,J,Vl(k,$),H,!1),X>0){if(X&16)et(tt,ot,ht,O,$);else if(X&2&&ot.class!==ht.class&&s(tt,"class",null,ht.class,$),X&4&&s(tt,"style",ot.style,ht.style,$),X&8){const Pt=k.dynamicProps;for(let Vt=0;Vt{dt&&dn(dt,O,k,R),pt&&mi(k,R,O,"updated")},J)},W=(R,k,O,J,$,H,it)=>{for(let tt=0;tt{if(k!==O){if(k!==Xt)for(const H in k)!Ho(H)&&!(H in O)&&s(R,H,k[H],null,$,J);for(const H in O){if(Ho(H))continue;const it=O[H],tt=k[H];it!==tt&&H!=="value"&&s(R,H,tt,it,$,J)}"value"in O&&s(R,"value",k.value,O.value,$)}},at=(R,k,O,J,$,H,it,tt,X)=>{const z=k.el=R?R.el:l(""),pt=k.anchor=R?R.anchor:l("");let{patchFlag:ot,dynamicChildren:ht,slotScopeIds:dt}=k;dt&&(tt=tt?tt.concat(dt):dt),R==null?(i(z,O,J),i(pt,O,J),U(k.children||[],O,pt,$,H,it,tt,X)):ot>0&&ot&64&&ht&&R.dynamicChildren&&R.dynamicChildren.length===ht.length?(W(R.dynamicChildren,ht,O,$,H,it,tt),(k.key!=null||$&&k===$.subTree)&&Fg(R,k,!0)):rt(R,k,O,pt,$,H,it,tt,X)},Ct=(R,k,O,J,$,H,it,tt,X)=>{k.slotScopeIds=tt,R==null?k.shapeFlag&512?$.ctx.activate(k,O,J,it,X):gt(k,O,J,$,H,it,X):st(R,k,X)},gt=(R,k,O,J,$,H,it)=>{const tt=R.component=lv(R,J,$);if(vg(R)&&(tt.ctx.renderer=Me),cv(tt,!1,it),tt.asyncDep){if($&&$.registerDep(tt,ut,it),!R.el){const X=tt.subTree=Z(ai);T(null,X,k,O),R.placeholder=X.el}}else ut(tt,R,k,O,$,H,it)},st=(R,k,O)=>{const J=k.component=R.component;if(H_(R,k,O))if(J.asyncDep&&!J.asyncResolved){ft(J,k,O);return}else J.next=k,J.update();else k.el=R.el,J.vnode=k},ut=(R,k,O,J,$,H,it)=>{const tt=()=>{if(R.isMounted){let{next:ot,bu:ht,u:dt,parent:Pt,vnode:Vt}=R;{const _=Ug(R);if(_){ot&&(ot.el=Vt.el,ft(R,ot,it)),_.asyncDep.then(()=>{Ve(()=>{R.isUnmounted||z()},$)});return}}let Et=ot,Qt;yi(R,!1),ot?(ot.el=Vt.el,ft(R,ot,it)):ot=Vt,ht&&ar(ht),(Qt=ot.props&&ot.props.onVnodeBeforeUpdate)&&dn(Qt,Pt,ot,Vt),yi(R,!0);const w=Mu(R),y=R.subTree;R.subTree=w,x(y,w,h(y.el),pe(y),R,$,H),ot.el=w.el,Et===null&&$_(R,w.el),dt&&Ve(dt,$),(Qt=ot.props&&ot.props.onVnodeUpdated)&&Ve(()=>dn(Qt,Pt,ot,Vt),$)}else{let ot;const{el:ht,props:dt}=k,{bm:Pt,m:Vt,parent:Et,root:Qt,type:w}=R,y=Wo(k);yi(R,!1),Pt&&ar(Pt),!y&&(ot=dt&&dt.onVnodeBeforeMount)&&dn(ot,Et,k),yi(R,!0);{Qt.ce&&Qt.ce._hasShadowRoot()&&Qt.ce._injectChildStyle(w,R.parent?R.parent.type:void 0);const _=R.subTree=Mu(R);x(null,_,O,J,R,$,H),k.el=_.el}if(Vt&&Ve(Vt,$),!y&&(ot=dt&&dt.onVnodeMounted)){const _=k;Ve(()=>dn(ot,Et,_),$)}(k.shapeFlag&256||Et&&Wo(Et.vnode)&&Et.vnode.shapeFlag&256)&&R.a&&Ve(R.a,$),R.isMounted=!0,k=O=J=null}};R.scope.on();const X=R.effect=new Yp(tt);R.scope.off();const z=R.update=X.run.bind(X),pt=R.job=X.runIfDirty.bind(X);pt.i=R,pt.id=R.uid,X.scheduler=()=>Pc(pt),yi(R,!0),z()},ft=(R,k,O)=>{k.component=R;const J=R.vnode.props;R.vnode=k,R.next=null,z_(R,k.props,J,O),Y_(R,k.children,O),Gn(),Eu(R),Hn()},rt=(R,k,O,J,$,H,it,tt,X=!1)=>{const z=R&&R.children,pt=R?R.shapeFlag:0,ot=k.children,{patchFlag:ht,shapeFlag:dt}=k;if(ht>0){if(ht&128){Nt(z,ot,O,J,$,H,it,tt,X);return}else if(ht&256){xt(z,ot,O,J,$,H,it,tt,X);return}}dt&8?(pt&16&&ae(z,$,H),ot!==z&&u(O,ot)):pt&16?dt&16?Nt(z,ot,O,J,$,H,it,tt,X):ae(z,$,H,!0):(pt&8&&u(O,""),dt&16&&U(ot,O,J,$,H,it,tt,X))},xt=(R,k,O,J,$,H,it,tt,X)=>{R=R||Yi,k=k||Yi;const z=R.length,pt=k.length,ot=Math.min(z,pt);let ht;for(ht=0;htpt?ae(R,$,H,!0,!1,ot):U(k,O,J,$,H,it,tt,X,ot)},Nt=(R,k,O,J,$,H,it,tt,X)=>{let z=0;const pt=k.length;let ot=R.length-1,ht=pt-1;for(;z<=ot&&z<=ht;){const dt=R[z],Pt=k[z]=X?kn(k[z]):_n(k[z]);if(vo(dt,Pt))x(dt,Pt,O,null,$,H,it,tt,X);else break;z++}for(;z<=ot&&z<=ht;){const dt=R[ot],Pt=k[ht]=X?kn(k[ht]):_n(k[ht]);if(vo(dt,Pt))x(dt,Pt,O,null,$,H,it,tt,X);else break;ot--,ht--}if(z>ot){if(z<=ht){const dt=ht+1,Pt=dtht)for(;z<=ot;)ie(R[z],$,H,!0),z++;else{const dt=z,Pt=z,Vt=new Map;for(z=Pt;z<=ht;z++){const F=k[z]=X?kn(k[z]):_n(k[z]);F.key!=null&&Vt.set(F.key,z)}let Et,Qt=0;const w=ht-Pt+1;let y=!1,_=0;const C=new Array(w);for(z=0;z=w){ie(F,$,H,!0);continue}let G;if(F.key!=null)G=Vt.get(F.key);else for(Et=Pt;Et<=ht;Et++)if(C[Et-Pt]===0&&vo(F,k[Et])){G=Et;break}G===void 0?ie(F,$,H,!0):(C[G-Pt]=z+1,G>=_?_=G:y=!0,x(F,k[G],O,null,$,H,it,tt,X),Qt++)}const N=y?j_(C):Yi;for(Et=N.length-1,z=w-1;z>=0;z--){const F=Pt+z,G=k[F],At=k[F+1],yt=F+1{const{el:H,type:it,transition:tt,children:X,shapeFlag:z}=R;if(z&6){Kt(R.component.subTree,k,O,J);return}if(z&128){R.suspense.move(k,O,J);return}if(z&64){it.move(R,k,O,Me);return}if(it===kt){i(H,k,O);for(let ot=0;ottt.enter(H),$);else{const{leave:ot,delayLeave:ht,afterLeave:dt}=tt,Pt=()=>{R.ctx.isUnmounted?o(H):i(H,k,O)},Vt=()=>{H._isLeaving&&H[g_](!0),ot(H,()=>{Pt(),dt&&dt()})};ht?ht(H,Pt,Vt):Vt()}else i(H,k,O)},ie=(R,k,O,J=!1,$=!1)=>{const{type:H,props:it,ref:tt,children:X,dynamicChildren:z,shapeFlag:pt,patchFlag:ot,dirs:ht,cacheIndex:dt,memo:Pt}=R;if(ot===-2&&($=!1),tt!=null&&(Gn(),zo(tt,null,O,R,!0),Hn()),dt!=null&&(k.renderCache[dt]=void 0),pt&256){k.ctx.deactivate(R);return}const Vt=pt&1&&ht,Et=!Wo(R);let Qt;if(Et&&(Qt=it&&it.onVnodeBeforeUnmount)&&dn(Qt,k,R),pt&6)Lt(R.component,O,J);else{if(pt&128){R.suspense.unmount(O,J);return}Vt&&mi(R,null,k,"beforeUnmount"),pt&64?R.type.remove(R,k,O,Me,J):z&&!z.hasOnce&&(H!==kt||ot>0&&ot&64)?ae(z,k,O,!1,!0):(H===kt&&ot&384||!$&&pt&16)&&ae(X,k,O),J&&Ut(R)}const w=Pt!=null&&dt==null;(Et&&(Qt=it&&it.onVnodeUnmounted)||Vt||w)&&Ve(()=>{Qt&&dn(Qt,k,R),Vt&&mi(R,null,k,"unmounted"),w&&(R.el=null)},O)},Ut=R=>{const{type:k,el:O,anchor:J,transition:$}=R;if(k===kt){Rt(O,J);return}if(k===ur){M(R);return}const H=()=>{o(O),$&&!$.persisted&&$.afterLeave&&$.afterLeave()};if(R.shapeFlag&1&&$&&!$.persisted){const{leave:it,delayLeave:tt}=$,X=()=>it(O,H);tt?tt(R.el,H,X):X()}else H()},Rt=(R,k)=>{let O;for(;R!==k;)O=p(R),o(R),R=O;o(k)},Lt=(R,k,O)=>{const{bum:J,scope:$,job:H,subTree:it,um:tt,m:X,a:z}=R;Du(X),Du(z),J&&ar(J),$.stop(),H&&(H.flags|=8,ie(it,R,k,O)),tt&&Ve(tt,k),Ve(()=>{R.isUnmounted=!0},k)},ae=(R,k,O,J=!1,$=!1,H=0)=>{for(let it=H;it{if(R.shapeFlag&6)return pe(R.component.subTree);if(R.shapeFlag&128)return R.suspense.next();const k=p(R.anchor||R.el),O=k&&k[h_];return O?p(O):k};let vt=!1;const Re=(R,k,O)=>{let J;R==null?k._vnode&&(ie(k._vnode,null,null,!0),J=k._vnode.component):x(k._vnode||null,R,k,null,null,null,O),k._vnode=R,vt||(vt=!0,Eu(J),fg(),vt=!1)},Me={p:x,um:ie,m:Kt,r:Ut,mt:gt,mc:U,pc:rt,pbc:W,n:pe,o:e};return{render:Re,hydrate:void 0,createApp:F_(Re)}}function Vl({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function yi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Z_(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Fg(e,t,n=!1){const i=e.children,o=t.children;if(bt(i)&&bt(o))for(let s=0;s>1,e[n[l]]0&&(t[i]=n[s-1]),n[s]=i)}}for(s=n.length,r=n[s-1];s-- >0;)n[s]=r,r=t[r];return n}function Ug(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ug(t)}function Du(e){if(e)for(let t=0;te.__isSuspense;function tv(e,t){t&&t.pendingBranch?bt(e)?t.effects.push(...e):t.effects.push(e):l_(e)}const kt=Symbol.for("v-fgt"),ul=Symbol.for("v-txt"),ai=Symbol.for("v-cmt"),ur=Symbol.for("v-stc"),Ko=[];let Je=null;function Y(e=!1){Ko.push(Je=e?null:[])}function ev(){Ko.pop(),Je=Ko[Ko.length-1]||null}let os=1;function Nr(e,t=!1){os+=e,e<0&&Je&&t&&(Je.hasOnce=!0)}function Vg(e){return e.dynamicChildren=os>0?Je||Yi:null,ev(),os>0&&Je&&Je.push(e),e}function j(e,t,n,i,o,s){return Vg(m(e,t,n,i,o,s,!0))}function Xn(e,t,n,i,o){return Vg(Z(e,t,n,i,o,!0))}function Lr(e){return e?e.__v_isVNode===!0:!1}function vo(e,t){return e.type===t.type&&e.key===t.key}const Gg=({key:e})=>e??null,dr=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?le(e)||Ae(e)||St(e)?{i:We,r:e,k:t,f:!!n}:e:null);function m(e,t=null,n=null,i=0,o=null,s=e===kt?0:1,r=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Gg(t),ref:t&&dr(t),scopeId:pg,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:We};return l?(Fc(a,n),s&128&&e.normalize(a)):n&&(a.shapeFlag|=le(n)?8:16),os>0&&!r&&Je&&(a.patchFlag>0||s&6)&&a.patchFlag!==32&&Je.push(a),a}const Z=nv;function nv(e,t=null,n=null,i=0,o=null,s=!1){if((!e||e===Eg)&&(e=ai),Lr(e)){const l=oo(e,t,!0);return n&&Fc(l,n),os>0&&!s&&Je&&(l.shapeFlag&6?Je[Je.indexOf(e)]=l:Je.push(l)),l.patchFlag=-2,l}if(pv(e)&&(e=e.__vccOpts),t){t=iv(t);let{class:l,style:a}=t;l&&!le(l)&&(t.class=$t(l)),Jt(a)&&(Mc(a)&&!bt(a)&&(a=xe({},a)),t.style=bc(a))}const r=le(e)?1:Og(e)?128:p_(e)?64:Jt(e)?4:St(e)?2:0;return m(e,t,n,i,o,r,s,!0)}function iv(e){return e?Mc(e)||Mg(e)?xe({},e):e:null}function oo(e,t,n=!1,i=!1){const{props:o,ref:s,patchFlag:r,children:l,transition:a}=e,c=t?ov(o||{},t):o,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Gg(c),ref:t&&t.ref?n&&s?bt(s)?s.concat(dr(t)):[s,dr(t)]:dr(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==kt?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&oo(e.ssContent),ssFallback:e.ssFallback&&oo(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&i&&kc(u,a.clone(u)),u}function Yt(e=" ",t=0){return Z(ul,null,e,t)}function Us(e,t){const n=Z(ur,null,e);return n.staticCount=t,n}function Ht(e="",t=!1){return t?(Y(),Xn(ai,null,e)):Z(ai,null,e)}function _n(e){return e==null||typeof e=="boolean"?Z(ai):bt(e)?Z(kt,null,e.slice()):Lr(e)?kn(e):Z(ul,null,String(e))}function kn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:oo(e)}function Fc(e,t){let n=0;const{shapeFlag:i}=e;if(t==null)t=null;else if(bt(t))n=16;else if(typeof t=="object")if(i&65){const o=t.default;o&&(o._c&&(o._d=!1),Fc(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Mg(t)?t._ctx=We:o===3&&We&&(We.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else St(t)?(t={default:t,_ctx:We},n=32):(t=String(t),i&64?(n=16,t=[Yt(t)]):n=8);e.children=t,e.shapeFlag|=n}function ov(...e){const t={};for(let n=0;nTe||We;let Fr,Ia;{const e=sl(),t=(n,i)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(i),s=>{o.length>1?o.forEach(r=>r(s)):o[0](s)}};Fr=t("__VUE_INSTANCE_SETTERS__",n=>Te=n),Ia=t("__VUE_SSR_SETTERS__",n=>ss=n)}const ms=e=>{const t=Te;return Fr(e),e.scope.on(),()=>{e.scope.off(),Fr(t)}},Nu=()=>{Te&&Te.scope.off(),Fr(null)};function Hg(e){return e.vnode.shapeFlag&4}let ss=!1;function cv(e,t=!1,n=!1){t&&Ia(t);const{props:i,children:o}=e.vnode,s=Hg(e);q_(e,i,s,t),K_(e,o,n||t);const r=s?uv(e,t):void 0;return t&&Ia(!1),r}function uv(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,R_);const{setup:i}=n;if(i){Gn();const o=e.setupContext=i.length>1?fv(e):null,s=ms(e),r=gs(i,e,0,[e.props,o]),l=Hp(r);if(Hn(),s(),(l||e.sp)&&!Wo(e)&&_g(e),l){if(r.then(Nu,Nu),t)return r.then(a=>{Lu(e,a)}).catch(a=>{ll(a,e,0)});e.asyncDep=r}else Lu(e,r)}else $g(e)}function Lu(e,t,n){St(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Jt(t)&&(e.setupState=cg(t)),$g(e)}function $g(e,t,n){const i=e.type;e.render||(e.render=i.render||En);{const o=ms(e);Gn();try{M_(e)}finally{Hn(),o()}}}const dv={get(e,t){return we(e,"get",""),e[t]}};function fv(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,dv),slots:e.slots,emit:e.emit,expose:t}}function dl(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(cg(Qy(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Jo)return Jo[n](e)},has(t,n){return n in t||n in Jo}})):e.proxy}function hv(e,t=!0){return St(e)?e.displayName||e.name:e.name||t&&e.__name}function pv(e){return St(e)&&"__vccOpts"in e}const In=(e,t)=>n_(e,t,ss);function Ra(e,t,n){try{Nr(-1);const i=arguments.length;return i===2?Jt(t)&&!bt(t)?Lr(t)?Z(e,null,[t]):Z(e,t):Z(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&Lr(n)&&(n=[n]),Z(e,t,n))}finally{Nr(1)}}const gv="3.5.34";/** * @vue/runtime-dom v3.5.34 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let Ma;const Fu=typeof window<"u"&&window.trustedTypes;if(Fu)try{Ma=Fu.createPolicy("vue",{createHTML:e=>e})}catch{}const qg=Ma?e=>Ma.createHTML(e):e=>e,mv="http://www.w3.org/2000/svg",yv="http://www.w3.org/1998/Math/MathML",Pn=typeof document<"u"?document:null,Uu=Pn&&Pn.createElement("template"),_v={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,i)=>{const o=t==="svg"?Pn.createElementNS(mv,e):t==="mathml"?Pn.createElementNS(yv,e):n?Pn.createElement(e,{is:n}):Pn.createElement(e);return e==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:e=>Pn.createTextNode(e),createComment:e=>Pn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Pn.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,i,o,s){const r=n?n.previousSibling:t.lastChild;if(o&&(o===s||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===s||!(o=o.nextSibling)););else{Uu.innerHTML=qg(i==="svg"?`${e}`:i==="mathml"?`${e}`:e);const l=Uu.content;if(i==="svg"||i==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}t.insertBefore(l,n)}return[r?r.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},vv=Symbol("_vtc");function xv(e,t,n){const i=e[vv];i&&(t=(t?[t,...i]:[...i]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ur=Symbol("_vod"),zg=Symbol("_vsh"),xo={name:"show",beforeMount(e,{value:t},{transition:n}){e[Ur]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):bo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:i}){!t!=!n&&(i?t?(i.beforeEnter(e),bo(e,!0),i.enter(e)):i.leave(e,()=>{bo(e,!1)}):bo(e,t))},beforeUnmount(e,{value:t}){bo(e,t)}};function bo(e,t){e.style.display=t?e[Ur]:"none",e[zg]=!t}const bv=Symbol(""),Ev=/(?:^|;)\s*display\s*:/;function wv(e,t,n){const i=e.style,o=le(n);let s=!1;if(n&&!o){if(t)if(le(t))for(const r of t.split(";")){const l=r.slice(0,r.indexOf(":")).trim();n[l]==null&&Do(i,l,"")}else for(const r in t)n[r]==null&&Do(i,r,"");for(const r in n){r==="display"&&(s=!0);const l=n[r];l!=null?Cv(e,r,!le(t)&&t?t[r]:void 0,l)||Do(i,r,l):Do(i,r,"")}}else if(o){if(t!==n){const r=i[bv];r&&(n+=";"+r),i.cssText=n,s=Ev.test(n)}}else t&&e.removeAttribute("style");Ur in e&&(e[Ur]=s?i.display:"",e[zg]&&(i.display="none"))}const Bu=/\s*!important$/;function Do(e,t,n){if(bt(n))n.forEach(i=>Do(e,t,i));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=Tv(e,t);Bu.test(n)?e.setProperty(fi(i),n.replace(Bu,""),"important"):e[i]=n}}const Ou=["Webkit","Moz","ms"],Gl={};function Tv(e,t){const n=Gl[t];if(n)return n;let i=Ne(t);if(i!=="filter"&&i in e)return Gl[t]=i;i=il(i);for(let o=0;oHl||(Rv.then(()=>Hl=0),Hl=Date.now());function Pv(e,t){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;Cn(kv(i,n.value),t,5,[i])};return n.value=e,n.attached=Mv(),n}function kv(e,t){if(bt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(i=>o=>!o._stopped&&i&&i(o))}else return t}const zu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Dv=(e,t,n,i,o,s)=>{const r=o==="svg";t==="class"?xv(e,i,r):t==="style"?wv(e,n,i):tl(t)?el(t)||Av(e,t,n,i,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Nv(e,t,i,r))?(Hu(e,t,i),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Gu(e,t,i,r,s,t!=="value")):e._isVueCE&&(Lv(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!le(i)))?Hu(e,Ne(t),i,s,t):(t==="true-value"?e._trueValue=i:t==="false-value"&&(e._falseValue=i),Gu(e,t,i,r))};function Nv(e,t,n,i){if(i)return!!(t==="innerHTML"||t==="textContent"||t in e&&zu(t)&&St(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return zu(t)&&le(n)?!1:t in e}function Lv(e,t){const n=e._def.props;if(!n)return!1;const i=Ne(t);return Array.isArray(n)?n.some(o=>Ne(o)===i):Object.keys(n).some(o=>Ne(o)===i)}const ci=e=>{const t=e.props["onUpdate:modelValue"]||!1;return bt(t)?n=>ar(t,n):t};function Fv(e){e.target.composing=!0}function Wu(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const je=Symbol("_assign");function Ju(e,t,n){return t&&(e=e.trim()),n&&(e=ol(e)),e}const re={created(e,{modifiers:{lazy:t,trim:n,number:i}},o){e[je]=ci(o);const s=i||o.props&&o.props.type==="number";Fn(e,t?"change":"input",r=>{r.target.composing||e[je](Ju(e.value,n,s))}),(n||s)&&Fn(e,"change",()=>{e.value=Ju(e.value,n,s)}),t||(Fn(e,"compositionstart",Fv),Fn(e,"compositionend",Wu),Fn(e,"change",Wu))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:i,trim:o,number:s}},r){if(e[je]=ci(r),e.composing)return;const l=(s||e.type==="number")&&!/^0\d/.test(e.value)?ol(e.value):e.value,a=t??"";if(l===a)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(i&&t===n||o&&e.value.trim()===a)||(e.value=a)}},Uv={deep:!0,created(e,t,n){e[je]=ci(n),Fn(e,"change",()=>{const i=e._modelValue,o=so(e),s=e.checked,r=e[je];if(bt(i)){const l=Ec(i,o),a=l!==-1;if(s&&!a)r(i.concat(o));else if(!s&&a){const c=[...i];c.splice(l,1),r(c)}}else if(uo(i)){const l=new Set(i);s?l.add(o):l.delete(o),r(l)}else r(Wg(e,s))})},mounted:Ku,beforeUpdate(e,t,n){e[je]=ci(n),Ku(e,t,n)}};function Ku(e,{value:t,oldValue:n},i){e._modelValue=t;let o;if(bt(t))o=Ec(t,i.props.value)>-1;else if(uo(t))o=t.has(i.props.value);else{if(t===n)return;o=li(t,Wg(e,!0))}e.checked!==o&&(e.checked=o)}const Bs={created(e,{value:t},n){e.checked=li(t,n.props.value),e[je]=ci(n),Fn(e,"change",()=>{e[je](so(e))})},beforeUpdate(e,{value:t,oldValue:n},i){e[je]=ci(i),t!==n&&(e.checked=li(t,i.props.value))}},_i={deep:!0,created(e,{value:t,modifiers:{number:n}},i){const o=uo(t);Fn(e,"change",()=>{const s=Array.prototype.filter.call(e.options,r=>r.selected).map(r=>n?ol(so(r)):so(r));e[je](e.multiple?o?new Set(s):s:s[0]),e._assigning=!0,Mr(()=>{e._assigning=!1})}),e[je]=ci(i)},mounted(e,{value:t}){Yu(e,t)},beforeUpdate(e,t,n){e[je]=ci(n)},updated(e,{value:t}){e._assigning||Yu(e,t)}};function Yu(e,t){const n=e.multiple,i=bt(t);if(!(n&&!i&&!uo(t))){for(let o=0,s=e.options.length;oString(c)===String(l)):r.selected=Ec(t,l)>-1}else r.selected=t.has(l);else if(li(so(r),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function so(e){return"_value"in e?e._value:e.value}function Wg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Bv={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Xu=(e,t)=>{const n=e._withKeys||(e._withKeys={}),i=t.join(".");return n[i]||(n[i]=(o=>{if(!("key"in o))return;const s=fi(o.key);if(t.some(r=>r===s||Bv[r]===s))return e(o)}))},Ov=xe({patchProp:Dv},_v);let Qu;function Vv(){return Qu||(Qu=X_(Ov))}const Gv=((...e)=>{const t=Vv().createApp(...e),{mount:n}=t;return t.mount=i=>{const o=$v(i);if(!o)return;const s=t._component;!St(s)&&!s.render&&!s.template&&(s.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const r=n(o,!1,Hv(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),r},t});function Hv(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function $v(e){return le(e)?document.querySelector(e):e}/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Os={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zv=({size:e,strokeWidth:t=2,absoluteStrokeWidth:n,color:i,iconNode:o,name:s,class:r,...l},{slots:a})=>Ra("svg",{...Os,width:e||Os.width,height:e||Os.height,stroke:i||Os.stroke,"stroke-width":n?Number(t)*24/Number(e):t,class:["lucide",`lucide-${qv(s??"icon")}`],...l},[...o.map(c=>Ra(...c)),...a.default?[a.default()]:[]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const It=(e,t)=>(n,{slots:i})=>Ra(zv,{...n,iconNode:t,name:e},i);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ai=It("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wv=It("ArrowLeftIcon",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jv=It("BookOpenIcon",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zu=It("BrainCircuitIcon",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ju=It("CheckIcon",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $l=It("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const td=It("ChevronRightIcon",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ql=It("ChevronUpIcon",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kv=It("CircleAlertIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ed=It("CircleCheckIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pa=It("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zl=It("CloudIcon",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nd=It("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yv=It("GlobeIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xv=It("GraduationCapIcon",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const id=It("InfoIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qv=It("LaptopIcon",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zv=It("LayoutDashboardIcon",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gi=It("LoaderCircleIcon",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jv=It("LockIcon",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const od=It("LogOutIcon",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tx=It("MailIcon",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sd=It("PlusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ex=It("RefreshCcwIcon",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rd=It("SearchIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ld=It("SendIcon",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nx=It("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ad=It("ShieldAlertIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vs=It("ShieldCheckIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cd=It("ShieldXIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ka=It("ShieldIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wl=It("StarIcon",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ud=It("TargetIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gs=It("TerminalIcon",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ix=It("Trash2Icon",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eo=It("TriangleAlertIcon",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ox=It("UploadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jl=It("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hs=It("UsersIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $s=It("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-vue-next v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dd=It("ZapIcon",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/*! * @kurkle/color v0.3.4 * https://github.com/kurkle/color#readme * (c) 2024 Jukka Kurkela * Released under the MIT License */function ys(e){return e+.5|0}const jn=(e,t,n)=>Math.max(Math.min(e,n),t);function No(e){return jn(ys(e*2.55),0,255)}function ri(e){return jn(ys(e*255),0,255)}function Dn(e){return jn(ys(e/2.55)/100,0,1)}function fd(e){return jn(ys(e*100),0,100)}const Ke={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Da=[..."0123456789ABCDEF"],sx=e=>Da[e&15],rx=e=>Da[(e&240)>>4]+Da[e&15],qs=e=>(e&240)>>4===(e&15),lx=e=>qs(e.r)&&qs(e.g)&&qs(e.b)&&qs(e.a);function ax(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&Ke[e[1]]*17,g:255&Ke[e[2]]*17,b:255&Ke[e[3]]*17,a:t===5?Ke[e[4]]*17:255}:(t===7||t===9)&&(n={r:Ke[e[1]]<<4|Ke[e[2]],g:Ke[e[3]]<<4|Ke[e[4]],b:Ke[e[5]]<<4|Ke[e[6]],a:t===9?Ke[e[7]]<<4|Ke[e[8]]:255})),n}const cx=(e,t)=>e<255?t(e):"";function ux(e){var t=lx(e)?sx:rx;return e?"#"+t(e.r)+t(e.g)+t(e.b)+cx(e.a,t):void 0}const dx=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Jg(e,t,n){const i=t*Math.min(n,1-n),o=(s,r=(s+e/30)%12)=>n-i*Math.max(Math.min(r-3,9-r,1),-1);return[o(0),o(8),o(4)]}function fx(e,t,n){const i=(o,s=(o+e/60)%6)=>n-n*t*Math.max(Math.min(s,4-s,1),0);return[i(5),i(3),i(1)]}function hx(e,t,n){const i=Jg(e,1,.5);let o;for(t+n>1&&(o=1/(t+n),t*=o,n*=o),o=0;o<3;o++)i[o]*=1-t-n,i[o]+=t;return i}function px(e,t,n,i,o){return e===o?(t-n)/i+(t.5?u/(2-s-r):u/(s+r),a=px(n,i,o,u,s),a=a*60+.5),[a|0,c||0,l]}function Bc(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(ri)}function Oc(e,t,n){return Bc(Jg,e,t,n)}function gx(e,t,n){return Bc(hx,e,t,n)}function mx(e,t,n){return Bc(fx,e,t,n)}function Kg(e){return(e%360+360)%360}function yx(e){const t=dx.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?No(+t[5]):ri(+t[5]));const o=Kg(+t[2]),s=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=gx(o,s,r):t[1]==="hsv"?i=mx(o,s,r):i=Oc(o,s,r),{r:i[0],g:i[1],b:i[2],a:n}}function _x(e,t){var n=Uc(e);n[0]=Kg(n[0]+t),n=Oc(n),e.r=n[0],e.g=n[1],e.b=n[2]}function vx(e){if(!e)return;const t=Uc(e),n=t[0],i=fd(t[1]),o=fd(t[2]);return e.a<255?`hsla(${n}, ${i}%, ${o}%, ${Dn(e.a)})`:`hsl(${n}, ${i}%, ${o}%)`}const hd={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},pd={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function xx(){const e={},t=Object.keys(pd),n=Object.keys(hd);let i,o,s,r,l;for(i=0;i>16&255,s>>8&255,s&255]}return e}let zs;function bx(e){zs||(zs=xx(),zs.transparent=[0,0,0,0]);const t=zs[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Ex=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function wx(e){const t=Ex.exec(e);let n=255,i,o,s;if(t){if(t[7]!==i){const r=+t[7];n=t[8]?No(r):jn(r*255,0,255)}return i=+t[1],o=+t[3],s=+t[5],i=255&(t[2]?No(i):jn(i,0,255)),o=255&(t[4]?No(o):jn(o,0,255)),s=255&(t[6]?No(s):jn(s,0,255)),{r:i,g:o,b:s,a:n}}}function Tx(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Dn(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Kl=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Hi=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Cx(e,t,n){const i=Hi(Dn(e.r)),o=Hi(Dn(e.g)),s=Hi(Dn(e.b));return{r:ri(Kl(i+n*(Hi(Dn(t.r))-i))),g:ri(Kl(o+n*(Hi(Dn(t.g))-o))),b:ri(Kl(s+n*(Hi(Dn(t.b))-s))),a:e.a+n*(t.a-e.a)}}function Ws(e,t,n){if(e){let i=Uc(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=Oc(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Yg(e,t){return e&&Object.assign(t||{},e)}function gd(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=ri(e[3]))):(t=Yg(e,{r:0,g:0,b:0,a:1}),t.a=ri(t.a)),t}function Sx(e){return e.charAt(0)==="r"?wx(e):yx(e)}class rs{constructor(t){if(t instanceof rs)return t;const n=typeof t;let i;n==="object"?i=gd(t):n==="string"&&(i=ax(t)||bx(t)||Sx(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Yg(this._rgb);return t&&(t.a=Dn(t.a)),t}set rgb(t){this._rgb=gd(t)}rgbString(){return this._valid?Tx(this._rgb):void 0}hexString(){return this._valid?ux(this._rgb):void 0}hslString(){return this._valid?vx(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,o=t.rgb;let s;const r=n===s?.5:n,l=2*r-1,a=i.a-o.a,c=((l*a===-1?l:(l+a)/(1+l*a))+1)/2;s=1-c,i.r=255&c*i.r+s*o.r+.5,i.g=255&c*i.g+s*o.g+.5,i.b=255&c*i.b+s*o.b+.5,i.a=r*i.a+(1-r)*o.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=Cx(this._rgb,t._rgb,n)),this}clone(){return new rs(this.rgb)}alpha(t){return this._rgb.a=ri(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=ys(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ws(this._rgb,2,t),this}darken(t){return Ws(this._rgb,2,-t),this}saturate(t){return Ws(this._rgb,1,t),this}desaturate(t){return Ws(this._rgb,1,-t),this}rotate(t){return _x(this._rgb,t),this}}/*! * Chart.js v4.5.1 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License */function An(){}const Ax=(()=>{let e=0;return()=>e++})();function Dt(e){return e==null}function oe(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Ft(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function ce(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function ze(e,t){return ce(e)?e:t}function Tt(e,t){return typeof e>"u"?t:e}const Ix=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Xg=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ee(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function Wt(e,t,n,i){let o,s,r;if(oe(e))for(s=e.length,o=0;oe,x:e=>e.x,y:e=>e.y};function Px(e){const t=e.split("."),n=[];let i="";for(const o of t)i+=o,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function kx(e){const t=Px(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function ui(e,t){return(md[t]||(md[t]=kx(t)))(e)}function Vc(e){return e.charAt(0).toUpperCase()+e.slice(1)}const as=e=>typeof e<"u",di=e=>typeof e=="function",yd=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function Dx(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const Ot=Math.PI,ne=2*Ot,Nx=ne+Ot,Vr=Number.POSITIVE_INFINITY,Lx=Ot/180,de=Ot/2,vi=Ot/4,_d=Ot*2/3,ti=Math.log10,wn=Math.sign;function Xo(e,t,n){return Math.abs(e-t)o-s).pop(),t}function Ux(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function ro(e){return!Ux(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function Bx(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Zg(e,t,n){let i,o,s;for(i=0,o=e.length;ia&&c=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function Hc(e,t,n){n=n||(r=>e[r]1;)s=o+i>>1,n(s)?o=s:i=s;return{lo:o,hi:i}}const Bn=(e,t,n,i)=>Hc(e,n,i?o=>{const s=e[o][t];return se[o][t]Hc(e,n,i=>e[i][t]>=n);function Hx(e,t,n){let i=0,o=e.length;for(;ii&&e[o-1]>n;)o--;return i>0||o{const i="_onData"+Vc(n),o=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...s){const r=o.apply(this,s);return e._chartjs.listeners.forEach(l=>{typeof l[i]=="function"&&l[i](...s)}),r}})})}function bd(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,o=i.indexOf(t);o!==-1&&i.splice(o,1),!(i.length>0)&&(tm.forEach(s=>{delete e[s]}),delete e._chartjs)}function em(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const nm=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function im(e,t){let n=[],i=!1;return function(...o){n=o,i||(i=!0,nm.call(window,()=>{i=!1,e.apply(t,n)}))}}function qx(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const $c=e=>e==="start"?"left":e==="end"?"right":"center",be=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,zx=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function om(e,t,n){const i=t.length;let o=0,s=i;if(e._sorted){const{iScale:r,vScale:l,_parsed:a}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:h,max:p,minDefined:g,maxDefined:v}=r.getUserBounds();if(g){if(o=Math.min(Bn(a,u,h).lo,n?i:Bn(t,u,r.getPixelForValue(h)).lo),c){const x=a.slice(0,o+1).reverse().findIndex(E=>!Dt(E[l.axis]));o-=Math.max(0,x)}o=ye(o,0,i-1)}if(v){let x=Math.max(Bn(a,r.axis,p,!0).hi+1,n?0:Bn(t,u,r.getPixelForValue(p),!0).hi+1);if(c){const E=a.slice(x-1).findIndex(T=>!Dt(T[l.axis]));x+=Math.max(0,E)}s=ye(x,o,i)-o}else s=i-o}return{start:o,count:s}}function sm(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,o={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=o,!0;const s=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,o),s}const Js=e=>e===0||e===1,Ed=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*ne/n)),wd=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*ne/n)+1,Qo={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*de)+1,easeOutSine:e=>Math.sin(e*de),easeInOutSine:e=>-.5*(Math.cos(Ot*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Js(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Js(e)?e:Ed(e,.075,.3),easeOutElastic:e=>Js(e)?e:wd(e,.075,.3),easeInOutElastic(e){return Js(e)?e:e<.5?.5*Ed(e*2,.1125,.45):.5+.5*wd(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Qo.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Qo.easeInBounce(e*2)*.5:Qo.easeOutBounce(e*2-1)*.5+.5};function qc(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Td(e){return qc(e)?e:new rs(e)}function Yl(e){return qc(e)?e:new rs(e).saturate(.5).darken(.1).hexString()}const Wx=["x","y","borderWidth","radius","tension"],Jx=["color","borderColor","backgroundColor"];function Kx(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:Jx},numbers:{type:"number",properties:Wx}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Yx(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Cd=new Map;function Xx(e,t){t=t||{};const n=e+JSON.stringify(t);let i=Cd.get(n);return i||(i=new Intl.NumberFormat(e,t),Cd.set(n,i)),i}function _s(e,t,n){return Xx(t,n).format(e)}const rm={values(e){return oe(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let o,s=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(o="scientific"),s=Qx(e,n)}const r=ti(Math.abs(s)),l=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),a={notation:o,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(a,this.options.ticks.format),_s(e,i,a)},logarithmic(e,t,n){if(e===0)return"0";const i=n[t].significand||e/Math.pow(10,Math.floor(ti(e)));return[1,2,3,5,10,15].includes(i)||t>.8*n.length?rm.numeric.call(this,e,t,n):""}};function Qx(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var fl={formatters:rm};function Zx(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fl.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Fi=Object.create(null),La=Object.create(null);function Zo(e,t){if(!t)return e;const n=t.split(".");for(let i=0,o=n.length;ii.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,o)=>Yl(o.backgroundColor),this.hoverBorderColor=(i,o)=>Yl(o.borderColor),this.hoverColor=(i,o)=>Yl(o.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Xl(this,t,n)}get(t){return Zo(this,t)}describe(t,n){return Xl(La,t,n)}override(t,n){return Xl(Fi,t,n)}route(t,n,i,o){const s=Zo(this,t),r=Zo(this,i),l="_"+n;Object.defineProperties(s,{[l]:{value:s[n],writable:!0},[n]:{enumerable:!0,get(){const a=this[l],c=r[o];return Ft(a)?Object.assign({},c,a):Tt(a,c)},set(a){this[l]=a}}})}apply(t){t.forEach(n=>n(this))}}var se=new jx({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Kx,Yx,Zx]);function tb(e){return!e||Dt(e.size)||Dt(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Gr(e,t,n,i,o){let s=t[o];return s||(s=t[o]=e.measureText(o).width,n.push(o)),s>i&&(i=s),i}function eb(e,t,n,i){i=i||{};let o=i.data=i.data||{},s=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(o=i.data={},s=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let r=0;const l=n.length;let a,c,u,h,p;for(a=0;an.length){for(a=0;a0&&e.stroke()}}function On(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&s.strokeColor!=="";let a,c;for(e.save(),e.font=o.string,ob(e,s),a=0;a+e||0;function zc(e,t){const n={},i=Ft(t),o=i?Object.keys(t):t,s=Ft(e)?i?r=>Tt(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of o)n[r]=ub(s(r));return n}function am(e){return zc(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Di(e){return zc(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Ie(e){const t=am(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ge(e,t){e=e||{},t=t||se.font;let n=Tt(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=Tt(e.style,t.style);i&&!(""+i).match(ab)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const o={family:Tt(e.family,t.family),lineHeight:cb(Tt(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:Tt(e.weight,t.weight),string:""};return o.string=tb(o),o}function Lo(e,t,n,i){let o,s,r;for(o=0,s=e.length;on&&l===0?0:l+a;return{min:r(i,-Math.abs(s)),max:r(o,s)}}function hi(e,t){return Object.assign(Object.create(e),t)}function Wc(e,t=[""],n,i,o=()=>e[0]){const s=n||e;typeof i>"u"&&(i=fm("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:s,_fallback:i,_getTarget:o,override:l=>Wc([l,...e],t,s,i)};return new Proxy(r,{deleteProperty(l,a){return delete l[a],delete l._keys,delete e[0][a],!0},get(l,a){return um(l,a,()=>vb(a,t,e,l))},getOwnPropertyDescriptor(l,a){return Reflect.getOwnPropertyDescriptor(l._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(l,a){return Id(l).includes(a)},ownKeys(l){return Id(l)},set(l,a,c){const u=l._storage||(l._storage=o());return l[a]=u[a]=c,delete l._keys,!0}})}function lo(e,t,n,i){const o={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:cm(e,i),setContext:s=>lo(e,s,n,i),override:s=>lo(e.override(s),t,n,i)};return new Proxy(o,{deleteProperty(s,r){return delete s[r],delete e[r],!0},get(s,r,l){return um(s,r,()=>hb(s,r,l))},getOwnPropertyDescriptor(s,r){return s._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(s,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(s,r,l){return e[r]=l,delete s[r],!0}})}function cm(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:o=t.allKeys}=e;return{allKeys:o,scriptable:n,indexable:i,isScriptable:di(n)?n:()=>n,isIndexable:di(i)?i:()=>i}}const fb=(e,t)=>e?e+Vc(t):t,Jc=(e,t)=>Ft(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function um(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function hb(e,t,n){const{_proxy:i,_context:o,_subProxy:s,_descriptors:r}=e;let l=i[t];return di(l)&&r.isScriptable(t)&&(l=pb(t,l,e,n)),oe(l)&&l.length&&(l=gb(t,l,e,r.isIndexable)),Jc(t,l)&&(l=lo(l,o,s&&s[t],r)),l}function pb(e,t,n,i){const{_proxy:o,_context:s,_subProxy:r,_stack:l}=n;if(l.has(e))throw new Error("Recursion detected: "+Array.from(l).join("->")+"->"+e);l.add(e);let a=t(s,r||i);return l.delete(e),Jc(e,a)&&(a=Kc(o._scopes,o,e,a)),a}function gb(e,t,n,i){const{_proxy:o,_context:s,_subProxy:r,_descriptors:l}=n;if(typeof s.index<"u"&&i(e))return t[s.index%t.length];if(Ft(t[0])){const a=t,c=o._scopes.filter(u=>u!==a);t=[];for(const u of a){const h=Kc(c,o,e,u);t.push(lo(h,s,r&&r[e],l))}}return t}function dm(e,t,n){return di(e)?e(t,n):e}const mb=(e,t)=>e===!0?t:typeof e=="string"?ui(t,e):void 0;function yb(e,t,n,i,o){for(const s of t){const r=mb(n,s);if(r){e.add(r);const l=dm(r._fallback,n,o);if(typeof l<"u"&&l!==n&&l!==i)return l}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function Kc(e,t,n,i){const o=t._rootScopes,s=dm(t._fallback,n,i),r=[...e,...o],l=new Set;l.add(i);let a=Ad(l,r,n,s||n,i);return a===null||typeof s<"u"&&s!==n&&(a=Ad(l,r,s,a,i),a===null)?!1:Wc(Array.from(l),[""],o,s,()=>_b(t,n,i))}function Ad(e,t,n,i,o){for(;n;)n=yb(e,t,n,i,o);return n}function _b(e,t,n){const i=e._getTarget();t in i||(i[t]={});const o=i[t];return oe(o)&&Ft(n)?n:o||{}}function vb(e,t,n,i){let o;for(const s of t)if(o=fm(fb(s,e),n),typeof o<"u")return Jc(e,o)?Kc(n,i,e,o):o}function fm(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function Id(e){let t=e._keys;return t||(t=e._keys=xb(e._scopes)),t}function xb(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(o=>!o.startsWith("_")))t.add(i);return Array.from(t)}function hm(e,t,n,i){const{iScale:o}=e,{key:s="r"}=this._parsing,r=new Array(i);let l,a,c,u;for(l=0,a=i;lte==="x"?"y":"x";function Eb(e,t,n,i){const o=e.skip?t:e,s=t,r=n.skip?t:n,l=Na(s,o),a=Na(r,s);let c=l/(l+a),u=a/(l+a);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const h=i*c,p=i*u;return{previous:{x:s.x-h*(r.x-o.x),y:s.y-h*(r.y-o.y)},next:{x:s.x+p*(r.x-o.x),y:s.y+p*(r.y-o.y)}}}function wb(e,t,n){const i=e.length;let o,s,r,l,a,c=ao(e,0);for(let u=0;u!c.skip)),t.cubicInterpolationMode==="monotone")Cb(e,o);else{let c=i?e[e.length-1]:e[0];for(s=0,r=e.length;se.ownerDocument.defaultView.getComputedStyle(e,null);function Ib(e,t){return gl(e).getPropertyValue(t)}const Rb=["top","right","bottom","left"];function Ni(e,t,n){const i={};n=n?"-"+n:"";for(let o=0;o<4;o++){const s=Rb[o];i[s]=parseFloat(e[t+"-"+s+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Mb=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Pb(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:o,offsetY:s}=i;let r=!1,l,a;if(Mb(o,s,e.target))l=o,a=s;else{const c=t.getBoundingClientRect();l=i.clientX-c.left,a=i.clientY-c.top,r=!0}return{x:l,y:a,box:r}}function Ti(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,o=gl(n),s=o.boxSizing==="border-box",r=Ni(o,"padding"),l=Ni(o,"border","width"),{x:a,y:c,box:u}=Pb(e,n),h=r.left+(u&&l.left),p=r.top+(u&&l.top);let{width:g,height:v}=t;return s&&(g-=r.width+l.width,v-=r.height+l.height),{x:Math.round((a-h)/g*n.width/i),y:Math.round((c-p)/v*n.height/i)}}function kb(e,t,n){let i,o;if(t===void 0||n===void 0){const s=e&&Xc(e);if(!s)t=e.clientWidth,n=e.clientHeight;else{const r=s.getBoundingClientRect(),l=gl(s),a=Ni(l,"border","width"),c=Ni(l,"padding");t=r.width-c.width-a.width,n=r.height-c.height-a.height,i=Hr(l.maxWidth,s,"clientWidth"),o=Hr(l.maxHeight,s,"clientHeight")}}return{width:t,height:n,maxWidth:i||Vr,maxHeight:o||Vr}}const ei=e=>Math.round(e*10)/10;function Db(e,t,n,i){const o=gl(e),s=Ni(o,"margin"),r=Hr(o.maxWidth,e,"clientWidth")||Vr,l=Hr(o.maxHeight,e,"clientHeight")||Vr,a=kb(e,t,n);let{width:c,height:u}=a;if(o.boxSizing==="content-box"){const p=Ni(o,"border","width"),g=Ni(o,"padding");c-=g.width+p.width,u-=g.height+p.height}return c=Math.max(0,c-s.width),u=Math.max(0,i?c/i:u-s.height),c=ei(Math.min(c,r,a.maxWidth)),u=ei(Math.min(u,l,a.maxHeight)),c&&!u&&(u=ei(c/2)),(t!==void 0||n!==void 0)&&i&&a.height&&u>a.height&&(u=a.height,c=ei(Math.floor(u*i))),{width:c,height:u}}function Rd(e,t,n){const i=t||1,o=ei(e.height*i),s=ei(e.width*i);e.height=ei(e.height),e.width=ei(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==i||r.height!==o||r.width!==s?(e.currentDevicePixelRatio=i,r.height=o,r.width=s,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Nb=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Yc()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Md(e,t){const n=Ib(e,t),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Ci(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function Lb(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function Fb(e,t,n,i){const o={x:e.cp2x,y:e.cp2y},s={x:t.cp1x,y:t.cp1y},r=Ci(e,o,n),l=Ci(o,s,n),a=Ci(s,t,n),c=Ci(r,l,n),u=Ci(l,a,n);return Ci(c,u,n)}const Ub=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},Bb=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function ji(e,t,n){return e?Ub(t,n):Bb()}function gm(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function mm(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function ym(e){return e==="angle"?{between:cs,compare:Ox,normalize:Ee}:{between:Un,compare:(t,n)=>t-n,normalize:t=>t}}function Pd({start:e,end:t,count:n,loop:i,style:o}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:o}}function Ob(e,t,n){const{property:i,start:o,end:s}=n,{between:r,normalize:l}=ym(i),a=t.length;let{start:c,end:u,loop:h}=e,p,g;if(h){for(c+=a,u+=a,p=0,g=a;pa(o,I,T)&&l(o,I)!==0,D=()=>l(s,T)===0||a(s,I,T),P=()=>x||M(),B=()=>!x||D();for(let U=u,V=u;U<=h;++U)A=t[U%r],!A.skip&&(T=c(A[i]),T!==I&&(x=a(T,o,s),E===null&&P()&&(E=l(T,o)===0?U:V),E!==null&&B()&&(v.push(Pd({start:E,end:U,loop:p,count:r,style:g})),E=null),V=U,I=T));return E!==null&&v.push(Pd({start:E,end:h,loop:p,count:r,style:g})),v}function vm(e,t){const n=[],i=e.segments;for(let o=0;oo&&e[s%t].skip;)s--;return s%=t,{start:o,end:s}}function Gb(e,t,n,i){const o=e.length,s=[];let r=t,l=e[t],a;for(a=t+1;a<=n;++a){const c=e[a%o];c.skip||c.stop?l.skip||(i=!1,s.push({start:t%o,end:(a-1)%o,loop:i}),t=r=c.stop?a:null):(r=a,l.skip&&(t=a)),l=c}return r!==null&&s.push({start:t%o,end:r%o,loop:i}),s}function Hb(e,t){const n=e.points,i=e.options.spanGaps,o=n.length;if(!o)return[];const s=!!e._loop,{start:r,end:l}=Vb(n,o,s,i);if(i===!0)return kd(e,[{start:r,end:l,loop:s}],n,t);const a=ll({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=nm.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,o)=>{if(!i.running||!i.items.length)return;const s=i.items;let r=s.length-1,l=!1,a;for(;r>=0;--r)a=s[r],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),l=!0):(s[r]=s[s.length-1],s.pop());l&&(o.draw(),this._notify(o,i,t,"progress")),s.length||(i.running=!1,this._notify(o,i,t,"complete"),i.initial=!1),n+=s.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,o)=>Math.max(i,o._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let o=i.length-1;for(;o>=0;--o)i[o].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Rn=new Wb;const Nd="transparent",Jb={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=Td(e||Nd),o=i.valid&&Td(t||Nd);return o&&o.valid?o.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Kb{constructor(t,n,i,o){const s=n[i];o=Lo([t.to,o,s,t.from]);const r=Lo([t.from,s,o]);this._active=!0,this._fn=t.fn||Jb[t.type||typeof r],this._easing=Qo[t.easing]||Qo.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=o,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const o=this._target[this._prop],s=i-this._start,r=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=s,this._loop=!!t.loop,this._to=Lo([t.to,n,o,t.from]),this._from=Lo([t.from,o,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,o=this._prop,s=this._from,r=this._loop,l=this._to;let a;if(this._active=s!==l&&(r||n1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[o]=this._fn(s,l,a)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let o=0;o{const s=t[o];if(!Ft(s))return;const r={};for(const l of n)r[l]=s[l];(oe(s.properties)&&s.properties||[o]).forEach(l=>{(l===o||!i.has(l))&&i.set(l,r)})})}_animateOptions(t,n){const i=n.options,o=Xb(t,i);if(!o)return[];const s=this._createAnimations(o,i);return i.$shared&&Yb(t.options.$animations,i).then(()=>{t.options=i},()=>{}),s}_createAnimations(t,n){const i=this._properties,o=[],s=t.$animations||(t.$animations={}),r=Object.keys(n),l=Date.now();let a;for(a=r.length-1;a>=0;--a){const c=r[a];if(c.charAt(0)==="$")continue;if(c==="options"){o.push(...this._animateOptions(t,n));continue}const u=n[c];let h=s[c];const p=i.get(c);if(h)if(p&&h.active()){h.update(p,u,l);continue}else h.cancel();if(!p||!p.duration){t[c]=u;continue}s[c]=h=new Kb(p,t,c,u),o.push(h)}return o}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return Rn.add(this._chart,i),!0}}function Yb(e,t){const n=[],i=Object.keys(t);for(let o=0;o0||!n&&s<0)return o.index}return null}function Bd(e,t){const{chart:n,_cachedMeta:i}=e,o=n._stacks||(n._stacks={}),{iScale:s,vScale:r,index:l}=i,a=s.axis,c=r.axis,u=tE(s,r,i),h=t.length;let p;for(let g=0;gn[i].axis===t).shift()}function iE(e,t){return hi(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function oE(e,t,n){return hi(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function wo(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const o of t){const s=o._stacks;if(!s||s[i]===void 0||s[i][n]===void 0)return;delete s[i][n],s[i]._visualValues!==void 0&&s[i]._visualValues[n]!==void 0&&delete s[i]._visualValues[n]}}}const jl=e=>e==="reset"||e==="none",Od=(e,t)=>t?e:Object.assign({},e),sE=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Em(n,!0),values:null};class sn{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ql(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&wo(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),o=(h,p,g,v)=>h==="x"?p:h==="r"?v:g,s=n.xAxisID=Tt(i.xAxisID,Zl(t,"x")),r=n.yAxisID=Tt(i.yAxisID,Zl(t,"y")),l=n.rAxisID=Tt(i.rAxisID,Zl(t,"r")),a=n.indexAxis,c=n.iAxisID=o(a,s,r,l),u=n.vAxisID=o(a,r,s,l);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(l),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&bd(this._data,this),t._stacked&&wo(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(Ft(n)){const o=this._cachedMeta;this._data=jb(n,o)}else if(i!==n){if(i){bd(i,this);const o=this._cachedMeta;wo(o),o._parsed=[]}n&&Object.isExtensible(n)&&$x(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let o=!1;this._dataCheck();const s=n._stacked;n._stacked=Ql(n.vScale,n),n.stack!==i.stack&&(o=!0,wo(n),n.stack=i.stack),this._resyncElements(t),(o||s!==n._stacked)&&(Bd(this,n._parsed),n._stacked=Ql(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:o}=this,{iScale:s,_stacked:r}=i,l=s.axis;let a=t===0&&n===o.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,h,p;if(this._parsing===!1)i._parsed=o,i._sorted=!0,p=o;else{oe(o[t])?p=this.parseArrayData(i,o,t,n):Ft(o[t])?p=this.parseObjectData(i,o,t,n):p=this.parsePrimitiveData(i,o,t,n);const g=()=>h[l]===null||c&&h[l]x||h=0;--p)if(!v()){this.updateRangeFromParsed(c,t,g,a);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let o,s,r;for(o=0,s=n.length;o=0&&tthis.getContext(i,o,n),x=c.resolveNamedOptions(p,g,v,h);return x.$shared&&(x.$shared=a,s[r]=Object.freeze(Od(x,a))),x}_resolveAnimations(t,n,i){const o=this.chart,s=this._cachedDataOpts,r=`animation-${n}`,l=s[r];if(l)return l;let a;if(o.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),p=u.getOptionScopes(this.getDataset(),h);a=u.createResolver(p,this.getContext(t,i,n))}const c=new bm(o,a&&a.animations);return a&&a._cacheable&&(s[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||jl(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),o=this._sharedOptions,s=this.getSharedOptions(i),r=this.includeOptions(n,s)||s!==o;return this.updateSharedOptions(s,n,i),{sharedOptions:s,includeOptions:r}}updateElement(t,n,i,o){jl(o)?Object.assign(t,i):this._resolveAnimations(n,o).update(t,i)}updateSharedOptions(t,n,i){t&&!jl(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,o){t.active=o;const s=this.getStyle(n,o);this._resolveAnimations(n,i,o).update(t,{options:!o&&this.getSharedOptions(s)||s})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[l,a,c]of this._syncList)this[l](a,c);this._syncList=[];const o=i.length,s=n.length,r=Math.min(s,o);r&&this.parse(0,r),s>o?this._insertElements(o,s-o,t):s{for(c.length+=n,l=c.length-1;l>=r;l--)c[l]=c[l-n]};for(a(s),l=t;lo-s))}return e._cache.$bar}function lE(e){const t=e.iScale,n=rE(t,e.type);let i=t._length,o,s,r,l;const a=()=>{r===32767||r===-32768||(as(l)&&(i=Math.min(i,Math.abs(r-l)||i)),l=r)};for(o=0,s=n.length;o0?o[e-1]:null,l=eMath.abs(l)&&(a=l,c=r),t[n.axis]=c,t._custom={barStart:a,barEnd:c,start:o,end:s,min:r,max:l}}function wm(e,t,n,i){return oe(e)?uE(e,t,n,i):t[n.axis]=n.parse(e,i),t}function Vd(e,t,n,i){const o=e.iScale,s=e.vScale,r=o.getLabels(),l=o===s,a=[];let c,u,h,p;for(c=n,u=n+i;c=n?1:-1)}function fE(e){let t,n,i,o,s;return e.horizontal?(t=e.base>e.x,n="left",i="right"):(t=e.baseu.controller.options.grouped),s=i.options.stacked,r=[],l=this._cachedMeta.controller.getParsed(n),a=l&&l[i.axis],c=u=>{const h=u._parsed.find(g=>g[i.axis]===a),p=h&&h[u.vScale.axis];if(Dt(p)||isNaN(p))return!0};for(const u of o)if(!(n!==void 0&&c(u))&&((s===!1||r.indexOf(u.stack)===-1||s===void 0&&u.stack===void 0)&&r.push(u.stack),u.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[Tt(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,i){const o=this._getStacks(t,i),s=n!==void 0?o.indexOf(n):-1;return s===-1?o.length-1:s}_getRuler(){const t=this.options,n=this._cachedMeta,i=n.iScale,o=[];let s,r;for(s=0,r=n.data.length;s=0;--i)n=Math.max(n,t[i].size(this.resolveDataElementOptions(i))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:o,yScale:s}=n,r=this.getParsed(t),l=o.getLabelForValue(r.x),a=s.getLabelForValue(r.y),c=r._custom;return{label:i[t]||"",value:"("+l+", "+a+(c?", "+c:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,i,o){const s=o==="reset",{iScale:r,vScale:l}=this._cachedMeta,{sharedOptions:a,includeOptions:c}=this._getSharedOptions(n,o),u=r.axis,h=l.axis;for(let p=n;pcs(I,l,a,!0)?1:Math.max(M,M*n,D,D*n),v=(I,M,D)=>cs(I,l,a,!0)?-1:Math.min(M,M*n,D,D*n),x=g(0,c,h),E=g(de,u,p),T=v(Ot,c,h),A=v(Ot+de,u,p);i=(x-T)/2,o=(E-A)/2,s=-(x+T)/2,r=-(E+A)/2}return{ratioX:i,ratioY:o,offsetX:s,offsetY:r}}class Ii extends sn{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const i=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=i;else{let s=a=>+i[a];if(Ft(i[t])){const{key:a="value"}=this._parsing;s=c=>+ui(i[c],a)}let r,l;for(r=t,l=t+n;r0&&!isNaN(t)?ne*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,o=i.data.labels||[],s=_s(n._parsed[t],i.options.locale);return{label:o[t]||"",value:s}}getMaxBorderWidth(t){let n=0;const i=this.chart;let o,s,r,l,a;if(!t){for(o=0,s=i.data.datasets.length;ot!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),nt(Ii,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:i,textAlign:o,color:s,useBorderRadius:r,borderRadius:l}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((a,c)=>{const h=t.getDatasetMeta(0).controller.getStyle(c);return{text:a,fillStyle:h.backgroundColor,fontColor:s,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:o,pointStyle:i,borderRadius:r&&(l||h.borderRadius),index:c}}):[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}}});class pr extends sn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:o=[],_dataset:s}=n,r=this.chart._animationsDisabled;let{start:l,count:a}=om(n,o,r);this._drawStart=l,this._drawCount=a,sm(n)&&(l=0,a=o.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!s._decimated,i.points=o;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(o,l,a,t)}updateElements(t,n,i,o){const s=o==="reset",{iScale:r,vScale:l,_stacked:a,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,o),p=r.axis,g=l.axis,{spanGaps:v,segment:x}=this.options,E=ro(v)?v:Number.POSITIVE_INFINITY,T=this.chart._animationsDisabled||s||o==="none",A=n+i,I=t.length;let M=n>0&&this.getParsed(n-1);for(let D=0;D=A){B.skip=!0;continue}const U=this.getParsed(D),V=Dt(U[g]),W=B[p]=r.getPixelForValue(U[p],D),et=B[g]=s||V?l.getBasePixel():l.getPixelForValue(a?this.applyStack(l,U,a):U[g],D);B.skip=isNaN(W)||isNaN(et)||V,B.stop=D>0&&Math.abs(U[p]-M[p])>E,x&&(B.parsed=U,B.raw=c.data[D]),h&&(B.options=u||this.resolveDataElementOptions(D,P.active?"active":o)),T||this.updateElement(P,D,B,o),M=U}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,o=t.data||[];if(!o.length)return i;const s=o[0].size(this.resolveDataElementOptions(0)),r=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(i,s,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}nt(pr,"id","line"),nt(pr,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),nt(pr,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class jo extends sn{constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,o=i.data.labels||[],s=_s(n._parsed[t].r,i.options.locale);return{label:o[t]||"",value:s}}parseObjectData(t,n,i,o){return hm.bind(this)(t,n,i,o)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,o)=>{const s=this.getParsed(o).r;!isNaN(s)&&this.chart.getDataVisibility(o)&&(sn.max&&(n.max=s))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,i=t.options,o=Math.min(n.right-n.left,n.bottom-n.top),s=Math.max(o/2,0),r=Math.max(i.cutoutPercentage?s/100*i.cutoutPercentage:1,0),l=(s-r)/t.getVisibleDatasetCount();this.outerRadius=s-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,n,i,o){const s=o==="reset",r=this.chart,a=r.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,h=c.yCenter,p=c.getIndexAngle(0)-.5*Ot;let g=p,v;const x=360/this.countVisibleElements();for(v=0;v{!isNaN(this.getParsed(o).r)&&this.chart.getDataVisibility(o)&&n++}),n}_computeAngle(t,n,i){return this.chart.getDataVisibility(t)?nn(this.resolveDataElementOptions(t,n).angle||i):0}}nt(jo,"id","polarArea"),nt(jo,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),nt(jo,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:o}}=t.legend.options;return n.labels.map((s,r)=>{const a=t.getDatasetMeta(0).controller.getStyle(r);return{text:s,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:o,lineWidth:a.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Ua extends Ii{}nt(Ua,"id","pie"),nt(Ua,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class gr extends sn{getLabelAndValue(t){const n=this._cachedMeta.vScale,i=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(i[n.axis])}}parseObjectData(t,n,i,o){return hm.bind(this)(t,n,i,o)}update(t){const n=this._cachedMeta,i=n.dataset,o=n.data||[],s=n.iScale.getLabels();if(i.points=o,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const l={_loop:!0,_fullLoop:s.length===o.length,options:r};this.updateElement(i,void 0,l,t)}this.updateElements(o,0,o.length,t)}updateElements(t,n,i,o){const s=this._cachedMeta.rScale,r=o==="reset";for(let l=n;l0&&this.getParsed(n-1);for(let M=n;M0&&Math.abs(P[g]-I[g])>T,E&&(B.parsed=P,B.raw=c.data[M]),p&&(B.options=h||this.resolveDataElementOptions(M,D.active?"active":o)),A||this.updateElement(D,M,B,o),I=P}this.updateSharedOptions(h,o,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let l=0;for(let a=n.length-1;a>=0;--a)l=Math.max(l,n[a].size(this.resolveDataElementOptions(a))/2);return l>0&&l}const i=t.dataset,o=i.options&&i.options.borderWidth||0;if(!n.length)return o;const s=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(o,s,r)/2}}nt(mr,"id","scatter"),nt(mr,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),nt(mr,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var yE=Object.freeze({__proto__:null,BarController:fr,BubbleController:hr,DoughnutController:Ii,LineController:pr,PieController:Ua,PolarAreaController:jo,RadarController:gr,ScatterController:mr});function bi(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Qc{constructor(t){nt(this,"options");this.options=t||{}}static override(t){Object.assign(Qc.prototype,t)}init(){}formats(){return bi()}parse(){return bi()}format(){return bi()}add(){return bi()}diff(){return bi()}startOf(){return bi()}endOf(){return bi()}}var _E={_date:Qc};function vE(e,t,n,i){const{controller:o,data:s,_sorted:r}=e,l=o._cachedMeta.iScale,a=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(l&&t===l.axis&&t!=="r"&&r&&s.length){const c=l._reversePixels?Gx:Bn;if(i){if(o._sharedOptions){const u=s[0],h=typeof u.getRange=="function"&&u.getRange(t);if(h){const p=c(s,t,n-h),g=c(s,t,n+h);return{lo:p.lo,hi:g.hi}}}}else{const u=c(s,t,n);if(a){const{vScale:h}=o._cachedMeta,{_parsed:p}=e,g=p.slice(0,u.lo+1).reverse().findIndex(x=>!Dt(x[h.axis]));u.lo-=Math.max(0,g);const v=p.slice(u.hi).findIndex(x=>!Dt(x[h.axis]));u.hi+=Math.max(0,v)}return u}}return{lo:0,hi:s.length-1}}function ml(e,t,n,i,o){const s=e.getSortedVisibleDatasetMetas(),r=n[t];for(let l=0,a=s.length;l{a[r]&&a[r](t[n],o)&&(s.push({element:a,datasetIndex:c,index:u}),l=l||a.inRange(t.x,t.y,o))}),i&&!l?[]:s}var wE={modes:{index(e,t,n,i){const o=Ti(t,e),s=n.axis||"x",r=n.includeInvisible||!1,l=n.intersect?ea(e,o,s,i,r):na(e,o,s,!1,i,r),a=[];return l.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=l[0].index,h=c.data[u];h&&!h.skip&&a.push({element:h,datasetIndex:c.index,index:u})}),a):[]},dataset(e,t,n,i){const o=Ti(t,e),s=n.axis||"xy",r=n.includeInvisible||!1;let l=n.intersect?ea(e,o,s,i,r):na(e,o,s,!1,i,r);if(l.length>0){const a=l[0].datasetIndex,c=e.getDatasetMeta(a).data;l=[];for(let u=0;un.pos===t)}function qd(e,t){return e.filter(n=>Tm.indexOf(n.pos)===-1&&n.box.axis===t)}function Co(e,t){return e.sort((n,i)=>{const o=t?i:n,s=t?n:i;return o.weight===s.weight?o.index-s.index:o.weight-s.weight})}function TE(e){const t=[];let n,i,o,s,r,l;for(n=0,i=(e||[]).length;nc.box.fullSize),!0),i=Co(To(t,"left"),!0),o=Co(To(t,"right")),s=Co(To(t,"top"),!0),r=Co(To(t,"bottom")),l=qd(t,"x"),a=qd(t,"y");return{fullSize:n,leftAndTop:i.concat(s),rightAndBottom:o.concat(a).concat(r).concat(l),chartArea:To(t,"chartArea"),vertical:i.concat(o).concat(a),horizontal:s.concat(r).concat(l)}}function zd(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function Cm(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function IE(e,t,n,i){const{pos:o,box:s}=n,r=e.maxPadding;if(!Ft(o)){n.size&&(e[o]-=n.size);const h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?s.height:s.width),n.size=h.size/h.count,e[o]+=n.size}s.getPadding&&Cm(r,s.getPadding());const l=Math.max(0,t.outerWidth-zd(r,e,"left","right")),a=Math.max(0,t.outerHeight-zd(r,e,"top","bottom")),c=l!==e.w,u=a!==e.h;return e.w=l,e.h=a,n.horizontal?{same:c,other:u}:{same:u,other:c}}function RE(e){const t=e.maxPadding;function n(i){const o=Math.max(t[i]-e[i],0);return e[i]+=o,o}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function ME(e,t){const n=t.maxPadding;function i(o){const s={left:0,top:0,right:0,bottom:0};return o.forEach(r=>{s[r]=Math.max(t[r],n[r])}),s}return i(e?["left","right"]:["top","bottom"])}function Fo(e,t,n,i){const o=[];let s,r,l,a,c,u;for(s=0,r=e.length,c=0;s{typeof x.beforeLayout=="function"&&x.beforeLayout()});const u=a.reduce((x,E)=>E.box.options&&E.box.options.display===!1?x:x+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/u,hBoxMaxHeight:r/2}),p=Object.assign({},o);Cm(p,Ie(i));const g=Object.assign({maxPadding:p,w:s,h:r,x:o.left,y:o.top},o),v=SE(a.concat(c),h);Fo(l.fullSize,g,h,v),Fo(a,g,h,v),Fo(c,g,h,v)&&Fo(a,g,h,v),RE(g),Wd(l.leftAndTop,g,h,v),g.x+=g.w,g.y+=g.h,Wd(l.rightAndBottom,g,h,v),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},Wt(l.chartArea,x=>{const E=x.box;Object.assign(E,e.chartArea),E.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Sm{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,o){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,o?Math.floor(n/o):i)}}isAttached(t){return!0}updateConfig(t){}}class PE extends Sm{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const yr="$chartjs",kE={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Jd=e=>e===null||e==="";function DE(e,t){const n=e.style,i=e.getAttribute("height"),o=e.getAttribute("width");if(e[yr]={initial:{height:i,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Jd(o)){const s=Md(e,"width");s!==void 0&&(e.width=s)}if(Jd(i))if(e.style.height==="")e.height=e.width/(t||2);else{const s=Md(e,"height");s!==void 0&&(e.height=s)}return e}const Am=Nb?{passive:!0}:!1;function NE(e,t,n){e&&e.addEventListener(t,n,Am)}function LE(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Am)}function FE(e,t){const n=kE[e.type]||e.type,{x:i,y:o}=Ti(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:o!==void 0?o:null}}function $r(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function UE(e,t,n){const i=e.canvas,o=new MutationObserver(s=>{let r=!1;for(const l of s)r=r||$r(l.addedNodes,i),r=r&&!$r(l.removedNodes,i);r&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}function BE(e,t,n){const i=e.canvas,o=new MutationObserver(s=>{let r=!1;for(const l of s)r=r||$r(l.removedNodes,i),r=r&&!$r(l.addedNodes,i);r&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}const ds=new Map;let Kd=0;function Im(){const e=window.devicePixelRatio;e!==Kd&&(Kd=e,ds.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function OE(e,t){ds.size||window.addEventListener("resize",Im),ds.set(e,t)}function VE(e){ds.delete(e),ds.size||window.removeEventListener("resize",Im)}function GE(e,t,n){const i=e.canvas,o=i&&Xc(i);if(!o)return;const s=im((l,a)=>{const c=o.clientWidth;n(l,a),c{const a=l[0],c=a.contentRect.width,u=a.contentRect.height;c===0&&u===0||s(c,u)});return r.observe(o),OE(e,s),r}function ia(e,t,n){n&&n.disconnect(),t==="resize"&&VE(e)}function HE(e,t,n){const i=e.canvas,o=im(s=>{e.ctx!==null&&n(FE(s,e))},e);return NE(i,t,o),o}class $E extends Sm{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(DE(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[yr])return!1;const i=n[yr].initial;["height","width"].forEach(s=>{const r=i[s];Dt(r)?n.removeAttribute(s):n.setAttribute(s,r)});const o=i.style||{};return Object.keys(o).forEach(s=>{n.style[s]=o[s]}),n.width=n.width,delete n[yr],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const o=t.$proxies||(t.$proxies={}),r={attach:UE,detach:BE,resize:GE}[n]||HE;o[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),o=i[n];if(!o)return;({attach:ia,detach:ia,resize:ia}[n]||LE)(t,n,o),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,o){return Db(t,n,i,o)}isAttached(t){const n=t&&Xc(t);return!!(n&&n.isConnected)}}function qE(e){return!Yc()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?PE:$E}var lr;let Wn=(lr=class{constructor(){nt(this,"x");nt(this,"y");nt(this,"active",!1);nt(this,"options");nt(this,"$animations")}tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return ro(this.x)&&ro(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const o={};return t.forEach(s=>{o[s]=i[s]&&i[s].active()?i[s]._to:this[s]}),o}},nt(lr,"defaults",{}),nt(lr,"defaultRoutes"),lr);function zE(e,t){const n=e.options.ticks,i=WE(e),o=Math.min(n.maxTicksLimit||i,i),s=n.major.enabled?KE(t):[],r=s.length,l=s[0],a=s[r-1],c=[];if(r>o)return YE(t,c,s,r/o),c;const u=JE(s,t,o);if(r>0){let h,p;const g=r>1?Math.round((a-l)/(r-1)):null;for(Qs(t,c,u,Dt(g)?0:l-g,l),h=0,p=r-1;ho)return a}return Math.max(o,1)}function KE(e){const t=[];let n,i;for(n=0,i=e.length;ne==="left"?"right":e==="right"?"left":e,Yd=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Xd=(e,t)=>Math.min(t||e,e);function Qd(e,t){const n=[],i=e.length/t,o=e.length;let s=0;for(;sr+l)))return a}function jE(e,t){Wt(e,n=>{const i=n.gc,o=i.length/2;let s;if(o>t){for(s=0;si?i:n,i=o&&n>i?n:i,{min:ze(n,ze(i,n)),max:ze(i,ze(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ee(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:o,grace:s,ticks:r}=this.options,l=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=db(this,s,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=l=s||i<=1||!this.isHorizontal()){this.labelRotation=o;return}const u=this._getLabelSizes(),h=u.widest.width,p=u.highest.height,g=ye(this.chart.width-h,0,this.maxWidth);l=t.offset?this.maxWidth/i:g/(i-1),h+6>l&&(l=g/(i-(t.offset?.5:1)),a=this.maxHeight-So(t.grid)-n.padding-Zd(t.title,this.chart.options.font),c=Math.sqrt(h*h+p*p),r=Gc(Math.min(Math.asin(ye((u.highest.height+6)/l,-1,1)),Math.asin(ye(a/c,-1,1))-Math.asin(ye(p/c,-1,1)))),r=Math.max(o,Math.min(s,r))),this.labelRotation=r}afterCalculateLabelRotation(){ee(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ee(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:o,grid:s}}=this,r=this._isVisible(),l=this.isHorizontal();if(r){const a=Zd(o,n.options.font);if(l?(t.width=this.maxWidth,t.height=So(s)+a):(t.height=this.maxHeight,t.width=So(s)+a),i.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:p}=this._getLabelSizes(),g=i.padding*2,v=nn(this.labelRotation),x=Math.cos(v),E=Math.sin(v);if(l){const T=i.mirror?0:E*h.width+x*p.height;t.height=Math.min(this.maxHeight,t.height+T+g)}else{const T=i.mirror?0:x*h.width+E*p.height;t.width=Math.min(this.maxWidth,t.width+T+g)}this._calculatePadding(c,u,E,x)}}this._handleMargins(),l?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,o){const{ticks:{align:s,padding:r},position:l}=this.options,a=this.labelRotation!==0,c=l!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,g=0;a?c?(p=o*t.width,g=i*n.height):(p=i*t.height,g=o*n.width):s==="start"?g=n.width:s==="end"?p=t.width:s!=="inner"&&(p=t.width/2,g=n.width/2),this.paddingLeft=Math.max((p-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-h+r)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;s==="start"?(u=0,h=t.height):s==="end"&&(u=n.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ee(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n({width:r[V]||0,height:l[V]||0});return{first:U(0),last:U(n-1),widest:U(P),highest:U(B),widths:r,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return Vx(this._alignToPixels?xi(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&tl*o?l/i:a/o:a*o0}_computeGridLineItems(t){const n=this.axis,i=this.chart,o=this.options,{grid:s,position:r,border:l}=o,a=s.offset,c=this.isHorizontal(),h=this.ticks.length+(a?1:0),p=So(s),g=[],v=l.setContext(this.getContext()),x=v.display?v.width:0,E=x/2,T=function(ut){return xi(i,ut,x)};let A,I,M,D,P,B,U,V,W,et,at,Ct;if(r==="top")A=T(this.bottom),B=this.bottom-p,V=A-E,et=T(t.top)+E,Ct=t.bottom;else if(r==="bottom")A=T(this.top),et=t.top,Ct=T(t.bottom)-E,B=A+E,V=this.top+p;else if(r==="left")A=T(this.right),P=this.right-p,U=A-E,W=T(t.left)+E,at=t.right;else if(r==="right")A=T(this.left),W=t.left,at=T(t.right)-E,P=A+E,U=this.left+p;else if(n==="x"){if(r==="center")A=T((t.top+t.bottom)/2+.5);else if(Ft(r)){const ut=Object.keys(r)[0],ft=r[ut];A=T(this.chart.scales[ut].getPixelForValue(ft))}et=t.top,Ct=t.bottom,B=A+E,V=B+p}else if(n==="y"){if(r==="center")A=T((t.left+t.right)/2);else if(Ft(r)){const ut=Object.keys(r)[0],ft=r[ut];A=T(this.chart.scales[ut].getPixelForValue(ft))}P=A-E,U=P-p,W=t.left,at=t.right}const gt=Tt(o.ticks.maxTicksLimit,h),st=Math.max(1,Math.ceil(h/gt));for(I=0;I0&&(ae-=Rt/2);break}Kt={left:ae,top:Lt,width:Rt+ie.width,height:Ut+ie.height,color:st.backdropColor}}E.push({label:M,font:V,textOffset:at,options:{rotation:x,color:ft,strokeColor:rt,strokeWidth:xt,textAlign:Nt,textBaseline:Ct,translation:[D,P],backdrop:Kt}})}return E}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-nn(this.labelRotation))return t==="top"?"left":"right";let o="center";return n.align==="start"?o="left":n.align==="end"?o="right":n.align==="inner"&&(o="inner"),o}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:o,padding:s}}=this.options,r=this._getLabelSizes(),l=t+s,a=r.widest.width;let c,u;return n==="left"?o?(u=this.right+s,i==="near"?c="left":i==="center"?(c="center",u+=a/2):(c="right",u+=a)):(u=this.right-l,i==="near"?c="right":i==="center"?(c="center",u-=a/2):(c="left",u=this.left)):n==="right"?o?(u=this.left+s,i==="near"?c="right":i==="center"?(c="center",u-=a/2):(c="left",u-=a)):(u=this.left+l,i==="near"?c="left":i==="center"?(c="center",u+=a/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:o,width:s,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,o,s,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const o=this.ticks.findIndex(s=>s.value===t);return o>=0?n.setContext(this.getContext(o)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let s,r;const l=(a,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(s=0,r=o.length;s{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",o=[];let s,r;for(s=0,r=n.length;s{const i=n.split("."),o=i.pop(),s=[e].concat(i).join("."),r=t[n].split("."),l=r.pop(),a=r.join(".");se.route(s,o,a,l)})}function rw(e){return"id"in e&&"defaults"in e}class lw{constructor(){this.controllers=new Zs(sn,"datasets",!0),this.elements=new Zs(Wn,"elements"),this.plugins=new Zs(Object,"plugins"),this.scales=new Zs(vs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(o=>{const s=i||this._getRegistryForType(o);i||s.isForType(o)||s===this.plugins&&o.id?this._exec(t,s,o):Wt(o,r=>{const l=i||this._getRegistryForType(r);this._exec(t,l,r)})})}_exec(t,n,i){const o=Vc(t);ee(i["before"+o],[],i),n[t](i),ee(i["after"+o],[],i)}_getRegistryForType(t){for(let n=0;ns.filter(l=>!r.some(a=>l.plugin.id===a.plugin.id));this._notify(o(n,i),t,"stop"),this._notify(o(i,n),t,"start")}}function cw(e){const t={},n=[],i=Object.keys(pn.plugins.items);for(let s=0;s1&&jd(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function tf(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function mw(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return tf(e,"x",n[0])||tf(e,"y",n[0])}return{}}function yw(e,t){const n=Fi[e.type]||{scales:{}},i=t.scales||{},o=Ba(e.type,t),s=Object.create(null);return Object.keys(i).forEach(r=>{const l=i[r];if(!Ft(l))return console.error(`Invalid scale configuration for scale: ${r}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const a=Oa(r,l,mw(r,e),se.scales[l.type]),c=pw(a,o),u=n.scales||{};s[r]=Yo(Object.create(null),[{axis:a},l,u[a],u[c]])}),e.data.datasets.forEach(r=>{const l=r.type||e.type,a=r.indexAxis||Ba(l,t),u=(Fi[l]||{}).scales||{};Object.keys(u).forEach(h=>{const p=hw(h,a),g=r[p+"AxisID"]||p;s[g]=s[g]||Object.create(null),Yo(s[g],[{axis:p},i[g],u[h]])})}),Object.keys(s).forEach(r=>{const l=s[r];Yo(l,[se.scales[l.type],se.scale])}),s}function Mm(e){const t=e.options||(e.options={});t.plugins=Tt(t.plugins,{}),t.scales=yw(e,t)}function Pm(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function _w(e){return e=e||{},e.data=Pm(e.data),Mm(e),e}const ef=new Map,km=new Set;function js(e,t){let n=ef.get(e);return n||(n=t(),ef.set(e,n),km.add(n)),n}const Ao=(e,t,n)=>{const i=ui(t,n);i!==void 0&&e.add(i)};class vw{constructor(t){this._config=_w(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Pm(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Mm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return js(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return js(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return js(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return js(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let o=i.get(t);return(!o||n)&&(o=new Map,i.set(t,o)),o}getOptionScopes(t,n,i){const{options:o,type:s}=this,r=this._cachedScopes(t,i),l=r.get(n);if(l)return l;const a=new Set;n.forEach(u=>{t&&(a.add(t),u.forEach(h=>Ao(a,t,h))),u.forEach(h=>Ao(a,o,h)),u.forEach(h=>Ao(a,Fi[s]||{},h)),u.forEach(h=>Ao(a,se,h)),u.forEach(h=>Ao(a,La,h))});const c=Array.from(a);return c.length===0&&c.push(Object.create(null)),km.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Fi[n]||{},se.datasets[n]||{},{type:n},se,La]}resolveNamedOptions(t,n,i,o=[""]){const s={$shared:!0},{resolver:r,subPrefixes:l}=nf(this._resolverCache,t,o);let a=r;if(bw(r,n)){s.$shared=!1,i=di(i)?i():i;const c=this.createResolver(t,i,l);a=lo(r,i,c)}for(const c of n)s[c]=a[c];return s}createResolver(t,n,i=[""],o){const{resolver:s}=nf(this._resolverCache,t,i);return Ft(n)?lo(s,n,void 0,o):s}}function nf(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const o=n.join();let s=i.get(o);return s||(s={resolver:Wc(t,n),subPrefixes:n.filter(l=>!l.toLowerCase().includes("hover"))},i.set(o,s)),s}const xw=e=>Ft(e)&&Object.getOwnPropertyNames(e).some(t=>di(e[t]));function bw(e,t){const{isScriptable:n,isIndexable:i}=cm(e);for(const o of t){const s=n(o),r=i(o),l=(r||s)&&e[o];if(s&&(di(l)||xw(l))||r&&oe(l))return!0}return!1}var Ew="4.5.1";const ww=["top","bottom","left","right","chartArea"];function of(e,t){return e==="top"||e==="bottom"||ww.indexOf(e)===-1&&t==="x"}function sf(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function rf(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ee(n&&n.onComplete,[e],t)}function Tw(e){const t=e.chart,n=t.options.animation;ee(n&&n.onProgress,[e],t)}function Dm(e){return Yc()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const _r={},lf=e=>{const t=Dm(e);return Object.values(_r).filter(n=>n.canvas===t).pop()};function Cw(e,t,n){const i=Object.keys(e);for(const o of i){const s=+o;if(s>=t){const r=e[o];delete e[o],(n>0||s>t)&&(e[s+n]=r)}}}function Sw(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class vn{static register(...t){pn.add(...t),af()}static unregister(...t){pn.remove(...t),af()}constructor(t,n){const i=this.config=new vw(n),o=Dm(t),s=lf(o);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||qE(o)),this.platform.updateConfig(i);const l=this.platform.acquireContext(o,r.aspectRatio),a=l&&l.canvas,c=a&&a.height,u=a&&a.width;if(this.id=Ax(),this.ctx=l,this.canvas=a,this.width=u,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new aw,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=qx(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],_r[this.id]=this,!l||!a){console.error("Failed to create chart: can't acquire context from the given item");return}Rn.listen(this,"complete",rf),Rn.listen(this,"progress",Tw),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:o,_aspectRatio:s}=this;return Dt(t)?n&&s?s:o?i/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return pn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Rd(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Sd(this.canvas,this.ctx),this}stop(){return Rn.stop(this),this}resize(t,n){Rn.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,o=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(o,t,n,s),l=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Rd(this,l,!0)&&(this.notifyPlugins("resize",{size:r}),ee(i.onResize,[this,r],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Wt(n,(i,o)=>{i.id=o})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,o=Object.keys(i).reduce((r,l)=>(r[l]=!1,r),{});let s=[];n&&(s=s.concat(Object.keys(n).map(r=>{const l=n[r],a=Oa(r,l),c=a==="r",u=a==="x";return{options:l,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),Wt(s,r=>{const l=r.options,a=l.id,c=Oa(a,l),u=Tt(l.type,r.dtype);(l.position===void 0||of(l.position,c)!==of(r.dposition))&&(l.position=r.dposition),o[a]=!0;let h=null;if(a in i&&i[a].type===u)h=i[a];else{const p=pn.getScale(u);h=new p({id:a,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(l,t)}),Wt(o,(r,l)=>{r||delete i[l]}),Wt(i,r=>{Se.configure(this,r,r.options),Se.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((o,s)=>o.index-s.index),i>n){for(let o=n;on.length&&delete this._stacks,t.forEach((i,o)=>{n.filter(s=>s===i._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,o;for(this._removeUnreferencedMetasets(),i=0,o=n.length;i{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(sf("z","_idx"));const{_active:l,_lastEvent:a}=this;a?this._eventHandler(a,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){Wt(this.scales,t=>{Se.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!yd(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:o,count:s}of n){const r=i==="_removeElements"?-s:s;Cw(t,o,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=s=>new Set(t.filter(r=>r[0]===s).map((r,l)=>l+","+r.splice(1).join(","))),o=i(0);for(let s=1;ss.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Se.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],Wt(this.boxes,o=>{i&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,s)=>{o._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},o=xm(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(o&&hl(n,o),t.controller.draw(),o&&pl(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return On(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,o){const s=wE.modes[n];return typeof s=="function"?s(this,t,i,o):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let o=i.filter(s=>s&&s._dataset===n).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(o)),o}getContext(){return this.$context||(this.$context=hi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const o=i?"show":"hide",s=this.getDatasetMeta(t),r=s.controller._resolveAnimations(void 0,o);as(n)?(s.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(s,{visible:i}),this.update(l=>l.datasetIndex===t?o:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Rn.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,s,r),t[s]=r},o=(s,r,l)=>{s.offsetX=r,s.offsetY=l,this._eventHandler(s)};Wt(this.options.events,s=>i(s,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(a,c)=>{n.addEventListener(this,a,c),t[a]=c},o=(a,c)=>{t[a]&&(n.removeEventListener(this,a,c),delete t[a])},s=(a,c)=>{this.canvas&&this.resize(a,c)};let r;const l=()=>{o("attach",l),this.attached=!0,this.resize(),i("resize",s),i("detach",r)};r=()=>{this.attached=!1,o("resize",s),this._stop(),this._resize(0,0),i("attach",l)},n.isAttached(this.canvas)?l():r()}unbindEvents(){Wt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},Wt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const o=i?"set":"remove";let s,r,l,a;for(n==="dataset"&&(s=this.getDatasetMeta(t[0].datasetIndex),s.controller["_"+o+"DatasetHoverStyle"]()),l=0,a=t.length;l{const l=this.getDatasetMeta(s);if(!l)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:l.data[r],index:r}});!Br(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const o=this.options.hover,s=(a,c)=>a.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=s(n,t),l=i?t:s(t,n);r.length&&this.updateHoverStyle(r,o.mode,!1),l.length&&o.mode&&this.updateHoverStyle(l,o.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},o=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,o)===!1)return;const s=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,o),(s||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:o=[],options:s}=this,r=n,l=this._getActiveElements(t,o,i,r),a=Dx(t),c=Sw(t,this._lastEvent,i,a);i&&(this._lastEvent=null,ee(s.onHover,[t,l,this],this),a&&ee(s.onClick,[t,l,this],this));const u=!Br(l,o);return(u||n)&&(this._active=l,this._updateHoverStyles(l,o,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,o){if(t.type==="mouseout")return[];if(!i)return n;const s=this.options.hover;return this.getElementsAtEventForMode(t,s.mode,s,o)}}nt(vn,"defaults",se),nt(vn,"instances",_r),nt(vn,"overrides",Fi),nt(vn,"registry",pn),nt(vn,"version",Ew),nt(vn,"getChart",lf);function af(){return Wt(vn.instances,e=>e._plugins.invalidate())}function Aw(e,t,n){const{startAngle:i,x:o,y:s,outerRadius:r,innerRadius:l,options:a}=t,{borderWidth:c,borderJoinStyle:u}=a,h=Math.min(c/r,Ee(i-n));if(e.beginPath(),e.arc(o,s,r-c/2,i+h/2,n-h/2),l>0){const p=Math.min(c/l,Ee(i-n));e.arc(o,s,l+c/2,n-p/2,i+p/2,!0)}else{const p=Math.min(c/2,r*Ee(i-n));if(u==="round")e.arc(o,s,p,n-Ot/2,i+Ot/2,!0);else if(u==="bevel"){const g=2*p*p,v=-g*Math.cos(n+Ot/2)+o,x=-g*Math.sin(n+Ot/2)+s,E=g*Math.cos(i+Ot/2)+o,T=g*Math.sin(i+Ot/2)+s;e.lineTo(v,x),e.lineTo(E,T)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function Iw(e,t,n){const{startAngle:i,pixelMargin:o,x:s,y:r,outerRadius:l,innerRadius:a}=t;let c=o/l;e.beginPath(),e.arc(s,r,l,i-c,n+c),a>o?(c=o/a,e.arc(s,r,a,n+c,i-c,!0)):e.arc(s,r,o,n+de,i-de),e.closePath(),e.clip()}function Rw(e){return zc(e,["outerStart","outerEnd","innerStart","innerEnd"])}function Mw(e,t,n,i){const o=Rw(e.options.borderRadius),s=(n-t)/2,r=Math.min(s,i*t/2),l=a=>{const c=(n-Math.min(s,a))*i/2;return ye(a,0,Math.min(s,c))};return{outerStart:l(o.outerStart),outerEnd:l(o.outerEnd),innerStart:ye(o.innerStart,0,r),innerEnd:ye(o.innerEnd,0,r)}}function $i(e,t,n,i){return{x:n+e*Math.cos(t),y:i+e*Math.sin(t)}}function qr(e,t,n,i,o,s){const{x:r,y:l,startAngle:a,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+i+n-c,0),p=u>0?u+i+n+c:0;let g=0;const v=o-a;if(i){const st=u>0?u-i:0,ut=h>0?h-i:0,ft=(st+ut)/2,rt=ft!==0?v*ft/(ft+i):v;g=(v-rt)/2}const x=Math.max(.001,v*h-n/Ot)/h,E=(v-x)/2,T=a+E+g,A=o-E-g,{outerStart:I,outerEnd:M,innerStart:D,innerEnd:P}=Mw(t,p,h,A-T),B=h-I,U=h-M,V=T+I/B,W=A-M/U,et=p+D,at=p+P,Ct=T+D/et,gt=A-P/at;if(e.beginPath(),s){const st=(V+W)/2;if(e.arc(r,l,h,V,st),e.arc(r,l,h,st,W),M>0){const xt=$i(U,W,r,l);e.arc(xt.x,xt.y,M,W,A+de)}const ut=$i(at,A,r,l);if(e.lineTo(ut.x,ut.y),P>0){const xt=$i(at,gt,r,l);e.arc(xt.x,xt.y,P,A+de,gt+Math.PI)}const ft=(A-P/p+(T+D/p))/2;if(e.arc(r,l,p,A-P/p,ft,!0),e.arc(r,l,p,ft,T+D/p,!0),D>0){const xt=$i(et,Ct,r,l);e.arc(xt.x,xt.y,D,Ct+Math.PI,T-de)}const rt=$i(B,T,r,l);if(e.lineTo(rt.x,rt.y),I>0){const xt=$i(B,V,r,l);e.arc(xt.x,xt.y,I,T-de,V)}}else{e.moveTo(r,l);const st=Math.cos(V)*h+r,ut=Math.sin(V)*h+l;e.lineTo(st,ut);const ft=Math.cos(W)*h+r,rt=Math.sin(W)*h+l;e.lineTo(ft,rt)}e.closePath()}function Pw(e,t,n,i,o){const{fullCircles:s,startAngle:r,circumference:l}=t;let a=t.endAngle;if(s){qr(e,t,n,i,a,o);for(let c=0;c=Ot&&g===0&&u!=="miter"&&Aw(e,t,x),s||(qr(e,t,n,i,x,o),e.stroke())}class Uo extends Wn{constructor(n){super();nt(this,"circumference");nt(this,"endAngle");nt(this,"fullCircles");nt(this,"innerRadius");nt(this,"outerRadius");nt(this,"pixelMargin");nt(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,i,o){const s=this.getProps(["x","y"],o),{angle:r,distance:l}=jg(s,{x:n,y:i}),{startAngle:a,endAngle:c,innerRadius:u,outerRadius:h,circumference:p}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],o),g=(this.options.spacing+this.options.borderWidth)/2,v=Tt(p,c-a),x=cs(r,a,c)&&a!==c,E=v>=ne||x,T=Un(l,u+g,h+g);return E&&T}getCenterPoint(n){const{x:i,y:o,startAngle:s,endAngle:r,innerRadius:l,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,h=(s+r)/2,p=(l+a+u+c)/2;return{x:i+Math.cos(h)*p,y:o+Math.sin(h)*p}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:i,circumference:o}=this,s=(i.offset||0)/4,r=(i.spacing||0)/2,l=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=o>ne?Math.floor(o/ne):0,o===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const a=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(a)*s,Math.sin(a)*s);const c=1-Math.sin(Math.min(Ot,o||0)),u=s*c;n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,Pw(n,this,u,r,l),kw(n,this,u,r,l),n.restore()}}nt(Uo,"id","arc"),nt(Uo,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),nt(Uo,"defaultRoutes",{backgroundColor:"backgroundColor"}),nt(Uo,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Nm(e,t,n=t){e.lineCap=Tt(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Tt(n.borderDash,t.borderDash)),e.lineDashOffset=Tt(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Tt(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Tt(n.borderWidth,t.borderWidth),e.strokeStyle=Tt(n.borderColor,t.borderColor)}function Dw(e,t,n){e.lineTo(n.x,n.y)}function Nw(e){return e.stepped?nb:e.tension||e.cubicInterpolationMode==="monotone"?ib:Dw}function Lm(e,t,n={}){const i=e.length,{start:o=0,end:s=i-1}=n,{start:r,end:l}=t,a=Math.max(o,r),c=Math.min(s,l),u=ol&&s>l;return{count:i,start:a,loop:t.loop,ilen:c(r+(c?l-M:M))%s,I=()=>{x!==E&&(e.lineTo(u,E),e.lineTo(u,x),e.lineTo(u,T))};for(a&&(g=o[A(0)],e.moveTo(g.x,g.y)),p=0;p<=l;++p){if(g=o[A(p)],g.skip)continue;const M=g.x,D=g.y,P=M|0;P===v?(DE&&(E=D),u=(h*u+M)/++h):(I(),e.lineTo(M,D),v=P,h=0,x=E=D),T=D}I()}function Va(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Fw:Lw}function Uw(e){return e.stepped?Lb:e.tension||e.cubicInterpolationMode==="monotone"?Fb:Ci}function Bw(e,t,n,i){let o=t._path;o||(o=t._path=new Path2D,t.path(o,n,i)&&o.closePath()),Nm(e,t.options),e.stroke(o)}function Ow(e,t,n,i){const{segments:o,options:s}=t,r=Va(t);for(const l of o)Nm(e,s,l.style),e.beginPath(),r(e,t,l,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Vw=typeof Path2D=="function";function Gw(e,t,n,i){Vw&&!t.options.segment?Bw(e,t,n,i):Ow(e,t,n,i)}class ni extends Wn{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const o=i.spanGaps?this._loop:this._fullLoop;Ab(this._points,i,t,o,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Hb(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,o=t[n],s=this.points,r=vm(this,{property:n,start:o,end:o});if(!r.length)return;const l=[],a=Uw(i);let c,u;for(c=0,u=r.length;ct!=="borderDash"&&t!=="fill"});function cf(e,t,n,i){const o=e.options,{[n]:s}=e.getProps([n],i);return Math.abs(t-s)e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Um(e){return Ga[e%Ga.length]}function Bm(e){return uf[e%uf.length]}function Kw(e,t){return e.borderColor=Um(t),e.backgroundColor=Bm(t),++t}function Yw(e,t){return e.backgroundColor=e.data.map(()=>Um(t++)),t}function Xw(e,t){return e.backgroundColor=e.data.map(()=>Bm(t++)),t}function Qw(e){let t=0;return(n,i)=>{const o=e.getDatasetMeta(i).controller;o instanceof Ii?t=Yw(n,t):o instanceof jo?t=Xw(n,t):o&&(t=Kw(n,t))}}function df(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function Zw(e){return e&&(e.borderColor||e.backgroundColor)}function jw(){return se.borderColor!=="rgba(0,0,0,0.1)"||se.backgroundColor!=="rgba(0,0,0,0.1)"}var tT={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:i},options:o}=e.config,{elements:s}=o,r=df(i)||Zw(o)||s&&df(s)||jw();if(!n.forceOverride&&r)return;const l=Qw(e);i.forEach(l)}};function eT(e,t,n,i,o){const s=o.samples||i;if(s>=n)return e.slice(t,t+n);const r=[],l=(n-2)/(s-2);let a=0;const c=t+n-1;let u=t,h,p,g,v,x;for(r[a++]=e[u],h=0;hg&&(g=v,p=e[A],x=A);r[a++]=p,u=x}return r[a++]=e[c],r}function nT(e,t,n,i){let o=0,s=0,r,l,a,c,u,h,p,g,v,x;const E=[],T=t+n-1,A=e[t].x,M=e[T].x-A;for(r=t;rx&&(x=c,p=r),o=(s*o+l.x)/++s;else{const P=r-1;if(!Dt(h)&&!Dt(p)){const B=Math.min(h,p),U=Math.max(h,p);B!==g&&B!==P&&E.push({...e[B],x:o}),U!==g&&U!==P&&E.push({...e[U],x:o})}r>0&&P!==g&&E.push(e[P]),E.push(l),u=D,s=0,v=x=c,h=p=g=r}}return E}function Om(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ff(e){e.data.datasets.forEach(t=>{Om(t)})}function iT(e,t){const n=t.length;let i=0,o;const{iScale:s}=e,{min:r,max:l,minDefined:a,maxDefined:c}=s.getUserBounds();return a&&(i=ye(Bn(t,s.axis,r).lo,0,n-1)),c?o=ye(Bn(t,s.axis,l).hi+1,i,n)-i:o=n-i,{start:i,count:o}}var oT={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){ff(e);return}const i=e.width;e.data.datasets.forEach((o,s)=>{const{_data:r,indexAxis:l}=o,a=e.getDatasetMeta(s),c=r||o.data;if(Lo([l,e.options.indexAxis])==="y"||!a.controller.supportsDecimation)return;const u=e.scales[a.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:h,count:p}=iT(a,c);const g=n.threshold||4*i;if(p<=g){Om(o);return}Dt(r)&&(o._data=c,delete o.data,Object.defineProperty(o,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(x){this._data=x}}));let v;switch(n.algorithm){case"lttb":v=eT(c,h,p,i,n);break;case"min-max":v=nT(c,h,p,i);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}o._decimated=v})},destroy(e){ff(e)}};function sT(e,t,n){const i=e.segments,o=e.points,s=t.points,r=[];for(const l of i){let{start:a,end:c}=l;c=yl(a,c,o);const u=Ha(n,o[a],o[c],l.loop);if(!t.segments){r.push({source:l,target:u,start:o[a],end:o[c]});continue}const h=vm(t,u);for(const p of h){const g=Ha(n,s[p.start],s[p.end],p.loop),v=_m(l,o,g);for(const x of v)r.push({source:x,target:p,start:{[n]:hf(u,g,"start",Math.max)},end:{[n]:hf(u,g,"end",Math.min)}})}}return r}function Ha(e,t,n,i){if(i)return;let o=t[e],s=n[e];return e==="angle"&&(o=Ee(o),s=Ee(s)),{property:e,start:o,end:s}}function rT(e,t){const{x:n=null,y:i=null}=e||{},o=t.points,s=[];return t.segments.forEach(({start:r,end:l})=>{l=yl(r,l,o);const a=o[r],c=o[l];i!==null?(s.push({x:a.x,y:i}),s.push({x:c.x,y:i})):n!==null&&(s.push({x:n,y:a.y}),s.push({x:n,y:c.y}))}),s}function yl(e,t,n){for(;t>e;t--){const i=n[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function hf(e,t,n,i){return e&&t?i(e[n],t[n]):e?e[n]:t?t[n]:0}function Vm(e,t){let n=[],i=!1;return oe(e)?(i=!0,n=e):n=rT(e,t),n.length?new ni({points:n,options:{tension:0},_loop:i,_fullLoop:i}):null}function pf(e){return e&&e.fill!==!1}function lT(e,t,n){let o=e[t].fill;const s=[t];let r;if(!n)return o;for(;o!==!1&&s.indexOf(o)===-1;){if(!ce(o))return o;if(r=e[o],!r)return!1;if(r.visible)return o;s.push(o),o=r.fill}return!1}function aT(e,t,n){const i=fT(e);if(Ft(i))return isNaN(i.value)?!1:i;let o=parseFloat(i);return ce(o)&&Math.floor(o)===o?cT(i[0],t,o,n):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function cT(e,t,n,i){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=i?!1:n}function uT(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:Ft(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function dT(e,t,n){let i;return e==="start"?i=n:e==="end"?i=t.options.reverse?t.min:t.max:Ft(e)?i=e.value:i=t.getBaseValue(),i}function fT(e){const t=e.options,n=t.fill;let i=Tt(n&&n.target,n);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function hT(e){const{scale:t,index:n,line:i}=e,o=[],s=i.segments,r=i.points,l=pT(t,n);l.push(Vm({x:null,y:t.bottom},i));for(let a=0;a=0;--r){const l=o[r].$filler;l&&(l.line.updateControlPoints(s,l.axis),i&&l.fill&&ra(e.ctx,l,s))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const i=e.getSortedVisibleDatasetMetas();for(let o=i.length-1;o>=0;--o){const s=i[o].$filler;pf(s)&&ra(e.ctx,s,e.chartArea)}},beforeDatasetDraw(e,t,n){const i=t.meta.$filler;!pf(i)||n.drawTime!=="beforeDatasetDraw"||ra(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const _f=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},CT=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class vf extends Wn{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=ee(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,o)=>t.sort(i,o,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,o=ge(i.font),s=o.size,r=this._computeTitleHeight(),{boxWidth:l,itemHeight:a}=_f(i,s);let c,u;n.font=o.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,s,l,a)+10):(u=this.maxHeight,c=this._fitCols(r,o,l,a)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,o){const{ctx:s,maxWidth:r,options:{labels:{padding:l}}}=this,a=this.legendHitBoxes=[],c=this.lineWidths=[0],u=o+l;let h=t;s.textAlign="left",s.textBaseline="middle";let p=-1,g=-u;return this.legendItems.forEach((v,x)=>{const E=i+n/2+s.measureText(v.text).width;(x===0||c[c.length-1]+E+2*l>r)&&(h+=u,c[c.length-(x>0?0:1)]=0,g+=u,p++),a[x]={left:0,top:g,row:p,width:E,height:o},c[c.length-1]+=E+l}),h}_fitCols(t,n,i,o){const{ctx:s,maxHeight:r,options:{labels:{padding:l}}}=this,a=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let h=l,p=0,g=0,v=0,x=0;return this.legendItems.forEach((E,T)=>{const{itemWidth:A,itemHeight:I}=ST(i,n,s,E,o);T>0&&g+I+2*l>u&&(h+=p+l,c.push({width:p,height:g}),v+=p+l,x++,p=g=0),a[T]={left:v,top:g,col:x,width:A,height:I},p=Math.max(p,A),g+=I+l}),h+=p,c.push({width:p,height:g}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:o},rtl:s}}=this,r=ji(s,this.left,this.width);if(this.isHorizontal()){let l=0,a=be(i,this.left+o,this.right-this.lineWidths[l]);for(const c of n)l!==c.row&&(l=c.row,a=be(i,this.left+o,this.right-this.lineWidths[l])),c.top+=this.top+t+o,c.left=r.leftForLtr(r.x(a),c.width),a+=c.width+o}else{let l=0,a=be(i,this.top+t+o,this.bottom-this.columnSizes[l].height);for(const c of n)c.col!==l&&(l=c.col,a=be(i,this.top+t+o,this.bottom-this.columnSizes[l].height)),c.top=a,c.left+=this.left+o,c.left=r.leftForLtr(r.x(c.left),c.width),a+=c.height+o}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;hl(t,this),this._draw(),pl(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:o}=this,{align:s,labels:r}=t,l=se.color,a=ji(t.rtl,this.left,this.width),c=ge(r.font),{padding:u}=r,h=c.size,p=h/2;let g;this.drawTitle(),o.textAlign=a.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=c.string;const{boxWidth:v,boxHeight:x,itemHeight:E}=_f(r,h),T=function(P,B,U){if(isNaN(v)||v<=0||isNaN(x)||x<0)return;o.save();const V=Tt(U.lineWidth,1);if(o.fillStyle=Tt(U.fillStyle,l),o.lineCap=Tt(U.lineCap,"butt"),o.lineDashOffset=Tt(U.lineDashOffset,0),o.lineJoin=Tt(U.lineJoin,"miter"),o.lineWidth=V,o.strokeStyle=Tt(U.strokeStyle,l),o.setLineDash(Tt(U.lineDash,[])),r.usePointStyle){const W={radius:x*Math.SQRT2/2,pointStyle:U.pointStyle,rotation:U.rotation,borderWidth:V},et=a.xPlus(P,v/2),at=B+p;lm(o,W,et,at,r.pointStyleWidth&&v)}else{const W=B+Math.max((h-x)/2,0),et=a.leftForLtr(P,v),at=Di(U.borderRadius);o.beginPath(),Object.values(at).some(Ct=>Ct!==0)?us(o,{x:et,y:W,w:v,h:x,radius:at}):o.rect(et,W,v,x),o.fill(),V!==0&&o.stroke()}o.restore()},A=function(P,B,U){Ui(o,U.text,P,B+E/2,c,{strikethrough:U.hidden,textAlign:a.textAlign(U.textAlign)})},I=this.isHorizontal(),M=this._computeTitleHeight();I?g={x:be(s,this.left+u,this.right-i[0]),y:this.top+u+M,line:0}:g={x:this.left+u,y:be(s,this.top+M+u,this.bottom-n[0].height),line:0},gm(this.ctx,t.textDirection);const D=E+u;this.legendItems.forEach((P,B)=>{o.strokeStyle=P.fontColor,o.fillStyle=P.fontColor;const U=o.measureText(P.text).width,V=a.textAlign(P.textAlign||(P.textAlign=r.textAlign)),W=v+p+U;let et=g.x,at=g.y;a.setWidth(this.width),I?B>0&&et+W+u>this.right&&(at=g.y+=D,g.line++,et=g.x=be(s,this.left+u,this.right-i[g.line])):B>0&&at+D>this.bottom&&(et=g.x=et+n[g.line].width+u,g.line++,at=g.y=be(s,this.top+M+u,this.bottom-n[g.line].height));const Ct=a.x(et);if(T(Ct,at,P),et=zx(V,et+v+p,I?et+W:this.right,t.rtl),A(a.x(et),at,P),I)g.x+=W+u;else if(typeof P.text!="string"){const gt=c.lineHeight;g.y+=Hm(P,gt)+u}else g.y+=D}),mm(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ge(n.font),o=Ie(n.padding);if(!n.display)return;const s=ji(t.rtl,this.left,this.width),r=this.ctx,l=n.position,a=i.size/2,c=o.top+a;let u,h=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),u=this.top+c,h=be(t.align,h,this.right-p);else{const v=this.columnSizes.reduce((x,E)=>Math.max(x,E.height),0);u=c+be(t.align,this.top,this.bottom-v-t.labels.padding-this._computeTitleHeight())}const g=be(l,h,h+p);r.textAlign=s.textAlign($c(l)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Ui(r,n.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,n=ge(t.font),i=Ie(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,o,s;if(Un(t,this.left,this.right)&&Un(n,this.top,this.bottom)){for(s=this.legendHitBoxes,i=0;is.length>r.length?s:r)),t+n.size/2+i.measureText(o).width}function IT(e,t,n){let i=e;return typeof t.text!="string"&&(i=Hm(t,n)),i}function Hm(e,t){const n=e.text?e.text.length:0;return t*n}function RT(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var MT={id:"legend",_element:vf,start(e,t,n){const i=e.legend=new vf({ctx:e.ctx,options:n,chart:e});Se.configure(e,i,n),Se.addBox(e,i)},stop(e){Se.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;Se.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,o=n.chart;o.isDatasetVisible(i)?(o.hide(i),t.hidden=!0):(o.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:o,color:s,useBorderRadius:r,borderRadius:l}}=e.legend.options;return e._getSortedDatasetMetas().map(a=>{const c=a.controller.getStyle(n?0:void 0),u=Ie(c.borderWidth);return{text:t[a.index].label,fillStyle:c.backgroundColor,fontColor:s,hidden:!a.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:o||c.textAlign,borderRadius:r&&(l||c.borderRadius),datasetIndex:a.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Zc extends Wn{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const o=oe(i.text)?i.text.length:1;this._padding=Ie(i.padding);const s=o*ge(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:i,bottom:o,right:s,options:r}=this,l=r.align;let a=0,c,u,h;return this.isHorizontal()?(u=be(l,i,s),h=n+t,c=s-i):(r.position==="left"?(u=i+t,h=be(l,o,n),a=Ot*-.5):(u=s-t,h=be(l,n,o),a=Ot*.5),c=o-n),{titleX:u,titleY:h,maxWidth:c,rotation:a}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const i=ge(n.font),s=i.lineHeight/2+this._padding.top,{titleX:r,titleY:l,maxWidth:a,rotation:c}=this._drawArgs(s);Ui(t,n.text,0,0,i,{color:n.color,maxWidth:a,rotation:c,textAlign:$c(n.align),textBaseline:"middle",translation:[r,l]})}}function PT(e,t){const n=new Zc({ctx:e.ctx,options:t,chart:e});Se.configure(e,n,t),Se.addBox(e,n),e.titleBlock=n}var kT={id:"title",_element:Zc,start(e,t,n){PT(e,n)},stop(e){const t=e.titleBlock;Se.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const i=e.titleBlock;Se.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const tr=new WeakMap;var DT={id:"subtitle",start(e,t,n){const i=new Zc({ctx:e.ctx,options:n,chart:e});Se.configure(e,i,n),Se.addBox(e,i),tr.set(e,i)},stop(e){Se.removeBox(e,tr.get(e)),tr.delete(e)},beforeUpdate(e,t,n){const i=tr.get(e);Se.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Bo={average(e){if(!e.length)return!1;let t,n,i=new Set,o=0,s=0;for(t=0,n=e.length;tl+a)/i.size,y:o/s}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,o=Number.POSITIVE_INFINITY,s,r,l;for(s=0,r=e.length;s-1?e.split(` `):e}function NT(e,t){const{element:n,datasetIndex:i,index:o}=t,s=e.getDatasetMeta(i).controller,{label:r,value:l}=s.getLabelAndValue(o);return{chart:e,label:r,parsed:s.getParsed(o),raw:e.data.datasets[i].data[o],formattedValue:l,dataset:s.getDataset(),dataIndex:o,datasetIndex:i,element:n}}function xf(e,t){const n=e.chart.ctx,{body:i,footer:o,title:s}=e,{boxWidth:r,boxHeight:l}=t,a=ge(t.bodyFont),c=ge(t.titleFont),u=ge(t.footerFont),h=s.length,p=o.length,g=i.length,v=Ie(t.padding);let x=v.height,E=0,T=i.reduce((M,D)=>M+D.before.length+D.lines.length+D.after.length,0);if(T+=e.beforeBody.length+e.afterBody.length,h&&(x+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),T){const M=t.displayColors?Math.max(l,a.lineHeight):a.lineHeight;x+=g*M+(T-g)*a.lineHeight+(T-1)*t.bodySpacing}p&&(x+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let A=0;const I=function(M){E=Math.max(E,n.measureText(M).width+A)};return n.save(),n.font=c.string,Wt(e.title,I),n.font=a.string,Wt(e.beforeBody.concat(e.afterBody),I),A=t.displayColors?r+2+t.boxPadding:0,Wt(i,M=>{Wt(M.before,I),Wt(M.lines,I),Wt(M.after,I)}),A=0,n.font=u.string,Wt(e.footer,I),n.restore(),E+=v.width,{width:E,height:x}}function LT(e,t){const{y:n,height:i}=t;return ne.height-i/2?"bottom":"center"}function FT(e,t,n,i){const{x:o,width:s}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&o+s+r>t.width||e==="right"&&o-s-r<0)return!0}function UT(e,t,n,i){const{x:o,width:s}=n,{width:r,chartArea:{left:l,right:a}}=e;let c="center";return i==="center"?c=o<=(l+a)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),FT(c,e,t,n)&&(c="center"),c}function bf(e,t,n){const i=n.yAlign||t.yAlign||LT(e,n);return{xAlign:n.xAlign||t.xAlign||UT(e,t,n,i),yAlign:i}}function BT(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function OT(e,t,n){let{y:i,height:o}=e;return t==="top"?i+=n:t==="bottom"?i-=o+n:i-=o/2,i}function Ef(e,t,n,i){const{caretSize:o,caretPadding:s,cornerRadius:r}=e,{xAlign:l,yAlign:a}=n,c=o+s,{topLeft:u,topRight:h,bottomLeft:p,bottomRight:g}=Di(r);let v=BT(t,l);const x=OT(t,a,c);return a==="center"?l==="left"?v+=c:l==="right"&&(v-=c):l==="left"?v-=Math.max(u,p)+o:l==="right"&&(v+=Math.max(h,g)+o),{x:ye(v,0,i.width-t.width),y:ye(x,0,i.height-t.height)}}function er(e,t,n){const i=Ie(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function wf(e){return fn([],Mn(e))}function VT(e,t,n){return hi(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Tf(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const $m={beforeTitle:An,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?$m[t].call(n,i):o}class $a extends Wn{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),o=i.enabled&&n.options.animation&&i.animations,s=new bm(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=VT(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,o=Oe(i,"beforeTitle",this,t),s=Oe(i,"title",this,t),r=Oe(i,"afterTitle",this,t);let l=[];return l=fn(l,Mn(o)),l=fn(l,Mn(s)),l=fn(l,Mn(r)),l}getBeforeBody(t,n){return wf(Oe(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,o=[];return Wt(t,s=>{const r={before:[],lines:[],after:[]},l=Tf(i,s);fn(r.before,Mn(Oe(l,"beforeLabel",this,s))),fn(r.lines,Oe(l,"label",this,s)),fn(r.after,Mn(Oe(l,"afterLabel",this,s))),o.push(r)}),o}getAfterBody(t,n){return wf(Oe(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,o=Oe(i,"beforeFooter",this,t),s=Oe(i,"footer",this,t),r=Oe(i,"afterFooter",this,t);let l=[];return l=fn(l,Mn(o)),l=fn(l,Mn(s)),l=fn(l,Mn(r)),l}_createItems(t){const n=this._active,i=this.chart.data,o=[],s=[],r=[];let l=[],a,c;for(a=0,c=n.length;at.filter(u,h,p,i))),t.itemSort&&(l=l.sort((u,h)=>t.itemSort(u,h,i))),Wt(l,u=>{const h=Tf(t.callbacks,u);o.push(Oe(h,"labelColor",this,u)),s.push(Oe(h,"labelPointStyle",this,u)),r.push(Oe(h,"labelTextColor",this,u))}),this.labelColors=o,this.labelPointStyles=s,this.labelTextColors=r,this.dataPoints=l,l}update(t,n){const i=this.options.setContext(this.getContext()),o=this._active;let s,r=[];if(!o.length)this.opacity!==0&&(s={opacity:0});else{const l=Bo[i.position].call(this,o,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const a=this._size=xf(this,i),c=Object.assign({},l,a),u=bf(this.chart,i,c),h=Ef(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,s={opacity:1,x:h.x,y:h.y,width:a.width,height:a.height,caretX:l.x,caretY:l.y}}this._tooltipItems=r,this.$context=void 0,s&&this._resolveAnimations().update(this,s),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,o){const s=this.getCaretPosition(t,i,o);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(t,n,i){const{xAlign:o,yAlign:s}=this,{caretSize:r,cornerRadius:l}=i,{topLeft:a,topRight:c,bottomLeft:u,bottomRight:h}=Di(l),{x:p,y:g}=t,{width:v,height:x}=n;let E,T,A,I,M,D;return s==="center"?(M=g+x/2,o==="left"?(E=p,T=E-r,I=M+r,D=M-r):(E=p+v,T=E+r,I=M-r,D=M+r),A=E):(o==="left"?T=p+Math.max(a,u)+r:o==="right"?T=p+v-Math.max(c,h)-r:T=this.caretX,s==="top"?(I=g,M=I-r,E=T-r,A=T+r):(I=g+x,M=I+r,E=T+r,A=T-r),D=I),{x1:E,x2:T,x3:A,y1:I,y2:M,y3:D}}drawTitle(t,n,i){const o=this.title,s=o.length;let r,l,a;if(s){const c=ji(i.rtl,this.x,this.width);for(t.x=er(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ge(i.titleFont),l=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,a=0;aA!==0)?(t.beginPath(),t.fillStyle=s.multiKeyBackground,us(t,{x,y:v,w:c,h:a,radius:T}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),us(t,{x:E,y:v+1,w:c-2,h:a-2,radius:T}),t.fill()):(t.fillStyle=s.multiKeyBackground,t.fillRect(x,v,c,a),t.strokeRect(x,v,c,a),t.fillStyle=r.backgroundColor,t.fillRect(E,v+1,c-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:o}=this,{bodySpacing:s,bodyAlign:r,displayColors:l,boxHeight:a,boxWidth:c,boxPadding:u}=i,h=ge(i.bodyFont);let p=h.lineHeight,g=0;const v=ji(i.rtl,this.x,this.width),x=function(U){n.fillText(U,v.x(t.x+g),t.y+p/2),t.y+=p+s},E=v.textAlign(r);let T,A,I,M,D,P,B;for(n.textAlign=r,n.textBaseline="middle",n.font=h.string,t.x=er(this,E,i),n.fillStyle=i.bodyColor,Wt(this.beforeBody,x),g=l&&E!=="right"?r==="center"?c/2+u:c+2+u:0,M=0,P=o.length;M0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,o=i&&i.x,s=i&&i.y;if(o||s){const r=Bo[t.position].call(this,this._active,this._eventPosition);if(!r)return;const l=this._size=xf(this,t),a=Object.assign({},r,this._size),c=bf(n,t,a),u=Ef(t,a,c,n);(o._to!==u.x||s._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=l.width,this.height=l.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},s={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Ie(n.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&l&&(t.save(),t.globalAlpha=i,this.drawBackground(s,t,o,n),gm(t,n.textDirection),s.y+=r.top,this.drawTitle(s,t,n),this.drawBody(s,t,n),this.drawFooter(s,t,n),mm(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,o=t.map(({datasetIndex:l,index:a})=>{const c=this.chart.getDatasetMeta(l);if(!c)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:c.data[a],index:a}}),s=!Br(i,o),r=this._positionChanged(o,n);(s||r)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,s=this._active||[],r=this._getActiveElements(t,s,n,i),l=this._positionChanged(r,t),a=n||!Br(r,s)||l;return a&&(this._active=r,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),a}_getActiveElements(t,n,i,o){const s=this.options;if(t.type==="mouseout")return[];if(!o)return n.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,s.mode,s,i);return s.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:o,options:s}=this,r=Bo[s.position].call(this,t,n);return r!==!1&&(i!==r.x||o!==r.y)}}nt($a,"positioners",Bo);var GT={id:"tooltip",_element:$a,positioners:Bo,afterInit(e,t,n){n&&(e.tooltip=new $a({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:$m},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},HT=Object.freeze({__proto__:null,Colors:tT,Decimation:oT,Filler:TT,Legend:MT,SubTitle:DT,Title:kT,Tooltip:GT});const $T=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function qT(e,t,n,i){const o=e.indexOf(t);if(o===-1)return $T(e,t,n,i);const s=e.lastIndexOf(t);return o!==s?n:o}const zT=(e,t)=>e===null?null:ye(Math.round(e),0,t);function Cf(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}nt(qa,"id","category"),nt(qa,"defaults",{ticks:{callback:Cf}});function WT(e,t){const n=[],{bounds:o,step:s,min:r,max:l,precision:a,count:c,maxTicks:u,maxDigits:h,includeBounds:p}=e,g=s||1,v=u-1,{min:x,max:E}=t,T=!Dt(r),A=!Dt(l),I=!Dt(c),M=(E-x)/(h+1);let D=vd((E-x)/v/g)*g,P,B,U,V;if(D<1e-14&&!T&&!A)return[{value:x},{value:E}];V=Math.ceil(E/D)-Math.floor(x/D),V>v&&(D=vd(V*D/v/g)*g),Dt(a)||(P=Math.pow(10,a),D=Math.ceil(D*P)/P),o==="ticks"?(B=Math.floor(x/D)*D,U=Math.ceil(E/D)*D):(B=x,U=E),T&&A&&s&&Bx((l-r)/s,D/1e3)?(V=Math.round(Math.min((l-r)/D,u)),D=(l-r)/V,B=r,U=l):I?(B=T?r:B,U=A?l:U,V=c-1,D=(U-B)/V):(V=(U-B)/D,Xo(V,Math.round(V),D/1e3)?V=Math.round(V):V=Math.ceil(V));const W=Math.max(xd(D),xd(B));P=Math.pow(10,Dt(a)?W:a),B=Math.round(B*P)/P,U=Math.round(U*P)/P;let et=0;for(T&&(p&&B!==r?(n.push({value:r}),Bl)break;n.push({value:at})}return A&&p&&U!==l?n.length&&Xo(n[n.length-1].value,l,Sf(l,M,e))?n[n.length-1].value=l:n.push({value:l}):(!A||U===l)&&n.push({value:U}),n}function Sf(e,t,{horizontal:n,minRotation:i}){const o=nn(i),s=(n?Math.sin(o):Math.cos(o))||.001,r=.75*t*(""+e).length;return Math.min(t/s,r)}class zr extends vs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Dt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:o,max:s}=this;const r=a=>o=n?o:a,l=a=>s=i?s:a;if(t){const a=wn(o),c=wn(s);a<0&&c<0?l(0):a>0&&c>0&&r(0)}if(o===s){let a=s===0?1:Math.abs(s*.05);l(s+a),t||r(o-a)}this.min=o,this.max=s}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,o;return i?(o=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const o={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,r=WT(o,s);return t.bounds==="ticks"&&Zg(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const o=(i-n)/Math.max(t.length-1,1)/2;n-=o,i+=o}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return _s(t,this.chart.options.locale,this.options.ticks.format)}}class za extends zr{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ce(t)?t:0,this.max=ce(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=nn(this.options.ticks.minRotation),o=(t?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}nt(za,"id","linear"),nt(za,"defaults",{ticks:{callback:fl.formatters.numeric}});const fs=e=>Math.floor(ti(e)),Ei=(e,t)=>Math.pow(10,fs(e)+t);function Af(e){return e/Math.pow(10,fs(e))===1}function If(e,t,n){const i=Math.pow(10,n),o=Math.floor(e/i);return Math.ceil(t/i)-o}function JT(e,t){const n=t-e;let i=fs(n);for(;If(e,t,i)>10;)i++;for(;If(e,t,i)<10;)i--;return Math.min(i,fs(e))}function KT(e,{min:t,max:n}){t=ze(e.min,t);const i=[],o=fs(t);let s=JT(t,n),r=s<0?Math.pow(10,Math.abs(s)):1;const l=Math.pow(10,s),a=o>s?Math.pow(10,o):0,c=Math.round((t-a)*r)/r,u=Math.floor((t-a)/l/10)*l*10;let h=Math.floor((c-u)/Math.pow(10,s)),p=ze(e.min,Math.round((a+u+h*Math.pow(10,s))*r)/r);for(;p=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,r=s>=0?1:r),p=Math.round((a+u+h*Math.pow(10,s))*r)/r;const g=ze(e.max,p);return i.push({value:g,major:Af(g),significand:h}),i}class Wa extends vs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=zr.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return ce(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ce(t)?Math.max(0,t):null,this.max=ce(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ce(this._userMin)&&(this.min=t===Ei(this.min,0)?Ei(this.min,-1):Ei(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,o=this.max;const s=l=>i=t?i:l,r=l=>o=n?o:l;i===o&&(i<=0?(s(1),r(10)):(s(Ei(i,-1)),r(Ei(o,1)))),i<=0&&s(Ei(o,-1)),o<=0&&r(Ei(i,1)),this.min=i,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=KT(n,this);return t.bounds==="ticks"&&Zg(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":_s(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ti(t),this._valueRange=ti(this.max)-ti(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ti(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}nt(Wa,"id","logarithmic"),nt(Wa,"defaults",{ticks:{callback:fl.formatters.logarithmic,major:{enabled:!0}}});function Ja(e){const t=e.ticks;if(t.display&&e.display){const n=Ie(t.backdropPadding);return Tt(t.font&&t.font.size,se.font.size)+n.height}return 0}function YT(e,t,n){return n=oe(n)?n:[n],{w:eb(e,t.string,n),h:n.length*t.lineHeight}}function Rf(e,t,n,i,o){return e===i||e===o?{start:t-n/2,end:t+n/2}:eo?{start:t-n,end:t}:{start:t,end:t+n}}function XT(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],o=[],s=e._pointLabels.length,r=e.options.pointLabels,l=r.centerPointLabels?Ot/s:0;for(let a=0;at.r&&(l=(i.end-t.r)/s,e.r=Math.max(e.r,t.r+l)),o.startt.b&&(a=(o.end-t.b)/r,e.b=Math.max(e.b,t.b+a))}function ZT(e,t,n){const i=e.drawingArea,{extra:o,additionalAngle:s,padding:r,size:l}=n,a=e.getPointPosition(t,i+o+r,s),c=Math.round(Gc(Ee(a.angle+de))),u=i1(a.y,l.h,c),h=e1(c),p=n1(a.x,l.w,h);return{visible:!0,x:a.x,y:u,textAlign:h,left:p,top:u,right:p+l.w,bottom:u+l.h}}function jT(e,t){if(!t)return!0;const{left:n,top:i,right:o,bottom:s}=e;return!(On({x:n,y:i},t)||On({x:n,y:s},t)||On({x:o,y:i},t)||On({x:o,y:s},t))}function t1(e,t,n){const i=[],o=e._pointLabels.length,s=e.options,{centerPointLabels:r,display:l}=s.pointLabels,a={extra:Ja(s)/2,additionalAngle:r?Ot/o:0};let c;for(let u=0;u270||n<90)&&(e-=t),e}function o1(e,t,n){const{left:i,top:o,right:s,bottom:r}=n,{backdropColor:l}=t;if(!Dt(l)){const a=Di(t.borderRadius),c=Ie(t.backdropPadding);e.fillStyle=l;const u=i-c.left,h=o-c.top,p=s-i+c.width,g=r-o+c.height;Object.values(a).some(v=>v!==0)?(e.beginPath(),us(e,{x:u,y:h,w:p,h:g,radius:a}),e.fill()):e.fillRect(u,h,p,g)}}function s1(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let o=t-1;o>=0;o--){const s=e._pointLabelItems[o];if(!s.visible)continue;const r=i.setContext(e.getPointLabelContext(o));o1(n,r,s);const l=ge(r.font),{x:a,y:c,textAlign:u}=s;Ui(n,e._pointLabels[o],a,c+l.lineHeight/2,l,{color:r.color,textAlign:u,textBaseline:"middle"})}}function qm(e,t,n,i){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,ne);else{let s=e.getPointPosition(0,t);o.moveTo(s.x,s.y);for(let r=1;r{const o=ee(this.options.pointLabels.callback,[n,i],this);return o||o===0?o:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?XT(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,o){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,o))}getIndexAngle(t){const n=ne/(this._pointLabels.length||1),i=this.options.startAngle||0;return Ee(t*n+nn(i))}getDistanceFromCenterForValue(t){if(Dt(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(Dt(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t{if(h!==0||h===0&&this.min<0){a=this.getDistanceFromCenterForValue(u.value);const p=this.getContext(h),g=o.setContext(p),v=s.setContext(p);r1(this,g,a,r,v)}}),i.display){for(t.save(),l=r-1;l>=0;l--){const u=i.setContext(this.getPointLabelContext(l)),{color:h,lineWidth:p}=u;!p||!h||(t.lineWidth=p,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,a=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(l,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const o=this.getIndexAngle(0);let s,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((l,a)=>{if(a===0&&this.min>=0&&!n.reverse)return;const c=i.setContext(this.getContext(a)),u=ge(c.font);if(s=this.getDistanceFromCenterForValue(this.ticks[a].value),c.showLabelBackdrop){t.font=u.string,r=t.measureText(l.label).width,t.fillStyle=c.backdropColor;const h=Ie(c.backdropPadding);t.fillRect(-r/2-h.left,-s-u.size/2-h.top,r+h.width,u.size+h.height)}Ui(t,l.label,0,-s,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}nt(Oo,"id","radialLinear"),nt(Oo,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fl.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),nt(Oo,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),nt(Oo,"descriptors",{angleLines:{_fallback:"grid"}});const _l={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ge=Object.keys(_l);function Mf(e,t){return e-t}function Pf(e,t){if(Dt(t))return null;const n=e._adapter,{parser:i,round:o,isoWeekday:s}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),ce(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(o&&(r=o==="week"&&(ro(s)||s===!0)?n.startOf(r,"isoWeek",s):n.startOf(r,o)),+r)}function kf(e,t,n,i){const o=Ge.length;for(let s=Ge.indexOf(e);s=Ge.indexOf(n);s--){const r=Ge[s];if(_l[r].common&&e._adapter.diff(o,i,r)>=t-1)return r}return Ge[n?Ge.indexOf(n):0]}function c1(e){for(let t=Ge.indexOf(e)+1,n=Ge.length;t=t?n[i]:n[o];e[s]=!0}}function u1(e,t,n,i){const o=e._adapter,s=+o.startOf(t[0].value,i),r=t[t.length-1].value;let l,a;for(l=s;l<=r;l=+o.add(l,1,i))a=n[l],a>=0&&(t[a].major=!0);return t}function Nf(e,t,n){const i=[],o={},s=t.length;let r,l;for(r=0;r+t.value))}initOffsets(t=[]){let n=0,i=0,o,s;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,s=this.getDecimalForValue(t[t.length-1]),t.length===1?i=s:i=(s-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=ye(n,0,r),i=ye(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,o=this.options,s=o.time,r=s.unit||kf(s.minUnit,n,i,this._getLabelCapacity(n)),l=Tt(o.ticks.stepSize,1),a=r==="week"?s.isoWeekday:!1,c=ro(a)||a===!0,u={};let h=n,p,g;if(c&&(h=+t.startOf(h,"isoWeek",a)),h=+t.startOf(h,c?"day":r),t.diff(i,n,r)>1e5*l)throw new Error(n+" and "+i+" are too far apart with stepSize of "+l+" "+r);const v=o.ticks.source==="data"&&this.getDataTimestamps();for(p=h,g=0;p+x)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,s=this._unit,r=n||o[s];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,o){const s=this.options,r=s.ticks.callback;if(r)return ee(r,[t,n,i],this);const l=s.time.displayFormats,a=this._unit,c=this._majorUnit,u=a&&l[a],h=c&&l[c],p=i[n],g=c&&h&&p&&p.major;return this._adapter.format(t,o||(g?h:u))}generateTickLabels(t){let n,i,o;for(n=0,i=t.length;n0?l:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,i=o.length;n=e[i].pos&&t<=e[o].pos&&({lo:i,hi:o}=Bn(e,"pos",t)),{pos:s,time:l}=e[i],{pos:r,time:a}=e[o]):(t>=e[i].time&&t<=e[o].time&&({lo:i,hi:o}=Bn(e,"time",t)),{time:s,pos:l}=e[i],{time:r,pos:a}=e[o]);const c=r-s;return c?l+(a-l)*(t-s)/c:l}class Ka extends hs{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=nr(n,this.min),this._tableRange=nr(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,o=[],s=[];let r,l,a,c,u;for(r=0,l=t.length;r=n&&c<=i&&o.push(c);if(o.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,l=o.length;ro-s)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(nr(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return nr(this._table,i*this._tableRange+this._minPos,!0)}}nt(Ka,"id","timeseries"),nt(Ka,"defaults",hs.defaults);var d1=Object.freeze({__proto__:null,CategoryScale:qa,LinearScale:za,LogarithmicScale:Wa,RadialLinearScale:Oo,TimeScale:hs,TimeSeriesScale:Ka});const f1=[yE,Jw,HT,d1];function h1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Io={exports:{}},aa={},ca,Lf;function p1(){if(Lf)return ca;Lf=1;function e(t,n){typeof n=="boolean"&&(n={forever:n}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=n||{},this._maxRetryTime=n&&n.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return ca=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var n=new Date().getTime();if(t&&n-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var i=this._timeouts.shift();if(i===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),i=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},i),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,n){this._fn=t,n&&(n.timeout&&(this._operationTimeout=n.timeout),n.cb&&(this._operationTimeoutCb=n.cb));var i=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){i._operationTimeoutCb()},i._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},n=null,i=0,o=0;o=i&&(n=s,i=l)}return n},ca}var Ff;function g1(){return Ff||(Ff=1,(function(e){var t=p1();e.operation=function(n){var i=e.timeouts(n);return new t(i,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(n){if(n instanceof Array)return[].concat(n);var i={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var o in n)i[o]=n[o];if(i.minTimeout>i.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],r=0;r{const c=a.retries-(l-1);return r.attemptNumber=l,r.retriesLeft=c,r},o=r=>t.includes(r),s=(r,l)=>new Promise((a,c)=>{l={onFailedAttempt:()=>{},retries:10,...l};const u=e.operation(l);u.attempt(async h=>{try{a(await r(h))}catch(p){if(!(p instanceof Error)){c(new TypeError(`Non-error was thrown: "${p}". You should only throw errors.`));return}if(p instanceof n)u.stop(),c(p.originalError);else if(p instanceof TypeError&&!o(p.message))u.stop(),c(p);else{i(p,h,l);try{await l.onFailedAttempt(p)}catch(g){c(g);return}u.retry(p)||c(u.mainError())}}})});return Io.exports=s,Io.exports.default=s,Io.exports.AbortError=n,Io.exports}var zm=y1();const _1=h1(zm);var v1={};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let x1,b1;function E1(){return{geminiUrl:x1,vertexUrl:b1}}function w1(e,t,n,i){var o,s;if(!(e!=null&&e.baseUrl)){const r=E1();return t?(o=r.vertexUrl)!==null&&o!==void 0?o:n:(s=r.geminiUrl)!==null&&s!==void 0?s:i}return e.baseUrl}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Jn{}function lt(e,t){const n=/\{([^}]+)\}/g;return e.replace(n,(i,o)=>{if(Object.prototype.hasOwnProperty.call(t,o)){const s=t[o];return s!=null?String(s):""}else throw new Error(`Key '${o}' not found in valueMap.`)})}function f(e,t,n){for(let s=0;s({}));else throw new Error(`Value must be a list given an array path ${r}`);if(Array.isArray(e[l])){const a=e[l];if(Array.isArray(n))for(let c=0;cd(l,t.slice(i+1),n)):n}else return n}else e=e[o]}return e}catch(i){if(i instanceof TypeError)return n;throw i}}function T1(e,t){for(const[n,i]of Object.entries(t)){const o=n.split("."),s=i.split("."),r=new Set;let l=-1;for(let a=0;al)for(let a=l;a=t.length||typeof e!="object"||e===null)return;const s=t[i];if(s.endsWith("[]")){const r=s.slice(0,-2),l=e;if(r in l&&Array.isArray(l[r]))for(const a of l[r])Ya(a,t,n,i+1,o)}else if(s==="*"){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){const r=e,l=Object.keys(r).filter(c=>!c.startsWith("_")&&!o.has(c)),a={};for(const c of l)a[c]=r[c];for(const[c,u]of Object.entries(a)){const h=[];for(const p of n.slice(i))p==="*"?h.push(c):h.push(p);f(r,h,u)}for(const c of l)delete r[c]}}else{const r=e;s in r&&Ya(r[s],t,n,i+1,o)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function jc(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 C1(e){const t={},n=d(e,["operationName"]);n!=null&&f(t,["operationName"],n);const i=d(e,["resourceName"]);return i!=null&&f(t,["_url","resourceName"],i),t}function S1(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["metadata"]);i!=null&&f(t,["metadata"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);s!=null&&f(t,["error"],s);const r=d(e,["response","generateVideoResponse"]);return r!=null&&f(t,["response"],I1(r)),t}function A1(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["metadata"]);i!=null&&f(t,["metadata"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);s!=null&&f(t,["error"],s);const r=d(e,["response"]);return r!=null&&f(t,["response"],R1(r)),t}function I1(e){const t={},n=d(e,["generatedSamples"]);if(n!=null){let s=n;Array.isArray(s)&&(s=s.map(r=>M1(r))),f(t,["generatedVideos"],s)}const i=d(e,["raiMediaFilteredCount"]);i!=null&&f(t,["raiMediaFilteredCount"],i);const o=d(e,["raiMediaFilteredReasons"]);return o!=null&&f(t,["raiMediaFilteredReasons"],o),t}function R1(e){const t={},n=d(e,["videos"]);if(n!=null){let s=n;Array.isArray(s)&&(s=s.map(r=>P1(r))),f(t,["generatedVideos"],s)}const i=d(e,["raiMediaFilteredCount"]);i!=null&&f(t,["raiMediaFilteredCount"],i);const o=d(e,["raiMediaFilteredReasons"]);return o!=null&&f(t,["raiMediaFilteredReasons"],o),t}function M1(e){const t={},n=d(e,["video"]);return n!=null&&f(t,["video"],U1(n)),t}function P1(e){const t={},n=d(e,["_self"]);return n!=null&&f(t,["video"],B1(n)),t}function k1(e){const t={},n=d(e,["operationName"]);return n!=null&&f(t,["_url","operationName"],n),t}function D1(e){const t={},n=d(e,["operationName"]);return n!=null&&f(t,["_url","operationName"],n),t}function N1(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["metadata"]);i!=null&&f(t,["metadata"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);s!=null&&f(t,["error"],s);const r=d(e,["response"]);return r!=null&&f(t,["response"],L1(r)),t}function L1(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["parent"]);i!=null&&f(t,["parent"],i);const o=d(e,["documentName"]);return o!=null&&f(t,["documentName"],o),t}function Wm(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["metadata"]);i!=null&&f(t,["metadata"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);s!=null&&f(t,["error"],s);const r=d(e,["response"]);return r!=null&&f(t,["response"],F1(r)),t}function F1(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["parent"]);i!=null&&f(t,["parent"],i);const o=d(e,["documentName"]);return o!=null&&f(t,["documentName"],o),t}function U1(e){const t={},n=d(e,["uri"]);n!=null&&f(t,["uri"],n);const i=d(e,["encodedVideo"]);i!=null&&f(t,["videoBytes"],jc(i));const o=d(e,["encoding"]);return o!=null&&f(t,["mimeType"],o),t}function B1(e){const t={},n=d(e,["gcsUri"]);n!=null&&f(t,["uri"],n);const i=d(e,["bytesBase64Encoded"]);i!=null&&f(t,["videoBytes"],jc(i));const o=d(e,["mimeType"]);return o!=null&&f(t,["mimeType"],o),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var Of;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(Of||(Of={}));var Vf;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(Vf||(Vf={}));var Gf;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(Gf||(Gf={}));var oi;(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"})(oi||(oi={}));var Hf;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(Hf||(Hf={}));var $f;(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"})($f||($f={}));var qf;(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"})(qf||(qf={}));var zf;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})(zf||(zf={}));var Wf;(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"})(Wf||(Wf={}));var Jf;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.BLOCKING="BLOCKING",e.NON_BLOCKING="NON_BLOCKING"})(Jf||(Jf={}));var Kf;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(Kf||(Kf={}));var Yf;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})(Yf||(Yf={}));var Xf;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(Xf||(Xf={}));var Qf;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(Qf||(Qf={}));var Zf;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",e.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",e.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE"})(Zf||(Zf={}));var jf;(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"})(jf||(jf={}));var th;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(th||(th={}));var eh;(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"})(eh||(eh={}));var nh;(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"})(nh||(nh={}));var ih;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(ih||(ih={}));var oh;(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"})(oh||(oh={}));var sh;(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"})(sh||(sh={}));var rh;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.IMAGE_SAFETY="IMAGE_SAFETY",e.MODEL_ARMOR="MODEL_ARMOR",e.JAILBREAK="JAILBREAK"})(rh||(rh={}));var lh;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",e.ON_DEMAND="ON_DEMAND",e.ON_DEMAND_PRIORITY="ON_DEMAND_PRIORITY",e.ON_DEMAND_FLEX="ON_DEMAND_FLEX",e.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(lh||(lh={}));var Wr;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO",e.VIDEO="VIDEO"})(Wr||(Wr={}));var ah;(function(e){e.MODEL_STAGE_UNSPECIFIED="MODEL_STAGE_UNSPECIFIED",e.UNSTABLE_EXPERIMENTAL="UNSTABLE_EXPERIMENTAL",e.EXPERIMENTAL="EXPERIMENTAL",e.PREVIEW="PREVIEW",e.STABLE="STABLE",e.LEGACY="LEGACY",e.DEPRECATED="DEPRECATED",e.RETIRED="RETIRED"})(ah||(ah={}));var ch;(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"})(ch||(ch={}));var uh;(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"})(uh||(uh={}));var dh;(function(e){e.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",e.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",e.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",e.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",e.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",e.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",e.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(dh||(dh={}));var Xa;(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"})(Xa||(Xa={}));var fh;(function(e){e.TUNING_JOB_STATE_UNSPECIFIED="TUNING_JOB_STATE_UNSPECIFIED",e.TUNING_JOB_STATE_WAITING_FOR_QUOTA="TUNING_JOB_STATE_WAITING_FOR_QUOTA",e.TUNING_JOB_STATE_PROCESSING_DATASET="TUNING_JOB_STATE_PROCESSING_DATASET",e.TUNING_JOB_STATE_WAITING_FOR_CAPACITY="TUNING_JOB_STATE_WAITING_FOR_CAPACITY",e.TUNING_JOB_STATE_TUNING="TUNING_JOB_STATE_TUNING",e.TUNING_JOB_STATE_POST_PROCESSING="TUNING_JOB_STATE_POST_PROCESSING"})(fh||(fh={}));var hh;(function(e){e.AGGREGATION_METRIC_UNSPECIFIED="AGGREGATION_METRIC_UNSPECIFIED",e.AVERAGE="AVERAGE",e.MODE="MODE",e.STANDARD_DEVIATION="STANDARD_DEVIATION",e.VARIANCE="VARIANCE",e.MINIMUM="MINIMUM",e.MAXIMUM="MAXIMUM",e.MEDIAN="MEDIAN",e.PERCENTILE_P90="PERCENTILE_P90",e.PERCENTILE_P95="PERCENTILE_P95",e.PERCENTILE_P99="PERCENTILE_P99"})(hh||(hh={}));var ph;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",e.BASELINE="BASELINE",e.CANDIDATE="CANDIDATE",e.TIE="TIE"})(ph||(ph={}));var gh;(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"})(gh||(gh={}));var mh;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(mh||(mh={}));var yh;(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"})(yh||(yh={}));var _h;(function(e){e.TOOL_TYPE_UNSPECIFIED="TOOL_TYPE_UNSPECIFIED",e.GOOGLE_SEARCH_WEB="GOOGLE_SEARCH_WEB",e.GOOGLE_SEARCH_IMAGE="GOOGLE_SEARCH_IMAGE",e.URL_CONTEXT="URL_CONTEXT",e.GOOGLE_MAPS="GOOGLE_MAPS",e.FILE_SEARCH="FILE_SEARCH"})(_h||(_h={}));var Qa;(function(e){e.COLLECTION="COLLECTION"})(Qa||(Qa={}));var vh;(function(e){e.UNSPECIFIED="unspecified",e.FLEX="flex",e.STANDARD="standard",e.PRIORITY="priority"})(vh||(vh={}));var xh;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(xh||(xh={}));var Jr;(function(e){e.PREDICT="PREDICT",e.EMBED_CONTENT="EMBED_CONTENT"})(Jr||(Jr={}));var bh;(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"})(bh||(bh={}));var Eh;(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"})(Eh||(Eh={}));var wh;(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"})(wh||(wh={}));var Th;(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"})(Th||(Th={}));var Ch;(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"})(Ch||(Ch={}));var Sh;(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"})(Sh||(Sh={}));var Ah;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(Ah||(Ah={}));var Ih;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(Ih||(Ih={}));var Rh;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(Rh||(Rh={}));var Mh;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(Mh||(Mh={}));var Ph;(function(e){e.CROP="CROP",e.PAD="PAD"})(Ph||(Ph={}));var kh;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING",e.DISTILLATION="DISTILLATION"})(kh||(kh={}));var Dh;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(Dh||(Dh={}));var Nh;(function(e){e.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",e.UPLOADED="UPLOADED",e.GENERATED="GENERATED",e.REGISTERED="REGISTERED"})(Nh||(Nh={}));var Lh;(function(e){e.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.RESPONSE_REJECTED="RESPONSE_REJECTED",e.NEED_MORE_INPUT="NEED_MORE_INPUT",e.PROHIBITED_INPUT_CONTENT="PROHIBITED_INPUT_CONTENT",e.IMAGE_PROHIBITED_INPUT_CONTENT="IMAGE_PROHIBITED_INPUT_CONTENT",e.INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED="INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED",e.INPUT_IMAGE_CELEBRITY="INPUT_IMAGE_CELEBRITY",e.INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED="INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED",e.INPUT_TEXT_NCII_PROHIBITED="INPUT_TEXT_NCII_PROHIBITED",e.INPUT_OTHER="INPUT_OTHER",e.INPUT_IP_PROHIBITED="INPUT_IP_PROHIBITED",e.BLOCKLIST="BLOCKLIST",e.UNSAFE_PROMPT_FOR_IMAGE_GENERATION="UNSAFE_PROMPT_FOR_IMAGE_GENERATION",e.GENERATED_IMAGE_SAFETY="GENERATED_IMAGE_SAFETY",e.GENERATED_CONTENT_SAFETY="GENERATED_CONTENT_SAFETY",e.GENERATED_AUDIO_SAFETY="GENERATED_AUDIO_SAFETY",e.GENERATED_VIDEO_SAFETY="GENERATED_VIDEO_SAFETY",e.GENERATED_CONTENT_PROHIBITED="GENERATED_CONTENT_PROHIBITED",e.GENERATED_CONTENT_BLOCKLIST="GENERATED_CONTENT_BLOCKLIST",e.GENERATED_IMAGE_PROHIBITED="GENERATED_IMAGE_PROHIBITED",e.GENERATED_IMAGE_CELEBRITY="GENERATED_IMAGE_CELEBRITY",e.GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER="GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER",e.GENERATED_IMAGE_IDENTIFIABLE_PEOPLE="GENERATED_IMAGE_IDENTIFIABLE_PEOPLE",e.GENERATED_IMAGE_MINORS="GENERATED_IMAGE_MINORS",e.OUTPUT_IMAGE_IP_PROHIBITED="OUTPUT_IMAGE_IP_PROHIBITED",e.GENERATED_OTHER="GENERATED_OTHER",e.MAX_REGENERATION_REACHED="MAX_REGENERATION_REACHED"})(Lh||(Lh={}));var Fh;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(Fh||(Fh={}));var Uh;(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"})(Uh||(Uh={}));var Bh;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(Bh||(Bh={}));var Oh;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Oh||(Oh={}));var Vh;(function(e){e.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",e.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",e.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Vh||(Vh={}));var Gh;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",e.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",e.NO_INTERRUPTION="NO_INTERRUPTION"})(Gh||(Gh={}));var Hh;(function(e){e.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",e.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",e.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT",e.TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO="TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO"})(Hh||(Hh={}));var $h;(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"})($h||($h={}));var qh;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",e.QUALITY="QUALITY",e.DIVERSITY="DIVERSITY",e.VOCALIZATION="VOCALIZATION"})(qh||(qh={}));var Ji;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(Ji||(Ji={}));class Kr{constructor(t){const n={};for(const i of t.headers.entries())n[i[0]]=i[1];this.headers=n,this.responseInternal=t}json(){return this.responseInternal.json()}}class Ro{get text(){var t,n,i,o,s,r,l,a;if(((o=(i=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.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 c="",u=!1;const h=[];for(const p of(a=(l=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[g,v]of Object.entries(p))g!=="text"&&g!=="thought"&&g!=="thoughtSignature"&&(v!==null||v!==void 0)&&h.push(g);if(typeof p.text=="string"){if(typeof p.thought=="boolean"&&p.thought)continue;u=!0,c+=p.text}}return h.length>0&&console.warn(`there are non-text parts ${h} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),u?c:void 0}get data(){var t,n,i,o,s,r,l,a;if(((o=(i=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.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 c="";const u=[];for(const h of(a=(l=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||l===void 0?void 0:l.parts)!==null&&a!==void 0?a:[]){for(const[p,g]of Object.entries(h))p!=="inlineData"&&(g!==null||g!==void 0)&&u.push(p);h.inlineData&&typeof h.inlineData.data=="string"&&(c+=atob(h.inlineData.data))}return u.length>0&&console.warn(`there are non-data parts ${u} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),c.length>0?btoa(c):void 0}get functionCalls(){var t,n,i,o,s,r,l,a;if(((o=(i=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.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 c=(a=(l=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||l===void 0?void 0:l.parts)===null||a===void 0?void 0:a.filter(u=>u.functionCall).map(u=>u.functionCall).filter(u=>u!==void 0);if((c==null?void 0:c.length)!==0)return c}get executableCode(){var t,n,i,o,s,r,l,a,c;if(((o=(i=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.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 u=(a=(l=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||l===void 0?void 0:l.parts)===null||a===void 0?void 0:a.filter(h=>h.executableCode).map(h=>h.executableCode).filter(h=>h!==void 0);if((u==null?void 0:u.length)!==0)return(c=u==null?void 0:u[0])===null||c===void 0?void 0:c.code}get codeExecutionResult(){var t,n,i,o,s,r,l,a,c;if(((o=(i=(n=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.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 u=(a=(l=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||l===void 0?void 0:l.parts)===null||a===void 0?void 0:a.filter(h=>h.codeExecutionResult).map(h=>h.codeExecutionResult).filter(h=>h!==void 0);if((u==null?void 0:u.length)!==0)return(c=u==null?void 0:u[0])===null||c===void 0?void 0:c.output}}class zh{}class Wh{}class O1{}class V1{}class G1{}class H1{}class Jh{}class Kh{}class Yh{}class $1{}class Yr{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){const i=new Yr;let o;const s=t;return n?o=A1(s):o=S1(s),Object.assign(i,o),i}}class q1{}class Xh{}class Qh{}class Zh{}class z1{}class W1{}class J1{}class tu{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){const i=new tu,s=N1(t);return Object.assign(i,s),i}}class K1{}class Y1{}class X1{}class Q1{}class jh{}class Z1{get text(){var t,n,i;let o="",s=!1;const r=[];for(const l of(i=(n=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||n===void 0?void 0:n.parts)!==null&&i!==void 0?i:[]){for(const[a,c]of Object.entries(l))a!=="text"&&a!=="thought"&&c!==null&&r.push(a);if(typeof l.text=="string"){if(typeof l.thought=="boolean"&&l.thought)continue;s=!0,o+=l.text}}return r.length>0&&console.warn(`there are non-text parts ${r} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),s?o:void 0}get data(){var t,n,i;let o="";const s=[];for(const r of(i=(n=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||n===void 0?void 0:n.parts)!==null&&i!==void 0?i:[]){for(const[l,a]of Object.entries(r))l!=="inlineData"&&a!==null&&s.push(l);r.inlineData&&typeof r.inlineData.data=="string"&&(o+=atob(r.inlineData.data))}return s.length>0&&console.warn(`there are non-data parts ${s} 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 j1{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class eu{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){const i=new eu,s=Wm(t);return Object.assign(i,s),i}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Bt(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 Jm(e,t){const n=Bt(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 Km(e){return Array.isArray(e)?e.map(t=>Xr(t)):[Xr(e)]}function Xr(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function Ym(e){const t=Xr(e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function Xm(e){const t=Xr(e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function tp(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 Qm(e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("PartListUnion is required");return Array.isArray(e)?e.map(t=>tp(t)):[tp(e)]}function Za(e){return e!=null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)}function ep(e){return e!=null&&typeof e=="object"&&"functionCall"in e}function np(e){return e!=null&&typeof e=="object"&&"functionResponse"in e}function _e(e){if(e==null)throw new Error("ContentUnion is required");return Za(e)?e:{role:"user",parts:Qm(e)}}function nu(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap(n=>{const i=_e(n);return i.parts&&i.parts.length>0&&i.parts[0].text!==void 0?[i.parts[0].text]:[]});if(e.isVertexAI()){const n=_e(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=>_e(n)):[_e(t)]}function He(e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("contents are required");if(!Array.isArray(e)){if(ep(e)||np(e))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[_e(e)]}const t=[],n=[],i=Za(e[0]);for(const o of e){const s=Za(o);if(s!=i)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(s)t.push(o);else{if(ep(o)||np(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 i||t.push({role:"user",parts:Qm(n)}),t}function tC(e,t){e.includes("null")&&(t.nullable=!0);const n=e.filter(i=>i!=="null");if(n.length===1)t.type=Object.values(oi).includes(n[0].toUpperCase())?n[0].toUpperCase():oi.TYPE_UNSPECIFIED;else{t.anyOf=[];for(const i of n)t.anyOf.push({type:Object.values(oi).includes(i.toUpperCase())?i.toUpperCase():oi.TYPE_UNSPECIFIED})}}function to(e){const t={},n=["items"],i=["anyOf"],o=["properties"];if(e.type&&e.anyOf)throw new Error("type and anyOf cannot be both populated.");const s=e.anyOf;s!=null&&s.length==2&&(s[0].type==="null"?(t.nullable=!0,e=s[1]):s[1].type==="null"&&(t.nullable=!0,e=s[0])),e.type instanceof Array&&tC(e.type,t);for(const[r,l]of Object.entries(e))if(l!=null)if(r=="type"){if(l==="null")throw new Error("type: null can not be the only possible type for the field.");if(l instanceof Array)continue;t.type=Object.values(oi).includes(l.toUpperCase())?l.toUpperCase():oi.TYPE_UNSPECIFIED}else if(n.includes(r))t[r]=to(l);else if(i.includes(r)){const a=[];for(const c of l){if(c.type=="null"){t.nullable=!0;continue}a.push(to(c))}t[r]=a}else if(o.includes(r)){const a={};for(const[c,u]of Object.entries(l))a[c]=to(u);t[r]=a}else{if(r==="additionalProperties")continue;t[r]=l}return t}function iu(e){return to(e)}function ou(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 su(e){if("multiSpeakerVoiceConfig"in e)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return e}function fo(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=to(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=to(t.response));return e}function ho(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 eC(e,t,n,i=1){const o=!t.startsWith(`${n}/`)&&t.split("/").length===i;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 Kn(e,t){if(typeof t!="string")throw new Error("name must be a string");return eC(e,t,"cachedContents")}function Zm(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 pi(e){return jc(e)}function nC(e){return e!=null&&typeof e=="object"&&"name"in e}function iC(e){return e!=null&&typeof e=="object"&&"video"in e}function oC(e){return e!=null&&typeof e=="object"&&"uri"in e}function jm(e){var t;let n;if(nC(e)&&(n=e.name),!(oC(e)&&(n=e.uri,n===void 0))&&!(iC(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 t0(e,t){let n;return e.isVertexAI()?n=t?"publishers/google/models":"models":n=t?"models":"tunedModels",n}function e0(e){for(const t of["models","tunedModels","publisherModels"])if(sC(e,t))return e[t];return[]}function sC(e,t){return e!==null&&typeof e=="object"&&t in e}function rC(e,t={}){const n=e,i={name:n.name,description:n.description,parametersJsonSchema:n.inputSchema};return n.outputSchema&&(i.responseJsonSchema=n.outputSchema),t.behavior&&(i.behavior=t.behavior),{functionDeclarations:[i]}}function lC(e,t={}){const n=[],i=new Set;for(const o of e){const s=o.name;if(i.has(s))throw new Error(`Duplicate function name ${s} found in MCP tools. Please ensure function names are unique.`);i.add(s);const r=rC(o,t);r.functionDeclarations&&n.push(...r.functionDeclarations)}return{functionDeclarations:n}}function n0(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 if(/^projects\/[^/]+\/locations\/[^/]+\/datasets\/[^/]+$/.test(t))n={format:"vertex-dataset",vertexDatasetName: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 i=[n.gcsUri,n.bigqueryUri,n.vertexDatasetName].filter(Boolean).length,o=[n.inlinedRequests,n.fileName].filter(Boolean).length;if(e.isVertexAI()){if(o>0||i!==1)throw new Error("Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.")}else if(i>0||o!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return n}function aC(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 i0(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 s=!1;for(const r of o){if(typeof r!="object"||r===null)continue;const a=r.response;if(typeof a!="object"||a===null)continue;if(a.embedding!==void 0){s=!0;break}}return s&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),e}function po(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 o0(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}function cC(e){return e.includes("gemini")&&e!=="gemini-embedding-001"||e.includes("maas")}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function uC(e){const t={},n=d(e,["apiKey"]);if(n!=null&&f(t,["apiKey"],n),d(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is not supported in Gemini API.");if(d(e,["authType"])!==void 0)throw new Error("authType parameter is not supported in Gemini API.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is not supported in Gemini API.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is not supported in Gemini API.");if(d(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is not supported in Gemini API.");if(d(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is not supported in Gemini API.");return t}function dC(e){const t={},n=d(e,["responsesFile"]);n!=null&&f(t,["fileName"],n);const i=d(e,["inlinedResponses","inlinedResponses"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>zC(r))),f(t,["inlinedResponses"],s)}const o=d(e,["inlinedEmbedContentResponses","inlinedResponses"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["inlinedEmbedContentResponses"],s)}return t}function fC(e){const t={},n=d(e,["predictionsFormat"]);n!=null&&f(t,["format"],n);const i=d(e,["gcsDestination","outputUriPrefix"]);i!=null&&f(t,["gcsUri"],i);const o=d(e,["bigqueryDestination","outputUri"]);o!=null&&f(t,["bigqueryUri"],o);const s=d(e,["vertexMultimodalDatasetDestination"]);return s!=null&&f(t,["vertexDataset"],nS(s)),t}function hC(e){const t={},n=d(e,["format"]);n!=null&&f(t,["predictionsFormat"],n);const i=d(e,["gcsUri"]);i!=null&&f(t,["gcsDestination","outputUriPrefix"],i);const o=d(e,["bigqueryUri"]);if(o!=null&&f(t,["bigqueryDestination","outputUri"],o),d(e,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const s=d(e,["vertexDataset"]);return s!=null&&f(t,["vertexMultimodalDatasetDestination"],iS(s)),t}function br(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["metadata","displayName"]);i!=null&&f(t,["displayName"],i);const o=d(e,["metadata","state"]);o!=null&&f(t,["state"],o0(o));const s=d(e,["metadata","createTime"]);s!=null&&f(t,["createTime"],s);const r=d(e,["metadata","endTime"]);r!=null&&f(t,["endTime"],r);const l=d(e,["metadata","updateTime"]);l!=null&&f(t,["updateTime"],l);const a=d(e,["metadata","model"]);a!=null&&f(t,["model"],a);const c=d(e,["metadata","output"]);return c!=null&&f(t,["dest"],dC(i0(c))),t}function ja(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["displayName"]);i!=null&&f(t,["displayName"],i);const o=d(e,["state"]);o!=null&&f(t,["state"],o0(o));const s=d(e,["error"]);s!=null&&f(t,["error"],s);const r=d(e,["createTime"]);r!=null&&f(t,["createTime"],r);const l=d(e,["startTime"]);l!=null&&f(t,["startTime"],l);const a=d(e,["endTime"]);a!=null&&f(t,["endTime"],a);const c=d(e,["updateTime"]);c!=null&&f(t,["updateTime"],c);const u=d(e,["model"]);u!=null&&f(t,["model"],u);const h=d(e,["inputConfig"]);h!=null&&f(t,["src"],pC(h));const p=d(e,["outputConfig"]);p!=null&&f(t,["dest"],fC(i0(p)));const g=d(e,["completionStats"]);g!=null&&f(t,["completionStats"],g);const v=d(e,["outputInfo"]);return v!=null&&f(t,["outputInfo"],v),t}function pC(e){const t={},n=d(e,["instancesFormat"]);n!=null&&f(t,["format"],n);const i=d(e,["gcsSource","uris"]);i!=null&&f(t,["gcsUri"],i);const o=d(e,["bigquerySource","inputUri"]);o!=null&&f(t,["bigqueryUri"],o);const s=d(e,["vertexMultimodalDatasetSource","datasetName"]);return s!=null&&f(t,["vertexDatasetName"],s),t}function gC(e,t){const n={};if(d(t,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(d(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(d(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const i=d(t,["fileName"]);i!=null&&f(n,["fileName"],i);const o=d(t,["inlinedRequests"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>qC(e,r))),f(n,["requests","requests"],s)}if(d(t,["vertexDatasetName"])!==void 0)throw new Error("vertexDatasetName parameter is not supported in Gemini API.");return n}function mC(e){const t={},n=d(e,["format"]);n!=null&&f(t,["instancesFormat"],n);const i=d(e,["gcsUri"]);i!=null&&f(t,["gcsSource","uris"],i);const o=d(e,["bigqueryUri"]);if(o!=null&&f(t,["bigquerySource","inputUri"],o),d(e,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const s=d(e,["vertexDatasetName"]);return s!=null&&f(t,["vertexMultimodalDatasetSource","datasetName"],s),t}function yC(e){const t={},n=d(e,["data"]);if(n!=null&&f(t,["data"],n),d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function _C(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],po(e,i)),n}function vC(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],po(e,i)),n}function xC(e){const t={},n=d(e,["content"]);n!=null&&f(t,["content"],n);const i=d(e,["citationMetadata"]);i!=null&&f(t,["citationMetadata"],bC(i));const o=d(e,["tokenCount"]);o!=null&&f(t,["tokenCount"],o);const s=d(e,["finishReason"]);s!=null&&f(t,["finishReason"],s);const r=d(e,["groundingMetadata"]);r!=null&&f(t,["groundingMetadata"],r);const l=d(e,["avgLogprobs"]);l!=null&&f(t,["avgLogprobs"],l);const a=d(e,["index"]);a!=null&&f(t,["index"],a);const c=d(e,["logprobsResult"]);c!=null&&f(t,["logprobsResult"],c);const u=d(e,["safetyRatings"]);if(u!=null){let p=u;Array.isArray(p)&&(p=p.map(g=>g)),f(t,["safetyRatings"],p)}const h=d(e,["urlContextMetadata"]);return h!=null&&f(t,["urlContextMetadata"],h),t}function bC(e){const t={},n=d(e,["citationSources"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),f(t,["citations"],i)}return t}function s0(e){const t={},n=d(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>ZC(s))),f(t,["parts"],o)}const i=d(e,["role"]);return i!=null&&f(t,["role"],i),t}function EC(e,t){const n={},i=d(e,["displayName"]);if(t!==void 0&&i!=null&&f(t,["batch","displayName"],i),d(e,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");const o=d(e,["webhookConfig"]);return t!==void 0&&o!=null&&f(t,["batch","webhookConfig"],o),n}function wC(e,t){const n={},i=d(e,["displayName"]);t!==void 0&&i!=null&&f(t,["displayName"],i);const o=d(e,["dest"]);if(t!==void 0&&o!=null&&f(t,["outputConfig"],hC(aC(o))),d(e,["webhookConfig"])!==void 0)throw new Error("webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return n}function ip(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["_url","model"],Bt(e,i));const o=d(t,["src"]);o!=null&&f(n,["batch","inputConfig"],gC(e,n0(e,o)));const s=d(t,["config"]);return s!=null&&EC(s,n),n}function TC(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["model"],Bt(e,i));const o=d(t,["src"]);o!=null&&f(n,["inputConfig"],mC(n0(e,o)));const s=d(t,["config"]);return s!=null&&wC(s,n),n}function CC(e,t){const n={},i=d(e,["displayName"]);return t!==void 0&&i!=null&&f(t,["batch","displayName"],i),n}function SC(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["_url","model"],Bt(e,i));const o=d(t,["src"]);o!=null&&f(n,["batch","inputConfig"],DC(e,o));const s=d(t,["config"]);return s!=null&&CC(s,n),n}function AC(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],po(e,i)),n}function IC(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],po(e,i)),n}function RC(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["name"]);i!=null&&f(t,["name"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);return s!=null&&f(t,["error"],s),t}function MC(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["name"]);i!=null&&f(t,["name"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);return s!=null&&f(t,["error"],s),t}function PC(e,t){const n={},i=d(t,["contents"]);if(i!=null){let s=nu(e,i);Array.isArray(s)&&(s=s.map(r=>r)),f(n,["requests[]","request","content"],s)}const o=d(t,["config"]);return o!=null&&(f(n,["_self"],kC(o,n)),T1(n,{"requests[].*":"requests[].request.*"})),n}function kC(e,t){const n={},i=d(e,["taskType"]);t!==void 0&&i!=null&&f(t,["requests[]","taskType"],i);const o=d(e,["title"]);t!==void 0&&o!=null&&f(t,["requests[]","title"],o);const s=d(e,["outputDimensionality"]);if(t!==void 0&&s!=null&&f(t,["requests[]","outputDimensionality"],s),d(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(d(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");if(d(e,["documentOcr"])!==void 0)throw new Error("documentOcr parameter is not supported in Gemini API.");if(d(e,["audioTrackExtraction"])!==void 0)throw new Error("audioTrackExtraction parameter is not supported in Gemini API.");return n}function DC(e,t){const n={},i=d(t,["fileName"]);i!=null&&f(n,["file_name"],i);const o=d(t,["inlinedRequests"]);return o!=null&&f(n,["requests"],PC(e,o)),n}function NC(e){const t={};if(d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=d(e,["fileUri"]);n!=null&&f(t,["fileUri"],n);const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function LC(e){const t={},n=d(e,["id"]);n!=null&&f(t,["id"],n);const i=d(e,["args"]);i!=null&&f(t,["args"],i);const o=d(e,["name"]);if(o!=null&&f(t,["name"],o),d(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(d(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function FC(e){const t={},n=d(e,["allowedFunctionNames"]);n!=null&&f(t,["allowedFunctionNames"],n);const i=d(e,["mode"]);if(i!=null&&f(t,["mode"],i),d(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function UC(e,t,n){const i={},o=d(t,["systemInstruction"]);n!==void 0&&o!=null&&f(n,["systemInstruction"],s0(_e(o)));const s=d(t,["temperature"]);s!=null&&f(i,["temperature"],s);const r=d(t,["topP"]);r!=null&&f(i,["topP"],r);const l=d(t,["topK"]);l!=null&&f(i,["topK"],l);const a=d(t,["candidateCount"]);a!=null&&f(i,["candidateCount"],a);const c=d(t,["maxOutputTokens"]);c!=null&&f(i,["maxOutputTokens"],c);const u=d(t,["stopSequences"]);u!=null&&f(i,["stopSequences"],u);const h=d(t,["responseLogprobs"]);h!=null&&f(i,["responseLogprobs"],h);const p=d(t,["logprobs"]);p!=null&&f(i,["logprobs"],p);const g=d(t,["presencePenalty"]);g!=null&&f(i,["presencePenalty"],g);const v=d(t,["frequencyPenalty"]);v!=null&&f(i,["frequencyPenalty"],v);const x=d(t,["seed"]);x!=null&&f(i,["seed"],x);const E=d(t,["responseMimeType"]);E!=null&&f(i,["responseMimeType"],E);const T=d(t,["responseSchema"]);T!=null&&f(i,["responseSchema"],iu(T));const A=d(t,["responseJsonSchema"]);if(A!=null&&f(i,["responseJsonSchema"],A),d(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(d(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const I=d(t,["safetySettings"]);if(n!==void 0&&I!=null){let gt=I;Array.isArray(gt)&&(gt=gt.map(st=>jC(st))),f(n,["safetySettings"],gt)}const M=d(t,["tools"]);if(n!==void 0&&M!=null){let gt=ho(M);Array.isArray(gt)&&(gt=gt.map(st=>eS(fo(st)))),f(n,["tools"],gt)}const D=d(t,["toolConfig"]);if(n!==void 0&&D!=null&&f(n,["toolConfig"],tS(D)),d(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const P=d(t,["cachedContent"]);n!==void 0&&P!=null&&f(n,["cachedContent"],Kn(e,P));const B=d(t,["responseModalities"]);B!=null&&f(i,["responseModalities"],B);const U=d(t,["mediaResolution"]);U!=null&&f(i,["mediaResolution"],U);const V=d(t,["speechConfig"]);if(V!=null&&f(i,["speechConfig"],ou(V)),d(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const W=d(t,["thinkingConfig"]);W!=null&&f(i,["thinkingConfig"],W);const et=d(t,["imageConfig"]);et!=null&&f(i,["imageConfig"],$C(et));const at=d(t,["enableEnhancedCivicAnswers"]);if(at!=null&&f(i,["enableEnhancedCivicAnswers"],at),d(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is not supported in Gemini API.");const Ct=d(t,["serviceTier"]);return n!==void 0&&Ct!=null&&f(n,["serviceTier"],Ct),i}function BC(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["candidates"]);if(i!=null){let c=i;Array.isArray(c)&&(c=c.map(u=>xC(u))),f(t,["candidates"],c)}const o=d(e,["modelVersion"]);o!=null&&f(t,["modelVersion"],o);const s=d(e,["promptFeedback"]);s!=null&&f(t,["promptFeedback"],s);const r=d(e,["responseId"]);r!=null&&f(t,["responseId"],r);const l=d(e,["usageMetadata"]);l!=null&&f(t,["usageMetadata"],l);const a=d(e,["modelStatus"]);return a!=null&&f(t,["modelStatus"],a),t}function OC(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],po(e,i)),n}function VC(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],po(e,i)),n}function GC(e){const t={},n=d(e,["authConfig"]);n!=null&&f(t,["authConfig"],uC(n));const i=d(e,["enableWidget"]);return i!=null&&f(t,["enableWidget"],i),t}function HC(e){const t={},n=d(e,["searchTypes"]);if(n!=null&&f(t,["searchTypes"],n),d(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");if(d(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");const i=d(e,["timeRangeFilter"]);return i!=null&&f(t,["timeRangeFilter"],i),t}function $C(e){const t={},n=d(e,["aspectRatio"]);n!=null&&f(t,["aspectRatio"],n);const i=d(e,["imageSize"]);if(i!=null&&f(t,["imageSize"],i),d(e,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is not supported in Gemini API.");if(d(e,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is not supported in Gemini API.");if(d(e,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(d(e,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");if(d(e,["imageOutputOptions"])!==void 0)throw new Error("imageOutputOptions parameter is not supported in Gemini API.");return t}function qC(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["request","model"],Bt(e,i));const o=d(t,["contents"]);if(o!=null){let l=He(o);Array.isArray(l)&&(l=l.map(a=>s0(a))),f(n,["request","contents"],l)}const s=d(t,["metadata"]);s!=null&&f(n,["metadata"],s);const r=d(t,["config"]);return r!=null&&f(n,["request","generationConfig"],UC(e,r,d(n,["request"],{}))),n}function zC(e){const t={},n=d(e,["response"]);n!=null&&f(t,["response"],BC(n));const i=d(e,["metadata"]);i!=null&&f(t,["metadata"],i);const o=d(e,["error"]);return o!=null&&f(t,["error"],o),t}function WC(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);if(t!==void 0&&o!=null&&f(t,["_query","pageToken"],o),d(e,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return n}function JC(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);t!==void 0&&o!=null&&f(t,["_query","pageToken"],o);const s=d(e,["filter"]);return t!==void 0&&s!=null&&f(t,["_query","filter"],s),n}function KC(e){const t={},n=d(e,["config"]);return n!=null&&WC(n,t),t}function YC(e){const t={},n=d(e,["config"]);return n!=null&&JC(n,t),t}function XC(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["operations"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>br(r))),f(t,["batchJobs"],s)}return t}function QC(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["batchPredictionJobs"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>ja(r))),f(t,["batchJobs"],s)}return t}function ZC(e){const t={},n=d(e,["mediaResolution"]);n!=null&&f(t,["mediaResolution"],n);const i=d(e,["codeExecutionResult"]);i!=null&&f(t,["codeExecutionResult"],i);const o=d(e,["executableCode"]);o!=null&&f(t,["executableCode"],o);const s=d(e,["fileData"]);s!=null&&f(t,["fileData"],NC(s));const r=d(e,["functionCall"]);r!=null&&f(t,["functionCall"],LC(r));const l=d(e,["functionResponse"]);l!=null&&f(t,["functionResponse"],l);const a=d(e,["inlineData"]);a!=null&&f(t,["inlineData"],yC(a));const c=d(e,["text"]);c!=null&&f(t,["text"],c);const u=d(e,["thought"]);u!=null&&f(t,["thought"],u);const h=d(e,["thoughtSignature"]);h!=null&&f(t,["thoughtSignature"],h);const p=d(e,["videoMetadata"]);p!=null&&f(t,["videoMetadata"],p);const g=d(e,["toolCall"]);g!=null&&f(t,["toolCall"],g);const v=d(e,["toolResponse"]);v!=null&&f(t,["toolResponse"],v);const x=d(e,["partMetadata"]);return x!=null&&f(t,["partMetadata"],x),t}function jC(e){const t={},n=d(e,["category"]);if(n!=null&&f(t,["category"],n),d(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const i=d(e,["threshold"]);return i!=null&&f(t,["threshold"],i),t}function tS(e){const t={},n=d(e,["retrievalConfig"]);n!=null&&f(t,["retrievalConfig"],n);const i=d(e,["functionCallingConfig"]);i!=null&&f(t,["functionCallingConfig"],FC(i));const o=d(e,["includeServerSideToolInvocations"]);return o!=null&&f(t,["includeServerSideToolInvocations"],o),t}function eS(e){const t={};if(d(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=d(e,["computerUse"]);n!=null&&f(t,["computerUse"],n);const i=d(e,["fileSearch"]);i!=null&&f(t,["fileSearch"],i);const o=d(e,["googleSearch"]);o!=null&&f(t,["googleSearch"],HC(o));const s=d(e,["googleMaps"]);s!=null&&f(t,["googleMaps"],GC(s));const r=d(e,["codeExecution"]);if(r!=null&&f(t,["codeExecution"],r),d(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=d(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["functionDeclarations"],h)}const a=d(e,["googleSearchRetrieval"]);if(a!=null&&f(t,["googleSearchRetrieval"],a),d(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is not supported in Gemini API.");const c=d(e,["urlContext"]);c!=null&&f(t,["urlContext"],c);const u=d(e,["mcpServers"]);if(u!=null){let h=u;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["mcpServers"],h)}return t}function nS(e){const t={},n=d(e,["bigqueryDestination","outputUri"]);n!=null&&f(t,["bigqueryDestination"],n);const i=d(e,["displayName"]);return i!=null&&f(t,["displayName"],i),t}function iS(e){const t={},n=d(e,["bigqueryDestination"]);n!=null&&f(t,["bigqueryDestination","outputUri"],n);const i=d(e,["displayName"]);return i!=null&&f(t,["displayName"],i),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var qn;(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"})(qn||(qn={}));class Oi{constructor(t,n,i,o){this.pageInternal=[],this.paramsInternal={},this.requestInternal=n,this.init(t,i,o)}init(t,n,i){var o,s;this.nameInternal=t,this.pageInternal=n[this.nameInternal]||[],this.sdkHttpResponseInternal=n==null?void 0:n.sdkHttpResponse,this.idxInternal=0;let r={config:{}};!i||Object.keys(i).length===0?r={config:{}}:typeof i=="object"?r=Object.assign({},i):r=i,r.config&&(r.config.pageToken=n.nextPageToken),this.paramsInternal=r,this.pageInternalSize=(s=(o=r.config)===null||o===void 0?void 0:o.pageSize)!==null&&s!==void 0?s: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 oS extends Jn{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Oi(qn.PAGED_ITEM_BATCH_JOBS,i=>this.listInternal(i),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("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(n)}}createInlinedGenerateContentRequest(t){const n=ip(this.apiClient,t),i=n._url,o=lt("{model}:batchGenerateContent",i),l=n.batch.inputConfig.requests,a=l.requests,c=[];for(const u of a){const h=Object.assign({},u);if(h.systemInstruction){const p=h.systemInstruction;delete h.systemInstruction;const g=h.request;g.systemInstruction=p,h.request=g}c.push(h)}return l.requests=c,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 i=n?Object.assign({},n):{},o=Date.now().toString();if(i.displayName||(i.displayName=`genaiBatchJob_${o}`),i.dest===void 0){const s=this.getGcsUri(t),r=this.getBigqueryUri(t);if(s)s.endsWith(".jsonl")?i.dest=`${s.slice(0,-6)}/dest`:i.dest=`${s}_dest_${o}`;else if(r)i.dest=`${r}_dest_${o}`;else throw new Error("Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.")}return i}async createInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=TC(this.apiClient,t);return l=lt("batchPredictionJobs",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>ja(u))}else{const c=ip(this.apiClient,t);return l=lt("{model}:batchGenerateContent",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>br(u))}}async createEmbeddingsInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=SC(this.apiClient,t);return s=lt("{model}:asyncBatchEmbedContent",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>br(a))}}async get(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=VC(this.apiClient,t);return l=lt("batchPredictionJobs/{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>ja(u))}else{const c=OC(this.apiClient,t);return l=lt("batches/{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>br(u))}}async cancel(t){var n,i,o,s;let r="",l={};if(this.apiClient.isVertexAI()){const a=vC(this.apiClient,t);r=lt("batchPredictionJobs/{name}:cancel",a._url),l=a._query,delete a._url,delete a._query,await this.apiClient.request({path:r,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal})}else{const a=_C(this.apiClient,t);r=lt("batches/{name}:cancel",a._url),l=a._query,delete a._url,delete a._query,await this.apiClient.request({path:r,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal})}}async listInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=YC(t);return l=lt("batchPredictionJobs",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=QC(u),p=new jh;return Object.assign(p,h),p})}else{const c=KC(t);return l=lt("batches",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=XC(u),p=new jh;return Object.assign(p,h),p})}}async delete(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=IC(this.apiClient,t);return l=lt("batchPredictionJobs/{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>MC(u))}else{const c=AC(this.apiClient,t);return l=lt("batches/{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>RC(u))}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function sS(e){const t={},n=d(e,["apiKey"]);if(n!=null&&f(t,["apiKey"],n),d(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is not supported in Gemini API.");if(d(e,["authType"])!==void 0)throw new Error("authType parameter is not supported in Gemini API.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is not supported in Gemini API.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is not supported in Gemini API.");if(d(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is not supported in Gemini API.");if(d(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is not supported in Gemini API.");return t}function rS(e){const t={},n=d(e,["data"]);if(n!=null&&f(t,["data"],n),d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function op(e){const t={},n=d(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>RS(s))),f(t,["parts"],o)}const i=d(e,["role"]);return i!=null&&f(t,["role"],i),t}function sp(e){const t={},n=d(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>MS(s))),f(t,["parts"],o)}const i=d(e,["role"]);return i!=null&&f(t,["role"],i),t}function lS(e,t){const n={},i=d(e,["ttl"]);t!==void 0&&i!=null&&f(t,["ttl"],i);const o=d(e,["expireTime"]);t!==void 0&&o!=null&&f(t,["expireTime"],o);const s=d(e,["displayName"]);t!==void 0&&s!=null&&f(t,["displayName"],s);const r=d(e,["contents"]);if(t!==void 0&&r!=null){let u=He(r);Array.isArray(u)&&(u=u.map(h=>op(h))),f(t,["contents"],u)}const l=d(e,["systemInstruction"]);t!==void 0&&l!=null&&f(t,["systemInstruction"],op(_e(l)));const a=d(e,["tools"]);if(t!==void 0&&a!=null){let u=a;Array.isArray(u)&&(u=u.map(h=>DS(h))),f(t,["tools"],u)}const c=d(e,["toolConfig"]);if(t!==void 0&&c!=null&&f(t,["toolConfig"],PS(c)),d(e,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return n}function aS(e,t){const n={},i=d(e,["ttl"]);t!==void 0&&i!=null&&f(t,["ttl"],i);const o=d(e,["expireTime"]);t!==void 0&&o!=null&&f(t,["expireTime"],o);const s=d(e,["displayName"]);t!==void 0&&s!=null&&f(t,["displayName"],s);const r=d(e,["contents"]);if(t!==void 0&&r!=null){let h=He(r);Array.isArray(h)&&(h=h.map(p=>sp(p))),f(t,["contents"],h)}const l=d(e,["systemInstruction"]);t!==void 0&&l!=null&&f(t,["systemInstruction"],sp(_e(l)));const a=d(e,["tools"]);if(t!==void 0&&a!=null){let h=a;Array.isArray(h)&&(h=h.map(p=>NS(p))),f(t,["tools"],h)}const c=d(e,["toolConfig"]);t!==void 0&&c!=null&&f(t,["toolConfig"],kS(c));const u=d(e,["kmsKeyName"]);return t!==void 0&&u!=null&&f(t,["encryption_spec","kmsKeyName"],u),n}function cS(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["model"],Jm(e,i));const o=d(t,["config"]);return o!=null&&lS(o,n),n}function uS(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["model"],Jm(e,i));const o=d(t,["config"]);return o!=null&&aS(o,n),n}function dS(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],Kn(e,i)),n}function fS(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],Kn(e,i)),n}function hS(e){const t={},n=d(e,["sdkHttpResponse"]);return n!=null&&f(t,["sdkHttpResponse"],n),t}function pS(e){const t={},n=d(e,["sdkHttpResponse"]);return n!=null&&f(t,["sdkHttpResponse"],n),t}function gS(e){const t={};if(d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=d(e,["fileUri"]);n!=null&&f(t,["fileUri"],n);const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function mS(e){const t={},n=d(e,["id"]);n!=null&&f(t,["id"],n);const i=d(e,["args"]);i!=null&&f(t,["args"],i);const o=d(e,["name"]);if(o!=null&&f(t,["name"],o),d(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(d(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function yS(e){const t={},n=d(e,["allowedFunctionNames"]);n!=null&&f(t,["allowedFunctionNames"],n);const i=d(e,["mode"]);if(i!=null&&f(t,["mode"],i),d(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function _S(e){const t={},n=d(e,["description"]);n!=null&&f(t,["description"],n);const i=d(e,["name"]);i!=null&&f(t,["name"],i);const o=d(e,["parameters"]);o!=null&&f(t,["parameters"],o);const s=d(e,["parametersJsonSchema"]);s!=null&&f(t,["parametersJsonSchema"],s);const r=d(e,["response"]);r!=null&&f(t,["response"],r);const l=d(e,["responseJsonSchema"]);if(l!=null&&f(t,["responseJsonSchema"],l),d(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function vS(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],Kn(e,i)),n}function xS(e,t){const n={},i=d(t,["name"]);return i!=null&&f(n,["_url","name"],Kn(e,i)),n}function bS(e){const t={},n=d(e,["authConfig"]);n!=null&&f(t,["authConfig"],sS(n));const i=d(e,["enableWidget"]);return i!=null&&f(t,["enableWidget"],i),t}function ES(e){const t={},n=d(e,["searchTypes"]);if(n!=null&&f(t,["searchTypes"],n),d(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");if(d(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");const i=d(e,["timeRangeFilter"]);return i!=null&&f(t,["timeRangeFilter"],i),t}function wS(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);return t!==void 0&&o!=null&&f(t,["_query","pageToken"],o),n}function TS(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);return t!==void 0&&o!=null&&f(t,["_query","pageToken"],o),n}function CS(e){const t={},n=d(e,["config"]);return n!=null&&wS(n,t),t}function SS(e){const t={},n=d(e,["config"]);return n!=null&&TS(n,t),t}function AS(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["cachedContents"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["cachedContents"],s)}return t}function IS(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["cachedContents"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["cachedContents"],s)}return t}function RS(e){const t={},n=d(e,["mediaResolution"]);n!=null&&f(t,["mediaResolution"],n);const i=d(e,["codeExecutionResult"]);i!=null&&f(t,["codeExecutionResult"],i);const o=d(e,["executableCode"]);o!=null&&f(t,["executableCode"],o);const s=d(e,["fileData"]);s!=null&&f(t,["fileData"],gS(s));const r=d(e,["functionCall"]);r!=null&&f(t,["functionCall"],mS(r));const l=d(e,["functionResponse"]);l!=null&&f(t,["functionResponse"],l);const a=d(e,["inlineData"]);a!=null&&f(t,["inlineData"],rS(a));const c=d(e,["text"]);c!=null&&f(t,["text"],c);const u=d(e,["thought"]);u!=null&&f(t,["thought"],u);const h=d(e,["thoughtSignature"]);h!=null&&f(t,["thoughtSignature"],h);const p=d(e,["videoMetadata"]);p!=null&&f(t,["videoMetadata"],p);const g=d(e,["toolCall"]);g!=null&&f(t,["toolCall"],g);const v=d(e,["toolResponse"]);v!=null&&f(t,["toolResponse"],v);const x=d(e,["partMetadata"]);return x!=null&&f(t,["partMetadata"],x),t}function MS(e){const t={},n=d(e,["mediaResolution"]);n!=null&&f(t,["mediaResolution"],n);const i=d(e,["codeExecutionResult"]);i!=null&&f(t,["codeExecutionResult"],i);const o=d(e,["executableCode"]);o!=null&&f(t,["executableCode"],o);const s=d(e,["fileData"]);s!=null&&f(t,["fileData"],s);const r=d(e,["functionCall"]);r!=null&&f(t,["functionCall"],r);const l=d(e,["functionResponse"]);l!=null&&f(t,["functionResponse"],l);const a=d(e,["inlineData"]);a!=null&&f(t,["inlineData"],a);const c=d(e,["text"]);c!=null&&f(t,["text"],c);const u=d(e,["thought"]);u!=null&&f(t,["thought"],u);const h=d(e,["thoughtSignature"]);h!=null&&f(t,["thoughtSignature"],h);const p=d(e,["videoMetadata"]);if(p!=null&&f(t,["videoMetadata"],p),d(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function PS(e){const t={},n=d(e,["retrievalConfig"]);n!=null&&f(t,["retrievalConfig"],n);const i=d(e,["functionCallingConfig"]);i!=null&&f(t,["functionCallingConfig"],yS(i));const o=d(e,["includeServerSideToolInvocations"]);return o!=null&&f(t,["includeServerSideToolInvocations"],o),t}function kS(e){const t={},n=d(e,["retrievalConfig"]);n!=null&&f(t,["retrievalConfig"],n);const i=d(e,["functionCallingConfig"]);if(i!=null&&f(t,["functionCallingConfig"],i),d(e,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function DS(e){const t={};if(d(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=d(e,["computerUse"]);n!=null&&f(t,["computerUse"],n);const i=d(e,["fileSearch"]);i!=null&&f(t,["fileSearch"],i);const o=d(e,["googleSearch"]);o!=null&&f(t,["googleSearch"],ES(o));const s=d(e,["googleMaps"]);s!=null&&f(t,["googleMaps"],bS(s));const r=d(e,["codeExecution"]);if(r!=null&&f(t,["codeExecution"],r),d(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=d(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["functionDeclarations"],h)}const a=d(e,["googleSearchRetrieval"]);if(a!=null&&f(t,["googleSearchRetrieval"],a),d(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is not supported in Gemini API.");const c=d(e,["urlContext"]);c!=null&&f(t,["urlContext"],c);const u=d(e,["mcpServers"]);if(u!=null){let h=u;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["mcpServers"],h)}return t}function NS(e){const t={},n=d(e,["retrieval"]);n!=null&&f(t,["retrieval"],n);const i=d(e,["computerUse"]);if(i!=null&&f(t,["computerUse"],i),d(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const o=d(e,["googleSearch"]);o!=null&&f(t,["googleSearch"],o);const s=d(e,["googleMaps"]);s!=null&&f(t,["googleMaps"],s);const r=d(e,["codeExecution"]);r!=null&&f(t,["codeExecution"],r);const l=d(e,["enterpriseWebSearch"]);l!=null&&f(t,["enterpriseWebSearch"],l);const a=d(e,["functionDeclarations"]);if(a!=null){let p=a;Array.isArray(p)&&(p=p.map(g=>_S(g))),f(t,["functionDeclarations"],p)}const c=d(e,["googleSearchRetrieval"]);c!=null&&f(t,["googleSearchRetrieval"],c);const u=d(e,["parallelAiSearch"]);u!=null&&f(t,["parallelAiSearch"],u);const h=d(e,["urlContext"]);if(h!=null&&f(t,["urlContext"],h),d(e,["mcpServers"])!==void 0)throw new Error("mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function LS(e,t){const n={},i=d(e,["ttl"]);t!==void 0&&i!=null&&f(t,["ttl"],i);const o=d(e,["expireTime"]);return t!==void 0&&o!=null&&f(t,["expireTime"],o),n}function FS(e,t){const n={},i=d(e,["ttl"]);t!==void 0&&i!=null&&f(t,["ttl"],i);const o=d(e,["expireTime"]);return t!==void 0&&o!=null&&f(t,["expireTime"],o),n}function US(e,t){const n={},i=d(t,["name"]);i!=null&&f(n,["_url","name"],Kn(e,i));const o=d(t,["config"]);return o!=null&&LS(o,n),n}function BS(e,t){const n={},i=d(t,["name"]);i!=null&&f(n,["_url","name"],Kn(e,i));const o=d(t,["config"]);return o!=null&&FS(o,n),n}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class OS extends Jn{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Oi(qn.PAGED_ITEM_CACHED_CONTENTS,i=>this.listInternal(i),await this.listInternal(n),n)}async create(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=uS(this.apiClient,t);return l=lt("cachedContents",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>u)}else{const c=cS(this.apiClient,t);return l=lt("cachedContents",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async get(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=xS(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>u)}else{const c=vS(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async delete(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=fS(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=pS(u),p=new Qh;return Object.assign(p,h),p})}else{const c=dS(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=hS(u),p=new Qh;return Object.assign(p,h),p})}}async update(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=BS(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>u)}else{const c=US(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async listInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=SS(t);return l=lt("cachedContents",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=IS(u),p=new Zh;return Object.assign(p,h),p})}else{const c=CS(t);return l=lt("cachedContents",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=AS(u),p=new Zh;return Object.assign(p,h),p})}}}function si(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(e);o=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wt(e){return this instanceof wt?(this.v=e,this):new wt(e)}function rn(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(e,t||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",r),o[Symbol.asyncIterator]=function(){return this},o;function r(g){return function(v){return Promise.resolve(v).then(g,h)}}function l(g,v){i[g]&&(o[g]=function(x){return new Promise(function(E,T){s.push([g,x,E,T])>1||a(g,x)})},v&&(o[g]=v(o[g])))}function a(g,v){try{c(i[g](v))}catch(x){p(s[0][3],x)}}function c(g){g.value instanceof wt?Promise.resolve(g.value.v).then(u,h):p(s[0][2],g)}function u(g){a("next",g)}function h(g){a("throw",g)}function p(g,v){g(v),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ln(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 rp=="function"?rp(e):e[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=e[s]&&function(r){return new Promise(function(l,a){r=e[s](r),o(l,a,r.done,r.value)})}}function o(s,r,l,a){Promise.resolve(a).then(function(c){s({value:c,done:l})},r)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function VS(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:r0(n)}function r0(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 GS(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 lp(e){if(e===void 0||e.length===0)return[];const t=[],n=e.length;let i=0;for(;i{var s,r,l;const a=await o,c=(r=(s=a.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content,u=a.automaticFunctionCallingHistory,h=this.getHistory(!0).length;let p=[];u!=null&&(p=(l=u.slice(h))!==null&&l!==void 0?l:[]);const g=c?[c]:[];this.recordHistory(i,g,p)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),o}async sendMessageStream(t){var n;await this.sendPromise;const i=_e(t.message),o=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(i),config:(n=t.config)!==null&&n!==void 0?n:this.config});this.sendPromise=o.then(()=>{}).catch(()=>{});const s=await o;return this.processStreamResponse(s,i)}getHistory(t=!1){const n=t?lp(this.history):this.history;return structuredClone(n)}processStreamResponse(t,n){return rn(this,arguments,function*(){var o,s,r,l,a,c;const u=[];try{for(var h=!0,p=ln(t),g;g=yield wt(p.next()),o=g.done,!o;h=!0){l=g.value,h=!1;const v=l;if(VS(v)){const x=(c=(a=v.candidates)===null||a===void 0?void 0:a[0])===null||c===void 0?void 0:c.content;x!==void 0&&u.push(x)}yield yield wt(v)}}catch(v){s={error:v}}finally{try{!h&&!o&&(r=p.return)&&(yield wt(r.call(p)))}finally{if(s)throw s.error}}this.recordHistory(n,u)})}recordHistory(t,n,i){let o=[];n.length>0&&n.every(s=>s.role!==void 0)?o=n:o.push({role:"model",parts:[]}),i&&i.length>0?this.history.push(...lp(i)):this.history.push(t),this.history.push(...o)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class vl extends Error{constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,vl.prototype)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function qS(e){const t={},n=d(e,["file"]);return n!=null&&f(t,["file"],n),t}function zS(e){const t={},n=d(e,["sdkHttpResponse"]);return n!=null&&f(t,["sdkHttpResponse"],n),t}function WS(e){const t={},n=d(e,["name"]);return n!=null&&f(t,["_url","file"],jm(n)),t}function JS(e){const t={},n=d(e,["sdkHttpResponse"]);return n!=null&&f(t,["sdkHttpResponse"],n),t}function KS(e){const t={},n=d(e,["name"]);return n!=null&&f(t,["_url","file"],jm(n)),t}function YS(e){const t={},n=d(e,["uris"]);return n!=null&&f(t,["uris"],n),t}function XS(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);return t!==void 0&&o!=null&&f(t,["_query","pageToken"],o),n}function QS(e){const t={},n=d(e,["config"]);return n!=null&&XS(n,t),t}function ZS(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["files"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["files"],s)}return t}function jS(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["files"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>s)),f(t,["files"],o)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class tA extends Jn{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Oi(qn.PAGED_ITEM_FILES,i=>this.listInternal(i),await this.listInternal(n),n)}async upload(t){if(this.apiClient.isVertexAI())throw new Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(t.file,t.config).then(n=>n)}async download(t){await this.apiClient.downloadFile(t)}async registerFiles(t){throw new Error("registerFiles is only supported in Node.js environments.")}async _registerFiles(t){return this.registerFilesInternal(t)}async listInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=QS(t);return s=lt("files",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>{const c=ZS(a),u=new K1;return Object.assign(u,c),u})}}async createInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=qS(t);return s=lt("upload/v1beta/files",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=zS(a),u=new Y1;return Object.assign(u,c),u})}}async get(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=KS(t);return s=lt("files/{file}",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>a)}}async delete(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=WS(t);return s=lt("files/{file}",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>{const c=JS(a),u=new X1;return Object.assign(u,c),u})}}async registerFilesInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=YS(t);return s=lt("files:register",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=jS(a),u=new Q1;return Object.assign(u,c),u})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function ap(e){const t={};if(d(e,["languageCodes"])!==void 0)throw new Error("languageCodes parameter is not supported in Gemini API.");return t}function eA(e){const t={},n=d(e,["apiKey"]);if(n!=null&&f(t,["apiKey"],n),d(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is not supported in Gemini API.");if(d(e,["authType"])!==void 0)throw new Error("authType parameter is not supported in Gemini API.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is not supported in Gemini API.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is not supported in Gemini API.");if(d(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is not supported in Gemini API.");if(d(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is not supported in Gemini API.");return t}function Er(e){const t={},n=d(e,["data"]);if(n!=null&&f(t,["data"],n),d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function nA(e){const t={},n=d(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>vA(s))),f(t,["parts"],o)}const i=d(e,["role"]);return i!=null&&f(t,["role"],i),t}function iA(e){const t={},n=d(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>xA(s))),f(t,["parts"],o)}const i=d(e,["role"]);return i!=null&&f(t,["role"],i),t}function oA(e){const t={};if(d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=d(e,["fileUri"]);n!=null&&f(t,["fileUri"],n);const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function sA(e){const t={},n=d(e,["id"]);n!=null&&f(t,["id"],n);const i=d(e,["args"]);i!=null&&f(t,["args"],i);const o=d(e,["name"]);if(o!=null&&f(t,["name"],o),d(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(d(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function rA(e){const t={},n=d(e,["description"]);n!=null&&f(t,["description"],n);const i=d(e,["name"]);i!=null&&f(t,["name"],i);const o=d(e,["parameters"]);o!=null&&f(t,["parameters"],o);const s=d(e,["parametersJsonSchema"]);s!=null&&f(t,["parametersJsonSchema"],s);const r=d(e,["response"]);r!=null&&f(t,["response"],r);const l=d(e,["responseJsonSchema"]);if(l!=null&&f(t,["responseJsonSchema"],l),d(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function lA(e){const t={},n=d(e,["modelSelectionConfig"]);n!=null&&f(t,["modelConfig"],n);const i=d(e,["responseJsonSchema"]);i!=null&&f(t,["responseJsonSchema"],i);const o=d(e,["audioTimestamp"]);o!=null&&f(t,["audioTimestamp"],o);const s=d(e,["candidateCount"]);s!=null&&f(t,["candidateCount"],s);const r=d(e,["enableAffectiveDialog"]);r!=null&&f(t,["enableAffectiveDialog"],r);const l=d(e,["frequencyPenalty"]);l!=null&&f(t,["frequencyPenalty"],l);const a=d(e,["logprobs"]);a!=null&&f(t,["logprobs"],a);const c=d(e,["maxOutputTokens"]);c!=null&&f(t,["maxOutputTokens"],c);const u=d(e,["mediaResolution"]);u!=null&&f(t,["mediaResolution"],u);const h=d(e,["presencePenalty"]);h!=null&&f(t,["presencePenalty"],h);const p=d(e,["responseLogprobs"]);p!=null&&f(t,["responseLogprobs"],p);const g=d(e,["responseMimeType"]);g!=null&&f(t,["responseMimeType"],g);const v=d(e,["responseModalities"]);v!=null&&f(t,["responseModalities"],v);const x=d(e,["responseSchema"]);x!=null&&f(t,["responseSchema"],x);const E=d(e,["routingConfig"]);E!=null&&f(t,["routingConfig"],E);const T=d(e,["seed"]);T!=null&&f(t,["seed"],T);const A=d(e,["speechConfig"]);A!=null&&f(t,["speechConfig"],A);const I=d(e,["stopSequences"]);I!=null&&f(t,["stopSequences"],I);const M=d(e,["temperature"]);M!=null&&f(t,["temperature"],M);const D=d(e,["thinkingConfig"]);D!=null&&f(t,["thinkingConfig"],D);const P=d(e,["topK"]);P!=null&&f(t,["topK"],P);const B=d(e,["topP"]);if(B!=null&&f(t,["topP"],B),d(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function aA(e){const t={},n=d(e,["authConfig"]);n!=null&&f(t,["authConfig"],eA(n));const i=d(e,["enableWidget"]);return i!=null&&f(t,["enableWidget"],i),t}function cA(e){const t={},n=d(e,["searchTypes"]);if(n!=null&&f(t,["searchTypes"],n),d(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");if(d(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");const i=d(e,["timeRangeFilter"]);return i!=null&&f(t,["timeRangeFilter"],i),t}function uA(e,t){const n={},i=d(e,["generationConfig"]);t!==void 0&&i!=null&&f(t,["setup","generationConfig"],i);const o=d(e,["responseModalities"]);t!==void 0&&o!=null&&f(t,["setup","generationConfig","responseModalities"],o);const s=d(e,["temperature"]);t!==void 0&&s!=null&&f(t,["setup","generationConfig","temperature"],s);const r=d(e,["topP"]);t!==void 0&&r!=null&&f(t,["setup","generationConfig","topP"],r);const l=d(e,["topK"]);t!==void 0&&l!=null&&f(t,["setup","generationConfig","topK"],l);const a=d(e,["maxOutputTokens"]);t!==void 0&&a!=null&&f(t,["setup","generationConfig","maxOutputTokens"],a);const c=d(e,["mediaResolution"]);t!==void 0&&c!=null&&f(t,["setup","generationConfig","mediaResolution"],c);const u=d(e,["seed"]);t!==void 0&&u!=null&&f(t,["setup","generationConfig","seed"],u);const h=d(e,["speechConfig"]);t!==void 0&&h!=null&&f(t,["setup","generationConfig","speechConfig"],su(h));const p=d(e,["thinkingConfig"]);t!==void 0&&p!=null&&f(t,["setup","generationConfig","thinkingConfig"],p);const g=d(e,["enableAffectiveDialog"]);t!==void 0&&g!=null&&f(t,["setup","generationConfig","enableAffectiveDialog"],g);const v=d(e,["systemInstruction"]);t!==void 0&&v!=null&&f(t,["setup","systemInstruction"],nA(_e(v)));const x=d(e,["tools"]);if(t!==void 0&&x!=null){let U=ho(x);Array.isArray(U)&&(U=U.map(V=>wA(fo(V)))),f(t,["setup","tools"],U)}const E=d(e,["sessionResumption"]);t!==void 0&&E!=null&&f(t,["setup","sessionResumption"],EA(E));const T=d(e,["inputAudioTranscription"]);t!==void 0&&T!=null&&f(t,["setup","inputAudioTranscription"],ap(T));const A=d(e,["outputAudioTranscription"]);t!==void 0&&A!=null&&f(t,["setup","outputAudioTranscription"],ap(A));const I=d(e,["realtimeInputConfig"]);t!==void 0&&I!=null&&f(t,["setup","realtimeInputConfig"],I);const M=d(e,["contextWindowCompression"]);t!==void 0&&M!=null&&f(t,["setup","contextWindowCompression"],M);const D=d(e,["proactivity"]);if(t!==void 0&&D!=null&&f(t,["setup","proactivity"],D),d(e,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");const P=d(e,["avatarConfig"]);t!==void 0&&P!=null&&f(t,["setup","avatarConfig"],P);const B=d(e,["safetySettings"]);if(t!==void 0&&B!=null){let U=B;Array.isArray(U)&&(U=U.map(V=>bA(V))),f(t,["setup","safetySettings"],U)}return n}function dA(e,t){const n={},i=d(e,["generationConfig"]);t!==void 0&&i!=null&&f(t,["setup","generationConfig"],lA(i));const o=d(e,["responseModalities"]);t!==void 0&&o!=null&&f(t,["setup","generationConfig","responseModalities"],o);const s=d(e,["temperature"]);t!==void 0&&s!=null&&f(t,["setup","generationConfig","temperature"],s);const r=d(e,["topP"]);t!==void 0&&r!=null&&f(t,["setup","generationConfig","topP"],r);const l=d(e,["topK"]);t!==void 0&&l!=null&&f(t,["setup","generationConfig","topK"],l);const a=d(e,["maxOutputTokens"]);t!==void 0&&a!=null&&f(t,["setup","generationConfig","maxOutputTokens"],a);const c=d(e,["mediaResolution"]);t!==void 0&&c!=null&&f(t,["setup","generationConfig","mediaResolution"],c);const u=d(e,["seed"]);t!==void 0&&u!=null&&f(t,["setup","generationConfig","seed"],u);const h=d(e,["speechConfig"]);t!==void 0&&h!=null&&f(t,["setup","generationConfig","speechConfig"],su(h));const p=d(e,["thinkingConfig"]);t!==void 0&&p!=null&&f(t,["setup","generationConfig","thinkingConfig"],p);const g=d(e,["enableAffectiveDialog"]);t!==void 0&&g!=null&&f(t,["setup","generationConfig","enableAffectiveDialog"],g);const v=d(e,["systemInstruction"]);t!==void 0&&v!=null&&f(t,["setup","systemInstruction"],iA(_e(v)));const x=d(e,["tools"]);if(t!==void 0&&x!=null){let V=ho(x);Array.isArray(V)&&(V=V.map(W=>TA(fo(W)))),f(t,["setup","tools"],V)}const E=d(e,["sessionResumption"]);t!==void 0&&E!=null&&f(t,["setup","sessionResumption"],E);const T=d(e,["inputAudioTranscription"]);t!==void 0&&T!=null&&f(t,["setup","inputAudioTranscription"],T);const A=d(e,["outputAudioTranscription"]);t!==void 0&&A!=null&&f(t,["setup","outputAudioTranscription"],A);const I=d(e,["realtimeInputConfig"]);t!==void 0&&I!=null&&f(t,["setup","realtimeInputConfig"],I);const M=d(e,["contextWindowCompression"]);t!==void 0&&M!=null&&f(t,["setup","contextWindowCompression"],M);const D=d(e,["proactivity"]);t!==void 0&&D!=null&&f(t,["setup","proactivity"],D);const P=d(e,["explicitVadSignal"]);t!==void 0&&P!=null&&f(t,["setup","explicitVadSignal"],P);const B=d(e,["avatarConfig"]);t!==void 0&&B!=null&&f(t,["setup","avatarConfig"],B);const U=d(e,["safetySettings"]);if(t!==void 0&&U!=null){let V=U;Array.isArray(V)&&(V=V.map(W=>W)),f(t,["setup","safetySettings"],V)}return n}function fA(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["setup","model"],Bt(e,i));const o=d(t,["config"]);return o!=null&&f(n,["config"],uA(o,n)),n}function hA(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["setup","model"],Bt(e,i));const o=d(t,["config"]);return o!=null&&f(n,["config"],dA(o,n)),n}function pA(e){const t={},n=d(e,["musicGenerationConfig"]);return n!=null&&f(t,["musicGenerationConfig"],n),t}function gA(e){const t={},n=d(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),f(t,["weightedPrompts"],i)}return t}function mA(e){const t={},n=d(e,["media"]);if(n!=null){let c=Km(n);Array.isArray(c)&&(c=c.map(u=>Er(u))),f(t,["mediaChunks"],c)}const i=d(e,["audio"]);i!=null&&f(t,["audio"],Er(Xm(i)));const o=d(e,["audioStreamEnd"]);o!=null&&f(t,["audioStreamEnd"],o);const s=d(e,["video"]);s!=null&&f(t,["video"],Er(Ym(s)));const r=d(e,["text"]);r!=null&&f(t,["text"],r);const l=d(e,["activityStart"]);l!=null&&f(t,["activityStart"],l);const a=d(e,["activityEnd"]);return a!=null&&f(t,["activityEnd"],a),t}function yA(e){const t={},n=d(e,["media"]);if(n!=null){let c=Km(n);Array.isArray(c)&&(c=c.map(u=>u)),f(t,["mediaChunks"],c)}const i=d(e,["audio"]);i!=null&&f(t,["audio"],Xm(i));const o=d(e,["audioStreamEnd"]);o!=null&&f(t,["audioStreamEnd"],o);const s=d(e,["video"]);s!=null&&f(t,["video"],Ym(s));const r=d(e,["text"]);r!=null&&f(t,["text"],r);const l=d(e,["activityStart"]);l!=null&&f(t,["activityStart"],l);const a=d(e,["activityEnd"]);return a!=null&&f(t,["activityEnd"],a),t}function _A(e){const t={},n=d(e,["setupComplete"]);n!=null&&f(t,["setupComplete"],n);const i=d(e,["serverContent"]);i!=null&&f(t,["serverContent"],i);const o=d(e,["toolCall"]);o!=null&&f(t,["toolCall"],o);const s=d(e,["toolCallCancellation"]);s!=null&&f(t,["toolCallCancellation"],s);const r=d(e,["usageMetadata"]);r!=null&&f(t,["usageMetadata"],CA(r));const l=d(e,["goAway"]);l!=null&&f(t,["goAway"],l);const a=d(e,["sessionResumptionUpdate"]);a!=null&&f(t,["sessionResumptionUpdate"],a);const c=d(e,["voiceActivityDetectionSignal"]);c!=null&&f(t,["voiceActivityDetectionSignal"],c);const u=d(e,["voiceActivity"]);return u!=null&&f(t,["voiceActivity"],SA(u)),t}function vA(e){const t={},n=d(e,["mediaResolution"]);n!=null&&f(t,["mediaResolution"],n);const i=d(e,["codeExecutionResult"]);i!=null&&f(t,["codeExecutionResult"],i);const o=d(e,["executableCode"]);o!=null&&f(t,["executableCode"],o);const s=d(e,["fileData"]);s!=null&&f(t,["fileData"],oA(s));const r=d(e,["functionCall"]);r!=null&&f(t,["functionCall"],sA(r));const l=d(e,["functionResponse"]);l!=null&&f(t,["functionResponse"],l);const a=d(e,["inlineData"]);a!=null&&f(t,["inlineData"],Er(a));const c=d(e,["text"]);c!=null&&f(t,["text"],c);const u=d(e,["thought"]);u!=null&&f(t,["thought"],u);const h=d(e,["thoughtSignature"]);h!=null&&f(t,["thoughtSignature"],h);const p=d(e,["videoMetadata"]);p!=null&&f(t,["videoMetadata"],p);const g=d(e,["toolCall"]);g!=null&&f(t,["toolCall"],g);const v=d(e,["toolResponse"]);v!=null&&f(t,["toolResponse"],v);const x=d(e,["partMetadata"]);return x!=null&&f(t,["partMetadata"],x),t}function xA(e){const t={},n=d(e,["mediaResolution"]);n!=null&&f(t,["mediaResolution"],n);const i=d(e,["codeExecutionResult"]);i!=null&&f(t,["codeExecutionResult"],i);const o=d(e,["executableCode"]);o!=null&&f(t,["executableCode"],o);const s=d(e,["fileData"]);s!=null&&f(t,["fileData"],s);const r=d(e,["functionCall"]);r!=null&&f(t,["functionCall"],r);const l=d(e,["functionResponse"]);l!=null&&f(t,["functionResponse"],l);const a=d(e,["inlineData"]);a!=null&&f(t,["inlineData"],a);const c=d(e,["text"]);c!=null&&f(t,["text"],c);const u=d(e,["thought"]);u!=null&&f(t,["thought"],u);const h=d(e,["thoughtSignature"]);h!=null&&f(t,["thoughtSignature"],h);const p=d(e,["videoMetadata"]);if(p!=null&&f(t,["videoMetadata"],p),d(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function bA(e){const t={},n=d(e,["category"]);if(n!=null&&f(t,["category"],n),d(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const i=d(e,["threshold"]);return i!=null&&f(t,["threshold"],i),t}function EA(e){const t={},n=d(e,["handle"]);if(n!=null&&f(t,["handle"],n),d(e,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function wA(e){const t={};if(d(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=d(e,["computerUse"]);n!=null&&f(t,["computerUse"],n);const i=d(e,["fileSearch"]);i!=null&&f(t,["fileSearch"],i);const o=d(e,["googleSearch"]);o!=null&&f(t,["googleSearch"],cA(o));const s=d(e,["googleMaps"]);s!=null&&f(t,["googleMaps"],aA(s));const r=d(e,["codeExecution"]);if(r!=null&&f(t,["codeExecution"],r),d(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=d(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["functionDeclarations"],h)}const a=d(e,["googleSearchRetrieval"]);if(a!=null&&f(t,["googleSearchRetrieval"],a),d(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is not supported in Gemini API.");const c=d(e,["urlContext"]);c!=null&&f(t,["urlContext"],c);const u=d(e,["mcpServers"]);if(u!=null){let h=u;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["mcpServers"],h)}return t}function TA(e){const t={},n=d(e,["retrieval"]);n!=null&&f(t,["retrieval"],n);const i=d(e,["computerUse"]);if(i!=null&&f(t,["computerUse"],i),d(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const o=d(e,["googleSearch"]);o!=null&&f(t,["googleSearch"],o);const s=d(e,["googleMaps"]);s!=null&&f(t,["googleMaps"],s);const r=d(e,["codeExecution"]);r!=null&&f(t,["codeExecution"],r);const l=d(e,["enterpriseWebSearch"]);l!=null&&f(t,["enterpriseWebSearch"],l);const a=d(e,["functionDeclarations"]);if(a!=null){let p=a;Array.isArray(p)&&(p=p.map(g=>rA(g))),f(t,["functionDeclarations"],p)}const c=d(e,["googleSearchRetrieval"]);c!=null&&f(t,["googleSearchRetrieval"],c);const u=d(e,["parallelAiSearch"]);u!=null&&f(t,["parallelAiSearch"],u);const h=d(e,["urlContext"]);if(h!=null&&f(t,["urlContext"],h),d(e,["mcpServers"])!==void 0)throw new Error("mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return t}function CA(e){const t={},n=d(e,["promptTokenCount"]);n!=null&&f(t,["promptTokenCount"],n);const i=d(e,["cachedContentTokenCount"]);i!=null&&f(t,["cachedContentTokenCount"],i);const o=d(e,["candidatesTokenCount"]);o!=null&&f(t,["responseTokenCount"],o);const s=d(e,["toolUsePromptTokenCount"]);s!=null&&f(t,["toolUsePromptTokenCount"],s);const r=d(e,["thoughtsTokenCount"]);r!=null&&f(t,["thoughtsTokenCount"],r);const l=d(e,["totalTokenCount"]);l!=null&&f(t,["totalTokenCount"],l);const a=d(e,["promptTokensDetails"]);if(a!=null){let g=a;Array.isArray(g)&&(g=g.map(v=>v)),f(t,["promptTokensDetails"],g)}const c=d(e,["cacheTokensDetails"]);if(c!=null){let g=c;Array.isArray(g)&&(g=g.map(v=>v)),f(t,["cacheTokensDetails"],g)}const u=d(e,["candidatesTokensDetails"]);if(u!=null){let g=u;Array.isArray(g)&&(g=g.map(v=>v)),f(t,["responseTokensDetails"],g)}const h=d(e,["toolUsePromptTokensDetails"]);if(h!=null){let g=h;Array.isArray(g)&&(g=g.map(v=>v)),f(t,["toolUsePromptTokensDetails"],g)}const p=d(e,["trafficType"]);return p!=null&&f(t,["trafficType"],p),t}function SA(e){const t={},n=d(e,["type"]);return n!=null&&f(t,["voiceActivityType"],n),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function AA(e,t){const n={},i=d(e,["apiKey"]);if(i!=null&&f(n,["apiKey"],i),d(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is not supported in Gemini API.");if(d(e,["authType"])!==void 0)throw new Error("authType parameter is not supported in Gemini API.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is not supported in Gemini API.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is not supported in Gemini API.");if(d(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is not supported in Gemini API.");if(d(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is not supported in Gemini API.");return n}function IA(e,t){const n={},i=d(e,["data"]);if(i!=null&&f(n,["data"],i),d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const o=d(e,["mimeType"]);return o!=null&&f(n,["mimeType"],o),n}function RA(e,t){const n={},i=d(e,["content"]);i!=null&&f(n,["content"],i);const o=d(e,["citationMetadata"]);o!=null&&f(n,["citationMetadata"],MA(o));const s=d(e,["tokenCount"]);s!=null&&f(n,["tokenCount"],s);const r=d(e,["finishReason"]);r!=null&&f(n,["finishReason"],r);const l=d(e,["groundingMetadata"]);l!=null&&f(n,["groundingMetadata"],l);const a=d(e,["avgLogprobs"]);a!=null&&f(n,["avgLogprobs"],a);const c=d(e,["index"]);c!=null&&f(n,["index"],c);const u=d(e,["logprobsResult"]);u!=null&&f(n,["logprobsResult"],u);const h=d(e,["safetyRatings"]);if(h!=null){let g=h;Array.isArray(g)&&(g=g.map(v=>v)),f(n,["safetyRatings"],g)}const p=d(e,["urlContextMetadata"]);return p!=null&&f(n,["urlContextMetadata"],p),n}function MA(e,t){const n={},i=d(e,["citationSources"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>s)),f(n,["citations"],o)}return n}function PA(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["contents"]);if(s!=null){let r=He(s);Array.isArray(r)&&(r=r.map(l=>go(l))),f(i,["contents"],r)}return i}function kA(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["tokensInfo"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(n,["tokensInfo"],s)}return n}function DA(e,t){const n={},i=d(e,["values"]);i!=null&&f(n,["values"],i);const o=d(e,["statistics"]);return o!=null&&f(n,["statistics"],NA(o)),n}function NA(e,t){const n={},i=d(e,["truncated"]);i!=null&&f(n,["truncated"],i);const o=d(e,["token_count"]);return o!=null&&f(n,["tokenCount"],o),n}function xs(e,t){const n={},i=d(e,["parts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>$I(r))),f(n,["parts"],s)}const o=d(e,["role"]);return o!=null&&f(n,["role"],o),n}function go(e,t){const n={},i=d(e,["parts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>qI(r))),f(n,["parts"],s)}const o=d(e,["role"]);return o!=null&&f(n,["role"],o),n}function LA(e,t){const n={},i=d(e,["controlType"]);i!=null&&f(n,["controlType"],i);const o=d(e,["enableControlImageComputation"]);return o!=null&&f(n,["computeControl"],o),n}function FA(e,t){const n={};if(d(e,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(d(e,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(d(e,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return n}function UA(e,t,n){const i={},o=d(e,["systemInstruction"]);t!==void 0&&o!=null&&f(t,["systemInstruction"],go(_e(o)));const s=d(e,["tools"]);if(t!==void 0&&s!=null){let l=s;Array.isArray(l)&&(l=l.map(a=>u0(a))),f(t,["tools"],l)}const r=d(e,["generationConfig"]);return t!==void 0&&r!=null&&f(t,["generationConfig"],II(r)),i}function BA(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["contents"]);if(s!=null){let l=He(s);Array.isArray(l)&&(l=l.map(a=>xs(a))),f(i,["contents"],l)}const r=d(t,["config"]);return r!=null&&FA(r),i}function OA(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["contents"]);if(s!=null){let l=He(s);Array.isArray(l)&&(l=l.map(a=>go(a))),f(i,["contents"],l)}const r=d(t,["config"]);return r!=null&&UA(r,i),i}function VA(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["totalTokens"]);o!=null&&f(n,["totalTokens"],o);const s=d(e,["cachedContentTokenCount"]);return s!=null&&f(n,["cachedContentTokenCount"],s),n}function GA(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["totalTokens"]);return o!=null&&f(n,["totalTokens"],o),n}function HA(e,t,n){const i={},o=d(t,["model"]);return o!=null&&f(i,["_url","name"],Bt(e,o)),i}function $A(e,t,n){const i={},o=d(t,["model"]);return o!=null&&f(i,["_url","name"],Bt(e,o)),i}function qA(e,t){const n={},i=d(e,["sdkHttpResponse"]);return i!=null&&f(n,["sdkHttpResponse"],i),n}function zA(e,t){const n={},i=d(e,["sdkHttpResponse"]);return i!=null&&f(n,["sdkHttpResponse"],i),n}function WA(e,t,n){const i={},o=d(e,["outputGcsUri"]);t!==void 0&&o!=null&&f(t,["parameters","storageUri"],o);const s=d(e,["negativePrompt"]);t!==void 0&&s!=null&&f(t,["parameters","negativePrompt"],s);const r=d(e,["numberOfImages"]);t!==void 0&&r!=null&&f(t,["parameters","sampleCount"],r);const l=d(e,["aspectRatio"]);t!==void 0&&l!=null&&f(t,["parameters","aspectRatio"],l);const a=d(e,["guidanceScale"]);t!==void 0&&a!=null&&f(t,["parameters","guidanceScale"],a);const c=d(e,["seed"]);t!==void 0&&c!=null&&f(t,["parameters","seed"],c);const u=d(e,["safetyFilterLevel"]);t!==void 0&&u!=null&&f(t,["parameters","safetySetting"],u);const h=d(e,["personGeneration"]);t!==void 0&&h!=null&&f(t,["parameters","personGeneration"],h);const p=d(e,["includeSafetyAttributes"]);t!==void 0&&p!=null&&f(t,["parameters","includeSafetyAttributes"],p);const g=d(e,["includeRaiReason"]);t!==void 0&&g!=null&&f(t,["parameters","includeRaiReason"],g);const v=d(e,["language"]);t!==void 0&&v!=null&&f(t,["parameters","language"],v);const x=d(e,["outputMimeType"]);t!==void 0&&x!=null&&f(t,["parameters","outputOptions","mimeType"],x);const E=d(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&f(t,["parameters","outputOptions","compressionQuality"],E);const T=d(e,["addWatermark"]);t!==void 0&&T!=null&&f(t,["parameters","addWatermark"],T);const A=d(e,["labels"]);t!==void 0&&A!=null&&f(t,["labels"],A);const I=d(e,["editMode"]);t!==void 0&&I!=null&&f(t,["parameters","editMode"],I);const M=d(e,["baseSteps"]);return t!==void 0&&M!=null&&f(t,["parameters","editConfig","baseSteps"],M),i}function JA(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["prompt"]);s!=null&&f(i,["instances[0]","prompt"],s);const r=d(t,["referenceImages"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(c=>XI(c))),f(i,["instances[0]","referenceImages"],a)}const l=d(t,["config"]);return l!=null&&WA(l,i),i}function KA(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["predictions"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>xl(r))),f(n,["generatedImages"],s)}return n}function YA(e,t,n){const i={},o=d(e,["taskType"]);t!==void 0&&o!=null&&f(t,["requests[]","taskType"],o);const s=d(e,["title"]);t!==void 0&&s!=null&&f(t,["requests[]","title"],s);const r=d(e,["outputDimensionality"]);if(t!==void 0&&r!=null&&f(t,["requests[]","outputDimensionality"],r),d(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(d(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");if(d(e,["documentOcr"])!==void 0)throw new Error("documentOcr parameter is not supported in Gemini API.");if(d(e,["audioTrackExtraction"])!==void 0)throw new Error("audioTrackExtraction parameter is not supported in Gemini API.");return i}function XA(e,t,n){const i={};let o=d(n,["embeddingApiType"]);if(o===void 0&&(o="PREDICT"),o==="PREDICT"){const h=d(e,["taskType"]);t!==void 0&&h!=null&&f(t,["instances[]","task_type"],h)}else if(o==="EMBED_CONTENT"){const h=d(e,["taskType"]);t!==void 0&&h!=null&&f(t,["embedContentConfig","taskType"],h)}let s=d(n,["embeddingApiType"]);if(s===void 0&&(s="PREDICT"),s==="PREDICT"){const h=d(e,["title"]);t!==void 0&&h!=null&&f(t,["instances[]","title"],h)}else if(s==="EMBED_CONTENT"){const h=d(e,["title"]);t!==void 0&&h!=null&&f(t,["embedContentConfig","title"],h)}let r=d(n,["embeddingApiType"]);if(r===void 0&&(r="PREDICT"),r==="PREDICT"){const h=d(e,["outputDimensionality"]);t!==void 0&&h!=null&&f(t,["parameters","outputDimensionality"],h)}else if(r==="EMBED_CONTENT"){const h=d(e,["outputDimensionality"]);t!==void 0&&h!=null&&f(t,["embedContentConfig","outputDimensionality"],h)}let l=d(n,["embeddingApiType"]);if(l===void 0&&(l="PREDICT"),l==="PREDICT"){const h=d(e,["mimeType"]);t!==void 0&&h!=null&&f(t,["instances[]","mimeType"],h)}let a=d(n,["embeddingApiType"]);if(a===void 0&&(a="PREDICT"),a==="PREDICT"){const h=d(e,["autoTruncate"]);t!==void 0&&h!=null&&f(t,["parameters","autoTruncate"],h)}else if(a==="EMBED_CONTENT"){const h=d(e,["autoTruncate"]);t!==void 0&&h!=null&&f(t,["embedContentConfig","autoTruncate"],h)}let c=d(n,["embeddingApiType"]);if(c===void 0&&(c="PREDICT"),c==="EMBED_CONTENT"){const h=d(e,["documentOcr"]);t!==void 0&&h!=null&&f(t,["embedContentConfig","documentOcr"],h)}let u=d(n,["embeddingApiType"]);if(u===void 0&&(u="PREDICT"),u==="EMBED_CONTENT"){const h=d(e,["audioTrackExtraction"]);t!==void 0&&h!=null&&f(t,["embedContentConfig","audioTrackExtraction"],h)}return i}function QA(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["contents"]);if(s!=null){let c=nu(e,s);Array.isArray(c)&&(c=c.map(u=>u)),f(i,["requests[]","content"],c)}const r=d(t,["content"]);r!=null&&xs(_e(r));const l=d(t,["config"]);l!=null&&YA(l,i);const a=d(t,["model"]);return a!==void 0&&f(i,["requests[]","model"],Bt(e,a)),i}function ZA(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));let s=d(n,["embeddingApiType"]);if(s===void 0&&(s="PREDICT"),s==="PREDICT"){const a=d(t,["contents"]);if(a!=null){let c=nu(e,a);Array.isArray(c)&&(c=c.map(u=>u)),f(i,["instances[]","content"],c)}}let r=d(n,["embeddingApiType"]);if(r===void 0&&(r="PREDICT"),r==="EMBED_CONTENT"){const a=d(t,["content"]);a!=null&&f(i,["content"],go(_e(a)))}const l=d(t,["config"]);return l!=null&&XA(l,i,n),i}function jA(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["embeddings"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(l=>l)),f(n,["embeddings"],r)}const s=d(e,["metadata"]);return s!=null&&f(n,["metadata"],s),n}function tI(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["predictions[]","embeddings"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(l=>DA(l))),f(n,["embeddings"],r)}const s=d(e,["metadata"]);if(s!=null&&f(n,["metadata"],s),t&&d(t,["embeddingApiType"])==="EMBED_CONTENT"){const r=d(e,["embedding"]),l=d(e,["usageMetadata"]),a=d(e,["truncated"]);if(r){const c={};l&&l.promptTokenCount&&(c.tokenCount=l.promptTokenCount),a&&(c.truncated=a),r.statistics=c,f(n,["embeddings"],[r])}}return n}function eI(e,t){const n={},i=d(e,["endpoint"]);i!=null&&f(n,["name"],i);const o=d(e,["deployedModelId"]);return o!=null&&f(n,["deployedModelId"],o),n}function nI(e,t){const n={};if(d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=d(e,["fileUri"]);i!=null&&f(n,["fileUri"],i);const o=d(e,["mimeType"]);return o!=null&&f(n,["mimeType"],o),n}function iI(e,t){const n={},i=d(e,["id"]);i!=null&&f(n,["id"],i);const o=d(e,["args"]);o!=null&&f(n,["args"],o);const s=d(e,["name"]);if(s!=null&&f(n,["name"],s),d(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(d(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return n}function oI(e,t){const n={},i=d(e,["allowedFunctionNames"]);i!=null&&f(n,["allowedFunctionNames"],i);const o=d(e,["mode"]);if(o!=null&&f(n,["mode"],o),d(e,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return n}function sI(e,t){const n={},i=d(e,["description"]);i!=null&&f(n,["description"],i);const o=d(e,["name"]);o!=null&&f(n,["name"],o);const s=d(e,["parameters"]);s!=null&&f(n,["parameters"],s);const r=d(e,["parametersJsonSchema"]);r!=null&&f(n,["parametersJsonSchema"],r);const l=d(e,["response"]);l!=null&&f(n,["response"],l);const a=d(e,["responseJsonSchema"]);if(a!=null&&f(n,["responseJsonSchema"],a),d(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return n}function rI(e,t,n,i){const o={},s=d(t,["systemInstruction"]);n!==void 0&&s!=null&&f(n,["systemInstruction"],xs(_e(s)));const r=d(t,["temperature"]);r!=null&&f(o,["temperature"],r);const l=d(t,["topP"]);l!=null&&f(o,["topP"],l);const a=d(t,["topK"]);a!=null&&f(o,["topK"],a);const c=d(t,["candidateCount"]);c!=null&&f(o,["candidateCount"],c);const u=d(t,["maxOutputTokens"]);u!=null&&f(o,["maxOutputTokens"],u);const h=d(t,["stopSequences"]);h!=null&&f(o,["stopSequences"],h);const p=d(t,["responseLogprobs"]);p!=null&&f(o,["responseLogprobs"],p);const g=d(t,["logprobs"]);g!=null&&f(o,["logprobs"],g);const v=d(t,["presencePenalty"]);v!=null&&f(o,["presencePenalty"],v);const x=d(t,["frequencyPenalty"]);x!=null&&f(o,["frequencyPenalty"],x);const E=d(t,["seed"]);E!=null&&f(o,["seed"],E);const T=d(t,["responseMimeType"]);T!=null&&f(o,["responseMimeType"],T);const A=d(t,["responseSchema"]);A!=null&&f(o,["responseSchema"],iu(A));const I=d(t,["responseJsonSchema"]);if(I!=null&&f(o,["responseJsonSchema"],I),d(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(d(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const M=d(t,["safetySettings"]);if(n!==void 0&&M!=null){let st=M;Array.isArray(st)&&(st=st.map(ut=>QI(ut))),f(n,["safetySettings"],st)}const D=d(t,["tools"]);if(n!==void 0&&D!=null){let st=ho(D);Array.isArray(st)&&(st=st.map(ut=>sR(fo(ut)))),f(n,["tools"],st)}const P=d(t,["toolConfig"]);if(n!==void 0&&P!=null&&f(n,["toolConfig"],iR(P)),d(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const B=d(t,["cachedContent"]);n!==void 0&&B!=null&&f(n,["cachedContent"],Kn(e,B));const U=d(t,["responseModalities"]);U!=null&&f(o,["responseModalities"],U);const V=d(t,["mediaResolution"]);V!=null&&f(o,["mediaResolution"],V);const W=d(t,["speechConfig"]);if(W!=null&&f(o,["speechConfig"],ou(W)),d(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const et=d(t,["thinkingConfig"]);et!=null&&f(o,["thinkingConfig"],et);const at=d(t,["imageConfig"]);at!=null&&f(o,["imageConfig"],DI(at));const Ct=d(t,["enableEnhancedCivicAnswers"]);if(Ct!=null&&f(o,["enableEnhancedCivicAnswers"],Ct),d(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is not supported in Gemini API.");const gt=d(t,["serviceTier"]);return n!==void 0&>!=null&&f(n,["serviceTier"],gt),o}function lI(e,t,n,i){const o={},s=d(t,["systemInstruction"]);n!==void 0&&s!=null&&f(n,["systemInstruction"],go(_e(s)));const r=d(t,["temperature"]);r!=null&&f(o,["temperature"],r);const l=d(t,["topP"]);l!=null&&f(o,["topP"],l);const a=d(t,["topK"]);a!=null&&f(o,["topK"],a);const c=d(t,["candidateCount"]);c!=null&&f(o,["candidateCount"],c);const u=d(t,["maxOutputTokens"]);u!=null&&f(o,["maxOutputTokens"],u);const h=d(t,["stopSequences"]);h!=null&&f(o,["stopSequences"],h);const p=d(t,["responseLogprobs"]);p!=null&&f(o,["responseLogprobs"],p);const g=d(t,["logprobs"]);g!=null&&f(o,["logprobs"],g);const v=d(t,["presencePenalty"]);v!=null&&f(o,["presencePenalty"],v);const x=d(t,["frequencyPenalty"]);x!=null&&f(o,["frequencyPenalty"],x);const E=d(t,["seed"]);E!=null&&f(o,["seed"],E);const T=d(t,["responseMimeType"]);T!=null&&f(o,["responseMimeType"],T);const A=d(t,["responseSchema"]);A!=null&&f(o,["responseSchema"],iu(A));const I=d(t,["responseJsonSchema"]);I!=null&&f(o,["responseJsonSchema"],I);const M=d(t,["routingConfig"]);M!=null&&f(o,["routingConfig"],M);const D=d(t,["modelSelectionConfig"]);D!=null&&f(o,["modelConfig"],D);const P=d(t,["safetySettings"]);if(n!==void 0&&P!=null){let xt=P;Array.isArray(xt)&&(xt=xt.map(Nt=>Nt)),f(n,["safetySettings"],xt)}const B=d(t,["tools"]);if(n!==void 0&&B!=null){let xt=ho(B);Array.isArray(xt)&&(xt=xt.map(Nt=>u0(fo(Nt)))),f(n,["tools"],xt)}const U=d(t,["toolConfig"]);n!==void 0&&U!=null&&f(n,["toolConfig"],oR(U));const V=d(t,["labels"]);n!==void 0&&V!=null&&f(n,["labels"],V);const W=d(t,["cachedContent"]);n!==void 0&&W!=null&&f(n,["cachedContent"],Kn(e,W));const et=d(t,["responseModalities"]);et!=null&&f(o,["responseModalities"],et);const at=d(t,["mediaResolution"]);at!=null&&f(o,["mediaResolution"],at);const Ct=d(t,["speechConfig"]);Ct!=null&&f(o,["speechConfig"],ou(Ct));const gt=d(t,["audioTimestamp"]);gt!=null&&f(o,["audioTimestamp"],gt);const st=d(t,["thinkingConfig"]);st!=null&&f(o,["thinkingConfig"],st);const ut=d(t,["imageConfig"]);if(ut!=null&&f(o,["imageConfig"],NI(ut)),d(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const ft=d(t,["modelArmorConfig"]);n!==void 0&&ft!=null&&f(n,["modelArmorConfig"],ft);const rt=d(t,["serviceTier"]);return n!==void 0&&rt!=null&&f(n,["serviceTier"],rt),o}function cp(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["contents"]);if(s!=null){let l=He(s);Array.isArray(l)&&(l=l.map(a=>xs(a))),f(i,["contents"],l)}const r=d(t,["config"]);return r!=null&&f(i,["generationConfig"],rI(e,r,i)),i}function up(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["contents"]);if(s!=null){let l=He(s);Array.isArray(l)&&(l=l.map(a=>go(a))),f(i,["contents"],l)}const r=d(t,["config"]);return r!=null&&f(i,["generationConfig"],lI(e,r,i)),i}function dp(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["candidates"]);if(o!=null){let u=o;Array.isArray(u)&&(u=u.map(h=>RA(h))),f(n,["candidates"],u)}const s=d(e,["modelVersion"]);s!=null&&f(n,["modelVersion"],s);const r=d(e,["promptFeedback"]);r!=null&&f(n,["promptFeedback"],r);const l=d(e,["responseId"]);l!=null&&f(n,["responseId"],l);const a=d(e,["usageMetadata"]);a!=null&&f(n,["usageMetadata"],a);const c=d(e,["modelStatus"]);return c!=null&&f(n,["modelStatus"],c),n}function fp(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["candidates"]);if(o!=null){let u=o;Array.isArray(u)&&(u=u.map(h=>h)),f(n,["candidates"],u)}const s=d(e,["createTime"]);s!=null&&f(n,["createTime"],s);const r=d(e,["modelVersion"]);r!=null&&f(n,["modelVersion"],r);const l=d(e,["promptFeedback"]);l!=null&&f(n,["promptFeedback"],l);const a=d(e,["responseId"]);a!=null&&f(n,["responseId"],a);const c=d(e,["usageMetadata"]);return c!=null&&f(n,["usageMetadata"],c),n}function aI(e,t,n){const i={};if(d(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(d(e,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const o=d(e,["numberOfImages"]);t!==void 0&&o!=null&&f(t,["parameters","sampleCount"],o);const s=d(e,["aspectRatio"]);t!==void 0&&s!=null&&f(t,["parameters","aspectRatio"],s);const r=d(e,["guidanceScale"]);if(t!==void 0&&r!=null&&f(t,["parameters","guidanceScale"],r),d(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const l=d(e,["safetyFilterLevel"]);t!==void 0&&l!=null&&f(t,["parameters","safetySetting"],l);const a=d(e,["personGeneration"]);t!==void 0&&a!=null&&f(t,["parameters","personGeneration"],a);const c=d(e,["includeSafetyAttributes"]);t!==void 0&&c!=null&&f(t,["parameters","includeSafetyAttributes"],c);const u=d(e,["includeRaiReason"]);t!==void 0&&u!=null&&f(t,["parameters","includeRaiReason"],u);const h=d(e,["language"]);t!==void 0&&h!=null&&f(t,["parameters","language"],h);const p=d(e,["outputMimeType"]);t!==void 0&&p!=null&&f(t,["parameters","outputOptions","mimeType"],p);const g=d(e,["outputCompressionQuality"]);if(t!==void 0&&g!=null&&f(t,["parameters","outputOptions","compressionQuality"],g),d(e,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(d(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const v=d(e,["imageSize"]);if(t!==void 0&&v!=null&&f(t,["parameters","sampleImageSize"],v),d(e,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return i}function cI(e,t,n){const i={},o=d(e,["outputGcsUri"]);t!==void 0&&o!=null&&f(t,["parameters","storageUri"],o);const s=d(e,["negativePrompt"]);t!==void 0&&s!=null&&f(t,["parameters","negativePrompt"],s);const r=d(e,["numberOfImages"]);t!==void 0&&r!=null&&f(t,["parameters","sampleCount"],r);const l=d(e,["aspectRatio"]);t!==void 0&&l!=null&&f(t,["parameters","aspectRatio"],l);const a=d(e,["guidanceScale"]);t!==void 0&&a!=null&&f(t,["parameters","guidanceScale"],a);const c=d(e,["seed"]);t!==void 0&&c!=null&&f(t,["parameters","seed"],c);const u=d(e,["safetyFilterLevel"]);t!==void 0&&u!=null&&f(t,["parameters","safetySetting"],u);const h=d(e,["personGeneration"]);t!==void 0&&h!=null&&f(t,["parameters","personGeneration"],h);const p=d(e,["includeSafetyAttributes"]);t!==void 0&&p!=null&&f(t,["parameters","includeSafetyAttributes"],p);const g=d(e,["includeRaiReason"]);t!==void 0&&g!=null&&f(t,["parameters","includeRaiReason"],g);const v=d(e,["language"]);t!==void 0&&v!=null&&f(t,["parameters","language"],v);const x=d(e,["outputMimeType"]);t!==void 0&&x!=null&&f(t,["parameters","outputOptions","mimeType"],x);const E=d(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&f(t,["parameters","outputOptions","compressionQuality"],E);const T=d(e,["addWatermark"]);t!==void 0&&T!=null&&f(t,["parameters","addWatermark"],T);const A=d(e,["labels"]);t!==void 0&&A!=null&&f(t,["labels"],A);const I=d(e,["imageSize"]);t!==void 0&&I!=null&&f(t,["parameters","sampleImageSize"],I);const M=d(e,["enhancePrompt"]);return t!==void 0&&M!=null&&f(t,["parameters","enhancePrompt"],M),i}function uI(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["prompt"]);s!=null&&f(i,["instances[0]","prompt"],s);const r=d(t,["config"]);return r!=null&&aI(r,i),i}function dI(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["prompt"]);s!=null&&f(i,["instances[0]","prompt"],s);const r=d(t,["config"]);return r!=null&&cI(r,i),i}function fI(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["predictions"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(l=>TI(l))),f(n,["generatedImages"],r)}const s=d(e,["positivePromptSafetyAttributes"]);return s!=null&&f(n,["positivePromptSafetyAttributes"],a0(s)),n}function hI(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["predictions"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(l=>xl(l))),f(n,["generatedImages"],r)}const s=d(e,["positivePromptSafetyAttributes"]);return s!=null&&f(n,["positivePromptSafetyAttributes"],c0(s)),n}function pI(e,t,n){const i={},o=d(e,["numberOfVideos"]);if(t!==void 0&&o!=null&&f(t,["parameters","sampleCount"],o),d(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(d(e,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const s=d(e,["durationSeconds"]);if(t!==void 0&&s!=null&&f(t,["parameters","durationSeconds"],s),d(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const r=d(e,["aspectRatio"]);t!==void 0&&r!=null&&f(t,["parameters","aspectRatio"],r);const l=d(e,["resolution"]);t!==void 0&&l!=null&&f(t,["parameters","resolution"],l);const a=d(e,["personGeneration"]);if(t!==void 0&&a!=null&&f(t,["parameters","personGeneration"],a),d(e,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const c=d(e,["negativePrompt"]);t!==void 0&&c!=null&&f(t,["parameters","negativePrompt"],c);const u=d(e,["enhancePrompt"]);if(t!==void 0&&u!=null&&f(t,["parameters","enhancePrompt"],u),d(e,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const h=d(e,["lastFrame"]);t!==void 0&&h!=null&&f(t,["instances[0]","lastFrame"],bl(h));const p=d(e,["referenceImages"]);if(t!==void 0&&p!=null){let v=p;Array.isArray(v)&&(v=v.map(x=>_R(x))),f(t,["instances[0]","referenceImages"],v)}if(d(e,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(d(e,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");if(d(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const g=d(e,["webhookConfig"]);if(t!==void 0&&g!=null&&f(t,["webhookConfig"],g),d(e,["resizeMode"])!==void 0)throw new Error("resizeMode parameter is not supported in Gemini API.");return i}function gI(e,t,n){const i={},o=d(e,["numberOfVideos"]);t!==void 0&&o!=null&&f(t,["parameters","sampleCount"],o);const s=d(e,["outputGcsUri"]);t!==void 0&&s!=null&&f(t,["parameters","storageUri"],s);const r=d(e,["fps"]);t!==void 0&&r!=null&&f(t,["parameters","fps"],r);const l=d(e,["durationSeconds"]);t!==void 0&&l!=null&&f(t,["parameters","durationSeconds"],l);const a=d(e,["seed"]);t!==void 0&&a!=null&&f(t,["parameters","seed"],a);const c=d(e,["aspectRatio"]);t!==void 0&&c!=null&&f(t,["parameters","aspectRatio"],c);const u=d(e,["resolution"]);t!==void 0&&u!=null&&f(t,["parameters","resolution"],u);const h=d(e,["personGeneration"]);t!==void 0&&h!=null&&f(t,["parameters","personGeneration"],h);const p=d(e,["pubsubTopic"]);t!==void 0&&p!=null&&f(t,["parameters","pubsubTopic"],p);const g=d(e,["negativePrompt"]);t!==void 0&&g!=null&&f(t,["parameters","negativePrompt"],g);const v=d(e,["enhancePrompt"]);t!==void 0&&v!=null&&f(t,["parameters","enhancePrompt"],v);const x=d(e,["generateAudio"]);t!==void 0&&x!=null&&f(t,["parameters","generateAudio"],x);const E=d(e,["lastFrame"]);t!==void 0&&E!=null&&f(t,["instances[0]","lastFrame"],cn(E));const T=d(e,["referenceImages"]);if(t!==void 0&&T!=null){let P=T;Array.isArray(P)&&(P=P.map(B=>vR(B))),f(t,["instances[0]","referenceImages"],P)}const A=d(e,["mask"]);t!==void 0&&A!=null&&f(t,["instances[0]","mask"],yR(A));const I=d(e,["compressionQuality"]);t!==void 0&&I!=null&&f(t,["parameters","compressionQuality"],I);const M=d(e,["labels"]);if(t!==void 0&&M!=null&&f(t,["labels"],M),d(e,["webhookConfig"])!==void 0)throw new Error("webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const D=d(e,["resizeMode"]);return t!==void 0&&D!=null&&f(t,["parameters","resizeMode"],D),i}function mI(e,t){const n={},i=d(e,["name"]);i!=null&&f(n,["name"],i);const o=d(e,["metadata"]);o!=null&&f(n,["metadata"],o);const s=d(e,["done"]);s!=null&&f(n,["done"],s);const r=d(e,["error"]);r!=null&&f(n,["error"],r);const l=d(e,["response","generateVideoResponse"]);return l!=null&&f(n,["response"],xI(l)),n}function yI(e,t){const n={},i=d(e,["name"]);i!=null&&f(n,["name"],i);const o=d(e,["metadata"]);o!=null&&f(n,["metadata"],o);const s=d(e,["done"]);s!=null&&f(n,["done"],s);const r=d(e,["error"]);r!=null&&f(n,["error"],r);const l=d(e,["response"]);return l!=null&&f(n,["response"],bI(l)),n}function _I(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["prompt"]);s!=null&&f(i,["instances[0]","prompt"],s);const r=d(t,["image"]);r!=null&&f(i,["instances[0]","image"],bl(r));const l=d(t,["video"]);l!=null&&f(i,["instances[0]","video"],d0(l));const a=d(t,["source"]);a!=null&&EI(a,i);const c=d(t,["config"]);return c!=null&&pI(c,i),i}function vI(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["prompt"]);s!=null&&f(i,["instances[0]","prompt"],s);const r=d(t,["image"]);r!=null&&f(i,["instances[0]","image"],cn(r));const l=d(t,["video"]);l!=null&&f(i,["instances[0]","video"],f0(l));const a=d(t,["source"]);a!=null&&wI(a,i);const c=d(t,["config"]);return c!=null&&gI(c,i),i}function xI(e,t){const n={},i=d(e,["generatedSamples"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(l=>SI(l))),f(n,["generatedVideos"],r)}const o=d(e,["raiMediaFilteredCount"]);o!=null&&f(n,["raiMediaFilteredCount"],o);const s=d(e,["raiMediaFilteredReasons"]);return s!=null&&f(n,["raiMediaFilteredReasons"],s),n}function bI(e,t){const n={},i=d(e,["videos"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(l=>AI(l))),f(n,["generatedVideos"],r)}const o=d(e,["raiMediaFilteredCount"]);o!=null&&f(n,["raiMediaFilteredCount"],o);const s=d(e,["raiMediaFilteredReasons"]);return s!=null&&f(n,["raiMediaFilteredReasons"],s),n}function EI(e,t,n){const i={},o=d(e,["prompt"]);t!==void 0&&o!=null&&f(t,["instances[0]","prompt"],o);const s=d(e,["image"]);t!==void 0&&s!=null&&f(t,["instances[0]","image"],bl(s));const r=d(e,["video"]);return t!==void 0&&r!=null&&f(t,["instances[0]","video"],d0(r)),i}function wI(e,t,n){const i={},o=d(e,["prompt"]);t!==void 0&&o!=null&&f(t,["instances[0]","prompt"],o);const s=d(e,["image"]);t!==void 0&&s!=null&&f(t,["instances[0]","image"],cn(s));const r=d(e,["video"]);return t!==void 0&&r!=null&&f(t,["instances[0]","video"],f0(r)),i}function TI(e,t){const n={},i=d(e,["_self"]);i!=null&&f(n,["image"],LI(i));const o=d(e,["raiFilteredReason"]);o!=null&&f(n,["raiFilteredReason"],o);const s=d(e,["_self"]);return s!=null&&f(n,["safetyAttributes"],a0(s)),n}function xl(e,t){const n={},i=d(e,["_self"]);i!=null&&f(n,["image"],l0(i));const o=d(e,["raiFilteredReason"]);o!=null&&f(n,["raiFilteredReason"],o);const s=d(e,["_self"]);s!=null&&f(n,["safetyAttributes"],c0(s));const r=d(e,["prompt"]);return r!=null&&f(n,["enhancedPrompt"],r),n}function CI(e,t){const n={},i=d(e,["_self"]);i!=null&&f(n,["mask"],l0(i));const o=d(e,["labels"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(n,["labels"],s)}return n}function SI(e,t){const n={},i=d(e,["video"]);return i!=null&&f(n,["video"],gR(i)),n}function AI(e,t){const n={},i=d(e,["_self"]);return i!=null&&f(n,["video"],mR(i)),n}function II(e,t){const n={},i=d(e,["modelSelectionConfig"]);i!=null&&f(n,["modelConfig"],i);const o=d(e,["responseJsonSchema"]);o!=null&&f(n,["responseJsonSchema"],o);const s=d(e,["audioTimestamp"]);s!=null&&f(n,["audioTimestamp"],s);const r=d(e,["candidateCount"]);r!=null&&f(n,["candidateCount"],r);const l=d(e,["enableAffectiveDialog"]);l!=null&&f(n,["enableAffectiveDialog"],l);const a=d(e,["frequencyPenalty"]);a!=null&&f(n,["frequencyPenalty"],a);const c=d(e,["logprobs"]);c!=null&&f(n,["logprobs"],c);const u=d(e,["maxOutputTokens"]);u!=null&&f(n,["maxOutputTokens"],u);const h=d(e,["mediaResolution"]);h!=null&&f(n,["mediaResolution"],h);const p=d(e,["presencePenalty"]);p!=null&&f(n,["presencePenalty"],p);const g=d(e,["responseLogprobs"]);g!=null&&f(n,["responseLogprobs"],g);const v=d(e,["responseMimeType"]);v!=null&&f(n,["responseMimeType"],v);const x=d(e,["responseModalities"]);x!=null&&f(n,["responseModalities"],x);const E=d(e,["responseSchema"]);E!=null&&f(n,["responseSchema"],E);const T=d(e,["routingConfig"]);T!=null&&f(n,["routingConfig"],T);const A=d(e,["seed"]);A!=null&&f(n,["seed"],A);const I=d(e,["speechConfig"]);I!=null&&f(n,["speechConfig"],I);const M=d(e,["stopSequences"]);M!=null&&f(n,["stopSequences"],M);const D=d(e,["temperature"]);D!=null&&f(n,["temperature"],D);const P=d(e,["thinkingConfig"]);P!=null&&f(n,["thinkingConfig"],P);const B=d(e,["topK"]);B!=null&&f(n,["topK"],B);const U=d(e,["topP"]);if(U!=null&&f(n,["topP"],U),d(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return n}function RI(e,t,n){const i={},o=d(t,["model"]);return o!=null&&f(i,["_url","name"],Bt(e,o)),i}function MI(e,t,n){const i={},o=d(t,["model"]);return o!=null&&f(i,["_url","name"],Bt(e,o)),i}function PI(e,t){const n={},i=d(e,["authConfig"]);i!=null&&f(n,["authConfig"],AA(i));const o=d(e,["enableWidget"]);return o!=null&&f(n,["enableWidget"],o),n}function kI(e,t){const n={},i=d(e,["searchTypes"]);if(i!=null&&f(n,["searchTypes"],i),d(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");if(d(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");const o=d(e,["timeRangeFilter"]);return o!=null&&f(n,["timeRangeFilter"],o),n}function DI(e,t){const n={},i=d(e,["aspectRatio"]);i!=null&&f(n,["aspectRatio"],i);const o=d(e,["imageSize"]);if(o!=null&&f(n,["imageSize"],o),d(e,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is not supported in Gemini API.");if(d(e,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is not supported in Gemini API.");if(d(e,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(d(e,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");if(d(e,["imageOutputOptions"])!==void 0)throw new Error("imageOutputOptions parameter is not supported in Gemini API.");return n}function NI(e,t){const n={},i=d(e,["aspectRatio"]);i!=null&&f(n,["aspectRatio"],i);const o=d(e,["imageSize"]);o!=null&&f(n,["imageSize"],o);const s=d(e,["personGeneration"]);s!=null&&f(n,["personGeneration"],s);const r=d(e,["prominentPeople"]);r!=null&&f(n,["prominentPeople"],r);const l=d(e,["outputMimeType"]);l!=null&&f(n,["imageOutputOptions","mimeType"],l);const a=d(e,["outputCompressionQuality"]);a!=null&&f(n,["imageOutputOptions","compressionQuality"],a);const c=d(e,["imageOutputOptions"]);return c!=null&&f(n,["imageOutputOptions"],c),n}function LI(e,t){const n={},i=d(e,["bytesBase64Encoded"]);i!=null&&f(n,["imageBytes"],pi(i));const o=d(e,["mimeType"]);return o!=null&&f(n,["mimeType"],o),n}function l0(e,t){const n={},i=d(e,["gcsUri"]);i!=null&&f(n,["gcsUri"],i);const o=d(e,["bytesBase64Encoded"]);o!=null&&f(n,["imageBytes"],pi(o));const s=d(e,["mimeType"]);return s!=null&&f(n,["mimeType"],s),n}function bl(e,t){const n={};if(d(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const i=d(e,["imageBytes"]);i!=null&&f(n,["bytesBase64Encoded"],pi(i));const o=d(e,["mimeType"]);return o!=null&&f(n,["mimeType"],o),n}function cn(e,t){const n={},i=d(e,["gcsUri"]);i!=null&&f(n,["gcsUri"],i);const o=d(e,["imageBytes"]);o!=null&&f(n,["bytesBase64Encoded"],pi(o));const s=d(e,["mimeType"]);return s!=null&&f(n,["mimeType"],s),n}function FI(e,t,n,i){const o={},s=d(t,["pageSize"]);n!==void 0&&s!=null&&f(n,["_query","pageSize"],s);const r=d(t,["pageToken"]);n!==void 0&&r!=null&&f(n,["_query","pageToken"],r);const l=d(t,["filter"]);n!==void 0&&l!=null&&f(n,["_query","filter"],l);const a=d(t,["queryBase"]);return n!==void 0&&a!=null&&f(n,["_url","models_url"],t0(e,a)),o}function UI(e,t,n,i){const o={},s=d(t,["pageSize"]);n!==void 0&&s!=null&&f(n,["_query","pageSize"],s);const r=d(t,["pageToken"]);n!==void 0&&r!=null&&f(n,["_query","pageToken"],r);const l=d(t,["filter"]);n!==void 0&&l!=null&&f(n,["_query","filter"],l);const a=d(t,["queryBase"]);return n!==void 0&&a!=null&&f(n,["_url","models_url"],t0(e,a)),o}function BI(e,t,n){const i={},o=d(t,["config"]);return o!=null&&FI(e,o,i),i}function OI(e,t,n){const i={},o=d(t,["config"]);return o!=null&&UI(e,o,i),i}function VI(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["nextPageToken"]);o!=null&&f(n,["nextPageToken"],o);const s=d(e,["_self"]);if(s!=null){let r=e0(s);Array.isArray(r)&&(r=r.map(l=>tc(l))),f(n,["models"],r)}return n}function GI(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["nextPageToken"]);o!=null&&f(n,["nextPageToken"],o);const s=d(e,["_self"]);if(s!=null){let r=e0(s);Array.isArray(r)&&(r=r.map(l=>ec(l))),f(n,["models"],r)}return n}function HI(e,t){const n={},i=d(e,["maskMode"]);i!=null&&f(n,["maskMode"],i);const o=d(e,["segmentationClasses"]);o!=null&&f(n,["maskClasses"],o);const s=d(e,["maskDilation"]);return s!=null&&f(n,["dilation"],s),n}function tc(e,t){const n={},i=d(e,["name"]);i!=null&&f(n,["name"],i);const o=d(e,["displayName"]);o!=null&&f(n,["displayName"],o);const s=d(e,["description"]);s!=null&&f(n,["description"],s);const r=d(e,["version"]);r!=null&&f(n,["version"],r);const l=d(e,["_self"]);l!=null&&f(n,["tunedModelInfo"],rR(l));const a=d(e,["inputTokenLimit"]);a!=null&&f(n,["inputTokenLimit"],a);const c=d(e,["outputTokenLimit"]);c!=null&&f(n,["outputTokenLimit"],c);const u=d(e,["supportedGenerationMethods"]);u!=null&&f(n,["supportedActions"],u);const h=d(e,["temperature"]);h!=null&&f(n,["temperature"],h);const p=d(e,["maxTemperature"]);p!=null&&f(n,["maxTemperature"],p);const g=d(e,["topP"]);g!=null&&f(n,["topP"],g);const v=d(e,["topK"]);v!=null&&f(n,["topK"],v);const x=d(e,["thinking"]);return x!=null&&f(n,["thinking"],x),n}function ec(e,t){const n={},i=d(e,["name"]);i!=null&&f(n,["name"],i);const o=d(e,["displayName"]);o!=null&&f(n,["displayName"],o);const s=d(e,["description"]);s!=null&&f(n,["description"],s);const r=d(e,["versionId"]);r!=null&&f(n,["version"],r);const l=d(e,["deployedModels"]);if(l!=null){let p=l;Array.isArray(p)&&(p=p.map(g=>eI(g))),f(n,["endpoints"],p)}const a=d(e,["labels"]);a!=null&&f(n,["labels"],a);const c=d(e,["_self"]);c!=null&&f(n,["tunedModelInfo"],lR(c));const u=d(e,["defaultCheckpointId"]);u!=null&&f(n,["defaultCheckpointId"],u);const h=d(e,["checkpoints"]);if(h!=null){let p=h;Array.isArray(p)&&(p=p.map(g=>g)),f(n,["checkpoints"],p)}return n}function $I(e,t){const n={},i=d(e,["mediaResolution"]);i!=null&&f(n,["mediaResolution"],i);const o=d(e,["codeExecutionResult"]);o!=null&&f(n,["codeExecutionResult"],o);const s=d(e,["executableCode"]);s!=null&&f(n,["executableCode"],s);const r=d(e,["fileData"]);r!=null&&f(n,["fileData"],nI(r));const l=d(e,["functionCall"]);l!=null&&f(n,["functionCall"],iI(l));const a=d(e,["functionResponse"]);a!=null&&f(n,["functionResponse"],a);const c=d(e,["inlineData"]);c!=null&&f(n,["inlineData"],IA(c));const u=d(e,["text"]);u!=null&&f(n,["text"],u);const h=d(e,["thought"]);h!=null&&f(n,["thought"],h);const p=d(e,["thoughtSignature"]);p!=null&&f(n,["thoughtSignature"],p);const g=d(e,["videoMetadata"]);g!=null&&f(n,["videoMetadata"],g);const v=d(e,["toolCall"]);v!=null&&f(n,["toolCall"],v);const x=d(e,["toolResponse"]);x!=null&&f(n,["toolResponse"],x);const E=d(e,["partMetadata"]);return E!=null&&f(n,["partMetadata"],E),n}function qI(e,t){const n={},i=d(e,["mediaResolution"]);i!=null&&f(n,["mediaResolution"],i);const o=d(e,["codeExecutionResult"]);o!=null&&f(n,["codeExecutionResult"],o);const s=d(e,["executableCode"]);s!=null&&f(n,["executableCode"],s);const r=d(e,["fileData"]);r!=null&&f(n,["fileData"],r);const l=d(e,["functionCall"]);l!=null&&f(n,["functionCall"],l);const a=d(e,["functionResponse"]);a!=null&&f(n,["functionResponse"],a);const c=d(e,["inlineData"]);c!=null&&f(n,["inlineData"],c);const u=d(e,["text"]);u!=null&&f(n,["text"],u);const h=d(e,["thought"]);h!=null&&f(n,["thought"],h);const p=d(e,["thoughtSignature"]);p!=null&&f(n,["thoughtSignature"],p);const g=d(e,["videoMetadata"]);if(g!=null&&f(n,["videoMetadata"],g),d(e,["toolCall"])!==void 0)throw new Error("toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");if(d(e,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return n}function zI(e,t){const n={},i=d(e,["productImage"]);return i!=null&&f(n,["image"],cn(i)),n}function WI(e,t,n){const i={},o=d(e,["numberOfImages"]);t!==void 0&&o!=null&&f(t,["parameters","sampleCount"],o);const s=d(e,["baseSteps"]);t!==void 0&&s!=null&&f(t,["parameters","baseSteps"],s);const r=d(e,["outputGcsUri"]);t!==void 0&&r!=null&&f(t,["parameters","storageUri"],r);const l=d(e,["seed"]);t!==void 0&&l!=null&&f(t,["parameters","seed"],l);const a=d(e,["safetyFilterLevel"]);t!==void 0&&a!=null&&f(t,["parameters","safetySetting"],a);const c=d(e,["personGeneration"]);t!==void 0&&c!=null&&f(t,["parameters","personGeneration"],c);const u=d(e,["addWatermark"]);t!==void 0&&u!=null&&f(t,["parameters","addWatermark"],u);const h=d(e,["outputMimeType"]);t!==void 0&&h!=null&&f(t,["parameters","outputOptions","mimeType"],h);const p=d(e,["outputCompressionQuality"]);t!==void 0&&p!=null&&f(t,["parameters","outputOptions","compressionQuality"],p);const g=d(e,["enhancePrompt"]);t!==void 0&&g!=null&&f(t,["parameters","enhancePrompt"],g);const v=d(e,["labels"]);return t!==void 0&&v!=null&&f(t,["labels"],v),i}function JI(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["source"]);s!=null&&YI(s,i);const r=d(t,["config"]);return r!=null&&WI(r,i),i}function KI(e,t){const n={},i=d(e,["predictions"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>xl(s))),f(n,["generatedImages"],o)}return n}function YI(e,t,n){const i={},o=d(e,["prompt"]);t!==void 0&&o!=null&&f(t,["instances[0]","prompt"],o);const s=d(e,["personImage"]);t!==void 0&&s!=null&&f(t,["instances[0]","personImage","image"],cn(s));const r=d(e,["productImages"]);if(t!==void 0&&r!=null){let l=r;Array.isArray(l)&&(l=l.map(a=>zI(a))),f(t,["instances[0]","productImages"],l)}return i}function XI(e,t){const n={},i=d(e,["referenceImage"]);i!=null&&f(n,["referenceImage"],cn(i));const o=d(e,["referenceId"]);o!=null&&f(n,["referenceId"],o);const s=d(e,["referenceType"]);s!=null&&f(n,["referenceType"],s);const r=d(e,["maskImageConfig"]);r!=null&&f(n,["maskImageConfig"],HI(r));const l=d(e,["controlImageConfig"]);l!=null&&f(n,["controlImageConfig"],LA(l));const a=d(e,["styleImageConfig"]);a!=null&&f(n,["styleImageConfig"],a);const c=d(e,["subjectImageConfig"]);return c!=null&&f(n,["subjectImageConfig"],c),n}function a0(e,t){const n={},i=d(e,["safetyAttributes","categories"]);i!=null&&f(n,["categories"],i);const o=d(e,["safetyAttributes","scores"]);o!=null&&f(n,["scores"],o);const s=d(e,["contentType"]);return s!=null&&f(n,["contentType"],s),n}function c0(e,t){const n={},i=d(e,["safetyAttributes","categories"]);i!=null&&f(n,["categories"],i);const o=d(e,["safetyAttributes","scores"]);o!=null&&f(n,["scores"],o);const s=d(e,["contentType"]);return s!=null&&f(n,["contentType"],s),n}function QI(e,t){const n={},i=d(e,["category"]);if(i!=null&&f(n,["category"],i),d(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const o=d(e,["threshold"]);return o!=null&&f(n,["threshold"],o),n}function ZI(e,t){const n={},i=d(e,["image"]);return i!=null&&f(n,["image"],cn(i)),n}function jI(e,t,n){const i={},o=d(e,["mode"]);t!==void 0&&o!=null&&f(t,["parameters","mode"],o);const s=d(e,["maxPredictions"]);t!==void 0&&s!=null&&f(t,["parameters","maxPredictions"],s);const r=d(e,["confidenceThreshold"]);t!==void 0&&r!=null&&f(t,["parameters","confidenceThreshold"],r);const l=d(e,["maskDilation"]);t!==void 0&&l!=null&&f(t,["parameters","maskDilation"],l);const a=d(e,["binaryColorThreshold"]);t!==void 0&&a!=null&&f(t,["parameters","binaryColorThreshold"],a);const c=d(e,["labels"]);return t!==void 0&&c!=null&&f(t,["labels"],c),i}function tR(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["source"]);s!=null&&nR(s,i);const r=d(t,["config"]);return r!=null&&jI(r,i),i}function eR(e,t){const n={},i=d(e,["predictions"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>CI(s))),f(n,["generatedMasks"],o)}return n}function nR(e,t,n){const i={},o=d(e,["prompt"]);t!==void 0&&o!=null&&f(t,["instances[0]","prompt"],o);const s=d(e,["image"]);t!==void 0&&s!=null&&f(t,["instances[0]","image"],cn(s));const r=d(e,["scribbleImage"]);return t!==void 0&&r!=null&&f(t,["instances[0]","scribble"],ZI(r)),i}function iR(e,t){const n={},i=d(e,["retrievalConfig"]);i!=null&&f(n,["retrievalConfig"],i);const o=d(e,["functionCallingConfig"]);o!=null&&f(n,["functionCallingConfig"],oI(o));const s=d(e,["includeServerSideToolInvocations"]);return s!=null&&f(n,["includeServerSideToolInvocations"],s),n}function oR(e,t){const n={},i=d(e,["retrievalConfig"]);i!=null&&f(n,["retrievalConfig"],i);const o=d(e,["functionCallingConfig"]);if(o!=null&&f(n,["functionCallingConfig"],o),d(e,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return n}function sR(e,t){const n={};if(d(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=d(e,["computerUse"]);i!=null&&f(n,["computerUse"],i);const o=d(e,["fileSearch"]);o!=null&&f(n,["fileSearch"],o);const s=d(e,["googleSearch"]);s!=null&&f(n,["googleSearch"],kI(s));const r=d(e,["googleMaps"]);r!=null&&f(n,["googleMaps"],PI(r));const l=d(e,["codeExecution"]);if(l!=null&&f(n,["codeExecution"],l),d(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const a=d(e,["functionDeclarations"]);if(a!=null){let p=a;Array.isArray(p)&&(p=p.map(g=>g)),f(n,["functionDeclarations"],p)}const c=d(e,["googleSearchRetrieval"]);if(c!=null&&f(n,["googleSearchRetrieval"],c),d(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is not supported in Gemini API.");const u=d(e,["urlContext"]);u!=null&&f(n,["urlContext"],u);const h=d(e,["mcpServers"]);if(h!=null){let p=h;Array.isArray(p)&&(p=p.map(g=>g)),f(n,["mcpServers"],p)}return n}function u0(e,t){const n={},i=d(e,["retrieval"]);i!=null&&f(n,["retrieval"],i);const o=d(e,["computerUse"]);if(o!=null&&f(n,["computerUse"],o),d(e,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");const s=d(e,["googleSearch"]);s!=null&&f(n,["googleSearch"],s);const r=d(e,["googleMaps"]);r!=null&&f(n,["googleMaps"],r);const l=d(e,["codeExecution"]);l!=null&&f(n,["codeExecution"],l);const a=d(e,["enterpriseWebSearch"]);a!=null&&f(n,["enterpriseWebSearch"],a);const c=d(e,["functionDeclarations"]);if(c!=null){let g=c;Array.isArray(g)&&(g=g.map(v=>sI(v))),f(n,["functionDeclarations"],g)}const u=d(e,["googleSearchRetrieval"]);u!=null&&f(n,["googleSearchRetrieval"],u);const h=d(e,["parallelAiSearch"]);h!=null&&f(n,["parallelAiSearch"],h);const p=d(e,["urlContext"]);if(p!=null&&f(n,["urlContext"],p),d(e,["mcpServers"])!==void 0)throw new Error("mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return n}function rR(e,t){const n={},i=d(e,["baseModel"]);i!=null&&f(n,["baseModel"],i);const o=d(e,["createTime"]);o!=null&&f(n,["createTime"],o);const s=d(e,["updateTime"]);return s!=null&&f(n,["updateTime"],s),n}function lR(e,t){const n={},i=d(e,["labels","google-vertex-llm-tuning-base-model-id"]);i!=null&&f(n,["baseModel"],i);const o=d(e,["createTime"]);o!=null&&f(n,["createTime"],o);const s=d(e,["updateTime"]);return s!=null&&f(n,["updateTime"],s),n}function aR(e,t,n){const i={},o=d(e,["displayName"]);t!==void 0&&o!=null&&f(t,["displayName"],o);const s=d(e,["description"]);t!==void 0&&s!=null&&f(t,["description"],s);const r=d(e,["defaultCheckpointId"]);return t!==void 0&&r!=null&&f(t,["defaultCheckpointId"],r),i}function cR(e,t,n){const i={},o=d(e,["displayName"]);t!==void 0&&o!=null&&f(t,["displayName"],o);const s=d(e,["description"]);t!==void 0&&s!=null&&f(t,["description"],s);const r=d(e,["defaultCheckpointId"]);return t!==void 0&&r!=null&&f(t,["defaultCheckpointId"],r),i}function uR(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","name"],Bt(e,o));const s=d(t,["config"]);return s!=null&&aR(s,i),i}function dR(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["config"]);return s!=null&&cR(s,i),i}function fR(e,t,n){const i={},o=d(e,["outputGcsUri"]);t!==void 0&&o!=null&&f(t,["parameters","storageUri"],o);const s=d(e,["safetyFilterLevel"]);t!==void 0&&s!=null&&f(t,["parameters","safetySetting"],s);const r=d(e,["personGeneration"]);t!==void 0&&r!=null&&f(t,["parameters","personGeneration"],r);const l=d(e,["includeRaiReason"]);t!==void 0&&l!=null&&f(t,["parameters","includeRaiReason"],l);const a=d(e,["outputMimeType"]);t!==void 0&&a!=null&&f(t,["parameters","outputOptions","mimeType"],a);const c=d(e,["outputCompressionQuality"]);t!==void 0&&c!=null&&f(t,["parameters","outputOptions","compressionQuality"],c);const u=d(e,["enhanceInputImage"]);t!==void 0&&u!=null&&f(t,["parameters","upscaleConfig","enhanceInputImage"],u);const h=d(e,["imagePreservationFactor"]);t!==void 0&&h!=null&&f(t,["parameters","upscaleConfig","imagePreservationFactor"],h);const p=d(e,["labels"]);t!==void 0&&p!=null&&f(t,["labels"],p);const g=d(e,["numberOfImages"]);t!==void 0&&g!=null&&f(t,["parameters","sampleCount"],g);const v=d(e,["mode"]);return t!==void 0&&v!=null&&f(t,["parameters","mode"],v),i}function hR(e,t,n){const i={},o=d(t,["model"]);o!=null&&f(i,["_url","model"],Bt(e,o));const s=d(t,["image"]);s!=null&&f(i,["instances[0]","image"],cn(s));const r=d(t,["upscaleFactor"]);r!=null&&f(i,["parameters","upscaleConfig","upscaleFactor"],r);const l=d(t,["config"]);return l!=null&&fR(l,i),i}function pR(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["predictions"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>xl(r))),f(n,["generatedImages"],s)}return n}function gR(e,t){const n={},i=d(e,["uri"]);i!=null&&f(n,["uri"],i);const o=d(e,["encodedVideo"]);o!=null&&f(n,["videoBytes"],pi(o));const s=d(e,["encoding"]);return s!=null&&f(n,["mimeType"],s),n}function mR(e,t){const n={},i=d(e,["gcsUri"]);i!=null&&f(n,["uri"],i);const o=d(e,["bytesBase64Encoded"]);o!=null&&f(n,["videoBytes"],pi(o));const s=d(e,["mimeType"]);return s!=null&&f(n,["mimeType"],s),n}function yR(e,t){const n={},i=d(e,["image"]);i!=null&&f(n,["_self"],cn(i));const o=d(e,["maskMode"]);return o!=null&&f(n,["maskMode"],o),n}function _R(e,t){const n={},i=d(e,["image"]);i!=null&&f(n,["image"],bl(i));const o=d(e,["referenceType"]);return o!=null&&f(n,["referenceType"],o),n}function vR(e,t){const n={},i=d(e,["image"]);i!=null&&f(n,["image"],cn(i));const o=d(e,["referenceType"]);return o!=null&&f(n,["referenceType"],o),n}function d0(e,t){const n={},i=d(e,["uri"]);i!=null&&f(n,["uri"],i);const o=d(e,["videoBytes"]);o!=null&&f(n,["encodedVideo"],pi(o));const s=d(e,["mimeType"]);return s!=null&&f(n,["encoding"],s),n}function f0(e,t){const n={},i=d(e,["uri"]);i!=null&&f(n,["gcsUri"],i);const o=d(e,["videoBytes"]);o!=null&&f(n,["bytesBase64Encoded"],pi(o));const s=d(e,["mimeType"]);return s!=null&&f(n,["mimeType"],s),n}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function xR(e,t,n){const i={},o=d(t,["displayName"]);n!==void 0&&o!=null&&f(n,["displayName"],o);const s=d(t,["embeddingModel"]);return n!==void 0&&s!=null&&f(n,["embeddingModel"],Bt(e,s)),i}function bR(e,t){const n={},i=d(t,["config"]);return i!=null&&xR(e,i,n),n}function ER(e,t){const n={},i=d(e,["force"]);return t!==void 0&&i!=null&&f(t,["_query","force"],i),n}function wR(e){const t={},n=d(e,["name"]);n!=null&&f(t,["_url","name"],n);const i=d(e,["config"]);return i!=null&&ER(i,t),t}function TR(e){const t={},n=d(e,["name"]);return n!=null&&f(t,["_url","name"],n),t}function CR(e,t){const n={},i=d(e,["customMetadata"]);if(t!==void 0&&i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["customMetadata"],s)}const o=d(e,["chunkingConfig"]);return t!==void 0&&o!=null&&f(t,["chunkingConfig"],o),n}function SR(e){const t={},n=d(e,["name"]);n!=null&&f(t,["name"],n);const i=d(e,["metadata"]);i!=null&&f(t,["metadata"],i);const o=d(e,["done"]);o!=null&&f(t,["done"],o);const s=d(e,["error"]);s!=null&&f(t,["error"],s);const r=d(e,["response"]);return r!=null&&f(t,["response"],IR(r)),t}function AR(e){const t={},n=d(e,["fileSearchStoreName"]);n!=null&&f(t,["_url","file_search_store_name"],n);const i=d(e,["fileName"]);i!=null&&f(t,["fileName"],i);const o=d(e,["config"]);return o!=null&&CR(o,t),t}function IR(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["parent"]);i!=null&&f(t,["parent"],i);const o=d(e,["documentName"]);return o!=null&&f(t,["documentName"],o),t}function RR(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);return t!==void 0&&o!=null&&f(t,["_query","pageToken"],o),n}function MR(e){const t={},n=d(e,["config"]);return n!=null&&RR(n,t),t}function PR(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["fileSearchStores"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["fileSearchStores"],s)}return t}function h0(e,t){const n={},i=d(e,["mimeType"]);t!==void 0&&i!=null&&f(t,["mimeType"],i);const o=d(e,["displayName"]);t!==void 0&&o!=null&&f(t,["displayName"],o);const s=d(e,["customMetadata"]);if(t!==void 0&&s!=null){let l=s;Array.isArray(l)&&(l=l.map(a=>a)),f(t,["customMetadata"],l)}const r=d(e,["chunkingConfig"]);return t!==void 0&&r!=null&&f(t,["chunkingConfig"],r),n}function kR(e){const t={},n=d(e,["fileSearchStoreName"]);n!=null&&f(t,["_url","file_search_store_name"],n);const i=d(e,["config"]);return i!=null&&h0(i,t),t}function DR(e){const t={},n=d(e,["sdkHttpResponse"]);return n!=null&&f(t,["sdkHttpResponse"],n),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const NR="Content-Type",LR="X-Server-Timeout",FR="User-Agent",nc="x-goog-api-client",UR="1.52.0",BR=`google-genai-sdk/${UR}`,OR="v1beta1",VR="v1beta",GR=new Set(["us","eu"]),HR=5,$R=[408,429,500,502,503,504];class qR{constructor(t){var n,i,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 s={};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 l=t.project&&t.location||!!t.apiKey;this.customBaseUrl&&!l?(s.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||this.clientOptions.location==="global"?s.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&GR.has(this.clientOptions.location)?s.baseUrl=`https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(s.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),s.apiVersion=(i=this.clientOptions.apiVersion)!==null&&i!==void 0?i:OR}else this.clientOptions.apiKey||console.warn("API key should be set when using the Gemini API."),s.apiVersion=(o=this.clientOptions.apiVersion)!==null&&o!==void 0?o:VR,s.baseUrl="https://generativelanguage.googleapis.com/";s.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=s,t.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(s,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 i=[t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl];return t.apiVersion&&t.apiVersion!==""&&i.push(t.apiVersion),i.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,i){const o=[this.getRequestUrlInternal(n)];return i&&o.push(this.getBaseResourcePath()),t!==""&&o.push(t),new URL(`${o.join("/")}`)}shouldPrependVertexProjectPath(t,n){return!(n.baseUrl&&n.baseUrlResourceScope===Qa.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 i=this.shouldPrependVertexProjectPath(t,n),o=this.constructUrl(t.path,n,i);if(t.queryParams)for(const[r,l]of Object.entries(t.queryParams))o.searchParams.append(r,String(l));let s={};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 s.body=t.body;return s=await this.includeExtraHttpOptionsToRequestInit(s,n,o.toString(),t.abortSignal),this.unaryApiCall(o,s,t.httpMethod)}patchHttpOptions(t,n){const i=JSON.parse(JSON.stringify(t));for(const[o,s]of Object.entries(n))typeof s=="object"?i[o]=Object.assign(Object.assign({},i[o]),s):s!==void 0&&(i[o]=s);return i}async requestStream(t){let n=this.clientOptions.httpOptions;t.httpOptions&&(n=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const i=this.shouldPrependVertexProjectPath(t,n),o=this.constructUrl(t.path,n,i);(!o.searchParams.has("alt")||o.searchParams.get("alt")!=="sse")&&o.searchParams.set("alt","sse");let s={};return s.body=t.body,s=await this.includeExtraHttpOptionsToRequestInit(s,n,o.toString(),t.abortSignal),this.streamApiCall(o,s,t.httpMethod)}async includeExtraHttpOptionsToRequestInit(t,n,i,o){if(n&&n.timeout||o){const s=new AbortController,r=s.signal;if(n.timeout&&(n==null?void 0:n.timeout)>0){const l=setTimeout(()=>s.abort(),n.timeout);l&&typeof l.unref=="function"&&l.unref()}o&&o.addEventListener("abort",()=>{s.abort()}),t.signal=r}return n&&n.extraBody!==null&&zR(t,n.extraBody),t.headers=await this.getHeadersInternal(n,i),t}async unaryApiCall(t,n,i){return this.apiCall(t.toString(),Object.assign(Object.assign({},n),{method:i})).then(async o=>(await hp(o),new Kr(o))).catch(o=>{throw o instanceof Error?o:new Error(JSON.stringify(o))})}async streamApiCall(t,n,i){return this.apiCall(t.toString(),Object.assign(Object.assign({},n),{method:i})).then(async o=>(await hp(o),this.processStreamResponse(o))).catch(o=>{throw o instanceof Error?o:new Error(JSON.stringify(o))})}processStreamResponse(t){return rn(this,arguments,function*(){var i;const o=(i=t==null?void 0:t.body)===null||i===void 0?void 0:i.getReader(),s=new TextDecoder("utf-8");if(!o)throw new Error("Response body is empty");try{let r="";const l="data:",a=[` `,"\r\r",`\r \r `];for(;;){const{done:c,value:u}=yield wt(o.read());if(c){if(r.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const h=s.decode(u,{stream:!0});try{const v=JSON.parse(h);if("error"in v){const x=JSON.parse(JSON.stringify(v.error)),E=x.status,T=x.code,A=`got status: ${E}. ${JSON.stringify(v)}`;if(T>=400&&T<600)throw new vl({message:A,status:T})}}catch(v){if(v.name==="ApiError")throw v}r+=h;let p=-1,g=0;for(;;){p=-1,g=0;for(const E of a){const T=r.indexOf(E);T!==-1&&(p===-1||T{const r=await fetch(t,n);if(r.ok)return r;throw $R.includes(r.status)?new Error(`Retryable HTTP Error: ${r.statusText}`):new zm.AbortError(`Non-retryable exception ${r.statusText} sending request`)},{retries:((i=o.attempts)!==null&&i!==void 0?i:HR)-1})}getDefaultHeaders(){const t={},n=BR+" "+this.clientOptions.userAgentExtra;return t[FR]=n,t[nc]=n,t[NR]="application/json",t}async getHeadersInternal(t,n){const i=new Headers;if(t&&t.headers){for(const[o,s]of Object.entries(t.headers))i.append(o,s);t.timeout&&t.timeout>0&&i.append(LR,String(Math.ceil(t.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(i,n),i}getFileName(t){var n;let i="";return typeof t=="string"&&(i=t.replace(/[/\\]+$/,""),i=(n=i.split(/[/\\]/).pop())!==null&&n!==void 0?n:""),i}async uploadFile(t,n){var i;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 s=this.clientOptions.uploader,r=await s.stat(t);o.sizeBytes=String(r.size);const l=(i=n==null?void 0:n.mimeType)!==null&&i!==void 0?i:r.type;if(l===void 0||l==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");o.mimeType=l;const a={file:o},c=this.getFileName(t),u=lt("upload/v1beta/files",a._url),h=await this.fetchUploadUrl(u,o.sizeBytes,o.mimeType,c,a,n==null?void 0:n.httpOptions);return s.upload(t,h,this)}async uploadFileToFileSearchStore(t,n,i){var o;const s=this.clientOptions.uploader,r=await s.stat(n),l=String(r.size),a=(o=i==null?void 0:i.mimeType)!==null&&o!==void 0?o:r.type;if(a===void 0||a==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const c=`upload/v1beta/${t}:uploadToFileSearchStore`,u=this.getFileName(n),h={};i!=null&&h0(i,h);const p=await this.fetchUploadUrl(c,l,a,u,h,i==null?void 0:i.httpOptions);return s.uploadToFileSearchStore(n,p,this)}async downloadFile(t){await this.clientOptions.downloader.download(t,this)}async fetchUploadUrl(t,n,i,o,s,r){var l;let a={};r?a=r:a={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":`${i}`},o?{"X-Goog-Upload-File-Name":o}:{})};const c=await this.request({path:t,body:JSON.stringify(s),httpMethod:"POST",httpOptions:a});if(!c||!(c!=null&&c.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const u=(l=c==null?void 0:c.headers)===null||l===void 0?void 0:l["x-goog-upload-url"];if(u===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return u}}async function hp(e){var t;if(e===void 0)throw new Error("response is undefined");if(!e.ok){const n=e.status;let i;!((t=e.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?i=await e.json():i={error:{message:await e.text(),code:e.status,status:e.statusText}};const o=JSON.stringify(i);throw n>=400&&n<600?new vl({message:o,status:n}):new Error(o)}}function zR(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 s=JSON.parse(e.body);if(typeof s=="object"&&s!==null&&!Array.isArray(s))n=s;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 i(s,r){const l=Object.assign({},s);for(const a in r)if(Object.prototype.hasOwnProperty.call(r,a)){const c=r[a],u=l[a];c&&typeof c=="object"&&!Array.isArray(c)&&u&&typeof u=="object"&&!Array.isArray(u)?l[a]=i(u,c):(u&&c&&typeof u!=typeof c&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${a}". Original type: ${typeof u}, New type: ${typeof c}. Overwriting.`),l[a]=c)}return l}const o=i(n,t);e.body=JSON.stringify(o)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const WR="mcp_used/unknown";let JR=!1;function p0(e){for(const t of e)if(KR(t)||typeof t=="object"&&"inputSchema"in t)return!0;return JR}function g0(e){var t;const n=(t=e[nc])!==null&&t!==void 0?t:"";e[nc]=(n+` ${WR}`).trimStart()}function KR(e){return e!==null&&typeof e=="object"&&e instanceof ru}function YR(e){return rn(this,arguments,function*(n,i=100){let o,s=0;for(;s0)return;const s={},r=[];for(const u of this.mcpClients)try{for(var l=!0,a=(n=void 0,ln(YR(u))),c;c=await a.next(),t=c.done,!t;l=!0){o=c.value,l=!1;const h=o;r.push(h);const p=h.name;if(s[p])throw new Error(`Duplicate function name ${p} found in MCP tools. Please ensure function names are unique.`);s[p]=u}}catch(h){n={error:h}}finally{try{!l&&!t&&(i=a.return)&&await i.call(a)}finally{if(n)throw n.error}}this.mcpTools=r,this.functionNameToMcpClient=s}async tool(){return await this.initialize(),lC(this.mcpTools,this.config)}async callTool(t){await this.initialize();const n=[];for(const i of t)if(i.name in this.functionNameToMcpClient){const o=this.functionNameToMcpClient[i.name];let s;this.config.timeout&&(s={timeout:this.config.timeout});const r=await o.callTool({name:i.name,arguments:i.args},void 0,s);n.push({functionResponse:{name:i.name,response:r.isError?{error:r}:r}})}return n}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */async function XR(e,t,n){const i=new j1;let o;n.data instanceof Blob?o=JSON.parse(await n.data.text()):o=JSON.parse(n.data),Object.assign(i,o),t(i)}class QR{constructor(t,n,i){this.apiClient=t,this.auth=n,this.webSocketFactory=i}async connect(t){var n,i;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(),s=this.apiClient.getApiVersion(),r=tM(this.apiClient.getDefaultHeaders()),l=this.apiClient.getApiKey(),a=`${o}/ws/google.ai.generativelanguage.${s}.GenerativeService.BidiGenerateMusic?key=${l}`;let c=()=>{};const u=new Promise(I=>{c=I}),h=t.callbacks,p=function(){c({})},g=this.apiClient,v={onopen:p,onmessage:I=>{XR(g,h.onmessage,I)},onerror:(n=h==null?void 0:h.onerror)!==null&&n!==void 0?n:function(I){},onclose:(i=h==null?void 0:h.onclose)!==null&&i!==void 0?i:function(I){}},x=this.webSocketFactory.create(a,jR(r),v);x.connect(),await u;const A={setup:{model:Bt(this.apiClient,t.model)}};return x.send(JSON.stringify(A)),new ZR(x,this.apiClient)}}class ZR{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=gA(t);this.conn.send(JSON.stringify({clientContent:n}))}async setMusicGenerationConfig(t){t.musicGenerationConfig||(t.musicGenerationConfig={});const n=pA(t);this.conn.send(JSON.stringify(n))}sendPlaybackControl(t){const n={playbackControl:t};this.conn.send(JSON.stringify(n))}play(){this.sendPlaybackControl(Ji.PLAY)}pause(){this.sendPlaybackControl(Ji.PAUSE)}stop(){this.sendPlaybackControl(Ji.STOP)}resetContext(){this.sendPlaybackControl(Ji.RESET_CONTEXT)}close(){this.conn.close()}}function jR(e){const t={};return e.forEach((n,i)=>{t[i]=n}),t}function tM(e){const t=new Headers;for(const[n,i]of Object.entries(e))t.append(n,i);return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const eM="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function nM(e,t,n){const i=new Z1;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 s=JSON.parse(o);if(e.isVertexAI()){const r=_A(s);Object.assign(i,r)}else Object.assign(i,s);t(i)}class iM{constructor(t,n,i){this.apiClient=t,this.auth=n,this.webSocketFactory=i,this.music=new QR(this.apiClient,this.auth,this.webSocketFactory)}async connect(t){var n,i,o,s,r,l;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 a=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let u;const h=this.apiClient.getHeaders();t.config&&t.config.tools&&p0(t.config.tools)&&g0(h);const p=lM(h);if(this.apiClient.isVertexAI()){const V=this.apiClient.getProject(),W=this.apiClient.getLocation(),et=this.apiClient.getApiKey(),at=!!V&&!!W||!!et;this.apiClient.getCustomBaseUrl()&&!at?u=a:(u=`${a}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(p,u))}else{const V=this.apiClient.getApiKey();let W="BidiGenerateContent",et="key";V!=null&&V.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),c!=="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."),W="BidiGenerateContentConstrained",et="access_token"),u=`${a}/ws/google.ai.generativelanguage.${c}.GenerativeService.${W}?${et}=${V}`}let g=()=>{};const v=new Promise(V=>{g=V}),x=t.callbacks,E=function(){var V;(V=x==null?void 0:x.onopen)===null||V===void 0||V.call(x),g({})},T=this.apiClient,A={onopen:E,onmessage:V=>{nM(T,x.onmessage,V)},onerror:(n=x==null?void 0:x.onerror)!==null&&n!==void 0?n:function(V){},onclose:(i=x==null?void 0:x.onclose)!==null&&i!==void 0?i:function(V){}},I=this.webSocketFactory.create(u,rM(p),A);I.connect(),await v;let M=Bt(this.apiClient,t.model);if(this.apiClient.isVertexAI()&&M.startsWith("publishers/")){const V=this.apiClient.getProject(),W=this.apiClient.getLocation();V&&W&&(M=`projects/${V}/locations/${W}/`+M)}let D={};this.apiClient.isVertexAI()&&((o=t.config)===null||o===void 0?void 0:o.responseModalities)===void 0&&(t.config===void 0?t.config={responseModalities:[Wr.AUDIO]}:t.config.responseModalities=[Wr.AUDIO]),!((s=t.config)===null||s===void 0)&&s.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 P=(l=(r=t.config)===null||r===void 0?void 0:r.tools)!==null&&l!==void 0?l:[],B=[];for(const V of P)if(this.isCallableTool(V)){const W=V;B.push(await W.tool())}else B.push(V);B.length>0&&(t.config.tools=B);const U={model:M,config:t.config,callbacks:t.callbacks};return this.apiClient.isVertexAI()?D=hA(this.apiClient,U):D=fA(this.apiClient,U),delete D.config,I.send(JSON.stringify(D)),new sM(I,this.apiClient)}isCallableTool(t){return"callTool"in t&&typeof t.callTool=="function"}}const oM={turnComplete:!0};class sM{constructor(t,n){this.conn=t,this.apiClient=n}tLiveClientContent(t,n){if(n.turns!==null&&n.turns!==void 0){let i=[];try{i=He(n.turns),t.isVertexAI()||(i=i.map(o=>xs(o)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof n.turns}'`)}return{clientContent:{turns:i,turnComplete:n.turnComplete}}}return{clientContent:{turnComplete:n.turnComplete}}}tLiveClienttToolResponse(t,n){let i=[];if(n.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(n.functionResponses)?i=n.functionResponses:i=[n.functionResponses],i.length===0)throw new Error("functionResponses is required.");for(const s of i){if(typeof s!="object"||s===null||!("name"in s)||!("response"in s))throw new Error(`Could not parse function response, type '${typeof s}'.`);if(!t.isVertexAI()&&!("id"in s))throw new Error(eM)}return{toolResponse:{functionResponses:i}}}sendClientContent(t){t=Object.assign(Object.assign({},oM),t);const n=this.tLiveClientContent(this.apiClient,t);this.conn.send(JSON.stringify(n))}sendRealtimeInput(t){let n={};this.apiClient.isVertexAI()?n={realtimeInput:yA(t)}:n={realtimeInput:mA(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 rM(e){const t={};return e.forEach((n,i)=>{t[i]=n}),t}function lM(e){const t=new Headers;for(const[n,i]of Object.entries(e))t.append(n,i);return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const pp=10;function gp(e){var t,n,i;if(!((t=e==null?void 0:e.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let o=!1;for(const r of(n=e==null?void 0:e.tools)!==null&&n!==void 0?n:[])if(eo(r)){o=!0;break}if(!o)return!0;const s=(i=e==null?void 0:e.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls;return s&&(s<0||!Number.isInteger(s))||s==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:",s),!0):!1}function eo(e){return"callTool"in e&&typeof e.callTool=="function"}function aM(e){var t,n,i;return(i=(n=(t=e.config)===null||t===void 0?void 0:t.tools)===null||n===void 0?void 0:n.some(o=>eo(o)))!==null&&i!==void 0?i:!1}function mp(e){var t;const n=[];return!((t=e==null?void 0:e.config)===null||t===void 0)&&t.tools&&e.config.tools.forEach((i,o)=>{if(eo(i))return;const s=i;s.functionDeclarations&&s.functionDeclarations.length>0&&n.push(o)}),n}function yp(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 cM extends Jn{constructor(t){super(),this.apiClient=t,this.embedContent=async n=>{if(!this.apiClient.isVertexAI())return n.model.includes("gemini-embedding-2")&&(n.contents=He(n.contents)),await this.embedContentInternal(n);if(n.model.includes("gemini")&&n.model!=="gemini-embedding-001"||n.model.includes("maas")){const o=He(n.contents);if(o.length>1)throw new Error("The embedContent API for this model only supports one content at a time.");const s=Object.assign(Object.assign({},n),{content:o[0],embeddingApiType:Jr.EMBED_CONTENT});return await this.embedContentInternal(s)}else{const o=Object.assign(Object.assign({},n),{embeddingApiType:Jr.PREDICT});return await this.embedContentInternal(o)}},this.generateContent=async n=>{var i,o,s,r,l;const a=await this.processParamsMaybeAddMcpUsage(n);if(this.maybeMoveToResponseJsonSchem(n),!aM(n)||gp(n.config))return await this.generateContentInternal(a);const c=mp(n);if(c.length>0){const x=c.map(E=>`tools[${E}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${x}.`)}let u,h;const p=He(a.contents),g=(s=(o=(i=a.config)===null||i===void 0?void 0:i.automaticFunctionCalling)===null||o===void 0?void 0:o.maximumRemoteCalls)!==null&&s!==void 0?s:pp;let v=0;for(;v{var i,o,s,r,l;if(this.maybeMoveToResponseJsonSchem(n),gp(n.config)){const h=await this.processParamsMaybeAddMcpUsage(n);return await this.generateContentStreamInternal(h)}const a=mp(n);if(a.length>0){const h=a.map(p=>`tools[${p}]`).join(", ");throw new Error(`Incompatible tools found at ${h}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const c=(s=(o=(i=n==null?void 0:n.config)===null||i===void 0?void 0:i.toolConfig)===null||o===void 0?void 0:o.functionCallingConfig)===null||s===void 0?void 0:s.streamFunctionCallArguments,u=(l=(r=n==null?void 0:n.config)===null||r===void 0?void 0:r.automaticFunctionCalling)===null||l===void 0?void 0:l.disable;if(c&&!u)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(i=>{var o;let s;const r=[];if(i!=null&&i.generatedImages)for(const a of i.generatedImages)a&&(a!=null&&a.safetyAttributes)&&((o=a==null?void 0:a.safetyAttributes)===null||o===void 0?void 0:o.contentType)==="Positive Prompt"?s=a==null?void 0:a.safetyAttributes:r.push(a);let l;return s?l={generatedImages:r,positivePromptSafetyAttributes:s,sdkHttpResponse:i.sdkHttpResponse}:l={generatedImages:r,sdkHttpResponse:i.sdkHttpResponse},l}),this.list=async n=>{var i;const r={config:Object.assign(Object.assign({},{queryBase:!0}),n==null?void 0:n.config)};if(this.apiClient.isVertexAI()&&!r.config.queryBase){if(!((i=r.config)===null||i===void 0)&&i.filter)throw new Error("Filtering tuned models list for Gemini Enterprise Agent Platform (previously known as Vertex AI) is not currently supported");r.config.filter="labels.tune-type:*"}return new Oi(qn.PAGED_ITEM_MODELS,l=>this.listInternal(l),await this.listInternal(r),r)},this.editImage=async n=>{const i={model:n.model,prompt:n.prompt,referenceImages:[],config:n.config};return n.referenceImages&&n.referenceImages&&(i.referenceImages=n.referenceImages.map(o=>o.toReferenceImageAPI())),await this.editImageInternal(i)},this.upscaleImage=async n=>{let i={numberOfImages:1,mode:"upscale"};n.config&&(i=Object.assign(Object.assign({},i),n.config));const o={model:n.model,image:n.image,upscaleFactor:n.upscaleFactor,config:i};return await this.upscaleImageInternal(o)},this.generateVideos=async n=>{var i,o,s,r,l,a;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()||(!((i=n.video)===null||i===void 0)&&i.uri&&(!((o=n.video)===null||o===void 0)&&o.videoBytes)?n.video={uri:n.video.uri,mimeType:n.video.mimeType}:!((r=(s=n.source)===null||s===void 0?void 0:s.video)===null||r===void 0)&&r.uri&&(!((a=(l=n.source)===null||l===void 0?void 0:l.video)===null||a===void 0)&&a.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,i,o;const s=(n=t.config)===null||n===void 0?void 0:n.tools;if(!s)return t;const r=await Promise.all(s.map(async a=>eo(a)?await a.tool():a)),l={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:r})};if(l.config.tools=r,t.config&&t.config.tools&&p0(t.config.tools)){const a=(o=(i=t.config.httpOptions)===null||i===void 0?void 0:i.headers)!==null&&o!==void 0?o:{};let c=Object.assign({},a);Object.keys(c).length===0&&(c=this.apiClient.getDefaultHeaders()),g0(c),l.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:c})}return l}async initAfcToolsMap(t){var n,i,o;const s=new Map;for(const r of(i=(n=t.config)===null||n===void 0?void 0:n.tools)!==null&&i!==void 0?i:[])if(eo(r)){const l=r,a=await l.tool();for(const c of(o=a.functionDeclarations)!==null&&o!==void 0?o:[]){if(!c.name)throw new Error("Function declaration name is required.");if(s.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);s.set(c.name,l)}}return s}async processAfcStream(t){var n,i,o;const s=(o=(i=(n=t.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&o!==void 0?o:pp;let r=!1,l=0;const a=await this.initAfcToolsMap(t);return(function(c,u,h){return rn(this,arguments,function*(){for(var p,g,v,x,E,T;l0){r=!0;const V=new Ro;V.candidates=[{content:{role:"user",parts:B}}],yield yield wt(V);const W=[];W.push(...U),W.push({role:"user",parts:B});const et=He(h.contents).concat(W);h.contents=et}else break}})})(this,a,t)}async generateContentInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=up(this.apiClient,t);return l=lt("{model}:generateContent",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=fp(u),p=new Ro;return Object.assign(p,h),p})}else{const c=cp(this.apiClient,t);return l=lt("{model}:generateContent",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=dp(u),p=new Ro;return Object.assign(p,h),p})}}async generateContentStreamInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=up(this.apiClient,t);return l=lt("{model}:streamGenerateContent?alt=sse",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.requestStream({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}),r.then(function(h){return rn(this,arguments,function*(){var p,g,v,x;try{for(var E=!0,T=ln(h),A;A=yield wt(T.next()),p=A.done,!p;E=!0){x=A.value,E=!1;const I=x,M=fp(yield wt(I.json()),t);M.sdkHttpResponse={headers:I.headers};const D=new Ro;Object.assign(D,M),yield yield wt(D)}}catch(I){g={error:I}}finally{try{!E&&!p&&(v=T.return)&&(yield wt(v.call(T)))}finally{if(g)throw g.error}}})})}else{const c=cp(this.apiClient,t);return l=lt("{model}:streamGenerateContent?alt=sse",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.requestStream({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}),r.then(function(h){return rn(this,arguments,function*(){var p,g,v,x;try{for(var E=!0,T=ln(h),A;A=yield wt(T.next()),p=A.done,!p;E=!0){x=A.value,E=!1;const I=x,M=dp(yield wt(I.json()),t);M.sdkHttpResponse={headers:I.headers};const D=new Ro;Object.assign(D,M),yield yield wt(D)}}catch(I){g={error:I}}finally{try{!E&&!p&&(v=T.return)&&(yield wt(v.call(T)))}finally{if(g)throw g.error}}})})}}async embedContentInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=ZA(this.apiClient,t,t),u=cC(t.model)?"{model}:embedContent":"{model}:predict";return l=lt(u,c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(h=>h.json().then(p=>{const g=p;return g.sdkHttpResponse={headers:h.headers},g})),r.then(h=>{const p=tI(h,t),g=new zh;return Object.assign(g,p),g})}else{const c=QA(this.apiClient,t);return l=lt("{model}:batchEmbedContents",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=jA(u),p=new zh;return Object.assign(p,h),p})}}async generateImagesInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=dI(this.apiClient,t);return l=lt("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=hI(u),p=new Wh;return Object.assign(p,h),p})}else{const c=uI(this.apiClient,t);return l=lt("{model}:predict",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=fI(u),p=new Wh;return Object.assign(p,h),p})}}async editImageInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=JA(this.apiClient,t);return s=lt("{model}:predict",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>{const c=KA(a),u=new O1;return Object.assign(u,c),u})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async upscaleImageInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=hR(this.apiClient,t);return s=lt("{model}:predict",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>{const c=pR(a),u=new V1;return Object.assign(u,c),u})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async recontextImage(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=JI(this.apiClient,t);return s=lt("{model}:predict",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=KI(a),u=new G1;return Object.assign(u,c),u})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async segmentImage(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=tR(this.apiClient,t);return s=lt("{model}:predict",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=eR(a),u=new H1;return Object.assign(u,c),u})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async get(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=MI(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>ec(u))}else{const c=RI(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>tc(u))}}async listInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=OI(this.apiClient,t);return l=lt("{models_url}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=GI(u),p=new Jh;return Object.assign(p,h),p})}else{const c=BI(this.apiClient,t);return l=lt("{models_url}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=VI(u),p=new Jh;return Object.assign(p,h),p})}}async update(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=dR(this.apiClient,t);return l=lt("{model}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>ec(u))}else{const c=uR(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>tc(u))}}async delete(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=$A(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=zA(u),p=new Kh;return Object.assign(p,h),p})}else{const c=HA(this.apiClient,t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=qA(u),p=new Kh;return Object.assign(p,h),p})}}async countTokens(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=OA(this.apiClient,t);return l=lt("{model}:countTokens",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=GA(u),p=new Yh;return Object.assign(p,h),p})}else{const c=BA(this.apiClient,t);return l=lt("{model}:countTokens",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=VA(u),p=new Yh;return Object.assign(p,h),p})}}async computeTokens(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=PA(this.apiClient,t);return s=lt("{model}:computeTokens",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>{const c=kA(a),u=new $1;return Object.assign(u,c),u})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async generateVideosInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=vI(this.apiClient,t);return l=lt("{model}:predictLongRunning",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r.then(u=>{const h=yI(u),p=new Yr;return Object.assign(p,h),p})}else{const c=_I(this.apiClient,t);return l=lt("{model}:predictLongRunning",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const h=mI(u),p=new Yr;return Object.assign(p,h),p})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class uM extends Jn{constructor(t){super(),this.apiClient=t}async getVideosOperation(t){const n=t.operation,i=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 s;i&&"httpOptions"in i&&(s=i.httpOptions);const r=await this.fetchPredictVideosOperationInternal({operationName:n.name,resourceName:o,config:{httpOptions:s}});return n._fromAPIResponse({apiResponse:r,_isVertexAI:!0})}else{const o=await this.getVideosOperationInternal({operationName:n.name,config:i});return n._fromAPIResponse({apiResponse:o,_isVertexAI:!1})}}async get(t){const n=t.operation,i=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 s;i&&"httpOptions"in i&&(s=i.httpOptions);const r=await this.fetchPredictVideosOperationInternal({operationName:n.name,resourceName:o,config:{httpOptions:s}});return n._fromAPIResponse({apiResponse:r,_isVertexAI:!0})}else{const o=await this.getVideosOperationInternal({operationName:n.name,config:i});return n._fromAPIResponse({apiResponse:o,_isVertexAI:!1})}}async getVideosOperationInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=D1(t);return l=lt("{operationName}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json()),r}else{const c=k1(t);return l=lt("{operationName}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r}}async fetchPredictVideosOperationInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=C1(t);return s=lt("{resourceName}:fetchPredictOperation",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function _p(e){const t={};if(d(e,["languageCodes"])!==void 0)throw new Error("languageCodes parameter is not supported in Gemini API.");return t}function dM(e){const t={},n=d(e,["apiKey"]);if(n!=null&&f(t,["apiKey"],n),d(e,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is not supported in Gemini API.");if(d(e,["authType"])!==void 0)throw new Error("authType parameter is not supported in Gemini API.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is not supported in Gemini API.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is not supported in Gemini API.");if(d(e,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is not supported in Gemini API.");if(d(e,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is not supported in Gemini API.");return t}function fM(e){const t={},n=d(e,["data"]);if(n!=null&&f(t,["data"],n),d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function hM(e){const t={},n=d(e,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>EM(s))),f(t,["parts"],o)}const i=d(e,["role"]);return i!=null&&f(t,["role"],i),t}function pM(e,t,n){const i={},o=d(t,["expireTime"]);n!==void 0&&o!=null&&f(n,["expireTime"],o);const s=d(t,["newSessionExpireTime"]);n!==void 0&&s!=null&&f(n,["newSessionExpireTime"],s);const r=d(t,["uses"]);n!==void 0&&r!=null&&f(n,["uses"],r);const l=d(t,["liveConnectConstraints"]);n!==void 0&&l!=null&&f(n,["bidiGenerateContentSetup"],bM(e,l));const a=d(t,["lockAdditionalFields"]);return n!==void 0&&a!=null&&f(n,["fieldMask"],a),i}function gM(e,t){const n={},i=d(t,["config"]);return i!=null&&f(n,["config"],pM(e,i,n)),n}function mM(e){const t={};if(d(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=d(e,["fileUri"]);n!=null&&f(t,["fileUri"],n);const i=d(e,["mimeType"]);return i!=null&&f(t,["mimeType"],i),t}function yM(e){const t={},n=d(e,["id"]);n!=null&&f(t,["id"],n);const i=d(e,["args"]);i!=null&&f(t,["args"],i);const o=d(e,["name"]);if(o!=null&&f(t,["name"],o),d(e,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(d(e,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function _M(e){const t={},n=d(e,["authConfig"]);n!=null&&f(t,["authConfig"],dM(n));const i=d(e,["enableWidget"]);return i!=null&&f(t,["enableWidget"],i),t}function vM(e){const t={},n=d(e,["searchTypes"]);if(n!=null&&f(t,["searchTypes"],n),d(e,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");if(d(e,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");const i=d(e,["timeRangeFilter"]);return i!=null&&f(t,["timeRangeFilter"],i),t}function xM(e,t){const n={},i=d(e,["generationConfig"]);t!==void 0&&i!=null&&f(t,["setup","generationConfig"],i);const o=d(e,["responseModalities"]);t!==void 0&&o!=null&&f(t,["setup","generationConfig","responseModalities"],o);const s=d(e,["temperature"]);t!==void 0&&s!=null&&f(t,["setup","generationConfig","temperature"],s);const r=d(e,["topP"]);t!==void 0&&r!=null&&f(t,["setup","generationConfig","topP"],r);const l=d(e,["topK"]);t!==void 0&&l!=null&&f(t,["setup","generationConfig","topK"],l);const a=d(e,["maxOutputTokens"]);t!==void 0&&a!=null&&f(t,["setup","generationConfig","maxOutputTokens"],a);const c=d(e,["mediaResolution"]);t!==void 0&&c!=null&&f(t,["setup","generationConfig","mediaResolution"],c);const u=d(e,["seed"]);t!==void 0&&u!=null&&f(t,["setup","generationConfig","seed"],u);const h=d(e,["speechConfig"]);t!==void 0&&h!=null&&f(t,["setup","generationConfig","speechConfig"],su(h));const p=d(e,["thinkingConfig"]);t!==void 0&&p!=null&&f(t,["setup","generationConfig","thinkingConfig"],p);const g=d(e,["enableAffectiveDialog"]);t!==void 0&&g!=null&&f(t,["setup","generationConfig","enableAffectiveDialog"],g);const v=d(e,["systemInstruction"]);t!==void 0&&v!=null&&f(t,["setup","systemInstruction"],hM(_e(v)));const x=d(e,["tools"]);if(t!==void 0&&x!=null){let U=ho(x);Array.isArray(U)&&(U=U.map(V=>CM(fo(V)))),f(t,["setup","tools"],U)}const E=d(e,["sessionResumption"]);t!==void 0&&E!=null&&f(t,["setup","sessionResumption"],TM(E));const T=d(e,["inputAudioTranscription"]);t!==void 0&&T!=null&&f(t,["setup","inputAudioTranscription"],_p(T));const A=d(e,["outputAudioTranscription"]);t!==void 0&&A!=null&&f(t,["setup","outputAudioTranscription"],_p(A));const I=d(e,["realtimeInputConfig"]);t!==void 0&&I!=null&&f(t,["setup","realtimeInputConfig"],I);const M=d(e,["contextWindowCompression"]);t!==void 0&&M!=null&&f(t,["setup","contextWindowCompression"],M);const D=d(e,["proactivity"]);if(t!==void 0&&D!=null&&f(t,["setup","proactivity"],D),d(e,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");const P=d(e,["avatarConfig"]);t!==void 0&&P!=null&&f(t,["setup","avatarConfig"],P);const B=d(e,["safetySettings"]);if(t!==void 0&&B!=null){let U=B;Array.isArray(U)&&(U=U.map(V=>wM(V))),f(t,["setup","safetySettings"],U)}return n}function bM(e,t){const n={},i=d(t,["model"]);i!=null&&f(n,["setup","model"],Bt(e,i));const o=d(t,["config"]);return o!=null&&f(n,["config"],xM(o,n)),n}function EM(e){const t={},n=d(e,["mediaResolution"]);n!=null&&f(t,["mediaResolution"],n);const i=d(e,["codeExecutionResult"]);i!=null&&f(t,["codeExecutionResult"],i);const o=d(e,["executableCode"]);o!=null&&f(t,["executableCode"],o);const s=d(e,["fileData"]);s!=null&&f(t,["fileData"],mM(s));const r=d(e,["functionCall"]);r!=null&&f(t,["functionCall"],yM(r));const l=d(e,["functionResponse"]);l!=null&&f(t,["functionResponse"],l);const a=d(e,["inlineData"]);a!=null&&f(t,["inlineData"],fM(a));const c=d(e,["text"]);c!=null&&f(t,["text"],c);const u=d(e,["thought"]);u!=null&&f(t,["thought"],u);const h=d(e,["thoughtSignature"]);h!=null&&f(t,["thoughtSignature"],h);const p=d(e,["videoMetadata"]);p!=null&&f(t,["videoMetadata"],p);const g=d(e,["toolCall"]);g!=null&&f(t,["toolCall"],g);const v=d(e,["toolResponse"]);v!=null&&f(t,["toolResponse"],v);const x=d(e,["partMetadata"]);return x!=null&&f(t,["partMetadata"],x),t}function wM(e){const t={},n=d(e,["category"]);if(n!=null&&f(t,["category"],n),d(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const i=d(e,["threshold"]);return i!=null&&f(t,["threshold"],i),t}function TM(e){const t={},n=d(e,["handle"]);if(n!=null&&f(t,["handle"],n),d(e,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function CM(e){const t={};if(d(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const n=d(e,["computerUse"]);n!=null&&f(t,["computerUse"],n);const i=d(e,["fileSearch"]);i!=null&&f(t,["fileSearch"],i);const o=d(e,["googleSearch"]);o!=null&&f(t,["googleSearch"],vM(o));const s=d(e,["googleMaps"]);s!=null&&f(t,["googleMaps"],_M(s));const r=d(e,["codeExecution"]);if(r!=null&&f(t,["codeExecution"],r),d(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=d(e,["functionDeclarations"]);if(l!=null){let h=l;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["functionDeclarations"],h)}const a=d(e,["googleSearchRetrieval"]);if(a!=null&&f(t,["googleSearchRetrieval"],a),d(e,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is not supported in Gemini API.");const c=d(e,["urlContext"]);c!=null&&f(t,["urlContext"],c);const u=d(e,["mcpServers"]);if(u!=null){let h=u;Array.isArray(h)&&(h=h.map(p=>p)),f(t,["mcpServers"],h)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function SM(e){const t=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n];if(typeof i=="object"&&i!=null&&Object.keys(i).length>0){const o=Object.keys(i).map(s=>`${n}.${s}`);t.push(...o)}else t.push(n)}return t.join(",")}function AM(e,t){let n=null;const i=e.bidiGenerateContentSetup;if(typeof i=="object"&&i!==null&&"setup"in i){const s=i.setup;typeof s=="object"&&s!==null?(e.bidiGenerateContentSetup=s,n=s):delete e.bidiGenerateContentSetup}else i!==void 0&&delete e.bidiGenerateContentSetup;const o=e.fieldMask;if(n){const s=SM(n);if(Array.isArray(t==null?void 0:t.lockAdditionalFields)&&(t==null?void 0:t.lockAdditionalFields.length)===0)s?e.fieldMask=s:delete e.fieldMask;else if(t!=null&&t.lockAdditionalFields&&t.lockAdditionalFields.length>0&&o!==null&&Array.isArray(o)&&o.length>0){const r=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let l=[];o.length>0&&(l=o.map(c=>r.includes(c)?`generationConfig.${c}`:c));const a=[];s&&a.push(s),l.length>0&&a.push(...l),a.length>0?e.fieldMask=a.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 IM extends Jn{constructor(t){super(),this.apiClient=t}async create(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const l=gM(this.apiClient,t);s=lt("auth_tokens",l._url),r=l._query,delete l.config,delete l._url,delete l._query;const a=AM(l,t.config);return o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>c)}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function RM(e,t){const n={},i=d(e,["force"]);return t!==void 0&&i!=null&&f(t,["_query","force"],i),n}function MM(e){const t={},n=d(e,["name"]);n!=null&&f(t,["_url","name"],n);const i=d(e,["config"]);return i!=null&&RM(i,t),t}function PM(e){const t={},n=d(e,["name"]);return n!=null&&f(t,["_url","name"],n),t}function kM(e,t){const n={},i=d(e,["pageSize"]);t!==void 0&&i!=null&&f(t,["_query","pageSize"],i);const o=d(e,["pageToken"]);return t!==void 0&&o!=null&&f(t,["_query","pageToken"],o),n}function DM(e){const t={},n=d(e,["parent"]);n!=null&&f(t,["_url","parent"],n);const i=d(e,["config"]);return i!=null&&kM(i,t),t}function NM(e){const t={},n=d(e,["sdkHttpResponse"]);n!=null&&f(t,["sdkHttpResponse"],n);const i=d(e,["nextPageToken"]);i!=null&&f(t,["nextPageToken"],i);const o=d(e,["documents"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),f(t,["documents"],s)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class LM extends Jn{constructor(t){super(),this.apiClient=t,this.list=async n=>new Oi(qn.PAGED_ITEM_DOCUMENTS,i=>this.listInternal({parent:n.parent,config:i.config}),await this.listInternal(n),n)}async get(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=PM(t);return s=lt("{name}",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>a)}}async delete(t){var n,i;let o="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const r=MM(t);o=lt("{name}",r._url),s=r._query,delete r._url,delete r._query,await this.apiClient.request({path:o,queryParams:s,body:JSON.stringify(r),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal})}}async listInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=DM(t);return s=lt("{parent}/documents",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=NM(a),u=new z1;return Object.assign(u,c),u})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class FM extends Jn{constructor(t,n=new LM(t)){super(),this.apiClient=t,this.documents=n,this.list=async(i={})=>new Oi(qn.PAGED_ITEM_FILE_SEARCH_STORES,o=>this.listInternal(o),await this.listInternal(i),i)}async uploadToFileSearchStore(t){if(this.apiClient.isVertexAI())throw new Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(t.fileSearchStoreName,t.file,t.config)}async downloadMedia(t,n){if(this.apiClient.isVertexAI())throw new Error("This method is only supported in the Gemini Developer client.");const i=new URL(t,"http://dummy.com");let o=i.pathname;if(o.startsWith("/")&&(o=o.slice(1)),!o.includes("/media/"))throw new Error(`Invalid uri format: ${t}. Expected to contain /media/`);const s={};i.searchParams.forEach((a,c)=>{s[c]=a}),s.alt="media";const r=Object.assign({},n==null?void 0:n.httpOptions),l=await this.apiClient.request({path:o,httpMethod:"GET",queryParams:s,httpOptions:r});if(l instanceof Kr){const a=await l.responseInternal.arrayBuffer();return new Uint8Array(a)}else throw new Error("Unexpected response type from downloadMedia")}async create(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=bR(this.apiClient,t);return s=lt("fileSearchStores",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>a)}}async get(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=TR(t);return s=lt("{name}",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>a)}}async delete(t){var n,i;let o="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const r=wR(t);o=lt("{name}",r._url),s=r._query,delete r._url,delete r._query,await this.apiClient.request({path:o,queryParams:s,body:JSON.stringify(r),httpMethod:"DELETE",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal})}}async listInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=MR(t);return s=lt("fileSearchStores",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=PR(a),u=new W1;return Object.assign(u,c),u})}}async uploadToFileSearchStoreInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=kR(t);return s=lt("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=DR(a),u=new J1;return Object.assign(u,c),u})}}async importFile(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=AR(t);return s=lt("{file_search_store_name}:importFile",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json()),o.then(a=>{const c=SR(a),u=new tu;return Object.assign(u,c),u})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let m0=function(){const{crypto:e}=globalThis;if(e!=null&&e.randomUUID)return m0=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,i=>(+i^n()&15>>+i/4).toString(16))};const UM=()=>m0();/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function ic(e){return typeof e=="object"&&e!==null&&("name"in e&&e.name==="AbortError"||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}const oc=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 tn extends Error{}class Fe extends tn{constructor(t,n,i,o){super(`${Fe.makeMessage(t,n,i)}`),this.status=t,this.headers=o,this.error=n}static makeMessage(t,n,i){const o=n!=null&&n.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):i;return t&&o?`${t} ${o}`:t?`${t} status code (no body)`:o||"(no status code or body)"}static generate(t,n,i,o){if(!t||!o)return new El({message:i,cause:oc(n)});const s=n;return t===400?new _0(t,s,i,o):t===401?new v0(t,s,i,o):t===403?new x0(t,s,i,o):t===404?new b0(t,s,i,o):t===409?new E0(t,s,i,o):t===422?new w0(t,s,i,o):t===429?new T0(t,s,i,o):t>=500?new C0(t,s,i,o):new Fe(t,s,i,o)}}class sc extends Fe{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class El extends Fe{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}}class y0 extends El{constructor({message:t}={}){super({message:t??"Request timed out."})}}class _0 extends Fe{}class v0 extends Fe{}class x0 extends Fe{}class b0 extends Fe{}class E0 extends Fe{}class w0 extends Fe{}class T0 extends Fe{}class C0 extends Fe{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const BM=/^[a-z][a-z0-9+.-]*:/i,OM=e=>BM.test(e);let rc=e=>(rc=Array.isArray,rc(e));const VM=rc;let GM=VM;const vp=GM;function xp(e){if(!e)return!0;for(const t in e)return!1;return!0}function HM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const $M=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new tn(`${e} must be an integer`);if(t<0)throw new tn(`${e} must be a positive integer`);return t},qM=e=>{try{return JSON.parse(e)}catch{return}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const zM=e=>new Promise(t=>setTimeout(t,e));/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function WM(){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 S0(...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 JM(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return S0({start(){},async pull(n){const{done:i,value:o}=await t.next();i?n.close():n.enqueue(o)},async cancel(){var n;await((n=t.return)===null||n===void 0?void 0:n.call(t))}})}function A0(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 KM(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 i=e.getReader(),o=i.cancel();i.releaseLock(),await o}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const YM=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function XM(e){return Object.entries(e).filter(([t,n])=>typeof n<"u").map(([t,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(t)}=`;throw new tn(`Cannot stringify type ${typeof n}; 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("&")}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const QM="0.0.1";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const I0=()=>{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 da(e,t,n){return I0(),new File(e,t??"unknown_file",n)}function ZM(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 jM=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const R0=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",tP=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&R0(e),eP=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function";async function nP(e,t,n){if(I0(),e=await e,tP(e))return e instanceof File?e:da([await e.arrayBuffer()],e.name);if(eP(e)){const o=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),da(await lc(o),t,n)}const i=await lc(e);if(t||(t=ZM(e)),!(n!=null&&n.type)){const o=i.find(s=>typeof s=="object"&&"type"in s&&s.type);typeof o=="string"&&(n=Object.assign(Object.assign({},n),{type:o}))}return da(i,t,n)}async function lc(e){var t,n,i,o,s;let r=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)r.push(e);else if(R0(e))r.push(e instanceof Blob?e:await e.arrayBuffer());else if(jM(e))try{for(var l=!0,a=ln(e),c;c=await a.next(),t=c.done,!t;l=!0){o=c.value,l=!1;const u=o;r.push(...await lc(u))}}catch(u){n={error:u}}finally{try{!l&&!t&&(i=a.return)&&await i.call(a)}finally{if(n)throw n.error}}else{const u=(s=e==null?void 0:e.constructor)===null||s===void 0?void 0:s.name;throw new Error(`Unexpected data type: ${typeof e}${u?`; constructor: ${u}`:""}${iP(e)}`)}return r}function iP(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 lu{constructor(t){this._client=t}}lu._key=[];/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function M0(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const bp=Object.freeze(Object.create(null)),oP=(e=M0)=>(function(n,...i){if(n.length===1)return n[0];let o=!1;const s=[],r=n.reduce((u,h,p)=>{var g,v,x;/[?#]/.test(h)&&(o=!0);const E=i[p];let T=(o?encodeURIComponent:e)(""+E);return p!==i.length&&(E==null||typeof E=="object"&&E.toString===((x=Object.getPrototypeOf((v=Object.getPrototypeOf((g=E.hasOwnProperty)!==null&&g!==void 0?g:bp))!==null&&v!==void 0?v:bp))===null||x===void 0?void 0:x.toString))&&(T=E+"",s.push({start:u.length+h.length,length:T.length,error:`Value of type ${Object.prototype.toString.call(E).slice(8,-1)} is not a valid path parameter`})),u+h+(p===i.length?"":T)},""),l=r.split(/[?#]/,1)[0],a=/(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;let c;for(;(c=a.exec(l))!==null;){const u=c[0].startsWith("/"),h=u?1:0,p=u?c[0].slice(1):c[0];s.push({start:c.index+h,length:p.length,error:`Value "${p}" can't be safely passed as a path parameter`})}if(s.sort((u,h)=>u.start-h.start),s.length>0){let u=0;const h=s.reduce((p,g)=>{const v=" ".repeat(g.start-u),x="^".repeat(g.length);return u=g.start+g.length,p+v+x},"");throw new tn(`Path parameters result in path with invalid segments: ${s.map(p=>p.error).join(` `)} ${r} ${h}`)}return r}),en=oP(M0);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class P0 extends lu{create(t,n){var i;const{api_version:o=this._client.apiVersion}=t,s=si(t,["api_version"]);if("model"in s&&"agent_config"in s)throw new tn("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in s&&"generation_config"in s)throw new tn("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(en`/${o}/interactions`,Object.assign(Object.assign({body:s},n),{stream:(i=t.stream)!==null&&i!==void 0?i:!1}))}delete(t,n={},i){const{api_version:o=this._client.apiVersion}=n??{};return this._client.delete(en`/${o}/interactions/${t}`,i)}cancel(t,n={},i){const{api_version:o=this._client.apiVersion}=n??{};return this._client.post(en`/${o}/interactions/${t}/cancel`,i)}get(t,n={},i){var o;const s=n??{},{api_version:r=this._client.apiVersion}=s,l=si(s,["api_version"]);return this._client.get(en`/${r}/interactions/${t}`,Object.assign(Object.assign({query:l},i),{stream:(o=n==null?void 0:n.stream)!==null&&o!==void 0?o:!1}))}}P0._key=Object.freeze(["interactions"]);class k0 extends P0{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class D0 extends lu{create(t,n){const{api_version:i=this._client.apiVersion}=t,o=si(t,["api_version"]);return this._client.post(en`/${i}/webhooks`,Object.assign({body:o},n))}update(t,n={},i){const o=n??{},{api_version:s=this._client.apiVersion,update_mask:r}=o,l=si(o,["api_version","update_mask"]);return this._client.patch(en`/${s}/webhooks/${t}`,Object.assign({query:{update_mask:r},body:l},i))}list(t={},n){const i=t??{},{api_version:o=this._client.apiVersion}=i,s=si(i,["api_version"]);return this._client.get(en`/${o}/webhooks`,Object.assign({query:s},n))}delete(t,n={},i){const{api_version:o=this._client.apiVersion}=n??{};return this._client.delete(en`/${o}/webhooks/${t}`,i)}get(t,n={},i){const{api_version:o=this._client.apiVersion}=n??{};return this._client.get(en`/${o}/webhooks/${t}`,i)}ping(t,n=void 0,i){const{api_version:o=this._client.apiVersion,body:s}=n??{};return this._client.post(en`/${o}/webhooks/${t}:ping`,Object.assign({body:s},i))}rotateSigningSecret(t,n={},i){const o=n??{},{api_version:s=this._client.apiVersion}=o,r=si(o,["api_version"]);return this._client.post(en`/${s}/webhooks/${t}:rotateSigningSecret`,Object.assign({body:r},i))}}D0._key=Object.freeze(["webhooks"]);class N0 extends D0{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function sP(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let i=0;for(const o of e)n.set(o,i),i+=o.length;return n}let ir;function au(e){let t;return(ir??(t=new globalThis.TextEncoder,ir=t.encode.bind(t)))(e)}let or;function Ep(e){let t;return(or??(t=new globalThis.TextDecoder,or=t.decode.bind(t)))(e)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class wl{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null,this.searchIndex=0}decode(t){var n;if(t==null)return[];const i=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?au(t):t;this.buffer=sP([this.buffer,i]);const o=[];let s;for(;(s=rP(this.buffer,(n=this.carriageReturnIndex)!==null&&n!==void 0?n:this.searchIndex))!=null;){if(s.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=s.index;continue}if(this.carriageReturnIndex!=null&&(s.index!==this.carriageReturnIndex+1||s.carriage)){o.push(Ep(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null,this.searchIndex=0;continue}const r=this.carriageReturnIndex!==null?s.preceding-1:s.preceding,l=Ep(this.buffer.subarray(0,r));o.push(l),this.buffer=this.buffer.subarray(s.index),this.carriageReturnIndex=null,this.searchIndex=0}return this.searchIndex=Math.max(0,this.buffer.length-1),o}flush(){return this.buffer.length?this.decode(` `):[]}}wl.NEWLINE_CHARS=new Set([` `,"\r"]);wl.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function rP(e,t){const o=t??0,s=e.indexOf(10,o),r=e.indexOf(13,o);if(s===-1&&r===-1)return null;let l;return s!==-1&&r!==-1?l=Math.min(s,r):l=s!==-1?s:r,e[l]===10?{preceding:l,index:l+1,carriage:!1}:{preceding:l,index:l+1,carriage:!0}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Qr={off:0,error:200,warn:300,info:400,debug:500},wp=(e,t,n)=>{if(e){if(HM(Qr,e))return e;ke(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Qr))}`)}};function Vo(){}function sr(e,t,n){return!t||Qr[e]>Qr[n]?Vo:t[e].bind(t)}const lP={error:Vo,warn:Vo,info:Vo,debug:Vo};let Tp=new WeakMap;function ke(e){var t;const n=e.logger,i=(t=e.logLevel)!==null&&t!==void 0?t:"off";if(!n)return lP;const o=Tp.get(n);if(o&&o[0]===i)return o[1];const s={error:sr("error",n,i),warn:sr("warn",n,i),info:sr("info",n,i),debug:sr("debug",n,i)};return Tp.set(n,[i,s]),s}const Si=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 Ki{constructor(t,n,i){this.iterator=t,this.controller=n,this.client=i}static fromSSEResponse(t,n,i){let o=!1;const s=i?ke(i):console;function r(){return rn(this,arguments,function*(){var a,c,u,h;if(o)throw new tn("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let p=!1;try{try{for(var g=!0,v=ln(aP(t,n)),x;x=yield wt(v.next()),a=x.done,!a;g=!0){h=x.value,g=!1;const E=h;if(!p)if(E.data.startsWith("[DONE]")){p=!0;continue}else try{yield yield wt(JSON.parse(E.data))}catch(T){throw s.error("Could not parse message into JSON:",E.data),s.error("From chunk:",E.raw),T}}}catch(E){c={error:E}}finally{try{!g&&!a&&(u=v.return)&&(yield wt(u.call(v)))}finally{if(c)throw c.error}}p=!0}catch(E){if(ic(E))return yield wt(void 0);throw E}finally{p||n.abort()}})}return new Ki(r,n,i)}static fromReadableStream(t,n,i){let o=!1;function s(){return rn(this,arguments,function*(){var a,c,u,h;const p=new wl,g=A0(t);try{for(var v=!0,x=ln(g),E;E=yield wt(x.next()),a=E.done,!a;v=!0){h=E.value,v=!1;const T=h;for(const A of p.decode(T))yield yield wt(A)}}catch(T){c={error:T}}finally{try{!v&&!a&&(u=x.return)&&(yield wt(u.call(x)))}finally{if(c)throw c.error}}for(const T of p.flush())yield yield wt(T)})}function r(){return rn(this,arguments,function*(){var a,c,u,h;if(o)throw new tn("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let p=!1;try{try{for(var g=!0,v=ln(s()),x;x=yield wt(v.next()),a=x.done,!a;g=!0){h=x.value,g=!1;const E=h;p||E&&(yield yield wt(JSON.parse(E)))}}catch(E){c={error:E}}finally{try{!g&&!a&&(u=v.return)&&(yield wt(u.call(v)))}finally{if(c)throw c.error}}p=!0}catch(E){if(ic(E))return yield wt(void 0);throw E}finally{p||n.abort()}})}return new Ki(r,n,i)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],n=[],i=this.iterator(),o=s=>({next:()=>{if(s.length===0){const r=i.next();t.push(r),n.push(r)}return s.shift()}});return[new Ki(()=>o(t),this.controller,this.client),new Ki(()=>o(n),this.controller,this.client)]}toReadableStream(){const t=this;let n;return S0({async start(){n=t[Symbol.asyncIterator]()},async pull(i){try{const{value:o,done:s}=await n.next();if(s)return i.close();const r=au(JSON.stringify(o)+` `);i.enqueue(r)}catch(o){i.error(o)}},async cancel(){var i;await((i=n.return)===null||i===void 0?void 0:i.call(n))}})}}function aP(e,t){return rn(this,arguments,function*(){var i,o,s,r;if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new tn("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 tn("Attempted to iterate over a response with no body");const l=new uP,a=new wl,c=A0(e.body);try{for(var u=!0,h=ln(cP(c)),p;p=yield wt(h.next()),i=p.done,!i;u=!0){r=p.value,u=!1;const g=r;for(const v of a.decode(g)){const x=l.decode(v);x&&(yield yield wt(x))}}}catch(g){o={error:g}}finally{try{!u&&!i&&(s=h.return)&&(yield wt(s.call(h)))}finally{if(o)throw o.error}}for(const g of a.flush()){const v=l.decode(g);v&&(yield yield wt(v))}})}function cP(e){return rn(this,arguments,function*(){var n,i,o,s;try{for(var r=!0,l=ln(e),a;a=yield wt(l.next()),n=a.done,!n;r=!0){s=a.value,r=!1;const c=s;if(c==null)continue;const u=c instanceof ArrayBuffer?new Uint8Array(c):typeof c=="string"?au(c):c;yield yield wt(u)}}catch(c){i={error:c}}finally{try{!r&&!n&&(o=l.return)&&(yield wt(o.call(l)))}finally{if(i)throw i.error}}})}class uP{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 s={event:this.event,data:this.data.join(` `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(t),t.startsWith(":"))return null;let[n,i,o]=dP(t,":");return o.startsWith(" ")&&(o=o.substring(1)),n==="event"?this.event=o:n==="data"&&this.data.push(o),null}}function dP(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 fP(e,t){const{response:n,requestLogID:i,retryOfRequestLogID:o,startTime:s}=t,r=await(async()=>{var l;if(t.options.stream)return ke(e).debug("response",n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller,e):Ki.fromSSEResponse(n,t.controller,e);if(n.status===204)return null;if(t.options.__binaryResponse)return n;const a=n.headers.get("content-type"),c=(l=a==null?void 0:a.split(";")[0])===null||l===void 0?void 0:l.trim();return(c==null?void 0:c.includes("application/json"))||(c==null?void 0:c.endsWith("+json"))?n.headers.get("content-length")==="0"?void 0:await n.json():await n.text()})();return ke(e).debug(`[${i}] response parsed`,Si({retryOfRequestLogID:o,url:n.url,status:n.status,body:r,durationMs:Date.now()-s})),r}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class cu extends Promise{constructor(t,n,i=fP){super(o=>{o(null)}),this.responsePromise=n,this.parseResponse=i,this.client=t}_thenUnwrap(t){return new cu(this.client,this.responsePromise,async(n,i)=>t(await this.parseResponse(n,i),i))}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 L0=Symbol("brand.privateNullableHeaders");function*hP(e){if(!e)return;if(L0 in e){const{values:i,nulls:o}=e;yield*i.entries();for(const s of o)yield[s,null];return}let t=!1,n;e instanceof Headers?n=e.entries():vp(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let i of n){const o=i[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");const s=vp(i[1])?i[1]:[i[1]];let r=!1;for(const l of s)l!==void 0&&(t&&!r&&(r=!0,yield[o,null]),yield[o,l])}}const Mo=e=>{const t=new Headers,n=new Set;for(const i of e){const o=new Set;for(const[s,r]of hP(i)){const l=s.toLowerCase();o.has(l)||(t.delete(s),o.add(l)),r===null?(t.delete(s),n.add(l)):(t.append(s,r),n.delete(l))}}return{[L0]:!0,values:t,nulls:n}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const fa=e=>{var t,n,i,o,s;if(typeof globalThis.process<"u")return((n=(t=v1)===null||t===void 0?void 0:t[e])===null||n===void 0?void 0:n.trim())||void 0;if(typeof globalThis.Deno<"u")return((s=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,e))===null||s===void 0?void 0:s.trim())||void 0};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var F0;class Tl{constructor(t){var n,i,o,s,r,l,a,{baseURL:c=fa("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:u=(n=fa("GEMINI_API_KEY"))!==null&&n!==void 0?n:null,apiVersion:h="v1beta"}=t,p=si(t,["baseURL","apiKey","apiVersion"]);const g=Object.assign(Object.assign({apiKey:u,apiVersion:h},p),{baseURL:c||"https://generativelanguage.googleapis.com"});this.baseURL=g.baseURL,this.timeout=(i=g.timeout)!==null&&i!==void 0?i:Tl.DEFAULT_TIMEOUT,this.logger=(o=g.logger)!==null&&o!==void 0?o:console;const v="warn";this.logLevel=v,this.logLevel=(r=(s=wp(g.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:wp(fa("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&r!==void 0?r:v,this.fetchOptions=g.fetchOptions,this.maxRetries=(l=g.maxRetries)!==null&&l!==void 0?l:2,this.fetch=(a=g.fetch)!==null&&a!==void 0?a:WM(),this.encoder=YM,this._options=g,this.apiKey=u,this.apiVersion=h,this.clientAdapter=g.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=Mo([t.headers]);if(!(n.values.has("authorization")||n.values.has("x-goog-api-key"))){if(this.apiKey)return Mo([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter&&this.clientAdapter.isVertexAI())return Mo([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return XM(t)}getUserAgent(){return`${this.constructor.name}/JS ${QM}`}defaultIdempotencyKey(){return`stainless-node-retry-${UM()}`}makeStatusError(t,n,i,o){return Fe.generate(t,n,i,o)}buildURL(t,n,i){const o=!this.baseURLOverridden()&&i||this.baseURL,s=OM(t)?new URL(t):new URL(o+(o.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),r=this.defaultQuery(),l=Object.fromEntries(s.searchParams);return(!xp(r)||!xp(l))&&(n=Object.assign(Object.assign(Object.assign({},l),r),n)),typeof n=="object"&&n&&!Array.isArray(n)&&(s.search=this.stringifyQuery(n)),s.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:i}){}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,i){return this.request(Promise.resolve(i).then(o=>Object.assign({method:t,path:n},o)))}request(t,n=null){return new cu(this,this.makeRequest(t,n,void 0))}async makeRequest(t,n,i){var o,s,r;const l=await t,a=(o=l.maxRetries)!==null&&o!==void 0?o:this.maxRetries;n==null&&(n=a),await this.prepareOptions(l);const{req:c,url:u,timeout:h}=await this.buildRequest(l,{retryCount:a-n});await this.prepareRequest(c,{url:u,options:l});const p="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),g=i===void 0?"":`, retryOf: ${i}`,v=Date.now();if(ke(this).debug(`[${p}] sending request`,Si({retryOfRequestLogID:i,method:l.method,url:u,options:l,headers:c.headers})),!((s=l.signal)===null||s===void 0)&&s.aborted)throw new sc;const x=new AbortController,E=await this.fetchWithTimeout(u,c,h,x).catch(oc),T=Date.now();if(E instanceof globalThis.Error){const I=`retrying, ${n} attempts remaining`;if(!((r=l.signal)===null||r===void 0)&&r.aborted)throw new sc;const M=ic(E)||/timed? ?out/i.test(String(E)+("cause"in E?String(E.cause):""));if(n)return ke(this).info(`[${p}] connection ${M?"timed out":"failed"} - ${I}`),ke(this).debug(`[${p}] connection ${M?"timed out":"failed"} (${I})`,Si({retryOfRequestLogID:i,url:u,durationMs:T-v,message:E.message})),this.retryRequest(l,n,i??p);throw ke(this).info(`[${p}] connection ${M?"timed out":"failed"} - error; no more retries left`),ke(this).debug(`[${p}] connection ${M?"timed out":"failed"} (error; no more retries left)`,Si({retryOfRequestLogID:i,url:u,durationMs:T-v,message:E.message})),M?new y0:new El({cause:E})}const A=`[${p}${g}] ${c.method} ${u} ${E.ok?"succeeded":"failed"} with status ${E.status} in ${T-v}ms`;if(!E.ok){const I=await this.shouldRetry(E);if(n&&I){const V=`retrying, ${n} attempts remaining`;return await KM(E.body),ke(this).info(`${A} - ${V}`),ke(this).debug(`[${p}] response error (${V})`,Si({retryOfRequestLogID:i,url:E.url,status:E.status,headers:E.headers,durationMs:T-v})),this.retryRequest(l,n,i??p,E.headers)}const M=I?"error; no more retries left":"error; not retryable";ke(this).info(`${A} - ${M}`);const D=await E.text().catch(V=>oc(V).message),P=qM(D),B=P?void 0:D;throw ke(this).debug(`[${p}] response error (${M})`,Si({retryOfRequestLogID:i,url:E.url,status:E.status,headers:E.headers,message:B,durationMs:Date.now()-v})),this.makeStatusError(E.status,P,B,E.headers)}return ke(this).info(A),ke(this).debug(`[${p}] response start`,Si({retryOfRequestLogID:i,url:E.url,status:E.status,headers:E.headers,durationMs:T-v})),{response:E,options:l,controller:x,requestLogID:p,retryOfRequestLogID:i,startTime:v}}async fetchWithTimeout(t,n,i,o){const s=n||{},{signal:r,method:l}=s,a=si(s,["signal","method"]),c=this._makeAbort(o);r&&r.addEventListener("abort",c,{once:!0});const u=setTimeout(c,i),h=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,p=Object.assign(Object.assign(Object.assign({signal:o.signal},h?{duplex:"half"}:{}),{method:"GET"}),a);l&&(p.method=l.toUpperCase());try{return await this.fetch.call(void 0,t,p)}finally{clearTimeout(u)}}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,i,o){var s;let r;const l=o==null?void 0:o.get("retry-after-ms");if(l){const c=parseFloat(l);Number.isNaN(c)||(r=c)}const a=o==null?void 0:o.get("retry-after");if(a&&!r){const c=parseFloat(a);Number.isNaN(c)?r=Date.parse(a)-Date.now():r=c*1e3}if(r===void 0){const c=(s=t.maxRetries)!==null&&s!==void 0?s:this.maxRetries;r=this.calculateDefaultRetryTimeoutMillis(n,c)}return await zM(r),this.makeRequest(t,n-1,i)}calculateDefaultRetryTimeoutMillis(t,n){const s=n-t,r=Math.min(.5*Math.pow(2,s),8),l=1-Math.random()*.25;return r*l*1e3}async buildRequest(t,{retryCount:n=0}={}){var i,o,s;const r=Object.assign({},t),{method:l,path:a,query:c,defaultBaseURL:u}=r,h=this.buildURL(a,c,u);"timeout"in r&&$M("timeout",r.timeout),r.timeout=(i=r.timeout)!==null&&i!==void 0?i:this.timeout;const{bodyHeaders:p,body:g}=this.buildBody({options:r}),v=await this.buildHeaders({options:t,method:l,bodyHeaders:p,retryCount:n});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:l,headers:v},r.signal&&{signal:r.signal}),globalThis.ReadableStream&&g instanceof globalThis.ReadableStream&&{duplex:"half"}),g&&{body:g}),(o=this.fetchOptions)!==null&&o!==void 0?o:{}),(s=r.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:r.timeout}}async buildHeaders({options:t,method:n,bodyHeaders:i,retryCount:o}){let s={};this.idempotencyHeader&&n!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=t.idempotencyKey);const r=await this.authHeaders(t);let l=Mo([s,{Accept:"application/json","User-Agent":this.getUserAgent()},this._options.defaultHeaders,i,t.headers,r]);return this.validateHeaders(l),l.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:n}}){if(!t)return{bodyHeaders:void 0,body:void 0};const i=Mo([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&i.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:JM(t)}:typeof t=="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:this.encoder({body:t,headers:i})}}Tl.DEFAULT_TIMEOUT=6e4;class me extends Tl{constructor(){super(...arguments),this.interactions=new k0(this),this.webhooks=new N0(this)}}F0=me;me.GeminiNextGenAPIClient=F0;me.GeminiNextGenAPIClientError=tn;me.APIError=Fe;me.APIConnectionError=El;me.APIConnectionTimeoutError=y0;me.APIUserAbortError=sc;me.NotFoundError=b0;me.ConflictError=E0;me.RateLimitError=T0;me.BadRequestError=_0;me.AuthenticationError=v0;me.InternalServerError=C0;me.PermissionDeniedError=x0;me.UnprocessableEntityError=w0;me.toFile=nP;me.Interactions=k0;me.Webhooks=N0;/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function pP(e,t){const n={},i=d(e,["name"]);return i!=null&&f(n,["_url","name"],i),n}function gP(e,t){const n={},i=d(e,["name"]);return i!=null&&f(n,["_url","name"],i),n}function mP(e,t){const n={},i=d(e,["sdkHttpResponse"]);return i!=null&&f(n,["sdkHttpResponse"],i),n}function yP(e,t){const n={},i=d(e,["sdkHttpResponse"]);return i!=null&&f(n,["sdkHttpResponse"],i),n}function _P(e,t,n){const i={};if(d(e,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const o=d(e,["tunedModelDisplayName"]);if(t!==void 0&&o!=null&&f(t,["displayName"],o),d(e,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const s=d(e,["epochCount"]);t!==void 0&&s!=null&&f(t,["tuningTask","hyperparameters","epochCount"],s);const r=d(e,["learningRateMultiplier"]);if(r!=null&&f(i,["tuningTask","hyperparameters","learningRateMultiplier"],r),d(e,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(d(e,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(d(e,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");if(d(e,["tuningMode"])!==void 0)throw new Error("tuningMode parameter is not supported in Gemini API.");if(d(e,["customBaseModel"])!==void 0)throw new Error("customBaseModel parameter is not supported in Gemini API.");const l=d(e,["batchSize"]);t!==void 0&&l!=null&&f(t,["tuningTask","hyperparameters","batchSize"],l);const a=d(e,["learningRate"]);if(t!==void 0&&a!=null&&f(t,["tuningTask","hyperparameters","learningRate"],a),d(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(d(e,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");if(d(e,["baseTeacherModel"])!==void 0)throw new Error("baseTeacherModel parameter is not supported in Gemini API.");if(d(e,["tunedTeacherModelSource"])!==void 0)throw new Error("tunedTeacherModelSource parameter is not supported in Gemini API.");if(d(e,["sftLossWeightMultiplier"])!==void 0)throw new Error("sftLossWeightMultiplier parameter is not supported in Gemini API.");if(d(e,["outputUri"])!==void 0)throw new Error("outputUri parameter is not supported in Gemini API.");if(d(e,["encryptionSpec"])!==void 0)throw new Error("encryptionSpec parameter is not supported in Gemini API.");return i}function vP(e,t,n){const i={};let o=d(n,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){const P=d(e,["validationDataset"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec"],ha(P))}else if(o==="PREFERENCE_TUNING"){const P=d(e,["validationDataset"]);t!==void 0&&P!=null&&f(t,["preferenceOptimizationSpec"],ha(P))}else if(o==="DISTILLATION"){const P=d(e,["validationDataset"]);t!==void 0&&P!=null&&f(t,["distillationSpec"],ha(P))}const s=d(e,["tunedModelDisplayName"]);t!==void 0&&s!=null&&f(t,["tunedModelDisplayName"],s);const r=d(e,["description"]);t!==void 0&&r!=null&&f(t,["description"],r);let l=d(n,["config","method"]);if(l===void 0&&(l="SUPERVISED_FINE_TUNING"),l==="SUPERVISED_FINE_TUNING"){const P=d(e,["epochCount"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","hyperParameters","epochCount"],P)}else if(l==="PREFERENCE_TUNING"){const P=d(e,["epochCount"]);t!==void 0&&P!=null&&f(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],P)}else if(l==="DISTILLATION"){const P=d(e,["epochCount"]);t!==void 0&&P!=null&&f(t,["distillationSpec","hyperParameters","epochCount"],P)}let a=d(n,["config","method"]);if(a===void 0&&(a="SUPERVISED_FINE_TUNING"),a==="SUPERVISED_FINE_TUNING"){const P=d(e,["learningRateMultiplier"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],P)}else if(a==="PREFERENCE_TUNING"){const P=d(e,["learningRateMultiplier"]);t!==void 0&&P!=null&&f(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],P)}else if(a==="DISTILLATION"){const P=d(e,["learningRateMultiplier"]);t!==void 0&&P!=null&&f(t,["distillationSpec","hyperParameters","learningRateMultiplier"],P)}let c=d(n,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){const P=d(e,["exportLastCheckpointOnly"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","exportLastCheckpointOnly"],P)}else if(c==="PREFERENCE_TUNING"){const P=d(e,["exportLastCheckpointOnly"]);t!==void 0&&P!=null&&f(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],P)}else if(c==="DISTILLATION"){const P=d(e,["exportLastCheckpointOnly"]);t!==void 0&&P!=null&&f(t,["distillationSpec","exportLastCheckpointOnly"],P)}let u=d(n,["config","method"]);if(u===void 0&&(u="SUPERVISED_FINE_TUNING"),u==="SUPERVISED_FINE_TUNING"){const P=d(e,["adapterSize"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","hyperParameters","adapterSize"],P)}else if(u==="PREFERENCE_TUNING"){const P=d(e,["adapterSize"]);t!==void 0&&P!=null&&f(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],P)}else if(u==="DISTILLATION"){const P=d(e,["adapterSize"]);t!==void 0&&P!=null&&f(t,["distillationSpec","hyperParameters","adapterSize"],P)}let h=d(n,["config","method"]);if(h===void 0&&(h="SUPERVISED_FINE_TUNING"),h==="SUPERVISED_FINE_TUNING"){const P=d(e,["tuningMode"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","tuningMode"],P)}else if(h==="DISTILLATION"){const P=d(e,["tuningMode"]);t!==void 0&&P!=null&&f(t,["distillationSpec","tuningMode"],P)}const p=d(e,["customBaseModel"]);t!==void 0&&p!=null&&f(t,["customBaseModel"],p);let g=d(n,["config","method"]);if(g===void 0&&(g="SUPERVISED_FINE_TUNING"),g==="SUPERVISED_FINE_TUNING"){const P=d(e,["batchSize"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","hyperParameters","batchSize"],P)}else if(g==="DISTILLATION"){const P=d(e,["batchSize"]);t!==void 0&&P!=null&&f(t,["distillationSpec","hyperParameters","batchSize"],P)}let v=d(n,["config","method"]);if(v===void 0&&(v="SUPERVISED_FINE_TUNING"),v==="SUPERVISED_FINE_TUNING"){const P=d(e,["learningRate"]);t!==void 0&&P!=null&&f(t,["supervisedTuningSpec","hyperParameters","learningRate"],P)}else if(v==="DISTILLATION"){const P=d(e,["learningRate"]);t!==void 0&&P!=null&&f(t,["distillationSpec","hyperParameters","learningRate"],P)}const x=d(e,["labels"]);t!==void 0&&x!=null&&f(t,["labels"],x);const E=d(e,["beta"]);t!==void 0&&E!=null&&f(t,["preferenceOptimizationSpec","hyperParameters","beta"],E);const T=d(e,["baseTeacherModel"]);t!==void 0&&T!=null&&f(t,["distillationSpec","baseTeacherModel"],T);const A=d(e,["tunedTeacherModelSource"]);t!==void 0&&A!=null&&f(t,["distillationSpec","tunedTeacherModelSource"],A);const I=d(e,["sftLossWeightMultiplier"]);t!==void 0&&I!=null&&f(t,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],I);const M=d(e,["outputUri"]);t!==void 0&&M!=null&&f(t,["outputUri"],M);const D=d(e,["encryptionSpec"]);return t!==void 0&&D!=null&&f(t,["encryptionSpec"],D),i}function xP(e,t){const n={},i=d(e,["baseModel"]);i!=null&&f(n,["baseModel"],i);const o=d(e,["preTunedModel"]);o!=null&&f(n,["preTunedModel"],o);const s=d(e,["trainingDataset"]);s!=null&&IP(s);const r=d(e,["config"]);return r!=null&&_P(r,n),n}function bP(e,t){const n={},i=d(e,["baseModel"]);i!=null&&f(n,["baseModel"],i);const o=d(e,["preTunedModel"]);o!=null&&f(n,["preTunedModel"],o);const s=d(e,["trainingDataset"]);s!=null&&RP(s,n,t);const r=d(e,["config"]);return r!=null&&vP(r,n,t),n}function EP(e,t){const n={},i=d(e,["name"]);return i!=null&&f(n,["_url","name"],i),n}function wP(e,t){const n={},i=d(e,["name"]);return i!=null&&f(n,["_url","name"],i),n}function TP(e,t,n){const i={},o=d(e,["pageSize"]);t!==void 0&&o!=null&&f(t,["_query","pageSize"],o);const s=d(e,["pageToken"]);t!==void 0&&s!=null&&f(t,["_query","pageToken"],s);const r=d(e,["filter"]);return t!==void 0&&r!=null&&f(t,["_query","filter"],r),i}function CP(e,t){const n={},i=d(e,["config"]);return i!=null&&TP(i,n),n}function SP(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["nextPageToken"]);o!=null&&f(n,["nextPageToken"],o);const s=d(e,["tuningJobs"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(l=>ac(l))),f(n,["tuningJobs"],r)}return n}function AP(e,t){const n={},i=d(e,["name"]);i!=null&&f(n,["model"],i);const o=d(e,["name"]);return o!=null&&f(n,["endpoint"],o),n}function IP(e,t){const n={};if(d(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(d(e,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const i=d(e,["examples"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>s)),f(n,["examples","examples"],o)}return n}function RP(e,t,n){const i={};let o=d(n,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){const r=d(e,["gcsUri"]);t!==void 0&&r!=null&&f(t,["supervisedTuningSpec","trainingDatasetUri"],r)}else if(o==="PREFERENCE_TUNING"){const r=d(e,["gcsUri"]);t!==void 0&&r!=null&&f(t,["preferenceOptimizationSpec","trainingDatasetUri"],r)}else if(o==="DISTILLATION"){const r=d(e,["gcsUri"]);t!==void 0&&r!=null&&f(t,["distillationSpec","promptDatasetUri"],r)}let s=d(n,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){const r=d(e,["vertexDatasetResource"]);t!==void 0&&r!=null&&f(t,["supervisedTuningSpec","trainingDatasetUri"],r)}else if(s==="PREFERENCE_TUNING"){const r=d(e,["vertexDatasetResource"]);t!==void 0&&r!=null&&f(t,["preferenceOptimizationSpec","trainingDatasetUri"],r)}else if(s==="DISTILLATION"){const r=d(e,["vertexDatasetResource"]);t!==void 0&&r!=null&&f(t,["distillationSpec","promptDatasetUri"],r)}if(d(e,["examples"])!==void 0)throw new Error("examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return i}function MP(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["name"]);o!=null&&f(n,["name"],o);const s=d(e,["state"]);s!=null&&f(n,["state"],Zm(s));const r=d(e,["createTime"]);r!=null&&f(n,["createTime"],r);const l=d(e,["tuningTask","startTime"]);l!=null&&f(n,["startTime"],l);const a=d(e,["tuningTask","completeTime"]);a!=null&&f(n,["endTime"],a);const c=d(e,["updateTime"]);c!=null&&f(n,["updateTime"],c);const u=d(e,["description"]);u!=null&&f(n,["description"],u);const h=d(e,["baseModel"]);h!=null&&f(n,["baseModel"],h);const p=d(e,["_self"]);return p!=null&&f(n,["tunedModel"],AP(p)),n}function ac(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["name"]);o!=null&&f(n,["name"],o);const s=d(e,["state"]);s!=null&&f(n,["state"],Zm(s));const r=d(e,["createTime"]);r!=null&&f(n,["createTime"],r);const l=d(e,["startTime"]);l!=null&&f(n,["startTime"],l);const a=d(e,["endTime"]);a!=null&&f(n,["endTime"],a);const c=d(e,["updateTime"]);c!=null&&f(n,["updateTime"],c);const u=d(e,["error"]);u!=null&&f(n,["error"],u);const h=d(e,["description"]);h!=null&&f(n,["description"],h);const p=d(e,["baseModel"]);p!=null&&f(n,["baseModel"],p);const g=d(e,["tunedModel"]);g!=null&&f(n,["tunedModel"],g);const v=d(e,["preTunedModel"]);v!=null&&f(n,["preTunedModel"],v);const x=d(e,["supervisedTuningSpec"]);x!=null&&f(n,["supervisedTuningSpec"],x);const E=d(e,["preferenceOptimizationSpec"]);E!=null&&f(n,["preferenceOptimizationSpec"],E);const T=d(e,["distillationSpec"]);T!=null&&f(n,["distillationSpec"],T);const A=d(e,["tuningDataStats"]);A!=null&&f(n,["tuningDataStats"],A);const I=d(e,["encryptionSpec"]);I!=null&&f(n,["encryptionSpec"],I);const M=d(e,["partnerModelTuningSpec"]);M!=null&&f(n,["partnerModelTuningSpec"],M);const D=d(e,["customBaseModel"]);D!=null&&f(n,["customBaseModel"],D);const P=d(e,["evaluateDatasetRuns"]);if(P!=null){let rt=P;Array.isArray(rt)&&(rt=rt.map(xt=>xt)),f(n,["evaluateDatasetRuns"],rt)}const B=d(e,["experiment"]);B!=null&&f(n,["experiment"],B);const U=d(e,["fullFineTuningSpec"]);U!=null&&f(n,["fullFineTuningSpec"],U);const V=d(e,["labels"]);V!=null&&f(n,["labels"],V);const W=d(e,["outputUri"]);W!=null&&f(n,["outputUri"],W);const et=d(e,["pipelineJob"]);et!=null&&f(n,["pipelineJob"],et);const at=d(e,["serviceAccount"]);at!=null&&f(n,["serviceAccount"],at);const Ct=d(e,["tunedModelDisplayName"]);Ct!=null&&f(n,["tunedModelDisplayName"],Ct);const gt=d(e,["tuningJobState"]);gt!=null&&f(n,["tuningJobState"],gt);const st=d(e,["veoTuningSpec"]);st!=null&&f(n,["veoTuningSpec"],st);const ut=d(e,["distillationSamplingSpec"]);ut!=null&&f(n,["distillationSamplingSpec"],ut);const ft=d(e,["tuningJobMetadata"]);return ft!=null&&f(n,["tuningJobMetadata"],ft),n}function PP(e,t){const n={},i=d(e,["sdkHttpResponse"]);i!=null&&f(n,["sdkHttpResponse"],i);const o=d(e,["name"]);o!=null&&f(n,["name"],o);const s=d(e,["metadata"]);s!=null&&f(n,["metadata"],s);const r=d(e,["done"]);r!=null&&f(n,["done"],r);const l=d(e,["error"]);return l!=null&&f(n,["error"],l),n}function ha(e,t){const n={},i=d(e,["gcsUri"]);i!=null&&f(n,["validationDatasetUri"],i);const o=d(e,["vertexDatasetResource"]);return o!=null&&f(n,["validationDatasetUri"],o),n}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class kP extends Jn{constructor(t){super(),this.apiClient=t,this.list=async(n={})=>new Oi(qn.PAGED_ITEM_TUNING_JOBS,i=>this.listInternal(i),await this.listInternal(n),n),this.get=async n=>await this.getInternal(n),this.tune=async n=>{var i;if(this.apiClient.isVertexAI())if(n.baseModel.startsWith("projects/")){const o={tunedModelName:n.baseModel};!((i=n.config)===null||i===void 0)&&i.preTunedModelCheckpointId&&(o.checkpointId=n.config.preTunedModelCheckpointId);const s=Object.assign(Object.assign({},n),{preTunedModel:o});return s.baseModel=void 0,await this.tuneInternal(s)}else{const o=Object.assign({},n);return await this.tuneInternal(o)}else{const o=Object.assign({},n),s=await this.tuneMldevInternal(o);let r="";return s.metadata!==void 0&&s.metadata.tunedModel!==void 0?r=s.metadata.tunedModel:s.name!==void 0&&s.name.includes("/operations/")&&(r=s.name.split("/operations/")[0]),{name:r,state:Xa.JOB_STATE_QUEUED}}}}async getInternal(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=wP(t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>ac(u))}else{const c=EP(t);return l=lt("{name}",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>MP(u))}}async listInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=CP(t);return s=lt("tuningJobs",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>{const c=SP(a),u=new q1;return Object.assign(u,c),u})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(t){var n,i,o,s;let r,l="",a={};if(this.apiClient.isVertexAI()){const c=gP(t);return l=lt("{name}:cancel",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=yP(u),p=new Xh;return Object.assign(p,h),p})}else{const c=pP(t);return l=lt("{name}:cancel",c._url),a=c._query,delete c._url,delete c._query,r=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=t.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(h=>{const p=h;return p.sdkHttpResponse={headers:u.headers},p})),r.then(u=>{const h=mP(u),p=new Xh;return Object.assign(p,h),p})}}async tuneInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const l=bP(t,t);return s=lt("tuningJobs",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>ac(a))}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async tuneMldevInternal(t){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=xP(t);return s=lt("tunedModels",l._url),r=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=t.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then(a=>a.json().then(c=>{const u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then(a=>PP(a))}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class DP{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 NP=1024*1024*8,LP=3,FP=1e3,UP=2,Zr="x-goog-upload-status";async function BP(e,t,n,i){var o;const s=await U0(e,t,n,i),r=await(s==null?void 0:s.json());if(((o=s==null?void 0:s.headers)===null||o===void 0?void 0:o[Zr])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return r.file}async function OP(e,t,n,i){var o;const s=await U0(e,t,n,i),r=await(s==null?void 0:s.json());if(((o=s==null?void 0:s.headers)===null||o===void 0?void 0:o[Zr])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const l=Wm(r),a=new eu;return Object.assign(a,l),a}async function U0(e,t,n,i){var o,s,r;let l=t;const a=(i==null?void 0:i.baseUrl)||((o=n.clientOptions.httpOptions)===null||o===void 0?void 0:o.baseUrl);if(a){const g=new URL(a),v=new URL(t);v.protocol=g.protocol,v.host=g.host,v.port=g.port,l=v.toString()}let c=0,u=0,h=new Kr(new Response),p="upload";for(c=e.size;u=c&&(p+=", finalize");let x=0,E=FP;for(;xsetTimeout(t,e))}class HP{async upload(t,n,i,o){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await BP(t,n,i,o)}async uploadToFileSearchStore(t,n,i,o){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await OP(t,n,i,o)}async stat(t){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await VP(t)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class $P{create(t,n,i){return new qP(t,n,i)}}class qP{constructor(t,n,i){this.url=t,this.headers=n,this.callbacks=i}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 Cp="x-goog-api-key";class zP{constructor(t){this.apiKey=t}async addAuthHeaders(t,n){if(t.get(Cp)===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(Cp,this.apiKey)}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const WP="gl-node/";class JP{getNextGenClient(){var t;const n=this.httpOptions;if(this._nextGenClient===void 0){const i=this.httpOptions;this._nextGenClient=new me({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:i==null?void 0:i.timeout,maxRetries:(t=i==null?void 0:i.retryOptions)===null||t===void 0?void 0:t.attempts})}return n!=null&&n.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored."),this._nextGenClient}get interactions(){return this._interactions!==void 0?this._interactions:(console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions."),this._interactions=this.getNextGenClient().interactions,this._interactions)}get webhooks(){return this._webhooks!==void 0?this._webhooks:(this._webhooks=this.getNextGenClient().webhooks,this._webhooks)}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 i=w1(t.httpOptions,t.vertexai,void 0,void 0);i&&(t.httpOptions?t.httpOptions.baseUrl=i:t.httpOptions={baseUrl:i}),this.apiVersion=t.apiVersion,this.httpOptions=t.httpOptions;const o=new zP(this.apiKey);this.apiClient=new qR({auth:o,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:WP+"web",uploader:new HP,downloader:new DP}),this.models=new cM(this.apiClient),this.live=new iM(this.apiClient,o,new $P),this.batches=new oS(this.apiClient),this.chats=new HS(this.models,this.apiClient),this.caches=new OS(this.apiClient),this.files=new tA(this.apiClient),this.operations=new uM(this.apiClient),this.authTokens=new IM(this.apiClient),this.tunings=new kP(this.apiClient),this.fileSearchStores=new FM(this.apiClient)}}const KP={class:"user-log-view-root space-y-6"},YP={class:"bg-slate-900 rounded-3xl border border-slate-800 p-8 shadow-2xl relative overflow-hidden group"},XP={class:"absolute top-0 right-0 p-12 opacity-5 pointer-events-none group-hover:scale-110 transition-transform duration-700"},QP={class:"flex flex-col md:flex-row md:items-center justify-between gap-6 relative z-10"},ZP={class:"flex items-center gap-5"},jP={class:"bg-gradient-to-br from-blue-600 to-indigo-700 p-4 rounded-2xl shadow-xl shadow-blue-900/40"},tk={class:"flex items-center gap-2 mt-1"},ek={class:"text-xs text-slate-500 font-medium italic"},nk=["disabled"],ik={key:0,class:"bg-red-500/10 border border-red-500/30 text-red-400 p-6 rounded-3xl flex items-start gap-4 animate-in fade-in slide-in-from-top-4 duration-300"},ok={class:"text-sm opacity-80 leading-relaxed"},sk={class:"bg-white rounded-3xl border border-slate-200 shadow-sm overflow-hidden"},rk={class:"overflow-x-auto"},lk={class:"w-full text-left border-collapse"},ak={class:"bg-slate-50/80 border-b border-slate-100"},ck={class:"p-5 text-xs font-bold text-slate-500 uppercase tracking-widest"},uk={class:"flex items-center gap-2"},dk={class:"p-5 text-xs font-bold text-slate-500 uppercase tracking-widest"},fk={class:"flex items-center gap-2"},hk={class:"p-5 text-xs font-bold text-slate-500 uppercase tracking-widest"},pk={class:"flex items-center gap-2"},gk={class:"p-5 text-xs font-bold text-slate-500 uppercase tracking-widest"},mk={class:"flex items-center gap-2"},yk={class:"divide-y divide-slate-50"},_k={key:0,class:"animate-pulse"},vk={key:1,class:"fade-in"},xk={colspan:"6",class:"p-20 text-center"},bk={class:"flex flex-col items-center gap-3"},Ek={class:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center"},wk={class:"p-5 text-sm font-mono text-slate-500"},Tk={class:"p-5"},Ck={class:"text-sm font-bold text-slate-800 group-hover:text-blue-600 transition-colors"},Sk={class:"p-5"},Ak={class:"text-sm font-mono text-blue-600 bg-blue-50 px-2 py-1 rounded-lg border border-blue-100"},Ik={class:"p-5"},Rk={class:"flex items-center gap-2"},Mk={class:"text-sm text-slate-600"},Pk={class:"p-5 text-sm text-slate-500 italic"},kk={class:"p-5"},Dk={class:"flex justify-center"},Nk=yg({__name:"UserLogView",props:{sessionId:{}},setup(e){const t=e,n=_t([]),i=_t(!1),o=_t(""),s=async()=>{if(!t.sessionId){o.value="未偵測到 Session ID,無法讀取日誌。";return}i.value=!0,o.value="";try{const r=window.location.port==="5173"?"http://localhost:7860":"https://my-project-team-infosecai-finalproj.hf.space",l=await fetch(`${r}/api/get_user_logs?session_id=${t.sessionId}`);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const a=await l.json();a.status==="success"?n.value=a.data:o.value=a.message||"後端回傳資料格式錯誤"}catch(r){console.error("Fetch logs error:",r),o.value="無法連接至 AI 後端安全引擎,請確認伺服器是否正常運作。"}finally{i.value=!1}};return Dc(()=>{s()}),(r,l)=>(Y(),j("div",KP,[m("div",YP,[m("div",XP,[Z(Q(ka),{class:"w-48 h-48 text-blue-500"})]),m("div",QP,[m("div",ZP,[m("div",jP,[Z(Q(ka),{class:"w-8 h-8 text-white"})]),m("div",null,[l[1]||(l[1]=m("h2",{class:"text-2xl font-black text-white tracking-tight"},"數位保鑣|個人安全日誌",-1)),m("div",tk,[l[0]||(l[0]=m("span",{class:"text-[10px] bg-blue-500/20 text-blue-400 px-2 py-0.5 rounded font-bold tracking-widest uppercase border border-blue-500/30"},"Live Monitor",-1)),m("p",ek,"目前監控 Session: "+q(t.sessionId),1)])])]),m("button",{onClick:s,disabled:i.value,class:"flex items-center justify-center gap-3 px-6 py-3 bg-slate-800 hover:bg-slate-700 text-slate-200 rounded-2xl text-sm font-bold transition-all border border-slate-700 active:scale-95 disabled:opacity-50 hover:shadow-lg hover:shadow-blue-900/10"},[Z(Q(ex),{class:$t(["w-4 h-4",{"animate-spin":i.value}])},null,8,["class"]),l[2]||(l[2]=m("span",null,"同步最新紀錄",-1))],8,nk)])]),o.value?(Y(),j("div",ik,[Z(Q(Kv),{class:"w-6 h-6 shrink-0 mt-1"}),m("div",null,[l[3]||(l[3]=m("h4",{class:"font-bold text-lg"},"系統連線異常",-1)),m("p",ok,q(o.value),1)])])):Ht("",!0),m("div",sk,[m("div",rk,[m("table",lk,[m("thead",null,[m("tr",ak,[m("th",ck,[m("div",uk,[Z(Q(Pa),{class:"w-4 h-4 text-slate-400"}),l[4]||(l[4]=Yt(" 紀錄時間",-1))])]),m("th",dk,[m("div",fk,[Z(Q(Ai),{class:"w-4 h-4 text-slate-400"}),l[5]||(l[5]=Yt(" 行為名稱",-1))])]),m("th",hk,[m("div",pk,[Z(Q(Yv),{class:"w-4 h-4 text-slate-400"}),l[6]||(l[6]=Yt(" 來源 IP",-1))])]),l[8]||(l[8]=m("th",{class:"p-5 text-xs font-bold text-slate-500 uppercase tracking-widest"}," 地理位置 ",-1)),m("th",gk,[m("div",mk,[Z(Q(Qv),{class:"w-4 h-4 text-slate-400"}),l[7]||(l[7]=Yt(" 存取設備",-1))])]),l[9]||(l[9]=m("th",{class:"p-5 text-xs font-bold text-slate-500 uppercase tracking-widest text-center"}," AI 防護判定 ",-1))])]),m("tbody",yk,[i.value?(Y(),j("tr",_k,[...l[10]||(l[10]=[m("td",{colspan:"6",class:"p-20 text-center text-slate-400 font-medium"}," 正在從雲端 Dataset 同步資料... ",-1)])])):n.value.length===0?(Y(),j("tr",vk,[m("td",xk,[m("div",bk,[m("div",Ek,[Z(Q(Ai),{class:"w-8 h-8 text-slate-300"})]),l[11]||(l[11]=m("p",{class:"text-slate-400 font-medium"},"目前尚無相關行為日誌紀錄",-1))])])])):Ht("",!0),(Y(!0),j(kt,null,ue(n.value,(a,c)=>(Y(),j("tr",{key:c,class:"hover:bg-blue-50/30 transition-all group duration-300"},[m("td",wk,q(a.time),1),m("td",Tk,[m("span",Ck,q(a.action),1)]),m("td",Sk,[m("span",Ak,q(a.ip),1)]),m("td",Ik,[m("div",Rk,[m("span",Mk,q(a.location),1)])]),m("td",Pk,q(a.device),1),m("td",kk,[m("div",Dk,[m("span",{class:$t([a.ai_status==="正常"?"bg-emerald-50 text-emerald-600 border-emerald-200":"bg-red-50 text-red-600 border-red-200 animate-pulse font-black","px-4 py-1.5 rounded-full text-[11px] font-bold border shadow-sm flex items-center gap-1.5"])},[m("div",{class:$t(["w-1.5 h-1.5 rounded-full",a.ai_status==="正常"?"bg-emerald-500":"bg-red-500"])},null,2),Yt(" "+q(a.ai_status),1)],2)])])]))),128))])])])])]))}}),Lk=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},Fk=Lk(Nk,[["__scopeId","data-v-0ea6b572"]]);function Uk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B0={exports:{}},he=B0.exports={},gn,mn;function cc(){throw new Error("setTimeout has not been defined")}function uc(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?gn=setTimeout:gn=cc}catch{gn=cc}try{typeof clearTimeout=="function"?mn=clearTimeout:mn=uc}catch{mn=uc}})();function O0(e){if(gn===setTimeout)return setTimeout(e,0);if((gn===cc||!gn)&&setTimeout)return gn=setTimeout,setTimeout(e,0);try{return gn(e,0)}catch{try{return gn.call(null,e,0)}catch{return gn.call(this,e,0)}}}function Bk(e){if(mn===clearTimeout)return clearTimeout(e);if((mn===uc||!mn)&&clearTimeout)return mn=clearTimeout,clearTimeout(e);try{return mn(e)}catch{try{return mn.call(null,e)}catch{return mn.call(this,e)}}}var Vn=[],no=!1,Ri,wr=-1;function Ok(){!no||!Ri||(no=!1,Ri.length?Vn=Ri.concat(Vn):wr=-1,Vn.length&&V0())}function V0(){if(!no){var e=O0(Ok);no=!0;for(var t=Vn.length;t;){for(Ri=Vn,Vn=[];++wr1)for(var n=1;nt=>{const n=Gk.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),un=e=>(e=e.toLowerCase(),t=>Al(t)===e),Il=e=>t=>typeof t===e,{isArray:mo}=Array,co=Il("undefined");function bs(e){return e!==null&&!co(e)&&e.constructor!==null&&!co(e.constructor)&&$e(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const q0=un("ArrayBuffer");function Hk(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&q0(e.buffer),t}const $k=Il("string"),$e=Il("function"),z0=Il("number"),Es=e=>e!==null&&typeof e=="object",qk=e=>e===!0||e===!1,Tr=e=>{if(Al(e)!=="object")return!1;const t=Cl(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!($0 in e)&&!(Sl in e)},zk=e=>{if(!Es(e)||bs(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Wk=un("Date"),Jk=un("File"),Kk=e=>!!(e&&typeof e.uri<"u"),Yk=e=>e&&typeof e.getParts<"u",Xk=un("Blob"),Qk=un("FileList"),Zk=e=>Es(e)&&$e(e.pipe);function jk(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof ts<"u"?ts:{}}const Ap=jk(),Ip=typeof Ap.FormData<"u"?Ap.FormData:void 0,t2=e=>{if(!e)return!1;if(Ip&&e instanceof Ip)return!0;const t=Cl(e);if(!t||t===Object.prototype||!$e(e.append))return!1;const n=Al(e);return n==="formdata"||n==="object"&&$e(e.toString)&&e.toString()==="[object FormData]"},e2=un("URLSearchParams"),[n2,i2,o2,s2]=["ReadableStream","Request","Response","Headers"].map(un),r2=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ws(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let i,o;if(typeof e!="object"&&(e=[e]),mo(e))for(i=0,o=e.length;i0;)if(o=n[i],t===o.toLowerCase())return o;return null}const Mi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:ts,J0=e=>!co(e)&&e!==Mi;function dc(...e){const{caseless:t,skipUndefined:n}=J0(this)&&this||{},i={},o=(s,r)=>{if(r==="__proto__"||r==="constructor"||r==="prototype")return;const l=t&&W0(i,r)||r,a=fc(i,l)?i[l]:void 0;Tr(a)&&Tr(s)?i[l]=dc(a,s):Tr(s)?i[l]=dc({},s):mo(s)?i[l]=s.slice():(!n||!co(s))&&(i[l]=s)};for(let s=0,r=e.length;s(ws(t,(o,s)=>{n&&$e(o)?Object.defineProperty(e,s,{__proto__:null,value:H0(o,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{__proto__:null,value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),e),a2=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),c2=(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},u2=(e,t,n,i)=>{let o,s,r;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)r=o[s],(!i||i(r,e,t))&&!l[r]&&(t[r]=e[r],l[r]=!0);e=n!==!1&&Cl(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},d2=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return i!==-1&&i===n},f2=e=>{if(!e)return null;if(mo(e))return e;let t=e.length;if(!z0(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},h2=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Cl(Uint8Array)),p2=(e,t)=>{const i=(e&&e[Sl]).call(e);let o;for(;(o=i.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},g2=(e,t)=>{let n;const i=[];for(;(n=e.exec(t))!==null;)i.push(n);return i},m2=un("HTMLFormElement"),y2=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),fc=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),_2=un("RegExp"),K0=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};ws(n,(o,s)=>{let r;(r=t(o,s,e))!==!1&&(i[s]=r||o)}),Object.defineProperties(e,i)},v2=e=>{K0(e,(t,n)=>{if($e(e)&&["arguments","caller","callee"].includes(n))return!1;const i=e[n];if($e(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},x2=(e,t)=>{const n={},i=o=>{o.forEach(s=>{n[s]=!0})};return mo(e)?i(e):i(String(e).split(t)),n},b2=()=>{},E2=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function w2(e){return!!(e&&$e(e.append)&&e[$0]==="FormData"&&e[Sl])}const T2=e=>{const t=new WeakSet,n=i=>{if(Es(i)){if(t.has(i))return;if(bs(i))return i;if(!("toJSON"in i)){t.add(i);const o=mo(i)?[]:{};return ws(i,(s,r)=>{const l=n(s);!co(l)&&(o[r]=l)}),t.delete(i),o}}return i};return n(e)},C2=un("AsyncFunction"),S2=e=>e&&(Es(e)||$e(e))&&$e(e.then)&&$e(e.catch),Y0=((e,t)=>e?setImmediate:t?((n,i)=>(Mi.addEventListener("message",({source:o,data:s})=>{o===Mi&&s===n&&i.length&&i.shift()()},!1),o=>{i.push(o),Mi.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",$e(Mi.postMessage)),A2=typeof queueMicrotask<"u"?queueMicrotask.bind(Mi):typeof Sp<"u"&&Sp.nextTick||Y0,I2=e=>e!=null&&$e(e[Sl]),L={isArray:mo,isArrayBuffer:q0,isBuffer:bs,isFormData:t2,isArrayBufferView:Hk,isString:$k,isNumber:z0,isBoolean:qk,isObject:Es,isPlainObject:Tr,isEmptyObject:zk,isReadableStream:n2,isRequest:i2,isResponse:o2,isHeaders:s2,isUndefined:co,isDate:Wk,isFile:Jk,isReactNativeBlob:Kk,isReactNative:Yk,isBlob:Xk,isRegExp:_2,isFunction:$e,isStream:Zk,isURLSearchParams:e2,isTypedArray:h2,isFileList:Qk,forEach:ws,merge:dc,extend:l2,trim:r2,stripBOM:a2,inherits:c2,toFlatObject:u2,kindOf:Al,kindOfTest:un,endsWith:d2,toArray:f2,forEachEntry:p2,matchAll:g2,isHTMLForm:m2,hasOwnProperty:fc,hasOwnProp:fc,reduceDescriptors:K0,freezeMethods:v2,toObjectSet:x2,toCamelCase:y2,noop:b2,toFiniteNumber:E2,findKey:W0,global:Mi,isContextDefined:J0,isSpecCompliantForm:w2,toJSONObject:T2,isAsyncFn:C2,isThenable:S2,setImmediate:Y0,asap:A2,isIterable:I2};var X0={},Rl={};Rl.byteLength=P2;Rl.toByteArray=D2;Rl.fromByteArray=F2;var bn=[],Qe=[],R2=typeof Uint8Array<"u"?Uint8Array:Array,pa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var qi=0,M2=pa.length;qi0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var i=n===t?0:4-n%4;return[n,i]}function P2(e){var t=Q0(e),n=t[0],i=t[1];return(n+i)*3/4-i}function k2(e,t,n){return(t+n)*3/4-n}function D2(e){var t,n=Q0(e),i=n[0],o=n[1],s=new R2(k2(e,i,o)),r=0,l=o>0?i-4:i,a;for(a=0;a>16&255,s[r++]=t>>8&255,s[r++]=t&255;return o===2&&(t=Qe[e.charCodeAt(a)]<<2|Qe[e.charCodeAt(a+1)]>>4,s[r++]=t&255),o===1&&(t=Qe[e.charCodeAt(a)]<<10|Qe[e.charCodeAt(a+1)]<<4|Qe[e.charCodeAt(a+2)]>>2,s[r++]=t>>8&255,s[r++]=t&255),s}function N2(e){return bn[e>>18&63]+bn[e>>12&63]+bn[e>>6&63]+bn[e&63]}function L2(e,t,n){for(var i,o=[],s=t;sl?l:r+s));return i===1?(t=e[n-1],o.push(bn[t>>2]+bn[t<<4&63]+"==")):i===2&&(t=(e[n-2]<<8)+e[n-1],o.push(bn[t>>10]+bn[t>>4&63]+bn[t<<2&63]+"=")),o.join("")}var uu={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */uu.read=function(e,t,n,i,o){var s,r,l=o*8-i-1,a=(1<>1,u=-7,h=n?o-1:0,p=n?-1:1,g=e[t+h];for(h+=p,s=g&(1<<-u)-1,g>>=-u,u+=l;u>0;s=s*256+e[t+h],h+=p,u-=8);for(r=s&(1<<-u)-1,s>>=-u,u+=i;u>0;r=r*256+e[t+h],h+=p,u-=8);if(s===0)s=1-c;else{if(s===a)return r?NaN:(g?-1:1)*(1/0);r=r+Math.pow(2,i),s=s-c}return(g?-1:1)*r*Math.pow(2,s-i)};uu.write=function(e,t,n,i,o,s){var r,l,a,c=s*8-o-1,u=(1<>1,p=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:s-1,v=i?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,r=u):(r=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-r))<1&&(r--,a*=2),r+h>=1?t+=p/a:t+=p*Math.pow(2,1-h),t*a>=2&&(r++,a/=2),r+h>=u?(l=0,r=u):r+h>=1?(l=(t*a-1)*Math.pow(2,o),r=r+h):(l=t*Math.pow(2,h-1)*Math.pow(2,o),r=0));o>=8;e[n+g]=l&255,g+=v,l/=256,o-=8);for(r=r<0;e[n+g]=r&255,g+=v,r/=256,c-=8);e[n+g-v]|=x*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */(function(e){const t=Rl,n=uu,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=D,e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o;const{Uint8Array:s,ArrayBuffer:r,SharedArrayBuffer:l}=globalThis;u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{const w=new s(1),y={foo:function(){return 42}};return Object.setPrototypeOf(y,s.prototype),Object.setPrototypeOf(w,y),w.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function c(w){if(w>o)throw new RangeError('The value "'+w+'" is invalid for option "size"');const y=new s(w);return Object.setPrototypeOf(y,u.prototype),y}function u(w,y,_){if(typeof w=="number"){if(typeof y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(w)}return h(w,y,_)}u.poolSize=8192;function h(w,y,_){if(typeof w=="string")return x(w,y);if(r.isView(w))return T(w);if(w==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof w);if(dt(w,r)||w&&dt(w.buffer,r)||typeof l<"u"&&(dt(w,l)||w&&dt(w.buffer,l)))return A(w,y,_);if(typeof w=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const C=w.valueOf&&w.valueOf();if(C!=null&&C!==w)return u.from(C,y,_);const N=I(w);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof w[Symbol.toPrimitive]=="function")return u.from(w[Symbol.toPrimitive]("string"),y,_);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof w)}u.from=function(w,y,_){return h(w,y,_)},Object.setPrototypeOf(u.prototype,s.prototype),Object.setPrototypeOf(u,s);function p(w){if(typeof w!="number")throw new TypeError('"size" argument must be of type number');if(w<0)throw new RangeError('The value "'+w+'" is invalid for option "size"')}function g(w,y,_){return p(w),w<=0?c(w):y!==void 0?typeof _=="string"?c(w).fill(y,_):c(w).fill(y):c(w)}u.alloc=function(w,y,_){return g(w,y,_)};function v(w){return p(w),c(w<0?0:M(w)|0)}u.allocUnsafe=function(w){return v(w)},u.allocUnsafeSlow=function(w){return v(w)};function x(w,y){if((typeof y!="string"||y==="")&&(y="utf8"),!u.isEncoding(y))throw new TypeError("Unknown encoding: "+y);const _=P(w,y)|0;let C=c(_);const N=C.write(w,y);return N!==_&&(C=C.slice(0,N)),C}function E(w){const y=w.length<0?0:M(w.length)|0,_=c(y);for(let C=0;C=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return w|0}function D(w){return+w!=w&&(w=0),u.alloc(+w)}u.isBuffer=function(y){return y!=null&&y._isBuffer===!0&&y!==u.prototype},u.compare=function(y,_){if(dt(y,s)&&(y=u.from(y,y.offset,y.byteLength)),dt(_,s)&&(_=u.from(_,_.offset,_.byteLength)),!u.isBuffer(y)||!u.isBuffer(_))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(y===_)return 0;let C=y.length,N=_.length;for(let F=0,G=Math.min(C,N);FN.length?(u.isBuffer(G)||(G=u.from(G)),G.copy(N,F)):s.prototype.set.call(N,G,F);else if(u.isBuffer(G))G.copy(N,F);else throw new TypeError('"list" argument must be an Array of Buffers');F+=G.length}return N};function P(w,y){if(u.isBuffer(w))return w.length;if(r.isView(w)||dt(w,r))return w.byteLength;if(typeof w!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof w);const _=w.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&_===0)return 0;let N=!1;for(;;)switch(y){case"ascii":case"latin1":case"binary":return _;case"utf8":case"utf-8":return X(w).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _*2;case"hex":return _>>>1;case"base64":return ot(w).length;default:if(N)return C?-1:X(w).length;y=(""+y).toLowerCase(),N=!0}}u.byteLength=P;function B(w,y,_){let C=!1;if((y===void 0||y<0)&&(y=0),y>this.length||((_===void 0||_>this.length)&&(_=this.length),_<=0)||(_>>>=0,y>>>=0,_<=y))return"";for(w||(w="utf8");;)switch(w){case"hex":return ie(this,y,_);case"utf8":case"utf-8":return ft(this,y,_);case"ascii":return Nt(this,y,_);case"latin1":case"binary":return Kt(this,y,_);case"base64":return ut(this,y,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ut(this,y,_);default:if(C)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),C=!0}}u.prototype._isBuffer=!0;function U(w,y,_){const C=w[y];w[y]=w[_],w[_]=C}u.prototype.swap16=function(){const y=this.length;if(y%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let _=0;__&&(y+=" ... "),""},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(y,_,C,N,F){if(dt(y,s)&&(y=u.from(y,y.offset,y.byteLength)),!u.isBuffer(y))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof y);if(_===void 0&&(_=0),C===void 0&&(C=y?y.length:0),N===void 0&&(N=0),F===void 0&&(F=this.length),_<0||C>y.length||N<0||F>this.length)throw new RangeError("out of range index");if(N>=F&&_>=C)return 0;if(N>=F)return-1;if(_>=C)return 1;if(_>>>=0,C>>>=0,N>>>=0,F>>>=0,this===y)return 0;let G=F-N,At=C-_;const yt=Math.min(G,At),Zt=this.slice(N,F),jt=y.slice(_,C);for(let Gt=0;Gt2147483647?_=2147483647:_<-2147483648&&(_=-2147483648),_=+_,Pt(_)&&(_=N?0:w.length-1),_<0&&(_=w.length+_),_>=w.length){if(N)return-1;_=w.length-1}else if(_<0)if(N)_=0;else return-1;if(typeof y=="string"&&(y=u.from(y,C)),u.isBuffer(y))return y.length===0?-1:W(w,y,_,C,N);if(typeof y=="number")return y=y&255,typeof s.prototype.indexOf=="function"?N?s.prototype.indexOf.call(w,y,_):s.prototype.lastIndexOf.call(w,y,_):W(w,[y],_,C,N);throw new TypeError("val must be string, number or Buffer")}function W(w,y,_,C,N){let F=1,G=w.length,At=y.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if(w.length<2||y.length<2)return-1;F=2,G/=2,At/=2,_/=2}function yt(jt,Gt){return F===1?jt[Gt]:jt.readUInt16BE(Gt*F)}let Zt;if(N){let jt=-1;for(Zt=_;ZtG&&(_=G-At),Zt=_;Zt>=0;Zt--){let jt=!0;for(let Gt=0;GtN&&(C=N)):C=N;const F=y.length;C>F/2&&(C=F/2);let G;for(G=0;G>>0,isFinite(C)?(C=C>>>0,N===void 0&&(N="utf8")):(N=C,C=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const F=this.length-_;if((C===void 0||C>F)&&(C=F),y.length>0&&(C<0||_<0)||_>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");let G=!1;for(;;)switch(N){case"hex":return et(this,y,_,C);case"utf8":case"utf-8":return at(this,y,_,C);case"ascii":case"latin1":case"binary":return Ct(this,y,_,C);case"base64":return gt(this,y,_,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,y,_,C);default:if(G)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),G=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ut(w,y,_){return y===0&&_===w.length?t.fromByteArray(w):t.fromByteArray(w.slice(y,_))}function ft(w,y,_){_=Math.min(w.length,_);const C=[];let N=y;for(;N<_;){const F=w[N];let G=null,At=F>239?4:F>223?3:F>191?2:1;if(N+At<=_){let yt,Zt,jt,Gt;switch(At){case 1:F<128&&(G=F);break;case 2:yt=w[N+1],(yt&192)===128&&(Gt=(F&31)<<6|yt&63,Gt>127&&(G=Gt));break;case 3:yt=w[N+1],Zt=w[N+2],(yt&192)===128&&(Zt&192)===128&&(Gt=(F&15)<<12|(yt&63)<<6|Zt&63,Gt>2047&&(Gt<55296||Gt>57343)&&(G=Gt));break;case 4:yt=w[N+1],Zt=w[N+2],jt=w[N+3],(yt&192)===128&&(Zt&192)===128&&(jt&192)===128&&(Gt=(F&15)<<18|(yt&63)<<12|(Zt&63)<<6|jt&63,Gt>65535&&Gt<1114112&&(G=Gt))}}G===null?(G=65533,At=1):G>65535&&(G-=65536,C.push(G>>>10&1023|55296),G=56320|G&1023),C.push(G),N+=At}return xt(C)}const rt=4096;function xt(w){const y=w.length;if(y<=rt)return String.fromCharCode.apply(String,w);let _="",C=0;for(;CC)&&(_=C);let N="";for(let F=y;F<_;++F)N+=Vt[w[F]];return N}function Ut(w,y,_){const C=w.slice(y,_);let N="";for(let F=0;FC&&(y=C),_<0?(_+=C,_<0&&(_=0)):_>C&&(_=C),__)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(y,_,C){y=y>>>0,_=_>>>0,C||Rt(y,_,this.length);let N=this[y],F=1,G=0;for(;++G<_&&(F*=256);)N+=this[y+G]*F;return N},u.prototype.readUintBE=u.prototype.readUIntBE=function(y,_,C){y=y>>>0,_=_>>>0,C||Rt(y,_,this.length);let N=this[y+--_],F=1;for(;_>0&&(F*=256);)N+=this[y+--_]*F;return N},u.prototype.readUint8=u.prototype.readUInt8=function(y,_){return y=y>>>0,_||Rt(y,1,this.length),this[y]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(y,_){return y=y>>>0,_||Rt(y,2,this.length),this[y]|this[y+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(y,_){return y=y>>>0,_||Rt(y,2,this.length),this[y]<<8|this[y+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(y,_){return y=y>>>0,_||Rt(y,4,this.length),(this[y]|this[y+1]<<8|this[y+2]<<16)+this[y+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(y,_){return y=y>>>0,_||Rt(y,4,this.length),this[y]*16777216+(this[y+1]<<16|this[y+2]<<8|this[y+3])},u.prototype.readBigUInt64LE=Et(function(y){y=y>>>0,$(y,"offset");const _=this[y],C=this[y+7];(_===void 0||C===void 0)&&H(y,this.length-8);const N=_+this[++y]*2**8+this[++y]*2**16+this[++y]*2**24,F=this[++y]+this[++y]*2**8+this[++y]*2**16+C*2**24;return BigInt(N)+(BigInt(F)<>>0,$(y,"offset");const _=this[y],C=this[y+7];(_===void 0||C===void 0)&&H(y,this.length-8);const N=_*2**24+this[++y]*2**16+this[++y]*2**8+this[++y],F=this[++y]*2**24+this[++y]*2**16+this[++y]*2**8+C;return(BigInt(N)<>>0,_=_>>>0,C||Rt(y,_,this.length);let N=this[y],F=1,G=0;for(;++G<_&&(F*=256);)N+=this[y+G]*F;return F*=128,N>=F&&(N-=Math.pow(2,8*_)),N},u.prototype.readIntBE=function(y,_,C){y=y>>>0,_=_>>>0,C||Rt(y,_,this.length);let N=_,F=1,G=this[y+--N];for(;N>0&&(F*=256);)G+=this[y+--N]*F;return F*=128,G>=F&&(G-=Math.pow(2,8*_)),G},u.prototype.readInt8=function(y,_){return y=y>>>0,_||Rt(y,1,this.length),this[y]&128?(255-this[y]+1)*-1:this[y]},u.prototype.readInt16LE=function(y,_){y=y>>>0,_||Rt(y,2,this.length);const C=this[y]|this[y+1]<<8;return C&32768?C|4294901760:C},u.prototype.readInt16BE=function(y,_){y=y>>>0,_||Rt(y,2,this.length);const C=this[y+1]|this[y]<<8;return C&32768?C|4294901760:C},u.prototype.readInt32LE=function(y,_){return y=y>>>0,_||Rt(y,4,this.length),this[y]|this[y+1]<<8|this[y+2]<<16|this[y+3]<<24},u.prototype.readInt32BE=function(y,_){return y=y>>>0,_||Rt(y,4,this.length),this[y]<<24|this[y+1]<<16|this[y+2]<<8|this[y+3]},u.prototype.readBigInt64LE=Et(function(y){y=y>>>0,$(y,"offset");const _=this[y],C=this[y+7];(_===void 0||C===void 0)&&H(y,this.length-8);const N=this[y+4]+this[y+5]*2**8+this[y+6]*2**16+(C<<24);return(BigInt(N)<>>0,$(y,"offset");const _=this[y],C=this[y+7];(_===void 0||C===void 0)&&H(y,this.length-8);const N=(_<<24)+this[++y]*2**16+this[++y]*2**8+this[++y];return(BigInt(N)<>>0,_||Rt(y,4,this.length),n.read(this,y,!0,23,4)},u.prototype.readFloatBE=function(y,_){return y=y>>>0,_||Rt(y,4,this.length),n.read(this,y,!1,23,4)},u.prototype.readDoubleLE=function(y,_){return y=y>>>0,_||Rt(y,8,this.length),n.read(this,y,!0,52,8)},u.prototype.readDoubleBE=function(y,_){return y=y>>>0,_||Rt(y,8,this.length),n.read(this,y,!1,52,8)};function Lt(w,y,_,C,N,F){if(!u.isBuffer(w))throw new TypeError('"buffer" argument must be a Buffer instance');if(y>N||yw.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(y,_,C,N){if(y=+y,_=_>>>0,C=C>>>0,!N){const At=Math.pow(2,8*C)-1;Lt(this,y,_,C,At,0)}let F=1,G=0;for(this[_]=y&255;++G>>0,C=C>>>0,!N){const At=Math.pow(2,8*C)-1;Lt(this,y,_,C,At,0)}let F=C-1,G=1;for(this[_+F]=y&255;--F>=0&&(G*=256);)this[_+F]=y/G&255;return _+C},u.prototype.writeUint8=u.prototype.writeUInt8=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,1,255,0),this[_]=y&255,_+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,2,65535,0),this[_]=y&255,this[_+1]=y>>>8,_+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,2,65535,0),this[_]=y>>>8,this[_+1]=y&255,_+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,4,4294967295,0),this[_+3]=y>>>24,this[_+2]=y>>>16,this[_+1]=y>>>8,this[_]=y&255,_+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,4,4294967295,0),this[_]=y>>>24,this[_+1]=y>>>16,this[_+2]=y>>>8,this[_+3]=y&255,_+4};function ae(w,y,_,C,N){J(y,C,N,w,_,7);let F=Number(y&BigInt(4294967295));w[_++]=F,F=F>>8,w[_++]=F,F=F>>8,w[_++]=F,F=F>>8,w[_++]=F;let G=Number(y>>BigInt(32)&BigInt(4294967295));return w[_++]=G,G=G>>8,w[_++]=G,G=G>>8,w[_++]=G,G=G>>8,w[_++]=G,_}function pe(w,y,_,C,N){J(y,C,N,w,_,7);let F=Number(y&BigInt(4294967295));w[_+7]=F,F=F>>8,w[_+6]=F,F=F>>8,w[_+5]=F,F=F>>8,w[_+4]=F;let G=Number(y>>BigInt(32)&BigInt(4294967295));return w[_+3]=G,G=G>>8,w[_+2]=G,G=G>>8,w[_+1]=G,G=G>>8,w[_]=G,_+8}u.prototype.writeBigUInt64LE=Et(function(y,_=0){return ae(this,y,_,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Et(function(y,_=0){return pe(this,y,_,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(y,_,C,N){if(y=+y,_=_>>>0,!N){const yt=Math.pow(2,8*C-1);Lt(this,y,_,C,yt-1,-yt)}let F=0,G=1,At=0;for(this[_]=y&255;++F>0)-At&255;return _+C},u.prototype.writeIntBE=function(y,_,C,N){if(y=+y,_=_>>>0,!N){const yt=Math.pow(2,8*C-1);Lt(this,y,_,C,yt-1,-yt)}let F=C-1,G=1,At=0;for(this[_+F]=y&255;--F>=0&&(G*=256);)y<0&&At===0&&this[_+F+1]!==0&&(At=1),this[_+F]=(y/G>>0)-At&255;return _+C},u.prototype.writeInt8=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,1,127,-128),y<0&&(y=255+y+1),this[_]=y&255,_+1},u.prototype.writeInt16LE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,2,32767,-32768),this[_]=y&255,this[_+1]=y>>>8,_+2},u.prototype.writeInt16BE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,2,32767,-32768),this[_]=y>>>8,this[_+1]=y&255,_+2},u.prototype.writeInt32LE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,4,2147483647,-2147483648),this[_]=y&255,this[_+1]=y>>>8,this[_+2]=y>>>16,this[_+3]=y>>>24,_+4},u.prototype.writeInt32BE=function(y,_,C){return y=+y,_=_>>>0,C||Lt(this,y,_,4,2147483647,-2147483648),y<0&&(y=4294967295+y+1),this[_]=y>>>24,this[_+1]=y>>>16,this[_+2]=y>>>8,this[_+3]=y&255,_+4},u.prototype.writeBigInt64LE=Et(function(y,_=0){return ae(this,y,_,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Et(function(y,_=0){return pe(this,y,_,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function vt(w,y,_,C,N,F){if(_+C>w.length)throw new RangeError("Index out of range");if(_<0)throw new RangeError("Index out of range")}function Re(w,y,_,C,N){return y=+y,_=_>>>0,N||vt(w,y,_,4),n.write(w,y,_,C,23,4),_+4}u.prototype.writeFloatLE=function(y,_,C){return Re(this,y,_,!0,C)},u.prototype.writeFloatBE=function(y,_,C){return Re(this,y,_,!1,C)};function Me(w,y,_,C,N){return y=+y,_=_>>>0,N||vt(w,y,_,8),n.write(w,y,_,C,52,8),_+8}u.prototype.writeDoubleLE=function(y,_,C){return Me(this,y,_,!0,C)},u.prototype.writeDoubleBE=function(y,_,C){return Me(this,y,_,!1,C)},u.prototype.copy=function(y,_,C,N){if(!u.isBuffer(y))throw new TypeError("argument should be a Buffer");if(C||(C=0),!N&&N!==0&&(N=this.length),_>=y.length&&(_=y.length),_||(_=0),N>0&&N=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),y.length-_>>0,C=C===void 0?this.length:C>>>0,y||(y=0);let F;if(typeof y=="number")for(F=_;F2**32?N=k(String(_)):typeof _=="bigint"&&(N=String(_),(_>BigInt(2)**BigInt(32)||_<-(BigInt(2)**BigInt(32)))&&(N=k(N)),N+="n"),C+=` It must be ${y}. Received ${N}`,C},RangeError);function k(w){let y="",_=w.length;const C=w[0]==="-"?1:0;for(;_>=C+4;_-=3)y=`_${w.slice(_-3,_)}${y}`;return`${w.slice(0,_)}${y}`}function O(w,y,_){$(y,"offset"),(w[y]===void 0||w[y+_]===void 0)&&H(y,w.length-(_+1))}function J(w,y,_,C,N,F){if(w>_||w= 0${G} and < 2${G} ** ${(F+1)*8}${G}`:At=`>= -(2${G} ** ${(F+1)*8-1}${G}) and < 2 ** ${(F+1)*8-1}${G}`,new Ue.ERR_OUT_OF_RANGE("value",At,w)}O(C,N,F)}function $(w,y){if(typeof w!="number")throw new Ue.ERR_INVALID_ARG_TYPE(y,"number",w)}function H(w,y,_){throw Math.floor(w)!==w?($(w,_),new Ue.ERR_OUT_OF_RANGE("offset","an integer",w)):y<0?new Ue.ERR_BUFFER_OUT_OF_BOUNDS:new Ue.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${y}`,w)}const it=/[^+/0-9A-Za-z-_]/g;function tt(w){if(w=w.split("=")[0],w=w.trim().replace(it,""),w.length<2)return"";for(;w.length%4!==0;)w=w+"=";return w}function X(w,y){y=y||1/0;let _;const C=w.length;let N=null;const F=[];for(let G=0;G55295&&_<57344){if(!N){if(_>56319){(y-=3)>-1&&F.push(239,191,189);continue}else if(G+1===C){(y-=3)>-1&&F.push(239,191,189);continue}N=_;continue}if(_<56320){(y-=3)>-1&&F.push(239,191,189),N=_;continue}_=(N-55296<<10|_-56320)+65536}else N&&(y-=3)>-1&&F.push(239,191,189);if(N=null,_<128){if((y-=1)<0)break;F.push(_)}else if(_<2048){if((y-=2)<0)break;F.push(_>>6|192,_&63|128)}else if(_<65536){if((y-=3)<0)break;F.push(_>>12|224,_>>6&63|128,_&63|128)}else if(_<1114112){if((y-=4)<0)break;F.push(_>>18|240,_>>12&63|128,_>>6&63|128,_&63|128)}else throw new Error("Invalid code point")}return F}function z(w){const y=[];for(let _=0;_>8,N=_%256,F.push(N),F.push(C);return F}function ot(w){return t.toByteArray(tt(w))}function ht(w,y,_,C){let N;for(N=0;N=y.length||N>=w.length);++N)y[N+_]=w[N];return N}function dt(w,y){return w instanceof y||w!=null&&w.constructor!=null&&w.constructor.name!=null&&w.constructor.name===y.name}function Pt(w){return w!==w}const Vt=(function(){const w="0123456789abcdef",y=new Array(256);for(let _=0;_<16;++_){const C=_*16;for(let N=0;N<16;++N)y[C+N]=w[_]+w[N]}return y})();function Et(w){return typeof BigInt>"u"?Qt:w}function Qt(){throw new Error("BigInt not supported")}})(X0);const Cr=X0.Buffer,U2=L.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),B2=e=>{const t={};let n,i,o;return e&&e.split(` `).forEach(function(r){o=r.indexOf(":"),n=r.substring(0,o).trim().toLowerCase(),i=r.substring(o+1).trim(),!(!n||t[n]&&U2[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t};function O2(e){let t=0,n=e.length;for(;tt;){const i=e.charCodeAt(n-1);if(i!==9&&i!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const V2=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),G2=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function du(e,t){return L.isArray(e)?e.map(n=>du(n,t)):O2(String(e).replace(t,""))}const H2=e=>du(e,V2),$2=e=>du(e,G2);function Z0(e){const t=Object.create(null);return L.forEach(e.toJSON(),(n,i)=>{t[i]=$2(n)}),t}const Rp=Symbol("internals");function Po(e){return e&&String(e).trim().toLowerCase()}function Sr(e){return e===!1||e==null?e:L.isArray(e)?e.map(Sr):H2(String(e))}function q2(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}const z2=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ga(e,t,n,i,o){if(L.isFunction(i))return i.call(this,t,n);if(o&&(t=n),!!L.isString(t)){if(L.isString(i))return t.indexOf(i)!==-1;if(L.isRegExp(i))return i.test(t)}}function W2(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function J2(e,t){const n=L.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{__proto__:null,value:function(o,s,r){return this[i].call(this,t,o,s,r)},configurable:!0})})}let Le=class{constructor(t){t&&this.set(t)}set(t,n,i){const o=this;function s(l,a,c){const u=Po(a);if(!u)throw new Error("header name must be a non-empty string");const h=L.findKey(o,u);(!h||o[h]===void 0||c===!0||c===void 0&&o[h]!==!1)&&(o[h||a]=Sr(l))}const r=(l,a)=>L.forEach(l,(c,u)=>s(c,u,a));if(L.isPlainObject(t)||t instanceof this.constructor)r(t,n);else if(L.isString(t)&&(t=t.trim())&&!z2(t))r(B2(t),n);else if(L.isObject(t)&&L.isIterable(t)){let l={},a,c;for(const u of t){if(!L.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[c=u[0]]=(a=l[c])?L.isArray(a)?[...a,u[1]]:[a,u[1]]:u[1]}r(l,n)}else t!=null&&s(n,t,i);return this}get(t,n){if(t=Po(t),t){const i=L.findKey(this,t);if(i){const o=this[i];if(!n)return o;if(n===!0)return q2(o);if(L.isFunction(n))return n.call(this,o,i);if(L.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Po(t),t){const i=L.findKey(this,t);return!!(i&&this[i]!==void 0&&(!n||ga(this,this[i],i,n)))}return!1}delete(t,n){const i=this;let o=!1;function s(r){if(r=Po(r),r){const l=L.findKey(i,r);l&&(!n||ga(i,i[l],l,n))&&(delete i[l],o=!0)}}return L.isArray(t)?t.forEach(s):s(t),o}clear(t){const n=Object.keys(this);let i=n.length,o=!1;for(;i--;){const s=n[i];(!t||ga(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){const n=this,i={};return L.forEach(this,(o,s)=>{const r=L.findKey(i,s);if(r){n[r]=Sr(o),delete n[s];return}const l=t?W2(s):String(s).trim();l!==s&&delete n[s],n[l]=Sr(o),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return L.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=t&&L.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const i=new this(t);return n.forEach(o=>i.set(o)),i}static accessor(t){const i=(this[Rp]=this[Rp]={accessors:{}}).accessors,o=this.prototype;function s(r){const l=Po(r);i[l]||(J2(o,r),i[l]=!0)}return L.isArray(t)?t.forEach(s):s(t),this}};Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(Le.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[n]=i}}});L.freezeMethods(Le);const K2="[REDACTED ****]";function Y2(e){if(L.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(L.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function X2(e,t){const n=new Set(t.map(s=>String(s).toLowerCase())),i=[],o=s=>{if(s===null||typeof s!="object"||L.isBuffer(s))return s;if(i.indexOf(s)!==-1)return;s instanceof Le&&(s=s.toJSON()),i.push(s);let r;if(L.isArray(s))r=[],s.forEach((l,a)=>{const c=o(l);L.isUndefined(c)||(r[a]=c)});else{if(!L.isPlainObject(s)&&Y2(s))return i.pop(),s;r=Object.create(null);for(const[l,a]of Object.entries(s)){const c=n.has(l.toLowerCase())?K2:o(a);L.isUndefined(c)||(r[l]=c)}}return i.pop(),r};return o(e)}let ct=class j0 extends Error{static from(t,n,i,o,s,r){const l=new j0(t.message,n||t.code,i,o,s);return l.cause=t,l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),r&&Object.assign(l,r),l}constructor(t,n,i,o,s){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),i&&(this.config=i),o&&(this.request=o),s&&(this.response=s,this.status=s.status)}toJSON(){const t=this.config,n=t&&L.hasOwnProp(t,"redact")?t.redact:void 0,i=L.isArray(n)&&n.length>0?X2(t,n):L.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:i,code:this.code,status:this.status}}};ct.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ct.ERR_BAD_OPTION="ERR_BAD_OPTION";ct.ECONNABORTED="ECONNABORTED";ct.ETIMEDOUT="ETIMEDOUT";ct.ECONNREFUSED="ECONNREFUSED";ct.ERR_NETWORK="ERR_NETWORK";ct.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ct.ERR_DEPRECATED="ERR_DEPRECATED";ct.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ct.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ct.ERR_CANCELED="ERR_CANCELED";ct.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ct.ERR_INVALID_URL="ERR_INVALID_URL";ct.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Q2=null;function hc(e){return L.isPlainObject(e)||L.isArray(e)}function ty(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function ma(e,t,n){return e?e.concat(t).map(function(o,s){return o=ty(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function Z2(e){return L.isArray(e)&&!e.some(hc)}const j2=L.toFlatObject(L,{},null,function(t){return/^is[A-Z]/.test(t)});function Ml(e,t,n){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,T){return!L.isUndefined(T[E])});const i=n.metaTokens,o=n.visitor||h,s=n.dots,r=n.indexes,l=n.Blob||typeof Blob<"u"&&Blob,a=n.maxDepth===void 0?100:n.maxDepth,c=l&&L.isSpecCompliantForm(t);if(!L.isFunction(o))throw new TypeError("visitor must be a function");function u(x){if(x===null)return"";if(L.isDate(x))return x.toISOString();if(L.isBoolean(x))return x.toString();if(!c&&L.isBlob(x))throw new ct("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(x)||L.isTypedArray(x)?c&&typeof Blob=="function"?new Blob([x]):Cr.from(x):x}function h(x,E,T){let A=x;if(L.isReactNative(t)&&L.isReactNativeBlob(x))return t.append(ma(T,E,s),u(x)),!1;if(x&&!T&&typeof x=="object"){if(L.endsWith(E,"{}"))E=i?E:E.slice(0,-2),x=JSON.stringify(x);else if(L.isArray(x)&&Z2(x)||(L.isFileList(x)||L.endsWith(E,"[]"))&&(A=L.toArray(x)))return E=ty(E),A.forEach(function(M,D){!(L.isUndefined(M)||M===null)&&t.append(r===!0?ma([E],D,s):r===null?E:E+"[]",u(M))}),!1}return hc(x)?!0:(t.append(ma(T,E,s),u(x)),!1)}const p=[],g=Object.assign(j2,{defaultVisitor:h,convertValue:u,isVisitable:hc});function v(x,E,T=0){if(!L.isUndefined(x)){if(T>a)throw new ct("Object is too deeply nested ("+T+" levels). Max depth: "+a,ct.ERR_FORM_DATA_DEPTH_EXCEEDED);if(p.indexOf(x)!==-1)throw Error("Circular reference detected in "+E.join("."));p.push(x),L.forEach(x,function(I,M){(!(L.isUndefined(I)||I===null)&&o.call(t,I,L.isString(M)?M.trim():M,E,g))===!0&&v(I,E?E.concat(M):[M],T+1)}),p.pop()}}if(!L.isObject(e))throw new TypeError("data must be an object");return v(e),t}function Mp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(i){return t[i]})}function fu(e,t){this._pairs=[],e&&Ml(e,this,t)}const ey=fu.prototype;ey.append=function(t,n){this._pairs.push([t,n])};ey.toString=function(t){const n=t?function(i){return t.call(this,i,Mp)}:Mp;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function tD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ny(e,t,n){if(!t)return e;const i=n&&n.encode||tD,o=L.isFunction(n)?{serialize:n}:n,s=o&&o.serialize;let r;if(s?r=s(t,o):r=L.isURLSearchParams(t)?t.toString():new fu(t,o).toString(i),r){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Pp{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){L.forEach(this.handlers,function(i){i!==null&&t(i)})}}const hu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},eD=typeof URLSearchParams<"u"?URLSearchParams:fu,nD=typeof FormData<"u"?FormData:null,iD=typeof Blob<"u"?Blob:null,oD={isBrowser:!0,classes:{URLSearchParams:eD,FormData:nD,Blob:iD},protocols:["http","https","file","blob","url","data"]},pu=typeof window<"u"&&typeof document<"u",pc=typeof navigator=="object"&&navigator||void 0,sD=pu&&(!pc||["ReactNative","NativeScript","NS"].indexOf(pc.product)<0),rD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",lD=pu&&window.location.href||"http://localhost",aD=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:pu,hasStandardBrowserEnv:sD,hasStandardBrowserWebWorkerEnv:rD,navigator:pc,origin:lD},Symbol.toStringTag,{value:"Module"})),Ce={...aD,...oD};function cD(e,t){return Ml(e,new Ce.classes.URLSearchParams,{visitor:function(n,i,o,s){return Ce.isNode&&L.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function uD(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dD(e){const t={},n=Object.keys(e);let i;const o=n.length;let s;for(i=0;i=n.length;return r=!r&&L.isArray(o)?o.length:r,a?(L.hasOwnProp(o,r)?o[r]=L.isArray(o[r])?o[r].concat(i):[o[r],i]:o[r]=i,!l):((!L.hasOwnProp(o,r)||!L.isObject(o[r]))&&(o[r]=[]),t(n,i,o[r],s)&&L.isArray(o[r])&&(o[r]=dD(o[r])),!l)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,(i,o)=>{t(uD(i),o,n,0)}),n}return null}const zi=(e,t)=>e!=null&&L.hasOwnProp(e,t)?e[t]:void 0;function fD(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}const Ts={transitional:hu,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,s=L.isObject(t);if(s&&L.isHTMLForm(t)&&(t=new FormData(t)),L.isFormData(t))return o?JSON.stringify(iy(t)):t;if(L.isArrayBuffer(t)||L.isBuffer(t)||L.isStream(t)||L.isFile(t)||L.isBlob(t)||L.isReadableStream(t))return t;if(L.isArrayBufferView(t))return t.buffer;if(L.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){const a=zi(this,"formSerializer");if(i.indexOf("application/x-www-form-urlencoded")>-1)return cD(t,a).toString();if((l=L.isFileList(t))||i.indexOf("multipart/form-data")>-1){const c=zi(this,"env"),u=c&&c.FormData;return Ml(l?{"files[]":t}:t,u&&new u,a)}}return s||o?(n.setContentType("application/json",!1),fD(t)):t}],transformResponse:[function(t){const n=zi(this,"transitional")||Ts.transitional,i=n&&n.forcedJSONParsing,o=zi(this,"responseType"),s=o==="json";if(L.isResponse(t)||L.isReadableStream(t))return t;if(t&&L.isString(t)&&(i&&!o||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,zi(this,"parseReviver"))}catch(a){if(l)throw a.name==="SyntaxError"?ct.from(a,ct.ERR_BAD_RESPONSE,this,null,zi(this,"response")):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ce.classes.FormData,Blob:Ce.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch","query"],e=>{Ts.headers[e]={}});function ya(e,t){const n=this||Ts,i=t||n,o=Le.from(i.headers);let s=i.data;return L.forEach(e,function(l){s=l.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function oy(e){return!!(e&&e.__CANCEL__)}let Cs=class extends ct{constructor(t,n,i){super(t??"canceled",ct.ERR_CANCELED,n,i),this.name="CanceledError",this.__CANCEL__=!0}};function sy(e,t,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new ct("Request failed with status code "+n.status,n.status>=400&&n.status<500?ct.ERR_BAD_REQUEST:ct.ERR_BAD_RESPONSE,n.config,n.request,n))}function hD(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function pD(e,t){e=e||10;const n=new Array(e),i=new Array(e);let o=0,s=0,r;return t=t!==void 0?t:1e3,function(a){const c=Date.now(),u=i[s];r||(r=c),n[o]=a,i[o]=c;let h=s,p=0;for(;h!==o;)p+=n[h++],h=h%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-r{n=u,o=null,s&&(clearTimeout(s),s=null),e(...c)};return[(...c)=>{const u=Date.now(),h=u-n;h>=i?r(c,u):(o=c,s||(s=setTimeout(()=>{s=null,r(o)},i-h)))},()=>o&&r(o)]}const jr=(e,t,n=3)=>{let i=0;const o=pD(50,250);return gD(s=>{if(!s||typeof s.loaded!="number")return;const r=s.loaded,l=s.lengthComputable?s.total:void 0,a=l!=null?Math.min(r,l):r,c=Math.max(0,a-i),u=o(c);i=Math.max(i,a);const h={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l?(l-a)/u:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(h)},n)},kp=(e,t)=>{const n=e!=null;return[i=>t[0]({lengthComputable:n,total:e,loaded:i}),t[1]]},Dp=e=>(...t)=>L.asap(()=>e(...t)),mD=Ce.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ce.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ce.origin),Ce.navigator&&/(msie|trident)/i.test(Ce.navigator.userAgent)):()=>!0,yD=Ce.hasStandardBrowserEnv?{write(e,t,n,i,o,s,r){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];L.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),L.isString(i)&&l.push(`path=${i}`),L.isString(o)&&l.push(`domain=${o}`),s===!0&&l.push("secure"),L.isString(r)&&l.push(`SameSite=${r}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;ne instanceof Le?{...e}:e;function Bi(e,t){t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function i(c,u,h,p){return L.isPlainObject(c)&&L.isPlainObject(u)?L.merge.call({caseless:p},c,u):L.isPlainObject(u)?L.merge({},u):L.isArray(u)?u.slice():u}function o(c,u,h,p){if(L.isUndefined(u)){if(!L.isUndefined(c))return i(void 0,c,h,p)}else return i(c,u,h,p)}function s(c,u){if(!L.isUndefined(u))return i(void 0,u)}function r(c,u){if(L.isUndefined(u)){if(!L.isUndefined(c))return i(void 0,c)}else return i(void 0,u)}function l(c,u,h){if(L.hasOwnProp(t,h))return i(c,u);if(L.hasOwnProp(e,h))return i(void 0,c)}const a={url:s,method:s,data:s,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,allowedSocketPaths:r,responseEncoding:r,validateStatus:l,headers:(c,u,h)=>o(Np(c),Np(u),h,!0)};return L.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=L.hasOwnProp(a,u)?a[u]:o,p=L.hasOwnProp(e,u)?e[u]:void 0,g=L.hasOwnProp(t,u)?t[u]:void 0,v=h(p,g,u);L.isUndefined(v)&&h!==l||(n[u]=v)}),n}const xD=["content-type","content-length"];function bD(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([i,o])=>{xD.includes(i.toLowerCase())&&e.set(i,o)})}const ED=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),ly=e=>{const t=Bi({},e),n=p=>L.hasOwnProp(t,p)?t[p]:void 0,i=n("data");let o=n("withXSRFToken");const s=n("xsrfHeaderName"),r=n("xsrfCookieName");let l=n("headers");const a=n("auth"),c=n("baseURL"),u=n("allowAbsoluteUrls"),h=n("url");if(t.headers=l=Le.from(l),t.url=ny(ry(c,h,u),e.params,e.paramsSerializer),a&&l.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?ED(a.password):""))),L.isFormData(i)&&(Ce.hasStandardBrowserEnv||Ce.hasStandardBrowserWebWorkerEnv?l.setContentType(void 0):L.isFunction(i.getHeaders)&&bD(l,i.getHeaders(),n("formDataHeaderPolicy"))),Ce.hasStandardBrowserEnv&&(L.isFunction(o)&&(o=o(t)),o===!0||o==null&&mD(t.url))){const g=s&&r&&yD.read(r);g&&l.set(s,g)}return t},wD=typeof XMLHttpRequest<"u",TD=wD&&function(e){return new Promise(function(n,i){const o=ly(e);let s=o.data;const r=Le.from(o.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:c}=o,u,h,p,g,v;function x(){g&&g(),v&&v(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let E=new XMLHttpRequest;E.open(o.method.toUpperCase(),o.url,!0),E.timeout=o.timeout;function T(){if(!E)return;const I=Le.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders()),D={data:!l||l==="text"||l==="json"?E.responseText:E.response,status:E.status,statusText:E.statusText,headers:I,config:e,request:E};sy(function(B){n(B),x()},function(B){i(B),x()},D),E=null}"onloadend"in E?E.onloadend=T:E.onreadystatechange=function(){!E||E.readyState!==4||E.status===0&&!(E.responseURL&&E.responseURL.startsWith("file:"))||setTimeout(T)},E.onabort=function(){E&&(i(new ct("Request aborted",ct.ECONNABORTED,e,E)),x(),E=null)},E.onerror=function(M){const D=M&&M.message?M.message:"Network Error",P=new ct(D,ct.ERR_NETWORK,e,E);P.event=M||null,i(P),x(),E=null},E.ontimeout=function(){let M=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const D=o.transitional||hu;o.timeoutErrorMessage&&(M=o.timeoutErrorMessage),i(new ct(M,D.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,e,E)),x(),E=null},s===void 0&&r.setContentType(null),"setRequestHeader"in E&&L.forEach(Z0(r),function(M,D){E.setRequestHeader(D,M)}),L.isUndefined(o.withCredentials)||(E.withCredentials=!!o.withCredentials),l&&l!=="json"&&(E.responseType=o.responseType),c&&([p,v]=jr(c,!0),E.addEventListener("progress",p)),a&&E.upload&&([h,g]=jr(a),E.upload.addEventListener("progress",h),E.upload.addEventListener("loadend",g)),(o.cancelToken||o.signal)&&(u=I=>{E&&(i(!I||I.type?new Cs(null,e,E):I),E.abort(),x(),E=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const A=hD(o.url);if(A&&!Ce.protocols.includes(A)){i(new ct("Unsupported protocol "+A+":",ct.ERR_BAD_REQUEST,e));return}E.send(s||null)})},CD=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let i=!1;const o=function(a){if(!i){i=!0,r();const c=a instanceof Error?a:this.reason;n.abort(c instanceof ct?c:new Cs(c instanceof Error?c.message:c))}};let s=t&&setTimeout(()=>{s=null,o(new ct(`timeout of ${t}ms exceeded`,ct.ETIMEDOUT))},t);const r=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(a=>{a.unsubscribe?a.unsubscribe(o):a.removeEventListener("abort",o)}),e=null)};e.forEach(a=>a.addEventListener("abort",o));const{signal:l}=n;return l.unsubscribe=()=>L.asap(r),l},SD=function*(e,t){let n=e.byteLength;if(n{const o=AD(e,t);let s=0,r,l=a=>{r||(r=!0,i&&i(a))};return new ReadableStream({async pull(a){try{const{done:c,value:u}=await o.next();if(c){l(),a.close();return}let h=u.byteLength;if(n){let p=s+=h;n(p)}a.enqueue(new Uint8Array(u))}catch(c){throw l(c),c}},cancel(a){return l(a),o.return()}},{highWaterMark:2})};function RD(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),i=e.slice(t+1);if(/;base64/i.test(n)){let r=i.length;const l=i.length;for(let g=0;g=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102)&&(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102)&&(r-=2,g+=2)}let a=0,c=l-1;const u=g=>g>=2&&i.charCodeAt(g-2)===37&&i.charCodeAt(g-1)===51&&(i.charCodeAt(g)===68||i.charCodeAt(g)===100);c>=0&&(i.charCodeAt(c)===61?(a++,c--):u(c)&&(a++,c-=3)),a===1&&c>=0&&(i.charCodeAt(c)===61||u(c))&&a++;const p=Math.floor(r/4)*3-(a||0);return p>0?p:0}if(typeof Cr<"u"&&typeof Cr.byteLength=="function")return Cr.byteLength(i,"utf8");let s=0;for(let r=0,l=i.length;r=55296&&a<=56319&&r+1=56320&&c<=57343?(s+=4,r++):s+=3}else s+=3}return s}const gu="1.16.1",Fp=64*1024,{isFunction:rr}=L,Up=(e,...t)=>{try{return!!e(...t)}catch{return!1}},MD=e=>{const t=L.global!==void 0&&L.global!==null?L.global:globalThis,{ReadableStream:n,TextEncoder:i}=t;e=L.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:s,Response:r}=e,l=o?rr(o):typeof fetch=="function",a=rr(s),c=rr(r);if(!l)return!1;const u=l&&rr(n),h=l&&(typeof i=="function"?(T=>A=>T.encode(A))(new i):async T=>new Uint8Array(await new s(T).arrayBuffer())),p=a&&u&&Up(()=>{let T=!1;const A=new s(Ce.origin,{body:new n,method:"POST",get duplex(){return T=!0,"half"}}),I=A.headers.has("Content-Type");return A.body!=null&&A.body.cancel(),T&&!I}),g=c&&u&&Up(()=>L.isReadableStream(new r("").body)),v={stream:g&&(T=>T.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!v[T]&&(v[T]=(A,I)=>{let M=A&&A[T];if(M)return M.call(A);throw new ct(`Response type '${T}' is not supported`,ct.ERR_NOT_SUPPORT,I)})});const x=async T=>{if(T==null)return 0;if(L.isBlob(T))return T.size;if(L.isSpecCompliantForm(T))return(await new s(Ce.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(L.isArrayBufferView(T)||L.isArrayBuffer(T))return T.byteLength;if(L.isURLSearchParams(T)&&(T=T+""),L.isString(T))return(await h(T)).byteLength},E=async(T,A)=>{const I=L.toFiniteNumber(T.getContentLength());return I??x(A)};return async T=>{let{url:A,method:I,data:M,signal:D,cancelToken:P,timeout:B,onDownloadProgress:U,onUploadProgress:V,responseType:W,headers:et,withCredentials:at="same-origin",fetchOptions:Ct,maxContentLength:gt,maxBodyLength:st}=ly(T);const ut=L.isNumber(gt)&>>-1,ft=L.isNumber(st)&&st>-1;let rt=o||fetch;W=W?(W+"").toLowerCase():"text";let xt=CD([D,P&&P.toAbortSignal()],B),Nt=null;const Kt=xt&&xt.unsubscribe&&(()=>{xt.unsubscribe()});let ie;try{if(ut&&typeof A=="string"&&A.startsWith("data:")&&RD(A)>gt)throw new ct("maxContentLength size of "+gt+" exceeded",ct.ERR_BAD_RESPONSE,T,Nt);if(ft&&I!=="get"&&I!=="head"){const vt=await E(et,M);if(typeof vt=="number"&&isFinite(vt)&&vt>st)throw new ct("Request body larger than maxBodyLength limit",ct.ERR_BAD_REQUEST,T,Nt)}if(V&&p&&I!=="get"&&I!=="head"&&(ie=await E(et,M))!==0){let vt=new s(A,{method:"POST",body:M,duplex:"half"}),Re;if(L.isFormData(M)&&(Re=vt.headers.get("content-type"))&&et.setContentType(Re),vt.body){const[Me,Ue]=kp(ie,jr(Dp(V)));M=Lp(vt.body,Fp,Me,Ue)}}L.isString(at)||(at=at?"include":"omit");const Ut=a&&"credentials"in s.prototype;if(L.isFormData(M)){const vt=et.getContentType();vt&&/^multipart\/form-data/i.test(vt)&&!/boundary=/i.test(vt)&&et.delete("content-type")}et.set("User-Agent","axios/"+gu,!1);const Rt={...Ct,signal:xt,method:I.toUpperCase(),headers:Z0(et.normalize()),body:M,duplex:"half",credentials:Ut?at:void 0};Nt=a&&new s(A,Rt);let Lt=await(a?rt(Nt,Ct):rt(A,Rt));if(ut){const vt=L.toFiniteNumber(Lt.headers.get("content-length"));if(vt!=null&&vt>gt)throw new ct("maxContentLength size of "+gt+" exceeded",ct.ERR_BAD_RESPONSE,T,Nt)}const ae=g&&(W==="stream"||W==="response");if(g&&Lt.body&&(U||ut||ae&&Kt)){const vt={};["status","statusText","headers"].forEach(O=>{vt[O]=Lt[O]});const Re=L.toFiniteNumber(Lt.headers.get("content-length")),[Me,Ue]=U&&kp(Re,jr(Dp(U),!0))||[];let R=0;const k=O=>{if(ut&&(R=O,R>gt))throw new ct("maxContentLength size of "+gt+" exceeded",ct.ERR_BAD_RESPONSE,T,Nt);Me&&Me(O)};Lt=new r(Lp(Lt.body,Fp,k,()=>{Ue&&Ue(),Kt&&Kt()}),vt)}W=W||"text";let pe=await v[L.findKey(v,W)||"text"](Lt,T);if(ut&&!g&&!ae){let vt;if(pe!=null&&(typeof pe.byteLength=="number"?vt=pe.byteLength:typeof pe.size=="number"?vt=pe.size:typeof pe=="string"&&(vt=typeof i=="function"?new i().encode(pe).byteLength:pe.length)),typeof vt=="number"&&vt>gt)throw new ct("maxContentLength size of "+gt+" exceeded",ct.ERR_BAD_RESPONSE,T,Nt)}return!ae&&Kt&&Kt(),await new Promise((vt,Re)=>{sy(vt,Re,{data:pe,headers:Le.from(Lt.headers),status:Lt.status,statusText:Lt.statusText,config:T,request:Nt})})}catch(Ut){if(Kt&&Kt(),xt&&xt.aborted&&xt.reason instanceof ct){const Rt=xt.reason;throw Rt.config=T,Nt&&(Rt.request=Nt),Ut!==Rt&&(Rt.cause=Ut),Rt}throw Ut&&Ut.name==="TypeError"&&/Load failed|fetch/i.test(Ut.message)?Object.assign(new ct("Network Error",ct.ERR_NETWORK,T,Nt,Ut&&Ut.response),{cause:Ut.cause||Ut}):ct.from(Ut,Ut&&Ut.code,T,Nt,Ut&&Ut.response)}}},PD=new Map,ay=e=>{let t=e&&e.env||{};const{fetch:n,Request:i,Response:o}=t,s=[i,o,n];let r=s.length,l=r,a,c,u=PD;for(;l--;)a=s[l],c=u.get(a),c===void 0&&u.set(a,c=l?new Map:MD(t)),u=c;return c};ay();const mu={http:Q2,xhr:TD,fetch:{get:ay}};L.forEach(mu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Bp=e=>`- ${e}`,kD=e=>L.isFunction(e)||e===null||e===!1;function DD(e,t){e=L.isArray(e)?e:[e];const{length:n}=e;let i,o;const s={};for(let r=0;r`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let l=n?r.length>1?`since : `+r.map(Bp).join(` `):" "+Bp(r[0]):"as no adapter specified";throw new ct("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o}const cy={getAdapter:DD,adapters:mu};function _a(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Cs(null,e)}function Op(e){return _a(e),e.headers=Le.from(e.headers),e.data=ya.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),cy.getAdapter(e.adapter||Ts.adapter,e)(e).then(function(i){_a(e),e.response=i;try{i.data=ya.call(e,e.transformResponse,i)}finally{delete e.response}return i.headers=Le.from(i.headers),i},function(i){if(!oy(i)&&(_a(e),i&&i.response)){e.response=i.response;try{i.response.data=ya.call(e,e.transformResponse,i.response)}finally{delete e.response}i.response.headers=Le.from(i.response.headers)}return Promise.reject(i)})}const Pl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Pl[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});const Vp={};Pl.transitional=function(t,n,i){function o(s,r){return"[Axios v"+gu+"] Transitional option '"+s+"'"+r+(i?". "+i:"")}return(s,r,l)=>{if(t===!1)throw new ct(o(r," has been removed"+(n?" in "+n:"")),ct.ERR_DEPRECATED);return n&&!Vp[r]&&(Vp[r]=!0,console.warn(o(r," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,r,l):!0}};Pl.spelling=function(t){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${t}`),!0)};function ND(e,t,n){if(typeof e!="object")throw new ct("options must be an object",ct.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let o=i.length;for(;o-- >0;){const s=i[o],r=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(r){const l=e[s],a=l===void 0||r(l,s,e);if(a!==!0)throw new ct("option "+s+" must be "+a,ct.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ct("Unknown option "+s,ct.ERR_BAD_OPTION)}}const Ar={assertOptions:ND,validators:Pl},Ye=Ar.validators;let Li=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Pp,response:new Pp}}async request(t,n){try{return await this._request(t,n)}catch(i){if(i instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=(()=>{if(!o.stack)return"";const r=o.stack.indexOf(` `);return r===-1?"":o.stack.slice(r+1)})();try{if(!i.stack)i.stack=s;else if(s){const r=s.indexOf(` `),l=r===-1?-1:s.indexOf(` `,r+1),a=l===-1?"":s.slice(l+1);String(i.stack).endsWith(a)||(i.stack+=` `+s)}}catch{}}throw i}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Bi(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:s}=n;i!==void 0&&Ar.assertOptions(i,{silentJSONParsing:Ye.transitional(Ye.boolean),forcedJSONParsing:Ye.transitional(Ye.boolean),clarifyTimeoutError:Ye.transitional(Ye.boolean),legacyInterceptorReqResOrdering:Ye.transitional(Ye.boolean)},!1),o!=null&&(L.isFunction(o)?n.paramsSerializer={serialize:o}:Ar.assertOptions(o,{encode:Ye.function,serialize:Ye.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ar.assertOptions(n,{baseUrl:Ye.spelling("baseURL"),withXsrfToken:Ye.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let r=s&&L.merge(s.common,s[n.method]);s&&L.forEach(["delete","get","head","post","put","patch","query","common"],v=>{delete s[v]}),n.headers=Le.concat(r,s);const l=[];let a=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(n)===!1)return;a=a&&x.synchronous;const E=n.transitional||hu;E&&E.legacyInterceptorReqResOrdering?l.unshift(x.fulfilled,x.rejected):l.push(x.fulfilled,x.rejected)});const c=[];this.interceptors.response.forEach(function(x){c.push(x.fulfilled,x.rejected)});let u,h=0,p;if(!a){const v=[Op.bind(this),void 0];for(v.unshift(...l),v.push(...c),p=v.length,u=Promise.resolve(n);h{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](o);i._listeners=null}),this.promise.then=o=>{let s;const r=new Promise(l=>{i.subscribe(l),s=l}).then(o);return r.cancel=function(){i.unsubscribe(s)},r},t(function(s,r,l){i.reason||(i.reason=new Cs(s,r,l),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=i=>{t.abort(i)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new uy(function(o){t=o}),cancel:t}}};function FD(e){return function(n){return e.apply(null,n)}}function UD(e){return L.isObject(e)&&e.isAxiosError===!0}const gc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gc).forEach(([e,t])=>{gc[t]=e});function dy(e){const t=new Li(e),n=H0(Li.prototype.request,t);return L.extend(n,Li.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return dy(Bi(e,o))},n}const fe=dy(Ts);fe.Axios=Li;fe.CanceledError=Cs;fe.CancelToken=LD;fe.isCancel=oy;fe.VERSION=gu;fe.toFormData=Ml;fe.AxiosError=ct;fe.Cancel=fe.CanceledError;fe.all=function(t){return Promise.all(t)};fe.spread=FD;fe.isAxiosError=UD;fe.mergeConfig=Bi;fe.AxiosHeaders=Le;fe.formToJSON=e=>iy(L.isHTMLForm(e)?new FormData(e):e);fe.getAdapter=cy.getAdapter;fe.HttpStatusCode=gc;fe.default=fe;const{Axios:DO,AxiosError:NO,CanceledError:LO,isCancel:FO,CancelToken:UO,VERSION:BO,all:OO,Cancel:VO,isAxiosError:GO,spread:HO,toFormData:$O,AxiosHeaders:qO,HttpStatusCode:zO,formToJSON:WO,getAdapter:JO,mergeConfig:KO,create:YO}=fe,BD=window.location.origin==="http://localhost:5173"?"http://localhost:7860":"https://my-project-team-infosecai-finalproj.hf.space",Go=_t(!1),mc=_t(!1),yc=_t(""),fy=_t(""),Xe=fe.create({baseURL:BD,headers:{"Content-Type":"application/json"}});Xe.interceptors.response.use(e=>{const t=e.data;return t&&t.status==="pending_verify"?(Go.value=!0,yc.value=t.message||"偵測到異常,請於5分鐘內確認 Email 以繼續使用"):t&&t.status==="blocked"&&(mc.value=!0,fy.value="驗證逾時或帳號遭非法存取,已強制登出"),e},e=>Promise.reject(e));var OD={};const VD={key:0,class:"flex h-screen bg-slate-100 font-sans text-slate-900 overflow-hidden"},GD={class:"w-[40%] bg-white border-r border-slate-200 p-10 flex flex-col gap-8 overflow-y-auto"},HD={class:"flex items-center gap-3 mb-2"},$D={class:"bg-blue-600 p-2 rounded-lg"},qD={class:"bg-slate-50 rounded-2xl p-6 border border-slate-200 space-y-6 shadow-sm"},zD={class:"space-y-4"},WD=["value"],JD={class:"space-y-4"},KD={class:"space-y-4 pt-2"},YD={class:"flex gap-6"},XD={class:"flex items-center gap-2 cursor-pointer group"},QD={class:"flex items-center gap-2 cursor-pointer group"},ZD={class:"flex-1 flex flex-col min-h-0"},jD={class:"flex-1 bg-slate-900 rounded-2xl border border-slate-800 overflow-hidden flex flex-col shadow-xl"},tN={class:"overflow-x-auto"},eN={class:"w-full text-left border-collapse"},nN={class:"font-mono text-[11px] divide-y divide-slate-800"},iN={class:"p-3 text-slate-300 truncate max-w-[100px]"},oN={class:"p-3 text-blue-400"},sN={class:"p-3 text-slate-500 truncate max-w-[80px]"},rN={class:"p-3 text-slate-300"},lN={class:"p-3"},aN={class:"w-[60%] bg-slate-100 flex items-center justify-center p-10"},cN={class:"w-full max-w-md bg-white rounded-3xl shadow-2xl overflow-hidden border border-slate-200"},uN={class:"bg-blue-600 p-8 text-white text-center relative overflow-hidden"},dN={class:"absolute -right-10 -bottom-10 opacity-10"},fN={class:"p-10 space-y-8"},hN={key:0,class:"bg-red-50 text-red-600 p-4 rounded-xl text-sm font-bold border border-red-100 flex items-center gap-2 animate-shake"},pN={class:"space-y-6"},gN={class:"space-y-2"},mN={class:"relative"},yN={class:"space-y-2"},_N={class:"relative"},vN={class:"grid grid-cols-2 gap-4"},xN={class:"space-y-2"},bN={class:"flex items-end"},EN={class:"w-full h-[58px] bg-slate-100 rounded-2xl border border-slate-200 flex items-center justify-center gap-2 cursor-pointer hover:bg-slate-200 transition-colors group"},wN={key:1,class:"flex h-screen bg-slate-50 font-sans text-slate-900 overflow-hidden"},TN={class:"w-64 bg-white border-r border-slate-200 flex flex-col shrink-0"},CN={class:"p-6 border-b border-slate-100 flex items-center gap-3"},SN={class:"bg-blue-600 p-2 rounded-lg"},AN={class:"flex-1 p-4 space-y-2"},IN=["onClick"],RN={class:"p-4 border-t border-slate-100"},MN={class:"bg-slate-50 rounded-2xl p-4 flex items-center gap-3"},PN={class:"w-10 h-10 rounded-full bg-slate-200 flex items-center justify-center"},kN={class:"flex-1 min-w-0"},DN={class:"text-sm font-semibold truncate"},NN={class:"flex-1 flex flex-col overflow-hidden relative"},LN={class:"h-16 bg-white border-b border-slate-200 px-8 flex items-center justify-between shrink-0 z-10"},FN={class:"flex items-center gap-4"},UN={class:"text-lg font-semibold text-slate-800"},BN={class:"flex items-center gap-6"},ON={class:"relative"},VN={class:"flex-1 overflow-y-auto p-8 space-y-8"},GN={key:0,class:"bg-amber-50 border-l-4 border-amber-500 p-4 rounded-r-xl shadow-sm flex justify-between items-center animate-fade-in shrink-0"},HN={class:"flex items-center gap-3"},$N={class:"text-xs text-amber-700 font-medium"},qN={class:"space-y-8"},zN={class:"grid grid-cols-1 md:grid-cols-3 gap-6"},WN={class:"flex items-start justify-between mb-4"},JN={class:"text-xs font-bold px-2 py-1 bg-slate-100 rounded-lg text-slate-600"},KN={class:"text-slate-500 text-sm font-medium"},YN={class:"text-2xl font-bold mt-1"},XN={class:"bg-white p-8 rounded-2xl border border-slate-200 shadow-sm relative overflow-hidden"},QN={class:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-8"},ZN={class:"flex items-center gap-3"},jN=["value"],tL={class:"h-[400px] w-full relative"},eL={key:0,class:"absolute inset-0 bg-white/50 backdrop-blur-[2px] z-10 flex items-center justify-center"},nL={class:"flex flex-col items-center gap-2"},iL={key:1,class:"absolute inset-0 z-10 flex items-center justify-center p-8 text-center"},oL={class:"bg-slate-50 rounded-2xl p-8 border border-dashed border-slate-200 max-w-md"},sL={class:"bg-amber-100 w-12 h-12 rounded-full flex items-center justify-center mx-auto mb-4"},rL={class:"text-sm text-slate-500 leading-relaxed"},lL={key:1,class:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden"},aL={class:"p-6 border-b border-slate-100 flex items-center justify-between"},cL={class:"text-sm text-slate-500"},uL={class:"font-semibold text-blue-600"},dL={class:"flex gap-2"},fL={class:"px-3 py-1 bg-red-50 text-red-600 text-xs font-bold rounded-full border border-red-100"},hL={class:"px-3 py-1 bg-amber-50 text-amber-600 text-xs font-bold rounded-full border border-amber-100"},pL={class:"divide-y divide-slate-100"},gL=["onClick"],mL={class:"flex items-center gap-4"},yL={class:"flex items-center gap-2"},_L={class:"font-bold text-slate-800"},vL={class:"text-sm text-slate-500 mt-0.5"},xL={class:"flex items-center gap-6"},bL={class:"text-right"},EL={class:"text-xs text-slate-400"},wL={key:2,class:"grid grid-cols-1 lg:grid-cols-2 gap-8"},TL={class:"bg-white rounded-2xl border border-slate-200 p-8 shadow-sm"},CL={class:"h-[400px] w-full"},SL={class:"space-y-8"},AL={class:"bg-white rounded-2xl border border-slate-200 p-8 shadow-sm"},IL={class:"space-y-8"},RL={class:"space-y-4"},ML={class:"flex justify-between items-center"},PL={class:"text-blue-600 font-bold"},kL={class:"border-t border-slate-100 pt-6 space-y-6"},DL={class:"grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6"},NL={class:"space-y-4"},LL={class:"flex justify-between items-center"},FL={class:"text-xs font-bold"},UL={class:"space-y-4"},BL={class:"flex justify-between items-center"},OL={class:"text-xs font-bold"},VL={class:"space-y-4"},GL={class:"flex justify-between items-center"},HL={class:"text-xs font-bold"},$L={class:"space-y-4"},qL={class:"flex justify-between items-center"},zL={class:"text-xs font-bold"},WL={class:"space-y-4"},JL={class:"flex justify-between items-center"},KL={class:"text-xs font-bold"},YL={key:3,class:"bg-white rounded-3xl border border-slate-200 shadow-sm overflow-hidden animate-in fade-in duration-300"},XL={class:"p-8 border-b border-slate-100 flex flex-col md:flex-row md:items-center justify-between gap-4 bg-slate-50/50"},QL={class:"text-xl font-bold text-slate-800 flex items-center gap-2"},ZL=["disabled"],jL={class:"overflow-x-auto"},tF={class:"w-full text-left border-collapse"},eF={class:"divide-y divide-slate-100"},nF={class:"p-6 font-mono text-sm font-bold text-slate-700"},iF={class:"p-6"},oF={class:"flex items-center gap-2"},sF={class:"w-8 h-8 rounded-full bg-slate-100 flex items-center justify-center font-bold text-slate-600 text-xs"},rF={class:"font-semibold text-slate-800"},lF={class:"p-6"},aF={class:"p-6"},cF={class:"p-6 text-right"},uF={class:"flex items-center justify-end gap-3"},dF=["onClick"],fF=["onClick"],hF={key:1,class:"text-xs text-slate-400 font-medium italic"},pF={class:"p-6 border-b border-slate-100 flex items-center justify-between shrink-0"},gF={class:"flex items-center gap-3"},mF={class:"p-2 bg-slate-100 rounded-lg"},yF={key:0,class:"flex-1 overflow-y-auto p-8 space-y-8"},_F={class:"space-y-4"},vF={class:"flex items-center justify-between"},xF={class:"text-xl font-bold text-slate-800"},bF={class:"grid grid-cols-1 gap-4"},EF={class:"bg-slate-50 p-4 rounded-xl"},wF={class:"font-mono font-semibold"},TF={class:"bg-blue-50/50 border border-blue-100 rounded-2xl p-6 space-y-3 relative overflow-hidden"},CF={class:"flex items-center justify-between"},SF={class:"flex items-center gap-2 text-blue-700"},AF={class:"flex items-center gap-2"},IF={key:0,class:"flex items-center gap-3 py-4 text-blue-600"},RF={key:1,class:"text-slate-700 leading-relaxed text-sm whitespace-pre-line"},MF={class:"absolute -right-4 -bottom-4 opacity-5"},PF={class:"space-y-3"},kF={class:"flex items-center gap-2 text-slate-500"},DF={class:"bg-slate-900 rounded-xl p-4 overflow-x-auto"},NF={class:"text-emerald-400 font-mono text-xs leading-relaxed"},LF={class:"p-6 border-t border-slate-100 bg-slate-50 flex gap-4 shrink-0"},FF={key:2,class:"flex h-screen bg-slate-100 font-sans text-slate-900 overflow-hidden"},UF={class:"w-[40%] bg-white border-r border-slate-200 p-10 flex flex-col gap-8 overflow-y-auto"},BF={class:"flex items-center gap-3 mb-2"},OF={class:"bg-blue-600 p-2 rounded-lg"},VF={class:"bg-slate-50 rounded-2xl p-6 border border-slate-200 space-y-6 shadow-sm"},GF={class:"space-y-4"},HF=["value"],$F={class:"space-y-4"},qF={class:"space-y-4 pt-2"},zF={class:"flex gap-6"},WF={class:"flex items-center gap-2 cursor-pointer group"},JF={class:"flex items-center gap-2 cursor-pointer group"},KF={class:"flex-1 flex flex-col min-h-0"},YF={class:"flex-1 bg-slate-900 rounded-2xl border border-slate-800 overflow-hidden flex flex-col shadow-xl"},XF={class:"overflow-x-auto"},QF={class:"w-full text-left border-collapse"},ZF={class:"font-mono text-[11px] divide-y divide-slate-800"},jF={class:"p-3 text-slate-300 truncate max-w-[100px]"},t5={class:"p-3 text-blue-400"},e5={class:"p-3 text-slate-500 truncate max-w-[80px]"},n5={class:"p-3 text-slate-300"},i5={class:"p-3"},o5={class:"w-[60%] flex flex-col overflow-hidden"},s5={class:"h-20 bg-white border-b border-slate-200 px-10 flex items-center justify-between shrink-0 shadow-sm z-10"},r5={class:"flex items-center gap-6"},l5={class:"flex items-center gap-3"},a5={class:"bg-blue-600 p-2 rounded-lg"},c5={class:"flex items-center gap-2 text-slate-600"},u5={class:"font-bold text-sm"},d5={class:"flex items-center gap-6"},f5={class:"flex items-center gap-2 text-slate-500"},h5={class:"flex items-center gap-2 bg-slate-100 p-1 rounded-xl"},p5={class:"flex-1 overflow-y-auto p-10 space-y-8"},g5={key:0,class:"bg-amber-50 border-l-4 border-amber-500 p-4 rounded-r-xl shadow-sm flex justify-between items-center animate-fade-in shrink-0"},m5={class:"flex items-center gap-3"},y5={class:"text-xs text-amber-700 font-medium"},_5={key:0,class:"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-350"},v5={class:"flex items-center justify-between pb-4 border-b border-slate-200"},x5={class:"flex items-center gap-3"},b5={class:"text-xl font-bold text-slate-800"},E5={key:0,class:"grid grid-cols-1 md:grid-cols-3 gap-6"},w5={class:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm space-y-4"},T5={class:"space-y-2"},C5=["onClick"],S5={class:"text-sm"},A5={class:"text-xs text-slate-400 font-medium mt-0.5"},I5={key:0,class:"px-2 py-0.5 bg-emerald-100 text-emerald-700 text-[10px] font-bold rounded"},R5={key:1,class:"px-2 py-0.5 bg-amber-100 text-amber-700 text-[10px] font-bold rounded"},M5={class:"md:col-span-2 bg-white rounded-2xl border border-slate-200 p-8 shadow-sm space-y-6"},P5={key:0,class:"space-y-6"},k5={class:"text-lg font-bold text-slate-800"},D5={class:"text-sm text-slate-500"},N5={class:"space-y-6"},L5={class:"space-y-3"},F5={class:"flex items-center gap-2"},U5=["disabled","onClick"],B5={class:"text-xs font-bold text-slate-400 ml-2"},O5={class:"space-y-3"},V5={class:"flex items-center gap-2"},G5=["disabled","onClick"],H5={class:"text-xs font-bold text-slate-400 ml-2"},$5={class:"space-y-3"},q5={class:"flex items-center gap-2"},z5=["disabled","onClick"],W5={class:"text-xs font-bold text-slate-400 ml-2"},J5={class:"space-y-3"},K5=["disabled"],Y5={class:"flex justify-end gap-3"},X5=["disabled"],Q5={key:1,class:"space-y-6"},Z5={class:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm flex flex-col md:flex-row md:items-center justify-between gap-4"},j5={class:"flex items-center gap-3 flex-1"},tU={class:"flex items-center gap-3 bg-blue-50 px-4 py-2.5 rounded-xl border border-blue-100 text-sm"},eU={class:"text-blue-600 font-extrabold text-base"},nU={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},iU={class:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm space-y-4"},oU={class:"space-y-3 max-h-[300px] overflow-y-auto pr-1"},sU={class:"space-y-1"},rU={class:"flex items-center gap-2"},lU={class:"text-xs bg-slate-200 text-slate-600 px-1.5 py-0.5 rounded font-mono font-bold"},aU={class:"font-bold text-slate-800 text-sm"},cU={class:"text-xs text-slate-500"},uU=["onClick"],dU={key:0,class:"text-center py-10 text-slate-400 text-sm font-medium"},fU={class:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm space-y-4"},hU={class:"space-y-3 max-h-[300px] overflow-y-auto pr-1"},pU={class:"space-y-1"},gU={class:"flex items-center gap-2"},mU={class:"text-xs bg-blue-200/50 text-blue-700 px-1.5 py-0.5 rounded font-mono font-bold"},yU={class:"font-bold text-slate-800 text-sm"},_U={class:"text-xs text-slate-500"},vU=["onClick"],xU={key:0,class:"text-center py-10 text-slate-400 text-sm font-medium"},bU={key:2,class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},EU={class:"bg-white rounded-2xl border border-slate-200 p-8 shadow-sm space-y-6"},wU={class:"space-y-4"},TU={class:"grid grid-cols-2 gap-4"},CU={class:"space-y-2"},SU={class:"space-y-2"},AU={class:"flex items-center justify-center gap-2 w-full h-[46px] bg-slate-50 border border-dashed border-slate-300 hover:bg-slate-100 rounded-xl cursor-pointer transition-colors text-xs font-bold text-slate-600"},IU={class:"truncate max-w-[120px]"},RU={class:"grid grid-cols-2 gap-4"},MU={class:"space-y-2"},PU={class:"space-y-2"},kU={class:"space-y-2"},DU={class:"bg-white rounded-2xl border border-slate-200 p-8 shadow-sm space-y-6"},NU={class:"space-y-3 max-h-[300px] overflow-y-auto pr-1"},LU={class:"space-y-1"},FU={class:"flex items-center gap-2"},UU={class:"font-mono text-[10px] text-slate-400"},BU={class:"text-xs font-bold text-slate-700"},OU={class:"text-[11px] text-slate-400 truncate max-w-[200px]"},VU={key:3,class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},GU={class:"bg-white rounded-2xl border border-slate-200 p-8 shadow-sm space-y-6"},HU={class:"space-y-4"},$U={class:"space-y-2"},qU={class:"space-y-2"},zU={class:"space-y-2"},WU={class:"flex items-start gap-2.5 pt-2 cursor-pointer select-none"},JU={class:"bg-white rounded-2xl border border-slate-200 p-8 shadow-sm flex flex-col justify-between"},KU={class:"space-y-6"},YU={class:"h-44 bg-slate-50 rounded-2xl border border-dashed border-slate-200 flex flex-col items-center justify-center p-6 text-center"},XU={class:"w-10 h-10 bg-blue-50 text-blue-500 rounded-full flex items-center justify-center mb-2"},QU={class:"font-extrabold text-sm"},ZU={class:"text-xs font-medium leading-relaxed"},jU=["disabled"],tB={key:4,class:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden h-[420px] flex relative"},eB={class:"w-36 bg-slate-50 border-r border-slate-100 p-3 flex flex-col gap-1 shrink-0"},nB=["onClick"],iB={key:0,class:"bg-blue-600 text-white px-1.5 py-0.2 rounded text-[9px] font-bold"},oB={class:"w-56 border-r border-slate-100 flex flex-col shrink-0"},sB={class:"p-3 border-b border-slate-50 bg-white"},rB={class:"text-[10px] font-extrabold text-slate-400 uppercase tracking-widest"},lB={class:"flex-1 overflow-y-auto divide-y divide-slate-50 bg-white"},aB=["onClick"],cB={class:"flex justify-between items-start w-full"},uB={class:"text-[9px] text-slate-400 font-mono"},dB={key:1,class:"p-10 text-center text-slate-400 text-xs font-medium"},fB={class:"flex-1 bg-white flex flex-col overflow-hidden"},hB={key:0,class:"flex-1 flex flex-col overflow-hidden animate-in fade-in duration-200"},pB={class:"p-5 border-b border-slate-50"},gB={class:"text-sm font-extrabold text-slate-800"},mB={class:"flex justify-between items-center mt-2"},yB={class:"text-xs font-bold text-slate-700"},_B={class:"text-[10px] text-slate-400 ml-1 font-mono"},vB={class:"text-[10px] text-slate-400 font-mono"},xB={class:"flex-1 p-5 overflow-y-auto text-xs text-slate-600 leading-relaxed whitespace-pre-line font-sans"},bB={key:1,class:"flex-1 flex items-center justify-center text-slate-400 text-xs font-medium"},EB={key:0,class:"absolute inset-0 bg-slate-900/20 backdrop-blur-[1px] z-20 flex items-center justify-center"},wB={class:"bg-white rounded-2xl border border-slate-200 shadow-2xl w-full max-w-sm p-5 space-y-3 animate-in zoom-in-95 duration-200"},TB={class:"flex items-center justify-between border-b border-slate-100 pb-2"},CB={class:"space-y-2.5"},SB={class:"space-y-1"},AB={class:"space-y-1"},IB={class:"space-y-1"},RB={class:"flex justify-end gap-2 pt-2 border-t border-slate-100"},MB={key:5,class:"space-y-6 relative min-h-[400px]"},PB={class:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm flex flex-col md:flex-row md:items-center justify-between gap-4"},kB={class:"flex items-center gap-1 bg-slate-100 p-1 rounded-xl"},DB=["onClick"],NB={class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"},LB={class:"space-y-2"},FB={class:"flex items-center justify-between"},UB={class:"px-2 py-0.5 bg-slate-100 text-slate-500 rounded text-[9px] font-bold"},BB={class:"text-[9px] text-slate-400 font-mono font-bold"},OB={class:"font-black text-slate-800 text-sm"},VB={class:"text-[11px] text-slate-500 leading-relaxed h-12 overflow-hidden"},GB={class:"grid grid-cols-2 gap-2 mt-4"},HB=["onClick"],$B={key:0,class:"absolute inset-0 bg-white/90 backdrop-blur-sm z-30 flex flex-col items-center justify-center gap-3 animate-in fade-in duration-250"},qB={key:1,class:"absolute inset-0 bg-slate-950 z-40 rounded-2xl flex flex-col overflow-hidden shadow-2xl border border-slate-800 animate-in zoom-in-95 duration-300"},zB={class:"h-10 bg-slate-900 border-b border-slate-800 px-4 flex items-center justify-between shrink-0 select-none"},WB={class:"flex items-center gap-2"},JB={class:"text-xs text-slate-400 font-mono font-bold ml-2"},KB={class:"flex-1 relative bg-slate-900 flex flex-col items-center justify-center p-6 select-none"},YB={key:0,class:"w-full max-w-xl bg-slate-800 rounded-xl border border-slate-700 shadow-xl overflow-hidden flex flex-col"},XB={class:"bg-slate-700 px-4 py-2 text-[10px] font-mono text-slate-300 border-b border-slate-600 flex items-center gap-2"},QB={key:1,class:"w-full max-w-xl bg-slate-800 rounded-xl border border-slate-700 shadow-xl overflow-hidden flex flex-col"},ZB={class:"bg-slate-700 px-4 py-2 text-[10px] font-mono text-slate-300 border-b border-slate-600 flex items-center gap-2"},jB={key:2,class:"text-center space-y-3"},tO={class:"w-12 h-12 bg-blue-900/30 text-blue-400 rounded-full flex items-center justify-center mx-auto border border-blue-500/20"},eO={class:"font-extrabold text-white text-sm"},nO={key:1,class:"space-y-8 animate-in fade-in duration-350"},iO={class:"space-y-4"},oO={class:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden"},sO={class:"flex items-center gap-3"},rO={class:"p-6 bg-slate-50/50 border-t border-slate-100 grid grid-cols-2 gap-4"},lO={class:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors"},aO={class:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors"},cO={class:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden"},uO={class:"flex items-center gap-3"},dO={class:"p-6 bg-slate-50/50 border-t border-slate-100 grid grid-cols-2 gap-4"},fO={class:"p-2 bg-emerald-50 rounded-lg group-hover:bg-emerald-100 transition-colors"},hO={class:"p-2 bg-emerald-50 rounded-lg group-hover:bg-emerald-100 transition-colors"},pO={class:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden"},gO={class:"flex items-center gap-3"},mO={class:"p-6 bg-slate-50/50 border-t border-slate-100 grid grid-cols-2 gap-4"},yO={class:"p-2 bg-amber-50 rounded-lg group-hover:bg-amber-100 transition-colors"},_O={class:"p-2 bg-amber-50 rounded-lg group-hover:bg-amber-100 transition-colors"},vO={class:"bg-red-50 rounded-2xl border border-red-100 p-8 space-y-6 shadow-sm"},xO={class:"flex items-center gap-3 text-red-700"},bO={key:3,class:"fixed inset-0 z-[9999] flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-md animate-fade-in"},EO={class:"bg-white rounded-3xl p-8 max-w-md w-full border border-red-200 shadow-2xl text-center space-y-6 transform scale-100 transition-all duration-300"},wO={class:"mx-auto bg-red-100 w-16 h-16 rounded-full flex items-center justify-center"},TO={class:"space-y-2"},CO={class:"text-slate-600 font-medium leading-relaxed"},SO=yg({__name:"App",setup(e){const t=window.location.origin==="http://localhost:5173"?"http://localhost:7860":"https://my-project-team-infosecai-finalproj.hf.space",n={期末教學評量:"click_eval_system",預選系統:"click_pre_select_system",請假系統:"click_leave_system",宿舍登錄:"click_dorm_system",網路郵局:"click_webmail",軟體雲:"click_vdesk","嘗試偷改成績 (SQL Injection)":"malicious_sql_injection"},i=K=>K.map(b=>({timestamp:b.timestamp,ip:b.ip_address,cookieId:b.cookie_id,account:b.account,result:b.status}));vn.register(...f1);const o=_t("防護中心"),s=_t(null),r=_t("教務系統: 期末網路教學評量"),l=_t(!1),a=_t(null),c=["教務系統: 期末網路教學評量","教務系統: 期末網路預選系統","學務系統: 學生請假系統","學務系統: 學生宿舍登錄(抽籤)系統","資訊服務: 網路郵局 WebMail","資訊服務: 北科軟體雲","惡意測試: 嘗試偷改成績 (SQL Injection)"],u=_t({account:"",password:"",captcha:""}),h=_t(""),p=_t(""),g=_t(""),v=_t([]),x=_t(!1),E=async()=>{x.value=!0;try{const K=await Xe.get("/api/users");K.data&&K.data.status==="success"&&(v.value=K.data.data)}catch(K){console.error("Fetch Users Error:",K)}finally{x.value=!1}},T=async K=>{var b,S;try{const mt=await Xe.post("/api/users/block",{account:K});mt.data&&mt.data.status==="success"?await E():alert(mt.data.message||"封鎖失敗")}catch(mt){console.error("Block User Error:",mt),alert(((S=(b=mt.response)==null?void 0:b.data)==null?void 0:S.message)||"封鎖失敗,連線異常")}},A=async K=>{var b,S;try{const mt=await Xe.post("/api/users/unblock",{account:K});mt.data&&mt.data.status==="success"?await E():alert(mt.data.message||"解鎖失敗")}catch(mt){console.error("Unblock User Error:",mt),alert(((S=(b=mt.response)==null?void 0:b.data)==null?void 0:S.message)||"解鎖失敗,連線異常")}};Zn(o,K=>{K==="使用者管理"&&E()});const I=_t({ip:"140.124.71.55",sessionId:"sess_9a2b4c6d8e0f",timeMode:"real",customTime:"2026-03-17 14:00:00"}),M=[{value:"140.124.71.55",label:"140.124.71.55 (學校內部 - 校內專網)"},{value:"140.124.18.22",label:"140.124.18.22 (學校內部 - 校園網路)"},{value:"61.228.1.100",label:"61.228.1.100 (台灣 - 宿舍/寬頻)"},{value:"210.61.1.100",label:"210.61.1.100 (台灣 - 公共網路)"},{value:"45.33.1.100",label:"45.33.1.100 (美國 - 海外連線)"}],D={push(K){K==="/login"&&(s.value=null,u.value={account:"",password:"",captcha:""},st.value=null,p.value="",g.value="")}},P=()=>{mc.value=!1,localStorage.clear(),D.push("/login")},B=_t([{timestamp:"2026-03-17 13:55:21",ip:"140.124.71.55",cookieId:"sess_9a2b4c6d8e0f",account:"admin",result:"正常"},{timestamp:"2026-03-17 13:56:05",ip:"45.33.1.100",cookieId:"sess_unknown",account:"guest",result:"異常"}]),U=async()=>{h.value="";try{const b=(await Xe.post("/api/login",{account:u.value.account,password:u.value.password,captcha:u.value.captcha,ip:I.value.ip,cookie:I.value.sessionId,time_mode:I.value.timeMode==="real"?"真實時間 (目前時間)":"自訂時間 (模擬過去/未來)",custom_time:I.value.customTime})).data;b.status==="error"?h.value=b.message:(s.value=b.role,p.value=b.name||(b.role==="admin"?"管理員":"學生"),g.value=u.value.account,await W(),b.role==="admin"&&await E())}catch(K){console.error("Login API Error:",K),h.value="無法連線至 AI 後端引擎"}},V=async()=>{try{await Xe.post("/api/logout",{account:u.value.account,ip:I.value.ip,cookie:I.value.sessionId,time_mode:I.value.timeMode==="real"?"真實時間 (目前時間)":"自訂時間 (模擬過去/未來)",custom_time:I.value.customTime}),await W()}catch(K){console.error("Logout API Error:",K)}finally{s.value=null,u.value={account:"",password:"",captcha:""},st.value=null}},W=async()=>{try{const b=(await Xe.get("/api/logs?limit=50")).data;b.status==="success"&&(B.value=i(b.data))}catch(K){console.error("Sync Logs Error:",K)}},et=async(K,b=!1)=>{const S=n[K];if(S){b||(st.value=K);try{const Be=(await Xe.post("/api/student/run_action",{ip:I.value.ip,cookie:I.value.sessionId,account:u.value.account||"student",action_code:S,time_mode:I.value.timeMode==="real"?"真實時間 (目前時間)":"自訂時間 (模擬過去/未來)",custom_time:I.value.customTime})).data;await W(),Be.anomaly_msg&&Be.anomaly_msg.includes("⚠️異常")&&alert(`【AI 防護警報】偵測到異常行為:${Be.anomaly_msg}`)}catch(mt){console.error("行為紀錄失敗",mt)}}},at=_t({academic:!0,affairs:!1,services:!1}),Ct=K=>{at.value[K]=!at.value[K]},gt=_t("dashboard"),st=_t(null),ut=_t([{id:1,name:"網路安全導論",teacher:"陳教授",evaluated:!1,ratings:{q1:5,q2:5,q3:5},comment:""},{id:2,name:"人工智慧專題",teacher:"林教授",evaluated:!1,ratings:{q1:4,q2:4,q3:5},comment:""},{id:3,name:"計算機網路",teacher:"張教授",evaluated:!0,ratings:{q1:5,q2:5,q3:5},comment:"課程內容非常充實,學到很多!"},{id:4,name:"軟體工程",teacher:"黃教授",evaluated:!1,ratings:{q1:3,q2:3,q3:4},comment:""}]),ft=_t(1),rt=In(()=>ut.value.find(K=>K.id===ft.value)),xt=()=>{const K=ut.value.find(b=>b.id===ft.value);K&&(K.evaluated=!0,alert(`【系統提示】您已成功提交「${K.name}」的期末教學評量!`))},Nt=_t(""),Kt=_t("全部"),ie=_t([{id:101,code:"CS3012",name:"作業系統",credits:3,teacher:"陳教授",dept:"資工系",time:"二 2, 3, 4"},{id:102,code:"CS3022",name:"演算法",credits:3,teacher:"林教授",dept:"資工系",time:"三 2, 3, 4"},{id:103,code:"CS4011",name:"密碼學導論",credits:3,teacher:"張教授",dept:"資工系",time:"四 5, 6, 7"},{id:104,code:"CS2021",name:"資料庫系統",credits:3,teacher:"黃教授",dept:"資工系",time:"一 6, 7, 8"},{id:105,code:"EE1001",name:"電路學",credits:3,teacher:"王教授",dept:"電機系",time:"五 2, 3, 4"},{id:106,code:"EE2002",name:"信號與系統",credits:3,teacher:"李教授",dept:"電機系",time:"三 5, 6, 7"},{id:107,code:"EN1011",name:"科技英文",credits:2,teacher:"Smith",dept:"英文系",time:"五 6, 7"}]),Ut=_t([{id:101,code:"CS3012",name:"作業系統",credits:3,teacher:"陳教授",dept:"資工系",time:"二 2, 3, 4"}]),Rt=In(()=>ie.value.filter(K=>{const b=K.name.includes(Nt.value)||K.code.toLowerCase().includes(Nt.value.toLowerCase())||K.teacher.includes(Nt.value),S=Kt.value==="全部"||K.dept===Kt.value,mt=!Ut.value.some(Be=>Be.id===K.id);return b&&S&&mt})),Lt=In(()=>Ut.value.reduce((K,b)=>K+b.credits,0)),ae=K=>{if(Lt.value+K.credits>25){alert("【警告】已達預選上限學分數 (25 學分)!");return}Ut.value.push(K)},pe=K=>{Ut.value=Ut.value.filter(b=>b.id!==K)},vt=_t({type:"病假",startDate:"2026-05-20",endDate:"2026-05-20",reason:"",fileName:""}),Re=_t([{id:1,type:"病假",startDate:"2026-05-10",endDate:"2026-05-10",reason:"感冒發燒,醫生建議在家休息",status:"已核准",dateApplied:"2026-05-09"},{id:2,type:"事假",startDate:"2026-04-12",endDate:"2026-04-12",reason:"家中有事需親自處理",status:"已核准",dateApplied:"2026-04-10"}]),Me=K=>{var S;const b=(S=K.target.files)==null?void 0:S[0];b&&(vt.value.fileName=b.name)},Ue=()=>{if(!vt.value.reason.trim()){alert("請填寫請假事由!");return}const K={id:Date.now(),type:vt.value.type,startDate:vt.value.startDate,endDate:vt.value.endDate,reason:vt.value.reason,status:"審核中",dateApplied:new Date().toLocaleDateString()};Re.value.unshift(K),vt.value={type:"病假",startDate:"2026-05-20",endDate:"2026-05-20",reason:"",fileName:""},alert("【系統提示】您的請假申請已送出,正在等待導師及學務處審核。")},R=_t({dormName:"北科大男一舍",roomType:"4人房 (標準)",roommateId:"",agreed:!0}),k=_t("idle"),O=_t(""),J=()=>{alert("【系統提示】宿舍申請志願偏好已儲存!")},$=()=>{k.value="drawing",setTimeout(()=>{k.value="drawn",Math.random()>.4?O.value=`恭喜中籤!分配床位:${R.value.dormName} ${Math.floor(Math.random()*500)+100}房-${Math.floor(Math.random()*4)+1}床 (${R.value.roomType})`:O.value=`很遺憾,本次未中籤。已自動為您加入候補名單,候補順位:${Math.floor(Math.random()*50)+1}`},1500)},H=_t("收件匣"),it=_t(1),tt=_t(!1),X=_t({to:"",subject:"",content:""}),z=_t([{id:1,sender:"教務處註冊組",senderEmail:"registrar@mail.ntut.edu.tw",subject:"【通知】114 學年度第 2 學期期末教學評量填寫開始",date:"2026-05-18 10:00",read:!0,content:`各位同學您好: 114 學年度第 2 學期期末教學評量自即日起開放填寫,請同學登入「學生資訊系統」後點選「期末教學評量」進行填寫。您的寶貴意見將是教師調整教學與學校改善教學環境的重要參考。 祝 學安 教務處 敬啟`},{id:2,sender:"圖書館讀者服務組",senderEmail:"libservice@mail.ntut.edu.tw",subject:"【催還】您有借閱圖書即將逾期,請儘速歸還或辦理續借",date:"2026-05-16 14:25",read:!1,content:`同學您好: 您借閱的以下圖書:「計算機網路安全與實務 (第四版)」即將於 2026/05/22 到期,請於到期日前歸還至圖書館或登入館藏系統辦理線上續借。逾期將產生每日每本書 5 元之滯納金。 圖書館 敬啟`},{id:3,sender:"資訊中心系統安全組",senderEmail:"sec@mail.ntut.edu.tw",subject:"【安全警報】您的入口網站密碼即將過期,請定期變更",date:"2026-05-15 09:12",read:!0,content:`安全宣導通知: 為維護校園個人資訊安全,提醒您,您的入口網站密碼已超過 90 天未變更。請於 10 天內登入校園入口網站,至「個人設定」變更您的密碼,以保障您的帳號安全,避免遭到惡意嘗試。 資訊中心 敬上`}]),pt=In(()=>z.value.find(K=>K.id===it.value)),ot=K=>{it.value=K.id,K.read=!0},ht=()=>{if(!X.value.to||!X.value.subject){alert("請填寫收件人與主旨!");return}alert(`【系統提示】郵件已成功發送至 ${X.value.to}!`),tt.value=!1,X.value={to:"",subject:"",content:""}},dt=_t("全部"),Pt=_t([{id:1,name:"MATLAB R2025a",category:"工程繪圖",desc:"適用於數值計算、矩陣分析、資料視覺化的標準工程學術軟體。",size:"20 GB",launched:!1},{id:2,name:"AutoCAD 2025",category:"工程繪圖",desc:"專業 2D/3D 電腦輔助設計與繪圖軟體,提供強大的精準度設計環境。",size:"4.5 GB",launched:!1},{id:3,name:"SPSS Statistics 28",category:"統計分析",desc:"提供進階統計分析、海量資料演算法、預測趨勢之大數據分析軟體。",size:"1.2 GB",launched:!1},{id:4,name:"Visual Studio Code",category:"開發工具",desc:"微軟開發的免費跨平台原始碼編輯器,已預裝常用 Python / C++ 編譯套件。",size:"350 MB",launched:!1},{id:5,name:"Photoshop 2025",category:"設計繪圖",desc:"全球頂尖的影像處理與圖形設計軟體,適用於海報製作、影像修圖。",size:"2.8 GB",launched:!1},{id:6,name:"MS Office 365 Pro",category:"辦公軟體",desc:"包含 Word, Excel, PowerPoint 等完整文書商務軟體套組。",size:"3.1 GB",launched:!1}]),Vt=In(()=>dt.value==="全部"?Pt.value:Pt.value.filter(K=>K.category===dt.value)),Et=_t(null),Qt=_t(!1),w=K=>{Qt.value=!0,setTimeout(()=>{Qt.value=!1,Et.value=K},1500)},y=[{name:"防護中心",icon:Vs},{name:"事件分析",icon:Ai},{name:"基準管理",icon:nd},{name:"使用者管理",icon:Hs}],_=In(()=>[{title:"總監測量",value:Dl.value.total_logs,change:"+12.5%",icon:Ai,color:"text-blue-600"},{title:"異常率",value:Dl.value.anomaly_rate,change:"-2.1%",icon:Eo,color:"text-amber-600"},{title:"系統狀態",value:"穩定",change:"99.9% Uptime",icon:Vs,color:"text-emerald-600"}]),C=_t([]),N=async()=>{try{const b=(await Xe.get("/api/abnormal_logs")).data;b.status==="success"&&(C.value=b.data.map((S,mt)=>({id:mt,time:S.timestamp,location:"偵測中...",ip:S.ip_address,score:S.status.includes("異常")?85:12,status:S.status.includes("異常")?"High":"Low",desc:S.action,rawLog:JSON.stringify(S),llmExplain:""})))}catch(K){console.error("Fetch Abnormal Logs Error:",K)}},F=_t(""),G=In(()=>{const K=C.value.filter(S=>S.score>=50);if(!F.value.trim())return K;const b=F.value.trim().toLowerCase();return K.filter(S=>S.desc&&S.desc.toLowerCase().includes(b)||S.ip&&S.ip.toLowerCase().includes(b)||S.status&&S.status.toLowerCase().includes(b)||S.time&&S.time.toLowerCase().includes(b))}),At=()=>{o.value="事件分析"},yt=_t({ow:75,tw:80,iw:65,dw:45,gw:50,fw:60}),Zt=In(()=>yt.value.ow),jt=_t(null);let Gt=null;const kl=()=>{if(!jt.value)return;const K=jt.value.getContext("2d");K&&(Gt&&Gt.destroy(),Gt=new vn(K,{type:"radar",data:{labels:["演算法嚴苛度","時間特徵","IP 聲譽","裝置/動作","地理偏移","行為頻率"],datasets:[{label:"當前防護權重",data:[yt.value.ow,yt.value.tw,yt.value.iw,yt.value.dw,yt.value.gw,yt.value.fw],backgroundColor:"rgba(59, 130, 246, 0.2)",borderColor:"#3b82f6",pointBackgroundColor:"#3b82f6",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"#3b82f6"}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:1500,easing:"easeOutQuart"},scales:{r:{angleLines:{display:!0,color:"#f1f5f9"},grid:{color:"#f1f5f9"},suggestedMin:0,suggestedMax:100,ticks:{display:!1}}},plugins:{legend:{display:!1}}}}))},qe=_t(null),Ss=_t(!1),As=_t(!1);new JP({apiKey:OD.GEMINI_API_KEY||""});const yu=async K=>{if(!K.llmExplain){As.value=!0;try{const S=await(await fetch(`${t}/api/analyze_log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_data:K.rawLog||JSON.stringify(K),event_desc:K.desc||"",event_ip:K.ip||"",event_status:K.status||""})})).json();S.status==="success"?K.llmExplain=S.analysis:K.llmExplain=`⚠️ 分析失敗:${S.message}`}catch(b){console.error("Groq AI analysis error:",b),K.llmExplain="⚠️ AI 分析服務暫時無法連線,請確認後端服務是否正常運作。"}finally{As.value=!1}}},hy=async K=>{qe.value=K,Ss.value=!0,await yu(K)},Is=()=>{Ss.value=!1},Rs=_t(null);let Ms=null,Ps=!1;const ks=async()=>{if(Ps){console.log("[Chart] 初始化進行中,略過本次呼叫");return}if(!Rs.value){console.warn("[Chart] Canvas 尚未掛載");return}Ps=!0,l.value=!0,a.value=null;const K=Rs.value.getContext("2d");if(!K){console.error("[Chart] 無法取得 2D context"),Ps=!1,l.value=!1;return}Ms&&(Ms.destroy(),Ms=null);let b=[],S=[];try{const Be=(await Xe.get("/api/chart_data",{params:{action_name:r.value}})).data;if(Be.status==="success")if(!Be.data||!Be.data.normal.length&&!Be.data.abnormal.length)a.value=`系統「${r.value}」目前尚無足夠的行為數據可供分析。`;else{const Ds=(gi,my)=>gi+(Math.random()-.5)*my;b=Be.data.normal.map(gi=>({x:Ds(parseFloat(gi.month),.4),y:Ds(parseFloat(gi.time_of_day),.5)})),S=Be.data.abnormal.map(gi=>({x:Ds(parseFloat(gi.month),.4),y:Ds(parseFloat(gi.time_of_day),.5)}))}else a.value=Be.message||"獲取數據失敗"}catch(mt){console.error("[Chart] 請求失敗:",mt),a.value=`連線失敗: ${mt.message}`}finally{l.value=!1,Ps=!1}if(!a.value){if(!Rs.value){console.warn("[Chart] Canvas 在 fetch 期間被卸載,略過渲染");return}console.log(`[Chart] 渲染:正常 ${b.length} 筆, 異常 ${S.length} 筆`),Ms=new vn(K,{type:"scatter",data:{datasets:[{label:"正常行為",data:b,backgroundColor:"rgba(16, 185, 129, 0.4)",borderColor:"rgba(16, 185, 129, 0.1)",pointRadius:5,pointHoverRadius:8},{label:"異常行為",data:S,backgroundColor:"rgba(239, 68, 68, 0.8)",borderColor:"#ef4444",pointRadius:7,pointStyle:"rectRot",pointHoverRadius:10}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:800,easing:"easeOutQuart"},plugins:{legend:{display:!0,position:"top",labels:{usePointStyle:!0,padding:20,font:{weight:"bold"}}},tooltip:{backgroundColor:"rgba(15, 23, 42, 0.9)",padding:12,cornerRadius:8,callbacks:{label:mt=>`${mt.dataset.label||""}: 月份 ${mt.parsed.x.toFixed(1)}, 時間 ${mt.parsed.y.toFixed(1)}`}}},scales:{x:{title:{display:!0,text:"月份",font:{weight:"bold"}},grid:{color:"#f1f5f9"},min:.5,max:12.5,ticks:{stepSize:1,callback:mt=>mt+"月"}},y:{title:{display:!0,text:"時間 (0-24h)",font:{weight:"bold"}},grid:{color:"#f1f5f9"},min:0,max:24,reverse:!0,ticks:{stepSize:4,callback:mt=>mt+":00"}}}}})}};Dc(async()=>{await W()}),Zn(s,async K=>{K==="admin"&&(await Mr(),await Promise.all([py(),N()]),o.value==="防護中心"?await ks():o.value==="基準管理"&&kl())});const Dl=_t({total_logs:"0",abnormal_logs:"0",anomaly_rate:"0%"}),py=async()=>{try{const b=(await Xe.get("/api/stats")).data;b.status==="success"&&(Dl.value={total_logs:b.data.total_logs.toLocaleString(),abnormal_logs:b.data.abnormal_logs.toLocaleString(),anomaly_rate:b.data.anomaly_rate_percent+"%"},b.data.current_weights&&(yt.value={...b.data.current_weights}))}catch(K){console.error("Update Admin Stats Error:",K)}},gy=async()=>{try{(await Xe.post("/api/update_weights",yt.value)).data.status==="success"&&alert("權重配置已成功同步至 AI 引擎")}catch(K){console.error("Save Weights Error:",K),alert("儲存失敗,請檢查後端連線")}};return Zn(r,()=>{s.value==="admin"&&o.value==="防護中心"&&ks()}),Zn(o,async K=>{s.value==="admin"&&(await Mr(),K==="防護中心"?await ks():K==="基準管理"&&kl())}),Zn([yt,Zt],()=>{s.value==="admin"&&o.value==="基準管理"&&kl()},{deep:!0}),(K,b)=>(Y(),j(kt,null,[s.value?s.value==="admin"?(Y(),j("div",wN,[m("aside",TN,[m("div",CN,[m("div",SN,[Z(Q(Vs),{class:"w-6 h-6 text-white"})]),b[73]||(b[73]=m("h1",{class:"font-bold text-xl tracking-tight text-slate-800"},"數位保鑣",-1))]),m("nav",AN,[(Y(),j(kt,null,ue(y,S=>m("button",{key:S.name,onClick:mt=>o.value=S.name,class:$t(["w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 text-left",o.value===S.name?"bg-blue-50 text-blue-700 font-semibold shadow-sm":"text-slate-500 hover:bg-slate-50 hover:text-slate-800"])},[(Y(),Xn(_o(S.icon),{class:"w-5 h-5"})),m("span",null,q(S.name),1)],10,IN)),64))]),m("div",RN,[m("div",MN,[m("div",PN,[Z(Q(Jl),{class:"w-5 h-5 text-slate-500"})]),m("div",kN,[m("p",DN,q(p.value),1),b[74]||(b[74]=m("p",{class:"text-xs text-slate-500 truncate"},"系統核心權限",-1))]),Z(Q(od),{onClick:V,class:"w-5 h-5 text-slate-400 cursor-pointer hover:text-red-600 transition-colors",title:"登出"})])])]),m("main",NN,[m("header",LN,[m("div",FN,[m("h2",UN,q(o.value)+"概覽",1),b[75]||(b[75]=m("span",{class:"px-2 py-1 bg-emerald-100 text-emerald-700 text-xs font-bold rounded-md flex items-center gap-1"},[m("div",{class:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),Yt(" 即時監控中 ")],-1))]),m("div",BN,[m("div",ON,[Z(Q(rd),{class:"w-5 h-5 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),Mt(m("input",{type:"text","onUpdate:modelValue":b[8]||(b[8]=S=>F.value=S),onKeydown:Xu(At,["enter"]),placeholder:"搜尋事件... (Enter 確認)",class:"pl-10 pr-4 py-2 bg-slate-100 border-none rounded-full text-sm w-72 focus:ring-2 focus:ring-blue-500 outline-none transition-all"},null,544),[[re,F.value]])])])]),m("div",VN,[Q(Go)?(Y(),j("div",GN,[m("div",HN,[Z(Q(Eo),{class:"w-5 h-5 text-amber-600 shrink-0 animate-bounce"}),m("div",null,[b[76]||(b[76]=m("h4",{class:"font-bold text-amber-800 text-sm"},"安全驗證提示",-1)),m("p",$N,q(Q(yc)),1)])]),m("button",{onClick:b[9]||(b[9]=S=>Go.value=!1),class:"text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-lg hover:bg-amber-100/50"},[Z(Q($s),{class:"w-4 h-4"})])])):Ht("",!0),Mt(m("div",qN,[m("div",zN,[(Y(!0),j(kt,null,ue(_.value,S=>(Y(),j("div",{key:S.title,class:"bg-white p-6 rounded-2xl border border-slate-200 shadow-sm"},[m("div",WN,[m("div",{class:$t(`p-3 rounded-xl bg-slate-50 ${S.color}`)},[(Y(),Xn(_o(S.icon),{class:"w-6 h-6"}))],2),m("span",JN,q(S.change),1)]),m("p",KN,q(S.title),1),m("h3",YN,q(S.value),1)]))),128))]),m("div",XN,[m("div",QN,[b[78]||(b[78]=m("div",null,[m("h3",{class:"text-lg font-bold text-slate-800"},"使用者行為密度分析 (HDBSCAN)"),m("p",{class:"text-sm text-slate-500"},"透過分佈雲圖觀察操作習慣與偏離值")],-1)),m("div",ZN,[b[77]||(b[77]=m("label",{class:"text-xs font-bold text-slate-400 uppercase"},"篩選系統:",-1)),Mt(m("select",{"onUpdate:modelValue":b[10]||(b[10]=S=>r.value=S),class:"bg-slate-50 border border-slate-200 rounded-xl px-4 py-2 text-sm font-medium outline-none focus:ring-2 focus:ring-blue-500 transition-all min-w-[200px]"},[(Y(),j(kt,null,ue(c,S=>m("option",{key:S,value:S},q(S),9,jN)),64))],512),[[_i,r.value]])])]),m("div",tL,[l.value?(Y(),j("div",eL,[m("div",nL,[Z(Q(Gi),{class:"w-8 h-8 text-blue-600 animate-spin"}),b[79]||(b[79]=m("span",{class:"text-sm font-bold text-blue-600"},"正在分析數據密度...",-1))])])):Ht("",!0),a.value?(Y(),j("div",iL,[m("div",oL,[m("div",sL,[Z(Q(id),{class:"w-6 h-6 text-amber-600"})]),b[80]||(b[80]=m("h4",{class:"font-bold text-slate-800 mb-2"},"暫無分析數據",-1)),m("p",rL,q(a.value),1),m("button",{onClick:ks,class:"mt-6 text-xs font-bold text-blue-600 hover:text-blue-700 underline"},"重新載入圖表")])])):Ht("",!0),Mt(m("canvas",{ref_key:"chartCanvas",ref:Rs},null,512),[[xo,!a.value]])]),b[81]||(b[81]=Us('
基準行為分佈
異常偏離點
Tip: 重疊顏色越深代表該時段行為密度越高
',1))])],512),[[xo,o.value==="防護中心"]]),o.value==="事件分析"?(Y(),j("div",lL,[m("div",aL,[m("div",null,[b[83]||(b[83]=m("h3",{class:"text-lg font-bold text-slate-800"},"異常事件清單",-1)),m("p",cL,[F.value.trim()?(Y(),j(kt,{key:0},[b[82]||(b[82]=Yt("搜尋關鍵字:",-1)),m("span",uL,q(F.value),1),Yt(" — 共 "+q(G.value.length)+" 筆結果",1)],64)):(Y(),j(kt,{key:1},[Yt("僅顯示風險分數 > 50 的異常活動")],64))])]),m("div",dL,[m("span",fL,"高風險: "+q(G.value.filter(S=>S.score>80).length),1),m("span",hL,"中風險: "+q(G.value.filter(S=>S.score<=80).length),1)])]),m("div",pL,[(Y(!0),j(kt,null,ue(G.value,S=>(Y(),j("div",{key:S.id,onClick:mt=>hy(S),class:"flex items-center justify-between p-6 hover:bg-slate-50 transition-colors cursor-pointer group"},[m("div",mL,[m("div",{class:$t(["w-12 h-12 rounded-xl flex items-center justify-center",S.score>80?"bg-red-50 text-red-600":"bg-amber-50 text-amber-600"])},[Z(Q(Eo),{class:"w-6 h-6"})],2),m("div",null,[m("div",yL,[m("span",_L,q(S.ip),1),m("span",{class:$t(["px-2 py-0.5 rounded text-[10px] font-bold uppercase",S.score>80?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700"])},q(S.status),3)]),m("p",vL,q(S.desc),1)])]),m("div",xL,[m("div",bL,[m("p",EL,q(S.time),1)]),Z(Q(td),{class:"w-5 h-5 text-slate-300 group-hover:text-slate-500 transition-colors"})])],8,gL))),128))])])):o.value==="基準管理"?(Y(),j("div",wL,[m("div",TL,[b[84]||(b[84]=m("h3",{class:"text-lg font-bold text-slate-800 mb-8"},"特徵權重分析",-1)),m("div",CL,[m("canvas",{ref_key:"radarCanvas",ref:jt},null,512)])]),m("div",SL,[m("div",AL,[b[93]||(b[93]=m("h3",{class:"text-lg font-bold text-slate-800 mb-6"},"防護強度微調",-1)),m("div",IL,[m("div",RL,[m("div",ML,[b[85]||(b[85]=m("label",{class:"text-sm font-bold text-slate-700"},"演算法嚴苛度 (ow)",-1)),m("span",PL,q(yt.value.ow)+"%",1)]),Mt(m("input",{type:"range","onUpdate:modelValue":b[11]||(b[11]=S=>yt.value.ow=S),min:"0",max:"100",class:"w-full h-2 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-blue-600"},null,512),[[re,yt.value.ow,void 0,{number:!0}]]),b[86]||(b[86]=m("p",{class:"text-xs text-slate-400"},"提高強度會增加誤報率,但能更有效攔截新型攻擊。",-1))]),m("div",kL,[m("div",DL,[m("div",NL,[m("div",LL,[b[87]||(b[87]=m("label",{class:"text-xs font-bold text-slate-500"},"時間特徵 (tw)",-1)),m("span",FL,q(yt.value.tw)+"%",1)]),Mt(m("input",{type:"range","onUpdate:modelValue":b[12]||(b[12]=S=>yt.value.tw=S),min:"0",max:"100",class:"w-full h-1.5 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-slate-400"},null,512),[[re,yt.value.tw,void 0,{number:!0}]])]),m("div",UL,[m("div",BL,[b[88]||(b[88]=m("label",{class:"text-xs font-bold text-slate-500"},"IP 聲譽 (iw)",-1)),m("span",OL,q(yt.value.iw)+"%",1)]),Mt(m("input",{type:"range","onUpdate:modelValue":b[13]||(b[13]=S=>yt.value.iw=S),min:"0",max:"100",class:"w-full h-1.5 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-slate-400"},null,512),[[re,yt.value.iw,void 0,{number:!0}]])]),m("div",VL,[m("div",GL,[b[89]||(b[89]=m("label",{class:"text-xs font-bold text-slate-500"},"裝置/動作 (dw)",-1)),m("span",HL,q(yt.value.dw)+"%",1)]),Mt(m("input",{type:"range","onUpdate:modelValue":b[14]||(b[14]=S=>yt.value.dw=S),min:"0",max:"100",class:"w-full h-1.5 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-slate-400"},null,512),[[re,yt.value.dw,void 0,{number:!0}]])]),m("div",$L,[m("div",qL,[b[90]||(b[90]=m("label",{class:"text-xs font-bold text-slate-500"},"地理偏移 (gw)",-1)),m("span",zL,q(yt.value.gw)+"%",1)]),Mt(m("input",{type:"range","onUpdate:modelValue":b[15]||(b[15]=S=>yt.value.gw=S),min:"0",max:"100",class:"w-full h-1.5 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-slate-400"},null,512),[[re,yt.value.gw,void 0,{number:!0}]])]),m("div",WL,[m("div",JL,[b[91]||(b[91]=m("label",{class:"text-xs font-bold text-slate-500"},"行為頻率 (fw)",-1)),m("span",KL,q(yt.value.fw)+"%",1)]),Mt(m("input",{type:"range","onUpdate:modelValue":b[16]||(b[16]=S=>yt.value.fw=S),min:"0",max:"100",class:"w-full h-1.5 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-slate-400"},null,512),[[re,yt.value.fw,void 0,{number:!0}]])])])]),m("button",{onClick:gy,class:"w-full py-3 bg-slate-800 hover:bg-slate-900 text-white rounded-xl font-bold transition-all shadow-lg flex items-center justify-center gap-2"},[Z(Q(nx),{class:"w-4 h-4"}),b[92]||(b[92]=Yt(" 儲存配置並同步引擎 ",-1))])])])])])):o.value==="使用者管理"?(Y(),j("div",YL,[m("div",XL,[m("div",null,[m("h3",QL,[Z(Q(Hs),{class:"w-6 h-6 text-blue-600"}),b[94]||(b[94]=Yt(" 使用者帳戶安全管理 ",-1))]),b[95]||(b[95]=m("p",{class:"text-sm text-slate-500 mt-1"},"檢視系統所有使用者帳號狀態、身份組,並可進行帳戶封鎖與解封操作",-1))]),m("button",{onClick:E,class:"px-5 py-2.5 bg-blue-600 hover:bg-blue-700 text-white font-bold text-sm rounded-xl transition-all shadow-md shadow-blue-100 active:scale-95 flex items-center gap-2",disabled:x.value},[x.value?(Y(),Xn(Q(Gi),{key:0,class:"w-4 h-4 animate-spin"})):Ht("",!0),b[96]||(b[96]=m("span",null,"重新整理",-1))],8,ZL)]),m("div",jL,[m("table",tF,[b[99]||(b[99]=m("thead",null,[m("tr",{class:"bg-slate-50/70 border-b border-slate-100"},[m("th",{class:"p-6 text-xs font-bold text-slate-400 uppercase tracking-wider"},"使用者帳號"),m("th",{class:"p-6 text-xs font-bold text-slate-400 uppercase tracking-wider"},"姓名"),m("th",{class:"p-6 text-xs font-bold text-slate-400 uppercase tracking-wider"},"身分組"),m("th",{class:"p-6 text-xs font-bold text-slate-400 uppercase tracking-wider"},"安全狀態"),m("th",{class:"p-6 text-xs font-bold text-slate-400 uppercase tracking-wider text-right"},"管理操作")])],-1)),m("tbody",eF,[(Y(!0),j(kt,null,ue(v.value,S=>(Y(),j("tr",{key:S.account,class:"hover:bg-slate-50/50 transition-colors"},[m("td",nF,q(S.account),1),m("td",iF,[m("div",oF,[m("div",sF,q(S.name[0]),1),m("span",rF,q(S.name),1)])]),m("td",lF,[m("span",{class:$t(["px-3 py-1.5 rounded-xl text-xs font-bold border",S.role==="admin"?"bg-blue-50 text-blue-700 border-blue-100":"bg-emerald-50 text-emerald-700 border-emerald-100"])},q(S.role_zh),3)]),m("td",aF,[m("span",{class:$t(["px-3 py-1.5 rounded-xl text-xs font-bold inline-flex items-center gap-1.5",S.status==="blocked"?"bg-red-50 text-red-700":S.status==="verifying"?"bg-amber-50 text-amber-700 animate-pulse":"bg-emerald-50 text-emerald-700"])},[m("div",{class:$t(["w-1.5 h-1.5 rounded-full",S.status==="blocked"?"bg-red-500":S.status==="verifying"?"bg-amber-500":"bg-emerald-500"])},null,2),Yt(" "+q(S.status==="blocked"?"已封鎖 (Blocked)":S.status==="verifying"?"安全驗證中":"正常啟用"),1)],2)]),m("td",cF,[m("div",uF,[S.account!==g.value?(Y(),j(kt,{key:0},[S.status==="blocked"?(Y(),j("button",{key:0,onClick:mt=>A(S.account),class:"px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white font-bold text-xs rounded-xl shadow-sm hover:shadow transition-all active:scale-95 flex items-center gap-1"},[Z(Q(ju),{class:"w-3.5 h-3.5"}),b[97]||(b[97]=m("span",null,"解除封鎖",-1))],8,dF)):(Y(),j("button",{key:1,onClick:mt=>T(S.account),class:"px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 font-bold text-xs rounded-xl transition-all active:scale-95 flex items-center gap-1 border border-red-100"},[Z(Q(cd),{class:"w-3.5 h-3.5"}),b[98]||(b[98]=m("span",null,"封鎖帳號",-1))],8,fF))],64)):(Y(),j("span",hF,"目前登入帳號"))])])]))),128))])])])])):Ht("",!0)]),Ss.value?(Y(),j("div",{key:0,class:"absolute inset-0 bg-slate-900/20 backdrop-blur-sm z-20 transition-opacity duration-300",onClick:Is})):Ht("",!0),m("div",{class:$t(["absolute top-0 right-0 h-full w-[500px] bg-white shadow-2xl z-30 transform transition-transform duration-300 ease-out flex flex-col",Ss.value?"translate-x-0":"translate-x-full"])},[m("div",pF,[m("div",gF,[m("div",mF,[Z(Q(Ai),{class:"w-5 h-5 text-slate-600"})]),b[100]||(b[100]=m("h3",{class:"font-bold text-lg"},"事件分析詳情",-1))]),m("button",{onClick:Is,class:"p-2 hover:bg-slate-100 rounded-full transition-colors"},[Z(Q($s),{class:"w-5 h-5 text-slate-400"})])]),qe.value?(Y(),j("div",yF,[m("div",_F,[m("div",vF,[b[101]||(b[101]=m("span",{class:"text-xs font-bold text-slate-400 uppercase tracking-wider"},"風險評級",-1)),m("span",{class:$t(["px-3 py-1 rounded-full text-xs font-bold",qe.value.score>80?"bg-red-100 text-red-700":qe.value.score>=50?"bg-amber-100 text-amber-700":"bg-green-100 text-green-700"])},q(qe.value.score>80?"高":qe.value.score>=50?"中":"低"),3)]),m("h4",xF,q(qe.value.desc),1),m("div",bF,[m("div",EF,[b[102]||(b[102]=m("p",{class:"text-xs text-slate-500 mb-1"},"來源 IP",-1)),m("p",wF,q(qe.value.ip),1)])])]),m("div",TF,[m("div",CF,[m("div",SF,[Z(Q(Zu),{class:"w-5 h-5"}),b[103]||(b[103]=m("span",{class:"font-bold"},"AI 智慧解析",-1))]),m("div",AF,[b[104]||(b[104]=m("span",{class:"px-2 py-0.5 bg-orange-100 text-orange-700 text-[10px] font-bold rounded-full border border-orange-200"},"⚡ Groq AI",-1)),!As.value&&qe.value?(Y(),j("button",{key:0,onClick:b[17]||(b[17]=()=>{qe.value.llmExplain=null,yu(qe.value)}),class:"p-1.5 hover:bg-blue-100 rounded-lg transition-colors text-blue-500 hover:text-blue-700",title:"重新分析"},[Z(Q(Gi),{class:"w-3.5 h-3.5"})])):Ht("",!0)])]),As.value?(Y(),j("div",IF,[Z(Q(Gi),{class:"w-5 h-5 animate-spin"}),b[105]||(b[105]=m("span",{class:"text-sm font-medium animate-pulse"},"正在透過 Groq AI 分析 Log 數據...",-1))])):(Y(),j("p",RF,q(qe.value.llmExplain||"點擊以生成 AI 解析。"),1)),m("div",MF,[Z(Q(Zu),{class:"w-24 h-24 text-blue-900"})])]),m("div",PF,[m("div",kF,[Z(Q(Gs),{class:"w-5 h-5"}),b[106]||(b[106]=m("span",{class:"font-bold text-sm"},"原始 Log 數據",-1))]),m("div",DF,[m("pre",NF,q(JSON.stringify(JSON.parse(qe.value.rawLog),null,2)),1)])])])):Ht("",!0),m("div",LF,[m("button",{onClick:Is,class:"flex-1 flex items-center justify-center gap-2 bg-red-600 hover:bg-red-700 text-white font-bold py-3 rounded-xl transition-colors shadow-lg shadow-red-200"},[Z(Q(cd),{class:"w-5 h-5"}),b[107]||(b[107]=Yt(" 立即阻斷 ",-1))]),m("button",{onClick:Is,class:"flex-1 flex items-center justify-center gap-2 bg-white border border-slate-200 hover:bg-slate-50 text-slate-700 font-bold py-3 rounded-xl transition-colors"},[Z(Q(ed),{class:"w-5 h-5 text-emerald-500"}),b[108]||(b[108]=Yt(" 標記為信任 ",-1))])])],2)])])):s.value==="student"?(Y(),j("div",FF,[m("div",UF,[m("div",BF,[m("div",OF,[Z(Q(Gs),{class:"w-6 h-6 text-white"})]),b[109]||(b[109]=m("h2",{class:"text-xl font-bold tracking-tight"},"環境變數模擬器",-1))]),m("div",VF,[m("div",GF,[b[110]||(b[110]=m("label",{class:"block text-sm font-bold text-slate-700"},"模擬來源 IP",-1)),Mt(m("select",{"onUpdate:modelValue":b[18]||(b[18]=S=>I.value.ip=S),class:"w-full bg-white border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all"},[(Y(),j(kt,null,ue(M,S=>m("option",{key:S.value,value:S.value},q(S.label),9,HF)),64))],512),[[_i,I.value.ip]])]),m("div",$F,[b[111]||(b[111]=m("label",{class:"block text-sm font-bold text-slate-700"},"Cookie Session ID",-1)),Mt(m("input",{type:"text","onUpdate:modelValue":b[19]||(b[19]=S=>I.value.sessionId=S),class:"w-full bg-white border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all font-mono text-sm",placeholder:"sess_..."},null,512),[[re,I.value.sessionId]])]),m("div",qF,[b[114]||(b[114]=m("label",{class:"block text-sm font-bold text-slate-700"},"時間設定",-1)),m("div",zF,[m("label",WF,[Mt(m("input",{type:"radio","onUpdate:modelValue":b[20]||(b[20]=S=>I.value.timeMode=S),value:"real",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[Bs,I.value.timeMode]]),b[112]||(b[112]=m("span",{class:"text-sm font-medium group-hover:text-blue-600 transition-colors"},"真實時間",-1))]),m("label",JF,[Mt(m("input",{type:"radio","onUpdate:modelValue":b[21]||(b[21]=S=>I.value.timeMode=S),value:"custom",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[Bs,I.value.timeMode]]),b[113]||(b[113]=m("span",{class:"text-sm font-medium group-hover:text-blue-600 transition-colors"},"自訂時間",-1))])]),I.value.timeMode==="custom"?Mt((Y(),j("input",{key:0,type:"text","onUpdate:modelValue":b[22]||(b[22]=S=>I.value.customTime=S),class:"w-full bg-white border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all font-mono text-sm"},null,512)),[[re,I.value.customTime]]):Ht("",!0)])]),m("div",KF,[b[116]||(b[116]=m("div",{class:"flex items-center justify-between mb-4"},[m("h3",{class:"text-sm font-bold text-slate-500 uppercase tracking-wider"},"即時 Log 監控區"),m("span",{class:"text-[10px] bg-emerald-100 text-emerald-700 px-2 py-0.5 rounded font-bold animate-pulse"},"LIVE")],-1)),m("div",YF,[m("div",XF,[m("table",QF,[b[115]||(b[115]=m("thead",null,[m("tr",{class:"border-b border-slate-800 bg-slate-800/50"},[m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"Timestamp"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"IP"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"Cookie ID"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"Account"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"AI Result")])],-1)),m("tbody",ZF,[(Y(!0),j(kt,null,ue(B.value,(S,mt)=>(Y(),j("tr",{key:mt,class:"hover:bg-slate-800/30 transition-colors"},[m("td",jF,q(S.timestamp),1),m("td",t5,q(S.ip),1),m("td",e5,q(S.cookieId),1),m("td",n5,q(S.account),1),m("td",i5,[m("span",{class:$t([S.result==="正常"?"text-emerald-500":"text-red-500","font-bold"])},q(S.result),3)])]))),128))])])])])])]),m("div",o5,[m("header",s5,[m("div",r5,[m("div",l5,[m("div",a5,[Z(Q(Xv),{class:"w-6 h-6 text-white"})]),b[117]||(b[117]=m("div",null,[m("h2",{class:"text-lg font-bold text-slate-800"},"學生資訊系統"),m("p",{class:"text-[10px] text-slate-400 font-bold tracking-widest uppercase"},"Student Information System")],-1))]),b[118]||(b[118]=m("div",{class:"h-8 w-px bg-slate-200 mx-2"},null,-1)),m("div",c5,[Z(Q(Jl),{class:"w-5 h-5"}),m("span",u5,q(p.value)+" 歡迎您",1)])]),m("div",d5,[m("div",f5,[Z(Q(Hs),{class:"w-4 h-4"}),b[119]||(b[119]=m("span",{class:"text-xs font-bold"},"線上人數: 1,284",-1))]),m("div",h5,[m("button",{onClick:b[23]||(b[23]=S=>{gt.value="dashboard",st.value=null}),class:$t([gt.value==="dashboard"?"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-700","px-4 py-2 rounded-lg font-bold text-xs transition-all flex items-center gap-2"])},[Z(Q(Zv),{class:"w-3.5 h-3.5"}),b[120]||(b[120]=Yt(" 服務選單 ",-1))],2),m("button",{onClick:b[24]||(b[24]=S=>{gt.value="logs",st.value=null}),class:$t([gt.value==="logs"?"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-700","px-4 py-2 rounded-lg font-bold text-xs transition-all flex items-center gap-2"])},[Z(Q(ka),{class:"w-3.5 h-3.5"}),b[121]||(b[121]=Yt(" 安全日誌 ",-1))],2)]),m("button",{onClick:V,class:"flex items-center gap-2 px-4 py-2 bg-slate-100 hover:bg-red-50 hover:text-red-600 text-slate-600 rounded-xl font-bold text-sm transition-all"},[Z(Q(od),{class:"w-4 h-4"}),b[122]||(b[122]=Yt(" 登出 Logout ",-1))])])]),m("div",p5,[Q(Go)?(Y(),j("div",g5,[m("div",m5,[Z(Q(Eo),{class:"w-5 h-5 text-amber-600 shrink-0 animate-bounce"}),m("div",null,[b[123]||(b[123]=m("h4",{class:"font-bold text-amber-800 text-sm"},"安全驗證提示",-1)),m("p",y5,q(Q(yc)),1)])]),m("button",{onClick:b[25]||(b[25]=S=>Go.value=!1),class:"text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-lg hover:bg-amber-100/50"},[Z(Q($s),{class:"w-4 h-4"})])])):Ht("",!0),gt.value==="dashboard"?(Y(),j(kt,{key:1},[st.value?(Y(),j("div",_5,[m("div",v5,[m("div",x5,[m("button",{onClick:b[26]||(b[26]=S=>st.value=null),class:"flex items-center justify-center p-2 rounded-xl bg-white border border-slate-200 hover:bg-slate-50 text-slate-600 transition-colors shadow-sm active:scale-95"},[Z(Q(Wv),{class:"w-5 h-5"})]),m("div",null,[m("h3",b5,q(st.value),1),b[124]||(b[124]=m("p",{class:"text-xs text-slate-400 font-medium"},"國立台北科技大學智慧校園服務",-1))])]),b[125]||(b[125]=m("span",{class:"px-3 py-1 bg-blue-50 text-blue-600 border border-blue-100 text-xs font-bold rounded-full"}," 模擬展示頁面 (無實際功能) ",-1))]),st.value==="期末教學評量"?(Y(),j("div",E5,[m("div",w5,[b[126]||(b[126]=m("h4",{class:"font-bold text-slate-700 text-sm uppercase tracking-wider"},"課程清單",-1)),m("div",T5,[(Y(!0),j(kt,null,ue(ut.value,S=>(Y(),j("button",{key:S.id,onClick:mt=>ft.value=S.id,class:$t(["w-full text-left p-4 rounded-xl border transition-all flex items-center justify-between group",ft.value===S.id?"border-blue-500 bg-blue-50/50 text-blue-700 font-bold":"border-slate-200 hover:bg-slate-50 text-slate-600"])},[m("div",null,[m("p",S5,q(S.name),1),m("p",A5,q(S.teacher),1)]),S.evaluated?(Y(),j("span",I5," 已評量 ")):(Y(),j("span",R5," 未填寫 "))],10,C5))),128))])]),m("div",M5,[rt.value?(Y(),j("div",P5,[m("div",null,[m("h4",k5,q(rt.value.name),1),m("p",D5,"授課教師:"+q(rt.value.teacher),1)]),b[131]||(b[131]=m("div",{class:"h-px bg-slate-100"},null,-1)),m("div",N5,[m("div",L5,[b[127]||(b[127]=m("p",{class:"text-sm font-bold text-slate-700"},"1. 教師授課準備充分,教學內容充實且具啟發性?",-1)),m("div",F5,[(Y(),j(kt,null,ue(5,S=>m("button",{key:S,disabled:rt.value.evaluated,onClick:mt=>rt.value.ratings.q1=S,class:"focus:outline-none transition-transform active:scale-95"},[Z(Q(Wl),{class:$t(["w-6 h-6",S<=rt.value.ratings.q1?"text-amber-400 fill-amber-400":"text-slate-200"])},null,8,["class"])],8,U5)),64)),m("span",B5,"("+q(rt.value.ratings.q1)+" 分)",1)])]),m("div",O5,[b[128]||(b[128]=m("p",{class:"text-sm font-bold text-slate-700"},"2. 教師教學方法清晰,能引導學生思考與討論?",-1)),m("div",V5,[(Y(),j(kt,null,ue(5,S=>m("button",{key:S,disabled:rt.value.evaluated,onClick:mt=>rt.value.ratings.q2=S,class:"focus:outline-none transition-transform active:scale-95"},[Z(Q(Wl),{class:$t(["w-6 h-6",S<=rt.value.ratings.q2?"text-amber-400 fill-amber-400":"text-slate-200"])},null,8,["class"])],8,G5)),64)),m("span",H5,"("+q(rt.value.ratings.q2)+" 分)",1)])]),m("div",$5,[b[129]||(b[129]=m("p",{class:"text-sm font-bold text-slate-700"},"3. 評量方式公平合理,作業與教材對學習有幫助?",-1)),m("div",q5,[(Y(),j(kt,null,ue(5,S=>m("button",{key:S,disabled:rt.value.evaluated,onClick:mt=>rt.value.ratings.q3=S,class:"focus:outline-none transition-transform active:scale-95"},[Z(Q(Wl),{class:$t(["w-6 h-6",S<=rt.value.ratings.q3?"text-amber-400 fill-amber-400":"text-slate-200"])},null,8,["class"])],8,z5)),64)),m("span",W5,"("+q(rt.value.ratings.q3)+" 分)",1)])]),m("div",J5,[b[130]||(b[130]=m("p",{class:"text-sm font-bold text-slate-700"},"4. 意見回饋與建議 (200字以內)",-1)),Mt(m("textarea",{"onUpdate:modelValue":b[27]||(b[27]=S=>rt.value.comment=S),disabled:rt.value.evaluated,rows:"4",placeholder:"請輸入您對此課程之建議...",class:"w-full bg-slate-50 border border-slate-200 rounded-xl p-4 text-sm outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all resize-none"},null,8,K5),[[re,rt.value.comment]])])]),b[132]||(b[132]=m("div",{class:"h-px bg-slate-100"},null,-1)),m("div",Y5,[m("button",{onClick:b[28]||(b[28]=S=>st.value=null),class:"px-5 py-3 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold rounded-xl text-sm transition-all"}," 取消返回 "),m("button",{onClick:xt,disabled:rt.value.evaluated,class:"px-6 py-3 bg-blue-600 hover:bg-blue-700 disabled:bg-slate-200 disabled:text-slate-400 disabled:cursor-not-allowed text-white font-bold rounded-xl text-sm transition-all shadow-lg shadow-blue-100 flex items-center gap-2"},[Z(Q(ed),{class:"w-4 h-4"}),Yt(" "+q(rt.value.evaluated?"已送出填寫":"送出評量問卷"),1)],8,X5)])])):Ht("",!0)])])):Ht("",!0),st.value==="預選系統"?(Y(),j("div",Q5,[m("div",Z5,[m("div",j5,[Z(Q(rd),{class:"w-5 h-5 text-slate-400"}),Mt(m("input",{type:"text","onUpdate:modelValue":b[29]||(b[29]=S=>Nt.value=S),placeholder:"搜尋課程名稱、代碼或授課教師...",class:"w-full max-w-md bg-slate-50 border border-slate-200 rounded-xl px-4 py-2.5 text-sm outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all"},null,512),[[re,Nt.value]]),Mt(m("select",{"onUpdate:modelValue":b[30]||(b[30]=S=>Kt.value=S),class:"bg-slate-50 border border-slate-200 rounded-xl px-4 py-2.5 text-sm outline-none focus:ring-2 focus:ring-blue-500 transition-all font-medium animate-none"},[...b[133]||(b[133]=[m("option",null,"全部",-1),m("option",null,"資工系",-1),m("option",null,"電機系",-1),m("option",null,"英文系",-1)])],512),[[_i,Kt.value]])]),m("div",tU,[b[134]||(b[134]=m("span",{class:"font-bold text-slate-600"},"已預選:",-1)),m("span",eU,q(Lt.value),1),b[135]||(b[135]=m("span",{class:"text-slate-400"},"/ 25 學分",-1))])]),m("div",nU,[m("div",iU,[b[136]||(b[136]=m("h4",{class:"font-bold text-slate-700 text-sm uppercase tracking-wider flex items-center justify-between"},[m("span",null,"可選課程清單"),m("span",{class:"text-xs text-slate-400 normal-case font-medium"},"點擊加選至預選單")],-1)),m("div",oU,[(Y(!0),j(kt,null,ue(Rt.value,S=>(Y(),j("div",{key:S.id,class:"p-4 bg-slate-50/50 rounded-xl border border-slate-100 flex items-center justify-between hover:bg-slate-50 transition-all group animate-in fade-in duration-200"},[m("div",sU,[m("div",rU,[m("span",lU,q(S.code),1),m("span",aU,q(S.name),1)]),m("p",cU,"教師:"+q(S.teacher)+" | 學分:"+q(S.credits)+" | 時間:"+q(S.time),1)]),m("button",{onClick:mt=>ae(S),class:"p-2 bg-blue-50 hover:bg-blue-600 text-blue-600 hover:text-white rounded-lg transition-all active:scale-95"},[Z(Q(sd),{class:"w-4 h-4"})],8,uU)]))),128)),Rt.value.length===0?(Y(),j("div",dU," 沒有符合篩選條件的課程 ")):Ht("",!0)])]),m("div",fU,[b[137]||(b[137]=m("h4",{class:"font-bold text-slate-700 text-sm uppercase tracking-wider"},"我的預選清單",-1)),m("div",hU,[(Y(!0),j(kt,null,ue(Ut.value,S=>(Y(),j("div",{key:S.id,class:"p-4 bg-blue-50/10 rounded-xl border border-blue-100/50 flex items-center justify-between animate-in fade-in duration-200"},[m("div",pU,[m("div",gU,[m("span",mU,q(S.code),1),m("span",yU,q(S.name),1)]),m("p",_U,"教師:"+q(S.teacher)+" | 學分:"+q(S.credits)+" | 時間:"+q(S.time),1)]),m("button",{onClick:mt=>pe(S.id),class:"p-2 bg-red-50 hover:bg-red-500 text-red-500 hover:text-white rounded-lg transition-all active:scale-95"},[Z(Q(ix),{class:"w-4 h-4"})],8,vU)]))),128)),Ut.value.length===0?(Y(),j("div",xU," 目前預選單空空如也,快從左側加選課程! ")):Ht("",!0)])])])])):Ht("",!0),st.value==="請假系統"?(Y(),j("div",bU,[m("div",EU,[b[145]||(b[145]=m("h4",{class:"font-bold text-slate-800 text-base border-b border-slate-100 pb-3"},"請假申請單",-1)),m("div",wU,[m("div",TU,[m("div",CU,[b[139]||(b[139]=m("label",{class:"text-xs font-bold text-slate-500"},"假別選擇",-1)),Mt(m("select",{"onUpdate:modelValue":b[31]||(b[31]=S=>vt.value.type=S),class:"w-full bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all text-sm font-medium animate-none"},[...b[138]||(b[138]=[m("option",null,"病假",-1),m("option",null,"事假",-1),m("option",null,"公假",-1)])],512),[[_i,vt.value.type]])]),m("div",SU,[b[140]||(b[140]=m("label",{class:"text-xs font-bold text-slate-500"},"檢附證明 (限病公假)",-1)),m("label",AU,[Z(Q(ox),{class:"w-4 h-4 text-slate-400"}),m("span",IU,q(vt.value.fileName||"上傳檔案"),1),m("input",{type:"file",onChange:Me,class:"hidden"},null,32)])])]),m("div",RU,[m("div",MU,[b[141]||(b[141]=m("label",{class:"text-xs font-bold text-slate-500"},"請假開始日期",-1)),Mt(m("input",{type:"date","onUpdate:modelValue":b[32]||(b[32]=S=>vt.value.startDate=S),class:"w-full bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all text-sm font-mono"},null,512),[[re,vt.value.startDate]])]),m("div",PU,[b[142]||(b[142]=m("label",{class:"text-xs font-bold text-slate-500"},"請假結束日期",-1)),Mt(m("input",{type:"date","onUpdate:modelValue":b[33]||(b[33]=S=>vt.value.endDate=S),class:"w-full bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all text-sm font-mono"},null,512),[[re,vt.value.endDate]])])]),m("div",kU,[b[143]||(b[143]=m("label",{class:"text-xs font-bold text-slate-500"},"請假原因描述",-1)),Mt(m("textarea",{"onUpdate:modelValue":b[34]||(b[34]=S=>vt.value.reason=S),rows:"3",placeholder:"請填寫詳細請假原因,以利主管單位審核...",class:"w-full bg-slate-50 border border-slate-200 rounded-xl p-4 text-sm outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all resize-none"},null,512),[[re,vt.value.reason]])])]),m("button",{onClick:Ue,class:"w-full bg-emerald-600 hover:bg-emerald-700 text-white font-bold py-4 rounded-xl transition-all shadow-lg shadow-emerald-100 flex items-center justify-center gap-2 active:scale-[0.98]"},[Z(Q(ld),{class:"w-4 h-4"}),b[144]||(b[144]=Yt(" 送出請假申請 ",-1))])]),m("div",DU,[b[146]||(b[146]=m("h4",{class:"font-bold text-slate-800 text-base border-b border-slate-100 pb-3"},"歷史請假紀錄",-1)),m("div",NU,[(Y(!0),j(kt,null,ue(Re.value,S=>(Y(),j("div",{key:S.id,class:"p-4 bg-slate-50 rounded-xl border border-slate-100 flex items-center justify-between animate-in fade-in duration-200"},[m("div",LU,[m("div",FU,[m("span",{class:$t([S.type==="病假"?"bg-amber-100 text-amber-700 border-amber-200":"bg-blue-100 text-blue-700 border-blue-200","px-2 py-0.5 rounded text-[10px] font-bold border"])},q(S.type),3),m("span",UU,"申請日:"+q(S.dateApplied),1)]),m("p",BU,q(S.startDate)+" 至 "+q(S.endDate),1),m("p",OU,q(S.reason),1)]),m("div",null,[m("span",{class:$t([S.status==="已核准"?"bg-emerald-50 text-emerald-600 border-emerald-200":"bg-slate-100 text-slate-600 border-slate-200","px-2 py-1 text-xs font-bold rounded-lg border"])},q(S.status),3)])]))),128))])])])):Ht("",!0),st.value==="宿舍登錄"?(Y(),j("div",VU,[m("div",GU,[b[154]||(b[154]=m("h4",{class:"font-bold text-slate-800 text-base border-b border-slate-100 pb-3"},"115 學年度床位抽籤申請",-1)),m("div",HU,[m("div",$U,[b[148]||(b[148]=m("label",{class:"text-xs font-bold text-slate-500"},"優先宿舍選擇",-1)),Mt(m("select",{"onUpdate:modelValue":b[35]||(b[35]=S=>R.value.dormName=S),class:"w-full bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all text-sm font-medium animate-none"},[...b[147]||(b[147]=[m("option",null,"北科大男一舍",-1),m("option",null,"北科大男二舍",-1),m("option",null,"北科大女一舍",-1)])],512),[[_i,R.value.dormName]])]),m("div",qU,[b[150]||(b[150]=m("label",{class:"text-xs font-bold text-slate-500"},"房型偏好",-1)),Mt(m("select",{"onUpdate:modelValue":b[36]||(b[36]=S=>R.value.roomType=S),class:"w-full bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all text-sm font-medium animate-none"},[...b[149]||(b[149]=[m("option",null,"4人房 (標準)",-1),m("option",null,"2人房 (限研究生)",-1),m("option",null,"6人房 (經濟)",-1)])],512),[[_i,R.value.roomType]])]),m("div",zU,[b[151]||(b[151]=m("label",{class:"text-xs font-bold text-slate-500"},"指定室友學號偏好 (選填)",-1)),Mt(m("input",{type:"text","onUpdate:modelValue":b[37]||(b[37]=S=>R.value.roommateId=S),placeholder:"請輸入同學學號",class:"w-full bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all text-sm font-mono"},null,512),[[re,R.value.roommateId]])]),m("label",WU,[Mt(m("input",{type:"checkbox","onUpdate:modelValue":b[38]||(b[38]=S=>R.value.agreed=S),class:"mt-1 text-blue-600 focus:ring-blue-500 rounded border-slate-300"},null,512),[[Uv,R.value.agreed]]),b[152]||(b[152]=m("span",{class:"text-xs text-slate-500 leading-normal"},"我已閱讀並同意「台北科技大學學生宿舍規章與生活規範」,願遵守住宿各項規定。",-1))])]),m("button",{onClick:J,class:"w-full bg-slate-800 hover:bg-slate-900 text-white font-bold py-4 rounded-xl transition-all shadow-md flex items-center justify-center gap-2 active:scale-[0.98]"},[Z(Q(ju),{class:"w-4 h-4"}),b[153]||(b[153]=Yt(" 儲存床位申請志願 ",-1))])]),m("div",JU,[m("div",KU,[b[159]||(b[159]=m("h4",{class:"font-bold text-slate-800 text-base border-b border-slate-100 pb-3"},"宿舍抽籤結果模擬",-1)),b[160]||(b[160]=m("p",{class:"text-xs text-slate-400 leading-relaxed"}," 本區提供模擬即時抽籤流程,可用於測試系統防護在高流量或特殊時段的承載狀況。 ",-1)),m("div",YU,[k.value==="idle"?(Y(),j(kt,{key:0},[m("div",XU,[Z(Q(ud),{class:"w-5 h-5"})]),b[155]||(b[155]=m("h5",{class:"font-bold text-slate-700 text-sm"},"床位抽籤尚未啟動",-1)),b[156]||(b[156]=m("p",{class:"text-xs text-slate-400 mt-1"},"點擊下方按鈕開始模擬抽籤",-1))],64)):k.value==="drawing"?(Y(),j(kt,{key:1},[Z(Q(Gi),{class:"w-8 h-8 text-blue-600 animate-spin mb-3"}),b[157]||(b[157]=m("h5",{class:"font-bold text-blue-600 text-sm animate-pulse"},"正在向雲端核心取得隨機亂數中...",-1)),b[158]||(b[158]=m("p",{class:"text-xs text-slate-400 mt-1"},"模擬防護機制校驗 IP 完整度...",-1))],64)):k.value==="drawn"?(Y(),j("div",{key:2,class:$t([O.value.includes("恭喜中籤")?"bg-emerald-50 text-emerald-600 border border-emerald-100 animate-in zoom-in-95 duration-200":"bg-red-50 text-red-600 border border-red-100 animate-in zoom-in-95 duration-200","p-4 rounded-xl text-center space-y-1 w-full"])},[m("p",QU,q(O.value.includes("恭喜中籤")?"🎉 抽籤成功":"😢 抽籤結果"),1),m("p",ZU,q(O.value),1)],2)):Ht("",!0)])]),m("button",{onClick:$,disabled:k.value==="drawing",class:"w-full bg-orange-500 hover:bg-orange-600 text-white font-bold py-4 rounded-xl transition-all shadow-lg shadow-orange-100 flex items-center justify-center gap-2 mt-6 active:scale-[0.98]"},[Z(Q(dd),{class:"w-4 h-4"}),Yt(" "+q(k.value==="drawing"?"正在排隊抽籤...":"開始模擬一鍵抽籤"),1)],8,jU)])])):Ht("",!0),st.value==="網路郵局"?(Y(),j("div",tB,[m("div",eB,[m("button",{onClick:b[39]||(b[39]=S=>tt.value=!0),class:"w-full py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-xl text-xs font-bold transition-all shadow shadow-blue-200 mb-3 flex items-center justify-center gap-1 active:scale-95"},[Z(Q(sd),{class:"w-3.5 h-3.5"}),b[161]||(b[161]=Yt(" 撰寫新信件 ",-1))]),(Y(),j(kt,null,ue(["收件匣","寄件備份","草稿","垃圾桶"],S=>m("button",{key:S,onClick:mt=>H.value=S,class:$t([H.value===S?"bg-blue-50 text-blue-700 font-bold":"text-slate-600 hover:bg-slate-100","w-full text-left px-3 py-2 rounded-lg text-[11px] transition-colors flex items-center justify-between"])},[m("span",null,q(S),1),S==="收件匣"&&z.value.filter(mt=>!mt.read).length>0?(Y(),j("span",iB,q(z.value.filter(mt=>!mt.read).length),1)):Ht("",!0)],10,nB)),64))]),m("div",oB,[m("div",sB,[m("h5",rB,q(H.value),1)]),m("div",lB,[H.value==="收件匣"?(Y(!0),j(kt,{key:0},ue(z.value,S=>(Y(),j("button",{key:S.id,onClick:mt=>ot(S),class:$t([it.value===S.id?"bg-slate-50":"","w-full text-left p-3 hover:bg-slate-50/50 transition-colors flex flex-col gap-1"])},[m("div",cB,[m("span",{class:$t(["text-[11px] font-bold",S.read?"text-slate-500":"text-blue-700"])},q(S.sender),3),m("span",uB,q(S.date.split(" ")[0].substring(5)),1)]),m("p",{class:$t(["text-xs text-slate-800 line-clamp-1",S.read?"font-medium":"font-extrabold"])},q(S.subject),3)],10,aB))),128)):(Y(),j("div",dB,"該郵件匣尚無信件"))])]),m("div",fB,[pt.value&&H.value==="收件匣"?(Y(),j("div",hB,[m("div",pB,[m("h4",gB,q(pt.value.subject),1),m("div",mB,[m("div",null,[m("span",yB,q(pt.value.sender),1),m("span",_B,"<"+q(pt.value.senderEmail)+">",1)]),m("span",vB,q(pt.value.date),1)])]),m("div",xB,q(pt.value.content),1)])):(Y(),j("div",bB," 請選擇一封信件來讀取內容 "))]),tt.value?(Y(),j("div",EB,[m("div",wB,[m("div",TB,[b[162]||(b[162]=m("h5",{class:"font-bold text-slate-800 text-sm"},"新信件撰寫",-1)),m("button",{onClick:b[40]||(b[40]=S=>tt.value=!1),class:"p-1 hover:bg-slate-100 rounded-full transition-colors"},[Z(Q($s),{class:"w-4 h-4 text-slate-400"})])]),m("div",CB,[m("div",SB,[b[163]||(b[163]=m("label",{class:"text-[9px] font-bold text-slate-400 uppercase"},"收件人",-1)),Mt(m("input",{type:"email","onUpdate:modelValue":b[41]||(b[41]=S=>X.value.to=S),placeholder:"recipient@mail.ntut.edu.tw",class:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-xs outline-none focus:ring-1 focus:ring-blue-500 focus:bg-white transition-all font-mono"},null,512),[[re,X.value.to]])]),m("div",AB,[b[164]||(b[164]=m("label",{class:"text-[9px] font-bold text-slate-400 uppercase"},"主旨",-1)),Mt(m("input",{type:"text","onUpdate:modelValue":b[42]||(b[42]=S=>X.value.subject=S),placeholder:"請輸入主旨",class:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-xs outline-none focus:ring-1 focus:ring-blue-500 focus:bg-white transition-all"},null,512),[[re,X.value.subject]])]),m("div",IB,[b[165]||(b[165]=m("label",{class:"text-[9px] font-bold text-slate-400 uppercase"},"信件內文",-1)),Mt(m("textarea",{"onUpdate:modelValue":b[43]||(b[43]=S=>X.value.content=S),rows:"4",placeholder:"請在此輸入信件主要內容...",class:"w-full bg-slate-50 border border-slate-200 rounded-lg p-3 text-xs outline-none focus:ring-1 focus:ring-blue-500 focus:bg-white transition-all resize-none font-sans"},null,512),[[re,X.value.content]])])]),m("div",RB,[m("button",{onClick:b[44]||(b[44]=S=>tt.value=!1),class:"px-3.5 py-1.5 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-lg text-xs font-bold transition-all"}," 關閉草稿 "),m("button",{onClick:ht,class:"px-3.5 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-xs font-bold transition-all shadow shadow-blue-100 flex items-center gap-1 active:scale-95"},[Z(Q(ld),{class:"w-3 h-3"}),b[166]||(b[166]=Yt(" 傳送郵件 ",-1))])])])])):Ht("",!0)])):Ht("",!0),st.value==="軟體雲"?(Y(),j("div",MB,[m("div",PB,[b[167]||(b[167]=m("div",null,[m("h4",{class:"font-extrabold text-slate-800 text-sm"},"北科軟體雲 NTUT Software Cloud"),m("p",{class:"text-xs text-slate-400 mt-0.5 font-medium"},"提供校園授權學術軟體下載或在網頁雲端開啟虛擬環境")],-1)),m("div",kB,[(Y(),j(kt,null,ue(["全部","工程繪圖","統計分析","開發工具","辦公軟體"],S=>m("button",{key:S,onClick:mt=>dt.value=S,class:$t([dt.value===S?"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-700","px-2.5 py-1 rounded-lg font-bold text-[10px] transition-all"])},q(S),11,DB)),64))])]),m("div",NB,[(Y(!0),j(kt,null,ue(Vt.value,S=>(Y(),j("div",{key:S.id,class:"bg-white rounded-2xl border border-slate-200 p-5 shadow-sm flex flex-col justify-between hover:shadow-md transition-shadow animate-in fade-in duration-200"},[m("div",LB,[m("div",FB,[m("span",UB,q(S.category),1),m("span",BB,q(S.size),1)]),m("h5",OB,q(S.name),1),m("p",VB,q(S.desc),1)]),m("div",GB,[m("button",{onClick:b[45]||(b[45]=mt=>K.alert("【下載提示】已開始下載該軟體安裝檔及校園授權 KMS 啟動腳本!")),class:"py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl text-xs font-bold transition-all active:scale-95"}," 下載安裝檔 "),m("button",{onClick:mt=>w(S.name),class:"py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-xl text-xs font-bold transition-all shadow-md shadow-blue-100 flex items-center justify-center gap-1 active:scale-95"},[Z(Q(zl),{class:"w-3.5 h-3.5"}),b[168]||(b[168]=Yt(" 雲端啟動 ",-1))],8,HB)])]))),128))]),Qt.value?(Y(),j("div",$B,[Z(Q(Gi),{class:"w-10 h-10 text-blue-600 animate-spin"}),b[169]||(b[169]=m("h5",{class:"font-bold text-blue-600 text-sm animate-pulse"},"正在為您配置雲端虛擬環境桌面...",-1)),b[170]||(b[170]=m("p",{class:"text-xs text-slate-400"},"系統正在掛載遠端授權儲存區並配置運算資源",-1))])):Ht("",!0),Et.value?(Y(),j("div",qB,[m("div",zB,[m("div",WB,[m("div",{class:"w-3 h-3 bg-red-500 rounded-full cursor-pointer",onClick:b[46]||(b[46]=S=>Et.value=null)}),b[171]||(b[171]=m("div",{class:"w-3 h-3 bg-amber-500 rounded-full"},null,-1)),b[172]||(b[172]=m("div",{class:"w-3 h-3 bg-emerald-500 rounded-full"},null,-1)),m("span",JB,"VDesk Remote System : [ "+q(Et.value)+" ]",1)]),m("button",{onClick:b[47]||(b[47]=S=>Et.value=null),class:"px-2.5 py-1 bg-red-600/20 text-red-400 hover:bg-red-600 hover:text-white rounded-md text-[10px] font-bold transition-all active:scale-95"}," 關閉虛擬桌面 ")]),m("div",KB,[Et.value.includes("MATLAB")?(Y(),j("div",YB,[m("div",XB,[Z(Q(Gs),{class:"w-3.5 h-3.5 text-blue-400"}),b[173]||(b[173]=m("span",null,"MATLAB Command Window",-1))]),b[174]||(b[174]=Us('

>> x = linspace(0, 2*pi, 100);

>> y = sin(x);

>> plot(x, y); title('NTUT VDesk MATLAB Demo'); grid on;

MATLAB Figure

>> NTUT VDesk environment initialized successfully.

>> _

',1))])):Et.value.includes("AutoCAD")?(Y(),j("div",QB,[m("div",ZB,[Z(Q(Ai),{class:"w-3.5 h-3.5 text-orange-400"}),b[175]||(b[175]=m("span",null,"AutoCAD 2025 Drawing Canvas - [NTUT_FloorPlan.dwg]",-1))]),b[176]||(b[176]=Us('
2D Blueprint

AutoCAD Graphics Engine Active

Hardware Accel: WebGL 2.0

',1))])):(Y(),j("div",jB,[m("div",tO,[Z(Q(zl),{class:"w-6 h-6 animate-pulse"})]),m("div",null,[m("h4",eO,"已啟動 "+q(Et.value)+" 雲端連線",1),b[177]||(b[177]=m("p",{class:"text-[11px] text-slate-400 mt-1 max-w-xs mx-auto leading-relaxed"}," 您目前正透過 HTTPS 使用北科軟體雲虛擬主機資源進行程式調校與學術操作。 ",-1))])]))])])):Ht("",!0)])):Ht("",!0)])):(Y(),j("div",nO,[m("div",iO,[m("div",oO,[m("button",{onClick:b[48]||(b[48]=S=>Ct("academic")),class:"w-full px-6 py-4 flex items-center justify-between hover:bg-slate-50 transition-colors"},[m("div",sO,[Z(Q(Jv),{class:"w-5 h-5 text-blue-600"}),b[178]||(b[178]=m("span",{class:"font-bold text-slate-800"},"教務系統 Academic Affairs",-1))]),(Y(),Xn(_o(at.value.academic?Q(ql):Q($l)),{class:"w-5 h-5 text-slate-400"}))]),Mt(m("div",rO,[m("button",{onClick:b[49]||(b[49]=S=>et("期末教學評量")),class:"flex items-center gap-3 p-4 bg-white border border-slate-200 rounded-xl hover:border-blue-500 hover:shadow-md transition-all group"},[m("div",lO,[Z(Q(nd),{class:"w-5 h-5 text-blue-600"})]),b[179]||(b[179]=m("span",{class:"font-bold text-sm text-slate-700"},"期末教學評量",-1))]),m("button",{onClick:b[50]||(b[50]=S=>et("預選系統")),class:"flex items-center gap-3 p-4 bg-white border border-slate-200 rounded-xl hover:border-blue-500 hover:shadow-md transition-all group"},[m("div",aO,[Z(Q(Pa),{class:"w-5 h-5 text-blue-600"})]),b[180]||(b[180]=m("span",{class:"font-bold text-sm text-slate-700"},"預選系統",-1))])],512),[[xo,at.value.academic]])]),m("div",cO,[m("button",{onClick:b[51]||(b[51]=S=>Ct("affairs")),class:"w-full px-6 py-4 flex items-center justify-between hover:bg-slate-50 transition-colors"},[m("div",uO,[Z(Q(Hs),{class:"w-5 h-5 text-emerald-600"}),b[181]||(b[181]=m("span",{class:"font-bold text-slate-800"},"學務系統 Student Affairs",-1))]),(Y(),Xn(_o(at.value.affairs?Q(ql):Q($l)),{class:"w-5 h-5 text-slate-400"}))]),Mt(m("div",dO,[m("button",{onClick:b[52]||(b[52]=S=>et("請假系統")),class:"flex items-center gap-3 p-4 bg-white border border-slate-200 rounded-xl hover:border-emerald-500 hover:shadow-md transition-all group"},[m("div",fO,[Z(Q(Ai),{class:"w-5 h-5 text-emerald-600"})]),b[182]||(b[182]=m("span",{class:"font-bold text-sm text-slate-700"},"請假系統",-1))]),m("button",{onClick:b[53]||(b[53]=S=>et("宿舍登錄")),class:"flex items-center gap-3 p-4 bg-white border border-slate-200 rounded-xl hover:border-emerald-500 hover:shadow-md transition-all group"},[m("div",hO,[Z(Q(ud),{class:"w-5 h-5 text-emerald-600"})]),b[183]||(b[183]=m("span",{class:"font-bold text-sm text-slate-700"},"宿舍登錄",-1))])],512),[[xo,at.value.affairs]])]),m("div",pO,[m("button",{onClick:b[54]||(b[54]=S=>Ct("services")),class:"w-full px-6 py-4 flex items-center justify-between hover:bg-slate-50 transition-colors"},[m("div",gO,[Z(Q(id),{class:"w-5 h-5 text-amber-600"}),b[184]||(b[184]=m("span",{class:"font-bold text-slate-800"},"資訊服務 Information Services",-1))]),(Y(),Xn(_o(at.value.services?Q(ql):Q($l)),{class:"w-5 h-5 text-slate-400"}))]),Mt(m("div",mO,[m("button",{onClick:b[55]||(b[55]=S=>et("網路郵局")),class:"flex items-center gap-3 p-4 bg-white border border-slate-200 rounded-xl hover:border-amber-500 hover:shadow-md transition-all group"},[m("div",yO,[Z(Q(tx),{class:"w-5 h-5 text-amber-600"})]),b[185]||(b[185]=m("span",{class:"font-bold text-sm text-slate-700"},"網路郵局",-1))]),m("button",{onClick:b[56]||(b[56]=S=>et("軟體雲")),class:"flex items-center gap-3 p-4 bg-white border border-slate-200 rounded-xl hover:border-amber-500 hover:shadow-md transition-all group"},[m("div",_O,[Z(Q(zl),{class:"w-5 h-5 text-amber-600"})]),b[186]||(b[186]=m("span",{class:"font-bold text-sm text-slate-700"},"軟體雲",-1))])],512),[[xo,at.value.services]])])]),m("div",vO,[m("div",xO,[Z(Q(ad),{class:"w-6 h-6"}),b[187]||(b[187]=m("h3",{class:"text-lg font-bold"},"惡意操作測試區 (Security Test)",-1))]),b[189]||(b[189]=m("p",{class:"text-sm text-red-600/80 leading-relaxed"}," 此區域僅供資安演練使用。點擊下方按鈕將模擬 SQL Injection 攻擊嘗試,系統將即時偵測並記錄此異常行為。 ",-1)),m("button",{onClick:b[57]||(b[57]=S=>et("嘗試偷改成績 (SQL Injection)",!0)),class:"w-full bg-red-600 hover:bg-red-700 text-white font-bold py-4 rounded-xl transition-all shadow-lg shadow-red-100 flex items-center justify-center gap-3 group active:scale-[0.98]"},[Z(Q(dd),{class:"w-5 h-5 group-hover:animate-pulse"}),b[188]||(b[188]=Yt(" 嘗試偷改成績 (SQL Injection) ",-1))])])]))],64)):gt.value==="logs"?(Y(),Xn(Fk,{key:2,sessionId:I.value.sessionId},null,8,["sessionId"])):Ht("",!0)])])])):Ht("",!0):(Y(),j("div",VD,[m("div",GD,[m("div",HD,[m("div",$D,[Z(Q(Gs),{class:"w-6 h-6 text-white"})]),b[58]||(b[58]=m("h2",{class:"text-xl font-bold tracking-tight"},"環境變數模擬器",-1))]),m("div",qD,[m("div",zD,[b[59]||(b[59]=m("label",{class:"block text-sm font-bold text-slate-700"},"模擬來源 IP",-1)),Mt(m("select",{"onUpdate:modelValue":b[0]||(b[0]=S=>I.value.ip=S),class:"w-full bg-white border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all"},[(Y(),j(kt,null,ue(M,S=>m("option",{key:S.value,value:S.value},q(S.label),9,WD)),64))],512),[[_i,I.value.ip]])]),m("div",JD,[b[60]||(b[60]=m("label",{class:"block text-sm font-bold text-slate-700"},"Cookie Session ID",-1)),Mt(m("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=S=>I.value.sessionId=S),class:"w-full bg-white border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all font-mono text-sm",placeholder:"sess_..."},null,512),[[re,I.value.sessionId]])]),m("div",KD,[b[63]||(b[63]=m("label",{class:"block text-sm font-bold text-slate-700"},"時間設定",-1)),m("div",YD,[m("label",XD,[Mt(m("input",{type:"radio","onUpdate:modelValue":b[2]||(b[2]=S=>I.value.timeMode=S),value:"real",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[Bs,I.value.timeMode]]),b[61]||(b[61]=m("span",{class:"text-sm font-medium group-hover:text-blue-600 transition-colors"},"真實時間",-1))]),m("label",QD,[Mt(m("input",{type:"radio","onUpdate:modelValue":b[3]||(b[3]=S=>I.value.timeMode=S),value:"custom",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[Bs,I.value.timeMode]]),b[62]||(b[62]=m("span",{class:"text-sm font-medium group-hover:text-blue-600 transition-colors"},"自訂時間",-1))])]),I.value.timeMode==="custom"?Mt((Y(),j("input",{key:0,type:"text","onUpdate:modelValue":b[4]||(b[4]=S=>I.value.customTime=S),class:"w-full bg-white border border-slate-200 rounded-xl px-4 py-3 outline-none focus:ring-2 focus:ring-blue-500 transition-all font-mono text-sm"},null,512)),[[re,I.value.customTime]]):Ht("",!0)])]),m("div",ZD,[b[65]||(b[65]=m("div",{class:"flex items-center justify-between mb-4"},[m("h3",{class:"text-sm font-bold text-slate-500 uppercase tracking-wider"},"即時 Log 監控區"),m("span",{class:"text-[10px] bg-emerald-100 text-emerald-700 px-2 py-0.5 rounded font-bold animate-pulse"},"LIVE")],-1)),m("div",jD,[m("div",tN,[m("table",eN,[b[64]||(b[64]=m("thead",null,[m("tr",{class:"border-b border-slate-800 bg-slate-800/50"},[m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"Timestamp"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"IP"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"Cookie ID"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"Account"),m("th",{class:"p-3 text-[10px] font-bold text-slate-400 uppercase"},"AI Result")])],-1)),m("tbody",nN,[(Y(!0),j(kt,null,ue(B.value,(S,mt)=>(Y(),j("tr",{key:mt,class:"hover:bg-slate-800/30 transition-colors"},[m("td",iN,q(S.timestamp),1),m("td",oN,q(S.ip),1),m("td",sN,q(S.cookieId),1),m("td",rN,q(S.account),1),m("td",lN,[m("span",{class:$t([S.result==="正常"?"text-emerald-500":"text-red-500","font-bold"])},q(S.result),3)])]))),128))])])])])])]),m("div",aN,[m("div",cN,[m("div",uN,[b[66]||(b[66]=m("div",{class:"relative z-10"},[m("h2",{class:"text-2xl font-bold mb-1"},"校園入口網站"),m("p",{class:"text-blue-100 text-sm font-medium tracking-wide"},"Taipei Tech Portal")],-1)),m("div",dN,[Z(Q(Vs),{class:"w-48 h-48"})])]),m("div",fN,[h.value?(Y(),j("div",hN,[Z(Q(Eo),{class:"w-4 h-4"}),Yt(" "+q(h.value),1)])):Ht("",!0),m("div",pN,[m("div",gN,[b[67]||(b[67]=m("label",{class:"text-xs font-bold text-slate-400 uppercase tracking-wider ml-1"},"帳號 Account",-1)),m("div",mN,[Z(Q(Jl),{class:"w-5 h-5 text-slate-300 absolute left-4 top-1/2 -translate-y-1/2"}),Mt(m("input",{type:"text","onUpdate:modelValue":b[5]||(b[5]=S=>u.value.account=S),class:"w-full pl-12 pr-4 py-4 bg-slate-50 border border-slate-200 rounded-2xl outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all",placeholder:"請輸入帳號"},null,512),[[re,u.value.account]])])]),m("div",yN,[b[68]||(b[68]=m("label",{class:"text-xs font-bold text-slate-400 uppercase tracking-wider ml-1"},"密碼 Password",-1)),m("div",_N,[Z(Q(jv),{class:"w-5 h-5 text-slate-300 absolute left-4 top-1/2 -translate-y-1/2"}),Mt(m("input",{type:"password","onUpdate:modelValue":b[6]||(b[6]=S=>u.value.password=S),class:"w-full pl-12 pr-4 py-4 bg-slate-50 border border-slate-200 rounded-2xl outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all",placeholder:"請輸入密碼"},null,512),[[re,u.value.password]])])]),m("div",vN,[m("div",xN,[b[69]||(b[69]=m("label",{class:"text-xs font-bold text-slate-400 uppercase tracking-wider ml-1"},"驗證碼 Captcha",-1)),Mt(m("input",{type:"text","onUpdate:modelValue":b[7]||(b[7]=S=>u.value.captcha=S),onKeydown:Xu(U,["enter"]),class:"w-full px-4 py-4 bg-slate-50 border border-slate-200 rounded-2xl outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-all",placeholder:"驗證碼"},null,544),[[re,u.value.captcha]])]),m("div",bN,[m("div",EN,[b[70]||(b[70]=Us('
FEIK
',1)),Z(Q(Pa),{class:"w-4 h-4 text-slate-400"})])])])]),m("button",{onClick:U,class:"w-full bg-orange-500 hover:bg-orange-600 text-white font-bold py-5 rounded-2xl transition-all shadow-xl shadow-orange-100 flex items-center justify-center gap-3 group active:scale-[0.98]"},[b[71]||(b[71]=m("span",null,"登入 Login",-1)),Z(Q(td),{class:"w-5 h-5 group-hover:translate-x-1 transition-transform"})]),b[72]||(b[72]=m("div",{class:"flex justify-between text-xs font-bold text-slate-400 px-2"},[m("a",{href:"#",class:"hover:text-blue-600 transition-colors"},"忘記密碼?"),m("a",{href:"#",class:"hover:text-blue-600 transition-colors"},"帳號申請")],-1))])])])])),Q(mc)?(Y(),j("div",bO,[m("div",EO,[m("div",wO,[Z(Q(ad),{class:"w-8 h-8 text-red-600 animate-pulse"})]),m("div",TO,[b[190]||(b[190]=m("h3",{class:"text-2xl font-black text-red-600"},"帳號安全存取受限",-1)),m("p",CO,q(Q(fy)||"驗證逾時或帳號遭非法存取,已強制登出"),1)]),m("button",{onClick:P,class:"w-full bg-red-600 hover:bg-red-700 active:scale-[0.98] text-white font-bold py-4 rounded-xl shadow-lg shadow-red-200 transition-all"}," 確定 ")])])):Ht("",!0)],64))}});Gv(SO).mount("#root");