@mcp-use/inspector 0.5.3-canary.7 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{g as pe}from"./index-Cyrsq1zA.js";import{r as Ln}from"./index-DRz5BQNA.js";var Xe,ot;function qn(){return ot||(ot=1,Xe=function(e,t){if(typeof e!="string")throw new TypeError("Expected a string");return t=typeof t>"u"?"_":t,e.replace(/([a-z\d])([A-Z])/g,"$1"+t+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+t+"$2").toLowerCase()}),Xe}var jn=qn();const Bi=pe(jn);var Ne={exports:{}},at;function Dn(){if(at)return Ne.exports;at=1;const e=/[\p{Lu}]/u,t=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,s=/[_.\- ]+/,u=new RegExp("^"+s.source),i=new RegExp(s.source+n.source,"gu"),o=new RegExp("\\d+"+n.source,"gu"),c=(d,m,h)=>{let p=!1,g=!1,v=!1;for(let E=0;E<d.length;E++){const y=d[E];p&&e.test(y)?(d=d.slice(0,E)+"-"+d.slice(E),p=!1,v=g,g=!0,E++):g&&v&&t.test(y)?(d=d.slice(0,E-1)+"-"+d.slice(E-1),v=g,g=!1,p=!0):(p=m(y)===y&&h(y)!==y,v=g,g=h(y)===y&&m(y)!==y)}return d},l=(d,m)=>(r.lastIndex=0,d.replace(r,h=>m(h))),a=(d,m)=>(i.lastIndex=0,o.lastIndex=0,d.replace(i,(h,p)=>m(p)).replace(o,h=>m(h))),f=(d,m)=>{if(!(typeof d=="string"||Array.isArray(d)))throw new TypeError("Expected the input to be `string | string[]`");if(m={pascalCase:!1,preserveConsecutiveUppercase:!1,...m},Array.isArray(d)?d=d.map(v=>v.trim()).filter(v=>v.length).join("-"):d=d.trim(),d.length===0)return"";const h=m.locale===!1?v=>v.toLowerCase():v=>v.toLocaleLowerCase(m.locale),p=m.locale===!1?v=>v.toUpperCase():v=>v.toLocaleUpperCase(m.locale);return d.length===1?m.pascalCase?p(d):h(d):(d!==h(d)&&(d=c(d,h,p)),d=d.replace(u,""),m.preserveConsecutiveUppercase?d=l(d,h):d=h(d),m.pascalCase&&(d=p(d.charAt(0))+d.slice(1)),a(d,p))};return Ne.exports=f,Ne.exports.default=f,Ne.exports}var Un=Dn();const Zi=pe(Un),Mn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Fn(e){return typeof e=="string"&&Mn.test(e)}function Gn(e){if(!Fn(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var H=[];for(var Je=0;Je<256;++Je)H.push((Je+256).toString(16).slice(1));function Rn(e,t=0){return(H[e[t+0]]+H[e[t+1]]+H[e[t+2]]+H[e[t+3]]+"-"+H[e[t+4]]+H[e[t+5]]+"-"+H[e[t+6]]+H[e[t+7]]+"-"+H[e[t+8]]+H[e[t+9]]+"-"+H[e[t+10]]+H[e[t+11]]+H[e[t+12]]+H[e[t+13]]+H[e[t+14]]+H[e[t+15]]).toLowerCase()}var Ae,Vn=new Uint8Array(16);function Bn(){if(!Ae&&(Ae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ae(Vn)}function Zn(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Xn="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Jn="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Hn(e,t,r){function n(s,u,i,o){var c;if(typeof s=="string"&&(s=Zn(s)),typeof u=="string"&&(u=Gn(u)),((c=u)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+s.length);if(l.set(u),l.set(s,u.length),l=r(l),l[6]=l[6]&15|t,l[8]=l[8]&63|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=l[a];return i}return Rn(l)}try{n.name=e}catch{}return n.DNS=Xn,n.URL=Jn,n}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const ut={randomUUID:Yn};function Xi(e,t,r){if(ut.randomUUID&&!e)return ut.randomUUID();e=e||{};var n=e.random||(e.rng||Bn)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Rn(n)}function Kn(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function He(e,t){return e<<t|e>>>32-t}function Wn(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var n=unescape(encodeURIComponent(e));e=[];for(var s=0;s<n.length;++s)e.push(n.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var u=e.length/4+2,i=Math.ceil(u/16),o=new Array(i),c=0;c<i;++c){for(var l=new Uint32Array(16),a=0;a<16;++a)l[a]=e[c*64+a*4]<<24|e[c*64+a*4+1]<<16|e[c*64+a*4+2]<<8|e[c*64+a*4+3];o[c]=l}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(var f=0;f<i;++f){for(var d=new Uint32Array(80),m=0;m<16;++m)d[m]=o[f][m];for(var h=16;h<80;++h)d[h]=He(d[h-3]^d[h-8]^d[h-14]^d[h-16],1);for(var p=r[0],g=r[1],v=r[2],E=r[3],y=r[4],q=0;q<80;++q){var M=Math.floor(q/20),U=He(p,5)+Kn(M,g,v,E)+y+t[M]+d[q]>>>0;y=E,E=v,v=He(g,30)>>>0,g=p,p=U}r[0]=r[0]+p>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+E>>>0,r[4]=r[4]+y>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Ji=Hn("v5",80,Wn),_e={exports:{}},Ye={},Ke,ct;function Qn(){if(ct)return Ke;ct=1;function e(t,r){typeof r=="boolean"&&(r={forever:r}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=r||{},this._maxRetryTime=r&&r.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 Ke=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 r=new Date().getTime();if(t&&r-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var s=this;return this._timer=setTimeout(function(){s._attempts++,s._operationTimeoutCb&&(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref&&s._timeout.unref()),s._fn(s._attempts)},n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,r){this._fn=t,r&&(r.timeout&&(this._operationTimeout=r.timeout),r.cb&&(this._operationTimeoutCb=r.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._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={},r=null,n=0,s=0;s<this._errors.length;s++){var u=this._errors[s],i=u.message,o=(t[i]||0)+1;t[i]=o,o>=n&&(r=u,n=o)}return r},Ke}var lt;function es(){return lt||(lt=1,(function(e){var t=Qn();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var s in r)n[s]=r[s];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var u=[],i=0;i<n.retries;i++)u.push(this.createTimeout(i,n));return r&&r.forever&&!u.length&&u.push(this.createTimeout(i,n)),u.sort(function(o,c){return o-c}),u},e.createTimeout=function(r,n){var s=n.randomize?Math.random()+1:1,u=Math.round(s*Math.max(n.minTimeout,1)*Math.pow(n.factor,r));return u=Math.min(u,n.maxTimeout),u},e.wrap=function(r,n,s){if(n instanceof Array&&(s=n,n=null),!s){s=[];for(var u in r)typeof r[u]=="function"&&s.push(u)}for(var i=0;i<s.length;i++){var o=s[i],c=r[o];r[o]=(function(a){var f=e.operation(n),d=Array.prototype.slice.call(arguments,1),m=d.pop();d.push(function(h){f.retry(h)||(h&&(arguments[0]=f.mainError()),m.apply(this,arguments))}),f.attempt(function(){a.apply(r,d)})}).bind(r,c),r[o].options=n}}})(Ye)),Ye}var We,ft;function rs(){return ft||(ft=1,We=es()),We}var dt;function ts(){if(dt)return _e.exports;dt=1;const e=rs(),t=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class r extends Error{constructor(o){super(),o instanceof Error?(this.originalError=o,{message:o}=o):(this.originalError=new Error(o),this.originalError.stack=this.stack),this.name="AbortError",this.message=o}}const n=(i,o,c)=>{const l=c.retries-(o-1);return i.attemptNumber=o,i.retriesLeft=l,i},s=i=>t.includes(i),u=(i,o)=>new Promise((c,l)=>{o={onFailedAttempt:()=>{},retries:10,...o};const a=e.operation(o);a.attempt(async f=>{try{c(await i(f))}catch(d){if(!(d instanceof Error)){l(new TypeError(`Non-error was thrown: "${d}". You should only throw errors.`));return}if(d instanceof r)a.stop(),l(d.originalError);else if(d instanceof TypeError&&!s(d.message))a.stop(),l(d);else{n(d,f,o);try{await o.onFailedAttempt(d)}catch(m){l(m);return}a.retry(d)||l(a.mainError())}}})});return _e.exports=u,_e.exports.default=u,_e.exports.AbortError=r,_e.exports}var ns=ts();const Hi=pe(ns);var ke={},Qe={exports:{}},ht;function ss(){return ht||(ht=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,l,a){this.fn=c,this.context=l,this.once=a||!1}function u(c,l,a,f,d){if(typeof a!="function")throw new TypeError("The listener must be a function");var m=new s(a,f||c,d),h=r?r+l:l;return c._events[h]?c._events[h].fn?c._events[h]=[c._events[h],m]:c._events[h].push(m):(c._events[h]=m,c._eventsCount++),c}function i(c,l){--c._eventsCount===0?c._events=new n:delete c._events[l]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],a,f;if(this._eventsCount===0)return l;for(f in a=this._events)t.call(a,f)&&l.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(a)):l},o.prototype.listeners=function(l){var a=r?r+l:l,f=this._events[a];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,m=f.length,h=new Array(m);d<m;d++)h[d]=f[d].fn;return h},o.prototype.listenerCount=function(l){var a=r?r+l:l,f=this._events[a];return f?f.fn?1:f.length:0},o.prototype.emit=function(l,a,f,d,m,h){var p=r?r+l:l;if(!this._events[p])return!1;var g=this._events[p],v=arguments.length,E,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,a),!0;case 3:return g.fn.call(g.context,a,f),!0;case 4:return g.fn.call(g.context,a,f,d),!0;case 5:return g.fn.call(g.context,a,f,d,m),!0;case 6:return g.fn.call(g.context,a,f,d,m,h),!0}for(y=1,E=new Array(v-1);y<v;y++)E[y-1]=arguments[y];g.fn.apply(g.context,E)}else{var q=g.length,M;for(y=0;y<q;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),v){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,a);break;case 3:g[y].fn.call(g[y].context,a,f);break;case 4:g[y].fn.call(g[y].context,a,f,d);break;default:if(!E)for(M=1,E=new Array(v-1);M<v;M++)E[M-1]=arguments[M];g[y].fn.apply(g[y].context,E)}}return!0},o.prototype.on=function(l,a,f){return u(this,l,a,f,!1)},o.prototype.once=function(l,a,f){return u(this,l,a,f,!0)},o.prototype.removeListener=function(l,a,f,d){var m=r?r+l:l;if(!this._events[m])return this;if(!a)return i(this,m),this;var h=this._events[m];if(h.fn)h.fn===a&&(!d||h.once)&&(!f||h.context===f)&&i(this,m);else{for(var p=0,g=[],v=h.length;p<v;p++)(h[p].fn!==a||d&&!h[p].once||f&&h[p].context!==f)&&g.push(h[p]);g.length?this._events[m]=g.length===1?g[0]:g:i(this,m)}return this},o.prototype.removeAllListeners=function(l){var a;return l?(a=r?r+l:l,this._events[a]&&i(this,a)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o})(Qe)),Qe.exports}var $e={exports:{}},er,pt;function is(){return pt||(pt=1,er=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))),er}var mt;function os(){if(mt)return $e.exports;mt=1;const e=is();class t extends Error{constructor(s){super(s),this.name="TimeoutError"}}const r=(n,s,u)=>new Promise((i,o)=>{if(typeof s!="number"||s<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(s===1/0){i(n);return}const c=setTimeout(()=>{if(typeof u=="function"){try{i(u())}catch(f){o(f)}return}const l=typeof u=="string"?u:`Promise timed out after ${s} milliseconds`,a=u instanceof Error?u:new t(l);typeof n.cancel=="function"&&n.cancel(),o(a)},s);e(n.then(i,o),()=>{clearTimeout(c)})});return $e.exports=r,$e.exports.default=r,$e.exports.TimeoutError=t,$e.exports}var ze={},Ce={},gt;function as(){if(gt)return Ce;gt=1,Object.defineProperty(Ce,"__esModule",{value:!0});function e(t,r,n){let s=0,u=t.length;for(;u>0;){const i=u/2|0;let o=s+i;n(t[o],r)<=0?(s=++o,u-=i+1):u=i}return s}return Ce.default=e,Ce}var vt;function us(){if(vt)return ze;vt=1,Object.defineProperty(ze,"__esModule",{value:!0});const e=as();class t{constructor(){this._queue=[]}enqueue(n,s){s=Object.assign({priority:0},s);const u={priority:s.priority,run:n};if(this.size&&this._queue[this.size-1].priority>=s.priority){this._queue.push(u);return}const i=e.default(this._queue,u,(o,c)=>c.priority-o.priority);this._queue.splice(i,0,u)}dequeue(){const n=this._queue.shift();return n?.run}filter(n){return this._queue.filter(s=>s.priority===n.priority).map(s=>s.run)}get size(){return this._queue.length}}return ze.default=t,ze}var yt;function cs(){if(yt)return ke;yt=1,Object.defineProperty(ke,"__esModule",{value:!0});const e=ss(),t=os(),r=us(),n=()=>{},s=new t.TimeoutError;class u extends e{constructor(o){var c,l,a,f;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=n,this._resolveIdle=n,o=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:r.default},o),!(typeof o.intervalCap=="number"&&o.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(l=(c=o.intervalCap)===null||c===void 0?void 0:c.toString())!==null&&l!==void 0?l:""}\` (${typeof o.intervalCap})`);if(o.interval===void 0||!(Number.isFinite(o.interval)&&o.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(f=(a=o.interval)===null||a===void 0?void 0:a.toString())!==null&&f!==void 0?f:""}\` (${typeof o.interval})`);this._carryoverConcurrencyCount=o.carryoverConcurrencyCount,this._isIntervalIgnored=o.intervalCap===1/0||o.interval===0,this._intervalCap=o.intervalCap,this._interval=o.interval,this._queue=new o.queueClass,this._queueClass=o.queueClass,this.concurrency=o.concurrency,this._timeout=o.timeout,this._throwOnTimeout=o.throwOnTimeout===!0,this._isPaused=o.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=n,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=n,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const o=Date.now();if(this._intervalId===void 0){const c=this._intervalEnd-o;if(c<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},c)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const o=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const c=this._queue.dequeue();return c?(this.emit("active"),c(),o&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(o){if(!(typeof o=="number"&&o>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);this._concurrency=o,this._processQueue()}async add(o,c={}){return new Promise((l,a)=>{const f=async()=>{this._pendingCount++,this._intervalCount++;try{const d=this._timeout===void 0&&c.timeout===void 0?o():t.default(Promise.resolve(o()),c.timeout===void 0?this._timeout:c.timeout,()=>{(c.throwOnTimeout===void 0?this._throwOnTimeout:c.throwOnTimeout)&&a(s)});l(await d)}catch(d){a(d)}this._next()};this._queue.enqueue(f,c),this._tryToStartAnother(),this.emit("add")})}async addAll(o,c){return Promise.all(o.map(async l=>this.add(l,c)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(o=>{const c=this._resolveEmpty;this._resolveEmpty=()=>{c(),o()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(o=>{const c=this._resolveIdle;this._resolveIdle=()=>{c(),o()}})}get size(){return this._queue.size}sizeBy(o){return this._queue.filter(o).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(o){this._timeout=o}}return ke.default=u,ke}var ls=cs();const Yi=pe(ls);var Le={exports:{}},rr,_t;function De(){if(_t)return rr;_t=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,s=t-6;return rr={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rr}var tr,$t;function Ue(){if($t)return tr;$t=1;var e={};return tr=typeof process=="object"&&e&&e.NODE_DEBUG&&/\bsemver\b/i.test(e.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},tr}var Et;function be(){return Et||(Et=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=De(),u=Ue();t=e.exports={};const i=t.re=[],o=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],a=t.t={};let f=0;const d="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",s],[d,n]],h=g=>{for(const[v,E]of m)g=g.split(`${v}*`).join(`${v}{0,${E}}`).split(`${v}+`).join(`${v}{1,${E}}`);return g},p=(g,v,E)=>{const y=h(v),q=f++;u(g,q,v),a[g]=q,c[q]=v,l[q]=y,i[q]=new RegExp(v,E?"g":void 0),o[q]=new RegExp(y,E?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),p("MAINVERSION",`(${c[a.NUMERICIDENTIFIER]})\\.(${c[a.NUMERICIDENTIFIER]})\\.(${c[a.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${c[a.NUMERICIDENTIFIERLOOSE]})\\.(${c[a.NUMERICIDENTIFIERLOOSE]})\\.(${c[a.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${c[a.NONNUMERICIDENTIFIER]}|${c[a.NUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${c[a.NONNUMERICIDENTIFIER]}|${c[a.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASE",`(?:-(${c[a.PRERELEASEIDENTIFIER]}(?:\\.${c[a.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${c[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[a.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${d}+`),p("BUILD",`(?:\\+(${c[a.BUILDIDENTIFIER]}(?:\\.${c[a.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${c[a.MAINVERSION]}${c[a.PRERELEASE]}?${c[a.BUILD]}?`),p("FULL",`^${c[a.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${c[a.MAINVERSIONLOOSE]}${c[a.PRERELEASELOOSE]}?${c[a.BUILD]}?`),p("LOOSE",`^${c[a.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${c[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${c[a.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${c[a.XRANGEIDENTIFIER]})(?:\\.(${c[a.XRANGEIDENTIFIER]})(?:\\.(${c[a.XRANGEIDENTIFIER]})(?:${c[a.PRERELEASE]})?${c[a.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${c[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[a.XRANGEIDENTIFIERLOOSE]})(?:${c[a.PRERELEASELOOSE]})?${c[a.BUILD]}?)?)?`),p("XRANGE",`^${c[a.GTLT]}\\s*${c[a.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${c[a.GTLT]}\\s*${c[a.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${c[a.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",c[a.COERCEPLAIN]+`(?:${c[a.PRERELEASE]})?(?:${c[a.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",c[a.COERCE],!0),p("COERCERTLFULL",c[a.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${c[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${c[a.LONETILDE]}${c[a.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${c[a.LONETILDE]}${c[a.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${c[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${c[a.LONECARET]}${c[a.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${c[a.LONECARET]}${c[a.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${c[a.GTLT]}\\s*(${c[a.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${c[a.GTLT]}\\s*(${c[a.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${c[a.GTLT]}\\s*(${c[a.LOOSEPLAIN]}|${c[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${c[a.XRANGEPLAIN]})\\s+-\\s+(${c[a.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${c[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[a.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Le,Le.exports)),Le.exports}var nr,wt;function Jr(){if(wt)return nr;wt=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return nr=n=>n?typeof n!="object"?e:n:t,nr}var sr,Rt;function bn(){if(Rt)return sr;Rt=1;const e=/^[0-9]+$/,t=(n,s)=>{if(typeof n=="number"&&typeof s=="number")return n===s?0:n<s?-1:1;const u=e.test(n),i=e.test(s);return u&&i&&(n=+n,s=+s),n===s?0:u&&!i?-1:i&&!u?1:n<s?-1:1};return sr={compareIdentifiers:t,rcompareIdentifiers:(n,s)=>t(s,n)},sr}var ir,bt;function K(){if(bt)return ir;bt=1;const e=Ue(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=De(),{safeRe:n,t:s}=be(),u=Jr(),{compareIdentifiers:i}=bn();class o{constructor(l,a){if(a=u(a),l instanceof o){if(l.loose===!!a.loose&&l.includePrerelease===!!a.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",l,a),this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease;const f=l.trim().match(a.loose?n[s.LOOSE]:n[s.FULL]);if(!f)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const m=+d;if(m>=0&&m<r)return m}return d}):this.prerelease=[],this.build=f[5]?f[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(l){if(e("SemVer.compare",this.version,this.options,l),!(l instanceof o)){if(typeof l=="string"&&l===this.version)return 0;l=new o(l,this.options)}return l.version===this.version?0:this.compareMain(l)||this.comparePre(l)}compareMain(l){return l instanceof o||(l=new o(l,this.options)),this.major<l.major?-1:this.major>l.major?1:this.minor<l.minor?-1:this.minor>l.minor?1:this.patch<l.patch?-1:this.patch>l.patch?1:0}comparePre(l){if(l instanceof o||(l=new o(l,this.options)),this.prerelease.length&&!l.prerelease.length)return-1;if(!this.prerelease.length&&l.prerelease.length)return 1;if(!this.prerelease.length&&!l.prerelease.length)return 0;let a=0;do{const f=this.prerelease[a],d=l.prerelease[a];if(e("prerelease compare",a,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return i(f,d)}while(++a)}compareBuild(l){l instanceof o||(l=new o(l,this.options));let a=0;do{const f=this.build[a],d=l.build[a];if(e("build compare",a,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return i(f,d)}while(++a)}inc(l,a,f){if(l.startsWith("pre")){if(!a&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(a){const d=`-${a}`.match(this.options.loose?n[s.PRERELEASELOOSE]:n[s.PRERELEASE]);if(!d||d[1]!==a)throw new Error(`invalid identifier: ${a}`)}}switch(l){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",a,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",a,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",a,f),this.inc("pre",a,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",a,f),this.inc("pre",a,f);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const d=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let m=this.prerelease.length;for(;--m>=0;)typeof this.prerelease[m]=="number"&&(this.prerelease[m]++,m=-2);if(m===-1){if(a===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(a){let m=[a,d];f===!1&&(m=[a]),i(this.prerelease[0],a)===0?isNaN(this.prerelease[1])&&(this.prerelease=m):this.prerelease=m}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ir=o,ir}var or,It;function me(){if(It)return or;It=1;const e=K();return or=(r,n,s=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(u){if(!s)return null;throw u}},or}var ar,Ot;function fs(){if(Ot)return ar;Ot=1;const e=me();return ar=(r,n)=>{const s=e(r,n);return s?s.version:null},ar}var ur,Tt;function ds(){if(Tt)return ur;Tt=1;const e=me();return ur=(r,n)=>{const s=e(r.trim().replace(/^[=v]+/,""),n);return s?s.version:null},ur}var cr,xt;function hs(){if(xt)return cr;xt=1;const e=K();return cr=(r,n,s,u,i)=>{typeof s=="string"&&(i=u,u=s,s=void 0);try{return new e(r instanceof e?r.version:r,s).inc(n,u,i).version}catch{return null}},cr}var lr,St;function ps(){if(St)return lr;St=1;const e=me();return lr=(r,n)=>{const s=e(r,null,!0),u=e(n,null,!0),i=s.compare(u);if(i===0)return null;const o=i>0,c=o?s:u,l=o?u:s,a=!!c.prerelease.length;if(!!l.prerelease.length&&!a){if(!l.patch&&!l.minor)return"major";if(l.compareMain(c)===0)return l.minor&&!l.patch?"minor":"patch"}const d=a?"pre":"";return s.major!==u.major?d+"major":s.minor!==u.minor?d+"minor":s.patch!==u.patch?d+"patch":"prerelease"},lr}var fr,Pt;function ms(){if(Pt)return fr;Pt=1;const e=K();return fr=(r,n)=>new e(r,n).major,fr}var dr,Nt;function gs(){if(Nt)return dr;Nt=1;const e=K();return dr=(r,n)=>new e(r,n).minor,dr}var hr,At;function vs(){if(At)return hr;At=1;const e=K();return hr=(r,n)=>new e(r,n).patch,hr}var pr,kt;function ys(){if(kt)return pr;kt=1;const e=me();return pr=(r,n)=>{const s=e(r,n);return s&&s.prerelease.length?s.prerelease:null},pr}var mr,zt;function ee(){if(zt)return mr;zt=1;const e=K();return mr=(r,n,s)=>new e(r,s).compare(new e(n,s)),mr}var gr,Ct;function _s(){if(Ct)return gr;Ct=1;const e=ee();return gr=(r,n,s)=>e(n,r,s),gr}var vr,Lt;function $s(){if(Lt)return vr;Lt=1;const e=ee();return vr=(r,n)=>e(r,n,!0),vr}var yr,qt;function Hr(){if(qt)return yr;qt=1;const e=K();return yr=(r,n,s)=>{const u=new e(r,s),i=new e(n,s);return u.compare(i)||u.compareBuild(i)},yr}var _r,jt;function Es(){if(jt)return _r;jt=1;const e=Hr();return _r=(r,n)=>r.sort((s,u)=>e(s,u,n)),_r}var $r,Dt;function ws(){if(Dt)return $r;Dt=1;const e=Hr();return $r=(r,n)=>r.sort((s,u)=>e(u,s,n)),$r}var Er,Ut;function Me(){if(Ut)return Er;Ut=1;const e=ee();return Er=(r,n,s)=>e(r,n,s)>0,Er}var wr,Mt;function Yr(){if(Mt)return wr;Mt=1;const e=ee();return wr=(r,n,s)=>e(r,n,s)<0,wr}var Rr,Ft;function In(){if(Ft)return Rr;Ft=1;const e=ee();return Rr=(r,n,s)=>e(r,n,s)===0,Rr}var br,Gt;function On(){if(Gt)return br;Gt=1;const e=ee();return br=(r,n,s)=>e(r,n,s)!==0,br}var Ir,Vt;function Kr(){if(Vt)return Ir;Vt=1;const e=ee();return Ir=(r,n,s)=>e(r,n,s)>=0,Ir}var Or,Bt;function Wr(){if(Bt)return Or;Bt=1;const e=ee();return Or=(r,n,s)=>e(r,n,s)<=0,Or}var Tr,Zt;function Tn(){if(Zt)return Tr;Zt=1;const e=In(),t=On(),r=Me(),n=Kr(),s=Yr(),u=Wr();return Tr=(o,c,l,a)=>{switch(c){case"===":return typeof o=="object"&&(o=o.version),typeof l=="object"&&(l=l.version),o===l;case"!==":return typeof o=="object"&&(o=o.version),typeof l=="object"&&(l=l.version),o!==l;case"":case"=":case"==":return e(o,l,a);case"!=":return t(o,l,a);case">":return r(o,l,a);case">=":return n(o,l,a);case"<":return s(o,l,a);case"<=":return u(o,l,a);default:throw new TypeError(`Invalid operator: ${c}`)}},Tr}var xr,Xt;function Rs(){if(Xt)return xr;Xt=1;const e=K(),t=me(),{safeRe:r,t:n}=be();return xr=(u,i)=>{if(u instanceof e)return u;if(typeof u=="number"&&(u=String(u)),typeof u!="string")return null;i=i||{};let o=null;if(!i.rtl)o=u.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const m=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let h;for(;(h=m.exec(u))&&(!o||o.index+o[0].length!==u.length);)(!o||h.index+h[0].length!==o.index+o[0].length)&&(o=h),m.lastIndex=h.index+h[1].length+h[2].length;m.lastIndex=-1}if(o===null)return null;const c=o[2],l=o[3]||"0",a=o[4]||"0",f=i.includePrerelease&&o[5]?`-${o[5]}`:"",d=i.includePrerelease&&o[6]?`+${o[6]}`:"";return t(`${c}.${l}.${a}${f}${d}`,i)},xr}var Sr,Jt;function bs(){if(Jt)return Sr;Jt=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const u=this.map.keys().next().value;this.delete(u)}this.map.set(r,n)}return this}}return Sr=e,Sr}var Pr,Ht;function re(){if(Ht)return Pr;Ht=1;const e=/\s+/g;class t{constructor(_,x){if(x=s(x),_ instanceof t)return _.loose===!!x.loose&&_.includePrerelease===!!x.includePrerelease?_:new t(_.raw,x);if(_ instanceof u)return this.raw=_.value,this.set=[[_]],this.formatted=void 0,this;if(this.options=x,this.loose=!!x.loose,this.includePrerelease=!!x.includePrerelease,this.raw=_.trim().replace(e," "),this.set=this.raw.split("||").map(I=>this.parseRange(I.trim())).filter(I=>I.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const I=this.set[0];if(this.set=this.set.filter(S=>!p(S[0])),this.set.length===0)this.set=[I];else if(this.set.length>1){for(const S of this.set)if(S.length===1&&g(S[0])){this.set=[S];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let _=0;_<this.set.length;_++){_>0&&(this.formatted+="||");const x=this.set[_];for(let I=0;I<x.length;I++)I>0&&(this.formatted+=" "),this.formatted+=x[I].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(_){const I=((this.options.includePrerelease&&m)|(this.options.loose&&h))+":"+_,S=n.get(I);if(S)return S;const O=this.options.loose,A=O?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];_=_.replace(A,de(this.options.includePrerelease)),i("hyphen replace",_),_=_.replace(c[l.COMPARATORTRIM],a),i("comparator trim",_),_=_.replace(c[l.TILDETRIM],f),i("tilde trim",_),_=_.replace(c[l.CARETTRIM],d),i("caret trim",_);let j=_.split(" ").map(D=>E(D,this.options)).join(" ").split(/\s+/).map(D=>oe(D,this.options));O&&(j=j.filter(D=>(i("loose invalid filter",D,this.options),!!D.match(c[l.COMPARATORLOOSE])))),i("range list",j);const L=new Map,F=j.map(D=>new u(D,this.options));for(const D of F){if(p(D))return[D];L.set(D.value,D)}L.size>1&&L.has("")&&L.delete("");const J=[...L.values()];return n.set(I,J),J}intersects(_,x){if(!(_ instanceof t))throw new TypeError("a Range is required");return this.set.some(I=>v(I,x)&&_.set.some(S=>v(S,x)&&I.every(O=>S.every(A=>O.intersects(A,x)))))}test(_){if(!_)return!1;if(typeof _=="string")try{_=new o(_,this.options)}catch{return!1}for(let x=0;x<this.set.length;x++)if(he(this.set[x],_,this.options))return!0;return!1}}Pr=t;const r=bs(),n=new r,s=Jr(),u=Fe(),i=Ue(),o=K(),{safeRe:c,t:l,comparatorTrimReplace:a,tildeTrimReplace:f,caretTrimReplace:d}=be(),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:h}=De(),p=w=>w.value==="<0.0.0-0",g=w=>w.value==="",v=(w,_)=>{let x=!0;const I=w.slice();let S=I.pop();for(;x&&I.length;)x=I.every(O=>S.intersects(O,_)),S=I.pop();return x},E=(w,_)=>(w=w.replace(c[l.BUILD],""),i("comp",w,_),w=U(w,_),i("caret",w),w=q(w,_),i("tildes",w),w=C(w,_),i("xrange",w),w=ie(w,_),i("stars",w),w),y=w=>!w||w.toLowerCase()==="x"||w==="*",q=(w,_)=>w.trim().split(/\s+/).map(x=>M(x,_)).join(" "),M=(w,_)=>{const x=_.loose?c[l.TILDELOOSE]:c[l.TILDE];return w.replace(x,(I,S,O,A,j)=>{i("tilde",w,I,S,O,A,j);let L;return y(S)?L="":y(O)?L=`>=${S}.0.0 <${+S+1}.0.0-0`:y(A)?L=`>=${S}.${O}.0 <${S}.${+O+1}.0-0`:j?(i("replaceTilde pr",j),L=`>=${S}.${O}.${A}-${j} <${S}.${+O+1}.0-0`):L=`>=${S}.${O}.${A} <${S}.${+O+1}.0-0`,i("tilde return",L),L})},U=(w,_)=>w.trim().split(/\s+/).map(x=>B(x,_)).join(" "),B=(w,_)=>{i("caret",w,_);const x=_.loose?c[l.CARETLOOSE]:c[l.CARET],I=_.includePrerelease?"-0":"";return w.replace(x,(S,O,A,j,L)=>{i("caret",w,S,O,A,j,L);let F;return y(O)?F="":y(A)?F=`>=${O}.0.0${I} <${+O+1}.0.0-0`:y(j)?O==="0"?F=`>=${O}.${A}.0${I} <${O}.${+A+1}.0-0`:F=`>=${O}.${A}.0${I} <${+O+1}.0.0-0`:L?(i("replaceCaret pr",L),O==="0"?A==="0"?F=`>=${O}.${A}.${j}-${L} <${O}.${A}.${+j+1}-0`:F=`>=${O}.${A}.${j}-${L} <${O}.${+A+1}.0-0`:F=`>=${O}.${A}.${j}-${L} <${+O+1}.0.0-0`):(i("no pr"),O==="0"?A==="0"?F=`>=${O}.${A}.${j}${I} <${O}.${A}.${+j+1}-0`:F=`>=${O}.${A}.${j}${I} <${O}.${+A+1}.0-0`:F=`>=${O}.${A}.${j} <${+O+1}.0.0-0`),i("caret return",F),F})},C=(w,_)=>(i("replaceXRanges",w,_),w.split(/\s+/).map(x=>te(x,_)).join(" ")),te=(w,_)=>{w=w.trim();const x=_.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return w.replace(x,(I,S,O,A,j,L)=>{i("xRange",w,I,S,O,A,j,L);const F=y(O),J=F||y(A),D=J||y(j),ne=D;return S==="="&&ne&&(S=""),L=_.includePrerelease?"-0":"",F?S===">"||S==="<"?I="<0.0.0-0":I="*":S&&ne?(J&&(A=0),j=0,S===">"?(S=">=",J?(O=+O+1,A=0,j=0):(A=+A+1,j=0)):S==="<="&&(S="<",J?O=+O+1:A=+A+1),S==="<"&&(L="-0"),I=`${S+O}.${A}.${j}${L}`):J?I=`>=${O}.0.0${L} <${+O+1}.0.0-0`:D&&(I=`>=${O}.${A}.0${L} <${O}.${+A+1}.0-0`),i("xRange return",I),I})},ie=(w,_)=>(i("replaceStars",w,_),w.trim().replace(c[l.STAR],"")),oe=(w,_)=>(i("replaceGTE0",w,_),w.trim().replace(c[_.includePrerelease?l.GTE0PRE:l.GTE0],"")),de=w=>(_,x,I,S,O,A,j,L,F,J,D,ne)=>(y(I)?x="":y(S)?x=`>=${I}.0.0${w?"-0":""}`:y(O)?x=`>=${I}.${S}.0${w?"-0":""}`:A?x=`>=${x}`:x=`>=${x}${w?"-0":""}`,y(F)?L="":y(J)?L=`<${+F+1}.0.0-0`:y(D)?L=`<${F}.${+J+1}.0-0`:ne?L=`<=${F}.${J}.${D}-${ne}`:w?L=`<${F}.${J}.${+D+1}-0`:L=`<=${L}`,`${x} ${L}`.trim()),he=(w,_,x)=>{for(let I=0;I<w.length;I++)if(!w[I].test(_))return!1;if(_.prerelease.length&&!x.includePrerelease){for(let I=0;I<w.length;I++)if(i(w[I].semver),w[I].semver!==u.ANY&&w[I].semver.prerelease.length>0){const S=w[I].semver;if(S.major===_.major&&S.minor===_.minor&&S.patch===_.patch)return!0}return!1}return!0};return Pr}var Nr,Yt;function Fe(){if(Yt)return Nr;Yt=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(a,f){if(f=r(f),a instanceof t){if(a.loose===!!f.loose)return a;a=a.value}a=a.trim().split(/\s+/).join(" "),i("comparator",a,f),this.options=f,this.loose=!!f.loose,this.parse(a),this.semver===e?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}parse(a){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],d=a.match(f);if(!d)throw new TypeError(`Invalid comparator: ${a}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new o(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(a){if(i("Comparator.test",a,this.options.loose),this.semver===e||a===e)return!0;if(typeof a=="string")try{a=new o(a,this.options)}catch{return!1}return u(a,this.operator,this.semver,this.options)}intersects(a,f){if(!(a instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(a.value,f).test(this.value):a.operator===""?a.value===""?!0:new c(this.value,f).test(a.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||a.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||a.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&a.operator.startsWith(">")||this.operator.startsWith("<")&&a.operator.startsWith("<")||this.semver.version===a.semver.version&&this.operator.includes("=")&&a.operator.includes("=")||u(this.semver,"<",a.semver,f)&&this.operator.startsWith(">")&&a.operator.startsWith("<")||u(this.semver,">",a.semver,f)&&this.operator.startsWith("<")&&a.operator.startsWith(">")))}}Nr=t;const r=Jr(),{safeRe:n,t:s}=be(),u=Tn(),i=Ue(),o=K(),c=re();return Nr}var Ar,Kt;function Ge(){if(Kt)return Ar;Kt=1;const e=re();return Ar=(r,n,s)=>{try{n=new e(n,s)}catch{return!1}return n.test(r)},Ar}var kr,Wt;function Is(){if(Wt)return kr;Wt=1;const e=re();return kr=(r,n)=>new e(r,n).set.map(s=>s.map(u=>u.value).join(" ").trim().split(" ")),kr}var zr,Qt;function Os(){if(Qt)return zr;Qt=1;const e=K(),t=re();return zr=(n,s,u)=>{let i=null,o=null,c=null;try{c=new t(s,u)}catch{return null}return n.forEach(l=>{c.test(l)&&(!i||o.compare(l)===-1)&&(i=l,o=new e(i,u))}),i},zr}var Cr,en;function Ts(){if(en)return Cr;en=1;const e=K(),t=re();return Cr=(n,s,u)=>{let i=null,o=null,c=null;try{c=new t(s,u)}catch{return null}return n.forEach(l=>{c.test(l)&&(!i||o.compare(l)===1)&&(i=l,o=new e(i,u))}),i},Cr}var Lr,rn;function xs(){if(rn)return Lr;rn=1;const e=K(),t=re(),r=Me();return Lr=(s,u)=>{s=new t(s,u);let i=new e("0.0.0");if(s.test(i)||(i=new e("0.0.0-0"),s.test(i)))return i;i=null;for(let o=0;o<s.set.length;++o){const c=s.set[o];let l=null;c.forEach(a=>{const f=new e(a.semver.version);switch(a.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!l||r(f,l))&&(l=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),l&&(!i||r(i,l))&&(i=l)}return i&&s.test(i)?i:null},Lr}var qr,tn;function Ss(){if(tn)return qr;tn=1;const e=re();return qr=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},qr}var jr,nn;function Qr(){if(nn)return jr;nn=1;const e=K(),t=Fe(),{ANY:r}=t,n=re(),s=Ge(),u=Me(),i=Yr(),o=Wr(),c=Kr();return jr=(a,f,d,m)=>{a=new e(a,m),f=new n(f,m);let h,p,g,v,E;switch(d){case">":h=u,p=o,g=i,v=">",E=">=";break;case"<":h=i,p=c,g=u,v="<",E="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(a,f,m))return!1;for(let y=0;y<f.set.length;++y){const q=f.set[y];let M=null,U=null;if(q.forEach(B=>{B.semver===r&&(B=new t(">=0.0.0")),M=M||B,U=U||B,h(B.semver,M.semver,m)?M=B:g(B.semver,U.semver,m)&&(U=B)}),M.operator===v||M.operator===E||(!U.operator||U.operator===v)&&p(a,U.semver))return!1;if(U.operator===E&&g(a,U.semver))return!1}return!0},jr}var Dr,sn;function Ps(){if(sn)return Dr;sn=1;const e=Qr();return Dr=(r,n,s)=>e(r,n,">",s),Dr}var Ur,on;function Ns(){if(on)return Ur;on=1;const e=Qr();return Ur=(r,n,s)=>e(r,n,"<",s),Ur}var Mr,an;function As(){if(an)return Mr;an=1;const e=re();return Mr=(r,n,s)=>(r=new e(r,s),n=new e(n,s),r.intersects(n,s)),Mr}var Fr,un;function ks(){if(un)return Fr;un=1;const e=Ge(),t=ee();return Fr=(r,n,s)=>{const u=[];let i=null,o=null;const c=r.sort((d,m)=>t(d,m,s));for(const d of c)e(d,n,s)?(o=d,i||(i=d)):(o&&u.push([i,o]),o=null,i=null);i&&u.push([i,null]);const l=[];for(const[d,m]of u)d===m?l.push(d):!m&&d===c[0]?l.push("*"):m?d===c[0]?l.push(`<=${m}`):l.push(`${d} - ${m}`):l.push(`>=${d}`);const a=l.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return a.length<f.length?a:n},Fr}var Gr,cn;function zs(){if(cn)return Gr;cn=1;const e=re(),t=Fe(),{ANY:r}=t,n=Ge(),s=ee(),u=(f,d,m={})=>{if(f===d)return!0;f=new e(f,m),d=new e(d,m);let h=!1;e:for(const p of f.set){for(const g of d.set){const v=c(p,g,m);if(h=h||v!==null,v)continue e}if(h)return!1}return!0},i=[new t(">=0.0.0-0")],o=[new t(">=0.0.0")],c=(f,d,m)=>{if(f===d)return!0;if(f.length===1&&f[0].semver===r){if(d.length===1&&d[0].semver===r)return!0;m.includePrerelease?f=i:f=o}if(d.length===1&&d[0].semver===r){if(m.includePrerelease)return!0;d=o}const h=new Set;let p,g;for(const C of f)C.operator===">"||C.operator===">="?p=l(p,C,m):C.operator==="<"||C.operator==="<="?g=a(g,C,m):h.add(C.semver);if(h.size>1)return null;let v;if(p&&g){if(v=s(p.semver,g.semver,m),v>0)return null;if(v===0&&(p.operator!==">="||g.operator!=="<="))return null}for(const C of h){if(p&&!n(C,String(p),m)||g&&!n(C,String(g),m))return null;for(const te of d)if(!n(C,String(te),m))return!1;return!0}let E,y,q,M,U=g&&!m.includePrerelease&&g.semver.prerelease.length?g.semver:!1,B=p&&!m.includePrerelease&&p.semver.prerelease.length?p.semver:!1;U&&U.prerelease.length===1&&g.operator==="<"&&U.prerelease[0]===0&&(U=!1);for(const C of d){if(M=M||C.operator===">"||C.operator===">=",q=q||C.operator==="<"||C.operator==="<=",p){if(B&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===B.major&&C.semver.minor===B.minor&&C.semver.patch===B.patch&&(B=!1),C.operator===">"||C.operator===">="){if(E=l(p,C,m),E===C&&E!==p)return!1}else if(p.operator===">="&&!n(p.semver,String(C),m))return!1}if(g){if(U&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===U.major&&C.semver.minor===U.minor&&C.semver.patch===U.patch&&(U=!1),C.operator==="<"||C.operator==="<="){if(y=a(g,C,m),y===C&&y!==g)return!1}else if(g.operator==="<="&&!n(g.semver,String(C),m))return!1}if(!C.operator&&(g||p)&&v!==0)return!1}return!(p&&q&&!g&&v!==0||g&&M&&!p&&v!==0||B||U)},l=(f,d,m)=>{if(!f)return d;const h=s(f.semver,d.semver,m);return h>0?f:h<0||d.operator===">"&&f.operator===">="?d:f},a=(f,d,m)=>{if(!f)return d;const h=s(f.semver,d.semver,m);return h<0?f:h>0||d.operator==="<"&&f.operator==="<="?d:f};return Gr=u,Gr}var Vr,ln;function Cs(){if(ln)return Vr;ln=1;const e=be(),t=De(),r=K(),n=bn(),s=me(),u=fs(),i=ds(),o=hs(),c=ps(),l=ms(),a=gs(),f=vs(),d=ys(),m=ee(),h=_s(),p=$s(),g=Hr(),v=Es(),E=ws(),y=Me(),q=Yr(),M=In(),U=On(),B=Kr(),C=Wr(),te=Tn(),ie=Rs(),oe=Fe(),de=re(),he=Ge(),w=Is(),_=Os(),x=Ts(),I=xs(),S=Ss(),O=Qr(),A=Ps(),j=Ns(),L=As(),F=ks(),J=zs();return Vr={parse:s,valid:u,clean:i,inc:o,diff:c,major:l,minor:a,patch:f,prerelease:d,compare:m,rcompare:h,compareLoose:p,compareBuild:g,sort:v,rsort:E,gt:y,lt:q,eq:M,neq:U,gte:B,lte:C,cmp:te,coerce:ie,Comparator:oe,Range:de,satisfies:he,toComparators:w,maxSatisfying:_,minSatisfying:x,minVersion:I,validRange:S,outside:O,gtr:A,ltr:j,intersects:L,simplifyRange:F,subset:J,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},Vr}Cs();var je={exports:{}};je.exports;var fn;function Ls(){return fn||(fn=1,(function(e){const r=(u=0)=>i=>`\x1B[${38+u};5;${i}m`,n=(u=0)=>(i,o,c)=>`\x1B[${38+u};2;${i};${o};${c}m`;function s(){const u=new Map,i={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};i.color.gray=i.color.blackBright,i.bgColor.bgGray=i.bgColor.bgBlackBright,i.color.grey=i.color.blackBright,i.bgColor.bgGrey=i.bgColor.bgBlackBright;for(const[o,c]of Object.entries(i)){for(const[l,a]of Object.entries(c))i[l]={open:`\x1B[${a[0]}m`,close:`\x1B[${a[1]}m`},c[l]=i[l],u.set(a[0],a[1]);Object.defineProperty(i,o,{value:c,enumerable:!1})}return Object.defineProperty(i,"codes",{value:u,enumerable:!1}),i.color.close="\x1B[39m",i.bgColor.close="\x1B[49m",i.color.ansi256=r(),i.color.ansi16m=n(),i.bgColor.ansi256=r(10),i.bgColor.ansi16m=n(10),Object.defineProperties(i,{rgbToAnsi256:{value:(o,c,l)=>o===c&&c===l?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(c/255*5)+Math.round(l/255*5),enumerable:!1},hexToRgb:{value:o=>{const c=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(o.toString(16));if(!c)return[0,0,0];let{colorString:l}=c.groups;l.length===3&&(l=l.split("").map(f=>f+f).join(""));const a=Number.parseInt(l,16);return[a>>16&255,a>>8&255,a&255]},enumerable:!1},hexToAnsi256:{value:o=>i.rgbToAnsi256(...i.hexToRgb(o)),enumerable:!1}}),i}Object.defineProperty(e,"exports",{enumerable:!0,get:s})})(je)),je.exports}var qs=Ls();const Ki=pe(qs);function G(e,t,r){function n(o,c){var l;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(l=o._zod).traits??(l.traits=new Set),o._zod.traits.add(e),t(o,c);for(const a in i.prototype)a in o||Object.defineProperty(o,a,{value:i.prototype[a].bind(o)});o._zod.constr=i,o._zod.def=c}const s=r?.Parent??Object;class u extends s{}Object.defineProperty(u,"name",{value:e});function i(o){var c;const l=r?.Parent?new u:this;n(l,o),(c=l._zod).deferred??(c.deferred=[]);for(const a of l._zod.deferred)a();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Re extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const js={};function le(e){return js}function Ds(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function Us(e,t){return typeof t=="bigint"?t.toString():t}function et(e){return e==null}function rt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Z(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ms(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}const xn=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Br(e){if(dn(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(dn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Sn(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function ge(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Wi(e,t){if(!Br(t))throw new Error("Invalid input to extend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ms(this,"shape",n),n},checks:[]};return Sn(e,r)}function Qi(e,t,r){const n=t._zod.def.shape,s={...n};for(const u in n)s[u]=e?new e({type:"optional",innerType:n[u]}):n[u];return Sn(t,{...t._zod.def,shape:s,checks:[]})}function Ee(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Fs(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function qe(e){return typeof e=="string"?e:e?.message}function fe(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=qe(e.inst?._zod.def?.error?.(e))??qe(t?.error?.(e))??qe(r.customError?.(e))??qe(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function tt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Gs(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Pn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Us,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Vs=G("$ZodError",Pn),Ve=G("$ZodError",Pn,{Parent:Error});function eo(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function ro(e,t){const r=t||function(u){return u.message},n={_errors:[]},s=u=>{for(const i of u.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>s({issues:o}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(e),n}function Bs(e){const t=[];for(const r of e)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function to(e){const t=[],r=[...e.issues].sort((n,s)=>n.path.length-s.path.length);for(const n of r)t.push(`✖ ${n.message}`),n.path?.length&&t.push(` → at ${Bs(n.path)}`);return t.join(`
1
+ import{g as pe}from"./index-CFpQGWTL.js";import{r as Ln}from"./index-DRz5BQNA.js";var Xe,ot;function qn(){return ot||(ot=1,Xe=function(e,t){if(typeof e!="string")throw new TypeError("Expected a string");return t=typeof t>"u"?"_":t,e.replace(/([a-z\d])([A-Z])/g,"$1"+t+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+t+"$2").toLowerCase()}),Xe}var jn=qn();const Bi=pe(jn);var Ne={exports:{}},at;function Dn(){if(at)return Ne.exports;at=1;const e=/[\p{Lu}]/u,t=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,s=/[_.\- ]+/,u=new RegExp("^"+s.source),i=new RegExp(s.source+n.source,"gu"),o=new RegExp("\\d+"+n.source,"gu"),c=(d,m,h)=>{let p=!1,g=!1,v=!1;for(let E=0;E<d.length;E++){const y=d[E];p&&e.test(y)?(d=d.slice(0,E)+"-"+d.slice(E),p=!1,v=g,g=!0,E++):g&&v&&t.test(y)?(d=d.slice(0,E-1)+"-"+d.slice(E-1),v=g,g=!1,p=!0):(p=m(y)===y&&h(y)!==y,v=g,g=h(y)===y&&m(y)!==y)}return d},l=(d,m)=>(r.lastIndex=0,d.replace(r,h=>m(h))),a=(d,m)=>(i.lastIndex=0,o.lastIndex=0,d.replace(i,(h,p)=>m(p)).replace(o,h=>m(h))),f=(d,m)=>{if(!(typeof d=="string"||Array.isArray(d)))throw new TypeError("Expected the input to be `string | string[]`");if(m={pascalCase:!1,preserveConsecutiveUppercase:!1,...m},Array.isArray(d)?d=d.map(v=>v.trim()).filter(v=>v.length).join("-"):d=d.trim(),d.length===0)return"";const h=m.locale===!1?v=>v.toLowerCase():v=>v.toLocaleLowerCase(m.locale),p=m.locale===!1?v=>v.toUpperCase():v=>v.toLocaleUpperCase(m.locale);return d.length===1?m.pascalCase?p(d):h(d):(d!==h(d)&&(d=c(d,h,p)),d=d.replace(u,""),m.preserveConsecutiveUppercase?d=l(d,h):d=h(d),m.pascalCase&&(d=p(d.charAt(0))+d.slice(1)),a(d,p))};return Ne.exports=f,Ne.exports.default=f,Ne.exports}var Un=Dn();const Zi=pe(Un),Mn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Fn(e){return typeof e=="string"&&Mn.test(e)}function Gn(e){if(!Fn(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var H=[];for(var Je=0;Je<256;++Je)H.push((Je+256).toString(16).slice(1));function Rn(e,t=0){return(H[e[t+0]]+H[e[t+1]]+H[e[t+2]]+H[e[t+3]]+"-"+H[e[t+4]]+H[e[t+5]]+"-"+H[e[t+6]]+H[e[t+7]]+"-"+H[e[t+8]]+H[e[t+9]]+"-"+H[e[t+10]]+H[e[t+11]]+H[e[t+12]]+H[e[t+13]]+H[e[t+14]]+H[e[t+15]]).toLowerCase()}var Ae,Vn=new Uint8Array(16);function Bn(){if(!Ae&&(Ae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ae(Vn)}function Zn(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Xn="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Jn="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Hn(e,t,r){function n(s,u,i,o){var c;if(typeof s=="string"&&(s=Zn(s)),typeof u=="string"&&(u=Gn(u)),((c=u)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+s.length);if(l.set(u),l.set(s,u.length),l=r(l),l[6]=l[6]&15|t,l[8]=l[8]&63|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=l[a];return i}return Rn(l)}try{n.name=e}catch{}return n.DNS=Xn,n.URL=Jn,n}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const ut={randomUUID:Yn};function Xi(e,t,r){if(ut.randomUUID&&!e)return ut.randomUUID();e=e||{};var n=e.random||(e.rng||Bn)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Rn(n)}function Kn(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function He(e,t){return e<<t|e>>>32-t}function Wn(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var n=unescape(encodeURIComponent(e));e=[];for(var s=0;s<n.length;++s)e.push(n.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var u=e.length/4+2,i=Math.ceil(u/16),o=new Array(i),c=0;c<i;++c){for(var l=new Uint32Array(16),a=0;a<16;++a)l[a]=e[c*64+a*4]<<24|e[c*64+a*4+1]<<16|e[c*64+a*4+2]<<8|e[c*64+a*4+3];o[c]=l}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(var f=0;f<i;++f){for(var d=new Uint32Array(80),m=0;m<16;++m)d[m]=o[f][m];for(var h=16;h<80;++h)d[h]=He(d[h-3]^d[h-8]^d[h-14]^d[h-16],1);for(var p=r[0],g=r[1],v=r[2],E=r[3],y=r[4],q=0;q<80;++q){var M=Math.floor(q/20),U=He(p,5)+Kn(M,g,v,E)+y+t[M]+d[q]>>>0;y=E,E=v,v=He(g,30)>>>0,g=p,p=U}r[0]=r[0]+p>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+E>>>0,r[4]=r[4]+y>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Ji=Hn("v5",80,Wn),_e={exports:{}},Ye={},Ke,ct;function Qn(){if(ct)return Ke;ct=1;function e(t,r){typeof r=="boolean"&&(r={forever:r}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=r||{},this._maxRetryTime=r&&r.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 Ke=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 r=new Date().getTime();if(t&&r-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var s=this;return this._timer=setTimeout(function(){s._attempts++,s._operationTimeoutCb&&(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref&&s._timeout.unref()),s._fn(s._attempts)},n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,r){this._fn=t,r&&(r.timeout&&(this._operationTimeout=r.timeout),r.cb&&(this._operationTimeoutCb=r.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._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={},r=null,n=0,s=0;s<this._errors.length;s++){var u=this._errors[s],i=u.message,o=(t[i]||0)+1;t[i]=o,o>=n&&(r=u,n=o)}return r},Ke}var lt;function es(){return lt||(lt=1,(function(e){var t=Qn();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var s in r)n[s]=r[s];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var u=[],i=0;i<n.retries;i++)u.push(this.createTimeout(i,n));return r&&r.forever&&!u.length&&u.push(this.createTimeout(i,n)),u.sort(function(o,c){return o-c}),u},e.createTimeout=function(r,n){var s=n.randomize?Math.random()+1:1,u=Math.round(s*Math.max(n.minTimeout,1)*Math.pow(n.factor,r));return u=Math.min(u,n.maxTimeout),u},e.wrap=function(r,n,s){if(n instanceof Array&&(s=n,n=null),!s){s=[];for(var u in r)typeof r[u]=="function"&&s.push(u)}for(var i=0;i<s.length;i++){var o=s[i],c=r[o];r[o]=(function(a){var f=e.operation(n),d=Array.prototype.slice.call(arguments,1),m=d.pop();d.push(function(h){f.retry(h)||(h&&(arguments[0]=f.mainError()),m.apply(this,arguments))}),f.attempt(function(){a.apply(r,d)})}).bind(r,c),r[o].options=n}}})(Ye)),Ye}var We,ft;function rs(){return ft||(ft=1,We=es()),We}var dt;function ts(){if(dt)return _e.exports;dt=1;const e=rs(),t=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class r extends Error{constructor(o){super(),o instanceof Error?(this.originalError=o,{message:o}=o):(this.originalError=new Error(o),this.originalError.stack=this.stack),this.name="AbortError",this.message=o}}const n=(i,o,c)=>{const l=c.retries-(o-1);return i.attemptNumber=o,i.retriesLeft=l,i},s=i=>t.includes(i),u=(i,o)=>new Promise((c,l)=>{o={onFailedAttempt:()=>{},retries:10,...o};const a=e.operation(o);a.attempt(async f=>{try{c(await i(f))}catch(d){if(!(d instanceof Error)){l(new TypeError(`Non-error was thrown: "${d}". You should only throw errors.`));return}if(d instanceof r)a.stop(),l(d.originalError);else if(d instanceof TypeError&&!s(d.message))a.stop(),l(d);else{n(d,f,o);try{await o.onFailedAttempt(d)}catch(m){l(m);return}a.retry(d)||l(a.mainError())}}})});return _e.exports=u,_e.exports.default=u,_e.exports.AbortError=r,_e.exports}var ns=ts();const Hi=pe(ns);var ke={},Qe={exports:{}},ht;function ss(){return ht||(ht=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,l,a){this.fn=c,this.context=l,this.once=a||!1}function u(c,l,a,f,d){if(typeof a!="function")throw new TypeError("The listener must be a function");var m=new s(a,f||c,d),h=r?r+l:l;return c._events[h]?c._events[h].fn?c._events[h]=[c._events[h],m]:c._events[h].push(m):(c._events[h]=m,c._eventsCount++),c}function i(c,l){--c._eventsCount===0?c._events=new n:delete c._events[l]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],a,f;if(this._eventsCount===0)return l;for(f in a=this._events)t.call(a,f)&&l.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(a)):l},o.prototype.listeners=function(l){var a=r?r+l:l,f=this._events[a];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,m=f.length,h=new Array(m);d<m;d++)h[d]=f[d].fn;return h},o.prototype.listenerCount=function(l){var a=r?r+l:l,f=this._events[a];return f?f.fn?1:f.length:0},o.prototype.emit=function(l,a,f,d,m,h){var p=r?r+l:l;if(!this._events[p])return!1;var g=this._events[p],v=arguments.length,E,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,a),!0;case 3:return g.fn.call(g.context,a,f),!0;case 4:return g.fn.call(g.context,a,f,d),!0;case 5:return g.fn.call(g.context,a,f,d,m),!0;case 6:return g.fn.call(g.context,a,f,d,m,h),!0}for(y=1,E=new Array(v-1);y<v;y++)E[y-1]=arguments[y];g.fn.apply(g.context,E)}else{var q=g.length,M;for(y=0;y<q;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),v){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,a);break;case 3:g[y].fn.call(g[y].context,a,f);break;case 4:g[y].fn.call(g[y].context,a,f,d);break;default:if(!E)for(M=1,E=new Array(v-1);M<v;M++)E[M-1]=arguments[M];g[y].fn.apply(g[y].context,E)}}return!0},o.prototype.on=function(l,a,f){return u(this,l,a,f,!1)},o.prototype.once=function(l,a,f){return u(this,l,a,f,!0)},o.prototype.removeListener=function(l,a,f,d){var m=r?r+l:l;if(!this._events[m])return this;if(!a)return i(this,m),this;var h=this._events[m];if(h.fn)h.fn===a&&(!d||h.once)&&(!f||h.context===f)&&i(this,m);else{for(var p=0,g=[],v=h.length;p<v;p++)(h[p].fn!==a||d&&!h[p].once||f&&h[p].context!==f)&&g.push(h[p]);g.length?this._events[m]=g.length===1?g[0]:g:i(this,m)}return this},o.prototype.removeAllListeners=function(l){var a;return l?(a=r?r+l:l,this._events[a]&&i(this,a)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o})(Qe)),Qe.exports}var $e={exports:{}},er,pt;function is(){return pt||(pt=1,er=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))),er}var mt;function os(){if(mt)return $e.exports;mt=1;const e=is();class t extends Error{constructor(s){super(s),this.name="TimeoutError"}}const r=(n,s,u)=>new Promise((i,o)=>{if(typeof s!="number"||s<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(s===1/0){i(n);return}const c=setTimeout(()=>{if(typeof u=="function"){try{i(u())}catch(f){o(f)}return}const l=typeof u=="string"?u:`Promise timed out after ${s} milliseconds`,a=u instanceof Error?u:new t(l);typeof n.cancel=="function"&&n.cancel(),o(a)},s);e(n.then(i,o),()=>{clearTimeout(c)})});return $e.exports=r,$e.exports.default=r,$e.exports.TimeoutError=t,$e.exports}var ze={},Ce={},gt;function as(){if(gt)return Ce;gt=1,Object.defineProperty(Ce,"__esModule",{value:!0});function e(t,r,n){let s=0,u=t.length;for(;u>0;){const i=u/2|0;let o=s+i;n(t[o],r)<=0?(s=++o,u-=i+1):u=i}return s}return Ce.default=e,Ce}var vt;function us(){if(vt)return ze;vt=1,Object.defineProperty(ze,"__esModule",{value:!0});const e=as();class t{constructor(){this._queue=[]}enqueue(n,s){s=Object.assign({priority:0},s);const u={priority:s.priority,run:n};if(this.size&&this._queue[this.size-1].priority>=s.priority){this._queue.push(u);return}const i=e.default(this._queue,u,(o,c)=>c.priority-o.priority);this._queue.splice(i,0,u)}dequeue(){const n=this._queue.shift();return n?.run}filter(n){return this._queue.filter(s=>s.priority===n.priority).map(s=>s.run)}get size(){return this._queue.length}}return ze.default=t,ze}var yt;function cs(){if(yt)return ke;yt=1,Object.defineProperty(ke,"__esModule",{value:!0});const e=ss(),t=os(),r=us(),n=()=>{},s=new t.TimeoutError;class u extends e{constructor(o){var c,l,a,f;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=n,this._resolveIdle=n,o=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:r.default},o),!(typeof o.intervalCap=="number"&&o.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(l=(c=o.intervalCap)===null||c===void 0?void 0:c.toString())!==null&&l!==void 0?l:""}\` (${typeof o.intervalCap})`);if(o.interval===void 0||!(Number.isFinite(o.interval)&&o.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(f=(a=o.interval)===null||a===void 0?void 0:a.toString())!==null&&f!==void 0?f:""}\` (${typeof o.interval})`);this._carryoverConcurrencyCount=o.carryoverConcurrencyCount,this._isIntervalIgnored=o.intervalCap===1/0||o.interval===0,this._intervalCap=o.intervalCap,this._interval=o.interval,this._queue=new o.queueClass,this._queueClass=o.queueClass,this.concurrency=o.concurrency,this._timeout=o.timeout,this._throwOnTimeout=o.throwOnTimeout===!0,this._isPaused=o.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=n,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=n,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const o=Date.now();if(this._intervalId===void 0){const c=this._intervalEnd-o;if(c<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},c)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const o=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const c=this._queue.dequeue();return c?(this.emit("active"),c(),o&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(o){if(!(typeof o=="number"&&o>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);this._concurrency=o,this._processQueue()}async add(o,c={}){return new Promise((l,a)=>{const f=async()=>{this._pendingCount++,this._intervalCount++;try{const d=this._timeout===void 0&&c.timeout===void 0?o():t.default(Promise.resolve(o()),c.timeout===void 0?this._timeout:c.timeout,()=>{(c.throwOnTimeout===void 0?this._throwOnTimeout:c.throwOnTimeout)&&a(s)});l(await d)}catch(d){a(d)}this._next()};this._queue.enqueue(f,c),this._tryToStartAnother(),this.emit("add")})}async addAll(o,c){return Promise.all(o.map(async l=>this.add(l,c)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(o=>{const c=this._resolveEmpty;this._resolveEmpty=()=>{c(),o()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(o=>{const c=this._resolveIdle;this._resolveIdle=()=>{c(),o()}})}get size(){return this._queue.size}sizeBy(o){return this._queue.filter(o).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(o){this._timeout=o}}return ke.default=u,ke}var ls=cs();const Yi=pe(ls);var Le={exports:{}},rr,_t;function De(){if(_t)return rr;_t=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,s=t-6;return rr={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rr}var tr,$t;function Ue(){if($t)return tr;$t=1;var e={};return tr=typeof process=="object"&&e&&e.NODE_DEBUG&&/\bsemver\b/i.test(e.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},tr}var Et;function be(){return Et||(Et=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=De(),u=Ue();t=e.exports={};const i=t.re=[],o=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],a=t.t={};let f=0;const d="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",s],[d,n]],h=g=>{for(const[v,E]of m)g=g.split(`${v}*`).join(`${v}{0,${E}}`).split(`${v}+`).join(`${v}{1,${E}}`);return g},p=(g,v,E)=>{const y=h(v),q=f++;u(g,q,v),a[g]=q,c[q]=v,l[q]=y,i[q]=new RegExp(v,E?"g":void 0),o[q]=new RegExp(y,E?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),p("MAINVERSION",`(${c[a.NUMERICIDENTIFIER]})\\.(${c[a.NUMERICIDENTIFIER]})\\.(${c[a.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${c[a.NUMERICIDENTIFIERLOOSE]})\\.(${c[a.NUMERICIDENTIFIERLOOSE]})\\.(${c[a.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${c[a.NONNUMERICIDENTIFIER]}|${c[a.NUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${c[a.NONNUMERICIDENTIFIER]}|${c[a.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASE",`(?:-(${c[a.PRERELEASEIDENTIFIER]}(?:\\.${c[a.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${c[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[a.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${d}+`),p("BUILD",`(?:\\+(${c[a.BUILDIDENTIFIER]}(?:\\.${c[a.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${c[a.MAINVERSION]}${c[a.PRERELEASE]}?${c[a.BUILD]}?`),p("FULL",`^${c[a.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${c[a.MAINVERSIONLOOSE]}${c[a.PRERELEASELOOSE]}?${c[a.BUILD]}?`),p("LOOSE",`^${c[a.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${c[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${c[a.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${c[a.XRANGEIDENTIFIER]})(?:\\.(${c[a.XRANGEIDENTIFIER]})(?:\\.(${c[a.XRANGEIDENTIFIER]})(?:${c[a.PRERELEASE]})?${c[a.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${c[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[a.XRANGEIDENTIFIERLOOSE]})(?:${c[a.PRERELEASELOOSE]})?${c[a.BUILD]}?)?)?`),p("XRANGE",`^${c[a.GTLT]}\\s*${c[a.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${c[a.GTLT]}\\s*${c[a.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${c[a.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",c[a.COERCEPLAIN]+`(?:${c[a.PRERELEASE]})?(?:${c[a.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",c[a.COERCE],!0),p("COERCERTLFULL",c[a.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${c[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${c[a.LONETILDE]}${c[a.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${c[a.LONETILDE]}${c[a.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${c[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${c[a.LONECARET]}${c[a.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${c[a.LONECARET]}${c[a.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${c[a.GTLT]}\\s*(${c[a.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${c[a.GTLT]}\\s*(${c[a.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${c[a.GTLT]}\\s*(${c[a.LOOSEPLAIN]}|${c[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${c[a.XRANGEPLAIN]})\\s+-\\s+(${c[a.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${c[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[a.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Le,Le.exports)),Le.exports}var nr,wt;function Jr(){if(wt)return nr;wt=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return nr=n=>n?typeof n!="object"?e:n:t,nr}var sr,Rt;function bn(){if(Rt)return sr;Rt=1;const e=/^[0-9]+$/,t=(n,s)=>{if(typeof n=="number"&&typeof s=="number")return n===s?0:n<s?-1:1;const u=e.test(n),i=e.test(s);return u&&i&&(n=+n,s=+s),n===s?0:u&&!i?-1:i&&!u?1:n<s?-1:1};return sr={compareIdentifiers:t,rcompareIdentifiers:(n,s)=>t(s,n)},sr}var ir,bt;function K(){if(bt)return ir;bt=1;const e=Ue(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=De(),{safeRe:n,t:s}=be(),u=Jr(),{compareIdentifiers:i}=bn();class o{constructor(l,a){if(a=u(a),l instanceof o){if(l.loose===!!a.loose&&l.includePrerelease===!!a.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",l,a),this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease;const f=l.trim().match(a.loose?n[s.LOOSE]:n[s.FULL]);if(!f)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const m=+d;if(m>=0&&m<r)return m}return d}):this.prerelease=[],this.build=f[5]?f[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(l){if(e("SemVer.compare",this.version,this.options,l),!(l instanceof o)){if(typeof l=="string"&&l===this.version)return 0;l=new o(l,this.options)}return l.version===this.version?0:this.compareMain(l)||this.comparePre(l)}compareMain(l){return l instanceof o||(l=new o(l,this.options)),this.major<l.major?-1:this.major>l.major?1:this.minor<l.minor?-1:this.minor>l.minor?1:this.patch<l.patch?-1:this.patch>l.patch?1:0}comparePre(l){if(l instanceof o||(l=new o(l,this.options)),this.prerelease.length&&!l.prerelease.length)return-1;if(!this.prerelease.length&&l.prerelease.length)return 1;if(!this.prerelease.length&&!l.prerelease.length)return 0;let a=0;do{const f=this.prerelease[a],d=l.prerelease[a];if(e("prerelease compare",a,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return i(f,d)}while(++a)}compareBuild(l){l instanceof o||(l=new o(l,this.options));let a=0;do{const f=this.build[a],d=l.build[a];if(e("build compare",a,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return i(f,d)}while(++a)}inc(l,a,f){if(l.startsWith("pre")){if(!a&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(a){const d=`-${a}`.match(this.options.loose?n[s.PRERELEASELOOSE]:n[s.PRERELEASE]);if(!d||d[1]!==a)throw new Error(`invalid identifier: ${a}`)}}switch(l){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",a,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",a,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",a,f),this.inc("pre",a,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",a,f),this.inc("pre",a,f);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const d=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let m=this.prerelease.length;for(;--m>=0;)typeof this.prerelease[m]=="number"&&(this.prerelease[m]++,m=-2);if(m===-1){if(a===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(a){let m=[a,d];f===!1&&(m=[a]),i(this.prerelease[0],a)===0?isNaN(this.prerelease[1])&&(this.prerelease=m):this.prerelease=m}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ir=o,ir}var or,It;function me(){if(It)return or;It=1;const e=K();return or=(r,n,s=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(u){if(!s)return null;throw u}},or}var ar,Ot;function fs(){if(Ot)return ar;Ot=1;const e=me();return ar=(r,n)=>{const s=e(r,n);return s?s.version:null},ar}var ur,Tt;function ds(){if(Tt)return ur;Tt=1;const e=me();return ur=(r,n)=>{const s=e(r.trim().replace(/^[=v]+/,""),n);return s?s.version:null},ur}var cr,xt;function hs(){if(xt)return cr;xt=1;const e=K();return cr=(r,n,s,u,i)=>{typeof s=="string"&&(i=u,u=s,s=void 0);try{return new e(r instanceof e?r.version:r,s).inc(n,u,i).version}catch{return null}},cr}var lr,St;function ps(){if(St)return lr;St=1;const e=me();return lr=(r,n)=>{const s=e(r,null,!0),u=e(n,null,!0),i=s.compare(u);if(i===0)return null;const o=i>0,c=o?s:u,l=o?u:s,a=!!c.prerelease.length;if(!!l.prerelease.length&&!a){if(!l.patch&&!l.minor)return"major";if(l.compareMain(c)===0)return l.minor&&!l.patch?"minor":"patch"}const d=a?"pre":"";return s.major!==u.major?d+"major":s.minor!==u.minor?d+"minor":s.patch!==u.patch?d+"patch":"prerelease"},lr}var fr,Pt;function ms(){if(Pt)return fr;Pt=1;const e=K();return fr=(r,n)=>new e(r,n).major,fr}var dr,Nt;function gs(){if(Nt)return dr;Nt=1;const e=K();return dr=(r,n)=>new e(r,n).minor,dr}var hr,At;function vs(){if(At)return hr;At=1;const e=K();return hr=(r,n)=>new e(r,n).patch,hr}var pr,kt;function ys(){if(kt)return pr;kt=1;const e=me();return pr=(r,n)=>{const s=e(r,n);return s&&s.prerelease.length?s.prerelease:null},pr}var mr,zt;function ee(){if(zt)return mr;zt=1;const e=K();return mr=(r,n,s)=>new e(r,s).compare(new e(n,s)),mr}var gr,Ct;function _s(){if(Ct)return gr;Ct=1;const e=ee();return gr=(r,n,s)=>e(n,r,s),gr}var vr,Lt;function $s(){if(Lt)return vr;Lt=1;const e=ee();return vr=(r,n)=>e(r,n,!0),vr}var yr,qt;function Hr(){if(qt)return yr;qt=1;const e=K();return yr=(r,n,s)=>{const u=new e(r,s),i=new e(n,s);return u.compare(i)||u.compareBuild(i)},yr}var _r,jt;function Es(){if(jt)return _r;jt=1;const e=Hr();return _r=(r,n)=>r.sort((s,u)=>e(s,u,n)),_r}var $r,Dt;function ws(){if(Dt)return $r;Dt=1;const e=Hr();return $r=(r,n)=>r.sort((s,u)=>e(u,s,n)),$r}var Er,Ut;function Me(){if(Ut)return Er;Ut=1;const e=ee();return Er=(r,n,s)=>e(r,n,s)>0,Er}var wr,Mt;function Yr(){if(Mt)return wr;Mt=1;const e=ee();return wr=(r,n,s)=>e(r,n,s)<0,wr}var Rr,Ft;function In(){if(Ft)return Rr;Ft=1;const e=ee();return Rr=(r,n,s)=>e(r,n,s)===0,Rr}var br,Gt;function On(){if(Gt)return br;Gt=1;const e=ee();return br=(r,n,s)=>e(r,n,s)!==0,br}var Ir,Vt;function Kr(){if(Vt)return Ir;Vt=1;const e=ee();return Ir=(r,n,s)=>e(r,n,s)>=0,Ir}var Or,Bt;function Wr(){if(Bt)return Or;Bt=1;const e=ee();return Or=(r,n,s)=>e(r,n,s)<=0,Or}var Tr,Zt;function Tn(){if(Zt)return Tr;Zt=1;const e=In(),t=On(),r=Me(),n=Kr(),s=Yr(),u=Wr();return Tr=(o,c,l,a)=>{switch(c){case"===":return typeof o=="object"&&(o=o.version),typeof l=="object"&&(l=l.version),o===l;case"!==":return typeof o=="object"&&(o=o.version),typeof l=="object"&&(l=l.version),o!==l;case"":case"=":case"==":return e(o,l,a);case"!=":return t(o,l,a);case">":return r(o,l,a);case">=":return n(o,l,a);case"<":return s(o,l,a);case"<=":return u(o,l,a);default:throw new TypeError(`Invalid operator: ${c}`)}},Tr}var xr,Xt;function Rs(){if(Xt)return xr;Xt=1;const e=K(),t=me(),{safeRe:r,t:n}=be();return xr=(u,i)=>{if(u instanceof e)return u;if(typeof u=="number"&&(u=String(u)),typeof u!="string")return null;i=i||{};let o=null;if(!i.rtl)o=u.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const m=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let h;for(;(h=m.exec(u))&&(!o||o.index+o[0].length!==u.length);)(!o||h.index+h[0].length!==o.index+o[0].length)&&(o=h),m.lastIndex=h.index+h[1].length+h[2].length;m.lastIndex=-1}if(o===null)return null;const c=o[2],l=o[3]||"0",a=o[4]||"0",f=i.includePrerelease&&o[5]?`-${o[5]}`:"",d=i.includePrerelease&&o[6]?`+${o[6]}`:"";return t(`${c}.${l}.${a}${f}${d}`,i)},xr}var Sr,Jt;function bs(){if(Jt)return Sr;Jt=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const u=this.map.keys().next().value;this.delete(u)}this.map.set(r,n)}return this}}return Sr=e,Sr}var Pr,Ht;function re(){if(Ht)return Pr;Ht=1;const e=/\s+/g;class t{constructor(_,x){if(x=s(x),_ instanceof t)return _.loose===!!x.loose&&_.includePrerelease===!!x.includePrerelease?_:new t(_.raw,x);if(_ instanceof u)return this.raw=_.value,this.set=[[_]],this.formatted=void 0,this;if(this.options=x,this.loose=!!x.loose,this.includePrerelease=!!x.includePrerelease,this.raw=_.trim().replace(e," "),this.set=this.raw.split("||").map(I=>this.parseRange(I.trim())).filter(I=>I.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const I=this.set[0];if(this.set=this.set.filter(S=>!p(S[0])),this.set.length===0)this.set=[I];else if(this.set.length>1){for(const S of this.set)if(S.length===1&&g(S[0])){this.set=[S];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let _=0;_<this.set.length;_++){_>0&&(this.formatted+="||");const x=this.set[_];for(let I=0;I<x.length;I++)I>0&&(this.formatted+=" "),this.formatted+=x[I].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(_){const I=((this.options.includePrerelease&&m)|(this.options.loose&&h))+":"+_,S=n.get(I);if(S)return S;const O=this.options.loose,A=O?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];_=_.replace(A,de(this.options.includePrerelease)),i("hyphen replace",_),_=_.replace(c[l.COMPARATORTRIM],a),i("comparator trim",_),_=_.replace(c[l.TILDETRIM],f),i("tilde trim",_),_=_.replace(c[l.CARETTRIM],d),i("caret trim",_);let j=_.split(" ").map(D=>E(D,this.options)).join(" ").split(/\s+/).map(D=>oe(D,this.options));O&&(j=j.filter(D=>(i("loose invalid filter",D,this.options),!!D.match(c[l.COMPARATORLOOSE])))),i("range list",j);const L=new Map,F=j.map(D=>new u(D,this.options));for(const D of F){if(p(D))return[D];L.set(D.value,D)}L.size>1&&L.has("")&&L.delete("");const J=[...L.values()];return n.set(I,J),J}intersects(_,x){if(!(_ instanceof t))throw new TypeError("a Range is required");return this.set.some(I=>v(I,x)&&_.set.some(S=>v(S,x)&&I.every(O=>S.every(A=>O.intersects(A,x)))))}test(_){if(!_)return!1;if(typeof _=="string")try{_=new o(_,this.options)}catch{return!1}for(let x=0;x<this.set.length;x++)if(he(this.set[x],_,this.options))return!0;return!1}}Pr=t;const r=bs(),n=new r,s=Jr(),u=Fe(),i=Ue(),o=K(),{safeRe:c,t:l,comparatorTrimReplace:a,tildeTrimReplace:f,caretTrimReplace:d}=be(),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:h}=De(),p=w=>w.value==="<0.0.0-0",g=w=>w.value==="",v=(w,_)=>{let x=!0;const I=w.slice();let S=I.pop();for(;x&&I.length;)x=I.every(O=>S.intersects(O,_)),S=I.pop();return x},E=(w,_)=>(w=w.replace(c[l.BUILD],""),i("comp",w,_),w=U(w,_),i("caret",w),w=q(w,_),i("tildes",w),w=C(w,_),i("xrange",w),w=ie(w,_),i("stars",w),w),y=w=>!w||w.toLowerCase()==="x"||w==="*",q=(w,_)=>w.trim().split(/\s+/).map(x=>M(x,_)).join(" "),M=(w,_)=>{const x=_.loose?c[l.TILDELOOSE]:c[l.TILDE];return w.replace(x,(I,S,O,A,j)=>{i("tilde",w,I,S,O,A,j);let L;return y(S)?L="":y(O)?L=`>=${S}.0.0 <${+S+1}.0.0-0`:y(A)?L=`>=${S}.${O}.0 <${S}.${+O+1}.0-0`:j?(i("replaceTilde pr",j),L=`>=${S}.${O}.${A}-${j} <${S}.${+O+1}.0-0`):L=`>=${S}.${O}.${A} <${S}.${+O+1}.0-0`,i("tilde return",L),L})},U=(w,_)=>w.trim().split(/\s+/).map(x=>B(x,_)).join(" "),B=(w,_)=>{i("caret",w,_);const x=_.loose?c[l.CARETLOOSE]:c[l.CARET],I=_.includePrerelease?"-0":"";return w.replace(x,(S,O,A,j,L)=>{i("caret",w,S,O,A,j,L);let F;return y(O)?F="":y(A)?F=`>=${O}.0.0${I} <${+O+1}.0.0-0`:y(j)?O==="0"?F=`>=${O}.${A}.0${I} <${O}.${+A+1}.0-0`:F=`>=${O}.${A}.0${I} <${+O+1}.0.0-0`:L?(i("replaceCaret pr",L),O==="0"?A==="0"?F=`>=${O}.${A}.${j}-${L} <${O}.${A}.${+j+1}-0`:F=`>=${O}.${A}.${j}-${L} <${O}.${+A+1}.0-0`:F=`>=${O}.${A}.${j}-${L} <${+O+1}.0.0-0`):(i("no pr"),O==="0"?A==="0"?F=`>=${O}.${A}.${j}${I} <${O}.${A}.${+j+1}-0`:F=`>=${O}.${A}.${j}${I} <${O}.${+A+1}.0-0`:F=`>=${O}.${A}.${j} <${+O+1}.0.0-0`),i("caret return",F),F})},C=(w,_)=>(i("replaceXRanges",w,_),w.split(/\s+/).map(x=>te(x,_)).join(" ")),te=(w,_)=>{w=w.trim();const x=_.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return w.replace(x,(I,S,O,A,j,L)=>{i("xRange",w,I,S,O,A,j,L);const F=y(O),J=F||y(A),D=J||y(j),ne=D;return S==="="&&ne&&(S=""),L=_.includePrerelease?"-0":"",F?S===">"||S==="<"?I="<0.0.0-0":I="*":S&&ne?(J&&(A=0),j=0,S===">"?(S=">=",J?(O=+O+1,A=0,j=0):(A=+A+1,j=0)):S==="<="&&(S="<",J?O=+O+1:A=+A+1),S==="<"&&(L="-0"),I=`${S+O}.${A}.${j}${L}`):J?I=`>=${O}.0.0${L} <${+O+1}.0.0-0`:D&&(I=`>=${O}.${A}.0${L} <${O}.${+A+1}.0-0`),i("xRange return",I),I})},ie=(w,_)=>(i("replaceStars",w,_),w.trim().replace(c[l.STAR],"")),oe=(w,_)=>(i("replaceGTE0",w,_),w.trim().replace(c[_.includePrerelease?l.GTE0PRE:l.GTE0],"")),de=w=>(_,x,I,S,O,A,j,L,F,J,D,ne)=>(y(I)?x="":y(S)?x=`>=${I}.0.0${w?"-0":""}`:y(O)?x=`>=${I}.${S}.0${w?"-0":""}`:A?x=`>=${x}`:x=`>=${x}${w?"-0":""}`,y(F)?L="":y(J)?L=`<${+F+1}.0.0-0`:y(D)?L=`<${F}.${+J+1}.0-0`:ne?L=`<=${F}.${J}.${D}-${ne}`:w?L=`<${F}.${J}.${+D+1}-0`:L=`<=${L}`,`${x} ${L}`.trim()),he=(w,_,x)=>{for(let I=0;I<w.length;I++)if(!w[I].test(_))return!1;if(_.prerelease.length&&!x.includePrerelease){for(let I=0;I<w.length;I++)if(i(w[I].semver),w[I].semver!==u.ANY&&w[I].semver.prerelease.length>0){const S=w[I].semver;if(S.major===_.major&&S.minor===_.minor&&S.patch===_.patch)return!0}return!1}return!0};return Pr}var Nr,Yt;function Fe(){if(Yt)return Nr;Yt=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(a,f){if(f=r(f),a instanceof t){if(a.loose===!!f.loose)return a;a=a.value}a=a.trim().split(/\s+/).join(" "),i("comparator",a,f),this.options=f,this.loose=!!f.loose,this.parse(a),this.semver===e?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}parse(a){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],d=a.match(f);if(!d)throw new TypeError(`Invalid comparator: ${a}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new o(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(a){if(i("Comparator.test",a,this.options.loose),this.semver===e||a===e)return!0;if(typeof a=="string")try{a=new o(a,this.options)}catch{return!1}return u(a,this.operator,this.semver,this.options)}intersects(a,f){if(!(a instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(a.value,f).test(this.value):a.operator===""?a.value===""?!0:new c(this.value,f).test(a.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||a.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||a.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&a.operator.startsWith(">")||this.operator.startsWith("<")&&a.operator.startsWith("<")||this.semver.version===a.semver.version&&this.operator.includes("=")&&a.operator.includes("=")||u(this.semver,"<",a.semver,f)&&this.operator.startsWith(">")&&a.operator.startsWith("<")||u(this.semver,">",a.semver,f)&&this.operator.startsWith("<")&&a.operator.startsWith(">")))}}Nr=t;const r=Jr(),{safeRe:n,t:s}=be(),u=Tn(),i=Ue(),o=K(),c=re();return Nr}var Ar,Kt;function Ge(){if(Kt)return Ar;Kt=1;const e=re();return Ar=(r,n,s)=>{try{n=new e(n,s)}catch{return!1}return n.test(r)},Ar}var kr,Wt;function Is(){if(Wt)return kr;Wt=1;const e=re();return kr=(r,n)=>new e(r,n).set.map(s=>s.map(u=>u.value).join(" ").trim().split(" ")),kr}var zr,Qt;function Os(){if(Qt)return zr;Qt=1;const e=K(),t=re();return zr=(n,s,u)=>{let i=null,o=null,c=null;try{c=new t(s,u)}catch{return null}return n.forEach(l=>{c.test(l)&&(!i||o.compare(l)===-1)&&(i=l,o=new e(i,u))}),i},zr}var Cr,en;function Ts(){if(en)return Cr;en=1;const e=K(),t=re();return Cr=(n,s,u)=>{let i=null,o=null,c=null;try{c=new t(s,u)}catch{return null}return n.forEach(l=>{c.test(l)&&(!i||o.compare(l)===1)&&(i=l,o=new e(i,u))}),i},Cr}var Lr,rn;function xs(){if(rn)return Lr;rn=1;const e=K(),t=re(),r=Me();return Lr=(s,u)=>{s=new t(s,u);let i=new e("0.0.0");if(s.test(i)||(i=new e("0.0.0-0"),s.test(i)))return i;i=null;for(let o=0;o<s.set.length;++o){const c=s.set[o];let l=null;c.forEach(a=>{const f=new e(a.semver.version);switch(a.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!l||r(f,l))&&(l=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),l&&(!i||r(i,l))&&(i=l)}return i&&s.test(i)?i:null},Lr}var qr,tn;function Ss(){if(tn)return qr;tn=1;const e=re();return qr=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},qr}var jr,nn;function Qr(){if(nn)return jr;nn=1;const e=K(),t=Fe(),{ANY:r}=t,n=re(),s=Ge(),u=Me(),i=Yr(),o=Wr(),c=Kr();return jr=(a,f,d,m)=>{a=new e(a,m),f=new n(f,m);let h,p,g,v,E;switch(d){case">":h=u,p=o,g=i,v=">",E=">=";break;case"<":h=i,p=c,g=u,v="<",E="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(a,f,m))return!1;for(let y=0;y<f.set.length;++y){const q=f.set[y];let M=null,U=null;if(q.forEach(B=>{B.semver===r&&(B=new t(">=0.0.0")),M=M||B,U=U||B,h(B.semver,M.semver,m)?M=B:g(B.semver,U.semver,m)&&(U=B)}),M.operator===v||M.operator===E||(!U.operator||U.operator===v)&&p(a,U.semver))return!1;if(U.operator===E&&g(a,U.semver))return!1}return!0},jr}var Dr,sn;function Ps(){if(sn)return Dr;sn=1;const e=Qr();return Dr=(r,n,s)=>e(r,n,">",s),Dr}var Ur,on;function Ns(){if(on)return Ur;on=1;const e=Qr();return Ur=(r,n,s)=>e(r,n,"<",s),Ur}var Mr,an;function As(){if(an)return Mr;an=1;const e=re();return Mr=(r,n,s)=>(r=new e(r,s),n=new e(n,s),r.intersects(n,s)),Mr}var Fr,un;function ks(){if(un)return Fr;un=1;const e=Ge(),t=ee();return Fr=(r,n,s)=>{const u=[];let i=null,o=null;const c=r.sort((d,m)=>t(d,m,s));for(const d of c)e(d,n,s)?(o=d,i||(i=d)):(o&&u.push([i,o]),o=null,i=null);i&&u.push([i,null]);const l=[];for(const[d,m]of u)d===m?l.push(d):!m&&d===c[0]?l.push("*"):m?d===c[0]?l.push(`<=${m}`):l.push(`${d} - ${m}`):l.push(`>=${d}`);const a=l.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return a.length<f.length?a:n},Fr}var Gr,cn;function zs(){if(cn)return Gr;cn=1;const e=re(),t=Fe(),{ANY:r}=t,n=Ge(),s=ee(),u=(f,d,m={})=>{if(f===d)return!0;f=new e(f,m),d=new e(d,m);let h=!1;e:for(const p of f.set){for(const g of d.set){const v=c(p,g,m);if(h=h||v!==null,v)continue e}if(h)return!1}return!0},i=[new t(">=0.0.0-0")],o=[new t(">=0.0.0")],c=(f,d,m)=>{if(f===d)return!0;if(f.length===1&&f[0].semver===r){if(d.length===1&&d[0].semver===r)return!0;m.includePrerelease?f=i:f=o}if(d.length===1&&d[0].semver===r){if(m.includePrerelease)return!0;d=o}const h=new Set;let p,g;for(const C of f)C.operator===">"||C.operator===">="?p=l(p,C,m):C.operator==="<"||C.operator==="<="?g=a(g,C,m):h.add(C.semver);if(h.size>1)return null;let v;if(p&&g){if(v=s(p.semver,g.semver,m),v>0)return null;if(v===0&&(p.operator!==">="||g.operator!=="<="))return null}for(const C of h){if(p&&!n(C,String(p),m)||g&&!n(C,String(g),m))return null;for(const te of d)if(!n(C,String(te),m))return!1;return!0}let E,y,q,M,U=g&&!m.includePrerelease&&g.semver.prerelease.length?g.semver:!1,B=p&&!m.includePrerelease&&p.semver.prerelease.length?p.semver:!1;U&&U.prerelease.length===1&&g.operator==="<"&&U.prerelease[0]===0&&(U=!1);for(const C of d){if(M=M||C.operator===">"||C.operator===">=",q=q||C.operator==="<"||C.operator==="<=",p){if(B&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===B.major&&C.semver.minor===B.minor&&C.semver.patch===B.patch&&(B=!1),C.operator===">"||C.operator===">="){if(E=l(p,C,m),E===C&&E!==p)return!1}else if(p.operator===">="&&!n(p.semver,String(C),m))return!1}if(g){if(U&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===U.major&&C.semver.minor===U.minor&&C.semver.patch===U.patch&&(U=!1),C.operator==="<"||C.operator==="<="){if(y=a(g,C,m),y===C&&y!==g)return!1}else if(g.operator==="<="&&!n(g.semver,String(C),m))return!1}if(!C.operator&&(g||p)&&v!==0)return!1}return!(p&&q&&!g&&v!==0||g&&M&&!p&&v!==0||B||U)},l=(f,d,m)=>{if(!f)return d;const h=s(f.semver,d.semver,m);return h>0?f:h<0||d.operator===">"&&f.operator===">="?d:f},a=(f,d,m)=>{if(!f)return d;const h=s(f.semver,d.semver,m);return h<0?f:h>0||d.operator==="<"&&f.operator==="<="?d:f};return Gr=u,Gr}var Vr,ln;function Cs(){if(ln)return Vr;ln=1;const e=be(),t=De(),r=K(),n=bn(),s=me(),u=fs(),i=ds(),o=hs(),c=ps(),l=ms(),a=gs(),f=vs(),d=ys(),m=ee(),h=_s(),p=$s(),g=Hr(),v=Es(),E=ws(),y=Me(),q=Yr(),M=In(),U=On(),B=Kr(),C=Wr(),te=Tn(),ie=Rs(),oe=Fe(),de=re(),he=Ge(),w=Is(),_=Os(),x=Ts(),I=xs(),S=Ss(),O=Qr(),A=Ps(),j=Ns(),L=As(),F=ks(),J=zs();return Vr={parse:s,valid:u,clean:i,inc:o,diff:c,major:l,minor:a,patch:f,prerelease:d,compare:m,rcompare:h,compareLoose:p,compareBuild:g,sort:v,rsort:E,gt:y,lt:q,eq:M,neq:U,gte:B,lte:C,cmp:te,coerce:ie,Comparator:oe,Range:de,satisfies:he,toComparators:w,maxSatisfying:_,minSatisfying:x,minVersion:I,validRange:S,outside:O,gtr:A,ltr:j,intersects:L,simplifyRange:F,subset:J,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},Vr}Cs();var je={exports:{}};je.exports;var fn;function Ls(){return fn||(fn=1,(function(e){const r=(u=0)=>i=>`\x1B[${38+u};5;${i}m`,n=(u=0)=>(i,o,c)=>`\x1B[${38+u};2;${i};${o};${c}m`;function s(){const u=new Map,i={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};i.color.gray=i.color.blackBright,i.bgColor.bgGray=i.bgColor.bgBlackBright,i.color.grey=i.color.blackBright,i.bgColor.bgGrey=i.bgColor.bgBlackBright;for(const[o,c]of Object.entries(i)){for(const[l,a]of Object.entries(c))i[l]={open:`\x1B[${a[0]}m`,close:`\x1B[${a[1]}m`},c[l]=i[l],u.set(a[0],a[1]);Object.defineProperty(i,o,{value:c,enumerable:!1})}return Object.defineProperty(i,"codes",{value:u,enumerable:!1}),i.color.close="\x1B[39m",i.bgColor.close="\x1B[49m",i.color.ansi256=r(),i.color.ansi16m=n(),i.bgColor.ansi256=r(10),i.bgColor.ansi16m=n(10),Object.defineProperties(i,{rgbToAnsi256:{value:(o,c,l)=>o===c&&c===l?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(c/255*5)+Math.round(l/255*5),enumerable:!1},hexToRgb:{value:o=>{const c=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(o.toString(16));if(!c)return[0,0,0];let{colorString:l}=c.groups;l.length===3&&(l=l.split("").map(f=>f+f).join(""));const a=Number.parseInt(l,16);return[a>>16&255,a>>8&255,a&255]},enumerable:!1},hexToAnsi256:{value:o=>i.rgbToAnsi256(...i.hexToRgb(o)),enumerable:!1}}),i}Object.defineProperty(e,"exports",{enumerable:!0,get:s})})(je)),je.exports}var qs=Ls();const Ki=pe(qs);function G(e,t,r){function n(o,c){var l;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(l=o._zod).traits??(l.traits=new Set),o._zod.traits.add(e),t(o,c);for(const a in i.prototype)a in o||Object.defineProperty(o,a,{value:i.prototype[a].bind(o)});o._zod.constr=i,o._zod.def=c}const s=r?.Parent??Object;class u extends s{}Object.defineProperty(u,"name",{value:e});function i(o){var c;const l=r?.Parent?new u:this;n(l,o),(c=l._zod).deferred??(c.deferred=[]);for(const a of l._zod.deferred)a();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Re extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const js={};function le(e){return js}function Ds(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function Us(e,t){return typeof t=="bigint"?t.toString():t}function et(e){return e==null}function rt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Z(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ms(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}const xn=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Br(e){if(dn(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(dn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Sn(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function ge(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Wi(e,t){if(!Br(t))throw new Error("Invalid input to extend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ms(this,"shape",n),n},checks:[]};return Sn(e,r)}function Qi(e,t,r){const n=t._zod.def.shape,s={...n};for(const u in n)s[u]=e?new e({type:"optional",innerType:n[u]}):n[u];return Sn(t,{...t._zod.def,shape:s,checks:[]})}function Ee(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Fs(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function qe(e){return typeof e=="string"?e:e?.message}function fe(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=qe(e.inst?._zod.def?.error?.(e))??qe(t?.error?.(e))??qe(r.customError?.(e))??qe(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function tt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Gs(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Pn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Us,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Vs=G("$ZodError",Pn),Ve=G("$ZodError",Pn,{Parent:Error});function eo(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function ro(e,t){const r=t||function(u){return u.message},n={_errors:[]},s=u=>{for(const i of u.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>s({issues:o}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(e),n}function Bs(e){const t=[];for(const r of e)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function to(e){const t=[],r=[...e.issues].sort((n,s)=>n.path.length-s.path.length);for(const n of r)t.push(`✖ ${n.message}`),n.path?.length&&t.push(` → at ${Bs(n.path)}`);return t.join(`
2
2
  `)}const Zs=e=>(t,r,n,s)=>{const u=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},u);if(i instanceof Promise)throw new Re;if(i.issues.length){const o=new(s?.Err??e)(i.issues.map(c=>fe(c,u,le())));throw xn(o,s?.callee),o}return i.value},no=Zs(Ve),Xs=e=>async(t,r,n,s)=>{const u=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},u);if(i instanceof Promise&&(i=await i),i.issues.length){const o=new(s?.Err??e)(i.issues.map(c=>fe(c,u,le())));throw xn(o,s?.callee),o}return i.value},so=Xs(Ve),Js=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},s);if(u instanceof Promise)throw new Re;return u.issues.length?{success:!1,error:new(e??Vs)(u.issues.map(i=>fe(i,s,le())))}:{success:!0,data:u.value}},Hs=Js(Ve),Ys=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let u=t._zod.run({value:r,issues:[]},s);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(i=>fe(i,s,le())))}:{success:!0,data:u.value}},Ks=Ys(Ve),Ie=G("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ws=G("$ZodCheckMaxLength",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!et(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const i=tt(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Qs=G("$ZodCheckMinLength",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!et(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const i=tt(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),ei=G("$ZodCheckLengthEquals",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!et(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,u=s.length;if(u===t.length)return;const i=tt(s),o=u>t.length;n.issues.push({origin:i,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ri=G("$ZodCheckOverwrite",(e,t)=>{Ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),ti={major:4,minor:0,patch:0},Y=G("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ti;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const u of s._zod.onattach)u(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,i,o)=>{let c=Ee(u),l;for(const a of i){if(a._zod.def.when){if(!a._zod.def.when(u))continue}else if(c)continue;const f=u.issues.length,d=a._zod.check(u);if(d instanceof Promise&&o?.async===!1)throw new Re;if(l||d instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await d,u.issues.length!==f&&(c||(c=Ee(u,f)))});else{if(u.issues.length===f)continue;c||(c=Ee(u,f))}}return l?l.then(()=>u):u};e._zod.run=(u,i)=>{const o=e._zod.parse(u,i);if(o instanceof Promise){if(i.async===!1)throw new Re;return o.then(c=>s(c,n,i))}return s(o,n,i)}}e["~standard"]={validate:s=>{try{const u=Hs(e,s);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return Ks(e,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),io=G("$ZodAny",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),oo=G("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),ao=G("$ZodNever",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function hn(e,t,r){e.issues.length&&t.issues.push(...Fs(r,e.issues)),t.value[r]=e.value}const uo=G("$ZodArray",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const u=[];for(let i=0;i<s.length;i++){const o=s[i],c=t.element._zod.run({value:o,issues:[]},n);c instanceof Promise?u.push(c.then(l=>hn(l,r,i))):hn(c,r,i)}return u.length?Promise.all(u).then(()=>r):r}});function pn(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(u=>fe(u,n,le())))}),t}const co=G("$ZodUnion",(e,t)=>{Y.init(e,t),Z(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Z(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Z(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),Z(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>rt(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let s=!1;const u=[];for(const i of t.options){const o=i._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)u.push(o),s=!0;else{if(o.issues.length===0)return o;u.push(o)}}return s?Promise.all(u).then(i=>pn(i,r,e,n)):pn(u,r,e,n)}}),lo=G("$ZodIntersection",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,u=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return u instanceof Promise||i instanceof Promise?Promise.all([u,i]).then(([c,l])=>mn(r,c,l)):mn(r,u,i)}});function Zr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Br(e)&&Br(t)){const r=Object.keys(t),n=Object.keys(e).filter(u=>r.indexOf(u)!==-1),s={...e,...t};for(const u of n){const i=Zr(e[u],t[u]);if(!i.valid)return{valid:!1,mergeErrorPath:[u,...i.mergeErrorPath]};s[u]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],u=t[n],i=Zr(s,u);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mn(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Ee(e))return e;const n=Zr(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const fo=G("$ZodTransform",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>{const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new Re;return r.value=s,r}}),ho=G("$ZodOptional",(e,t)=>{Y.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Z(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${rt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),po=G("$ZodNullable",(e,t)=>{Y.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${rt(r.source)}|null)$`):void 0}),Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),mo=G("$ZodDefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(u=>gn(u,t)):gn(s,t)}});function gn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const go=G("$ZodPrefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),vo=G("$ZodNonOptional",(e,t)=>{Y.init(e,t),Z(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(u=>vn(u,e)):vn(s,e)}});function vn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const yo=G("$ZodCatch",(e,t)=>{Y.init(e,t),e._zod.optin="optional",Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(u=>(r.value=u.value,u.issues.length&&(r.value=t.catchValue({...r,error:{issues:u.issues.map(i=>fe(i,n,le()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(u=>fe(u,n,le()))},input:r.value}),r.issues=[]),r)}}),_o=G("$ZodPipe",(e,t)=>{Y.init(e,t),Z(e._zod,"values",()=>t.in._zod.values),Z(e._zod,"optin",()=>t.in._zod.optin),Z(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(u=>yn(u,t,n)):yn(s,t,n)}});function yn(e,t,r){return Ee(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const $o=G("$ZodReadonly",(e,t)=>{Y.init(e,t),Z(e._zod,"propValues",()=>t.innerType._zod.propValues),Z(e._zod,"values",()=>t.innerType._zod.values),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(_n):_n(s)}});function _n(e){return e.value=Object.freeze(e.value),e}const Eo=G("$ZodCustom",(e,t)=>{Ie.init(e,t),Y.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(u=>$n(u,r,n,e));$n(s,r,n,e)}});function $n(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Gs(s))}}class Nn{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function ni(){return new Nn}const si=ni();function wo(e){return new e({type:"any"})}function Ro(e){return new e({type:"unknown"})}function bo(e,t){return new e({type:"never",...ge(t)})}function Io(e,t){return new Ws({check:"max_length",...ge(t),maximum:e})}function Oo(e,t){return new Qs({check:"min_length",...ge(t),minimum:e})}function To(e,t){return new ei({check:"length_equals",...ge(t),length:e})}function xo(e){return new ri({check:"overwrite",tx:e})}function So(e,t,r){return new e({type:"array",element:t,...ge(r)})}function Po(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ge(r)})}class En{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??si,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,r={path:[],schemaPath:[]}){var n;const s=t._zod.def,u={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(t,o);const c=t._zod.toJSONSchema?.();if(c)o.schema=c;else{const f={...r,schemaPath:[...r.schemaPath,t],path:r.path},d=t._zod.parent;if(d)o.ref=d,this.process(d,f),this.seen.get(d).isParent=!0;else{const m=o.schema;switch(s.type){case"string":{const h=m;h.type="string";const{minimum:p,maximum:g,format:v,patterns:E,contentEncoding:y}=t._zod.bag;if(typeof p=="number"&&(h.minLength=p),typeof g=="number"&&(h.maxLength=g),v&&(h.format=u[v]??v,h.format===""&&delete h.format),y&&(h.contentEncoding=y),E&&E.size>0){const q=[...E];q.length===1?h.pattern=q[0].source:q.length>1&&(o.schema.allOf=[...q.map(M=>({...this.target==="draft-7"?{type:"string"}:{},pattern:M.source}))])}break}case"number":{const h=m,{minimum:p,maximum:g,format:v,multipleOf:E,exclusiveMaximum:y,exclusiveMinimum:q}=t._zod.bag;typeof v=="string"&&v.includes("int")?h.type="integer":h.type="number",typeof q=="number"&&(h.exclusiveMinimum=q),typeof p=="number"&&(h.minimum=p,typeof q=="number"&&(q>=p?delete h.minimum:delete h.exclusiveMinimum)),typeof y=="number"&&(h.exclusiveMaximum=y),typeof g=="number"&&(h.maximum=g,typeof y=="number"&&(y<=g?delete h.maximum:delete h.exclusiveMaximum)),typeof E=="number"&&(h.multipleOf=E);break}case"boolean":{const h=m;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{m.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=m,{minimum:p,maximum:g}=t._zod.bag;typeof p=="number"&&(h.minItems=p),typeof g=="number"&&(h.maxItems=g),h.type="array",h.items=this.process(s.element,{...f,path:[...f.path,"items"]});break}case"object":{const h=m;h.type="object",h.properties={};const p=s.shape;for(const E in p)h.properties[E]=this.process(p[E],{...f,path:[...f.path,"properties",E]});const g=new Set(Object.keys(p)),v=new Set([...g].filter(E=>{const y=s.shape[E]._zod;return this.io==="input"?y.optin===void 0:y.optout===void 0}));v.size>0&&(h.required=Array.from(v)),s.catchall?._zod.def.type==="never"?h.additionalProperties=!1:s.catchall?s.catchall&&(h.additionalProperties=this.process(s.catchall,{...f,path:[...f.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{const h=m;h.anyOf=s.options.map((p,g)=>this.process(p,{...f,path:[...f.path,"anyOf",g]}));break}case"intersection":{const h=m,p=this.process(s.left,{...f,path:[...f.path,"allOf",0]}),g=this.process(s.right,{...f,path:[...f.path,"allOf",1]}),v=y=>"allOf"in y&&Object.keys(y).length===1,E=[...v(p)?p.allOf:[p],...v(g)?g.allOf:[g]];h.allOf=E;break}case"tuple":{const h=m;h.type="array";const p=s.items.map((E,y)=>this.process(E,{...f,path:[...f.path,"prefixItems",y]}));if(this.target==="draft-2020-12"?h.prefixItems=p:h.items=p,s.rest){const E=this.process(s.rest,{...f,path:[...f.path,"items"]});this.target==="draft-2020-12"?h.items=E:h.additionalItems=E}s.rest&&(h.items=this.process(s.rest,{...f,path:[...f.path,"items"]}));const{minimum:g,maximum:v}=t._zod.bag;typeof g=="number"&&(h.minItems=g),typeof v=="number"&&(h.maxItems=v);break}case"record":{const h=m;h.type="object",h.propertyNames=this.process(s.keyType,{...f,path:[...f.path,"propertyNames"]}),h.additionalProperties=this.process(s.valueType,{...f,path:[...f.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=m,p=Ds(s.entries);p.every(g=>typeof g=="number")&&(h.type="number"),p.every(g=>typeof g=="string")&&(h.type="string"),h.enum=p;break}case"literal":{const h=m,p=[];for(const g of s.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");p.push(Number(g))}else p.push(g);if(p.length!==0)if(p.length===1){const g=p[0];h.type=g===null?"null":typeof g,h.const=g}else p.every(g=>typeof g=="number")&&(h.type="number"),p.every(g=>typeof g=="string")&&(h.type="string"),p.every(g=>typeof g=="boolean")&&(h.type="string"),p.every(g=>g===null)&&(h.type="null"),h.enum=p;break}case"file":{const h=m,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:E}=t._zod.bag;g!==void 0&&(p.minLength=g),v!==void 0&&(p.maxLength=v),E?E.length===1?(p.contentMediaType=E[0],Object.assign(h,p)):h.anyOf=E.map(y=>({...p,contentMediaType:y})):Object.assign(h,p);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(s.innerType,f);m.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,f),o.ref=s.innerType;break}case"success":{const h=m;h.type="boolean";break}case"default":{this.process(s.innerType,f),o.ref=s.innerType,m.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,f),o.ref=s.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,f),o.ref=s.innerType;let h;try{h=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const h=m,p=t._zod.pattern;if(!p)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=p.source;break}case"pipe":{const h=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(h,f),o.ref=h;break}case"readonly":{this.process(s.innerType,f),o.ref=s.innerType,m.readOnly=!0;break}case"promise":{this.process(s.innerType,f),o.ref=s.innerType;break}case"optional":{this.process(s.innerType,f),o.ref=s.innerType;break}case"lazy":{const h=t._zod.innerType;this.process(h,f),o.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),this.io==="input"&&X(t)&&(delete o.schema.examples,delete o.schema.default),this.io==="input"&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(t).schema}emit(t,r){const n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},s=this.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const u=a=>{const f=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const p=n.external.registry.get(a[0])?.id,g=n.external.uri??(E=>E);if(p)return{ref:g(p)};const v=a[1].defId??a[1].schema.id??`schema${this.counter++}`;return a[1].defId=v,{defId:v,ref:`${g("__shared")}#/${f}/${v}`}}if(a[1]===s)return{ref:"#"};const m=`#/${f}/`,h=a[1].schema.id??`__schema${this.counter++}`;return{defId:h,ref:m+h}},i=a=>{if(a[1].schema.$ref)return;const f=a[1],{ref:d,defId:m}=u(a);f.def={...f.schema},m&&(f.defId=m);const h=f.schema;for(const p in h)delete h[p];h.$ref=d};if(n.cycles==="throw")for(const a of this.seen.entries()){const f=a[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
3
3
 
4
4
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of this.seen.entries()){const f=a[1];if(t===a[0]){i(a);continue}if(n.external){const m=n.external.registry.get(a[0])?.id;if(t!==a[0]&&m){i(a);continue}}if(this.metadataRegistry.get(a[0])?.id){i(a);continue}if(f.cycle){i(a);continue}if(f.count>1&&n.reused==="ref"){i(a);continue}}const o=(a,f)=>{const d=this.seen.get(a),m=d.def??d.schema,h={...m};if(d.ref===null)return;const p=d.ref;if(d.ref=null,p){o(p,f);const g=this.seen.get(p).schema;g.$ref&&f.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,h))}d.isParent||this.override({zodSchema:a,jsonSchema:m,path:d.path??[]})};for(const a of[...this.seen.entries()].reverse())o(a[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){const a=n.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(a)}Object.assign(c,s.def);const l=n.external?.defs??{};for(const a of this.seen.entries()){const f=a[1];f.def&&f.defId&&(l[f.defId]=f.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?c.$defs=l:c.definitions=l);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function No(e,t){if(e instanceof Nn){const n=new En(t),s={};for(const o of e._idmap.entries()){const[c,l]=o;n.process(l)}const u={},i={registry:e,uri:t?.uri,defs:s};for(const o of e._idmap.entries()){const[c,l]=o;u[c]=n.emit(l,{...t,external:i})}if(Object.keys(s).length>0){const o=n.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[o]:s}}return{schemas:u}}const r=new En(t);return r.process(e),r.emit(e,t)}function X(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const s=e._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return X(s.element,r);case"object":{for(const u in s.shape)if(X(s.shape[u],r))return!0;return!1}case"union":{for(const u of s.options)if(X(u,r))return!0;return!1}case"intersection":return X(s.left,r)||X(s.right,r);case"tuple":{for(const u of s.items)if(X(u,r))return!0;return!!(s.rest&&X(s.rest,r))}case"record":return X(s.keyType,r)||X(s.valueType,r);case"map":return X(s.keyType,r)||X(s.valueType,r);case"set":return X(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return X(s.innerType,r);case"lazy":return X(s.getter(),r);case"default":return X(s.innerType,r);case"prefault":return X(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return X(s.in,r)||X(s.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}function we(e,t){const r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(!we(e[s],t[s]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!we(e[i],t[i]))return!1;return!0}return e===t}function Q(e){return encodeURI(ii(e))}function ii(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}const oi={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},ai={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},ui={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};let ci=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function ce(e,t=Object.create(null),r=ci,n=""){if(e&&typeof e=="object"&&!Array.isArray(e)){const u=e.$id||e.id;if(u){const i=new URL(u,r.href);i.hash.length>1?t[i.href]=e:(i.hash="",n===""?r=i:ce(e,t,r))}}else if(e!==!0&&e!==!1)return t;const s=r.href+(n?"#"+n:"");if(t[s]!==void 0)throw new Error(`Duplicate schema URI "${s}".`);if(t[s]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:s}),e.$ref&&e.__absolute_ref__===void 0){const u=new URL(e.$ref,r.href);u.hash=u.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:u.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){const u=new URL(e.$recursiveRef,r.href);u.hash=u.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:u.href})}if(e.$anchor){const u=new URL("#"+e.$anchor,r.href);t[u.href]=e}for(let u in e){if(ui[u])continue;const i=`${n}/${Q(u)}`,o=e[u];if(Array.isArray(o)){if(oi[u]){const c=o.length;for(let l=0;l<c;l++)ce(o[l],t,r,`${i}/${l}`)}}else if(ai[u])for(let c in o)ce(o[c],t,r,`${i}/${Q(c)}`);else ce(o,t,r,i)}return t}const li=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fi=[0,31,28,31,30,31,30,31,31,30,31,30,31],di=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,hi=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,pi=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,mi=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,gi=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,vi=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,yi=/^(?:\/(?:[^~/]|~0|~1)*)*$/,_i=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,$i=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ei=e=>{if(e[0]==='"')return!1;const[t,r,...n]=e.split("@");return!t||!r||n.length!==0||t.length>64||r.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:r.split(".").every(s=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(s))},wi=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Ri=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,bi=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function se(e){return e.test.bind(e)}const wn={date:An,time:kn.bind(void 0,!1),"date-time":Ti,duration:bi,uri:Pi,"uri-reference":se(pi),"uri-template":se(mi),url:se(gi),email:Ei,hostname:se(hi),ipv4:se(wi),ipv6:se(Ri),regex:Ai,uuid:se(vi),"json-pointer":se(yi),"json-pointer-uri-fragment":se(_i),"relative-json-pointer":se($i)};function Ii(e){return e%4===0&&(e%100!==0||e%400===0)}function An(e){const t=e.match(li);if(!t)return!1;const r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n==2&&Ii(r)?29:fi[n])}function kn(e,t){const r=t.match(di);if(!r)return!1;const n=+r[1],s=+r[2],u=+r[3],i=!!r[5];return(n<=23&&s<=59&&u<=59||n==23&&s==59&&u==60)&&(!e||i)}const Oi=/t|\s/i;function Ti(e){const t=e.split(Oi);return t.length==2&&An(t[0])&&kn(!0,t[1])}const xi=/\/|:/,Si=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Pi(e){return xi.test(e)&&Si.test(e)}const Ni=/[^\\]\\Z/;function Ai(e){if(Ni.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}function ki(e){let t=0,r=e.length,n=0,s;for(;n<r;)t++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<r&&(s=e.charCodeAt(n),(s&64512)==56320&&n++);return t}function V(e,t,r="2019-09",n=ce(t),s=!0,u=null,i="#",o="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:"false",keywordLocation:i,error:"False boolean schema."}]};const l=typeof e;let a;switch(l){case"boolean":case"number":case"string":a=l;break;case"object":e===null?a="null":Array.isArray(e)?a="array":a="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}const{$ref:f,$recursiveRef:d,$recursiveAnchor:m,type:h,const:p,enum:g,required:v,not:E,anyOf:y,allOf:q,oneOf:M,if:U,then:B,else:C,format:te,properties:ie,patternProperties:oe,additionalProperties:de,unevaluatedProperties:he,minProperties:w,maxProperties:_,propertyNames:x,dependentRequired:I,dependentSchemas:S,dependencies:O,prefixItems:A,items:j,additionalItems:L,unevaluatedItems:F,contains:J,minContains:D,maxContains:ne,minItems:Be,maxItems:Ze,uniqueItems:zn,minimum:ae,maximum:ue,exclusiveMinimum:ve,exclusiveMaximum:ye,multipleOf:Oe,minLength:Te,maxLength:xe,pattern:nt,__absolute_ref__:Se,__absolute_recursive_ref__:Cn}=t,R=[];if(m===!0&&u===null&&(u=t),d==="#"){const P=u===null?n[Cn]:u,T=`${o}/$recursiveRef`,z=V(e,u===null?t:u,r,n,s,P,i,T,c);z.valid||R.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:T,error:"A subschema had errors."},...z.errors)}if(f!==void 0){const T=n[Se||f];if(T===void 0){let $=`Unresolved $ref "${f}".`;throw Se&&Se!==f&&($+=` Absolute URI "${Se}".`),$+=`
@@ -1 +1 @@
1
- import{_ as e,A as d}from"./index-DYamMjJ3.js";var l={};e(l,{chunkArray:()=>u});const u=(r,n)=>r.reduce((a,o,s)=>{const c=Math.floor(s/n),t=a[c]||[];return a[c]=t.concat([o]),a},[]);var _={};e(_,{Embeddings:()=>h});var h=class{caller;constructor(r){this.caller=new d(r??{})}};
1
+ import{_ as e,A as d}from"./index-D0nLMG1E.js";var l={};e(l,{chunkArray:()=>u});const u=(r,n)=>r.reduce((a,o,s)=>{const c=Math.floor(s/n),t=a[c]||[];return a[c]=t.concat([o]),a},[]);var _={};e(_,{Embeddings:()=>h});var h=class{caller;constructor(r){this.caller=new d(r??{})}};
@@ -1,4 +1,4 @@
1
- import{B as $n,O as bt,l as jn,p as nn,f as xt,H as St,j as Bn,k as Ln,c as A,b as kt,m as Un,n as qn,h as Wn,g as Fn,t as be,i as Mt,C as Dn,R as Tt,o as Hn}from"./index-DYamMjJ3.js";import"./chunk-VL2OQCWN-CCBLHHdi.js";import"./index-Cyrsq1zA.js";import"./index-DRz5BQNA.js";var Rt=class extends $n{static lc_name(){return"AnthropicToolsOutputParser"}lc_namespace=["langchain","anthropic","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(s.message)}`,t)}else e=t;if(this.zodSchema===void 0)return e;const n=await jn(this.zodSchema,e);if(n.success)return n.data;throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(t){const e=t.flatMap(r=>{const{message:i}=r;return Array.isArray(i.content)?sn(i.content)[0]:[]});if(e[0]===void 0)throw new Error("No parseable tool calls provided to AnthropicToolsOutputParser.");const[n]=e;return await this._validateResult(n.args)}};function sn(t){const e=[];for(const n of t)n.type==="tool_use"&&e.push({name:n.name,args:n.input,id:n.id,type:"tool_call"});return e}function Kn(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:t==="none"?{type:"none"}:typeof t=="string"?{type:"tool",name:t}:t}function Jn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Xn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function zn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function Vn(t){return typeof t!="object"||t==null||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}const Qn={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){const e=nn({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){const e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}},Gn=t=>t();function Yn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function Zn(t){function*e(){for(const n of t)Yn(n)&&(n.source==="char"?yield{type:"char_location",file_id:n.url??"",start_char_index:n.startIndex??0,end_char_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="page"?yield{type:"page_location",file_id:n.url??"",start_page_number:n.startIndex??0,end_page_number:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="block"?yield{type:"content_block_location",file_id:n.url??"",start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="url"?yield{type:"web_search_result_location",url:n.url??"",title:n.title??null,encrypted_index:String(n.startIndex??0),cited_text:n.citedText??""}:n.source==="search"&&(yield{type:"search_result_location",title:n.title??null,start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,search_result_index:0,source:n.source??"",cited_text:n.citedText??""}))}return Array.from(e())}function G(t){return typeof t=="string"?t:es(t)}function es(t){const e=[];for(let n=0,{length:s}=t;n<s;n++)e.push(String.fromCharCode(t[n]));return btoa(e.join(""))}function Ve(t){return(t??"").split(";")[0].toLowerCase()}function he(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function H(t,e){const n=he(e,"cache_control");n!==void 0&&(t.cache_control=n);const s=he(e,"citations");s!==void 0&&(t.citations=s);const r=he(e,"context");r!==void 0&&(t.context=r);const i=he(e,"title");return i!==void 0&&(t.title=i),t}function Qe(t,e){const n=he(e,"cache_control");return n!==void 0&&(t.cache_control=n),t}function At(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function ts(t){const e=[],n=t.response_metadata,s="model_provider"in n&&n?.model_provider==="anthropic";for(const r of t.contentBlocks)if(r.type==="text")r.annotations?e.push({type:"text",text:r.text,citations:Zn(r.annotations)}):e.push({type:"text",text:r.text});else if(r.type==="tool_call")e.push({type:"tool_use",id:r.id??"",name:r.name,input:r.args});else if(r.type==="tool_call_chunk"){const i=Gn(()=>{if(typeof r.args!="string")return r.args;try{return JSON.parse(r.args)}catch{return{}}});e.push({type:"tool_use",id:r.id??"",name:r.name??"",input:i})}else if(r.type==="reasoning"&&s)e.push({type:"thinking",thinking:r.reasoning,signature:String(r.signature)});else if(r.type==="server_tool_call"&&s)r.name==="web_search"?e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args}):r.name==="code_execution"&&e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args});else if(r.type==="server_tool_call_result"&&s)if(r.name==="web_search"&&Array.isArray(r.output.urls)){const i=r.output.urls.map(a=>({type:"web_search_result",title:"",encrypted_content:"",url:a}));e.push({type:"web_search_tool_result",tool_use_id:r.toolCallId??"",content:i})}else r.name==="code_execution"?e.push({type:"code_execution_tool_result",tool_use_id:r.toolCallId??"",content:r.output}):r.name==="mcp_tool_result"&&e.push({type:"mcp_tool_result",tool_use_id:r.toolCallId??"",content:r.output});else{if(r.type==="audio")throw new Error("Anthropic does not support audio content blocks.");if(r.type==="file"){const i=r.metadata;if(r.fileId){e.push(H({type:"document",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){const a=Ve(r.mimeType);if(a==="application/pdf"||a===""){e.push(H({type:"document",source:{type:"url",url:r.url}},i));continue}}if(r.data){const a=Ve(r.mimeType);if(a===""||a==="application/pdf")e.push(H({type:"document",source:{type:"base64",data:G(r.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},i));else if(At(a))e.push(H({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:G(r.data),media_type:a}}]}},i));else throw new Error(`Unsupported file mime type for Anthropic base64 source: ${a}`);continue}throw new Error("File content block must include a fileId, url, or data property.")}else if(r.type==="image"){const i=r.metadata;if(r.fileId){e.push(Qe({type:"image",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){e.push(Qe({type:"image",source:{type:"url",url:r.url}},i));continue}if(r.data){const a=Ve(r.mimeType)||"image/png";At(a)&&e.push(Qe({type:"image",source:{type:"base64",data:G(r.data),media_type:a}},i));continue}throw new Error("Image content block must include a fileId, url, or data property.")}else r.type==="video"||(r.type==="text-plain"?r.data&&e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},r.metadata)):r.type==="non_standard"&&s&&e.push(r.value))}return e}function vt(t){const e=nn({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let n;try{n=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
1
+ import{B as $n,O as bt,l as jn,p as nn,f as xt,H as St,j as Bn,k as Ln,c as A,b as kt,m as Un,n as qn,h as Wn,g as Fn,t as be,i as Mt,C as Dn,R as Tt,o as Hn}from"./index-D0nLMG1E.js";import"./chunk-VL2OQCWN-lvFdpsKs.js";import"./index-CFpQGWTL.js";import"./index-DRz5BQNA.js";var Rt=class extends $n{static lc_name(){return"AnthropicToolsOutputParser"}lc_namespace=["langchain","anthropic","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(s.message)}`,t)}else e=t;if(this.zodSchema===void 0)return e;const n=await jn(this.zodSchema,e);if(n.success)return n.data;throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(t){const e=t.flatMap(r=>{const{message:i}=r;return Array.isArray(i.content)?sn(i.content)[0]:[]});if(e[0]===void 0)throw new Error("No parseable tool calls provided to AnthropicToolsOutputParser.");const[n]=e;return await this._validateResult(n.args)}};function sn(t){const e=[];for(const n of t)n.type==="tool_use"&&e.push({name:n.name,args:n.input,id:n.id,type:"tool_call"});return e}function Kn(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:t==="none"?{type:"none"}:typeof t=="string"?{type:"tool",name:t}:t}function Jn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Xn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function zn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function Vn(t){return typeof t!="object"||t==null||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}const Qn={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){const e=nn({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){const e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}},Gn=t=>t();function Yn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function Zn(t){function*e(){for(const n of t)Yn(n)&&(n.source==="char"?yield{type:"char_location",file_id:n.url??"",start_char_index:n.startIndex??0,end_char_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="page"?yield{type:"page_location",file_id:n.url??"",start_page_number:n.startIndex??0,end_page_number:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="block"?yield{type:"content_block_location",file_id:n.url??"",start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="url"?yield{type:"web_search_result_location",url:n.url??"",title:n.title??null,encrypted_index:String(n.startIndex??0),cited_text:n.citedText??""}:n.source==="search"&&(yield{type:"search_result_location",title:n.title??null,start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,search_result_index:0,source:n.source??"",cited_text:n.citedText??""}))}return Array.from(e())}function G(t){return typeof t=="string"?t:es(t)}function es(t){const e=[];for(let n=0,{length:s}=t;n<s;n++)e.push(String.fromCharCode(t[n]));return btoa(e.join(""))}function Ve(t){return(t??"").split(";")[0].toLowerCase()}function he(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function H(t,e){const n=he(e,"cache_control");n!==void 0&&(t.cache_control=n);const s=he(e,"citations");s!==void 0&&(t.citations=s);const r=he(e,"context");r!==void 0&&(t.context=r);const i=he(e,"title");return i!==void 0&&(t.title=i),t}function Qe(t,e){const n=he(e,"cache_control");return n!==void 0&&(t.cache_control=n),t}function At(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function ts(t){const e=[],n=t.response_metadata,s="model_provider"in n&&n?.model_provider==="anthropic";for(const r of t.contentBlocks)if(r.type==="text")r.annotations?e.push({type:"text",text:r.text,citations:Zn(r.annotations)}):e.push({type:"text",text:r.text});else if(r.type==="tool_call")e.push({type:"tool_use",id:r.id??"",name:r.name,input:r.args});else if(r.type==="tool_call_chunk"){const i=Gn(()=>{if(typeof r.args!="string")return r.args;try{return JSON.parse(r.args)}catch{return{}}});e.push({type:"tool_use",id:r.id??"",name:r.name??"",input:i})}else if(r.type==="reasoning"&&s)e.push({type:"thinking",thinking:r.reasoning,signature:String(r.signature)});else if(r.type==="server_tool_call"&&s)r.name==="web_search"?e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args}):r.name==="code_execution"&&e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args});else if(r.type==="server_tool_call_result"&&s)if(r.name==="web_search"&&Array.isArray(r.output.urls)){const i=r.output.urls.map(a=>({type:"web_search_result",title:"",encrypted_content:"",url:a}));e.push({type:"web_search_tool_result",tool_use_id:r.toolCallId??"",content:i})}else r.name==="code_execution"?e.push({type:"code_execution_tool_result",tool_use_id:r.toolCallId??"",content:r.output}):r.name==="mcp_tool_result"&&e.push({type:"mcp_tool_result",tool_use_id:r.toolCallId??"",content:r.output});else{if(r.type==="audio")throw new Error("Anthropic does not support audio content blocks.");if(r.type==="file"){const i=r.metadata;if(r.fileId){e.push(H({type:"document",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){const a=Ve(r.mimeType);if(a==="application/pdf"||a===""){e.push(H({type:"document",source:{type:"url",url:r.url}},i));continue}}if(r.data){const a=Ve(r.mimeType);if(a===""||a==="application/pdf")e.push(H({type:"document",source:{type:"base64",data:G(r.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},i));else if(At(a))e.push(H({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:G(r.data),media_type:a}}]}},i));else throw new Error(`Unsupported file mime type for Anthropic base64 source: ${a}`);continue}throw new Error("File content block must include a fileId, url, or data property.")}else if(r.type==="image"){const i=r.metadata;if(r.fileId){e.push(Qe({type:"image",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){e.push(Qe({type:"image",source:{type:"url",url:r.url}},i));continue}if(r.data){const a=Ve(r.mimeType)||"image/png";At(a)&&e.push(Qe({type:"image",source:{type:"base64",data:G(r.data),media_type:a}},i));continue}throw new Error("Image content block must include a fileId, url, or data property.")}else r.type==="video"||(r.type==="text-plain"?r.data&&e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},r.metadata)):r.type==="non_standard"&&s&&e.push(r.value))}return e}function vt(t){const e=nn({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let n;try{n=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
2
2
 
3
3
  `))}if(n.protocol==="http:"||n.protocol==="https:")return{type:"url",url:t};throw new Error([`Invalid image URL protocol: ${JSON.stringify(n.protocol)}. Anthropic only supports images as http, https, or base64-encoded data URLs on 'image_url' content blocks.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
4
4
 
@@ -1,2 +1,2 @@
1
- import{i as ne,t as fe,a as he,b as pe,C as ge,c as me,d as Ce,e as ye,f as oe,g as se,h as ie,j as _e,k as Ee,p as A,B as ve,l as we,O as Te,m as Ie,n as Oe,J as Re,R as D,o as Se}from"./index-DYamMjJ3.js";import{v as ae}from"./index-Cyrsq1zA.js";import"./embeddings-Cec1zHaZ.js";import"./chunk-VL2OQCWN-CCBLHHdi.js";import"./index-DRz5BQNA.js";function _(e){if(typeof e=="object"&&e!==null){const n={...e};"additionalProperties"in n&&delete n.additionalProperties,"$schema"in n&&delete n.$schema,"strict"in n&&delete n.strict;for(const t in n)t in n&&(Array.isArray(n[t])?n[t]=n[t].map(_):typeof n[t]=="object"&&n[t]!==null&&(n[t]=_(n[t])));return n}return e}function N(e){const n=_(ne(e)?fe(e):e),{$schema:t,...o}=n;return o}function Ae(e){const n=_(e),{$schema:t,...o}=n;return o}function Ne(e){const n=e._getType();return Ce.isInstance(e)?e.role:n==="tool"?n:e.name??n}function be(e){switch(e){case"supervisor":case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${e}`)}}function Me(e){if("mimeType"in e&&"data"in e)return{inlineData:{mimeType:e.mimeType,data:e.data}};if("mimeType"in e&&"fileUri"in e)return{fileData:{mimeType:e.mimeType,fileUri:e.fileUri}};throw new Error("Invalid media content")}function xe(e,n){return n.map(t=>oe(t)?t.tool_calls??[]:[]).flat().find(t=>t.id===e.tool_call_id)?.name}function De(e){return{providerName:"Google Gemini",fromStandardTextBlock(t){return{text:t.text}},fromStandardImageBlock(t){if(!e)throw new Error("This model does not support images");if(t.source_type==="url"){const o=A({dataUrl:t.url});return o?{inlineData:{mimeType:o.mime_type,data:o.data}}:{fileData:{mimeType:t.mime_type??"",fileUri:t.url}}}if(t.source_type==="base64")return{inlineData:{mimeType:t.mime_type??"",data:t.data}};throw new Error(`Unsupported source type: ${t.source_type}`)},fromStandardAudioBlock(t){if(!e)throw new Error("This model does not support audio");if(t.source_type==="url"){const o=A({dataUrl:t.url});return o?{inlineData:{mimeType:o.mime_type,data:o.data}}:{fileData:{mimeType:t.mime_type??"",fileUri:t.url}}}if(t.source_type==="base64")return{inlineData:{mimeType:t.mime_type??"",data:t.data}};throw new Error(`Unsupported source type: ${t.source_type}`)},fromStandardFileBlock(t){if(!e)throw new Error("This model does not support files");if(t.source_type==="text")return{text:t.text};if(t.source_type==="url"){const o=A({dataUrl:t.url});return o?{inlineData:{mimeType:o.mime_type,data:o.data}}:{fileData:{mimeType:t.mime_type??"",fileUri:t.url}}}if(t.source_type==="base64")return{inlineData:{mimeType:t.mime_type??"",data:t.data}};throw new Error(`Unsupported source type: ${t.source_type}`)}}}function G(e,n){if(_e(e))return Ee(e,De(n));if(e.type==="text")return{text:e.text};if(e.type==="executableCode")return{executableCode:e.executableCode};if(e.type==="codeExecutionResult")return{codeExecutionResult:e.codeExecutionResult};if(e.type==="image_url"){if(!n)throw new Error("This model does not support images");let t;if(typeof e.image_url=="string")t=e.image_url;else if(typeof e.image_url=="object"&&"url"in e.image_url)t=e.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");const[o,s]=t.split(",");if(!o.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");const[i,a]=o.replace(/^data:/,"").split(";");if(a!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:s,mimeType:i}}}else{if(e.type==="media")return Me(e);if(e.type==="tool_use")return{functionCall:{name:e.name,args:e.input}};if(e.type?.includes("/")&&e.type.split("/").length===2&&"data"in e&&typeof e.data=="string")return{inlineData:{mimeType:e.type,data:e.data}};if("functionCall"in e)return;throw"type"in e?new Error(`Unknown content type ${e.type}`):new Error(`Unknown content ${JSON.stringify(e)}`)}}function Ge(e,n,t){if(ye(e)){const i=e.name??xe(e,t);if(i===void 0)throw new Error(`Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage "${e.id}" from your passed messages. Please populate a "name" field on that ToolMessage explicitly.`);const a=Array.isArray(e.content)?e.content.map(c=>G(c,n)).filter(c=>c!==void 0):e.content;return e.status==="error"?[{functionResponse:{name:i,response:{error:{details:a}}}}]:[{functionResponse:{name:i,response:{result:a}}}]}let o=[];const s=[];return typeof e.content=="string"&&e.content&&s.push({text:e.content}),Array.isArray(e.content)&&s.push(...e.content.map(i=>G(i,n)).filter(i=>i!==void 0)),oe(e)&&e.tool_calls?.length&&(o=e.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}}))),[...s,...o]}function k(e,n,t=!1){return e.reduce((o,s,i)=>{if(!he(s))throw new Error("Unsupported message input");const a=Ne(s);if(a==="system"&&i!==0)throw new Error("System message should be the first one");const c=be(a),u=o.content[o.content.length];if(!o.mergeWithPreviousContent&&u&&u.role===c)throw new Error("Google Generative AI requires alternate messages between authors");const r=Ge(s,n,e.slice(0,i));if(o.mergeWithPreviousContent){const d=o.content[o.content.length-1];if(!d)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return d.parts.push(...r),{mergeWithPreviousContent:!1,content:o.content}}let p=c;(p==="function"||p==="system"&&!t)&&(p="user");const f={role:p,parts:r};return{mergeWithPreviousContent:a==="system"&&!t,content:[...o.content,f]}},{content:[],mergeWithPreviousContent:!1}).content}function ke(e,n){if(!e.candidates||e.candidates.length===0||!e.candidates[0])return{generations:[],llmOutput:{filters:e.promptFeedback}};const t=e.functionCalls(),[o]=e.candidates,{content:s,...i}=o;let a;Array.isArray(s?.parts)&&s.parts.length===1&&s.parts[0].text?a=s.parts[0].text:Array.isArray(s?.parts)&&s.parts.length>0?a=s.parts.map(r=>"text"in r?{type:"text",text:r.text}:"inlineData"in r?{type:"inlineData",inlineData:r.inlineData}:"functionCall"in r?{type:"functionCall",functionCall:r.functionCall}:"functionResponse"in r?{type:"functionResponse",functionResponse:r.functionResponse}:"fileData"in r?{type:"fileData",fileData:r.fileData}:"executableCode"in r?{type:"executableCode",executableCode:r.executableCode}:"codeExecutionResult"in r?{type:"codeExecutionResult",codeExecutionResult:r.codeExecutionResult}:r):a=[];let c="";return typeof a=="string"?c=a:Array.isArray(a)&&a.length>0&&(c=a.find(p=>"text"in p)?.text??c),{generations:[{text:c,message:new pe({content:a??"",tool_calls:t?.map(r=>({...r,type:"tool_call",id:"id"in r&&typeof r.id=="string"?r.id:ae()})),additional_kwargs:{...i},usage_metadata:n?.usageMetadata}),generationInfo:i}],llmOutput:{tokenUsage:{promptTokens:n?.usageMetadata?.input_tokens,completionTokens:n?.usageMetadata?.output_tokens,totalTokens:n?.usageMetadata?.total_tokens}}}}function Ue(e,n){if(!e.candidates||e.candidates.length===0)return null;const t=e.functionCalls(),[o]=e.candidates,{content:s,...i}=o;let a;Array.isArray(s?.parts)&&s.parts.every(r=>"text"in r)?a=s.parts.map(r=>r.text).join(""):Array.isArray(s?.parts)?a=s.parts.map(r=>"text"in r?{type:"text",text:r.text}:"inlineData"in r?{type:"inlineData",inlineData:r.inlineData}:"functionCall"in r?{type:"functionCall",functionCall:r.functionCall}:"functionResponse"in r?{type:"functionResponse",functionResponse:r.functionResponse}:"fileData"in r?{type:"fileData",fileData:r.fileData}:"executableCode"in r?{type:"executableCode",executableCode:r.executableCode}:"codeExecutionResult"in r?{type:"codeExecutionResult",codeExecutionResult:r.codeExecutionResult}:r):a=[];let c="";a&&typeof a=="string"?c=a:Array.isArray(a)&&(c=a.find(p=>"text"in p)?.text??"");const u=[];return t&&u.push(...t.map(r=>({...r,args:JSON.stringify(r.args),index:n.index,type:"tool_call_chunk",id:"id"in r&&typeof r.id=="string"?r.id:ae()}))),new ge({text:c,message:new me({content:a||"",name:s?s.role:void 0,tool_call_chunks:u,additional_kwargs:{},response_metadata:{model_provider:"google-genai"},usage_metadata:n.usageMetadata}),generationInfo:i})}function Le(e){return e.every(n=>"functionDeclarations"in n&&Array.isArray(n.functionDeclarations))?e:[{functionDeclarations:e.map(n=>{if(se(n)){const t=N(n.schema);return t.type==="object"&&"properties"in t&&Object.keys(t.properties).length===0?{name:n.name,description:n.description}:{name:n.name,description:n.description,parameters:t}}return ie(n)?{name:n.function.name,description:n.function.description??"A function available to call.",parameters:Ae(n.function.parameters)}:n})}]}var U=class extends ve{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}lc_namespace=["langchain","google_genai","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(e){super(e),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;const n=await we(this.zodSchema,e);if(n.success)return n.data;throw new Te(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(e){const n=e.flatMap(s=>{const{message:i}=s;return!("tool_calls"in i)||!Array.isArray(i.tool_calls)?[]:i.tool_calls});if(n[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");const[t]=n;return await this._validateResult(t.args)}},L;(function(e){e.STRING="string",e.NUMBER="number",e.INTEGER="integer",e.BOOLEAN="boolean",e.ARRAY="array",e.OBJECT="object"})(L||(L={}));var P;(function(e){e.LANGUAGE_UNSPECIFIED="language_unspecified",e.PYTHON="python"})(P||(P={}));var j;(function(e){e.OUTCOME_UNSPECIFIED="outcome_unspecified",e.OUTCOME_OK="outcome_ok",e.OUTCOME_FAILED="outcome_failed",e.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(j||(j={}));const F=["user","model","function","system"];var K;(function(e){e.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",e.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",e.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",e.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",e.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(K||(K={}));var $;(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"})($||($={}));var H;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(H||(H={}));var B;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER"})(B||(B={}));var T;(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.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.SPII="SPII",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.OTHER="OTHER"})(T||(T={}));var Y;(function(e){e.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",e.RETRIEVAL_QUERY="RETRIEVAL_QUERY",e.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",e.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",e.CLASSIFICATION="CLASSIFICATION",e.CLUSTERING="CLUSTERING"})(Y||(Y={}));var w;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE"})(w||(w={}));var q;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(q||(q={}));class g extends Error{constructor(n){super(`[GoogleGenerativeAI Error]: ${n}`)}}class v extends g{constructor(n,t){super(n),this.response=t}}class re extends g{constructor(n,t,o,s){super(n),this.status=t,this.statusText=o,this.errorDetails=s}}class y extends g{}class ce extends g{}const Pe="https://generativelanguage.googleapis.com",je="v1beta",Fe="0.24.1",Ke="genai-js";var E;(function(e){e.GENERATE_CONTENT="generateContent",e.STREAM_GENERATE_CONTENT="streamGenerateContent",e.COUNT_TOKENS="countTokens",e.EMBED_CONTENT="embedContent",e.BATCH_EMBED_CONTENTS="batchEmbedContents"})(E||(E={}));class $e{constructor(n,t,o,s,i){this.model=n,this.task=t,this.apiKey=o,this.stream=s,this.requestOptions=i}toString(){var n,t;const o=((n=this.requestOptions)===null||n===void 0?void 0:n.apiVersion)||je;let i=`${((t=this.requestOptions)===null||t===void 0?void 0:t.baseUrl)||Pe}/${o}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}}function He(e){const n=[];return e?.apiClient&&n.push(e.apiClient),n.push(`${Ke}/${Fe}`),n.join(" ")}async function Be(e){var n;const t=new Headers;t.append("Content-Type","application/json"),t.append("x-goog-api-client",He(e.requestOptions)),t.append("x-goog-api-key",e.apiKey);let o=(n=e.requestOptions)===null||n===void 0?void 0:n.customHeaders;if(o){if(!(o instanceof Headers))try{o=new Headers(o)}catch(s){throw new y(`unable to convert customHeaders value ${JSON.stringify(o)} to Headers: ${s.message}`)}for(const[s,i]of o.entries()){if(s==="x-goog-api-key")throw new y(`Cannot set reserved header name ${s}`);if(s==="x-goog-api-client")throw new y(`Header name ${s} can only be set using the apiClient field`);t.append(s,i)}}return t}async function Ye(e,n,t,o,s,i){const a=new $e(e,n,t,o,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},Je(i)),{method:"POST",headers:await Be(a),body:s})}}async function R(e,n,t,o,s,i={},a=fetch){const{url:c,fetchOptions:u}=await Ye(e,n,t,o,s,i);return qe(c,u,a)}async function qe(e,n,t=fetch){let o;try{o=await t(e,n)}catch(s){We(s,e)}return o.ok||await Ve(o,e),o}function We(e,n){let t=e;throw t.name==="AbortError"?(t=new ce(`Request aborted when fetching ${n.toString()}: ${e.message}`),t.stack=e.stack):e instanceof re||e instanceof y||(t=new g(`Error fetching from ${n.toString()}: ${e.message}`),t.stack=e.stack),t}async function Ve(e,n){let t="",o;try{const s=await e.json();t=s.error.message,s.error.details&&(t+=` ${JSON.stringify(s.error.details)}`,o=s.error.details)}catch{}throw new re(`Error fetching from ${n.toString()}: [${e.status} ${e.statusText}] ${t}`,e.status,e.statusText,o)}function Je(e){const n={};if(e?.signal!==void 0||e?.timeout>=0){const t=new AbortController;e?.timeout>=0&&setTimeout(()=>t.abort(),e.timeout),e?.signal&&e.signal.addEventListener("abort",()=>{t.abort()}),n.signal=t.signal}return n}function b(e){return e.text=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),S(e.candidates[0]))throw new v(`${C(e)}`,e);return ze(e)}else if(e.promptFeedback)throw new v(`Text not available. ${C(e)}`,e);return""},e.functionCall=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),S(e.candidates[0]))throw new v(`${C(e)}`,e);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),W(e)[0]}else if(e.promptFeedback)throw new v(`Function call not available. ${C(e)}`,e)},e.functionCalls=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),S(e.candidates[0]))throw new v(`${C(e)}`,e);return W(e)}else if(e.promptFeedback)throw new v(`Function call not available. ${C(e)}`,e)},e}function ze(e){var n,t,o,s;const i=[];if(!((t=(n=e.candidates)===null||n===void 0?void 0:n[0].content)===null||t===void 0)&&t.parts)for(const a of(s=(o=e.candidates)===null||o===void 0?void 0:o[0].content)===null||s===void 0?void 0:s.parts)a.text&&i.push(a.text),a.executableCode&&i.push("\n```"+a.executableCode.language+`
1
+ import{i as ne,t as fe,a as he,b as pe,C as ge,c as me,d as Ce,e as ye,f as oe,g as se,h as ie,j as _e,k as Ee,p as A,B as ve,l as we,O as Te,m as Ie,n as Oe,J as Re,R as D,o as Se}from"./index-D0nLMG1E.js";import{v as ae}from"./index-CFpQGWTL.js";import"./embeddings-0wcwzrOS.js";import"./chunk-VL2OQCWN-lvFdpsKs.js";import"./index-DRz5BQNA.js";function _(e){if(typeof e=="object"&&e!==null){const n={...e};"additionalProperties"in n&&delete n.additionalProperties,"$schema"in n&&delete n.$schema,"strict"in n&&delete n.strict;for(const t in n)t in n&&(Array.isArray(n[t])?n[t]=n[t].map(_):typeof n[t]=="object"&&n[t]!==null&&(n[t]=_(n[t])));return n}return e}function N(e){const n=_(ne(e)?fe(e):e),{$schema:t,...o}=n;return o}function Ae(e){const n=_(e),{$schema:t,...o}=n;return o}function Ne(e){const n=e._getType();return Ce.isInstance(e)?e.role:n==="tool"?n:e.name??n}function be(e){switch(e){case"supervisor":case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${e}`)}}function Me(e){if("mimeType"in e&&"data"in e)return{inlineData:{mimeType:e.mimeType,data:e.data}};if("mimeType"in e&&"fileUri"in e)return{fileData:{mimeType:e.mimeType,fileUri:e.fileUri}};throw new Error("Invalid media content")}function xe(e,n){return n.map(t=>oe(t)?t.tool_calls??[]:[]).flat().find(t=>t.id===e.tool_call_id)?.name}function De(e){return{providerName:"Google Gemini",fromStandardTextBlock(t){return{text:t.text}},fromStandardImageBlock(t){if(!e)throw new Error("This model does not support images");if(t.source_type==="url"){const o=A({dataUrl:t.url});return o?{inlineData:{mimeType:o.mime_type,data:o.data}}:{fileData:{mimeType:t.mime_type??"",fileUri:t.url}}}if(t.source_type==="base64")return{inlineData:{mimeType:t.mime_type??"",data:t.data}};throw new Error(`Unsupported source type: ${t.source_type}`)},fromStandardAudioBlock(t){if(!e)throw new Error("This model does not support audio");if(t.source_type==="url"){const o=A({dataUrl:t.url});return o?{inlineData:{mimeType:o.mime_type,data:o.data}}:{fileData:{mimeType:t.mime_type??"",fileUri:t.url}}}if(t.source_type==="base64")return{inlineData:{mimeType:t.mime_type??"",data:t.data}};throw new Error(`Unsupported source type: ${t.source_type}`)},fromStandardFileBlock(t){if(!e)throw new Error("This model does not support files");if(t.source_type==="text")return{text:t.text};if(t.source_type==="url"){const o=A({dataUrl:t.url});return o?{inlineData:{mimeType:o.mime_type,data:o.data}}:{fileData:{mimeType:t.mime_type??"",fileUri:t.url}}}if(t.source_type==="base64")return{inlineData:{mimeType:t.mime_type??"",data:t.data}};throw new Error(`Unsupported source type: ${t.source_type}`)}}}function G(e,n){if(_e(e))return Ee(e,De(n));if(e.type==="text")return{text:e.text};if(e.type==="executableCode")return{executableCode:e.executableCode};if(e.type==="codeExecutionResult")return{codeExecutionResult:e.codeExecutionResult};if(e.type==="image_url"){if(!n)throw new Error("This model does not support images");let t;if(typeof e.image_url=="string")t=e.image_url;else if(typeof e.image_url=="object"&&"url"in e.image_url)t=e.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");const[o,s]=t.split(",");if(!o.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");const[i,a]=o.replace(/^data:/,"").split(";");if(a!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:s,mimeType:i}}}else{if(e.type==="media")return Me(e);if(e.type==="tool_use")return{functionCall:{name:e.name,args:e.input}};if(e.type?.includes("/")&&e.type.split("/").length===2&&"data"in e&&typeof e.data=="string")return{inlineData:{mimeType:e.type,data:e.data}};if("functionCall"in e)return;throw"type"in e?new Error(`Unknown content type ${e.type}`):new Error(`Unknown content ${JSON.stringify(e)}`)}}function Ge(e,n,t){if(ye(e)){const i=e.name??xe(e,t);if(i===void 0)throw new Error(`Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage "${e.id}" from your passed messages. Please populate a "name" field on that ToolMessage explicitly.`);const a=Array.isArray(e.content)?e.content.map(c=>G(c,n)).filter(c=>c!==void 0):e.content;return e.status==="error"?[{functionResponse:{name:i,response:{error:{details:a}}}}]:[{functionResponse:{name:i,response:{result:a}}}]}let o=[];const s=[];return typeof e.content=="string"&&e.content&&s.push({text:e.content}),Array.isArray(e.content)&&s.push(...e.content.map(i=>G(i,n)).filter(i=>i!==void 0)),oe(e)&&e.tool_calls?.length&&(o=e.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}}))),[...s,...o]}function k(e,n,t=!1){return e.reduce((o,s,i)=>{if(!he(s))throw new Error("Unsupported message input");const a=Ne(s);if(a==="system"&&i!==0)throw new Error("System message should be the first one");const c=be(a),u=o.content[o.content.length];if(!o.mergeWithPreviousContent&&u&&u.role===c)throw new Error("Google Generative AI requires alternate messages between authors");const r=Ge(s,n,e.slice(0,i));if(o.mergeWithPreviousContent){const d=o.content[o.content.length-1];if(!d)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return d.parts.push(...r),{mergeWithPreviousContent:!1,content:o.content}}let p=c;(p==="function"||p==="system"&&!t)&&(p="user");const f={role:p,parts:r};return{mergeWithPreviousContent:a==="system"&&!t,content:[...o.content,f]}},{content:[],mergeWithPreviousContent:!1}).content}function ke(e,n){if(!e.candidates||e.candidates.length===0||!e.candidates[0])return{generations:[],llmOutput:{filters:e.promptFeedback}};const t=e.functionCalls(),[o]=e.candidates,{content:s,...i}=o;let a;Array.isArray(s?.parts)&&s.parts.length===1&&s.parts[0].text?a=s.parts[0].text:Array.isArray(s?.parts)&&s.parts.length>0?a=s.parts.map(r=>"text"in r?{type:"text",text:r.text}:"inlineData"in r?{type:"inlineData",inlineData:r.inlineData}:"functionCall"in r?{type:"functionCall",functionCall:r.functionCall}:"functionResponse"in r?{type:"functionResponse",functionResponse:r.functionResponse}:"fileData"in r?{type:"fileData",fileData:r.fileData}:"executableCode"in r?{type:"executableCode",executableCode:r.executableCode}:"codeExecutionResult"in r?{type:"codeExecutionResult",codeExecutionResult:r.codeExecutionResult}:r):a=[];let c="";return typeof a=="string"?c=a:Array.isArray(a)&&a.length>0&&(c=a.find(p=>"text"in p)?.text??c),{generations:[{text:c,message:new pe({content:a??"",tool_calls:t?.map(r=>({...r,type:"tool_call",id:"id"in r&&typeof r.id=="string"?r.id:ae()})),additional_kwargs:{...i},usage_metadata:n?.usageMetadata}),generationInfo:i}],llmOutput:{tokenUsage:{promptTokens:n?.usageMetadata?.input_tokens,completionTokens:n?.usageMetadata?.output_tokens,totalTokens:n?.usageMetadata?.total_tokens}}}}function Ue(e,n){if(!e.candidates||e.candidates.length===0)return null;const t=e.functionCalls(),[o]=e.candidates,{content:s,...i}=o;let a;Array.isArray(s?.parts)&&s.parts.every(r=>"text"in r)?a=s.parts.map(r=>r.text).join(""):Array.isArray(s?.parts)?a=s.parts.map(r=>"text"in r?{type:"text",text:r.text}:"inlineData"in r?{type:"inlineData",inlineData:r.inlineData}:"functionCall"in r?{type:"functionCall",functionCall:r.functionCall}:"functionResponse"in r?{type:"functionResponse",functionResponse:r.functionResponse}:"fileData"in r?{type:"fileData",fileData:r.fileData}:"executableCode"in r?{type:"executableCode",executableCode:r.executableCode}:"codeExecutionResult"in r?{type:"codeExecutionResult",codeExecutionResult:r.codeExecutionResult}:r):a=[];let c="";a&&typeof a=="string"?c=a:Array.isArray(a)&&(c=a.find(p=>"text"in p)?.text??"");const u=[];return t&&u.push(...t.map(r=>({...r,args:JSON.stringify(r.args),index:n.index,type:"tool_call_chunk",id:"id"in r&&typeof r.id=="string"?r.id:ae()}))),new ge({text:c,message:new me({content:a||"",name:s?s.role:void 0,tool_call_chunks:u,additional_kwargs:{},response_metadata:{model_provider:"google-genai"},usage_metadata:n.usageMetadata}),generationInfo:i})}function Le(e){return e.every(n=>"functionDeclarations"in n&&Array.isArray(n.functionDeclarations))?e:[{functionDeclarations:e.map(n=>{if(se(n)){const t=N(n.schema);return t.type==="object"&&"properties"in t&&Object.keys(t.properties).length===0?{name:n.name,description:n.description}:{name:n.name,description:n.description,parameters:t}}return ie(n)?{name:n.function.name,description:n.function.description??"A function available to call.",parameters:Ae(n.function.parameters)}:n})}]}var U=class extends ve{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}lc_namespace=["langchain","google_genai","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(e){super(e),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;const n=await we(this.zodSchema,e);if(n.success)return n.data;throw new Te(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(e){const n=e.flatMap(s=>{const{message:i}=s;return!("tool_calls"in i)||!Array.isArray(i.tool_calls)?[]:i.tool_calls});if(n[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");const[t]=n;return await this._validateResult(t.args)}},L;(function(e){e.STRING="string",e.NUMBER="number",e.INTEGER="integer",e.BOOLEAN="boolean",e.ARRAY="array",e.OBJECT="object"})(L||(L={}));var P;(function(e){e.LANGUAGE_UNSPECIFIED="language_unspecified",e.PYTHON="python"})(P||(P={}));var j;(function(e){e.OUTCOME_UNSPECIFIED="outcome_unspecified",e.OUTCOME_OK="outcome_ok",e.OUTCOME_FAILED="outcome_failed",e.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(j||(j={}));const F=["user","model","function","system"];var K;(function(e){e.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",e.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",e.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",e.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",e.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(K||(K={}));var $;(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"})($||($={}));var H;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(H||(H={}));var B;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER"})(B||(B={}));var T;(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.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.SPII="SPII",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.OTHER="OTHER"})(T||(T={}));var Y;(function(e){e.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",e.RETRIEVAL_QUERY="RETRIEVAL_QUERY",e.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",e.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",e.CLASSIFICATION="CLASSIFICATION",e.CLUSTERING="CLUSTERING"})(Y||(Y={}));var w;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE"})(w||(w={}));var q;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(q||(q={}));class g extends Error{constructor(n){super(`[GoogleGenerativeAI Error]: ${n}`)}}class v extends g{constructor(n,t){super(n),this.response=t}}class re extends g{constructor(n,t,o,s){super(n),this.status=t,this.statusText=o,this.errorDetails=s}}class y extends g{}class ce extends g{}const Pe="https://generativelanguage.googleapis.com",je="v1beta",Fe="0.24.1",Ke="genai-js";var E;(function(e){e.GENERATE_CONTENT="generateContent",e.STREAM_GENERATE_CONTENT="streamGenerateContent",e.COUNT_TOKENS="countTokens",e.EMBED_CONTENT="embedContent",e.BATCH_EMBED_CONTENTS="batchEmbedContents"})(E||(E={}));class $e{constructor(n,t,o,s,i){this.model=n,this.task=t,this.apiKey=o,this.stream=s,this.requestOptions=i}toString(){var n,t;const o=((n=this.requestOptions)===null||n===void 0?void 0:n.apiVersion)||je;let i=`${((t=this.requestOptions)===null||t===void 0?void 0:t.baseUrl)||Pe}/${o}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}}function He(e){const n=[];return e?.apiClient&&n.push(e.apiClient),n.push(`${Ke}/${Fe}`),n.join(" ")}async function Be(e){var n;const t=new Headers;t.append("Content-Type","application/json"),t.append("x-goog-api-client",He(e.requestOptions)),t.append("x-goog-api-key",e.apiKey);let o=(n=e.requestOptions)===null||n===void 0?void 0:n.customHeaders;if(o){if(!(o instanceof Headers))try{o=new Headers(o)}catch(s){throw new y(`unable to convert customHeaders value ${JSON.stringify(o)} to Headers: ${s.message}`)}for(const[s,i]of o.entries()){if(s==="x-goog-api-key")throw new y(`Cannot set reserved header name ${s}`);if(s==="x-goog-api-client")throw new y(`Header name ${s} can only be set using the apiClient field`);t.append(s,i)}}return t}async function Ye(e,n,t,o,s,i){const a=new $e(e,n,t,o,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},Je(i)),{method:"POST",headers:await Be(a),body:s})}}async function R(e,n,t,o,s,i={},a=fetch){const{url:c,fetchOptions:u}=await Ye(e,n,t,o,s,i);return qe(c,u,a)}async function qe(e,n,t=fetch){let o;try{o=await t(e,n)}catch(s){We(s,e)}return o.ok||await Ve(o,e),o}function We(e,n){let t=e;throw t.name==="AbortError"?(t=new ce(`Request aborted when fetching ${n.toString()}: ${e.message}`),t.stack=e.stack):e instanceof re||e instanceof y||(t=new g(`Error fetching from ${n.toString()}: ${e.message}`),t.stack=e.stack),t}async function Ve(e,n){let t="",o;try{const s=await e.json();t=s.error.message,s.error.details&&(t+=` ${JSON.stringify(s.error.details)}`,o=s.error.details)}catch{}throw new re(`Error fetching from ${n.toString()}: [${e.status} ${e.statusText}] ${t}`,e.status,e.statusText,o)}function Je(e){const n={};if(e?.signal!==void 0||e?.timeout>=0){const t=new AbortController;e?.timeout>=0&&setTimeout(()=>t.abort(),e.timeout),e?.signal&&e.signal.addEventListener("abort",()=>{t.abort()}),n.signal=t.signal}return n}function b(e){return e.text=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),S(e.candidates[0]))throw new v(`${C(e)}`,e);return ze(e)}else if(e.promptFeedback)throw new v(`Text not available. ${C(e)}`,e);return""},e.functionCall=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),S(e.candidates[0]))throw new v(`${C(e)}`,e);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),W(e)[0]}else if(e.promptFeedback)throw new v(`Function call not available. ${C(e)}`,e)},e.functionCalls=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),S(e.candidates[0]))throw new v(`${C(e)}`,e);return W(e)}else if(e.promptFeedback)throw new v(`Function call not available. ${C(e)}`,e)},e}function ze(e){var n,t,o,s;const i=[];if(!((t=(n=e.candidates)===null||n===void 0?void 0:n[0].content)===null||t===void 0)&&t.parts)for(const a of(s=(o=e.candidates)===null||o===void 0?void 0:o[0].content)===null||s===void 0?void 0:s.parts)a.text&&i.push(a.text),a.executableCode&&i.push("\n```"+a.executableCode.language+`
2
2
  `+a.executableCode.code+"\n```\n"),a.codeExecutionResult&&i.push("\n```\n"+a.codeExecutionResult.output+"\n```\n");return i.length>0?i.join(""):""}function W(e){var n,t,o,s;const i=[];if(!((t=(n=e.candidates)===null||n===void 0?void 0:n[0].content)===null||t===void 0)&&t.parts)for(const a of(s=(o=e.candidates)===null||o===void 0?void 0:o[0].content)===null||s===void 0?void 0:s.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}const Xe=[T.RECITATION,T.SAFETY,T.LANGUAGE];function S(e){return!!e.finishReason&&Xe.includes(e.finishReason)}function C(e){var n,t,o;let s="";if((!e.candidates||e.candidates.length===0)&&e.promptFeedback)s+="Response was blocked",!((n=e.promptFeedback)===null||n===void 0)&&n.blockReason&&(s+=` due to ${e.promptFeedback.blockReason}`),!((t=e.promptFeedback)===null||t===void 0)&&t.blockReasonMessage&&(s+=`: ${e.promptFeedback.blockReasonMessage}`);else if(!((o=e.candidates)===null||o===void 0)&&o[0]){const i=e.candidates[0];S(i)&&(s+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(s+=`: ${i.finishMessage}`))}return s}function I(e){return this instanceof I?(this.v=e,this):new I(e)}function Qe(e,n,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(e,n||[]),s,i=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(d){o[d]&&(s[d]=function(l){return new Promise(function(h,m){i.push([d,l,h,m])>1||c(d,l)})})}function c(d,l){try{u(o[d](l))}catch(h){f(i[0][3],h)}}function u(d){d.value instanceof I?Promise.resolve(d.value.v).then(r,p):f(i[0][2],d)}function r(d){c("next",d)}function p(d){c("throw",d)}function f(d,l){d(l),i.shift(),i.length&&c(i[0][0],i[0][1])}}const V=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function Ze(e){const n=e.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),t=nt(n),[o,s]=t.tee();return{stream:tt(o),response:et(s)}}async function et(e){const n=[],t=e.getReader();for(;;){const{done:o,value:s}=await t.read();if(o)return b(ot(n));n.push(s)}}function tt(e){return Qe(this,arguments,function*(){const t=e.getReader();for(;;){const{value:o,done:s}=yield I(t.read());if(s)break;yield yield I(b(o))}})}function nt(e){const n=e.getReader();return new ReadableStream({start(o){let s="";return i();function i(){return n.read().then(({value:a,done:c})=>{if(c){if(s.trim()){o.error(new g("Failed to parse stream"));return}o.close();return}s+=a;let u=s.match(V),r;for(;u;){try{r=JSON.parse(u[1])}catch{o.error(new g(`Error parsing JSON response: "${u[1]}"`));return}o.enqueue(r),s=s.substring(u[0].length),u=s.match(V)}return i()}).catch(a=>{let c=a;throw c.stack=a.stack,c.name==="AbortError"?c=new ce("Request aborted when reading from the stream"):c=new g("Error reading from the stream"),c})}}})}function ot(e){const n=e[e.length-1],t={promptFeedback:n?.promptFeedback};for(const o of e){if(o.candidates){let s=0;for(const i of o.candidates)if(t.candidates||(t.candidates=[]),t.candidates[s]||(t.candidates[s]={index:s}),t.candidates[s].citationMetadata=i.citationMetadata,t.candidates[s].groundingMetadata=i.groundingMetadata,t.candidates[s].finishReason=i.finishReason,t.candidates[s].finishMessage=i.finishMessage,t.candidates[s].safetyRatings=i.safetyRatings,i.content&&i.content.parts){t.candidates[s].content||(t.candidates[s].content={role:i.content.role||"user",parts:[]});const a={};for(const c of i.content.parts)c.text&&(a.text=c.text),c.functionCall&&(a.functionCall=c.functionCall),c.executableCode&&(a.executableCode=c.executableCode),c.codeExecutionResult&&(a.codeExecutionResult=c.codeExecutionResult),Object.keys(a).length===0&&(a.text=""),t.candidates[s].content.parts.push(a)}s++}o.usageMetadata&&(t.usageMetadata=o.usageMetadata)}return t}async function le(e,n,t,o){const s=await R(n,E.STREAM_GENERATE_CONTENT,e,!0,JSON.stringify(t),o);return Ze(s)}async function ue(e,n,t,o){const i=await(await R(n,E.GENERATE_CONTENT,e,!1,JSON.stringify(t),o)).json();return{response:b(i)}}function de(e){if(e!=null){if(typeof e=="string")return{role:"system",parts:[{text:e}]};if(e.text)return{role:"system",parts:[e]};if(e.parts)return e.role?e:{role:"system",parts:e.parts}}}function O(e){let n=[];if(typeof e=="string")n=[{text:e}];else for(const t of e)typeof t=="string"?n.push({text:t}):n.push(t);return st(n)}function st(e){const n={role:"user",parts:[]},t={role:"function",parts:[]};let o=!1,s=!1;for(const i of e)"functionResponse"in i?(t.parts.push(i),s=!0):(n.parts.push(i),o=!0);if(o&&s)throw new g("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!o&&!s)throw new g("No content is provided for sending chat message.");return o?n:t}function it(e,n){var t;let o={model:n?.model,generationConfig:n?.generationConfig,safetySettings:n?.safetySettings,tools:n?.tools,toolConfig:n?.toolConfig,systemInstruction:n?.systemInstruction,cachedContent:(t=n?.cachedContent)===null||t===void 0?void 0:t.name,contents:[]};const s=e.generateContentRequest!=null;if(e.contents){if(s)throw new y("CountTokensRequest must have one of contents or generateContentRequest, not both.");o.contents=e.contents}else if(s)o=Object.assign(Object.assign({},o),e.generateContentRequest);else{const i=O(e);o.contents=[i]}return{generateContentRequest:o}}function J(e){let n;return e.contents?n=e:n={contents:[O(e)]},e.systemInstruction&&(n.systemInstruction=de(e.systemInstruction)),n}function at(e){return typeof e=="string"||Array.isArray(e)?{content:O(e)}:e}const z=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],rt={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function ct(e){let n=!1;for(const t of e){const{role:o,parts:s}=t;if(!n&&o!=="user")throw new g(`First content should be with role 'user', got ${o}`);if(!F.includes(o))throw new g(`Each item should include role field. Got ${o} but valid roles are: ${JSON.stringify(F)}`);if(!Array.isArray(s))throw new g("Content should have 'parts' property with an array of Parts");if(s.length===0)throw new g("Each Content should have at least one part");const i={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(const c of s)for(const u of z)u in c&&(i[u]+=1);const a=rt[o];for(const c of z)if(!a.includes(c)&&i[c]>0)throw new g(`Content with role '${o}' can't contain '${c}' part`);n=!0}}function X(e){var n;if(e.candidates===void 0||e.candidates.length===0)return!1;const t=(n=e.candidates[0])===null||n===void 0?void 0:n.content;if(t===void 0||t.parts===void 0||t.parts.length===0)return!1;for(const o of t.parts)if(o===void 0||Object.keys(o).length===0||o.text!==void 0&&o.text==="")return!1;return!0}const Q="SILENT_ERROR";class lt{constructor(n,t,o,s={}){this.model=t,this.params=o,this._requestOptions=s,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=n,o?.history&&(ct(o.history),this._history=o.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(n,t={}){var o,s,i,a,c,u;await this._sendPromise;const r=O(n),p={safetySettings:(o=this.params)===null||o===void 0?void 0:o.safetySettings,generationConfig:(s=this.params)===null||s===void 0?void 0:s.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(c=this.params)===null||c===void 0?void 0:c.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,r]},f=Object.assign(Object.assign({},this._requestOptions),t);let d;return this._sendPromise=this._sendPromise.then(()=>ue(this._apiKey,this.model,p,f)).then(l=>{var h;if(X(l.response)){this._history.push(r);const m=Object.assign({parts:[],role:"model"},(h=l.response.candidates)===null||h===void 0?void 0:h[0].content);this._history.push(m)}else{const m=C(l.response);m&&console.warn(`sendMessage() was unsuccessful. ${m}. Inspect response object for details.`)}d=l}).catch(l=>{throw this._sendPromise=Promise.resolve(),l}),await this._sendPromise,d}async sendMessageStream(n,t={}){var o,s,i,a,c,u;await this._sendPromise;const r=O(n),p={safetySettings:(o=this.params)===null||o===void 0?void 0:o.safetySettings,generationConfig:(s=this.params)===null||s===void 0?void 0:s.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(c=this.params)===null||c===void 0?void 0:c.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,r]},f=Object.assign(Object.assign({},this._requestOptions),t),d=le(this._apiKey,this.model,p,f);return this._sendPromise=this._sendPromise.then(()=>d).catch(l=>{throw new Error(Q)}).then(l=>l.response).then(l=>{if(X(l)){this._history.push(r);const h=Object.assign({},l.candidates[0].content);h.role||(h.role="model"),this._history.push(h)}else{const h=C(l);h&&console.warn(`sendMessageStream() was unsuccessful. ${h}. Inspect response object for details.`)}}).catch(l=>{l.message!==Q&&console.error(l)}),d}}async function ut(e,n,t,o){return(await R(n,E.COUNT_TOKENS,e,!1,JSON.stringify(t),o)).json()}async function dt(e,n,t,o){return(await R(n,E.EMBED_CONTENT,e,!1,JSON.stringify(t),o)).json()}async function ft(e,n,t,o){const s=t.requests.map(a=>Object.assign(Object.assign({},a),{model:n}));return(await R(n,E.BATCH_EMBED_CONTENTS,e,!1,JSON.stringify({requests:s}),o)).json()}class Z{constructor(n,t,o={}){this.apiKey=n,this._requestOptions=o,t.model.includes("/")?this.model=t.model:this.model=`models/${t.model}`,this.generationConfig=t.generationConfig||{},this.safetySettings=t.safetySettings||[],this.tools=t.tools,this.toolConfig=t.toolConfig,this.systemInstruction=de(t.systemInstruction),this.cachedContent=t.cachedContent}async generateContent(n,t={}){var o;const s=J(n),i=Object.assign(Object.assign({},this._requestOptions),t);return ue(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(o=this.cachedContent)===null||o===void 0?void 0:o.name},s),i)}async generateContentStream(n,t={}){var o;const s=J(n),i=Object.assign(Object.assign({},this._requestOptions),t);return le(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(o=this.cachedContent)===null||o===void 0?void 0:o.name},s),i)}startChat(n){var t;return new lt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(t=this.cachedContent)===null||t===void 0?void 0:t.name},n),this._requestOptions)}async countTokens(n,t={}){const o=it(n,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),s=Object.assign(Object.assign({},this._requestOptions),t);return ut(this.apiKey,this.model,o,s)}async embedContent(n,t={}){const o=at(n),s=Object.assign(Object.assign({},this._requestOptions),t);return dt(this.apiKey,this.model,o,s)}async batchEmbedContents(n,t={}){const o=Object.assign(Object.assign({},this._requestOptions),t);return ft(this.apiKey,this.model,n,o)}}class ee{constructor(n){this.apiKey=n}getGenerativeModel(n,t){if(!n.model)throw new g("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new Z(this.apiKey,n,t)}getGenerativeModelFromCachedContent(n,t,o){if(!n.name)throw new y("Cached content must contain a `name` field.");if(!n.model)throw new y("Cached content must contain a `model` field.");const s=["model","systemInstruction"];for(const a of s)if(t?.[a]&&n[a]&&t?.[a]!==n[a]){if(a==="model"){const c=t.model.startsWith("models/")?t.model.replace("models/",""):t.model,u=n.model.startsWith("models/")?n.model.replace("models/",""):n.model;if(c===u)continue}throw new y(`Different value for "${a}" specified in modelParams (${t[a]}) and cachedContent (${n[a]})`)}const i=Object.assign(Object.assign({},t),{model:n.model,tools:n.tools,toolConfig:n.toolConfig,systemInstruction:n.systemInstruction,cachedContent:n});return new Z(this.apiKey,i,o)}}function te(e,n){const t=ht(e),o=gt(t,n);return{tools:t,toolConfig:o}}function ht(e){let n=[];const t=[];return e.forEach(s=>{if(se(s)){const[i]=Le([s]);i.functionDeclarations&&n.push(...i.functionDeclarations)}else if(ie(s)){const{functionDeclarations:i}=pt(s);if(i)n.push(...i);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else t.push(s)}),t.find(s=>"functionDeclarations"in s)?t.map(s=>{if(n?.length>0&&"functionDeclarations"in s){const i={functionDeclarations:[...s.functionDeclarations||[],...n]};return n=[],i}return s}):[...t,...n.length>0?[{functionDeclarations:n}]:[]]}function pt(e){return{functionDeclarations:[{name:e.function.name,description:e.function.description,parameters:_(e.function.parameters)}]}}function gt(e,n){if(!e.length||!n)return;const{toolChoice:t,allowedFunctionNames:o}=n,s={any:w.ANY,auto:w.AUTO,none:w.NONE};if(t&&["any","auto","none"].includes(t))return{functionCallingConfig:{mode:s[t]??"MODE_UNSPECIFIED",allowedFunctionNames:o}};if(typeof t=="string"||o)return{functionCallingConfig:{mode:w.ANY,allowedFunctionNames:[...o??[],...t&&typeof t=="string"?[t]:[]]}}}var vt=class extends Ie{static lc_name(){return"ChatGoogleGenerativeAI"}lc_serializable=!0;get lc_secrets(){return{apiKey:"GOOGLE_API_KEY"}}lc_namespace=["langchain","chat_models","google_genai"];get lc_aliases(){return{apiKey:"google_api_key"}}model;temperature;maxOutputTokens;topP;topK;stopSequences=[];safetySettings;apiKey;streaming=!1;json;streamUsage=!0;convertSystemMessageToHumanContent;client;get _isMultimodalModel(){return this.model.includes("vision")||this.model.startsWith("gemini-1.5")||this.model.startsWith("gemini-2")||this.model.startsWith("gemma-3-")&&!this.model.startsWith("gemma-3-1b")}constructor(e){if(super(e),this.model=e.model.replace(/^models\//,""),this.maxOutputTokens=e.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=e.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>2))throw new Error("`temperature` must be in the range of [0.0,2.0]");if(this.topP=e.topP??this.topP,this.topP&&this.topP<0)throw new Error("`topP` must be a positive integer");if(this.topP&&this.topP>1)throw new Error("`topP` must be below 1.");if(this.topK=e.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=e.stopSequences??this.stopSequences,this.apiKey=e.apiKey??Oe("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environment variable GOOGLE_API_KEY or in the `apiKey` field of the ChatGoogleGenerativeAI constructor");if(this.safetySettings=e.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(t=>t.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=e.streaming??this.streaming,this.json=e.json,this.client=new ee(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...this.json?{responseMimeType:"application/json"}:{}}},{apiVersion:e.apiVersion,baseUrl:e.baseUrl}),this.streamUsage=e.streamUsage??this.streamUsage}useCachedContent(e,n,t){this.apiKey&&(this.client=new ee(this.apiKey).getGenerativeModelFromCachedContent(e,n,t))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.model==="gemini-1.0-pro-001"||this.model.startsWith("gemini-pro-vision")||this.model.startsWith("gemini-1.0-pro-vision")?!1:this.model!=="gemini-pro"}getLsParams(e){return{ls_provider:"google_genai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.client.generationConfig.temperature,ls_max_tokens:this.client.generationConfig.maxOutputTokens,ls_stop:e.stop}}_combineLLMOutput(){return[]}_llmType(){return"googlegenerativeai"}bindTools(e,n){return this.withConfig({tools:te(e)?.tools,...n})}invocationParams(e){const n=e?.tools?.length?te(e.tools,{toolChoice:e.tool_choice,allowedFunctionNames:e.allowedFunctionNames}):void 0;return e?.responseSchema?(this.client.generationConfig.responseSchema=e.responseSchema,this.client.generationConfig.responseMimeType="application/json"):(this.client.generationConfig.responseSchema=void 0,this.client.generationConfig.responseMimeType=this.json?"application/json":void 0),{...n?.tools?{tools:n.tools}:{},...n?.toolConfig?{toolConfig:n.toolConfig}:{}}}async _generate(e,n,t){const o=k(e,this._isMultimodalModel,this.useSystemInstruction);let s=o;if(o[0].role==="system"){const[r]=o;this.client.systemInstruction=r,s=o.slice(1)}const i=this.invocationParams(n);if(this.streaming){const r={},p=this._streamResponseChunks(e,n,t),f={};for await(const l of p){const h=l.generationInfo?.completion??0;f[h]===void 0?f[h]=l:f[h]=f[h].concat(l)}return{generations:Object.entries(f).sort(([l],[h])=>parseInt(l,10)-parseInt(h,10)).map(([l,h])=>h),llmOutput:{estimatedTokenUsage:r}}}const a=await this.completionWithRetry({...i,contents:s});let c;if("usageMetadata"in a.response){const r=a.response.usageMetadata;c={input_tokens:r.promptTokenCount??0,output_tokens:r.candidatesTokenCount??0,total_tokens:r.totalTokenCount??0}}const u=ke(a.response,{usageMetadata:c});return u.generations?.length>0&&await t?.handleLLMNewToken(u.generations[0]?.text??""),u}async*_streamResponseChunks(e,n,t){const o=k(e,this._isMultimodalModel,this.useSystemInstruction);let s=o;if(o[0].role==="system"){const[l]=o;this.client.systemInstruction=l,s=o.slice(1)}const a={...this.invocationParams(n),contents:s},c=await this.caller.callWithOptions({signal:n?.signal},async()=>{const{stream:l}=await this.client.generateContentStream(a);return l});let u,r=0,p=0,f=0,d=0;for await(const l of c){if("usageMetadata"in l&&l.usageMetadata!==void 0&&this.streamUsage!==!1&&n.streamUsage!==!1){u={input_tokens:l.usageMetadata.promptTokenCount??0,output_tokens:l.usageMetadata.candidatesTokenCount??0,total_tokens:l.usageMetadata.totalTokenCount??0};const m=l.usageMetadata.promptTokenCount??0;u.input_tokens=Math.max(0,m-r),r=m;const M=l.usageMetadata.candidatesTokenCount??0;u.output_tokens=Math.max(0,M-p),p=M;const x=l.usageMetadata.totalTokenCount??0;u.total_tokens=Math.max(0,x-f),f=x}const h=Ue(l,{usageMetadata:u,index:d});d+=1,h&&(yield h,await t?.handleLLMNewToken(h.text??""))}}async completionWithRetry(e,n){return this.caller.callWithOptions({signal:n?.signal},async()=>{try{return await this.client.generateContent(e)}catch(t){throw t.message?.includes("400 Bad Request")&&(t.status=400),t}})}withStructuredOutput(e,n){const t=e,o=n?.name,s=n?.method,i=n?.includeRaw;if(s==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "jsonSchema" or "functionCalling" as a method.');let a,c;if(s==="functionCalling"){let f=o??"extract",d;if(ne(t)){const l=N(t);d=[{functionDeclarations:[{name:f,description:l.description??"A function available to call.",parameters:l}]}],c=new U({returnSingle:!0,keyName:f,zodSchema:t})}else{let l;typeof t.name=="string"&&typeof t.parameters=="object"&&t.parameters!=null?(l=t,l.parameters=_(t.parameters),f=t.name):l={name:f,description:t.description??"",parameters:_(t)},d=[{functionDeclarations:[l]}],c=new U({returnSingle:!0,keyName:f})}a=this.bindTools(d).withConfig({allowedFunctionNames:[f]})}else{const f=N(t);a=this.withConfig({responseSchema:f}),c=new Re}if(!i)return a.pipe(c).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});const u=D.assign({parsed:(f,d)=>c.invoke(f.raw,d)}),r=D.assign({parsed:()=>null}),p=u.withFallbacks({fallbacks:[r]});return Se.from([{raw:a},p]).withConfig({runName:"StructuredOutputRunnable"})}};export{vt as ChatGoogleGenerativeAI};