@anthropic-ai/claude-agent-sdk 0.3.208 → 0.3.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bridge.mjs +68 -68
- package/browser-sdk.js +7 -7
- package/manifest.json +22 -20
- package/manifest.zst.json +26 -24
- package/package.json +10 -10
- package/sdk-tools.d.ts +21 -2
- package/sdk.d.ts +18 -3
- package/sdk.mjs +43 -43
package/browser-sdk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
|
|
2
2
|
|
|
3
|
-
// Version: 0.3.
|
|
3
|
+
// Version: 0.3.210
|
|
4
4
|
var aE=Object.create;var{getPrototypeOf:uE,defineProperty:ma,getOwnPropertyNames:C_,getOwnPropertyDescriptor:lE}=Object,O_=Object.prototype.hasOwnProperty;function D_(e){return this[e]}var cE,dE,N_=(e,t,r)=>{var i=e!=null&&typeof e==="object";if(i){var n=t?cE??=new WeakMap:dE??=new WeakMap,o=n.get(e);if(o)return o}r=e!=null?aE(uE(e)):{};let s=t||!e||!e.__esModule?ma(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let h of C_(e))if(!O_.call(s,h))ma(s,h,{get:D_.bind(e,h),enumerable:!0})}if(i)n.set(e,s);return s},kt=(e)=>{var t=(R_??=new WeakMap).get(e),r;if(t)return t;if(t=ma({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var i of C_(e))if(!O_.call(t,i))ma(t,i,{get:D_.bind(e,i),enumerable:!(r=lE(e,i))||r.enumerable})}return R_.set(e,t),t},R_,Xe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var fE=(e)=>e;function hE(e,t){this[e]=fE.bind(null,t)}var wn=(e,t)=>{for(var r in t)ma(e,r,{get:t[r],enumerable:!0,configurable:!0,set:hE.bind(t,r)})};var ga=(e,t)=>()=>(e&&(t=e(e=0)),t);var $i=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),pE=Symbol.dispose||Symbol.for("Symbol.dispose"),mE=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Kt=(e,t,r)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(r)i=t[mE];if(i===void 0)i=t[pE];if(typeof i!=="function")throw TypeError("Object not disposable");e.push([r,i,t])}else if(r)e.push([r]);return t},Vt=(e,t,r)=>{var i=typeof SuppressedError==="function"?SuppressedError:function(s,h,v,b){return b=Error(v),b.name="SuppressedError",b.error=s,b.suppressed=h,b},n=(s)=>t=r?new i(s,t,"An error was suppressed during disposal"):(r=!0,s),o=(s)=>{while(s=e.pop())try{var h=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(h).then(o,(v)=>(n(v),o()))}catch(v){n(v)}if(r)throw t};return o()};var $r={};wn($r,{transcode:()=>d$,resolveObjectURL:()=>u$,kStringMaxLength:()=>k1,kMaxLength:()=>ba,isUtf8:()=>l$,isAscii:()=>c$,default:()=>f$,constants:()=>NI,btoa:()=>RI,atob:()=>CI,INSPECT_MAX_BYTES:()=>x1,File:()=>OI,Buffer:()=>fe,Blob:()=>DI});function II(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");if(r===-1)r=t;var i=r===t?0:4-r%4;return[r,i]}function $I(e,t){return(e+t)*3/4-t}function TI(e){var t,r=II(e),i=r[0],n=r[1],o=new Uint8Array($I(i,n)),s=0,h=n>0?i-4:i,v;for(v=0;v<h;v+=4)t=Sn[e.charCodeAt(v)]<<18|Sn[e.charCodeAt(v+1)]<<12|Sn[e.charCodeAt(v+2)]<<6|Sn[e.charCodeAt(v+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;if(n===2)t=Sn[e.charCodeAt(v)]<<2|Sn[e.charCodeAt(v+1)]>>4,o[s++]=t&255;if(n===1)t=Sn[e.charCodeAt(v)]<<10|Sn[e.charCodeAt(v+1)]<<4|Sn[e.charCodeAt(v+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255;return o}function PI(e){return Wn[e>>18&63]+Wn[e>>12&63]+Wn[e>>6&63]+Wn[e&63]}function AI(e,t,r){var i,n=[];for(var o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(PI(i));return n.join("")}function y1(e){var t,r=e.length,i=r%3,n=[],o=16383;for(var s=0,h=r-i;s<h;s+=o)n.push(AI(e,s,s+o>h?h:s+o));if(i===1)t=e[r-1],n.push(Wn[t>>2]+Wn[t<<4&63]+"==");else if(i===2)t=(e[r-2]<<8)+e[r-1],n.push(Wn[t>>10]+Wn[t>>4&63]+Wn[t<<2&63]+"=");return n.join("")}function Ac(e,t,r,i,n){var o,s,h=n*8-i-1,v=(1<<h)-1,b=v>>1,_=-7,g=r?n-1:0,S=r?-1:1,x=e[t+g];g+=S,o=x&(1<<-_)-1,x>>=-_,_+=h;for(;_>0;o=o*256+e[t+g],g+=S,_-=8);s=o&(1<<-_)-1,o>>=-_,_+=i;for(;_>0;s=s*256+e[t+g],g+=S,_-=8);if(o===0)o=1-b;else if(o===v)return s?NaN:(x?-1:1)*(1/0);else s=s+Math.pow(2,i),o=o-b;return(x?-1:1)*s*Math.pow(2,o-i)}function S1(e,t,r,i,n,o){var s,h,v,b=o*8-n-1,_=(1<<b)-1,g=_>>1,S=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,M=i?1:-1,I=t<0||t===0&&1/t<0?1:0;if(t=Math.abs(t),isNaN(t)||t===1/0)h=isNaN(t)?1:0,s=_;else{if(s=Math.floor(Math.log(t)/Math.LN2),t*(v=Math.pow(2,-s))<1)s--,v*=2;if(s+g>=1)t+=S/v;else t+=S*Math.pow(2,1-g);if(t*v>=2)s++,v/=2;if(s+g>=_)h=0,s=_;else if(s+g>=1)h=(t*v-1)*Math.pow(2,n),s=s+g;else h=t*Math.pow(2,g-1)*Math.pow(2,n),s=0}for(;n>=8;e[r+x]=h&255,x+=M,h/=256,n-=8);s=s<<n|h,b+=n;for(;b>0;e[r+x]=s&255,x+=M,s/=256,b-=8);e[r+x-M]|=I*128}function ii(e){if(e>ba)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,fe.prototype),t}function dm(e,t,r){return class extends r{constructor(){super();Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function fe(e,t,r){if(typeof e==="number"){if(typeof t==="string")throw TypeError('The "string" argument must be of type string. Received type number');return fm(e)}return M1(e,t,r)}function M1(e,t,r){if(typeof e==="string")return LI(e,t);if(ArrayBuffer.isView(e))return FI(e);if(e==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Gn(e,ArrayBuffer)||e&&Gn(e.buffer,ArrayBuffer))return lm(e,t,r);if(typeof SharedArrayBuffer<"u"&&(Gn(e,SharedArrayBuffer)||e&&Gn(e.buffer,SharedArrayBuffer)))return lm(e,t,r);if(typeof e==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return fe.from(i,t,r);let n=qI(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==="function")return fe.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function E1(e){if(typeof e!=="number")throw TypeError('"size" argument must be of type number');else if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function UI(e,t,r){if(E1(e),e<=0)return ii(e);if(t!==void 0)return typeof r==="string"?ii(e).fill(t,r):ii(e).fill(t);return ii(e)}function fm(e){return E1(e),ii(e<0?0:hm(e)|0)}function LI(e,t){if(typeof t!=="string"||t==="")t="utf8";if(!fe.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=I1(e,t)|0,i=ii(r),n=i.write(e,t);if(n!==r)i=i.slice(0,n);return i}function um(e){let t=e.length<0?0:hm(e.length)|0,r=ii(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function FI(e){if(Gn(e,Uint8Array)){let t=new Uint8Array(e);return lm(t.buffer,t.byteOffset,t.byteLength)}return um(e)}function lm(e,t,r){if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');let i;if(t===void 0&&r===void 0)i=new Uint8Array(e);else if(r===void 0)i=new Uint8Array(e,t);else i=new Uint8Array(e,t,r);return Object.setPrototypeOf(i,fe.prototype),i}function qI(e){if(fe.isBuffer(e)){let t=hm(e.length)|0,r=ii(t);if(r.length===0)return r;return e.copy(r,0,0,t),r}if(e.length!==void 0){if(typeof e.length!=="number"||Number.isNaN(e.length))return ii(0);return um(e)}if(e.type==="Buffer"&&Array.isArray(e.data))return um(e.data)}function hm(e){if(e>=ba)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ba.toString(16)+" bytes");return e|0}function I1(e,t){if(fe.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Gn(e,ArrayBuffer))return e.byteLength;if(typeof e!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return cm(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return N1(e).length;default:if(n)return i?-1:cm(e).length;t=(""+t).toLowerCase(),n=!0}}function BI(e,t,r){let i=!1;if(t===void 0||t<0)t=0;if(t>this.length)return"";if(r===void 0||r>this.length)r=this.length;if(r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";if(!e)e="utf8";while(!0)switch(e){case"hex":return QI(this,t,r);case"utf8":case"utf-8":return T1(this,t,r);case"ascii":return XI(this,t,r);case"latin1":case"binary":return YI(this,t,r);case"base64":return GI(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e$(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function fo(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function $1(e,t,r,i,n){if(e.length===0)return-1;if(typeof r==="string")i=r,r=0;else if(r>2147483647)r=2147483647;else if(r<-2147483648)r=-2147483648;if(r=+r,Number.isNaN(r))r=n?0:e.length-1;if(r<0)r=e.length+r;if(r>=e.length)if(n)return-1;else r=e.length-1;else if(r<0)if(n)r=0;else return-1;if(typeof t==="string")t=fe.from(t,i);if(fe.isBuffer(t)){if(t.length===0)return-1;return b1(e,t,r,i,n)}else if(typeof t==="number"){if(t=t&255,typeof Uint8Array.prototype.indexOf==="function")if(n)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b1(e,[t],r,i,n)}throw TypeError("val must be string, number or Buffer")}function b1(e,t,r,i,n){let o=1,s=e.length,h=t.length;if(i!==void 0){if(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le"){if(e.length<2||t.length<2)return-1;o=2,s/=2,h/=2,r/=2}}function v(_,g){if(o===1)return _[g];else return _.readUInt16BE(g*o)}let b;if(n){let _=-1;for(b=r;b<s;b++)if(v(e,b)===v(t,_===-1?0:b-_)){if(_===-1)_=b;if(b-_+1===h)return _*o}else{if(_!==-1)b-=b-_;_=-1}}else{if(r+h>s)r=s-h;for(b=r;b>=0;b--){let _=!0;for(let g=0;g<h;g++)if(v(e,b+g)!==v(t,g)){_=!1;break}if(_)return b}}return-1}function HI(e,t,r,i){r=Number(r)||0;let n=e.length-r;if(!i)i=n;else if(i=Number(i),i>n)i=n;let o=t.length;if(i>o/2)i=o/2;let s;for(s=0;s<i;++s){let h=parseInt(t.substr(s*2,2),16);if(Number.isNaN(h))return s;e[r+s]=h}return s}function ZI(e,t,r,i){return Rc(cm(t,e.length-r),e,r,i)}function KI(e,t,r,i){return Rc(i$(t),e,r,i)}function VI(e,t,r,i){return Rc(N1(t),e,r,i)}function WI(e,t,r,i){return Rc(o$(t,e.length-r),e,r,i)}function GI(e,t,r){if(t===0&&r===e.length)return y1(e);else return y1(e.slice(t,r))}function T1(e,t,r){r=Math.min(e.length,r);let i=[],n=t;while(n<r){let o=e[n],s=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h<=r){let v,b,_,g;switch(h){case 1:if(o<128)s=o;break;case 2:if(v=e[n+1],(v&192)===128){if(g=(o&31)<<6|v&63,g>127)s=g}break;case 3:if(v=e[n+1],b=e[n+2],(v&192)===128&&(b&192)===128){if(g=(o&15)<<12|(v&63)<<6|b&63,g>2047&&(g<55296||g>57343))s=g}break;case 4:if(v=e[n+1],b=e[n+2],_=e[n+3],(v&192)===128&&(b&192)===128&&(_&192)===128){if(g=(o&15)<<18|(v&63)<<12|(b&63)<<6|_&63,g>65535&&g<1114112)s=g}}}if(s===null)s=65533,h=1;else if(s>65535)s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023;i.push(s),n+=h}return JI(i)}function JI(e){let t=e.length;if(t<=_1)return String.fromCharCode.apply(String,e);let r="",i=0;while(i<t)r+=String.fromCharCode.apply(String,e.slice(i,i+=_1));return r}function XI(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function YI(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function QI(e,t,r){let i=e.length;if(!t||t<0)t=0;if(!r||r<0||r>i)r=i;let n="";for(let o=t;o<r;++o)n+=s$[e[o]];return n}function e$(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}function Ir(e,t,r){if(e%1!==0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function Yr(e,t,r,i,n,o){if(!fe.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function P1(e,t,r,i,n){D1(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function A1(e,t,r,i,n){D1(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}function R1(e,t,r,i,n,o){if(r+i>e.length)throw RangeError("Index out of range");if(r<0)throw RangeError("Index out of range")}function C1(e,t,r,i,n){if(t=+t,r=r>>>0,!n)R1(e,t,r,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return S1(e,t,r,i,23,4),r+4}function O1(e,t,r,i,n){if(t=+t,r=r>>>0,!n)R1(e,t,r,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return S1(e,t,r,i,52,8),r+8}function w1(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function t$(e,t,r){if(ns(t,"offset"),e[t]===void 0||e[t+r]===void 0)_a(t,e.length-(r+1))}function D1(e,t,r,i,n,o){if(e>r||e<t){let s=typeof t==="bigint"?"n":"",h;if(o>3)if(t===0||t===BigInt(0))h=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`;else h=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`;else h=`>= ${t}${s} and <= ${r}${s}`;throw new am("value",h,e)}t$(i,n,o)}function ns(e,t){if(typeof e!=="number")throw new jI(t,"number",e)}function _a(e,t,r){if(Math.floor(e)!==e)throw ns(e,r),new am(r||"offset","an integer",e);if(t<0)throw new zI;throw new am(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}function n$(e){if(e=e.split("=")[0],e=e.trim().replace(r$,""),e.length<2)return"";while(e.length%4!==0)e=e+"=";return e}function cm(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(s+1===i){if((t-=3)>-1)o.push(239,191,189);continue}n=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);n=r;continue}r=(n-55296<<10|r-56320)+65536}else if(n){if((t-=3)>-1)o.push(239,191,189)}if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return o}function i$(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function o$(e,t){let r,i,n,o=[];for(let s=0;s<e.length;++s){if((t-=2)<0)break;r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i)}return o}function N1(e){return TI(n$(e))}function Rc(e,t,r,i){let n;for(n=0;n<i;++n){if(n+r>=t.length||n>=e.length)break;t[n+r]=e[n]}return n}function Gn(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ai(e){return typeof BigInt>"u"?a$:e}function a$(){throw Error("BigInt not supported")}function pm(e){return()=>{throw Error(e+" is not implemented for node:buffer browser polyfill")}}var Wn,Sn,sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",co,g1,v1,x1=50,ba=2147483647,k1=536870888,RI,CI,OI,DI,NI,zI,jI,am,_1=4096,r$,s$,u$,l$,c$=(e)=>{for(let t of e)if(t.charCodeAt(0)>127)return!1;return!0},d$,f$;var Tr=ga(()=>{Wn=[],Sn=[];for(co=0,g1=sm.length;co<g1;++co)Wn[co]=sm[co],Sn[sm.charCodeAt(co)]=co;Sn[45]=62;Sn[95]=63;v1=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,RI=globalThis.btoa,CI=globalThis.atob,OI=globalThis.File,DI=globalThis.Blob,NI={MAX_LENGTH:ba,MAX_STRING_LENGTH:k1};zI=dm("ERR_BUFFER_OUT_OF_BOUNDS",function(e){if(e)return`${e} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),jI=dm("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),am=dm("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;if(Number.isInteger(r)&&Math.abs(r)>4294967296)n=w1(String(r));else if(typeof r==="bigint"){if(n=String(r),r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))n=w1(n);n+="n"}return i+=` It must be ${t}. Received ${n}`,i},RangeError);Object.defineProperty(fe.prototype,"parent",{enumerable:!0,get:function(){if(!fe.isBuffer(this))return;return this.buffer}});Object.defineProperty(fe.prototype,"offset",{enumerable:!0,get:function(){if(!fe.isBuffer(this))return;return this.byteOffset}});fe.poolSize=8192;fe.from=function(e,t,r){return M1(e,t,r)};Object.setPrototypeOf(fe.prototype,Uint8Array.prototype);Object.setPrototypeOf(fe,Uint8Array);fe.alloc=function(e,t,r){return UI(e,t,r)};fe.allocUnsafe=function(e){return fm(e)};fe.allocUnsafeSlow=function(e){return fm(e)};fe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==fe.prototype};fe.compare=function(e,t){if(Gn(e,Uint8Array))e=fe.from(e,e.offset,e.byteLength);if(Gn(t,Uint8Array))t=fe.from(t,t.offset,t.byteLength);if(!fe.isBuffer(e)||!fe.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}if(r<i)return-1;if(i<r)return 1;return 0};fe.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};fe.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return fe.alloc(0);let r;if(t===void 0){t=0;for(r=0;r<e.length;++r)t+=e[r].length}let i=fe.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){let o=e[r];if(Gn(o,Uint8Array))if(n+o.length>i.length){if(!fe.isBuffer(o))o=fe.from(o);o.copy(i,n)}else Uint8Array.prototype.set.call(i,o,n);else if(!fe.isBuffer(o))throw TypeError('"list" argument must be an Array of Buffers');else o.copy(i,n);n+=o.length}return i};fe.byteLength=I1;fe.prototype._isBuffer=!0;fe.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)fo(this,t,t+1);return this};fe.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)fo(this,t,t+3),fo(this,t+1,t+2);return this};fe.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)fo(this,t,t+7),fo(this,t+1,t+6),fo(this,t+2,t+5),fo(this,t+3,t+4);return this};fe.prototype.toString=function(){let e=this.length;if(e===0)return"";if(arguments.length===0)return T1(this,0,e);return BI.apply(this,arguments)};fe.prototype.toLocaleString=fe.prototype.toString;fe.prototype.equals=function(e){if(!fe.isBuffer(e))throw TypeError("Argument must be a Buffer");if(this===e)return!0;return fe.compare(this,e)===0};fe.prototype.inspect=function(){let e="",t=x1;if(e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t)e+=" ... ";return"<Buffer "+e+">"};if(v1)fe.prototype[v1]=fe.prototype.inspect;fe.prototype.compare=function(e,t,r,i,n){if(Gn(e,Uint8Array))e=fe.from(e,e.offset,e.byteLength);if(!fe.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0)t=0;if(r===void 0)r=e?e.length:0;if(i===void 0)i=0;if(n===void 0)n=this.length;if(t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;let o=n-i,s=r-t,h=Math.min(o,s),v=this.slice(i,n),b=e.slice(t,r);for(let _=0;_<h;++_)if(v[_]!==b[_]){o=v[_],s=b[_];break}if(o<s)return-1;if(s<o)return 1;return 0};fe.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1};fe.prototype.indexOf=function(e,t,r){return $1(this,e,t,r,!0)};fe.prototype.lastIndexOf=function(e,t,r){return $1(this,e,t,r,!1)};fe.prototype.write=function(e,t,r,i){if(t===void 0)i="utf8",r=this.length,t=0;else if(r===void 0&&typeof t==="string")i=t,r=this.length,t=0;else if(isFinite(t))if(t=t>>>0,isFinite(r)){if(r=r>>>0,i===void 0)i="utf8"}else i=r,r=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let n=this.length-t;if(r===void 0||r>n)r=n;if(e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!i)i="utf8";let o=!1;for(;;)switch(i){case"hex":return HI(this,e,t,r);case"utf8":case"utf-8":return ZI(this,e,t,r);case"ascii":case"latin1":case"binary":return KI(this,e,t,r);case"base64":return VI(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return WI(this,e,t,r);default:if(o)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};fe.prototype.slice=function(e,t){let r=this.length;if(e=~~e,t=t===void 0?r:~~t,e<0){if(e+=r,e<0)e=0}else if(e>r)e=r;if(t<0){if(t+=r,t<0)t=0}else if(t>r)t=r;if(t<e)t=e;let i=this.subarray(e,t);return Object.setPrototypeOf(i,fe.prototype),i};fe.prototype.readUintLE=fe.prototype.readUIntLE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Ir(e,t,this.length);let i=this[e],n=1,o=0;while(++o<t&&(n*=256))i+=this[e+o]*n;return i};fe.prototype.readUintBE=fe.prototype.readUIntBE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Ir(e,t,this.length);let i=this[e+--t],n=1;while(t>0&&(n*=256))i+=this[e+--t]*n;return i};fe.prototype.readUint8=fe.prototype.readUInt8=function(e,t){if(e=e>>>0,!t)Ir(e,1,this.length);return this[e]};fe.prototype.readUint16LE=fe.prototype.readUInt16LE=function(e,t){if(e=e>>>0,!t)Ir(e,2,this.length);return this[e]|this[e+1]<<8};fe.prototype.readUint16BE=fe.prototype.readUInt16BE=function(e,t){if(e=e>>>0,!t)Ir(e,2,this.length);return this[e]<<8|this[e+1]};fe.prototype.readUint32LE=fe.prototype.readUInt32LE=function(e,t){if(e=e>>>0,!t)Ir(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};fe.prototype.readUint32BE=fe.prototype.readUInt32BE=function(e,t){if(e=e>>>0,!t)Ir(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};fe.prototype.readBigUInt64LE=Ai(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=t+this[++e]*256+this[++e]*65536+this[++e]*16777216,n=this[++e]+this[++e]*256+this[++e]*65536+r*16777216;return BigInt(i)+(BigInt(n)<<BigInt(32))});fe.prototype.readBigUInt64BE=Ai(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=t*16777216+this[++e]*65536+this[++e]*256+this[++e],n=this[++e]*16777216+this[++e]*65536+this[++e]*256+r;return(BigInt(i)<<BigInt(32))+BigInt(n)});fe.prototype.readIntLE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Ir(e,t,this.length);let i=this[e],n=1,o=0;while(++o<t&&(n*=256))i+=this[e+o]*n;if(n*=128,i>=n)i-=Math.pow(2,8*t);return i};fe.prototype.readIntBE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Ir(e,t,this.length);let i=t,n=1,o=this[e+--i];while(i>0&&(n*=256))o+=this[e+--i]*n;if(n*=128,o>=n)o-=Math.pow(2,8*t);return o};fe.prototype.readInt8=function(e,t){if(e=e>>>0,!t)Ir(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};fe.prototype.readInt16LE=function(e,t){if(e=e>>>0,!t)Ir(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};fe.prototype.readInt16BE=function(e,t){if(e=e>>>0,!t)Ir(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};fe.prototype.readInt32LE=function(e,t){if(e=e>>>0,!t)Ir(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};fe.prototype.readInt32BE=function(e,t){if(e=e>>>0,!t)Ir(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};fe.prototype.readBigInt64LE=Ai(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=this[e+4]+this[e+5]*256+this[e+6]*65536+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*65536+this[++e]*16777216)});fe.prototype.readBigInt64BE=Ai(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=(t<<24)+this[++e]*65536+this[++e]*256+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*16777216+this[++e]*65536+this[++e]*256+r)});fe.prototype.readFloatLE=function(e,t){if(e=e>>>0,!t)Ir(e,4,this.length);return Ac(this,e,!0,23,4)};fe.prototype.readFloatBE=function(e,t){if(e=e>>>0,!t)Ir(e,4,this.length);return Ac(this,e,!1,23,4)};fe.prototype.readDoubleLE=function(e,t){if(e=e>>>0,!t)Ir(e,8,this.length);return Ac(this,e,!0,52,8)};fe.prototype.readDoubleBE=function(e,t){if(e=e>>>0,!t)Ir(e,8,this.length);return Ac(this,e,!1,52,8)};fe.prototype.writeUintLE=fe.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let s=Math.pow(2,8*r)-1;Yr(this,e,t,r,s,0)}let n=1,o=0;this[t]=e&255;while(++o<r&&(n*=256))this[t+o]=e/n&255;return t+r};fe.prototype.writeUintBE=fe.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let s=Math.pow(2,8*r)-1;Yr(this,e,t,r,s,0)}let n=r-1,o=1;this[t+n]=e&255;while(--n>=0&&(o*=256))this[t+n]=e/o&255;return t+r};fe.prototype.writeUint8=fe.prototype.writeUInt8=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,1,255,0);return this[t]=e&255,t+1};fe.prototype.writeUint16LE=fe.prototype.writeUInt16LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,65535,0);return this[t]=e&255,this[t+1]=e>>>8,t+2};fe.prototype.writeUint16BE=fe.prototype.writeUInt16BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,65535,0);return this[t]=e>>>8,this[t+1]=e&255,t+2};fe.prototype.writeUint32LE=fe.prototype.writeUInt32LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,4294967295,0);return this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};fe.prototype.writeUint32BE=fe.prototype.writeUInt32BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,4294967295,0);return this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};fe.prototype.writeBigUInt64LE=Ai(function(e,t=0){return P1(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeBigUInt64BE=Ai(function(e,t=0){return A1(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let h=Math.pow(2,8*r-1);Yr(this,e,t,r,h-1,-h)}let n=0,o=1,s=0;this[t]=e&255;while(++n<r&&(o*=256)){if(e<0&&s===0&&this[t+n-1]!==0)s=1;this[t+n]=(e/o>>0)-s&255}return t+r};fe.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let h=Math.pow(2,8*r-1);Yr(this,e,t,r,h-1,-h)}let n=r-1,o=1,s=0;this[t+n]=e&255;while(--n>=0&&(o*=256)){if(e<0&&s===0&&this[t+n+1]!==0)s=1;this[t+n]=(e/o>>0)-s&255}return t+r};fe.prototype.writeInt8=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,1,127,-128);if(e<0)e=255+e+1;return this[t]=e&255,t+1};fe.prototype.writeInt16LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,32767,-32768);return this[t]=e&255,this[t+1]=e>>>8,t+2};fe.prototype.writeInt16BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,32767,-32768);return this[t]=e>>>8,this[t+1]=e&255,t+2};fe.prototype.writeInt32LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,2147483647,-2147483648);return this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};fe.prototype.writeInt32BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;return this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};fe.prototype.writeBigInt64LE=Ai(function(e,t=0){return P1(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeBigInt64BE=Ai(function(e,t=0){return A1(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeFloatLE=function(e,t,r){return C1(this,e,t,!0,r)};fe.prototype.writeFloatBE=function(e,t,r){return C1(this,e,t,!1,r)};fe.prototype.writeDoubleLE=function(e,t,r){return O1(this,e,t,!0,r)};fe.prototype.writeDoubleBE=function(e,t,r){return O1(this,e,t,!1,r)};fe.prototype.copy=function(e,t,r,i){if(!fe.isBuffer(e))throw TypeError("argument should be a Buffer");if(!r)r=0;if(!i&&i!==0)i=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(i>0&&i<r)i=r;if(i===r)return 0;if(e.length===0||this.length===0)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(e.length-t<i-r)i=e.length-t+r;let n=i-r;if(this===e&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(t,r,i);else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return n};fe.prototype.fill=function(e,t,r,i){if(typeof e==="string"){if(typeof t==="string")i=t,t=0,r=this.length;else if(typeof r==="string")i=r,r=this.length;if(i!==void 0&&typeof i!=="string")throw TypeError("encoding must be a string");if(typeof i==="string"&&!fe.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);if(i==="utf8"&&o<128||i==="latin1")e=o}}else if(typeof e==="number")e=e&255;else if(typeof e==="boolean")e=Number(e);if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t=t>>>0,r=r===void 0?this.length:r>>>0,!e)e=0;let n;if(typeof e==="number")for(n=t;n<r;++n)this[n]=e;else{let o=fe.isBuffer(e)?e:fe.from(e,i),s=o.length;if(s===0)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=o[n%s]}return this};r$=/[^+/0-9A-Za-z-_]/g;s$=function(){let e=Array(256);for(let t=0;t<16;++t){let r=t*16;for(let i=0;i<16;++i)e[r+i]="0123456789abcdef"[t]+"0123456789abcdef"[i]}return e}();u$=pm("resolveObjectURL"),l$=pm("isUtf8"),d$=pm("transcode"),f$=fe});var K1={};wn(K1,{types:()=>S$,promisify:()=>q1,log:()=>U1,isUndefined:()=>is,isSymbol:()=>k$,isString:()=>jc,isRegExp:()=>Cc,isPrimitive:()=>M$,isObject:()=>os,isNumber:()=>j1,isNullOrUndefined:()=>x$,isNull:()=>zc,isFunction:()=>Dc,isError:()=>Oc,isDate:()=>vm,isBuffer:()=>E$,isBoolean:()=>_m,isArray:()=>z1,inspect:()=>ho,inherits:()=>L1,format:()=>bm,deprecate:()=>p$,default:()=>T$,debuglog:()=>m$,callbackifyOnRejected:()=>xm,callbackify:()=>B1,_extend:()=>Sm,TextEncoder:()=>H1,TextDecoder:()=>Z1});function bm(e,...t){if(!jc(e)){var r=[e];for(var i=0;i<t.length;i++)r.push(ho(t[i]));return r.join(" ")}var i=0,n=t.length,o=String(e).replace(h$,function(h){if(h==="%%")return"%";if(i>=n)return h;switch(h){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch(v){return"[Circular]"}default:return h}});for(var s=t[i];i<n;s=t[++i])if(zc(s)||!os(s))o+=" "+s;else o+=" "+ho(s);return o}function p$(e,t){if(typeof process>"u"||process?.noDeprecation===!0)return e;var r=!1;function i(...n){if(!r){if(process.throwDeprecation)throw Error(t);else if(process.traceDeprecation)console.trace(t);else console.error(t);r=!0}return e.apply(this,...n)}return i}function g$(e,t){var r=ho.styles[t];if(r)return"\x1B["+ho.colors[r][0]+"m"+e+"\x1B["+ho.colors[r][1]+"m";else return e}function y$(e,t){return e}function v$(e){var t={};return e.forEach(function(r,i){t[r]=!0}),t}function Nc(e,t,r){if(e.customInspect&&t&&Dc(t.inspect)&&t.inspect!==ho&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(r,e);if(!jc(i))i=Nc(e,i,r);return i}var n=b$(e,t);if(n)return n;var o=Object.keys(t),s=v$(o);if(e.showHidden)o=Object.getOwnPropertyNames(t);if(Oc(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return mm(t);if(o.length===0){if(Dc(t)){var h=t.name?": "+t.name:"";return e.stylize("[Function"+h+"]","special")}if(Cc(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(vm(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Oc(t))return mm(t)}var v="",b=!1,_=["{","}"];if(z1(t))b=!0,_=["[","]"];if(Dc(t)){var g=t.name?": "+t.name:"";v=" [Function"+g+"]"}if(Cc(t))v=" "+RegExp.prototype.toString.call(t);if(vm(t))v=" "+Date.prototype.toUTCString.call(t);if(Oc(t))v=" "+mm(t);if(o.length===0&&(!b||t.length==0))return _[0]+v+_[1];if(r<0)if(Cc(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");else return e.stylize("[Object]","special");e.seen.push(t);var S;if(b)S=_$(e,t,r,s,o);else S=o.map(function(x){return ym(e,t,r,s,x,b)});return e.seen.pop(),w$(S,v,_)}function b$(e,t){if(is(t))return e.stylize("undefined","undefined");if(jc(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(j1(t))return e.stylize(""+t,"number");if(_m(t))return e.stylize(""+t,"boolean");if(zc(t))return e.stylize("null","null")}function mm(e){return"["+Error.prototype.toString.call(e)+"]"}function _$(e,t,r,i,n){var o=[];for(var s=0,h=t.length;s<h;++s)if(F1(t,String(s)))o.push(ym(e,t,r,i,String(s),!0));else o.push("");return n.forEach(function(v){if(!v.match(/^\d+$/))o.push(ym(e,t,r,i,v,!0))}),o}function ym(e,t,r,i,n,o){var s,h,v;if(v=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]},v.get)if(v.set)h=e.stylize("[Getter/Setter]","special");else h=e.stylize("[Getter]","special");else if(v.set)h=e.stylize("[Setter]","special");if(!F1(i,n))s="["+n+"]";if(!h)if(e.seen.indexOf(v.value)<0){if(zc(r))h=Nc(e,v.value,null);else h=Nc(e,v.value,r-1);if(h.indexOf(`
|
|
5
5
|
`)>-1)if(o)h=h.split(`
|
|
6
6
|
`).map(function(b){return" "+b}).join(`
|
|
@@ -20,10 +20,10 @@ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_S
|
|
|
20
20
|
`:""},this._extScope=e,this._scope=new Bn.Scope({parent:e}),this._nodes=[new Tk]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,i){let n=this._scope.toName(t);if(r!==void 0&&i)this._constants[n.str]=r;return this._leafNode(new xk(e,n,r)),n}const(e,t,r){return this._def(Bn.varKinds.const,e,t,r)}let(e,t,r){return this._def(Bn.varKinds.let,e,t,r)}var(e,t,r){return this._def(Bn.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new $b(e,t,r))}add(e,t){return this._leafNode(new kk(e,an.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==xt.nil)this._leafNode(new $k(e));return this}object(...e){let t=["{"];for(let[r,i]of e){if(t.length>1)t.push(",");if(t.push(r),r!==i||this.opts.es5)t.push(":"),(0,xt.addCodeArg)(t,i)}return t.push("}"),new xt._Code(t)}if(e,t,r){if(this._blockNode(new ki(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ki(e))}else(){return this._elseNode(new sc)}endIf(){return this._endBlockNode(ki,sc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Pk(e),t)}forRange(e,t,r,i,n=this.opts.es5?Bn.varKinds.var:Bn.varKinds.let){let o=this._scope.toName(e);return this._for(new Ak(n,o,t,r),()=>i(o))}forOf(e,t,r,i=Bn.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let o=t instanceof xt.Name?t:this.var("_arr",t);return this.forRange("_i",0,xt._`${o}.length`,(s)=>{this.var(n,xt._`${o}[${s}]`),r(n)})}return this._for(new Eb("of",i,n,t),()=>r(n))}forIn(e,t,r,i=this.opts.es5?Bn.varKinds.var:Bn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,xt._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new Eb("in",i,n,t),()=>r(n))}endFor(){return this._endBlockNode(na)}label(e){return this._leafNode(new Mk(e))}break(e){return this._leafNode(new Ek(e))}return(e){let t=new Sp;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Sp)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new Rk;if(this._blockNode(i),this.code(e),t){let n=this.name("e");this._currNode=i.catch=new xp(n),t(n)}if(r)this._currNode=i.finally=new kp,this.code(r);return this._endBlockNode(xp,kp)}throw(e){return this._leafNode(new Ik(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=xt.nil,r,i){if(this._blockNode(new wp(e,t,r)),i)this.code(i).endFunc();return this}endFunc(){return this._endBlockNode(wp)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof ki))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}an.CodeGen=Ck;function Zo(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Mp(e,t){return t instanceof xt._CodeOrName?Zo(e,t.names):e}function ia(e,t,r){if(e instanceof xt.Name)return i(e);if(!n(e))return e;return new xt._Code(e._items.reduce((o,s)=>{if(s instanceof xt.Name)s=i(s);if(s instanceof xt._Code)o.push(...s._items);else o.push(s);return o},[]));function i(o){let s=r[o.str];if(s===void 0||t[o.str]!==1)return o;return delete t[o.str],s}function n(o){return o instanceof xt._Code&&o._items.some((s)=>s instanceof xt.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function MN(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Ok(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:xt._`!${Ib(e)}`}an.not=Ok;var EN=Dk(an.operators.AND);function IN(...e){return e.reduce(EN)}an.and=IN;var $N=Dk(an.operators.OR);function TN(...e){return e.reduce($N)}an.or=TN;function Dk(e){return(t,r)=>t===xt.nil?r:r===xt.nil?t:xt._`${Ib(t)} ${e} ${Ib(r)}`}function Ib(e){return e instanceof xt.Name?e:xt._`(${e})`}});var Mt=Xe(function(Hk){Object.defineProperty(Hk,"__esModule",{value:!0});Hk.checkStrictMode=Hk.getErrorPath=Hk.Type=Hk.useFunc=Hk.setEvaluated=Hk.evaluatedPropsToName=Hk.mergeEvaluated=Hk.eachItem=Hk.unescapeJsonPointer=Hk.escapeJsonPointer=Hk.escapeFragment=Hk.unescapeFragment=Hk.schemaRefOrVal=Hk.schemaHasRulesButRef=Hk.schemaHasRules=Hk.checkUnknownRules=Hk.alwaysValidSchema=Hk.toHash=void 0;var jt=gt(),CN=oc();function ON(e){let t={};for(let r of e)t[r]=!0;return t}Hk.toHash=ON;function DN(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Uk(e,t),!Lk(t,e.self.RULES.all)}Hk.alwaysValidSchema=DN;function Uk(e,t=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=i.RULES.keywords;for(let o in t)if(!n[o])Bk(e,`unknown keyword: "${o}"`)}Hk.checkUnknownRules=Uk;function Lk(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Hk.schemaHasRules=Lk;function NN(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Hk.schemaHasRulesButRef=NN;function zN({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return jt._`${r}`}return jt._`${e}${t}${(0,jt.getProperty)(i)}`}Hk.schemaRefOrVal=zN;function jN(e){return Fk(decodeURIComponent(e))}Hk.unescapeFragment=jN;function UN(e){return encodeURIComponent(Pb(e))}Hk.escapeFragment=UN;function Pb(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Hk.escapeJsonPointer=Pb;function Fk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Hk.unescapeJsonPointer=Fk;function LN(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Hk.eachItem=LN;function zk({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,h)=>{let v=s===void 0?o:s instanceof jt.Name?(o instanceof jt.Name?e(n,o,s):t(n,o,s),s):o instanceof jt.Name?(t(n,s,o),o):r(o,s);return h===jt.Name&&!(v instanceof jt.Name)?i(n,v):v}}Hk.mergeEvaluated={props:zk({mergeNames:(e,t,r)=>e.if(jt._`${r} !== true && ${t} !== undefined`,()=>{e.if(jt._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,jt._`${r} || {}`).code(jt._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(jt._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,jt._`${r} || {}`),Ab(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:qk}),items:zk({mergeNames:(e,t,r)=>e.if(jt._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,jt._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(jt._`${r} !== true`,()=>e.assign(r,t===!0?!0:jt._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function qk(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",jt._`{}`);if(t!==void 0)Ab(e,r,t);return r}Hk.evaluatedPropsToName=qk;function Ab(e,t,r){Object.keys(r).forEach((i)=>e.assign(jt._`${t}${(0,jt.getProperty)(i)}`,!0))}Hk.setEvaluated=Ab;var jk={};function FN(e,t){return e.scopeValue("func",{ref:t,code:jk[t.code]||(jk[t.code]=new CN._Code(t.code))})}Hk.useFunc=FN;var Tb;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Tb||(Hk.Type=Tb={}));function qN(e,t,r){if(e instanceof jt.Name){let i=t===Tb.Num;return r?i?jt._`"[" + ${e} + "]"`:jt._`"['" + ${e} + "']"`:i?jt._`"/" + ${e}`:jt._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,jt.getProperty)(e).toString():"/"+Pb(e)}Hk.getErrorPath=qN;function Bk(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Hk.checkStrictMode=Bk});var Mi=Xe(function(Kk){Object.defineProperty(Kk,"__esModule",{value:!0});var Br=gt(),sz={data:new Br.Name("data"),valCxt:new Br.Name("valCxt"),instancePath:new Br.Name("instancePath"),parentData:new Br.Name("parentData"),parentDataProperty:new Br.Name("parentDataProperty"),rootData:new Br.Name("rootData"),dynamicAnchors:new Br.Name("dynamicAnchors"),vErrors:new Br.Name("vErrors"),errors:new Br.Name("errors"),this:new Br.Name("this"),self:new Br.Name("self"),scope:new Br.Name("scope"),json:new Br.Name("json"),jsonPos:new Br.Name("jsonPos"),jsonLen:new Br.Name("jsonLen"),jsonPart:new Br.Name("jsonPart")};Kk.default=sz});var ac=Xe(function(Jk){Object.defineProperty(Jk,"__esModule",{value:!0});Jk.extendErrors=Jk.resetErrorsCount=Jk.reportExtraError=Jk.reportError=Jk.keyword$DataError=Jk.keywordError=void 0;var Et=gt(),Tp=Mt(),Jr=Mi();Jk.keywordError={message:({keyword:e})=>Et.str`must pass "${e}" keyword validation`};Jk.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Et.str`"${e}" keyword must be ${t} ($data)`:Et.str`"${e}" keyword is invalid ($data)`};function uz(e,t=Jk.keywordError,r,i){let{it:n}=e,{gen:o,compositeRule:s,allErrors:h}=n,v=Gk(e,t,r);if(i!==null&&i!==void 0?i:s||h)Vk(o,v);else Wk(n,Et._`[${v}]`)}Jk.reportError=uz;function lz(e,t=Jk.keywordError,r){let{it:i}=e,{gen:n,compositeRule:o,allErrors:s}=i,h=Gk(e,t,r);if(Vk(n,h),!(o||s))Wk(i,Jr.default.vErrors)}Jk.reportExtraError=lz;function cz(e,t){e.assign(Jr.default.errors,t),e.if(Et._`${Jr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Et._`${Jr.default.vErrors}.length`,t),()=>e.assign(Jr.default.vErrors,null)))}Jk.resetErrorsCount=cz;function dz({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,Jr.default.errors,(h)=>{if(e.const(s,Et._`${Jr.default.vErrors}[${h}]`),e.if(Et._`${s}.instancePath === undefined`,()=>e.assign(Et._`${s}.instancePath`,(0,Et.strConcat)(Jr.default.instancePath,o.errorPath))),e.assign(Et._`${s}.schemaPath`,Et.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(Et._`${s}.schema`,r),e.assign(Et._`${s}.data`,i)})}Jk.extendErrors=dz;function Vk(e,t){let r=e.const("err",t);e.if(Et._`${Jr.default.vErrors} === null`,()=>e.assign(Jr.default.vErrors,Et._`[${r}]`),Et._`${Jr.default.vErrors}.push(${r})`),e.code(Et._`${Jr.default.errors}++`)}function Wk(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;if(n.$async)r.throw(Et._`new ${e.ValidationError}(${t})`);else r.assign(Et._`${i}.errors`,t),r.return(!1)}var Ko={keyword:new Et.Name("keyword"),schemaPath:new Et.Name("schemaPath"),params:new Et.Name("params"),propertyName:new Et.Name("propertyName"),message:new Et.Name("message"),schema:new Et.Name("schema"),parentSchema:new Et.Name("parentSchema")};function Gk(e,t,r){let{createErrors:i}=e.it;if(i===!1)return Et._`{}`;return fz(e,t,r)}function fz(e,t,r={}){let{gen:i,it:n}=e,o=[hz(n,r),pz(e,r)];return mz(e,t,o),i.object(...o)}function hz({errorPath:e},{instancePath:t}){let r=t?Et.str`${e}${(0,Tp.getErrorPath)(t,Tp.Type.Str)}`:e;return[Jr.default.instancePath,(0,Et.strConcat)(Jr.default.instancePath,r)]}function pz({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:Et.str`${t}/${e}`;if(r)n=Et.str`${n}${(0,Tp.getErrorPath)(r,Tp.Type.Str)}`;return[Ko.schemaPath,n]}function mz(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:s,it:h}=e,{opts:v,propertyName:b,topSchemaRef:_,schemaPath:g}=h;if(i.push([Ko.keyword,n],[Ko.params,typeof t=="function"?t(e):t||Et._`{}`]),v.messages)i.push([Ko.message,typeof r=="function"?r(e):r]);if(v.verbose)i.push([Ko.schema,s],[Ko.parentSchema,Et._`${_}${g}`],[Jr.default.data,o]);if(b)i.push([Ko.propertyName,b])}});var tM=Xe(function(Qk){Object.defineProperty(Qk,"__esModule",{value:!0});Qk.boolOrEmptySchema=Qk.topBoolOrEmptySchema=void 0;var _z=ac(),wz=gt(),Sz=Mi(),xz={message:"boolean schema is false"};function kz(e){let{gen:t,schema:r,validateName:i}=e;if(r===!1)Yk(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Sz.default.data);else t.assign(wz._`${i}.errors`,null),t.return(!0)}Qk.topBoolOrEmptySchema=kz;function Mz(e,t){let{gen:r,schema:i}=e;if(i===!1)r.var(t,!1),Yk(e);else r.var(t,!0)}Qk.boolOrEmptySchema=Mz;function Yk(e,t){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,_z.reportError)(n,xz,void 0,t)}});var Cb=Xe(function(rM){Object.defineProperty(rM,"__esModule",{value:!0});rM.getRules=rM.isJSONType=void 0;var Iz=["string","number","integer","boolean","null","object","array"],$z=new Set(Iz);function Tz(e){return typeof e=="string"&&$z.has(e)}rM.isJSONType=Tz;function Pz(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}rM.getRules=Pz});var Ob=Xe(function(sM){Object.defineProperty(sM,"__esModule",{value:!0});sM.shouldUseRule=sM.shouldUseGroup=sM.schemaHasRulesForType=void 0;function Rz({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&iM(e,i)}sM.schemaHasRulesForType=Rz;function iM(e,t){return t.rules.some((r)=>oM(e,r))}sM.shouldUseGroup=iM;function oM(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((i)=>e[i]!==void 0))}sM.shouldUseRule=oM});var uc=Xe(function(dM){Object.defineProperty(dM,"__esModule",{value:!0});dM.reportTypeError=dM.checkDataTypes=dM.checkDataType=dM.coerceAndCheckDataType=dM.getJSONTypes=dM.getSchemaTypes=dM.DataType=void 0;var Dz=Cb(),Nz=Ob(),zz=ac(),pt=gt(),uM=Mt(),oa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(oa||(dM.DataType=oa={}));function jz(e){let t=lM(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}dM.getSchemaTypes=jz;function lM(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Dz.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}dM.getJSONTypes=lM;function Uz(e,t){let{gen:r,data:i,opts:n}=e,o=Lz(t,n.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&(0,Nz.schemaHasRulesForType)(e,t[0]));if(s){let h=Nb(t,i,n.strictNumbers,oa.Wrong);r.if(h,()=>{if(o.length)Fz(e,t,o);else zb(e)})}return s}dM.coerceAndCheckDataType=Uz;var cM=new Set(["string","number","integer","boolean","null"]);function Lz(e,t){return t?e.filter((r)=>cM.has(r)||t==="array"&&r==="array"):[]}function Fz(e,t,r){let{gen:i,data:n,opts:o}=e,s=i.let("dataType",pt._`typeof ${n}`),h=i.let("coerced",pt._`undefined`);if(o.coerceTypes==="array")i.if(pt._`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,pt._`${n}[0]`).assign(s,pt._`typeof ${n}`).if(Nb(t,n,o.strictNumbers),()=>i.assign(h,n)));i.if(pt._`${h} !== undefined`);for(let b of r)if(cM.has(b)||b==="array"&&o.coerceTypes==="array")v(b);i.else(),zb(e),i.endIf(),i.if(pt._`${h} !== undefined`,()=>{i.assign(n,h),qz(e,h)});function v(b){switch(b){case"string":i.elseIf(pt._`${s} == "number" || ${s} == "boolean"`).assign(h,pt._`"" + ${n}`).elseIf(pt._`${n} === null`).assign(h,pt._`""`);return;case"number":i.elseIf(pt._`${s} == "boolean" || ${n} === null
|
|
21
21
|
|| (${s} == "string" && ${n} && ${n} == +${n})`).assign(h,pt._`+${n}`);return;case"integer":i.elseIf(pt._`${s} === "boolean" || ${n} === null
|
|
22
22
|
|| (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(h,pt._`+${n}`);return;case"boolean":i.elseIf(pt._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(h,!1).elseIf(pt._`${n} === "true" || ${n} === 1`).assign(h,!0);return;case"null":i.elseIf(pt._`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(h,null);return;case"array":i.elseIf(pt._`${s} === "string" || ${s} === "number"
|
|
23
|
-
|| ${s} === "boolean" || ${n} === null`).assign(h,pt._`[${n}]`)}}}function qz({gen:e,parentData:t,parentDataProperty:r},i){e.if(pt._`${t} !== undefined`,()=>e.assign(pt._`${t}[${r}]`,i))}function Db(e,t,r,i=oa.Correct){let n=i===oa.Correct?pt.operators.EQ:pt.operators.NEQ,o;switch(e){case"null":return pt._`${t} ${n} null`;case"array":o=pt._`Array.isArray(${t})`;break;case"object":o=pt._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(pt._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return pt._`typeof ${t} ${n} ${e}`}return i===oa.Correct?o:(0,pt.not)(o);function s(h=pt.nil){return(0,pt.and)(pt._`typeof ${t} == "number"`,h,r?pt._`isFinite(${t})`:pt.nil)}}dM.checkDataType=Db;function Nb(e,t,r,i){if(e.length===1)return Db(e[0],t,r,i);let n,o=(0,uM.toHash)(e);if(o.array&&o.object){let s=pt._`typeof ${t} != "object"`;n=o.null?s:pt._`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=pt.nil;if(o.number)delete o.integer;for(let s in o)n=(0,pt.and)(n,Db(s,t,r,i));return n}dM.checkDataTypes=Nb;var Bz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?pt._`{type: ${e}}`:pt._`{type: ${t}}`};function zb(e){let t=Hz(e);(0,zz.reportError)(t,Bz)}dM.reportTypeError=zb;function Hz(e){let{gen:t,data:r,schema:i}=e,n=(0,uM.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var gM=Xe(function(pM){Object.defineProperty(pM,"__esModule",{value:!0});pM.assignDefaults=void 0;var sa=gt(),Xz=Mt();function Yz(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)hM(e,n,r[n].default);else if(t==="array"&&Array.isArray(i))i.forEach((n,o)=>hM(e,o,n.default))}pM.assignDefaults=Yz;function hM(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let h=sa._`${o}${(0,sa.getProperty)(t)}`;if(n){(0,Xz.checkStrictMode)(e,`default is ignored for: ${h}`);return}let v=sa._`${h} === undefined`;if(s.useDefaults==="empty")v=sa._`${v} || ${h} === null || ${h} === ""`;i.if(v,sa._`${h} = ${(0,sa.stringify)(r)}`)}});var Rn=Xe(function(bM){Object.defineProperty(bM,"__esModule",{value:!0});bM.validateUnion=bM.validateArray=bM.usePattern=bM.callValidateCode=bM.schemaProperties=bM.allSchemaProperties=bM.noPropertyInData=bM.propertyInData=bM.isOwnProperty=bM.hasPropFunc=bM.reportMissingProp=bM.checkMissingProp=bM.checkReportMissingProp=void 0;var Bt=gt(),jb=Mt(),oo=Mi(),Qz=Mt();function ej(e,t){let{gen:r,data:i,it:n}=e;r.if(Lb(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Bt._`${t}`},!0),e.error()})}bM.checkReportMissingProp=ej;function tj({gen:e,data:t,it:{opts:r}},i,n){return(0,Bt.or)(...i.map((o)=>(0,Bt.and)(Lb(e,t,o,r.ownProperties),Bt._`${n} = ${o}`)))}bM.checkMissingProp=tj;function rj(e,t){e.setParams({missingProperty:t},!0),e.error()}bM.reportMissingProp=rj;function yM(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Bt._`Object.prototype.hasOwnProperty`})}bM.hasPropFunc=yM;function Ub(e,t,r){return Bt._`${yM(e)}.call(${t}, ${r})`}bM.isOwnProperty=Ub;function nj(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} !== undefined`;return i?Bt._`${n} && ${Ub(e,t,r)}`:n}bM.propertyInData=nj;function Lb(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} === undefined`;return i?(0,Bt.or)(n,(0,Bt.not)(Ub(e,t,r))):n}bM.noPropertyInData=Lb;function vM(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}bM.allSchemaProperties=vM;function ij(e,t){return vM(t).filter((r)=>!(0,jb.alwaysValidSchema)(e,t[r]))}bM.schemaProperties=ij;function oj({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},h,v,b){let _=b?Bt._`${e}, ${t}, ${i}${n}`:t,g=[[oo.default.instancePath,(0,Bt.strConcat)(oo.default.instancePath,o)],[oo.default.parentData,s.parentData],[oo.default.parentDataProperty,s.parentDataProperty],[oo.default.rootData,oo.default.rootData]];if(s.opts.dynamicRef)g.push([oo.default.dynamicAnchors,oo.default.dynamicAnchors]);let S=Bt._`${_}, ${r.object(...g)}`;return v!==Bt.nil?Bt._`${h}.call(${v}, ${S})`:Bt._`${h}(${S})`}bM.callValidateCode=oj;var sj=Bt._`new RegExp`;function aj({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:Bt._`${n.code==="new RegExp"?sj:(0,Qz.useFunc)(e,n)}(${r}, ${i})`})}bM.usePattern=aj;function uj(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let h=t.let("valid",!0);return s(()=>t.assign(h,!1)),h}return t.var(o,!0),s(()=>t.break()),o;function s(h){let v=t.const("len",Bt._`${r}.length`);t.forRange("i",0,v,(b)=>{e.subschema({keyword:i,dataProp:b,dataPropType:jb.Type.Num},o),t.if((0,Bt.not)(o),h)})}}bM.validateArray=uj;function lj(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((v)=>(0,jb.alwaysValidSchema)(n,v))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),h=t.name("_valid");t.block(()=>r.forEach((v,b)=>{let _=e.subschema({keyword:i,schemaProp:b,compositeRule:!0},h);if(t.assign(s,Bt._`${s} || ${h}`),!e.mergeValidEvaluated(_,h))t.if((0,Bt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}bM.validateUnion=lj});var MM=Xe(function(xM){Object.defineProperty(xM,"__esModule",{value:!0});xM.validateKeywordUsage=xM.validSchemaType=xM.funcKeywordCode=xM.macroKeywordCode=void 0;var Xr=gt(),Vo=Mi(),Sj=Rn(),xj=ac();function kj(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,h=t.macro.call(s.self,n,o,s),v=SM(r,i,h);if(s.opts.validateSchema!==!1)s.self.validateSchema(h,!0);let b=r.name("valid");e.subschema({schema:h,schemaPath:Xr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:v,compositeRule:!0},b),e.pass(b,()=>e.error(!0))}xM.macroKeywordCode=kj;function Mj(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:h,it:v}=e;Ij(v,t);let b=!h&&t.compile?t.compile.call(v.self,o,s,v):t.validate,_=SM(i,n,b),g=i.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1){if(I(),t.modifying)wM(e);$(()=>e.error())}else{let T=t.async?x():M();if(t.modifying)wM(e);$(()=>Ej(e,T))}}function x(){let T=i.let("ruleErrs",null);return i.try(()=>I(Xr._`await `),(P)=>i.assign(g,!1).if(Xr._`${P} instanceof ${v.ValidationError}`,()=>i.assign(T,Xr._`${P}.errors`),()=>i.throw(P))),T}function M(){let T=Xr._`${_}.errors`;return i.assign(T,null),I(Xr.nil),T}function I(T=t.async?Xr._`await `:Xr.nil){let P=v.opts.passContext?Vo.default.this:Vo.default.self,R=!(("compile"in t)&&!h||t.schema===!1);i.assign(g,Xr._`${T}${(0,Sj.callValidateCode)(e,_,P,R)}`,t.modifying)}function $(T){var P;i.if((0,Xr.not)((P=t.valid)!==null&&P!==void 0?P:g),T)}}xM.funcKeywordCode=Mj;function wM(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,Xr._`${i.parentData}[${i.parentDataProperty}]`))}function Ej(e,t){let{gen:r}=e;r.if(Xr._`Array.isArray(${t})`,()=>{r.assign(Vo.default.vErrors,Xr._`${Vo.default.vErrors} === null ? ${t} : ${Vo.default.vErrors}.concat(${t})`).assign(Vo.default.errors,Xr._`${Vo.default.vErrors}.length`),(0,xj.extendErrors)(e)},()=>e.error())}function Ij({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function SM(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Xr.stringify)(r)})}function $j(e,t,r=!1){return!t.length||t.some((i)=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}xM.validSchemaType=$j;function Tj({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((h)=>!Object.prototype.hasOwnProperty.call(e,h)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){let v=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(v);else throw Error(v)}}}xM.validateKeywordUsage=Tj});var TM=Xe(function(IM){Object.defineProperty(IM,"__esModule",{value:!0});IM.extendSubschemaMode=IM.extendSubschemaData=IM.getSubschema=void 0;var ti=gt(),EM=Mt();function Cj(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let h=e.schema[t];return r===void 0?{schema:h,schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:h[r],schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}${(0,ti.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,EM.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}IM.getSubschema=Cj;function Oj(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:h}=t;if(r!==void 0){let{errorPath:b,dataPathArr:_,opts:g}=t,S=h.let("data",ti._`${t.data}${(0,ti.getProperty)(r)}`,!0);v(S),e.errorPath=ti.str`${b}${(0,EM.getErrorPath)(r,i,g.jsPropertySyntax)}`,e.parentDataProperty=ti._`${r}`,e.dataPathArr=[..._,e.parentDataProperty]}if(n!==void 0){let b=n instanceof ti.Name?n:h.let("data",n,!0);if(v(b),s!==void 0)e.propertyName=s}if(o)e.dataTypes=o;function v(b){e.data=b,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,b]}}IM.extendSubschemaData=Oj;function Dj(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){if(i!==void 0)e.compositeRule=i;if(n!==void 0)e.createErrors=n;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=r}IM.extendSubschemaMode=Dj});var Fb=Xe(function(mbe,PM){PM.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var RM=Xe(function(gbe,AM){var so=AM.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Pp(t,i,n,e,"",e)};so.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};so.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};so.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};so.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function Pp(e,t,r,i,n,o,s,h,v,b){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,h,v,b);for(var _ in i){var g=i[_];if(Array.isArray(g)){if(_ in so.arrayKeywords)for(var S=0;S<g.length;S++)Pp(e,t,r,g[S],n+"/"+_+"/"+S,o,n,_,i,S)}else if(_ in so.propsKeywords){if(g&&typeof g=="object")for(var x in g)Pp(e,t,r,g[x],n+"/"+_+"/"+jj(x),o,n,_,i,x)}else if(_ in so.keywords||e.allKeys&&!(_ in so.skipKeywords))Pp(e,t,r,g,n+"/"+_,o,n,_,i)}r(i,n,o,s,h,v,b)}}function jj(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=Xe(function(NM){Object.defineProperty(NM,"__esModule",{value:!0});NM.getSchemaRefs=NM.resolveUrl=NM.normalizeId=NM._getFullPath=NM.getFullPath=NM.inlineRef=void 0;var Uj=Mt(),Lj=Fb(),Fj=RM(),qj=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Bj(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!qb(e);if(!t)return!1;return CM(e)<=t}NM.inlineRef=Bj;var Hj=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qb(e){for(let t in e){if(Hj.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(qb))return!0;if(typeof r=="object"&&qb(r))return!0}return!1}function CM(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,qj.has(r))continue;if(typeof e[r]=="object")(0,Uj.eachItem)(e[r],(i)=>t+=CM(i));if(t===1/0)return 1/0}return t}function OM(e,t="",r){if(r!==!1)t=aa(t);let i=e.parse(t);return DM(e,i)}NM.getFullPath=OM;function DM(e,t){return e.serialize(t).split("#")[0]+"#"}NM._getFullPath=DM;var Zj=/#\/?$/;function aa(e){return e?e.replace(Zj,""):""}NM.normalizeId=aa;function Kj(e,t,r){return r=aa(r),e.resolve(t,r)}NM.resolveUrl=Kj;var Vj=/^[a-z_][-a-z0-9._]*$/i;function Wj(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=aa(e[r]||t),o={"":n},s=OM(i,n,!1),h={},v=new Set;return Fj(e,{allKeys:!0},(g,S,x,M)=>{if(M===void 0)return;let I=s+S,$=o[M];if(typeof g[r]=="string")$=T.call(this,g[r]);P.call(this,g.$anchor),P.call(this,g.$dynamicAnchor),o[S]=$;function T(R){let C=this.opts.uriResolver.resolve;if(R=aa($?C($,R):R),v.has(R))throw _(R);v.add(R);let N=this.refs[R];if(typeof N=="string")N=this.refs[N];if(typeof N=="object")b(g,N.schema,R);else if(R!==aa(I))if(R[0]==="#")b(g,h[R],R),h[R]=g;else this.refs[R]=I;return R}function P(R){if(typeof R=="string"){if(!Vj.test(R))throw Error(`invalid anchor "${R}"`);T.call(this,`#${R}`)}}}),h;function b(g,S,x){if(S!==void 0&&!Lj(g,S))throw _(x)}function _(g){return Error(`reference "${g}" resolves to more than one schema`)}}NM.getSchemaRefs=Wj});var fc=Xe(function(YM){Object.defineProperty(YM,"__esModule",{value:!0});YM.getData=YM.KeywordCxt=YM.validateFunctionCode=void 0;var qM=tM(),jM=uc(),Hb=Ob(),Ap=uc(),eU=gM(),dc=MM(),Bb=TM(),nt=gt(),ct=Mi(),tU=lc(),Ei=Mt(),cc=ac();function rU(e){if(ZM(e)){if(KM(e),HM(e)){oU(e);return}}BM(e,()=>(0,qM.topBoolOrEmptySchema)(e))}YM.validateFunctionCode=rU;function BM({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){if(n.code.es5)e.func(t,nt._`${ct.default.data}, ${ct.default.valCxt}`,i.$async,()=>{e.code(nt._`"use strict"; ${UM(r,n)}`),iU(e,n),e.code(o)});else e.func(t,nt._`${ct.default.data}, ${nU(n)}`,i.$async,()=>e.code(UM(r,n)).code(o))}function nU(e){return nt._`{${ct.default.instancePath}="", ${ct.default.parentData}, ${ct.default.parentDataProperty}, ${ct.default.rootData}=${ct.default.data}${e.dynamicRef?nt._`, ${ct.default.dynamicAnchors}={}`:nt.nil}}={}`}function iU(e,t){e.if(ct.default.valCxt,()=>{if(e.var(ct.default.instancePath,nt._`${ct.default.valCxt}.${ct.default.instancePath}`),e.var(ct.default.parentData,nt._`${ct.default.valCxt}.${ct.default.parentData}`),e.var(ct.default.parentDataProperty,nt._`${ct.default.valCxt}.${ct.default.parentDataProperty}`),e.var(ct.default.rootData,nt._`${ct.default.valCxt}.${ct.default.rootData}`),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`${ct.default.valCxt}.${ct.default.dynamicAnchors}`)},()=>{if(e.var(ct.default.instancePath,nt._`""`),e.var(ct.default.parentData,nt._`undefined`),e.var(ct.default.parentDataProperty,nt._`undefined`),e.var(ct.default.rootData,ct.default.data),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`{}`)})}function oU(e){let{schema:t,opts:r,gen:i}=e;BM(e,()=>{if(r.$comment&&t.$comment)WM(e);if(cU(e),i.let(ct.default.vErrors,null),i.let(ct.default.errors,0),r.unevaluated)sU(e);VM(e),hU(e)});return}function sU(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",nt._`${r}.evaluated`),t.if(nt._`${e.evaluated}.dynamicProps`,()=>t.assign(nt._`${e.evaluated}.props`,nt._`undefined`)),t.if(nt._`${e.evaluated}.dynamicItems`,()=>t.assign(nt._`${e.evaluated}.items`,nt._`undefined`))}function UM(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?nt._`/*# sourceURL=${r} */`:nt.nil}function aU(e,t){if(ZM(e)){if(KM(e),HM(e)){uU(e,t);return}}(0,qM.boolOrEmptySchema)(e,t)}function HM({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function ZM(e){return typeof e.schema!="boolean"}function uU(e,t){let{schema:r,gen:i,opts:n}=e;if(n.$comment&&r.$comment)WM(e);dU(e),fU(e);let o=i.const("_errs",ct.default.errors);VM(e,o),i.var(t,nt._`${o} === ${ct.default.errors}`)}function KM(e){(0,Ei.checkUnknownRules)(e),lU(e)}function VM(e,t){if(e.opts.jtd)return LM(e,[],!1,t);let r=(0,jM.getSchemaTypes)(e.schema),i=(0,jM.coerceAndCheckDataType)(e,r);LM(e,r,!i,t)}function lU(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;if(t.$ref&&i.ignoreKeywordsWithRef&&(0,Ei.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function cU(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,Ei.checkStrictMode)(e,"default is ignored in the schema root")}function dU(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,tU.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function fU(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function WM({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code(nt._`${ct.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=nt.str`${i}/$comment`,h=e.scopeValue("root",{ref:t.root});e.code(nt._`${ct.default.self}.opts.$comment(${o}, ${s}, ${h}.schema)`)}}function hU(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;if(r.$async)t.if(nt._`${ct.default.errors} === 0`,()=>t.return(ct.default.data),()=>t.throw(nt._`new ${n}(${ct.default.vErrors})`));else{if(t.assign(nt._`${i}.errors`,ct.default.vErrors),o.unevaluated)pU(e);t.return(nt._`${ct.default.errors} === 0`)}}function pU({gen:e,evaluated:t,props:r,items:i}){if(r instanceof nt.Name)e.assign(nt._`${t}.props`,r);if(i instanceof nt.Name)e.assign(nt._`${t}.items`,i)}function LM(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:h,opts:v,self:b}=e,{RULES:_}=b;if(o.$ref&&(v.ignoreKeywordsWithRef||!(0,Ei.schemaHasRulesButRef)(o,_))){n.block(()=>JM(e,"$ref",_.all.$ref.definition));return}if(!v.jtd)mU(e,t);n.block(()=>{for(let S of _.rules)g(S);g(_.post)});function g(S){if(!(0,Hb.shouldUseGroup)(o,S))return;if(S.type){if(n.if((0,Ap.checkDataType)(S.type,s,v.strictNumbers)),FM(e,S),t.length===1&&t[0]===S.type&&r)n.else(),(0,Ap.reportTypeError)(e);n.endIf()}else FM(e,S);if(!h)n.if(nt._`${ct.default.errors} === ${i||0}`)}}function FM(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;if(n)(0,eU.assignDefaults)(e,t.type);r.block(()=>{for(let o of t.rules)if((0,Hb.shouldUseRule)(i,o))JM(e,o.keyword,o.definition,t.type)})}function mU(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(gU(e,t),!e.opts.allowUnionTypes)yU(e,t);vU(e,e.dataTypes)}function gU(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!GM(e.dataTypes,r))Zb(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),_U(e,t)}function yU(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Zb(e,"use allowUnionTypes to allow union type keyword")}function vU(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Hb.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;if(o.length&&!o.some((s)=>bU(t,s)))Zb(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function bU(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function GM(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function _U(e,t){let r=[];for(let i of e.dataTypes)if(GM(t,i))r.push(i);else if(t.includes("integer")&&i==="number")r.push("integer");e.dataTypes=r}function Zb(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ei.checkStrictMode)(e,t,e.opts.strictTypes)}class Kb{constructor(e,t,r){if((0,dc.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ei.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",XM(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,dc.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ct.default.errors)}result(e,t,r){this.failResult((0,nt.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,nt.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(nt._`${t} !== undefined && (${(0,nt.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?cc.reportExtraError:cc.reportError)(this,this.def.error,t)}$dataError(){(0,cc.reportError)(this,this.def.$dataError||cc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,cc.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=nt.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=nt.nil,t=nt.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:n,def:o}=this;if(r.if((0,nt.or)(nt._`${i} === undefined`,t)),e!==nt.nil)r.assign(e,!0);if(n.length||o.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==nt.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:i,it:n}=this;return(0,nt.or)(o(),s());function o(){if(r.length){if(!(t instanceof nt.Name))throw Error("ajv implementation error");let h=Array.isArray(r)?r:[r];return nt._`${(0,Ap.checkDataTypes)(h,t,n.opts.strictNumbers,Ap.DataType.Wrong)}`}return nt.nil}function s(){if(i.validateSchema){let h=e.scopeValue("validate$data",{ref:i.validateSchema});return nt._`!${h}(${t})`}return nt.nil}}subschema(e,t){let r=(0,Bb.getSubschema)(this.it,e);(0,Bb.extendSubschemaData)(r,this.it,e),(0,Bb.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return aU(i,t),i}mergeEvaluated(e,t){let{it:r,gen:i}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Ei.mergeEvaluated.props(i,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Ei.mergeEvaluated.items(i,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(t,()=>this.mergeEvaluated(e,nt.Name)),!0}}YM.KeywordCxt=Kb;function JM(e,t,r,i){let n=new Kb(e,r,t);if("code"in r)r.code(n,i);else if(n.$data&&r.validate)(0,dc.funcKeywordCode)(n,r);else if("macro"in r)(0,dc.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,dc.funcKeywordCode)(n,r)}var wU=/^\/(?:[^~]|~0|~1)*$/,SU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function XM(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return ct.default.rootData;if(e[0]==="/"){if(!wU.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,o=ct.default.rootData}else{let b=SU.exec(e);if(!b)throw Error(`Invalid JSON-pointer: ${e}`);let _=+b[1];if(n=b[2],n==="#"){if(_>=t)throw Error(v("property/index",_));return i[t-_]}if(_>t)throw Error(v("data",_));if(o=r[t-_],!n)return o}let s=o,h=n.split("/");for(let b of h)if(b)o=nt._`${o}${(0,nt.getProperty)((0,Ei.unescapeJsonPointer)(b))}`,s=nt._`${s} && ${o}`;return s;function v(b,_){return`Cannot access ${b} ${_} levels up, current level is ${t}`}}YM.getData=XM});var Rp=Xe(function(t4){Object.defineProperty(t4,"__esModule",{value:!0});class e4 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}t4.default=e4});var hc=Xe(function(n4){Object.defineProperty(n4,"__esModule",{value:!0});var Vb=lc();class r4 extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,Vb.resolveUrl)(e,t,r),this.missingSchema=(0,Vb.normalizeId)((0,Vb.getFullPath)(e,this.missingRef))}}n4.default=r4});var Op=Xe(function(s4){Object.defineProperty(s4,"__esModule",{value:!0});s4.resolveSchema=s4.getCompilingSchema=s4.resolveRef=s4.compileSchema=s4.SchemaEnv=void 0;var Hn=gt(),IU=Rp(),Wo=Mi(),Zn=lc(),i4=Mt(),$U=fc();class pc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Zn.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}s4.SchemaEnv=pc;function Gb(e){let t=o4.call(this,e);if(t)return t;let r=(0,Zn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Hn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),h;if(e.$async)h=s.scopeValue("Error",{ref:IU.default,code:Hn._`require("ajv/dist/runtime/validation_error").default`});let v=s.scopeName("validate");e.validateName=v;let b={gen:s,allErrors:this.opts.allErrors,data:Wo.default.data,parentData:Wo.default.parentData,parentDataProperty:Wo.default.parentDataProperty,dataNames:[Wo.default.data],dataPathArr:[Hn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Hn.stringify)(e.schema)}:{ref:e.schema}),validateName:v,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Hn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Hn._`""`,opts:this.opts,self:this},_;try{this._compilations.add(e),(0,$U.validateFunctionCode)(b),s.optimize(this.opts.code.optimize);let g=s.toString();if(_=`${s.scopeRefs(Wo.default.scope)}return ${g}`,this.opts.code.process)_=this.opts.code.process(_,e);let x=Function(`${Wo.default.self}`,`${Wo.default.scope}`,_)(this,this.scope.get());if(this.scope.value(v,{ref:x}),x.errors=null,x.schema=e.schema,x.schemaEnv=e,e.$async)x.$async=!0;if(this.opts.code.source===!0)x.source={validateName:v,validateCode:g,scopeValues:s._values};if(this.opts.unevaluated){let{props:M,items:I}=b;if(x.evaluated={props:M instanceof Hn.Name?void 0:M,items:I instanceof Hn.Name?void 0:I,dynamicProps:M instanceof Hn.Name,dynamicItems:I instanceof Hn.Name},x.source)x.source.evaluated=(0,Hn.stringify)(x.evaluated)}return e.validate=x,e}catch(g){if(delete e.validate,delete e.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw g}finally{this._compilations.delete(e)}}s4.compileSchema=Gb;function TU(e,t,r){var i;r=(0,Zn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=RU.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:h}=this.opts;if(s)o=new pc({schema:s,schemaId:h,root:e,baseId:t})}if(o===void 0)return;return e.refs[r]=PU.call(this,o)}s4.resolveRef=TU;function PU(e){if((0,Zn.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Gb.call(this,e)}function o4(e){for(let t of this._compilations)if(AU(t,e))return t}s4.getCompilingSchema=o4;function AU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function RU(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Cp.call(this,e,t)}function Cp(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Zn._getFullPath)(this.opts.uriResolver,r),n=(0,Zn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return Wb.call(this,r,e);let o=(0,Zn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let h=Cp.call(this,e,s);if(typeof(h===null||h===void 0?void 0:h.schema)!=="object")return;return Wb.call(this,r,h)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)Gb.call(this,s);if(o===(0,Zn.normalizeId)(t)){let{schema:h}=s,{schemaId:v}=this.opts,b=h[v];if(b)n=(0,Zn.resolveUrl)(this.opts.uriResolver,n,b);return new pc({schema:h,schemaId:v,root:e,baseId:n})}return Wb.call(this,r,s)}s4.resolveSchema=Cp;var CU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Wb(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let h of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let v=r[(0,i4.unescapeFragment)(h)];if(v===void 0)return;r=v;let b=typeof r==="object"&&r[this.opts.schemaId];if(!CU.has(h)&&b)t=(0,Zn.resolveUrl)(this.opts.uriResolver,t,b)}let o;if(typeof r!="boolean"&&r.$ref&&!(0,i4.schemaHasRulesButRef)(r,this.RULES)){let h=(0,Zn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Cp.call(this,i,h)}let{schemaId:s}=this.opts;if(o=o||new pc({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o;return}});var u4=Xe(function(Sbe,jU){jU.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Yb=Xe(function(xbe,p4){var UU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),c4=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Jb=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),d4=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),LU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Xb(e){let t="",r=0,i=0;for(i=0;i<e.length;i++){if(r=e[i].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var FU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l4(e){return e.length=0,!0}function qU(e,t,r){if(e.length){let i=Xb(e);if(i!=="")t.push(i);else return r.error=!0,!1;e.length=0}return!0}function BU(e){let t=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,h=qU;for(let v=0;v<e.length;v++){let b=e[v];if(b==="["||b==="]")continue;if(b===":"){if(o===!0)s=!0;if(!h(n,i,r))break;if(++t>7){r.error=!0;break}if(v>0&&e[v-1]===":")o=!0;i.push(":");continue}else if(b==="%"){if(!h(n,i,r))break;h=l4}else{n.push(b);continue}}if(n.length)if(h===l4)r.zone=n.join("");else if(s)i.push(n.join(""));else i.push(Xb(n));return r.address=i.join(""),r}function f4(e){if(HU(e,":")<2)return{host:e,isIPV6:!1};let t=BU(e);if(!t.error){let{address:r,address:i}=t;if(t.zone)r+="%"+t.zone,i+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:i}}else return{host:e,isIPV6:!1}}function HU(e,t){let r=0;for(let i=0;i<e.length;i++)if(e[i]===t)r++;return r}function ZU(e){let t=e,r=[],i=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var KU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},VU=/[@/?#:]/g,WU=/[@/?#]/g;function h4(e,t){let r=t?WU:VU;return r.lastIndex=0,e.replace(r,(i)=>KU[i])}function GU(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Jb(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(t&&d4(s))r+=s;else r+="%"+o;i+=2;continue}}r+=e[i]}return r}function JU(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Jb(i)){let n=i.toUpperCase(),o=String.fromCharCode(parseInt(n,16));if(o!=="."&&d4(o))t+=o;else t+="%"+n;r+=2;continue}}if(LU(e[r]))t+=e[r];else t+=escape(e[r])}return t}function XU(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Jb(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function YU(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!c4(r)){let i=f4(r);if(i.isIPV6===!0)r=`[${i.escapedHost}]`;else r=h4(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}p4.exports={nonSimpleDomain:FU,recomposeAuthority:YU,reescapeHostDelimiters:h4,normalizePercentEncoding:GU,normalizePathEncoding:JU,escapePreservingEscapes:XU,removeDotSegments:ZU,isIPv4:c4,isUUID:UU,normalizeIPv6:f4,stringArrayToHexStripped:Xb}});var b4=Xe(function(kbe,v4){var{isUUID:QU}=Yb(),eL=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,tL=["http","https","ws","wss","urn","urn:uuid"];function rL(e){return tL.indexOf(e)!==-1}function Qb(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function m4(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function g4(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function nL(e){return e.secure=Qb(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function iL(e){if(e.port===(Qb(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function oL(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(eL);if(r){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=e_(n);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function sL(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=e_(n);if(o)e=o.serialize(e,t);let s=e,h=e.nss;return s.path=`${i||t.nid}:${h}`,t.skipEscape=!0,s}function aL(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!QU(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function uL(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var y4={scheme:"http",domainHost:!0,parse:m4,serialize:g4},lL={scheme:"https",domainHost:y4.domainHost,parse:m4,serialize:g4},Dp={scheme:"ws",domainHost:!0,parse:nL,serialize:iL},cL={scheme:"wss",domainHost:Dp.domainHost,parse:Dp.parse,serialize:Dp.serialize},dL={scheme:"urn",parse:oL,serialize:sL,skipNormalize:!0},fL={scheme:"urn:uuid",parse:aL,serialize:uL,skipNormalize:!0},Np={http:y4,https:lL,ws:Dp,wss:cL,urn:dL,"urn:uuid":fL};Object.setPrototypeOf(Np,null);function e_(e){return e&&(Np[e]||Np[e.toLowerCase()])||void 0}v4.exports={wsIsSecure:Qb,SCHEMES:Np,isValidSchemeName:rL,getSchemeHandler:e_}});var M4=Xe(function(Mbe,zp){var{normalizeIPv6:hL,removeDotSegments:mc,recomposeAuthority:pL,normalizePercentEncoding:mL,normalizePathEncoding:gL,escapePreservingEscapes:yL,reescapeHostDelimiters:vL,isIPv4:bL,nonSimpleDomain:_L}=Yb(),{SCHEMES:wL,getSchemeHandler:w4}=b4();function SL(e,t){if(typeof e==="string")e=IL(e,t);else if(typeof e==="object")e=ua(Go(e,t),t);return e}function xL(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=S4(ua(e,i),ua(t,i),i,!0);return i.skipEscape=!0,Go(n,i)}function S4(e,t,r,i){let n={};if(!i)e=ua(Go(e,r),r),t=ua(Go(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=mc(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=mc(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function kL(e,t,r){let i=_4(e,r),n=_4(t,r);return i!==void 0&&n!==void 0&&i.toLowerCase()===n.toLowerCase()}function Go(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),n=[],o=w4(i.scheme||r.scheme);if(o&&o.serialize)o.serialize(r,i);if(r.path!==void 0)if(!i.skipEscape){if(r.path=yL(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=mL(r.path);if(i.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=pL(r);if(s!==void 0){if(i.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let h=r.path;if(!i.absolutePath&&(!o||!o.absolutePath))h=mc(h);if(s===void 0&&h[0]==="/"&&h[1]==="/")h="/%2F"+h.slice(2);n.push(h)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var ML=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function EL(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function x4(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(ML);if(s){if(i.scheme=s[1],i.userinfo=s[3],i.host=s[4],i.port=parseInt(s[5],10),i.path=s[6]||"",i.query=s[7],i.fragment=s[8],isNaN(i.port))i.port=s[5];let h=EL(i,s);if(h!==void 0)i.error=i.error||h,n=!0;if(i.host)if(bL(i.host)===!1){let _=hL(i.host);i.host=_.host.toLowerCase(),o=_.isIPV6}else o=!0;if(i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path)i.reference="same-document";else if(i.scheme===void 0)i.reference="relative";else if(i.fragment===void 0)i.reference="absolute";else i.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==i.reference)i.error=i.error||"URI is not a "+r.reference+" reference.";let v=w4(r.scheme||i.scheme);if(!r.unicodeSupport&&(!v||!v.unicodeSupport)){if(i.host&&(r.domainHost||v&&v.domainHost)&&o===!1&&_L(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(b){i.error=i.error||"Host's domain name can not be converted to ASCII: "+b}}if(!v||v&&!v.skipNormalize){if(e.indexOf("%")!==-1){if(i.scheme!==void 0)i.scheme=unescape(i.scheme);if(i.host!==void 0)i.host=vL(unescape(i.host),o)}if(i.path)i.path=gL(i.path);if(i.fragment)try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}}if(v&&v.parse)v.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function ua(e,t){return x4(e,t).parsed}function IL(e,t){return k4(e,t).normalized}function k4(e,t){let{parsed:r,malformedAuthorityOrPort:i}=x4(e,t);return{normalized:i?e:Go(r,t),malformedAuthorityOrPort:i}}function _4(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:i}=k4(e,t);return i?void 0:r}if(typeof e==="object")return Go(e,t)}var t_={SCHEMES:wL,normalize:SL,resolve:xL,resolveComponent:S4,equal:kL,serialize:Go,parse:ua};zp.exports=t_;zp.exports.default=t_;zp.exports.fastUri=t_});var $4=Xe(function(I4){Object.defineProperty(I4,"__esModule",{value:!0});var E4=M4();E4.code='require("ajv/dist/runtime/uri").default';I4.default=E4});var N4=Xe(function(Ii){Object.defineProperty(Ii,"__esModule",{value:!0});Ii.CodeGen=Ii.Name=Ii.nil=Ii.stringify=Ii.str=Ii._=Ii.KeywordCxt=void 0;var TL=fc();Object.defineProperty(Ii,"KeywordCxt",{enumerable:!0,get:function(){return TL.KeywordCxt}});var la=gt();Object.defineProperty(Ii,"_",{enumerable:!0,get:function(){return la._}});Object.defineProperty(Ii,"str",{enumerable:!0,get:function(){return la.str}});Object.defineProperty(Ii,"stringify",{enumerable:!0,get:function(){return la.stringify}});Object.defineProperty(Ii,"nil",{enumerable:!0,get:function(){return la.nil}});Object.defineProperty(Ii,"Name",{enumerable:!0,get:function(){return la.Name}});Object.defineProperty(Ii,"CodeGen",{enumerable:!0,get:function(){return la.CodeGen}});var PL=Rp(),C4=hc(),AL=Cb(),gc=Op(),RL=gt(),yc=lc(),jp=uc(),n_=Mt(),T4=u4(),CL=$4(),O4=(e,t)=>new RegExp(e,t);O4.code="new RegExp";var OL=["removeAdditional","useDefaults","coerceTypes"],DL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),NL={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},zL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},P4=200;function jL(e){var t,r,i,n,o,s,h,v,b,_,g,S,x,M,I,$,T,P,R,C,N,B,ie,le,ue;let F=e.strict,ee=(t=e.code)===null||t===void 0?void 0:t.optimize,a=ee===!0||ee===void 0?1:ee||0,c=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:O4,f=(n=e.uriResolver)!==null&&n!==void 0?n:CL.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:F)!==null&&s!==void 0?s:!0,strictNumbers:(v=(h=e.strictNumbers)!==null&&h!==void 0?h:F)!==null&&v!==void 0?v:!0,strictTypes:(_=(b=e.strictTypes)!==null&&b!==void 0?b:F)!==null&&_!==void 0?_:"log",strictTuples:(S=(g=e.strictTuples)!==null&&g!==void 0?g:F)!==null&&S!==void 0?S:"log",strictRequired:(M=(x=e.strictRequired)!==null&&x!==void 0?x:F)!==null&&M!==void 0?M:!1,code:e.code?{...e.code,optimize:a,regExp:c}:{optimize:a,regExp:c},loopRequired:(I=e.loopRequired)!==null&&I!==void 0?I:P4,loopEnum:($=e.loopEnum)!==null&&$!==void 0?$:P4,meta:(T=e.meta)!==null&&T!==void 0?T:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(N=e.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(B=e.validateSchema)!==null&&B!==void 0?B:!0,validateFormats:(ie=e.validateFormats)!==null&&ie!==void 0?ie:!0,unicodeRegExp:(le=e.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ue=e.int32range)!==null&&ue!==void 0?ue:!0,uriResolver:f}}class Up{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...jL(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new RL.ValueScope({scope:{},prefixes:DL,es5:t,lines:r}),this.logger=HL(e.logger);let i=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,AL.getRules)(),A4.call(this,NL,e,"NOT SUPPORTED"),A4.call(this,zL,e,"DEPRECATED","warn"),this._metaOpts=qL.call(this),e.formats)LL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)FL.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);UL.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,i=T4;if(r==="id")i={...T4},i.id=i.$id,delete i.$id;if(t&&e)this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(t);if(!("$async"in r))this.errors=r.errors;return i}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,t);async function i(b,_){await n.call(this,b.$schema);let g=this._addSchema(b,_);return g.validate||o.call(this,g)}async function n(b){if(b&&!this.getSchema(b))await i.call(this,{$ref:b},!0)}async function o(b){try{return this._compileSchemaEnv(b)}catch(_){if(!(_ instanceof C4.default))throw _;return s.call(this,_),await h.call(this,_.missingSchema),o.call(this,b)}}function s({missingSchema:b,missingRef:_}){if(this.refs[b])throw Error(`AnySchema ${b} is loaded but ${_} cannot be resolved`)}async function h(b){let _=await v.call(this,b);if(!this.refs[b])await n.call(this,_.$schema);if(!this.refs[b])this.addSchema(_,b,t)}async function v(b){let _=this._loading[b];if(_)return _;try{return await(this._loading[b]=r(b))}finally{delete this._loading[b]}}}addSchema(e,t,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,i);return this}let n;if(typeof e==="object"){let{schemaId:o}=this.opts;if(n=e[o],n!==void 0&&typeof n!="string")throw Error(`schema ${o} must be string`)}return t=(0,yc.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,i,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return i}getSchema(e){let t;while(typeof(t=R4.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,i=new gc.SchemaEnv({schema:{},schemaId:r});if(t=gc.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=R4.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,yc.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(KL.call(this,r,t),!t)return(0,n_.eachItem)(r,(n)=>r_.call(this,n)),this;WL.call(this,t);let i={...t,type:(0,jp.getJSONTypes)(t.type),schemaType:(0,jp.getJSONTypes)(t.schemaType)};return(0,n_.eachItem)(r,i.type.length===0?(n)=>r_.call(this,n,i):(n)=>i.type.forEach((o)=>r_.call(this,n,i,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let i=r.rules.findIndex((n)=>n.keyword===e);if(i>=0)r.rules.splice(i,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((i)=>`${r}${i.instancePath} ${i.message}`).reduce((i,n)=>i+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of t){let n=i.split("/").slice(1),o=e;for(let s of n)o=o[s];for(let s in r){let h=r[s];if(typeof h!="object")continue;let{$data:v}=h.definition,b=o[s];if(v&&b)o[s]=D4(b)}}return e}_removeAllSchemas(e,t){for(let r in e){let i=e[r];if(!t||t.test(r)){if(typeof i=="string")delete e[r];else if(i&&!i.meta)this._cache.delete(i.schema),delete e[r]}}}_addSchema(e,t,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let h=this._cache.get(e);if(h!==void 0)return h;r=(0,yc.normalizeId)(o||r);let v=yc.getSchemaRefs.call(this,e,r);if(h=new gc.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:v}),this._cache.set(h.schema,h),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=h}if(i)this.validateSchema(e,!0);return h}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else gc.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{gc.compileSchema.call(this,e)}finally{this.opts=t}}}Up.ValidationError=PL.default;Up.MissingRefError=C4.default;Ii.default=Up;function A4(e,t,r,i="error"){for(let n in e){let o=n;if(o in t)this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function R4(e){return e=(0,yc.normalizeId)(e),this.schemas[e]||this.refs[e]}function UL(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function LL(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function FL(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function qL(){let e={...this.opts};for(let t of OL)delete e[t];return e}var BL={log(){},warn(){},error(){}};function HL(e){if(e===!1)return BL;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var ZL=/^[a-z_$][a-z0-9_$:-]*$/i;function KL(e,t){let{RULES:r}=this;if((0,n_.eachItem)(e,(i)=>{if(r.keywords[i])throw Error(`Keyword ${i} is already defined`);if(!ZL.test(i))throw Error(`Keyword ${i} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function r_(e,t,r){var i;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:v})=>v===r);if(!s)s={type:r,rules:[]},o.rules.push(s);if(o.keywords[e]=!0,!t)return;let h={keyword:e,definition:{...t,type:(0,jp.getJSONTypes)(t.type),schemaType:(0,jp.getJSONTypes)(t.schemaType)}};if(t.before)VL.call(this,s,h,t.before);else s.rules.push(h);o.all[e]=h,(i=t.implements)===null||i===void 0||i.forEach((v)=>this.addKeyword(v))}function VL(e,t,r){let i=e.rules.findIndex((n)=>n.keyword===r);if(i>=0)e.rules.splice(i,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function WL(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=D4(t);e.validateSchema=this.compile(t,!0)}var GL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D4(e){return{anyOf:[e,GL]}}});var j4=Xe(function(z4){Object.defineProperty(z4,"__esModule",{value:!0});var YL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};z4.default=YL});var H4=Xe(function(q4){Object.defineProperty(q4,"__esModule",{value:!0});q4.callRef=q4.getValidate=void 0;var eF=hc(),U4=Rn(),un=gt(),ca=Mi(),L4=Op(),Lp=Mt(),tF={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:h,self:v}=i,{root:b}=o;if((r==="#"||r==="#/")&&n===b.baseId)return g();let _=L4.resolveRef.call(v,b,n,r);if(_===void 0)throw new eF.default(i.opts.uriResolver,n,r);if(_ instanceof L4.SchemaEnv)return S(_);return x(_);function g(){if(o===b)return Fp(e,s,o,o.$async);let M=t.scopeValue("root",{ref:b});return Fp(e,un._`${M}.validate`,b,b.$async)}function S(M){let I=F4(e,M);Fp(e,I,M,M.$async)}function x(M){let I=t.scopeValue("schema",h.code.source===!0?{ref:M,code:(0,un.stringify)(M)}:{ref:M}),$=t.name("valid"),T=e.subschema({schema:M,dataTypes:[],schemaPath:un.nil,topSchemaRef:I,errSchemaPath:r},$);e.mergeEvaluated(T),e.ok($)}}};function F4(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):un._`${r.scopeValue("wrapper",{ref:t})}.validate`}q4.getValidate=F4;function Fp(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:h,opts:v}=o,b=v.passContext?ca.default.this:un.nil;if(i)_();else g();function _(){if(!h.$async)throw Error("async schema referenced by sync schema");let M=n.let("valid");n.try(()=>{if(n.code(un._`await ${(0,U4.callValidateCode)(e,t,b)}`),x(t),!s)n.assign(M,!0)},(I)=>{if(n.if(un._`!(${I} instanceof ${o.ValidationError})`,()=>n.throw(I)),S(I),!s)n.assign(M,!1)}),e.ok(M)}function g(){e.result((0,U4.callValidateCode)(e,t,b),()=>x(t),()=>S(t))}function S(M){let I=un._`${M}.errors`;n.assign(ca.default.vErrors,un._`${ca.default.vErrors} === null ? ${I} : ${ca.default.vErrors}.concat(${I})`),n.assign(ca.default.errors,un._`${ca.default.vErrors}.length`)}function x(M){var I;if(!o.opts.unevaluated)return;let $=(I=r===null||r===void 0?void 0:r.validate)===null||I===void 0?void 0:I.evaluated;if(o.props!==!0)if($&&!$.dynamicProps){if($.props!==void 0)o.props=Lp.mergeEvaluated.props(n,$.props,o.props)}else{let T=n.var("props",un._`${M}.evaluated.props`);o.props=Lp.mergeEvaluated.props(n,T,o.props,un.Name)}if(o.items!==!0)if($&&!$.dynamicItems){if($.items!==void 0)o.items=Lp.mergeEvaluated.items(n,$.items,o.items)}else{let T=n.var("items",un._`${M}.evaluated.items`);o.items=Lp.mergeEvaluated.items(n,T,o.items,un.Name)}}}q4.callRef=Fp;q4.default=tF});var K4=Xe(function(Z4){Object.defineProperty(Z4,"__esModule",{value:!0});var iF=j4(),oF=H4(),sF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",iF.default,oF.default];Z4.default=sF});var W4=Xe(function(V4){Object.defineProperty(V4,"__esModule",{value:!0});var qp=gt(),ao=qp.operators,Bp={maximum:{okStr:"<=",ok:ao.LTE,fail:ao.GT},minimum:{okStr:">=",ok:ao.GTE,fail:ao.LT},exclusiveMaximum:{okStr:"<",ok:ao.LT,fail:ao.GTE},exclusiveMinimum:{okStr:">",ok:ao.GT,fail:ao.LTE}},uF={message:({keyword:e,schemaCode:t})=>qp.str`must be ${Bp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>qp._`{comparison: ${Bp[e].okStr}, limit: ${t}}`},lF={keyword:Object.keys(Bp),type:"number",schemaType:"number",$data:!0,error:uF,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data(qp._`${r} ${Bp[t].fail} ${i} || isNaN(${r})`)}};V4.default=lF});var J4=Xe(function(G4){Object.defineProperty(G4,"__esModule",{value:!0});var vc=gt(),dF={message:({schemaCode:e})=>vc.str`must be multiple of ${e}`,params:({schemaCode:e})=>vc._`{multipleOf: ${e}}`},fF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:dF,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),h=o?vc._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:vc._`${s} !== parseInt(${s})`;e.fail$data(vc._`(${i} === 0 || (${s} = ${r}/${i}, ${h}))`)}};G4.default=fF});var Q4=Xe(function(Y4){Object.defineProperty(Y4,"__esModule",{value:!0});function X4(e){let t=e.length,r=0,i=0,n;while(i<t)if(r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t){if(n=e.charCodeAt(i),(n&64512)===56320)i++}return r}Y4.default=X4;X4.code='require("ajv/dist/runtime/ucs2length").default'});var t3=Xe(function(e3){Object.defineProperty(e3,"__esModule",{value:!0});var Jo=gt(),mF=Mt(),gF=Q4(),yF={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Jo.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Jo._`{limit: ${e}}`},vF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:yF,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Jo.operators.GT:Jo.operators.LT,s=n.opts.unicode===!1?Jo._`${r}.length`:Jo._`${(0,mF.useFunc)(e.gen,gF.default)}(${r})`;e.fail$data(Jo._`${s} ${o} ${i}`)}};e3.default=vF});var n3=Xe(function(r3){Object.defineProperty(r3,"__esModule",{value:!0});var _F=Rn(),wF=Mt(),da=gt(),SF={message:({schemaCode:e})=>da.str`must match pattern "${e}"`,params:({schemaCode:e})=>da._`{pattern: ${e}}`},xF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:SF,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,h=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:v}=s.opts.code,b=v.code==="new RegExp"?da._`new RegExp`:(0,wF.useFunc)(t,v),_=t.let("valid");t.try(()=>t.assign(_,da._`${b}(${o}, ${h}).test(${r})`),()=>t.assign(_,!1)),e.fail$data(da._`!${_}`)}else{let v=(0,_F.usePattern)(e,n);e.fail$data(da._`!${v}.test(${r})`)}}};r3.default=xF});var o3=Xe(function(i3){Object.defineProperty(i3,"__esModule",{value:!0});var bc=gt(),MF={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return bc.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>bc._`{limit: ${e}}`},EF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?bc.operators.GT:bc.operators.LT;e.fail$data(bc._`Object.keys(${r}).length ${n} ${i}`)}};i3.default=EF});var a3=Xe(function(s3){Object.defineProperty(s3,"__esModule",{value:!0});var _c=Rn(),wc=gt(),$F=Mt(),TF={message:({params:{missingProperty:e}})=>wc.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>wc._`{missingProperty: ${e}}`},PF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:TF,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:h}=s;if(!o&&r.length===0)return;let v=r.length>=h.loopRequired;if(s.allErrors)b();else _();if(h.strictRequired){let x=e.parentSchema.properties,{definedProperties:M}=e.it;for(let I of r)if((x===null||x===void 0?void 0:x[I])===void 0&&!M.has(I)){let $=s.schemaEnv.baseId+s.errSchemaPath,T=`required property "${I}" is not defined at "${$}" (strictRequired)`;(0,$F.checkStrictMode)(s,T,s.opts.strictRequired)}}function b(){if(v||o)e.block$data(wc.nil,g);else for(let x of r)(0,_c.checkReportMissingProp)(e,x)}function _(){let x=t.let("missing");if(v||o){let M=t.let("valid",!0);e.block$data(M,()=>S(x,M)),e.ok(M)}else t.if((0,_c.checkMissingProp)(e,r,x)),(0,_c.reportMissingProp)(e,x),t.else()}function g(){t.forOf("prop",i,(x)=>{e.setParams({missingProperty:x}),t.if((0,_c.noPropertyInData)(t,n,x,h.ownProperties),()=>e.error())})}function S(x,M){e.setParams({missingProperty:x}),t.forOf(x,i,()=>{t.assign(M,(0,_c.propertyInData)(t,n,x,h.ownProperties)),t.if((0,wc.not)(M),()=>{e.error(),t.break()})},wc.nil)}}};s3.default=PF});var l3=Xe(function(u3){Object.defineProperty(u3,"__esModule",{value:!0});var Sc=gt(),RF={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return Sc.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Sc._`{limit: ${e}}`},CF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:RF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?Sc.operators.GT:Sc.operators.LT;e.fail$data(Sc._`${r}.length ${n} ${i}`)}};u3.default=CF});var Hp=Xe(function(d3){Object.defineProperty(d3,"__esModule",{value:!0});var c3=Fb();c3.code='require("ajv/dist/runtime/equal").default';d3.default=c3});var h3=Xe(function(f3){Object.defineProperty(f3,"__esModule",{value:!0});var i_=uc(),Nr=gt(),NF=Mt(),zF=Hp(),jF={message:({params:{i:e,j:t}})=>Nr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Nr._`{i: ${e}, j: ${t}}`},UF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:jF,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:h}=e;if(!i&&!n)return;let v=t.let("valid"),b=o.items?(0,i_.getSchemaTypes)(o.items):[];e.block$data(v,_,Nr._`${s} === false`),e.ok(v);function _(){let M=t.let("i",Nr._`${r}.length`),I=t.let("j");e.setParams({i:M,j:I}),t.assign(v,!0),t.if(Nr._`${M} > 1`,()=>(g()?S:x)(M,I))}function g(){return b.length>0&&!b.some((M)=>M==="object"||M==="array")}function S(M,I){let $=t.name("item"),T=(0,i_.checkDataTypes)(b,$,h.opts.strictNumbers,i_.DataType.Wrong),P=t.const("indices",Nr._`{}`);t.for(Nr._`;${M}--;`,()=>{if(t.let($,Nr._`${r}[${M}]`),t.if(T,Nr._`continue`),b.length>1)t.if(Nr._`typeof ${$} == "string"`,Nr._`${$} += "_"`);t.if(Nr._`typeof ${P}[${$}] == "number"`,()=>{t.assign(I,Nr._`${P}[${$}]`),e.error(),t.assign(v,!1).break()}).code(Nr._`${P}[${$}] = ${M}`)})}function x(M,I){let $=(0,NF.useFunc)(t,zF.default),T=t.name("outer");t.label(T).for(Nr._`;${M}--;`,()=>t.for(Nr._`${I} = ${M}; ${I}--;`,()=>t.if(Nr._`${$}(${r}[${M}], ${r}[${I}])`,()=>{e.error(),t.assign(v,!1).break(T)})))}}};f3.default=UF});var m3=Xe(function(p3){Object.defineProperty(p3,"__esModule",{value:!0});var o_=gt(),FF=Mt(),qF=Hp(),BF={message:"must be equal to constant",params:({schemaCode:e})=>o_._`{allowedValue: ${e}}`},HF={keyword:"const",$data:!0,error:BF,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;if(i||o&&typeof o=="object")e.fail$data(o_._`!${(0,FF.useFunc)(t,qF.default)}(${r}, ${n})`);else e.fail(o_._`${o} !== ${r}`)}};p3.default=HF});var y3=Xe(function(g3){Object.defineProperty(g3,"__esModule",{value:!0});var xc=gt(),KF=Mt(),VF=Hp(),WF={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>xc._`{allowedValues: ${e}}`},GF={keyword:"enum",schemaType:"array",$data:!0,error:WF,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw Error("enum must have non-empty array");let h=n.length>=s.opts.loopEnum,v,b=()=>v!==null&&v!==void 0?v:v=(0,KF.useFunc)(t,VF.default),_;if(h||i)_=t.let("valid"),e.block$data(_,g);else{if(!Array.isArray(n))throw Error("ajv implementation error");let x=t.const("vSchema",o);_=(0,xc.or)(...n.map((M,I)=>S(x,I)))}e.pass(_);function g(){t.assign(_,!1),t.forOf("v",o,(x)=>t.if(xc._`${b()}(${r}, ${x})`,()=>t.assign(_,!0).break()))}function S(x,M){let I=n[M];return typeof I==="object"&&I!==null?xc._`${b()}(${r}, ${x}[${M}])`:xc._`${r} === ${I}`}}};g3.default=GF});var b3=Xe(function(v3){Object.defineProperty(v3,"__esModule",{value:!0});var XF=W4(),YF=J4(),QF=t3(),eq=n3(),tq=o3(),rq=a3(),nq=l3(),iq=h3(),oq=m3(),sq=y3(),aq=[XF.default,YF.default,QF.default,eq.default,tq.default,rq.default,nq.default,iq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oq.default,sq.default];v3.default=aq});var a_=Xe(function(w3){Object.defineProperty(w3,"__esModule",{value:!0});w3.validateAdditionalItems=void 0;var Xo=gt(),s_=Mt(),lq={message:({params:{len:e}})=>Xo.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Xo._`{limit: ${e}}`},cq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lq,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,s_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}_3(e,i)}};function _3(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let h=r.const("len",Xo._`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass(Xo._`${h} <= ${t.length}`);else if(typeof i=="object"&&!(0,s_.alwaysValidSchema)(s,i)){let b=r.var("valid",Xo._`${h} <= ${t.length}`);r.if((0,Xo.not)(b),()=>v(b)),e.ok(b)}function v(b){r.forRange("i",t.length,h,(_)=>{if(e.subschema({keyword:o,dataProp:_,dataPropType:s_.Type.Num},b),!s.allErrors)r.if((0,Xo.not)(b),()=>r.break())})}}w3.validateAdditionalItems=_3;w3.default=cq});var u_=Xe(function(M3){Object.defineProperty(M3,"__esModule",{value:!0});M3.validateTuple=void 0;var x3=gt(),Zp=Mt(),fq=Rn(),hq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return k3(e,"additionalItems",t);if(r.items=!0,(0,Zp.alwaysValidSchema)(r,t))return;e.ok((0,fq.validateArray)(e))}};function k3(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:h}=e;if(_(n),h.opts.unevaluated&&r.length&&h.items!==!0)h.items=Zp.mergeEvaluated.items(i,r.length,h.items);let v=i.name("valid"),b=i.const("len",x3._`${o}.length`);r.forEach((g,S)=>{if((0,Zp.alwaysValidSchema)(h,g))return;i.if(x3._`${b} > ${S}`,()=>e.subschema({keyword:s,schemaProp:S,dataProp:S},v)),e.ok(v)});function _(g){let{opts:S,errSchemaPath:x}=h,M=r.length,I=M===g.minItems&&(M===g.maxItems||g[t]===!1);if(S.strictTuples&&!I){let $=`"${s}" is ${M}-tuple, but minItems or maxItems/${t} are not specified or different at path "${x}"`;(0,Zp.checkStrictMode)(h,$,S.strictTuples)}}}M3.validateTuple=k3;M3.default=hq});var $3=Xe(function(I3){Object.defineProperty(I3,"__esModule",{value:!0});var mq=u_(),gq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,mq.validateTuple)(e,"items")};I3.default=gq});var A3=Xe(function(P3){Object.defineProperty(P3,"__esModule",{value:!0});var T3=gt(),vq=Mt(),bq=Rn(),_q=a_(),wq={message:({params:{len:e}})=>T3.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>T3._`{limit: ${e}}`},Sq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:wq,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;if(i.items=!0,(0,vq.alwaysValidSchema)(i,t))return;if(n)(0,_q.validateAdditionalItems)(e,n);else e.ok((0,bq.validateArray)(e))}};P3.default=Sq});var C3=Xe(function(R3){Object.defineProperty(R3,"__esModule",{value:!0});var Cn=gt(),Kp=Mt(),kq={message:({params:{min:e,max:t}})=>t===void 0?Cn.str`must contain at least ${e} valid item(s)`:Cn.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Cn._`{minContains: ${e}}`:Cn._`{minContains: ${e}, maxContains: ${t}}`},Mq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:kq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,h,{minContains:v,maxContains:b}=i;if(o.opts.next)s=v===void 0?1:v,h=b;else s=1;let _=t.const("len",Cn._`${n}.length`);if(e.setParams({min:s,max:h}),h===void 0&&s===0){(0,Kp.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&s>h){(0,Kp.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Kp.alwaysValidSchema)(o,r)){let I=Cn._`${_} >= ${s}`;if(h!==void 0)I=Cn._`${I} && ${_} <= ${h}`;e.pass(I);return}o.items=!0;let g=t.name("valid");if(h===void 0&&s===1)x(g,()=>t.if(g,()=>t.break()));else if(s===0){if(t.let(g,!0),h!==void 0)t.if(Cn._`${n}.length > 0`,S)}else t.let(g,!1),S();e.result(g,()=>e.reset());function S(){let I=t.name("_valid"),$=t.let("count",0);x(I,()=>t.if(I,()=>M($)))}function x(I,$){t.forRange("i",0,_,(T)=>{e.subschema({keyword:"contains",dataProp:T,dataPropType:Kp.Type.Num,compositeRule:!0},I),$()})}function M(I){if(t.code(Cn._`${I}++`),h===void 0)t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0).break());else if(t.if(Cn._`${I} > ${h}`,()=>t.assign(g,!1).break()),s===1)t.assign(g,!0);else t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0))}}};R3.default=Mq});var U3=Xe(function(N3){Object.defineProperty(N3,"__esModule",{value:!0});N3.validateSchemaDeps=N3.validatePropertyDeps=N3.error=void 0;var l_=gt(),Iq=Mt(),kc=Rn();N3.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return l_.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>l_._`{property: ${e},
|
|
23
|
+
|| ${s} === "boolean" || ${n} === null`).assign(h,pt._`[${n}]`)}}}function qz({gen:e,parentData:t,parentDataProperty:r},i){e.if(pt._`${t} !== undefined`,()=>e.assign(pt._`${t}[${r}]`,i))}function Db(e,t,r,i=oa.Correct){let n=i===oa.Correct?pt.operators.EQ:pt.operators.NEQ,o;switch(e){case"null":return pt._`${t} ${n} null`;case"array":o=pt._`Array.isArray(${t})`;break;case"object":o=pt._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(pt._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return pt._`typeof ${t} ${n} ${e}`}return i===oa.Correct?o:(0,pt.not)(o);function s(h=pt.nil){return(0,pt.and)(pt._`typeof ${t} == "number"`,h,r?pt._`isFinite(${t})`:pt.nil)}}dM.checkDataType=Db;function Nb(e,t,r,i){if(e.length===1)return Db(e[0],t,r,i);let n,o=(0,uM.toHash)(e);if(o.array&&o.object){let s=pt._`typeof ${t} != "object"`;n=o.null?s:pt._`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=pt.nil;if(o.number)delete o.integer;for(let s in o)n=(0,pt.and)(n,Db(s,t,r,i));return n}dM.checkDataTypes=Nb;var Bz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?pt._`{type: ${e}}`:pt._`{type: ${t}}`};function zb(e){let t=Hz(e);(0,zz.reportError)(t,Bz)}dM.reportTypeError=zb;function Hz(e){let{gen:t,data:r,schema:i}=e,n=(0,uM.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var gM=Xe(function(pM){Object.defineProperty(pM,"__esModule",{value:!0});pM.assignDefaults=void 0;var sa=gt(),Xz=Mt();function Yz(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)hM(e,n,r[n].default);else if(t==="array"&&Array.isArray(i))i.forEach((n,o)=>hM(e,o,n.default))}pM.assignDefaults=Yz;function hM(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let h=sa._`${o}${(0,sa.getProperty)(t)}`;if(n){(0,Xz.checkStrictMode)(e,`default is ignored for: ${h}`);return}let v=sa._`${h} === undefined`;if(s.useDefaults==="empty")v=sa._`${v} || ${h} === null || ${h} === ""`;i.if(v,sa._`${h} = ${(0,sa.stringify)(r)}`)}});var Rn=Xe(function(bM){Object.defineProperty(bM,"__esModule",{value:!0});bM.validateUnion=bM.validateArray=bM.usePattern=bM.callValidateCode=bM.schemaProperties=bM.allSchemaProperties=bM.noPropertyInData=bM.propertyInData=bM.isOwnProperty=bM.hasPropFunc=bM.reportMissingProp=bM.checkMissingProp=bM.checkReportMissingProp=void 0;var Bt=gt(),jb=Mt(),oo=Mi(),Qz=Mt();function ej(e,t){let{gen:r,data:i,it:n}=e;r.if(Lb(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Bt._`${t}`},!0),e.error()})}bM.checkReportMissingProp=ej;function tj({gen:e,data:t,it:{opts:r}},i,n){return(0,Bt.or)(...i.map((o)=>(0,Bt.and)(Lb(e,t,o,r.ownProperties),Bt._`${n} = ${o}`)))}bM.checkMissingProp=tj;function rj(e,t){e.setParams({missingProperty:t},!0),e.error()}bM.reportMissingProp=rj;function yM(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Bt._`Object.prototype.hasOwnProperty`})}bM.hasPropFunc=yM;function Ub(e,t,r){return Bt._`${yM(e)}.call(${t}, ${r})`}bM.isOwnProperty=Ub;function nj(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} !== undefined`;return i?Bt._`${n} && ${Ub(e,t,r)}`:n}bM.propertyInData=nj;function Lb(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} === undefined`;return i?(0,Bt.or)(n,(0,Bt.not)(Ub(e,t,r))):n}bM.noPropertyInData=Lb;function vM(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}bM.allSchemaProperties=vM;function ij(e,t){return vM(t).filter((r)=>!(0,jb.alwaysValidSchema)(e,t[r]))}bM.schemaProperties=ij;function oj({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},h,v,b){let _=b?Bt._`${e}, ${t}, ${i}${n}`:t,g=[[oo.default.instancePath,(0,Bt.strConcat)(oo.default.instancePath,o)],[oo.default.parentData,s.parentData],[oo.default.parentDataProperty,s.parentDataProperty],[oo.default.rootData,oo.default.rootData]];if(s.opts.dynamicRef)g.push([oo.default.dynamicAnchors,oo.default.dynamicAnchors]);let S=Bt._`${_}, ${r.object(...g)}`;return v!==Bt.nil?Bt._`${h}.call(${v}, ${S})`:Bt._`${h}(${S})`}bM.callValidateCode=oj;var sj=Bt._`new RegExp`;function aj({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:Bt._`${n.code==="new RegExp"?sj:(0,Qz.useFunc)(e,n)}(${r}, ${i})`})}bM.usePattern=aj;function uj(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let h=t.let("valid",!0);return s(()=>t.assign(h,!1)),h}return t.var(o,!0),s(()=>t.break()),o;function s(h){let v=t.const("len",Bt._`${r}.length`);t.forRange("i",0,v,(b)=>{e.subschema({keyword:i,dataProp:b,dataPropType:jb.Type.Num},o),t.if((0,Bt.not)(o),h)})}}bM.validateArray=uj;function lj(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((v)=>(0,jb.alwaysValidSchema)(n,v))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),h=t.name("_valid");t.block(()=>r.forEach((v,b)=>{let _=e.subschema({keyword:i,schemaProp:b,compositeRule:!0},h);if(t.assign(s,Bt._`${s} || ${h}`),!e.mergeValidEvaluated(_,h))t.if((0,Bt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}bM.validateUnion=lj});var MM=Xe(function(xM){Object.defineProperty(xM,"__esModule",{value:!0});xM.validateKeywordUsage=xM.validSchemaType=xM.funcKeywordCode=xM.macroKeywordCode=void 0;var Xr=gt(),Vo=Mi(),Sj=Rn(),xj=ac();function kj(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,h=t.macro.call(s.self,n,o,s),v=SM(r,i,h);if(s.opts.validateSchema!==!1)s.self.validateSchema(h,!0);let b=r.name("valid");e.subschema({schema:h,schemaPath:Xr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:v,compositeRule:!0},b),e.pass(b,()=>e.error(!0))}xM.macroKeywordCode=kj;function Mj(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:h,it:v}=e;Ij(v,t);let b=!h&&t.compile?t.compile.call(v.self,o,s,v):t.validate,_=SM(i,n,b),g=i.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1){if(I(),t.modifying)wM(e);$(()=>e.error())}else{let T=t.async?x():M();if(t.modifying)wM(e);$(()=>Ej(e,T))}}function x(){let T=i.let("ruleErrs",null);return i.try(()=>I(Xr._`await `),(P)=>i.assign(g,!1).if(Xr._`${P} instanceof ${v.ValidationError}`,()=>i.assign(T,Xr._`${P}.errors`),()=>i.throw(P))),T}function M(){let T=Xr._`${_}.errors`;return i.assign(T,null),I(Xr.nil),T}function I(T=t.async?Xr._`await `:Xr.nil){let P=v.opts.passContext?Vo.default.this:Vo.default.self,R=!(("compile"in t)&&!h||t.schema===!1);i.assign(g,Xr._`${T}${(0,Sj.callValidateCode)(e,_,P,R)}`,t.modifying)}function $(T){var P;i.if((0,Xr.not)((P=t.valid)!==null&&P!==void 0?P:g),T)}}xM.funcKeywordCode=Mj;function wM(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,Xr._`${i.parentData}[${i.parentDataProperty}]`))}function Ej(e,t){let{gen:r}=e;r.if(Xr._`Array.isArray(${t})`,()=>{r.assign(Vo.default.vErrors,Xr._`${Vo.default.vErrors} === null ? ${t} : ${Vo.default.vErrors}.concat(${t})`).assign(Vo.default.errors,Xr._`${Vo.default.vErrors}.length`),(0,xj.extendErrors)(e)},()=>e.error())}function Ij({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function SM(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Xr.stringify)(r)})}function $j(e,t,r=!1){return!t.length||t.some((i)=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}xM.validSchemaType=$j;function Tj({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((h)=>!Object.prototype.hasOwnProperty.call(e,h)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){let v=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(v);else throw Error(v)}}}xM.validateKeywordUsage=Tj});var TM=Xe(function(IM){Object.defineProperty(IM,"__esModule",{value:!0});IM.extendSubschemaMode=IM.extendSubschemaData=IM.getSubschema=void 0;var ti=gt(),EM=Mt();function Cj(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let h=e.schema[t];return r===void 0?{schema:h,schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:h[r],schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}${(0,ti.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,EM.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}IM.getSubschema=Cj;function Oj(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:h}=t;if(r!==void 0){let{errorPath:b,dataPathArr:_,opts:g}=t,S=h.let("data",ti._`${t.data}${(0,ti.getProperty)(r)}`,!0);v(S),e.errorPath=ti.str`${b}${(0,EM.getErrorPath)(r,i,g.jsPropertySyntax)}`,e.parentDataProperty=ti._`${r}`,e.dataPathArr=[..._,e.parentDataProperty]}if(n!==void 0){let b=n instanceof ti.Name?n:h.let("data",n,!0);if(v(b),s!==void 0)e.propertyName=s}if(o)e.dataTypes=o;function v(b){e.data=b,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,b]}}IM.extendSubschemaData=Oj;function Dj(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){if(i!==void 0)e.compositeRule=i;if(n!==void 0)e.createErrors=n;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=r}IM.extendSubschemaMode=Dj});var Fb=Xe(function(gbe,PM){PM.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var RM=Xe(function(ybe,AM){var so=AM.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Pp(t,i,n,e,"",e)};so.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};so.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};so.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};so.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function Pp(e,t,r,i,n,o,s,h,v,b){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,h,v,b);for(var _ in i){var g=i[_];if(Array.isArray(g)){if(_ in so.arrayKeywords)for(var S=0;S<g.length;S++)Pp(e,t,r,g[S],n+"/"+_+"/"+S,o,n,_,i,S)}else if(_ in so.propsKeywords){if(g&&typeof g=="object")for(var x in g)Pp(e,t,r,g[x],n+"/"+_+"/"+jj(x),o,n,_,i,x)}else if(_ in so.keywords||e.allKeys&&!(_ in so.skipKeywords))Pp(e,t,r,g,n+"/"+_,o,n,_,i)}r(i,n,o,s,h,v,b)}}function jj(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=Xe(function(NM){Object.defineProperty(NM,"__esModule",{value:!0});NM.getSchemaRefs=NM.resolveUrl=NM.normalizeId=NM._getFullPath=NM.getFullPath=NM.inlineRef=void 0;var Uj=Mt(),Lj=Fb(),Fj=RM(),qj=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Bj(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!qb(e);if(!t)return!1;return CM(e)<=t}NM.inlineRef=Bj;var Hj=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qb(e){for(let t in e){if(Hj.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(qb))return!0;if(typeof r=="object"&&qb(r))return!0}return!1}function CM(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,qj.has(r))continue;if(typeof e[r]=="object")(0,Uj.eachItem)(e[r],(i)=>t+=CM(i));if(t===1/0)return 1/0}return t}function OM(e,t="",r){if(r!==!1)t=aa(t);let i=e.parse(t);return DM(e,i)}NM.getFullPath=OM;function DM(e,t){return e.serialize(t).split("#")[0]+"#"}NM._getFullPath=DM;var Zj=/#\/?$/;function aa(e){return e?e.replace(Zj,""):""}NM.normalizeId=aa;function Kj(e,t,r){return r=aa(r),e.resolve(t,r)}NM.resolveUrl=Kj;var Vj=/^[a-z_][-a-z0-9._]*$/i;function Wj(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=aa(e[r]||t),o={"":n},s=OM(i,n,!1),h={},v=new Set;return Fj(e,{allKeys:!0},(g,S,x,M)=>{if(M===void 0)return;let I=s+S,$=o[M];if(typeof g[r]=="string")$=T.call(this,g[r]);P.call(this,g.$anchor),P.call(this,g.$dynamicAnchor),o[S]=$;function T(R){let C=this.opts.uriResolver.resolve;if(R=aa($?C($,R):R),v.has(R))throw _(R);v.add(R);let N=this.refs[R];if(typeof N=="string")N=this.refs[N];if(typeof N=="object")b(g,N.schema,R);else if(R!==aa(I))if(R[0]==="#")b(g,h[R],R),h[R]=g;else this.refs[R]=I;return R}function P(R){if(typeof R=="string"){if(!Vj.test(R))throw Error(`invalid anchor "${R}"`);T.call(this,`#${R}`)}}}),h;function b(g,S,x){if(S!==void 0&&!Lj(g,S))throw _(x)}function _(g){return Error(`reference "${g}" resolves to more than one schema`)}}NM.getSchemaRefs=Wj});var fc=Xe(function(YM){Object.defineProperty(YM,"__esModule",{value:!0});YM.getData=YM.KeywordCxt=YM.validateFunctionCode=void 0;var qM=tM(),jM=uc(),Hb=Ob(),Ap=uc(),eU=gM(),dc=MM(),Bb=TM(),nt=gt(),ct=Mi(),tU=lc(),Ei=Mt(),cc=ac();function rU(e){if(ZM(e)){if(KM(e),HM(e)){oU(e);return}}BM(e,()=>(0,qM.topBoolOrEmptySchema)(e))}YM.validateFunctionCode=rU;function BM({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){if(n.code.es5)e.func(t,nt._`${ct.default.data}, ${ct.default.valCxt}`,i.$async,()=>{e.code(nt._`"use strict"; ${UM(r,n)}`),iU(e,n),e.code(o)});else e.func(t,nt._`${ct.default.data}, ${nU(n)}`,i.$async,()=>e.code(UM(r,n)).code(o))}function nU(e){return nt._`{${ct.default.instancePath}="", ${ct.default.parentData}, ${ct.default.parentDataProperty}, ${ct.default.rootData}=${ct.default.data}${e.dynamicRef?nt._`, ${ct.default.dynamicAnchors}={}`:nt.nil}}={}`}function iU(e,t){e.if(ct.default.valCxt,()=>{if(e.var(ct.default.instancePath,nt._`${ct.default.valCxt}.${ct.default.instancePath}`),e.var(ct.default.parentData,nt._`${ct.default.valCxt}.${ct.default.parentData}`),e.var(ct.default.parentDataProperty,nt._`${ct.default.valCxt}.${ct.default.parentDataProperty}`),e.var(ct.default.rootData,nt._`${ct.default.valCxt}.${ct.default.rootData}`),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`${ct.default.valCxt}.${ct.default.dynamicAnchors}`)},()=>{if(e.var(ct.default.instancePath,nt._`""`),e.var(ct.default.parentData,nt._`undefined`),e.var(ct.default.parentDataProperty,nt._`undefined`),e.var(ct.default.rootData,ct.default.data),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`{}`)})}function oU(e){let{schema:t,opts:r,gen:i}=e;BM(e,()=>{if(r.$comment&&t.$comment)WM(e);if(cU(e),i.let(ct.default.vErrors,null),i.let(ct.default.errors,0),r.unevaluated)sU(e);VM(e),hU(e)});return}function sU(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",nt._`${r}.evaluated`),t.if(nt._`${e.evaluated}.dynamicProps`,()=>t.assign(nt._`${e.evaluated}.props`,nt._`undefined`)),t.if(nt._`${e.evaluated}.dynamicItems`,()=>t.assign(nt._`${e.evaluated}.items`,nt._`undefined`))}function UM(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?nt._`/*# sourceURL=${r} */`:nt.nil}function aU(e,t){if(ZM(e)){if(KM(e),HM(e)){uU(e,t);return}}(0,qM.boolOrEmptySchema)(e,t)}function HM({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function ZM(e){return typeof e.schema!="boolean"}function uU(e,t){let{schema:r,gen:i,opts:n}=e;if(n.$comment&&r.$comment)WM(e);dU(e),fU(e);let o=i.const("_errs",ct.default.errors);VM(e,o),i.var(t,nt._`${o} === ${ct.default.errors}`)}function KM(e){(0,Ei.checkUnknownRules)(e),lU(e)}function VM(e,t){if(e.opts.jtd)return LM(e,[],!1,t);let r=(0,jM.getSchemaTypes)(e.schema),i=(0,jM.coerceAndCheckDataType)(e,r);LM(e,r,!i,t)}function lU(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;if(t.$ref&&i.ignoreKeywordsWithRef&&(0,Ei.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function cU(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,Ei.checkStrictMode)(e,"default is ignored in the schema root")}function dU(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,tU.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function fU(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function WM({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code(nt._`${ct.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=nt.str`${i}/$comment`,h=e.scopeValue("root",{ref:t.root});e.code(nt._`${ct.default.self}.opts.$comment(${o}, ${s}, ${h}.schema)`)}}function hU(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;if(r.$async)t.if(nt._`${ct.default.errors} === 0`,()=>t.return(ct.default.data),()=>t.throw(nt._`new ${n}(${ct.default.vErrors})`));else{if(t.assign(nt._`${i}.errors`,ct.default.vErrors),o.unevaluated)pU(e);t.return(nt._`${ct.default.errors} === 0`)}}function pU({gen:e,evaluated:t,props:r,items:i}){if(r instanceof nt.Name)e.assign(nt._`${t}.props`,r);if(i instanceof nt.Name)e.assign(nt._`${t}.items`,i)}function LM(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:h,opts:v,self:b}=e,{RULES:_}=b;if(o.$ref&&(v.ignoreKeywordsWithRef||!(0,Ei.schemaHasRulesButRef)(o,_))){n.block(()=>JM(e,"$ref",_.all.$ref.definition));return}if(!v.jtd)mU(e,t);n.block(()=>{for(let S of _.rules)g(S);g(_.post)});function g(S){if(!(0,Hb.shouldUseGroup)(o,S))return;if(S.type){if(n.if((0,Ap.checkDataType)(S.type,s,v.strictNumbers)),FM(e,S),t.length===1&&t[0]===S.type&&r)n.else(),(0,Ap.reportTypeError)(e);n.endIf()}else FM(e,S);if(!h)n.if(nt._`${ct.default.errors} === ${i||0}`)}}function FM(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;if(n)(0,eU.assignDefaults)(e,t.type);r.block(()=>{for(let o of t.rules)if((0,Hb.shouldUseRule)(i,o))JM(e,o.keyword,o.definition,t.type)})}function mU(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(gU(e,t),!e.opts.allowUnionTypes)yU(e,t);vU(e,e.dataTypes)}function gU(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!GM(e.dataTypes,r))Zb(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),_U(e,t)}function yU(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Zb(e,"use allowUnionTypes to allow union type keyword")}function vU(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Hb.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;if(o.length&&!o.some((s)=>bU(t,s)))Zb(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function bU(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function GM(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function _U(e,t){let r=[];for(let i of e.dataTypes)if(GM(t,i))r.push(i);else if(t.includes("integer")&&i==="number")r.push("integer");e.dataTypes=r}function Zb(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ei.checkStrictMode)(e,t,e.opts.strictTypes)}class Kb{constructor(e,t,r){if((0,dc.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ei.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",XM(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,dc.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ct.default.errors)}result(e,t,r){this.failResult((0,nt.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,nt.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(nt._`${t} !== undefined && (${(0,nt.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?cc.reportExtraError:cc.reportError)(this,this.def.error,t)}$dataError(){(0,cc.reportError)(this,this.def.$dataError||cc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,cc.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=nt.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=nt.nil,t=nt.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:n,def:o}=this;if(r.if((0,nt.or)(nt._`${i} === undefined`,t)),e!==nt.nil)r.assign(e,!0);if(n.length||o.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==nt.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:i,it:n}=this;return(0,nt.or)(o(),s());function o(){if(r.length){if(!(t instanceof nt.Name))throw Error("ajv implementation error");let h=Array.isArray(r)?r:[r];return nt._`${(0,Ap.checkDataTypes)(h,t,n.opts.strictNumbers,Ap.DataType.Wrong)}`}return nt.nil}function s(){if(i.validateSchema){let h=e.scopeValue("validate$data",{ref:i.validateSchema});return nt._`!${h}(${t})`}return nt.nil}}subschema(e,t){let r=(0,Bb.getSubschema)(this.it,e);(0,Bb.extendSubschemaData)(r,this.it,e),(0,Bb.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return aU(i,t),i}mergeEvaluated(e,t){let{it:r,gen:i}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Ei.mergeEvaluated.props(i,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Ei.mergeEvaluated.items(i,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(t,()=>this.mergeEvaluated(e,nt.Name)),!0}}YM.KeywordCxt=Kb;function JM(e,t,r,i){let n=new Kb(e,r,t);if("code"in r)r.code(n,i);else if(n.$data&&r.validate)(0,dc.funcKeywordCode)(n,r);else if("macro"in r)(0,dc.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,dc.funcKeywordCode)(n,r)}var wU=/^\/(?:[^~]|~0|~1)*$/,SU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function XM(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return ct.default.rootData;if(e[0]==="/"){if(!wU.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,o=ct.default.rootData}else{let b=SU.exec(e);if(!b)throw Error(`Invalid JSON-pointer: ${e}`);let _=+b[1];if(n=b[2],n==="#"){if(_>=t)throw Error(v("property/index",_));return i[t-_]}if(_>t)throw Error(v("data",_));if(o=r[t-_],!n)return o}let s=o,h=n.split("/");for(let b of h)if(b)o=nt._`${o}${(0,nt.getProperty)((0,Ei.unescapeJsonPointer)(b))}`,s=nt._`${s} && ${o}`;return s;function v(b,_){return`Cannot access ${b} ${_} levels up, current level is ${t}`}}YM.getData=XM});var Rp=Xe(function(t4){Object.defineProperty(t4,"__esModule",{value:!0});class e4 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}t4.default=e4});var hc=Xe(function(n4){Object.defineProperty(n4,"__esModule",{value:!0});var Vb=lc();class r4 extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,Vb.resolveUrl)(e,t,r),this.missingSchema=(0,Vb.normalizeId)((0,Vb.getFullPath)(e,this.missingRef))}}n4.default=r4});var Op=Xe(function(s4){Object.defineProperty(s4,"__esModule",{value:!0});s4.resolveSchema=s4.getCompilingSchema=s4.resolveRef=s4.compileSchema=s4.SchemaEnv=void 0;var Hn=gt(),IU=Rp(),Wo=Mi(),Zn=lc(),i4=Mt(),$U=fc();class pc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Zn.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}s4.SchemaEnv=pc;function Gb(e){let t=o4.call(this,e);if(t)return t;let r=(0,Zn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Hn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),h;if(e.$async)h=s.scopeValue("Error",{ref:IU.default,code:Hn._`require("ajv/dist/runtime/validation_error").default`});let v=s.scopeName("validate");e.validateName=v;let b={gen:s,allErrors:this.opts.allErrors,data:Wo.default.data,parentData:Wo.default.parentData,parentDataProperty:Wo.default.parentDataProperty,dataNames:[Wo.default.data],dataPathArr:[Hn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Hn.stringify)(e.schema)}:{ref:e.schema}),validateName:v,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Hn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Hn._`""`,opts:this.opts,self:this},_;try{this._compilations.add(e),(0,$U.validateFunctionCode)(b),s.optimize(this.opts.code.optimize);let g=s.toString();if(_=`${s.scopeRefs(Wo.default.scope)}return ${g}`,this.opts.code.process)_=this.opts.code.process(_,e);let x=Function(`${Wo.default.self}`,`${Wo.default.scope}`,_)(this,this.scope.get());if(this.scope.value(v,{ref:x}),x.errors=null,x.schema=e.schema,x.schemaEnv=e,e.$async)x.$async=!0;if(this.opts.code.source===!0)x.source={validateName:v,validateCode:g,scopeValues:s._values};if(this.opts.unevaluated){let{props:M,items:I}=b;if(x.evaluated={props:M instanceof Hn.Name?void 0:M,items:I instanceof Hn.Name?void 0:I,dynamicProps:M instanceof Hn.Name,dynamicItems:I instanceof Hn.Name},x.source)x.source.evaluated=(0,Hn.stringify)(x.evaluated)}return e.validate=x,e}catch(g){if(delete e.validate,delete e.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw g}finally{this._compilations.delete(e)}}s4.compileSchema=Gb;function TU(e,t,r){var i;r=(0,Zn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=RU.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:h}=this.opts;if(s)o=new pc({schema:s,schemaId:h,root:e,baseId:t})}if(o===void 0)return;return e.refs[r]=PU.call(this,o)}s4.resolveRef=TU;function PU(e){if((0,Zn.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Gb.call(this,e)}function o4(e){for(let t of this._compilations)if(AU(t,e))return t}s4.getCompilingSchema=o4;function AU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function RU(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Cp.call(this,e,t)}function Cp(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Zn._getFullPath)(this.opts.uriResolver,r),n=(0,Zn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return Wb.call(this,r,e);let o=(0,Zn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let h=Cp.call(this,e,s);if(typeof(h===null||h===void 0?void 0:h.schema)!=="object")return;return Wb.call(this,r,h)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)Gb.call(this,s);if(o===(0,Zn.normalizeId)(t)){let{schema:h}=s,{schemaId:v}=this.opts,b=h[v];if(b)n=(0,Zn.resolveUrl)(this.opts.uriResolver,n,b);return new pc({schema:h,schemaId:v,root:e,baseId:n})}return Wb.call(this,r,s)}s4.resolveSchema=Cp;var CU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Wb(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let h of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let v=r[(0,i4.unescapeFragment)(h)];if(v===void 0)return;r=v;let b=typeof r==="object"&&r[this.opts.schemaId];if(!CU.has(h)&&b)t=(0,Zn.resolveUrl)(this.opts.uriResolver,t,b)}let o;if(typeof r!="boolean"&&r.$ref&&!(0,i4.schemaHasRulesButRef)(r,this.RULES)){let h=(0,Zn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Cp.call(this,i,h)}let{schemaId:s}=this.opts;if(o=o||new pc({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o;return}});var u4=Xe(function(xbe,jU){jU.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Yb=Xe(function(kbe,p4){var UU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),c4=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Jb=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),d4=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),LU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Xb(e){let t="",r=0,i=0;for(i=0;i<e.length;i++){if(r=e[i].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var FU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l4(e){return e.length=0,!0}function qU(e,t,r){if(e.length){let i=Xb(e);if(i!=="")t.push(i);else return r.error=!0,!1;e.length=0}return!0}function BU(e){let t=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,h=qU;for(let v=0;v<e.length;v++){let b=e[v];if(b==="["||b==="]")continue;if(b===":"){if(o===!0)s=!0;if(!h(n,i,r))break;if(++t>7){r.error=!0;break}if(v>0&&e[v-1]===":")o=!0;i.push(":");continue}else if(b==="%"){if(!h(n,i,r))break;h=l4}else{n.push(b);continue}}if(n.length)if(h===l4)r.zone=n.join("");else if(s)i.push(n.join(""));else i.push(Xb(n));return r.address=i.join(""),r}function f4(e){if(HU(e,":")<2)return{host:e,isIPV6:!1};let t=BU(e);if(!t.error){let{address:r,address:i}=t;if(t.zone)r+="%"+t.zone,i+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:i}}else return{host:e,isIPV6:!1}}function HU(e,t){let r=0;for(let i=0;i<e.length;i++)if(e[i]===t)r++;return r}function ZU(e){let t=e,r=[],i=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var KU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},VU=/[@/?#:]/g,WU=/[@/?#]/g;function h4(e,t){let r=t?WU:VU;return r.lastIndex=0,e.replace(r,(i)=>KU[i])}function GU(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Jb(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(t&&d4(s))r+=s;else r+="%"+o;i+=2;continue}}r+=e[i]}return r}function JU(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Jb(i)){let n=i.toUpperCase(),o=String.fromCharCode(parseInt(n,16));if(o!=="."&&d4(o))t+=o;else t+="%"+n;r+=2;continue}}if(LU(e[r]))t+=e[r];else t+=escape(e[r])}return t}function XU(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Jb(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function YU(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!c4(r)){let i=f4(r);if(i.isIPV6===!0)r=`[${i.escapedHost}]`;else r=h4(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}p4.exports={nonSimpleDomain:FU,recomposeAuthority:YU,reescapeHostDelimiters:h4,normalizePercentEncoding:GU,normalizePathEncoding:JU,escapePreservingEscapes:XU,removeDotSegments:ZU,isIPv4:c4,isUUID:UU,normalizeIPv6:f4,stringArrayToHexStripped:Xb}});var b4=Xe(function(Mbe,v4){var{isUUID:QU}=Yb(),eL=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,tL=["http","https","ws","wss","urn","urn:uuid"];function rL(e){return tL.indexOf(e)!==-1}function Qb(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function m4(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function g4(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function nL(e){return e.secure=Qb(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function iL(e){if(e.port===(Qb(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function oL(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(eL);if(r){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=e_(n);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function sL(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=e_(n);if(o)e=o.serialize(e,t);let s=e,h=e.nss;return s.path=`${i||t.nid}:${h}`,t.skipEscape=!0,s}function aL(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!QU(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function uL(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var y4={scheme:"http",domainHost:!0,parse:m4,serialize:g4},lL={scheme:"https",domainHost:y4.domainHost,parse:m4,serialize:g4},Dp={scheme:"ws",domainHost:!0,parse:nL,serialize:iL},cL={scheme:"wss",domainHost:Dp.domainHost,parse:Dp.parse,serialize:Dp.serialize},dL={scheme:"urn",parse:oL,serialize:sL,skipNormalize:!0},fL={scheme:"urn:uuid",parse:aL,serialize:uL,skipNormalize:!0},Np={http:y4,https:lL,ws:Dp,wss:cL,urn:dL,"urn:uuid":fL};Object.setPrototypeOf(Np,null);function e_(e){return e&&(Np[e]||Np[e.toLowerCase()])||void 0}v4.exports={wsIsSecure:Qb,SCHEMES:Np,isValidSchemeName:rL,getSchemeHandler:e_}});var M4=Xe(function(Ebe,zp){var{normalizeIPv6:hL,removeDotSegments:mc,recomposeAuthority:pL,normalizePercentEncoding:mL,normalizePathEncoding:gL,escapePreservingEscapes:yL,reescapeHostDelimiters:vL,isIPv4:bL,nonSimpleDomain:_L}=Yb(),{SCHEMES:wL,getSchemeHandler:w4}=b4();function SL(e,t){if(typeof e==="string")e=IL(e,t);else if(typeof e==="object")e=ua(Go(e,t),t);return e}function xL(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=S4(ua(e,i),ua(t,i),i,!0);return i.skipEscape=!0,Go(n,i)}function S4(e,t,r,i){let n={};if(!i)e=ua(Go(e,r),r),t=ua(Go(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=mc(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=mc(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function kL(e,t,r){let i=_4(e,r),n=_4(t,r);return i!==void 0&&n!==void 0&&i.toLowerCase()===n.toLowerCase()}function Go(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),n=[],o=w4(i.scheme||r.scheme);if(o&&o.serialize)o.serialize(r,i);if(r.path!==void 0)if(!i.skipEscape){if(r.path=yL(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=mL(r.path);if(i.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=pL(r);if(s!==void 0){if(i.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let h=r.path;if(!i.absolutePath&&(!o||!o.absolutePath))h=mc(h);if(s===void 0&&h[0]==="/"&&h[1]==="/")h="/%2F"+h.slice(2);n.push(h)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var ML=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function EL(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function x4(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(ML);if(s){if(i.scheme=s[1],i.userinfo=s[3],i.host=s[4],i.port=parseInt(s[5],10),i.path=s[6]||"",i.query=s[7],i.fragment=s[8],isNaN(i.port))i.port=s[5];let h=EL(i,s);if(h!==void 0)i.error=i.error||h,n=!0;if(i.host)if(bL(i.host)===!1){let _=hL(i.host);i.host=_.host.toLowerCase(),o=_.isIPV6}else o=!0;if(i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path)i.reference="same-document";else if(i.scheme===void 0)i.reference="relative";else if(i.fragment===void 0)i.reference="absolute";else i.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==i.reference)i.error=i.error||"URI is not a "+r.reference+" reference.";let v=w4(r.scheme||i.scheme);if(!r.unicodeSupport&&(!v||!v.unicodeSupport)){if(i.host&&(r.domainHost||v&&v.domainHost)&&o===!1&&_L(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(b){i.error=i.error||"Host's domain name can not be converted to ASCII: "+b}}if(!v||v&&!v.skipNormalize){if(e.indexOf("%")!==-1){if(i.scheme!==void 0)i.scheme=unescape(i.scheme);if(i.host!==void 0)i.host=vL(unescape(i.host),o)}if(i.path)i.path=gL(i.path);if(i.fragment)try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}}if(v&&v.parse)v.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function ua(e,t){return x4(e,t).parsed}function IL(e,t){return k4(e,t).normalized}function k4(e,t){let{parsed:r,malformedAuthorityOrPort:i}=x4(e,t);return{normalized:i?e:Go(r,t),malformedAuthorityOrPort:i}}function _4(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:i}=k4(e,t);return i?void 0:r}if(typeof e==="object")return Go(e,t)}var t_={SCHEMES:wL,normalize:SL,resolve:xL,resolveComponent:S4,equal:kL,serialize:Go,parse:ua};zp.exports=t_;zp.exports.default=t_;zp.exports.fastUri=t_});var $4=Xe(function(I4){Object.defineProperty(I4,"__esModule",{value:!0});var E4=M4();E4.code='require("ajv/dist/runtime/uri").default';I4.default=E4});var N4=Xe(function(Ii){Object.defineProperty(Ii,"__esModule",{value:!0});Ii.CodeGen=Ii.Name=Ii.nil=Ii.stringify=Ii.str=Ii._=Ii.KeywordCxt=void 0;var TL=fc();Object.defineProperty(Ii,"KeywordCxt",{enumerable:!0,get:function(){return TL.KeywordCxt}});var la=gt();Object.defineProperty(Ii,"_",{enumerable:!0,get:function(){return la._}});Object.defineProperty(Ii,"str",{enumerable:!0,get:function(){return la.str}});Object.defineProperty(Ii,"stringify",{enumerable:!0,get:function(){return la.stringify}});Object.defineProperty(Ii,"nil",{enumerable:!0,get:function(){return la.nil}});Object.defineProperty(Ii,"Name",{enumerable:!0,get:function(){return la.Name}});Object.defineProperty(Ii,"CodeGen",{enumerable:!0,get:function(){return la.CodeGen}});var PL=Rp(),C4=hc(),AL=Cb(),gc=Op(),RL=gt(),yc=lc(),jp=uc(),n_=Mt(),T4=u4(),CL=$4(),O4=(e,t)=>new RegExp(e,t);O4.code="new RegExp";var OL=["removeAdditional","useDefaults","coerceTypes"],DL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),NL={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},zL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},P4=200;function jL(e){var t,r,i,n,o,s,h,v,b,_,g,S,x,M,I,$,T,P,R,C,N,B,ie,le,ue;let F=e.strict,ee=(t=e.code)===null||t===void 0?void 0:t.optimize,a=ee===!0||ee===void 0?1:ee||0,c=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:O4,f=(n=e.uriResolver)!==null&&n!==void 0?n:CL.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:F)!==null&&s!==void 0?s:!0,strictNumbers:(v=(h=e.strictNumbers)!==null&&h!==void 0?h:F)!==null&&v!==void 0?v:!0,strictTypes:(_=(b=e.strictTypes)!==null&&b!==void 0?b:F)!==null&&_!==void 0?_:"log",strictTuples:(S=(g=e.strictTuples)!==null&&g!==void 0?g:F)!==null&&S!==void 0?S:"log",strictRequired:(M=(x=e.strictRequired)!==null&&x!==void 0?x:F)!==null&&M!==void 0?M:!1,code:e.code?{...e.code,optimize:a,regExp:c}:{optimize:a,regExp:c},loopRequired:(I=e.loopRequired)!==null&&I!==void 0?I:P4,loopEnum:($=e.loopEnum)!==null&&$!==void 0?$:P4,meta:(T=e.meta)!==null&&T!==void 0?T:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(N=e.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(B=e.validateSchema)!==null&&B!==void 0?B:!0,validateFormats:(ie=e.validateFormats)!==null&&ie!==void 0?ie:!0,unicodeRegExp:(le=e.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ue=e.int32range)!==null&&ue!==void 0?ue:!0,uriResolver:f}}class Up{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...jL(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new RL.ValueScope({scope:{},prefixes:DL,es5:t,lines:r}),this.logger=HL(e.logger);let i=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,AL.getRules)(),A4.call(this,NL,e,"NOT SUPPORTED"),A4.call(this,zL,e,"DEPRECATED","warn"),this._metaOpts=qL.call(this),e.formats)LL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)FL.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);UL.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,i=T4;if(r==="id")i={...T4},i.id=i.$id,delete i.$id;if(t&&e)this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(t);if(!("$async"in r))this.errors=r.errors;return i}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,t);async function i(b,_){await n.call(this,b.$schema);let g=this._addSchema(b,_);return g.validate||o.call(this,g)}async function n(b){if(b&&!this.getSchema(b))await i.call(this,{$ref:b},!0)}async function o(b){try{return this._compileSchemaEnv(b)}catch(_){if(!(_ instanceof C4.default))throw _;return s.call(this,_),await h.call(this,_.missingSchema),o.call(this,b)}}function s({missingSchema:b,missingRef:_}){if(this.refs[b])throw Error(`AnySchema ${b} is loaded but ${_} cannot be resolved`)}async function h(b){let _=await v.call(this,b);if(!this.refs[b])await n.call(this,_.$schema);if(!this.refs[b])this.addSchema(_,b,t)}async function v(b){let _=this._loading[b];if(_)return _;try{return await(this._loading[b]=r(b))}finally{delete this._loading[b]}}}addSchema(e,t,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,i);return this}let n;if(typeof e==="object"){let{schemaId:o}=this.opts;if(n=e[o],n!==void 0&&typeof n!="string")throw Error(`schema ${o} must be string`)}return t=(0,yc.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,i,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return i}getSchema(e){let t;while(typeof(t=R4.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,i=new gc.SchemaEnv({schema:{},schemaId:r});if(t=gc.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=R4.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,yc.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(KL.call(this,r,t),!t)return(0,n_.eachItem)(r,(n)=>r_.call(this,n)),this;WL.call(this,t);let i={...t,type:(0,jp.getJSONTypes)(t.type),schemaType:(0,jp.getJSONTypes)(t.schemaType)};return(0,n_.eachItem)(r,i.type.length===0?(n)=>r_.call(this,n,i):(n)=>i.type.forEach((o)=>r_.call(this,n,i,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let i=r.rules.findIndex((n)=>n.keyword===e);if(i>=0)r.rules.splice(i,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((i)=>`${r}${i.instancePath} ${i.message}`).reduce((i,n)=>i+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of t){let n=i.split("/").slice(1),o=e;for(let s of n)o=o[s];for(let s in r){let h=r[s];if(typeof h!="object")continue;let{$data:v}=h.definition,b=o[s];if(v&&b)o[s]=D4(b)}}return e}_removeAllSchemas(e,t){for(let r in e){let i=e[r];if(!t||t.test(r)){if(typeof i=="string")delete e[r];else if(i&&!i.meta)this._cache.delete(i.schema),delete e[r]}}}_addSchema(e,t,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let h=this._cache.get(e);if(h!==void 0)return h;r=(0,yc.normalizeId)(o||r);let v=yc.getSchemaRefs.call(this,e,r);if(h=new gc.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:v}),this._cache.set(h.schema,h),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=h}if(i)this.validateSchema(e,!0);return h}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else gc.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{gc.compileSchema.call(this,e)}finally{this.opts=t}}}Up.ValidationError=PL.default;Up.MissingRefError=C4.default;Ii.default=Up;function A4(e,t,r,i="error"){for(let n in e){let o=n;if(o in t)this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function R4(e){return e=(0,yc.normalizeId)(e),this.schemas[e]||this.refs[e]}function UL(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function LL(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function FL(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function qL(){let e={...this.opts};for(let t of OL)delete e[t];return e}var BL={log(){},warn(){},error(){}};function HL(e){if(e===!1)return BL;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var ZL=/^[a-z_$][a-z0-9_$:-]*$/i;function KL(e,t){let{RULES:r}=this;if((0,n_.eachItem)(e,(i)=>{if(r.keywords[i])throw Error(`Keyword ${i} is already defined`);if(!ZL.test(i))throw Error(`Keyword ${i} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function r_(e,t,r){var i;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:v})=>v===r);if(!s)s={type:r,rules:[]},o.rules.push(s);if(o.keywords[e]=!0,!t)return;let h={keyword:e,definition:{...t,type:(0,jp.getJSONTypes)(t.type),schemaType:(0,jp.getJSONTypes)(t.schemaType)}};if(t.before)VL.call(this,s,h,t.before);else s.rules.push(h);o.all[e]=h,(i=t.implements)===null||i===void 0||i.forEach((v)=>this.addKeyword(v))}function VL(e,t,r){let i=e.rules.findIndex((n)=>n.keyword===r);if(i>=0)e.rules.splice(i,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function WL(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=D4(t);e.validateSchema=this.compile(t,!0)}var GL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D4(e){return{anyOf:[e,GL]}}});var j4=Xe(function(z4){Object.defineProperty(z4,"__esModule",{value:!0});var YL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};z4.default=YL});var H4=Xe(function(q4){Object.defineProperty(q4,"__esModule",{value:!0});q4.callRef=q4.getValidate=void 0;var eF=hc(),U4=Rn(),un=gt(),ca=Mi(),L4=Op(),Lp=Mt(),tF={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:h,self:v}=i,{root:b}=o;if((r==="#"||r==="#/")&&n===b.baseId)return g();let _=L4.resolveRef.call(v,b,n,r);if(_===void 0)throw new eF.default(i.opts.uriResolver,n,r);if(_ instanceof L4.SchemaEnv)return S(_);return x(_);function g(){if(o===b)return Fp(e,s,o,o.$async);let M=t.scopeValue("root",{ref:b});return Fp(e,un._`${M}.validate`,b,b.$async)}function S(M){let I=F4(e,M);Fp(e,I,M,M.$async)}function x(M){let I=t.scopeValue("schema",h.code.source===!0?{ref:M,code:(0,un.stringify)(M)}:{ref:M}),$=t.name("valid"),T=e.subschema({schema:M,dataTypes:[],schemaPath:un.nil,topSchemaRef:I,errSchemaPath:r},$);e.mergeEvaluated(T),e.ok($)}}};function F4(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):un._`${r.scopeValue("wrapper",{ref:t})}.validate`}q4.getValidate=F4;function Fp(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:h,opts:v}=o,b=v.passContext?ca.default.this:un.nil;if(i)_();else g();function _(){if(!h.$async)throw Error("async schema referenced by sync schema");let M=n.let("valid");n.try(()=>{if(n.code(un._`await ${(0,U4.callValidateCode)(e,t,b)}`),x(t),!s)n.assign(M,!0)},(I)=>{if(n.if(un._`!(${I} instanceof ${o.ValidationError})`,()=>n.throw(I)),S(I),!s)n.assign(M,!1)}),e.ok(M)}function g(){e.result((0,U4.callValidateCode)(e,t,b),()=>x(t),()=>S(t))}function S(M){let I=un._`${M}.errors`;n.assign(ca.default.vErrors,un._`${ca.default.vErrors} === null ? ${I} : ${ca.default.vErrors}.concat(${I})`),n.assign(ca.default.errors,un._`${ca.default.vErrors}.length`)}function x(M){var I;if(!o.opts.unevaluated)return;let $=(I=r===null||r===void 0?void 0:r.validate)===null||I===void 0?void 0:I.evaluated;if(o.props!==!0)if($&&!$.dynamicProps){if($.props!==void 0)o.props=Lp.mergeEvaluated.props(n,$.props,o.props)}else{let T=n.var("props",un._`${M}.evaluated.props`);o.props=Lp.mergeEvaluated.props(n,T,o.props,un.Name)}if(o.items!==!0)if($&&!$.dynamicItems){if($.items!==void 0)o.items=Lp.mergeEvaluated.items(n,$.items,o.items)}else{let T=n.var("items",un._`${M}.evaluated.items`);o.items=Lp.mergeEvaluated.items(n,T,o.items,un.Name)}}}q4.callRef=Fp;q4.default=tF});var K4=Xe(function(Z4){Object.defineProperty(Z4,"__esModule",{value:!0});var iF=j4(),oF=H4(),sF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",iF.default,oF.default];Z4.default=sF});var W4=Xe(function(V4){Object.defineProperty(V4,"__esModule",{value:!0});var qp=gt(),ao=qp.operators,Bp={maximum:{okStr:"<=",ok:ao.LTE,fail:ao.GT},minimum:{okStr:">=",ok:ao.GTE,fail:ao.LT},exclusiveMaximum:{okStr:"<",ok:ao.LT,fail:ao.GTE},exclusiveMinimum:{okStr:">",ok:ao.GT,fail:ao.LTE}},uF={message:({keyword:e,schemaCode:t})=>qp.str`must be ${Bp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>qp._`{comparison: ${Bp[e].okStr}, limit: ${t}}`},lF={keyword:Object.keys(Bp),type:"number",schemaType:"number",$data:!0,error:uF,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data(qp._`${r} ${Bp[t].fail} ${i} || isNaN(${r})`)}};V4.default=lF});var J4=Xe(function(G4){Object.defineProperty(G4,"__esModule",{value:!0});var vc=gt(),dF={message:({schemaCode:e})=>vc.str`must be multiple of ${e}`,params:({schemaCode:e})=>vc._`{multipleOf: ${e}}`},fF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:dF,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),h=o?vc._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:vc._`${s} !== parseInt(${s})`;e.fail$data(vc._`(${i} === 0 || (${s} = ${r}/${i}, ${h}))`)}};G4.default=fF});var Q4=Xe(function(Y4){Object.defineProperty(Y4,"__esModule",{value:!0});function X4(e){let t=e.length,r=0,i=0,n;while(i<t)if(r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t){if(n=e.charCodeAt(i),(n&64512)===56320)i++}return r}Y4.default=X4;X4.code='require("ajv/dist/runtime/ucs2length").default'});var t3=Xe(function(e3){Object.defineProperty(e3,"__esModule",{value:!0});var Jo=gt(),mF=Mt(),gF=Q4(),yF={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Jo.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Jo._`{limit: ${e}}`},vF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:yF,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Jo.operators.GT:Jo.operators.LT,s=n.opts.unicode===!1?Jo._`${r}.length`:Jo._`${(0,mF.useFunc)(e.gen,gF.default)}(${r})`;e.fail$data(Jo._`${s} ${o} ${i}`)}};e3.default=vF});var n3=Xe(function(r3){Object.defineProperty(r3,"__esModule",{value:!0});var _F=Rn(),wF=Mt(),da=gt(),SF={message:({schemaCode:e})=>da.str`must match pattern "${e}"`,params:({schemaCode:e})=>da._`{pattern: ${e}}`},xF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:SF,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,h=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:v}=s.opts.code,b=v.code==="new RegExp"?da._`new RegExp`:(0,wF.useFunc)(t,v),_=t.let("valid");t.try(()=>t.assign(_,da._`${b}(${o}, ${h}).test(${r})`),()=>t.assign(_,!1)),e.fail$data(da._`!${_}`)}else{let v=(0,_F.usePattern)(e,n);e.fail$data(da._`!${v}.test(${r})`)}}};r3.default=xF});var o3=Xe(function(i3){Object.defineProperty(i3,"__esModule",{value:!0});var bc=gt(),MF={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return bc.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>bc._`{limit: ${e}}`},EF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?bc.operators.GT:bc.operators.LT;e.fail$data(bc._`Object.keys(${r}).length ${n} ${i}`)}};i3.default=EF});var a3=Xe(function(s3){Object.defineProperty(s3,"__esModule",{value:!0});var _c=Rn(),wc=gt(),$F=Mt(),TF={message:({params:{missingProperty:e}})=>wc.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>wc._`{missingProperty: ${e}}`},PF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:TF,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:h}=s;if(!o&&r.length===0)return;let v=r.length>=h.loopRequired;if(s.allErrors)b();else _();if(h.strictRequired){let x=e.parentSchema.properties,{definedProperties:M}=e.it;for(let I of r)if((x===null||x===void 0?void 0:x[I])===void 0&&!M.has(I)){let $=s.schemaEnv.baseId+s.errSchemaPath,T=`required property "${I}" is not defined at "${$}" (strictRequired)`;(0,$F.checkStrictMode)(s,T,s.opts.strictRequired)}}function b(){if(v||o)e.block$data(wc.nil,g);else for(let x of r)(0,_c.checkReportMissingProp)(e,x)}function _(){let x=t.let("missing");if(v||o){let M=t.let("valid",!0);e.block$data(M,()=>S(x,M)),e.ok(M)}else t.if((0,_c.checkMissingProp)(e,r,x)),(0,_c.reportMissingProp)(e,x),t.else()}function g(){t.forOf("prop",i,(x)=>{e.setParams({missingProperty:x}),t.if((0,_c.noPropertyInData)(t,n,x,h.ownProperties),()=>e.error())})}function S(x,M){e.setParams({missingProperty:x}),t.forOf(x,i,()=>{t.assign(M,(0,_c.propertyInData)(t,n,x,h.ownProperties)),t.if((0,wc.not)(M),()=>{e.error(),t.break()})},wc.nil)}}};s3.default=PF});var l3=Xe(function(u3){Object.defineProperty(u3,"__esModule",{value:!0});var Sc=gt(),RF={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return Sc.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Sc._`{limit: ${e}}`},CF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:RF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?Sc.operators.GT:Sc.operators.LT;e.fail$data(Sc._`${r}.length ${n} ${i}`)}};u3.default=CF});var Hp=Xe(function(d3){Object.defineProperty(d3,"__esModule",{value:!0});var c3=Fb();c3.code='require("ajv/dist/runtime/equal").default';d3.default=c3});var h3=Xe(function(f3){Object.defineProperty(f3,"__esModule",{value:!0});var i_=uc(),Nr=gt(),NF=Mt(),zF=Hp(),jF={message:({params:{i:e,j:t}})=>Nr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Nr._`{i: ${e}, j: ${t}}`},UF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:jF,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:h}=e;if(!i&&!n)return;let v=t.let("valid"),b=o.items?(0,i_.getSchemaTypes)(o.items):[];e.block$data(v,_,Nr._`${s} === false`),e.ok(v);function _(){let M=t.let("i",Nr._`${r}.length`),I=t.let("j");e.setParams({i:M,j:I}),t.assign(v,!0),t.if(Nr._`${M} > 1`,()=>(g()?S:x)(M,I))}function g(){return b.length>0&&!b.some((M)=>M==="object"||M==="array")}function S(M,I){let $=t.name("item"),T=(0,i_.checkDataTypes)(b,$,h.opts.strictNumbers,i_.DataType.Wrong),P=t.const("indices",Nr._`{}`);t.for(Nr._`;${M}--;`,()=>{if(t.let($,Nr._`${r}[${M}]`),t.if(T,Nr._`continue`),b.length>1)t.if(Nr._`typeof ${$} == "string"`,Nr._`${$} += "_"`);t.if(Nr._`typeof ${P}[${$}] == "number"`,()=>{t.assign(I,Nr._`${P}[${$}]`),e.error(),t.assign(v,!1).break()}).code(Nr._`${P}[${$}] = ${M}`)})}function x(M,I){let $=(0,NF.useFunc)(t,zF.default),T=t.name("outer");t.label(T).for(Nr._`;${M}--;`,()=>t.for(Nr._`${I} = ${M}; ${I}--;`,()=>t.if(Nr._`${$}(${r}[${M}], ${r}[${I}])`,()=>{e.error(),t.assign(v,!1).break(T)})))}}};f3.default=UF});var m3=Xe(function(p3){Object.defineProperty(p3,"__esModule",{value:!0});var o_=gt(),FF=Mt(),qF=Hp(),BF={message:"must be equal to constant",params:({schemaCode:e})=>o_._`{allowedValue: ${e}}`},HF={keyword:"const",$data:!0,error:BF,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;if(i||o&&typeof o=="object")e.fail$data(o_._`!${(0,FF.useFunc)(t,qF.default)}(${r}, ${n})`);else e.fail(o_._`${o} !== ${r}`)}};p3.default=HF});var y3=Xe(function(g3){Object.defineProperty(g3,"__esModule",{value:!0});var xc=gt(),KF=Mt(),VF=Hp(),WF={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>xc._`{allowedValues: ${e}}`},GF={keyword:"enum",schemaType:"array",$data:!0,error:WF,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw Error("enum must have non-empty array");let h=n.length>=s.opts.loopEnum,v,b=()=>v!==null&&v!==void 0?v:v=(0,KF.useFunc)(t,VF.default),_;if(h||i)_=t.let("valid"),e.block$data(_,g);else{if(!Array.isArray(n))throw Error("ajv implementation error");let x=t.const("vSchema",o);_=(0,xc.or)(...n.map((M,I)=>S(x,I)))}e.pass(_);function g(){t.assign(_,!1),t.forOf("v",o,(x)=>t.if(xc._`${b()}(${r}, ${x})`,()=>t.assign(_,!0).break()))}function S(x,M){let I=n[M];return typeof I==="object"&&I!==null?xc._`${b()}(${r}, ${x}[${M}])`:xc._`${r} === ${I}`}}};g3.default=GF});var b3=Xe(function(v3){Object.defineProperty(v3,"__esModule",{value:!0});var XF=W4(),YF=J4(),QF=t3(),eq=n3(),tq=o3(),rq=a3(),nq=l3(),iq=h3(),oq=m3(),sq=y3(),aq=[XF.default,YF.default,QF.default,eq.default,tq.default,rq.default,nq.default,iq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oq.default,sq.default];v3.default=aq});var a_=Xe(function(w3){Object.defineProperty(w3,"__esModule",{value:!0});w3.validateAdditionalItems=void 0;var Xo=gt(),s_=Mt(),lq={message:({params:{len:e}})=>Xo.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Xo._`{limit: ${e}}`},cq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lq,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,s_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}_3(e,i)}};function _3(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let h=r.const("len",Xo._`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass(Xo._`${h} <= ${t.length}`);else if(typeof i=="object"&&!(0,s_.alwaysValidSchema)(s,i)){let b=r.var("valid",Xo._`${h} <= ${t.length}`);r.if((0,Xo.not)(b),()=>v(b)),e.ok(b)}function v(b){r.forRange("i",t.length,h,(_)=>{if(e.subschema({keyword:o,dataProp:_,dataPropType:s_.Type.Num},b),!s.allErrors)r.if((0,Xo.not)(b),()=>r.break())})}}w3.validateAdditionalItems=_3;w3.default=cq});var u_=Xe(function(M3){Object.defineProperty(M3,"__esModule",{value:!0});M3.validateTuple=void 0;var x3=gt(),Zp=Mt(),fq=Rn(),hq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return k3(e,"additionalItems",t);if(r.items=!0,(0,Zp.alwaysValidSchema)(r,t))return;e.ok((0,fq.validateArray)(e))}};function k3(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:h}=e;if(_(n),h.opts.unevaluated&&r.length&&h.items!==!0)h.items=Zp.mergeEvaluated.items(i,r.length,h.items);let v=i.name("valid"),b=i.const("len",x3._`${o}.length`);r.forEach((g,S)=>{if((0,Zp.alwaysValidSchema)(h,g))return;i.if(x3._`${b} > ${S}`,()=>e.subschema({keyword:s,schemaProp:S,dataProp:S},v)),e.ok(v)});function _(g){let{opts:S,errSchemaPath:x}=h,M=r.length,I=M===g.minItems&&(M===g.maxItems||g[t]===!1);if(S.strictTuples&&!I){let $=`"${s}" is ${M}-tuple, but minItems or maxItems/${t} are not specified or different at path "${x}"`;(0,Zp.checkStrictMode)(h,$,S.strictTuples)}}}M3.validateTuple=k3;M3.default=hq});var $3=Xe(function(I3){Object.defineProperty(I3,"__esModule",{value:!0});var mq=u_(),gq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,mq.validateTuple)(e,"items")};I3.default=gq});var A3=Xe(function(P3){Object.defineProperty(P3,"__esModule",{value:!0});var T3=gt(),vq=Mt(),bq=Rn(),_q=a_(),wq={message:({params:{len:e}})=>T3.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>T3._`{limit: ${e}}`},Sq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:wq,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;if(i.items=!0,(0,vq.alwaysValidSchema)(i,t))return;if(n)(0,_q.validateAdditionalItems)(e,n);else e.ok((0,bq.validateArray)(e))}};P3.default=Sq});var C3=Xe(function(R3){Object.defineProperty(R3,"__esModule",{value:!0});var Cn=gt(),Kp=Mt(),kq={message:({params:{min:e,max:t}})=>t===void 0?Cn.str`must contain at least ${e} valid item(s)`:Cn.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Cn._`{minContains: ${e}}`:Cn._`{minContains: ${e}, maxContains: ${t}}`},Mq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:kq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,h,{minContains:v,maxContains:b}=i;if(o.opts.next)s=v===void 0?1:v,h=b;else s=1;let _=t.const("len",Cn._`${n}.length`);if(e.setParams({min:s,max:h}),h===void 0&&s===0){(0,Kp.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&s>h){(0,Kp.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Kp.alwaysValidSchema)(o,r)){let I=Cn._`${_} >= ${s}`;if(h!==void 0)I=Cn._`${I} && ${_} <= ${h}`;e.pass(I);return}o.items=!0;let g=t.name("valid");if(h===void 0&&s===1)x(g,()=>t.if(g,()=>t.break()));else if(s===0){if(t.let(g,!0),h!==void 0)t.if(Cn._`${n}.length > 0`,S)}else t.let(g,!1),S();e.result(g,()=>e.reset());function S(){let I=t.name("_valid"),$=t.let("count",0);x(I,()=>t.if(I,()=>M($)))}function x(I,$){t.forRange("i",0,_,(T)=>{e.subschema({keyword:"contains",dataProp:T,dataPropType:Kp.Type.Num,compositeRule:!0},I),$()})}function M(I){if(t.code(Cn._`${I}++`),h===void 0)t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0).break());else if(t.if(Cn._`${I} > ${h}`,()=>t.assign(g,!1).break()),s===1)t.assign(g,!0);else t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0))}}};R3.default=Mq});var U3=Xe(function(N3){Object.defineProperty(N3,"__esModule",{value:!0});N3.validateSchemaDeps=N3.validatePropertyDeps=N3.error=void 0;var l_=gt(),Iq=Mt(),kc=Rn();N3.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return l_.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>l_._`{property: ${e},
|
|
24
24
|
missingProperty: ${i},
|
|
25
25
|
depsCount: ${t},
|
|
26
|
-
deps: ${r}}`};var $q={keyword:"dependencies",type:"object",schemaType:"object",error:N3.error,code(e){let[t,r]=Tq(e);O3(e,t),D3(e,r)}};function Tq({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function O3(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let h=t[s];if(h.length===0)continue;let v=(0,kc.propertyInData)(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:h.length,deps:h.join(", ")}),n.allErrors)r.if(v,()=>{for(let b of h)(0,kc.checkReportMissingProp)(e,b)});else r.if(l_._`${v} && (${(0,kc.checkMissingProp)(e,h,o)})`),(0,kc.reportMissingProp)(e,o),r.else()}}N3.validatePropertyDeps=O3;function D3(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let h in t){if((0,Iq.alwaysValidSchema)(o,t[h]))continue;r.if((0,kc.propertyInData)(r,i,h,o.opts.ownProperties),()=>{let v=e.subschema({keyword:n,schemaProp:h},s);e.mergeValidEvaluated(v,s)},()=>r.var(s,!0)),e.ok(s)}}N3.validateSchemaDeps=D3;N3.default=$q});var q3=Xe(function(F3){Object.defineProperty(F3,"__esModule",{value:!0});var L3=gt(),Rq=Mt(),Cq={message:"property name must be valid",params:({params:e})=>L3._`{propertyName: ${e.propertyName}}`},Oq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Cq,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,Rq.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,L3.not)(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};F3.default=Oq});var c_=Xe(function(B3){Object.defineProperty(B3,"__esModule",{value:!0});var Vp=Rn(),Kn=gt(),Nq=Mi(),Wp=Mt(),zq={message:"must NOT have additional properties",params:({params:e})=>Kn._`{additionalProperty: ${e.additionalProperty}}`},jq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:zq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:h,opts:v}=s;if(s.props=!0,v.removeAdditional!=="all"&&(0,Wp.alwaysValidSchema)(s,r))return;let b=(0,Vp.allSchemaProperties)(i.properties),_=(0,Vp.allSchemaProperties)(i.patternProperties);g(),e.ok(Kn._`${o} === ${Nq.default.errors}`);function g(){t.forIn("key",n,($)=>{if(!b.length&&!_.length)M($);else t.if(S($),()=>M($))})}function S($){let T;if(b.length>8){let P=(0,Wp.schemaRefOrVal)(s,i.properties,"properties");T=(0,Vp.isOwnProperty)(t,P,$)}else if(b.length)T=(0,Kn.or)(...b.map((P)=>Kn._`${$} === ${P}`));else T=Kn.nil;if(_.length)T=(0,Kn.or)(T,..._.map((P)=>Kn._`${(0,Vp.usePattern)(e,P)}.test(${$})`));return(0,Kn.not)(T)}function x($){t.code(Kn._`delete ${n}[${$}]`)}function M($){if(v.removeAdditional==="all"||v.removeAdditional&&r===!1){x($);return}if(r===!1){if(e.setParams({additionalProperty:$}),e.error(),!h)t.break();return}if(typeof r=="object"&&!(0,Wp.alwaysValidSchema)(s,r)){let T=t.name("valid");if(v.removeAdditional==="failing")I($,T,!1),t.if((0,Kn.not)(T),()=>{e.reset(),x($)});else if(I($,T),!h)t.if((0,Kn.not)(T),()=>t.break())}}function I($,T,P){let R={keyword:"additionalProperties",dataProp:$,dataPropType:Wp.Type.Str};if(P===!1)Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(R,T)}}};B3.default=jq});var V3=Xe(function(K3){Object.defineProperty(K3,"__esModule",{value:!0});var Lq=fc(),H3=Rn(),d_=Mt(),Z3=c_(),Fq={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)Z3.default.code(new Lq.KeywordCxt(o,Z3.default,"additionalProperties"));let s=(0,H3.allSchemaProperties)(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=d_.mergeEvaluated.props(t,(0,d_.toHash)(s),o.props);let h=s.filter((g)=>!(0,d_.alwaysValidSchema)(o,r[g]));if(h.length===0)return;let v=t.name("valid");for(let g of h){if(b(g))_(g);else{if(t.if((0,H3.propertyInData)(t,n,g,o.opts.ownProperties)),_(g),!o.allErrors)t.else().var(v,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(v)}function b(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function _(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},v)}}};K3.default=Fq});var Y3=Xe(function(X3){Object.defineProperty(X3,"__esModule",{value:!0});var W3=Rn(),Gp=gt(),G3=Mt(),J3=Mt(),Bq={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,h=(0,W3.allSchemaProperties)(r),v=h.filter((I)=>(0,G3.alwaysValidSchema)(o,r[I]));if(h.length===0||v.length===h.length&&(!o.opts.unevaluated||o.props===!0))return;let b=s.strictSchema&&!s.allowMatchingProperties&&n.properties,_=t.name("valid");if(o.props!==!0&&!(o.props instanceof Gp.Name))o.props=(0,J3.evaluatedPropsToName)(t,o.props);let{props:g}=o;S();function S(){for(let I of h){if(b)x(I);if(o.allErrors)M(I);else t.var(_,!0),M(I),t.if(_)}}function x(I){for(let $ in b)if(new RegExp(I).test($))(0,G3.checkStrictMode)(o,`property ${$} matches pattern ${I} (use allowMatchingProperties)`)}function M(I){t.forIn("key",i,($)=>{t.if(Gp._`${(0,W3.usePattern)(e,I)}.test(${$})`,()=>{let T=v.includes(I);if(!T)e.subschema({keyword:"patternProperties",schemaProp:I,dataProp:$,dataPropType:J3.Type.Str},_);if(o.opts.unevaluated&&g!==!0)t.assign(Gp._`${g}[${$}]`,!0);else if(!T&&!o.allErrors)t.if((0,Gp.not)(_),()=>t.break())})})}}};X3.default=Bq});var e8=Xe(function(Q3){Object.defineProperty(Q3,"__esModule",{value:!0});var Zq=Mt(),Kq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Zq.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Q3.default=Kq});var r8=Xe(function(t8){Object.defineProperty(t8,"__esModule",{value:!0});var Wq=Rn(),Gq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Wq.validateUnion,error:{message:"must match a schema in anyOf"}};t8.default=Gq});var i8=Xe(function(n8){Object.defineProperty(n8,"__esModule",{value:!0});var Jp=gt(),Xq=Mt(),Yq={message:"must match exactly one schema in oneOf",params:({params:e})=>Jp._`{passingSchemas: ${e.passing}}`},Qq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Yq,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),h=t.let("passing",null),v=t.name("_valid");e.setParams({passing:h}),t.block(b),e.result(s,()=>e.reset(),()=>e.error(!0));function b(){o.forEach((_,g)=>{let S;if((0,Xq.alwaysValidSchema)(n,_))t.var(v,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},v);if(g>0)t.if(Jp._`${v} && ${s}`).assign(s,!1).assign(h,Jp._`[${h}, ${g}]`).else();t.if(v,()=>{if(t.assign(s,!0),t.assign(h,g),S)e.mergeEvaluated(S,Jp.Name)})})}}};n8.default=Qq});var s8=Xe(function(o8){Object.defineProperty(o8,"__esModule",{value:!0});var tB=Mt(),rB={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,tB.alwaysValidSchema)(i,o))return;let h=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(h)})}};o8.default=rB});var c8=Xe(function(l8){Object.defineProperty(l8,"__esModule",{value:!0});var Xp=gt(),u8=Mt(),iB={message:({params:e})=>Xp.str`must match "${e.ifClause}" schema`,params:({params:e})=>Xp._`{failingKeyword: ${e.ifClause}}`},oB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:iB,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)(0,u8.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=a8(i,"then"),o=a8(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),h=t.name("_valid");if(v(),e.reset(),n&&o){let _=t.let("ifClause");e.setParams({ifClause:_}),t.if(h,b("then",_),b("else",_))}else if(n)t.if(h,b("then"));else t.if((0,Xp.not)(h),b("else"));e.pass(s,()=>e.error(!0));function v(){let _=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(_)}function b(_,g){return()=>{let S=e.subschema({keyword:_},h);if(t.assign(s,h),e.mergeValidEvaluated(S,s),g)t.assign(g,Xp._`${_}`);else e.setParams({ifClause:_})}}}};function a8(e,t){let r=e.schema[t];return r!==void 0&&!(0,u8.alwaysValidSchema)(e,r)}l8.default=oB});var f8=Xe(function(d8){Object.defineProperty(d8,"__esModule",{value:!0});var aB=Mt(),uB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,aB.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};d8.default=uB});var p8=Xe(function(h8){Object.defineProperty(h8,"__esModule",{value:!0});var cB=a_(),dB=$3(),fB=u_(),hB=A3(),pB=C3(),mB=U3(),gB=q3(),yB=c_(),vB=V3(),bB=Y3(),_B=e8(),wB=r8(),SB=i8(),xB=s8(),kB=c8(),MB=f8();function EB(e=!1){let t=[_B.default,wB.default,SB.default,xB.default,kB.default,MB.default,gB.default,yB.default,mB.default,vB.default,bB.default];if(e)t.push(dB.default,hB.default);else t.push(cB.default,fB.default);return t.push(pB.default),t}h8.default=EB});var g8=Xe(function(m8){Object.defineProperty(m8,"__esModule",{value:!0});var ir=gt(),$B={message:({schemaCode:e})=>ir.str`must match format "${e}"`,params:({schemaCode:e})=>ir._`{format: ${e}}`},TB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:$B,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:h}=e,{opts:v,errSchemaPath:b,schemaEnv:_,self:g}=h;if(!v.validateFormats)return;if(n)S();else x();function S(){let M=r.scopeValue("formats",{ref:g.formats,code:v.code.formats}),I=r.const("fDef",ir._`${M}[${s}]`),$=r.let("fType"),T=r.let("format");r.if(ir._`typeof ${I} == "object" && !(${I} instanceof RegExp)`,()=>r.assign($,ir._`${I}.type || "string"`).assign(T,ir._`${I}.validate`),()=>r.assign($,ir._`"string"`).assign(T,I)),e.fail$data((0,ir.or)(P(),R()));function P(){if(v.strictSchema===!1)return ir.nil;return ir._`${s} && !${T}`}function R(){let C=_.$async?ir._`(${I}.async ? await ${T}(${i}) : ${T}(${i}))`:ir._`${T}(${i})`,N=ir._`(typeof ${T} == "function" ? ${C} : ${T}.test(${i}))`;return ir._`${T} && ${T} !== true && ${$} === ${t} && !${N}`}}function x(){let M=g.formats[o];if(!M){P();return}if(M===!0)return;let[I,$,T]=R(M);if(I===t)e.pass(C());function P(){if(v.strictSchema===!1){g.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${b}"`}}function R(N){let B=N instanceof RegExp?(0,ir.regexpCode)(N):v.code.formats?ir._`${v.code.formats}${(0,ir.getProperty)(o)}`:void 0,ie=r.scopeValue("formats",{key:o,ref:N,code:B});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,ir._`${ie}.validate`];return["string",N,ie]}function C(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!_.$async)throw Error("async format in sync schema");return ir._`await ${T}(${i})`}return typeof $=="function"?ir._`${T}(${i})`:ir._`${T}.test(${i})`}}}};m8.default=TB});var v8=Xe(function(y8){Object.defineProperty(y8,"__esModule",{value:!0});var AB=g8(),RB=[AB.default];y8.default=RB});var w8=Xe(function(b8){Object.defineProperty(b8,"__esModule",{value:!0});b8.contentVocabulary=b8.metadataVocabulary=void 0;b8.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];b8.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var k8=Xe(function(x8){Object.defineProperty(x8,"__esModule",{value:!0});var DB=K4(),NB=b3(),zB=p8(),jB=v8(),S8=w8(),UB=[DB.default,NB.default,(0,zB.default)(),jB.default,S8.metadataVocabulary,S8.contentVocabulary];x8.default=UB});var $8=Xe(function(E8){Object.defineProperty(E8,"__esModule",{value:!0});E8.DiscrError=void 0;var M8;(function(e){e.Tag="tag",e.Mapping="mapping"})(M8||(E8.DiscrError=M8={}))});var A8=Xe(function(P8){Object.defineProperty(P8,"__esModule",{value:!0});var fa=gt(),f_=$8(),T8=Op(),FB=hc(),qB=Mt(),BB={message:({params:{discrError:e,tagName:t}})=>e===f_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>fa._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},HB={keyword:"discriminator",type:"object",schemaType:"object",error:BB,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=i.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let v=t.let("valid",!1),b=t.const("tag",fa._`${r}${(0,fa.getProperty)(h)}`);t.if(fa._`typeof ${b} == "string"`,()=>_(),()=>e.error(!1,{discrError:f_.DiscrError.Tag,tag:b,tagName:h})),e.ok(v);function _(){let x=S();t.if(!1);for(let M in x)t.elseIf(fa._`${b} === ${M}`),t.assign(v,g(x[M]));t.else(),e.error(!1,{discrError:f_.DiscrError.Mapping,tag:b,tagName:h}),t.endIf()}function g(x){let M=t.name("valid"),I=e.subschema({keyword:"oneOf",schemaProp:x},M);return e.mergeEvaluated(I,fa.Name),M}function S(){var x;let M={},I=T(n),$=!0;for(let C=0;C<s.length;C++){let N=s[C];if((N===null||N===void 0?void 0:N.$ref)&&!(0,qB.schemaHasRulesButRef)(N,o.self.RULES)){let ie=N.$ref;if(N=T8.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ie),N instanceof T8.SchemaEnv)N=N.schema;if(N===void 0)throw new FB.default(o.opts.uriResolver,o.baseId,ie)}let B=(x=N===null||N===void 0?void 0:N.properties)===null||x===void 0?void 0:x[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);$=$&&(I||T(N)),P(B,C)}if(!$)throw Error(`discriminator: "${h}" must be required`);return M;function T({required:C}){return Array.isArray(C)&&C.includes(h)}function P(C,N){if(C.const)R(C.const,N);else if(C.enum)for(let B of C.enum)R(B,N);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function R(C,N){if(typeof C!="string"||C in M)throw Error(`discriminator: "${h}" values must be unique strings`);M[C]=N}}}};P8.default=HB});var R8=Xe(function(b_e,KB){KB.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var p_=Xe(function(ln,h_){Object.defineProperty(ln,"__esModule",{value:!0});ln.MissingRefError=ln.ValidationError=ln.CodeGen=ln.Name=ln.nil=ln.stringify=ln.str=ln._=ln.KeywordCxt=ln.Ajv=void 0;var VB=N4(),WB=k8(),GB=A8(),C8=R8(),JB=["/properties"],Yp="http://json-schema.org/draft-07/schema";class Mc extends VB.default{_addVocabularies(){if(super._addVocabularies(),WB.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(GB.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(C8,JB):C8;this.addMetaSchema(e,Yp,!1),this.refs["http://json-schema.org/schema"]=Yp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Yp)?Yp:void 0)}}ln.Ajv=Mc;h_.exports=ln=Mc;h_.exports.Ajv=Mc;Object.defineProperty(ln,"__esModule",{value:!0});ln.default=Mc;var XB=fc();Object.defineProperty(ln,"KeywordCxt",{enumerable:!0,get:function(){return XB.KeywordCxt}});var ha=gt();Object.defineProperty(ln,"_",{enumerable:!0,get:function(){return ha._}});Object.defineProperty(ln,"str",{enumerable:!0,get:function(){return ha.str}});Object.defineProperty(ln,"stringify",{enumerable:!0,get:function(){return ha.stringify}});Object.defineProperty(ln,"nil",{enumerable:!0,get:function(){return ha.nil}});Object.defineProperty(ln,"Name",{enumerable:!0,get:function(){return ha.Name}});Object.defineProperty(ln,"CodeGen",{enumerable:!0,get:function(){return ha.CodeGen}});var YB=Rp();Object.defineProperty(ln,"ValidationError",{enumerable:!0,get:function(){return YB.default}});var QB=hc();Object.defineProperty(ln,"MissingRefError",{enumerable:!0,get:function(){return QB.default}})});var B8=Xe(function(F8){Object.defineProperty(F8,"__esModule",{value:!0});F8.formatNames=F8.fastFormats=F8.fullFormats=void 0;function ri(e,t){return{validate:e,compare:t}}F8.fullFormats={date:ri(z8,v_),time:ri(g_(!0),b_),"date-time":ri(O8(!0),U8),"iso-time":ri(g_(),j8),"iso-date-time":ri(O8(),L8),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:aH,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:pH,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:uH,int32:{type:"number",validate:dH},int64:{type:"number",validate:fH},float:{type:"number",validate:N8},double:{type:"number",validate:N8},password:!0,binary:!0};F8.fastFormats={...F8.fullFormats,date:ri(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,v_),time:ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,b_),"date-time":ri(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,U8),"iso-time":ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,j8),"iso-date-time":ri(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,L8),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};F8.formatNames=Object.keys(F8.fullFormats);function rH(e){return e%4===0&&(e%100!==0||e%400===0)}var nH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,iH=[0,31,28,31,30,31,30,31,31,30,31,30,31];function z8(e){let t=nH.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&rH(r)?29:iH[i])}function v_(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var m_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function g_(e){return function(r){let i=m_.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],h=i[4],v=i[5]==="-"?-1:1,b=+(i[6]||0),_=+(i[7]||0);if(b>23||_>59||e&&!h)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-_*v,S=n-b*v-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function b_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function j8(e,t){if(!(e&&t))return;let r=m_.exec(e),i=m_.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var y_=/t|\s/i;function O8(e){let t=g_(e);return function(i){let n=i.split(y_);return n.length===2&&z8(n[0])&&t(n[1])}}function U8(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function L8(e,t){if(!(e&&t))return;let[r,i]=e.split(y_),[n,o]=t.split(y_),s=v_(r,n);if(s===void 0)return;return s||b_(i,o)}var oH=/\/|:/,sH=/^(?:[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 aH(e){return oH.test(e)&&sH.test(e)}var D8=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function uH(e){return D8.lastIndex=0,D8.test(e)}var lH=-2147483648,cH=2147483647;function dH(e){return Number.isInteger(e)&&e<=cH&&e>=lH}function fH(e){return Number.isInteger(e)}function N8(){return!0}var hH=/[^\\]\\Z/;function pH(e){if(hH.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Z8=Xe(function(H8){Object.defineProperty(H8,"__esModule",{value:!0});H8.formatLimitDefinition=void 0;var gH=p_(),Vn=gt(),uo=Vn.operators,Qp={formatMaximum:{okStr:"<=",ok:uo.LTE,fail:uo.GT},formatMinimum:{okStr:">=",ok:uo.GTE,fail:uo.LT},formatExclusiveMaximum:{okStr:"<",ok:uo.LT,fail:uo.GTE},formatExclusiveMinimum:{okStr:">",ok:uo.GT,fail:uo.LTE}},yH={message:({keyword:e,schemaCode:t})=>Vn.str`should be ${Qp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Vn._`{comparison: ${Qp[e].okStr}, limit: ${t}}`};H8.formatLimitDefinition={keyword:Object.keys(Qp),type:"string",schemaType:"string",$data:!0,error:yH,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:h}=o;if(!s.validateFormats)return;let v=new gH.KeywordCxt(o,h.RULES.all.format.definition,"format");if(v.$data)b();else _();function b(){let S=t.scopeValue("formats",{ref:h.formats,code:s.code.formats}),x=t.const("fmt",Vn._`${S}[${v.schemaCode}]`);e.fail$data((0,Vn.or)(Vn._`typeof ${x} != "object"`,Vn._`${x} instanceof RegExp`,Vn._`typeof ${x}.compare != "function"`,g(x)))}function _(){let S=v.schema,x=h.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let M=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Vn._`${s.code.formats}${(0,Vn.getProperty)(S)}`:void 0});e.fail$data(g(M))}function g(S){return Vn._`${S}.compare(${r}, ${i}) ${Qp[n].fail} 0`}},dependencies:["format"]};var vH=(e)=>(e.addKeyword(H8.formatLimitDefinition),e);H8.default=vH});var G8=Xe(function(Ec,W8){Object.defineProperty(Ec,"__esModule",{value:!0});var pa=B8(),_H=Z8(),S_=gt(),K8=new S_.Name("fullFormats"),wH=new S_.Name("fastFormats"),x_=(e,t={keywords:!0})=>{if(Array.isArray(t))return V8(e,t,pa.fullFormats,K8),e;let[r,i]=t.mode==="fast"?[pa.fastFormats,wH]:[pa.fullFormats,K8],n=t.formats||pa.formatNames;if(V8(e,n,r,i),t.keywords)(0,_H.default)(e);return e};x_.get=(e,t="full")=>{let i=(t==="fast"?pa.fastFormats:pa.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function V8(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=S_._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}W8.exports=Ec=x_;Object.defineProperty(Ec,"__esModule",{value:!0});Ec.default=x_});var OH=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,DH=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;class On extends Error{}function z_(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((h,v,b)=>{h?.removeEventListener("abort",v),b()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}var{writeFileSync:Rpe}=(()=>({}));function yE(){this.__data__=[],this.size=0}var j_=yE;function vE(e,t){return e===t||e!==e&&t!==t}var U_=vE;function bE(e,t){var r=e.length;while(r--)if(U_(e[r][0],t))return r;return-1}var Ti=bE;var _E=Array.prototype,wE=_E.splice;function SE(e){var t=this.__data__,r=Ti(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else wE.call(t,r,1);return--this.size,!0}var L_=SE;function xE(e){var t=this.__data__,r=Ti(t,e);return r<0?void 0:t[r][1]}var F_=xE;function kE(e){return Ti(this.__data__,e)>-1}var q_=kE;function ME(e,t){var r=this.__data__,i=Ti(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var B_=ME;function Yo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Yo.prototype.clear=j_;Yo.prototype.delete=L_;Yo.prototype.get=F_;Yo.prototype.has=q_;Yo.prototype.set=B_;var H_=Yo;var EE=typeof global=="object"&&global&&global.Object===Object&&global,Z_=EE;var IE=typeof self=="object"&&self&&self.Object===Object&&self,$E=Z_||IE||Function("return this")(),Qo=$E;var TE=Qo.Symbol,es=TE;var K_=Object.prototype,PE=K_.hasOwnProperty,AE=K_.toString,ya=es?es.toStringTag:void 0;function RE(e){var t=PE.call(e,ya),r=e[ya];try{e[ya]=void 0;var i=!0}catch(o){}var n=AE.call(e);if(i)if(t)e[ya]=r;else delete e[ya];return n}var V_=RE;var CE=Object.prototype,OE=CE.toString;function DE(e){return OE.call(e)}var W_=DE;var NE="[object Null]",zE="[object Undefined]",G_=es?es.toStringTag:void 0;function jE(e){if(e==null)return e===void 0?zE:NE;return G_&&G_ in Object(e)?V_(e):W_(e)}var J_=jE;function UE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var $c=UE;var LE="[object AsyncFunction]",FE="[object Function]",qE="[object GeneratorFunction]",BE="[object Proxy]";function HE(e){if(!$c(e))return!1;var t=J_(e);return t==FE||t==qE||t==LE||t==BE}var X_=HE;var ZE=Qo["__core-js_shared__"],Tc=ZE;var Y_=function(){var e=/[^.]+$/.exec(Tc&&Tc.keys&&Tc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function KE(e){return!!Y_&&Y_ in e}var Q_=KE;var VE=Function.prototype,WE=VE.toString;function GE(e){if(e!=null){try{return WE.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var e1=GE;var JE=/[\\^$.*+?()[\]{}|]/g,XE=/^\[object .+?Constructor\]$/,YE=Function.prototype,QE=Object.prototype,eI=YE.toString,tI=QE.hasOwnProperty,rI=RegExp("^"+eI.call(tI).replace(JE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nI(e){if(!$c(e)||Q_(e))return!1;var t=X_(e)?rI:XE;return t.test(e1(e))}var t1=nI;function iI(e,t){return e==null?void 0:e[t]}var r1=iI;function oI(e,t){var r=r1(e,t);return t1(r)?r:void 0}var Pc=oI;var sI=Pc(Qo,"Map"),n1=sI;var aI=Pc(Object,"create"),ni=aI;function uI(){this.__data__=ni?ni(null):{},this.size=0}var i1=uI;function lI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var o1=lI;var cI="__lodash_hash_undefined__",dI=Object.prototype,fI=dI.hasOwnProperty;function hI(e){var t=this.__data__;if(ni){var r=t[e];return r===cI?void 0:r}return fI.call(t,e)?t[e]:void 0}var s1=hI;var pI=Object.prototype,mI=pI.hasOwnProperty;function gI(e){var t=this.__data__;return ni?t[e]!==void 0:mI.call(t,e)}var a1=gI;var yI="__lodash_hash_undefined__";function vI(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ni&&t===void 0?yI:t,this}var u1=vI;function ts(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}ts.prototype.clear=i1;ts.prototype.delete=o1;ts.prototype.get=s1;ts.prototype.has=a1;ts.prototype.set=u1;var nm=ts;function bI(){this.size=0,this.__data__={hash:new nm,map:new(n1||H_),string:new nm}}var l1=bI;function _I(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var c1=_I;function wI(e,t){var r=e.__data__;return c1(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Pi=wI;function SI(e){var t=Pi(this,e).delete(e);return this.size-=t?1:0,t}var d1=SI;function xI(e){return Pi(this,e).get(e)}var f1=xI;function kI(e){return Pi(this,e).has(e)}var h1=kI;function MI(e,t){var r=Pi(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var p1=MI;function rs(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}rs.prototype.clear=l1;rs.prototype.delete=d1;rs.prototype.get=f1;rs.prototype.has=h1;rs.prototype.set=p1;var im=rs;var{realpathSync:Qw}=(()=>({}));var EI="Expected a function";function om(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(EI);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(om.Cache||im),r}om.Cache=im;var Er=om;var m1=function(){return"/"};var va=()=>globalThis.crypto.randomUUID();Kr();Kr();var Ww="[\\w-]{1,63}",_A=new RegExp(`^${Ww}$`),qK=new RegExp(`^a(?:${Ww}-)?[0-9a-f]{16}$`);function Gw(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=Fm("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var wA="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function Jw(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?Gw(e,wA):null}var Xw=globalThis.process?.getBuiltinModule?.("async_hooks"),qm=Xw?(e)=>Xw.AsyncResource.bind(e):(e)=>e;function yo(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function Di(){let e=new Set;return{subscribe(t){let r=qm(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function Yw(){return{sent:new Set,rejected:new Set}}var xA={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function kA(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof Qw==="function"){let r=m1();try{e=eS(Qw(r))}catch{e=eS(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),sessionLogicalStartTime:void 0,lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,refusalFallbackModelLatch:void 0,sdkDialogHostActive:!1,sdkSupportedDialogKinds:void 0,sdkSupportedDialogKindsSource:void 0,replConfigArgv:[],settingsEffortAtStartup:void 0,initialMainLoopModel:void 0,resolvedOrgDefault:void 0,modelStrings:null,isInteractive:!1,thinkingDisplayExplicit:!1,permissionPromptToolName:void 0,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthTokenFromBgSnapshot:!1,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,startupPolicySnapshot:void 0,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:Jw()??va(),mainAgentId:null,parentSessionId:void 0,loggerProvider:null,eventLogger:null,pendingOTelEvents:[],meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:{direct:null,proxied:null},foundryDeploymentCapabilities:new Map,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginsNoMcp:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,teammateAgentId:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,loopEnded:!1,sessionCreatedTeams:new Set,surfacedHookSpawnFailures:new Set,bareMcpServerMatchersWarned:new Set,inheritedTeamName:void 0,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,longContext1mCreditsBlocked:!1,fableCreditsRequired:!1,fableConsentSessionFallback:!1,fableBridgeDialogTimedOut:!1,fableConsentDialogInteracted:!1,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:xA,replBridgeActive:!1,mainLoopBusy:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,deferredToolStubGateLatch:null,strictMcpConfig:!1,cliSessionConfigCarried:!1,sessionApprovedMcpServers:[],activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:Yw(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var MA=kA(),EA=()=>{return};function Bm(){return EA()?.sessionId??MA.sessionId}var IA=Di(),MV=IA.subscribe;function eS(e){return process.platform==="darwin"?e.normalize("NFC"):e}var $A=Di(),EV=$A.subscribe;var TA=Di(),IV=TA.subscribe;var PA=Di();var $V=PA.subscribe;var AA=Di();var TV=AA.subscribe;var{appendFile:Z2,mkdir:hC,rename:K2,stat:pC,symlink:mC,unlink:Pv}=(()=>({}));Dn();function uS({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,h=null,v=null;function b(){if(h)clearTimeout(h),h=null}function _(M){try{e(M)}catch{}}function g(){if(v)_(v.join("")),v=null;if(o.length===0)return;_(o.join("")),o=[],s=0,b()}function S(){if(!h)h=setTimeout(g,t)}function x(){if(v){v.push(...o),o=[],s=0,b();return}let M=o;o=[],s=0,b(),v=M,setImmediate(()=>{let I=v;if(v=null,I)_(I.join(""))})}return{write(M){if(n){_(M);return}if(o.push(M),s+=M.length,S(),o.length>=r||s>=i)x()},flush:g,dispose(){g()}}}var{realpathSync:OV}=(()=>({}));var Wc=function(){return"/"};Dn();function Wm(e){return process.platform==="darwin"?e.normalize("NFC"):e}function cS(e){return/^[\\/]{2}/.test(e)}function dS(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function OA(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function fS(e){if(/^\\\\\?\\volume\{/i.test(e))return lS(e);let t=OA(e);if(t!==e&&lS(t))return!0;return cS(t)&&!dS(t)}function lS(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)||e.includes("/")}function DA(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class Gm{#e=new Set;register(e){let t=DA(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var NA=new Gm;function hS(e){return NA.register(e)}var jV=new Gm;var pS=Er((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function zA(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function jA(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function mS(e,t){if(!t)return!0;let r=zA(e);return jA(r,t)}Dn();var qe={};wn(qe,{xid:()=>jR,void:()=>o5,uuidv7:()=>AR,uuidv6:()=>PR,uuidv4:()=>TR,uuid:()=>$R,url:()=>RR,uppercase:()=>vu,unknown:()=>qt,union:()=>Dt,undefined:()=>n5,ulid:()=>zR,uint64:()=>t5,uint32:()=>YR,tuple:()=>l5,trim:()=>ku,treeifyError:()=>Yc,transform:()=>zy,toUpperCase:()=>Eu,toLowerCase:()=>Mu,toJSONSchema:()=>xs,templateLiteral:()=>v5,symbol:()=>r5,superRefine:()=>xx,success:()=>g5,stringbool:()=>w5,stringFormat:()=>WR,string:()=>de,strictObject:()=>u5,startsWith:()=>_u,size:()=>mu,setErrorMap:()=>k5,set:()=>f5,safeParseAsync:()=>hy,safeParse:()=>fy,registry:()=>Va,regexes:()=>Fi,regex:()=>gu,refine:()=>Sx,record:()=>Nt,readonly:()=>gx,property:()=>ny,promise:()=>b5,prettifyError:()=>Qc,preprocess:()=>Gf,prefault:()=>lx,positive:()=>Qg,pipe:()=>qf,partialRecord:()=>c5,parseAsync:()=>dy,parse:()=>cy,overwrite:()=>fi,optional:()=>Lt,object:()=>Qe,number:()=>It,nullish:()=>m5,nullable:()=>Ff,null:()=>Bf,normalize:()=>xu,nonpositive:()=>ty,nonoptional:()=>cx,nonnegative:()=>ry,never:()=>Hf,negative:()=>ey,nativeEnum:()=>h5,nanoid:()=>OR,nan:()=>y5,multipleOf:()=>Eo,minSize:()=>Io,minLength:()=>Hi,mime:()=>Su,maxSize:()=>_s,maxLength:()=>ws,map:()=>d5,lte:()=>kn,lt:()=>ci,lowercase:()=>yu,looseObject:()=>Lr,locales:()=>vs,literal:()=>tt,length:()=>Ss,lazy:()=>bx,ksuid:()=>UR,keyof:()=>a5,jwt:()=>VR,json:()=>S5,iso:()=>ks,ipv6:()=>FR,ipv4:()=>LR,intersection:()=>Cu,int64:()=>e5,int32:()=>XR,int:()=>py,instanceof:()=>_5,includes:()=>bu,guid:()=>IR,gte:()=>rn,gt:()=>di,globalRegistry:()=>tn,getErrorMap:()=>M5,function:()=>Of,formatError:()=>fs,float64:()=>JR,float32:()=>GR,flattenError:()=>ds,file:()=>p5,enum:()=>Vr,endsWith:()=>wu,emoji:()=>CR,email:()=>ER,e164:()=>KR,discriminatedUnion:()=>Vf,date:()=>s5,custom:()=>Fy,cuid2:()=>NR,cuid:()=>DR,core:()=>Nn,config:()=>rr,coerce:()=>qy,clone:()=>Ur,cidrv6:()=>BR,cidrv4:()=>qR,check:()=>wx,catch:()=>hx,boolean:()=>or,bigint:()=>QR,base64url:()=>ZR,base64:()=>HR,array:()=>_t,any:()=>i5,_default:()=>ax,_ZodString:()=>my,ZodXID:()=>xy,ZodVoid:()=>JS,ZodUnknown:()=>WS,ZodUnion:()=>Oy,ZodUndefined:()=>ZS,ZodUUID:()=>hi,ZodURL:()=>yy,ZodULID:()=>Sy,ZodType:()=>vt,ZodTuple:()=>ex,ZodTransform:()=>Ny,ZodTemplateLiteral:()=>yx,ZodSymbol:()=>HS,ZodSuccess:()=>dx,ZodStringFormat:()=>Ut,ZodString:()=>Tu,ZodSet:()=>rx,ZodRecord:()=>Dy,ZodRealError:()=>Ms,ZodReadonly:()=>mx,ZodPromise:()=>_x,ZodPrefault:()=>ux,ZodPipe:()=>Ly,ZodOptional:()=>jy,ZodObject:()=>Kf,ZodNumberFormat:()=>Es,ZodNumber:()=>Pu,ZodNullable:()=>ox,ZodNull:()=>KS,ZodNonOptional:()=>Uy,ZodNever:()=>GS,ZodNanoID:()=>by,ZodNaN:()=>px,ZodMap:()=>tx,ZodLiteral:()=>nx,ZodLazy:()=>vx,ZodKSUID:()=>ky,ZodJWT:()=>Ry,ZodIssueCode:()=>x5,ZodIntersection:()=>QS,ZodISOTime:()=>jf,ZodISODuration:()=>Uf,ZodISODateTime:()=>Nf,ZodISODate:()=>zf,ZodIPv6:()=>Ey,ZodIPv4:()=>My,ZodGUID:()=>Lf,ZodFile:()=>ix,ZodError:()=>kR,ZodEnum:()=>$u,ZodEmoji:()=>vy,ZodEmail:()=>gy,ZodE164:()=>Ay,ZodDiscriminatedUnion:()=>YS,ZodDefault:()=>sx,ZodDate:()=>Zf,ZodCustomStringFormat:()=>BS,ZodCustom:()=>Wf,ZodCatch:()=>fx,ZodCUID2:()=>wy,ZodCUID:()=>_y,ZodCIDRv6:()=>$y,ZodCIDRv4:()=>Iy,ZodBoolean:()=>Au,ZodBigIntFormat:()=>Cy,ZodBigInt:()=>Ru,ZodBase64URL:()=>Py,ZodBase64:()=>Ty,ZodArray:()=>XS,ZodAny:()=>VS,TimePrecision:()=>cf,NEVER:()=>Gc,$output:()=>af,$input:()=>uf,$brand:()=>Jc});var Nn={};wn(Nn,{version:()=>Q0,util:()=>Be,treeifyError:()=>Yc,toJSONSchema:()=>xs,toDotPath:()=>vS,safeParseAsync:()=>Li,safeParse:()=>Ui,registry:()=>Va,regexes:()=>Fi,prettifyError:()=>Qc,parseAsync:()=>So,parse:()=>wo,locales:()=>vs,isValidJWT:()=>NS,isValidBase64URL:()=>DS,isValidBase64:()=>og,globalRegistry:()=>tn,globalConfig:()=>Ra,function:()=>Of,formatError:()=>fs,flattenError:()=>ds,config:()=>rr,clone:()=>Ur,_xid:()=>ou,_void:()=>Ef,_uuidv7:()=>Ya,_uuidv6:()=>Xa,_uuidv4:()=>Ja,_uuid:()=>Ga,_url:()=>Qa,_uppercase:()=>vu,_unknown:()=>Mo,_union:()=>rR,_undefined:()=>Sf,_ulid:()=>iu,_uint64:()=>_f,_uint32:()=>gf,_tuple:()=>iy,_trim:()=>ku,_transform:()=>dR,_toUpperCase:()=>Eu,_toLowerCase:()=>Mu,_templateLiteral:()=>_R,_symbol:()=>wf,_success:()=>gR,_stringbool:()=>Rf,_stringFormat:()=>Cf,_string:()=>lf,_startsWith:()=>_u,_size:()=>mu,_set:()=>aR,_safeParseAsync:()=>nd,_safeParse:()=>rd,_regex:()=>gu,_refine:()=>Af,_record:()=>oR,_readonly:()=>bR,_property:()=>ny,_promise:()=>SR,_positive:()=>Qg,_pipe:()=>vR,_parseAsync:()=>td,_parse:()=>ed,_overwrite:()=>fi,_optional:()=>fR,_number:()=>df,_nullable:()=>hR,_null:()=>xf,_normalize:()=>xu,_nonpositive:()=>ty,_nonoptional:()=>mR,_nonnegative:()=>ry,_never:()=>Mf,_negative:()=>ey,_nativeEnum:()=>lR,_nanoid:()=>tu,_nan:()=>$f,_multipleOf:()=>Eo,_minSize:()=>Io,_minLength:()=>Hi,_min:()=>rn,_mime:()=>Su,_maxSize:()=>_s,_maxLength:()=>ws,_max:()=>kn,_map:()=>sR,_lte:()=>kn,_lt:()=>ci,_lowercase:()=>yu,_literal:()=>cR,_length:()=>Ss,_lazy:()=>wR,_ksuid:()=>su,_jwt:()=>pu,_isoTime:()=>Vg,_isoDuration:()=>Wg,_isoDateTime:()=>Zg,_isoDate:()=>Kg,_ipv6:()=>uu,_ipv4:()=>au,_intersection:()=>iR,_int64:()=>bf,_int32:()=>mf,_int:()=>ff,_includes:()=>bu,_guid:()=>bs,_gte:()=>rn,_gt:()=>di,_float64:()=>pf,_float32:()=>hf,_file:()=>Tf,_enum:()=>uR,_endsWith:()=>wu,_emoji:()=>eu,_email:()=>Wa,_e164:()=>hu,_discriminatedUnion:()=>nR,_default:()=>pR,_date:()=>If,_custom:()=>Pf,_cuid2:()=>nu,_cuid:()=>ru,_coercedString:()=>Hg,_coercedNumber:()=>Gg,_coercedDate:()=>Yg,_coercedBoolean:()=>Jg,_coercedBigint:()=>Xg,_cidrv6:()=>cu,_cidrv4:()=>lu,_catch:()=>yR,_boolean:()=>yf,_bigint:()=>vf,_base64url:()=>fu,_base64:()=>du,_array:()=>Iu,_any:()=>kf,TimePrecision:()=>cf,NEVER:()=>Gc,JSONSchemaGenerator:()=>Df,JSONSchema:()=>LS,Doc:()=>ad,$output:()=>af,$input:()=>uf,$constructor:()=>ne,$brand:()=>Jc,$ZodXID:()=>bd,$ZodVoid:()=>zd,$ZodUnknown:()=>ko,$ZodUnion:()=>Ha,$ZodUndefined:()=>Cd,$ZodUUID:()=>dd,$ZodURL:()=>hd,$ZodULID:()=>vd,$ZodType:()=>ut,$ZodTuple:()=>Bi,$ZodTransform:()=>gs,$ZodTemplateLiteral:()=>rf,$ZodSymbol:()=>Rd,$ZodSuccess:()=>Yd,$ZodStringFormat:()=>Ot,$ZodString:()=>qi,$ZodSet:()=>Bd,$ZodRegistry:()=>Ka,$ZodRecord:()=>Fd,$ZodRealError:()=>cs,$ZodReadonly:()=>tf,$ZodPromise:()=>nf,$ZodPrefault:()=>Jd,$ZodPipe:()=>ys,$ZodOptional:()=>Vd,$ZodObject:()=>Ba,$ZodNumberFormat:()=>Pd,$ZodNumber:()=>Fa,$ZodNullable:()=>Wd,$ZodNull:()=>Od,$ZodNonOptional:()=>Xd,$ZodNever:()=>Nd,$ZodNanoID:()=>md,$ZodNaN:()=>ef,$ZodMap:()=>qd,$ZodLiteral:()=>Zd,$ZodLazy:()=>of,$ZodKSUID:()=>_d,$ZodJWT:()=>$d,$ZodIntersection:()=>Ld,$ZodISOTime:()=>ng,$ZodISODuration:()=>ig,$ZodISODateTime:()=>tg,$ZodISODate:()=>rg,$ZodIPv6:()=>Sd,$ZodIPv4:()=>wd,$ZodGUID:()=>cd,$ZodFunction:()=>oy,$ZodFile:()=>Kd,$ZodError:()=>La,$ZodEnum:()=>Hd,$ZodEmoji:()=>pd,$ZodEmail:()=>fd,$ZodE164:()=>Id,$ZodDiscriminatedUnion:()=>Ud,$ZodDefault:()=>Gd,$ZodDate:()=>jd,$ZodCustomStringFormat:()=>Td,$ZodCustom:()=>sf,$ZodCheckUpperCase:()=>K0,$ZodCheckStringFormat:()=>hs,$ZodCheckStartsWith:()=>W0,$ZodCheckSizeEquals:()=>L0,$ZodCheckRegex:()=>H0,$ZodCheckProperty:()=>J0,$ZodCheckOverwrite:()=>Y0,$ZodCheckNumberFormat:()=>N0,$ZodCheckMultipleOf:()=>D0,$ZodCheckMinSize:()=>U0,$ZodCheckMinLength:()=>q0,$ZodCheckMimeType:()=>X0,$ZodCheckMaxSize:()=>j0,$ZodCheckMaxLength:()=>F0,$ZodCheckLowerCase:()=>Z0,$ZodCheckLessThan:()=>od,$ZodCheckLengthEquals:()=>B0,$ZodCheckIncludes:()=>V0,$ZodCheckGreaterThan:()=>sd,$ZodCheckEndsWith:()=>G0,$ZodCheckBigIntFormat:()=>z0,$ZodCheck:()=>Ht,$ZodCatch:()=>Qd,$ZodCUID2:()=>yd,$ZodCUID:()=>gd,$ZodCIDRv6:()=>kd,$ZodCIDRv4:()=>xd,$ZodBoolean:()=>ps,$ZodBigIntFormat:()=>Ad,$ZodBigInt:()=>qa,$ZodBase64URL:()=>Ed,$ZodBase64:()=>Md,$ZodAsyncError:()=>ui,$ZodArray:()=>ms,$ZodAny:()=>Dd});var Gc=Object.freeze({status:"aborted"});function ne(e,t,r){function i(h,v){var b;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(b=h._zod).traits??(b.traits=new Set),h._zod.traits.add(e),t(h,v);for(let _ in s.prototype)if(!(_ in h))Object.defineProperty(h,_,{value:s.prototype[_].bind(h)});h._zod.constr=s,h._zod.def=v}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:e});function s(h){var v;let b=r?.Parent?new o:this;i(b,h),(v=b._zod).deferred??(v.deferred=[]);for(let _ of b._zod.deferred)_();return b}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var Jc=Symbol("zod_brand");class ui extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Ra={};function rr(e){if(e)Object.assign(Ra,e);return Ra}var Be={};wn(Be,{unwrapMessage:()=>Ca,stringifyPrimitive:()=>Ve,required:()=>t9,randomString:()=>KA,propertyKeyTypes:()=>za,promiseAllObject:()=>ZA,primitiveTypes:()=>t0,prefixIssues:()=>en,pick:()=>JA,partial:()=>e9,optionalKeys:()=>r0,omit:()=>XA,numKeys:()=>VA,nullish:()=>ji,normalizeParams:()=>Fe,merge:()=>QA,jsonStringifyReplacer:()=>Xm,joinValues:()=>be,issue:()=>o0,isPlainObject:()=>ls,isObject:()=>us,getSizableOrigin:()=>ja,getParsedType:()=>WA,getLengthableOrigin:()=>Ua,getEnumValues:()=>Oa,getElementAtPath:()=>HA,floatSafeRemainder:()=>Ym,finalizeIssue:()=>fn,extend:()=>YA,escapeRegex:()=>li,esc:()=>bo,defineLazy:()=>$t,createTransparentProxy:()=>GA,clone:()=>Ur,cleanRegex:()=>Na,cleanEnum:()=>r9,captureStackTrace:()=>Xc,cached:()=>Da,assignProp:()=>Qm,assertNotEqual:()=>LA,assertNever:()=>qA,assertIs:()=>FA,assertEqual:()=>UA,assert:()=>BA,allowsEval:()=>e0,aborted:()=>_o,NUMBER_FORMAT_RANGES:()=>n0,Class:()=>gS,BIGINT_FORMAT_RANGES:()=>i0});function UA(e){return e}function LA(e){return e}function FA(e){}function qA(e){throw Error()}function BA(e){}function Oa(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function be(e,t="|"){return e.map((r)=>Ve(r)).join(t)}function Xm(e,t){if(typeof t==="bigint")return t.toString();return t}function Da(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function ji(e){return e===null||e===void 0}function Na(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ym(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}function $t(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Qm(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function HA(e,t){if(!t)return e;return t.reduce((r,i)=>r?.[i],e)}function ZA(e){let t=Object.keys(e),r=t.map((i)=>e[i]);return Promise.all(r).then((i)=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function KA(e=10){let r="";for(let i=0;i<e;i++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function bo(e){return JSON.stringify(e)}var Xc=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function us(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var e0=Da(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ls(e){if(us(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(us(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function VA(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var WA=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},za=new Set(["string","number","symbol"]),t0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function li(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ur(e,t,r){let i=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)i._zod.parent=e;return i}function Fe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function GA(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function Ve(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function r0(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var n0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},i0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function JA(e,t){let r={},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=i.shape[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function XA(e,t){let r={...e._zod.def.shape},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function YA(e,t){if(!ls(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let i={...e._zod.def.shape,...t};return Qm(this,"shape",i),i},checks:[]};return Ur(e,r)}function QA(e,t){return Ur(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Qm(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function e9(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in i))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=e?new e({type:"optional",innerType:i[o]}):i[o]}else for(let o in i)n[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return Ur(t,{...t._zod.def,shape:n,checks:[]})}function t9(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in n))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=new e({type:"nonoptional",innerType:i[o]})}else for(let o in i)n[o]=new e({type:"nonoptional",innerType:i[o]});return Ur(t,{...t._zod.def,shape:n,checks:[]})}function _o(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function en(e,t){return t.map((r)=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Ca(e){return typeof e==="string"?e:e?.message}function fn(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let n=Ca(e.inst?._zod.def?.error?.(e))??Ca(t?.error?.(e))??Ca(r.customError?.(e))??Ca(r.localeError?.(e))??"Invalid input";i.message=n}if(delete i.inst,delete i.continue,!t?.reportInput)delete i.input;return i}function ja(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Ua(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function o0(...e){let[t,r,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:i};return{...t}}function r9(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}class gS{constructor(...e){}}var yS=(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,Xm,2)},enumerable:!0})},La=ne("$ZodError",yS),cs=ne("$ZodError",yS,{Parent:Error});function ds(e,t=(r)=>r.message){let r={},i=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else i.push(t(n));return{formErrors:i,fieldErrors:r}}function fs(e,t){let r=t||function(o){return o.message},i={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((h)=>n({issues:h}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)i._errors.push(r(s));else{let h=i,v=0;while(v<s.path.length){let b=s.path[v];if(v!==s.path.length-1)h[b]=h[b]||{_errors:[]};else h[b]=h[b]||{_errors:[]},h[b]._errors.push(r(s));h=h[b],v++}}};return n(e),i}function Yc(e,t){let r=t||function(o){return o.message},i={errors:[]},n=(o,s=[])=>{var h,v;for(let b of o.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((_)=>n({issues:_},b.path));else if(b.code==="invalid_key")n({issues:b.issues},b.path);else if(b.code==="invalid_element")n({issues:b.issues},b.path);else{let _=[...s,...b.path];if(_.length===0){i.errors.push(r(b));continue}let g=i,S=0;while(S<_.length){let x=_[S],M=S===_.length-1;if(typeof x==="string")g.properties??(g.properties={}),(h=g.properties)[x]??(h[x]={errors:[]}),g=g.properties[x];else g.items??(g.items=[]),(v=g.items)[x]??(v[x]={errors:[]}),g=g.items[x];if(M)g.errors.push(r(b));S++}}};return n(e),i}function vS(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function Qc(e){let t=[],r=[...e.issues].sort((i,n)=>i.path.length-n.path.length);for(let i of r)if(t.push(`✖ ${i.message}`),i.path?.length)t.push(` → at ${vS(i.path)}`);return t.join(`
|
|
26
|
+
deps: ${r}}`};var $q={keyword:"dependencies",type:"object",schemaType:"object",error:N3.error,code(e){let[t,r]=Tq(e);O3(e,t),D3(e,r)}};function Tq({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function O3(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let h=t[s];if(h.length===0)continue;let v=(0,kc.propertyInData)(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:h.length,deps:h.join(", ")}),n.allErrors)r.if(v,()=>{for(let b of h)(0,kc.checkReportMissingProp)(e,b)});else r.if(l_._`${v} && (${(0,kc.checkMissingProp)(e,h,o)})`),(0,kc.reportMissingProp)(e,o),r.else()}}N3.validatePropertyDeps=O3;function D3(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let h in t){if((0,Iq.alwaysValidSchema)(o,t[h]))continue;r.if((0,kc.propertyInData)(r,i,h,o.opts.ownProperties),()=>{let v=e.subschema({keyword:n,schemaProp:h},s);e.mergeValidEvaluated(v,s)},()=>r.var(s,!0)),e.ok(s)}}N3.validateSchemaDeps=D3;N3.default=$q});var q3=Xe(function(F3){Object.defineProperty(F3,"__esModule",{value:!0});var L3=gt(),Rq=Mt(),Cq={message:"property name must be valid",params:({params:e})=>L3._`{propertyName: ${e.propertyName}}`},Oq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Cq,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,Rq.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,L3.not)(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};F3.default=Oq});var c_=Xe(function(B3){Object.defineProperty(B3,"__esModule",{value:!0});var Vp=Rn(),Kn=gt(),Nq=Mi(),Wp=Mt(),zq={message:"must NOT have additional properties",params:({params:e})=>Kn._`{additionalProperty: ${e.additionalProperty}}`},jq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:zq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:h,opts:v}=s;if(s.props=!0,v.removeAdditional!=="all"&&(0,Wp.alwaysValidSchema)(s,r))return;let b=(0,Vp.allSchemaProperties)(i.properties),_=(0,Vp.allSchemaProperties)(i.patternProperties);g(),e.ok(Kn._`${o} === ${Nq.default.errors}`);function g(){t.forIn("key",n,($)=>{if(!b.length&&!_.length)M($);else t.if(S($),()=>M($))})}function S($){let T;if(b.length>8){let P=(0,Wp.schemaRefOrVal)(s,i.properties,"properties");T=(0,Vp.isOwnProperty)(t,P,$)}else if(b.length)T=(0,Kn.or)(...b.map((P)=>Kn._`${$} === ${P}`));else T=Kn.nil;if(_.length)T=(0,Kn.or)(T,..._.map((P)=>Kn._`${(0,Vp.usePattern)(e,P)}.test(${$})`));return(0,Kn.not)(T)}function x($){t.code(Kn._`delete ${n}[${$}]`)}function M($){if(v.removeAdditional==="all"||v.removeAdditional&&r===!1){x($);return}if(r===!1){if(e.setParams({additionalProperty:$}),e.error(),!h)t.break();return}if(typeof r=="object"&&!(0,Wp.alwaysValidSchema)(s,r)){let T=t.name("valid");if(v.removeAdditional==="failing")I($,T,!1),t.if((0,Kn.not)(T),()=>{e.reset(),x($)});else if(I($,T),!h)t.if((0,Kn.not)(T),()=>t.break())}}function I($,T,P){let R={keyword:"additionalProperties",dataProp:$,dataPropType:Wp.Type.Str};if(P===!1)Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(R,T)}}};B3.default=jq});var V3=Xe(function(K3){Object.defineProperty(K3,"__esModule",{value:!0});var Lq=fc(),H3=Rn(),d_=Mt(),Z3=c_(),Fq={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)Z3.default.code(new Lq.KeywordCxt(o,Z3.default,"additionalProperties"));let s=(0,H3.allSchemaProperties)(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=d_.mergeEvaluated.props(t,(0,d_.toHash)(s),o.props);let h=s.filter((g)=>!(0,d_.alwaysValidSchema)(o,r[g]));if(h.length===0)return;let v=t.name("valid");for(let g of h){if(b(g))_(g);else{if(t.if((0,H3.propertyInData)(t,n,g,o.opts.ownProperties)),_(g),!o.allErrors)t.else().var(v,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(v)}function b(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function _(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},v)}}};K3.default=Fq});var Y3=Xe(function(X3){Object.defineProperty(X3,"__esModule",{value:!0});var W3=Rn(),Gp=gt(),G3=Mt(),J3=Mt(),Bq={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,h=(0,W3.allSchemaProperties)(r),v=h.filter((I)=>(0,G3.alwaysValidSchema)(o,r[I]));if(h.length===0||v.length===h.length&&(!o.opts.unevaluated||o.props===!0))return;let b=s.strictSchema&&!s.allowMatchingProperties&&n.properties,_=t.name("valid");if(o.props!==!0&&!(o.props instanceof Gp.Name))o.props=(0,J3.evaluatedPropsToName)(t,o.props);let{props:g}=o;S();function S(){for(let I of h){if(b)x(I);if(o.allErrors)M(I);else t.var(_,!0),M(I),t.if(_)}}function x(I){for(let $ in b)if(new RegExp(I).test($))(0,G3.checkStrictMode)(o,`property ${$} matches pattern ${I} (use allowMatchingProperties)`)}function M(I){t.forIn("key",i,($)=>{t.if(Gp._`${(0,W3.usePattern)(e,I)}.test(${$})`,()=>{let T=v.includes(I);if(!T)e.subschema({keyword:"patternProperties",schemaProp:I,dataProp:$,dataPropType:J3.Type.Str},_);if(o.opts.unevaluated&&g!==!0)t.assign(Gp._`${g}[${$}]`,!0);else if(!T&&!o.allErrors)t.if((0,Gp.not)(_),()=>t.break())})})}}};X3.default=Bq});var e8=Xe(function(Q3){Object.defineProperty(Q3,"__esModule",{value:!0});var Zq=Mt(),Kq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Zq.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Q3.default=Kq});var r8=Xe(function(t8){Object.defineProperty(t8,"__esModule",{value:!0});var Wq=Rn(),Gq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Wq.validateUnion,error:{message:"must match a schema in anyOf"}};t8.default=Gq});var i8=Xe(function(n8){Object.defineProperty(n8,"__esModule",{value:!0});var Jp=gt(),Xq=Mt(),Yq={message:"must match exactly one schema in oneOf",params:({params:e})=>Jp._`{passingSchemas: ${e.passing}}`},Qq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Yq,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),h=t.let("passing",null),v=t.name("_valid");e.setParams({passing:h}),t.block(b),e.result(s,()=>e.reset(),()=>e.error(!0));function b(){o.forEach((_,g)=>{let S;if((0,Xq.alwaysValidSchema)(n,_))t.var(v,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},v);if(g>0)t.if(Jp._`${v} && ${s}`).assign(s,!1).assign(h,Jp._`[${h}, ${g}]`).else();t.if(v,()=>{if(t.assign(s,!0),t.assign(h,g),S)e.mergeEvaluated(S,Jp.Name)})})}}};n8.default=Qq});var s8=Xe(function(o8){Object.defineProperty(o8,"__esModule",{value:!0});var tB=Mt(),rB={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,tB.alwaysValidSchema)(i,o))return;let h=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(h)})}};o8.default=rB});var c8=Xe(function(l8){Object.defineProperty(l8,"__esModule",{value:!0});var Xp=gt(),u8=Mt(),iB={message:({params:e})=>Xp.str`must match "${e.ifClause}" schema`,params:({params:e})=>Xp._`{failingKeyword: ${e.ifClause}}`},oB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:iB,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)(0,u8.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=a8(i,"then"),o=a8(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),h=t.name("_valid");if(v(),e.reset(),n&&o){let _=t.let("ifClause");e.setParams({ifClause:_}),t.if(h,b("then",_),b("else",_))}else if(n)t.if(h,b("then"));else t.if((0,Xp.not)(h),b("else"));e.pass(s,()=>e.error(!0));function v(){let _=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(_)}function b(_,g){return()=>{let S=e.subschema({keyword:_},h);if(t.assign(s,h),e.mergeValidEvaluated(S,s),g)t.assign(g,Xp._`${_}`);else e.setParams({ifClause:_})}}}};function a8(e,t){let r=e.schema[t];return r!==void 0&&!(0,u8.alwaysValidSchema)(e,r)}l8.default=oB});var f8=Xe(function(d8){Object.defineProperty(d8,"__esModule",{value:!0});var aB=Mt(),uB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,aB.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};d8.default=uB});var p8=Xe(function(h8){Object.defineProperty(h8,"__esModule",{value:!0});var cB=a_(),dB=$3(),fB=u_(),hB=A3(),pB=C3(),mB=U3(),gB=q3(),yB=c_(),vB=V3(),bB=Y3(),_B=e8(),wB=r8(),SB=i8(),xB=s8(),kB=c8(),MB=f8();function EB(e=!1){let t=[_B.default,wB.default,SB.default,xB.default,kB.default,MB.default,gB.default,yB.default,mB.default,vB.default,bB.default];if(e)t.push(dB.default,hB.default);else t.push(cB.default,fB.default);return t.push(pB.default),t}h8.default=EB});var g8=Xe(function(m8){Object.defineProperty(m8,"__esModule",{value:!0});var ir=gt(),$B={message:({schemaCode:e})=>ir.str`must match format "${e}"`,params:({schemaCode:e})=>ir._`{format: ${e}}`},TB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:$B,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:h}=e,{opts:v,errSchemaPath:b,schemaEnv:_,self:g}=h;if(!v.validateFormats)return;if(n)S();else x();function S(){let M=r.scopeValue("formats",{ref:g.formats,code:v.code.formats}),I=r.const("fDef",ir._`${M}[${s}]`),$=r.let("fType"),T=r.let("format");r.if(ir._`typeof ${I} == "object" && !(${I} instanceof RegExp)`,()=>r.assign($,ir._`${I}.type || "string"`).assign(T,ir._`${I}.validate`),()=>r.assign($,ir._`"string"`).assign(T,I)),e.fail$data((0,ir.or)(P(),R()));function P(){if(v.strictSchema===!1)return ir.nil;return ir._`${s} && !${T}`}function R(){let C=_.$async?ir._`(${I}.async ? await ${T}(${i}) : ${T}(${i}))`:ir._`${T}(${i})`,N=ir._`(typeof ${T} == "function" ? ${C} : ${T}.test(${i}))`;return ir._`${T} && ${T} !== true && ${$} === ${t} && !${N}`}}function x(){let M=g.formats[o];if(!M){P();return}if(M===!0)return;let[I,$,T]=R(M);if(I===t)e.pass(C());function P(){if(v.strictSchema===!1){g.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${b}"`}}function R(N){let B=N instanceof RegExp?(0,ir.regexpCode)(N):v.code.formats?ir._`${v.code.formats}${(0,ir.getProperty)(o)}`:void 0,ie=r.scopeValue("formats",{key:o,ref:N,code:B});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,ir._`${ie}.validate`];return["string",N,ie]}function C(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!_.$async)throw Error("async format in sync schema");return ir._`await ${T}(${i})`}return typeof $=="function"?ir._`${T}(${i})`:ir._`${T}.test(${i})`}}}};m8.default=TB});var v8=Xe(function(y8){Object.defineProperty(y8,"__esModule",{value:!0});var AB=g8(),RB=[AB.default];y8.default=RB});var w8=Xe(function(b8){Object.defineProperty(b8,"__esModule",{value:!0});b8.contentVocabulary=b8.metadataVocabulary=void 0;b8.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];b8.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var k8=Xe(function(x8){Object.defineProperty(x8,"__esModule",{value:!0});var DB=K4(),NB=b3(),zB=p8(),jB=v8(),S8=w8(),UB=[DB.default,NB.default,(0,zB.default)(),jB.default,S8.metadataVocabulary,S8.contentVocabulary];x8.default=UB});var $8=Xe(function(E8){Object.defineProperty(E8,"__esModule",{value:!0});E8.DiscrError=void 0;var M8;(function(e){e.Tag="tag",e.Mapping="mapping"})(M8||(E8.DiscrError=M8={}))});var A8=Xe(function(P8){Object.defineProperty(P8,"__esModule",{value:!0});var fa=gt(),f_=$8(),T8=Op(),FB=hc(),qB=Mt(),BB={message:({params:{discrError:e,tagName:t}})=>e===f_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>fa._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},HB={keyword:"discriminator",type:"object",schemaType:"object",error:BB,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=i.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let v=t.let("valid",!1),b=t.const("tag",fa._`${r}${(0,fa.getProperty)(h)}`);t.if(fa._`typeof ${b} == "string"`,()=>_(),()=>e.error(!1,{discrError:f_.DiscrError.Tag,tag:b,tagName:h})),e.ok(v);function _(){let x=S();t.if(!1);for(let M in x)t.elseIf(fa._`${b} === ${M}`),t.assign(v,g(x[M]));t.else(),e.error(!1,{discrError:f_.DiscrError.Mapping,tag:b,tagName:h}),t.endIf()}function g(x){let M=t.name("valid"),I=e.subschema({keyword:"oneOf",schemaProp:x},M);return e.mergeEvaluated(I,fa.Name),M}function S(){var x;let M={},I=T(n),$=!0;for(let C=0;C<s.length;C++){let N=s[C];if((N===null||N===void 0?void 0:N.$ref)&&!(0,qB.schemaHasRulesButRef)(N,o.self.RULES)){let ie=N.$ref;if(N=T8.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ie),N instanceof T8.SchemaEnv)N=N.schema;if(N===void 0)throw new FB.default(o.opts.uriResolver,o.baseId,ie)}let B=(x=N===null||N===void 0?void 0:N.properties)===null||x===void 0?void 0:x[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);$=$&&(I||T(N)),P(B,C)}if(!$)throw Error(`discriminator: "${h}" must be required`);return M;function T({required:C}){return Array.isArray(C)&&C.includes(h)}function P(C,N){if(C.const)R(C.const,N);else if(C.enum)for(let B of C.enum)R(B,N);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function R(C,N){if(typeof C!="string"||C in M)throw Error(`discriminator: "${h}" values must be unique strings`);M[C]=N}}}};P8.default=HB});var R8=Xe(function(__e,KB){KB.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var p_=Xe(function(ln,h_){Object.defineProperty(ln,"__esModule",{value:!0});ln.MissingRefError=ln.ValidationError=ln.CodeGen=ln.Name=ln.nil=ln.stringify=ln.str=ln._=ln.KeywordCxt=ln.Ajv=void 0;var VB=N4(),WB=k8(),GB=A8(),C8=R8(),JB=["/properties"],Yp="http://json-schema.org/draft-07/schema";class Mc extends VB.default{_addVocabularies(){if(super._addVocabularies(),WB.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(GB.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(C8,JB):C8;this.addMetaSchema(e,Yp,!1),this.refs["http://json-schema.org/schema"]=Yp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Yp)?Yp:void 0)}}ln.Ajv=Mc;h_.exports=ln=Mc;h_.exports.Ajv=Mc;Object.defineProperty(ln,"__esModule",{value:!0});ln.default=Mc;var XB=fc();Object.defineProperty(ln,"KeywordCxt",{enumerable:!0,get:function(){return XB.KeywordCxt}});var ha=gt();Object.defineProperty(ln,"_",{enumerable:!0,get:function(){return ha._}});Object.defineProperty(ln,"str",{enumerable:!0,get:function(){return ha.str}});Object.defineProperty(ln,"stringify",{enumerable:!0,get:function(){return ha.stringify}});Object.defineProperty(ln,"nil",{enumerable:!0,get:function(){return ha.nil}});Object.defineProperty(ln,"Name",{enumerable:!0,get:function(){return ha.Name}});Object.defineProperty(ln,"CodeGen",{enumerable:!0,get:function(){return ha.CodeGen}});var YB=Rp();Object.defineProperty(ln,"ValidationError",{enumerable:!0,get:function(){return YB.default}});var QB=hc();Object.defineProperty(ln,"MissingRefError",{enumerable:!0,get:function(){return QB.default}})});var B8=Xe(function(F8){Object.defineProperty(F8,"__esModule",{value:!0});F8.formatNames=F8.fastFormats=F8.fullFormats=void 0;function ri(e,t){return{validate:e,compare:t}}F8.fullFormats={date:ri(z8,v_),time:ri(g_(!0),b_),"date-time":ri(O8(!0),U8),"iso-time":ri(g_(),j8),"iso-date-time":ri(O8(),L8),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:aH,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:pH,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:uH,int32:{type:"number",validate:dH},int64:{type:"number",validate:fH},float:{type:"number",validate:N8},double:{type:"number",validate:N8},password:!0,binary:!0};F8.fastFormats={...F8.fullFormats,date:ri(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,v_),time:ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,b_),"date-time":ri(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,U8),"iso-time":ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,j8),"iso-date-time":ri(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,L8),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};F8.formatNames=Object.keys(F8.fullFormats);function rH(e){return e%4===0&&(e%100!==0||e%400===0)}var nH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,iH=[0,31,28,31,30,31,30,31,31,30,31,30,31];function z8(e){let t=nH.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&rH(r)?29:iH[i])}function v_(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var m_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function g_(e){return function(r){let i=m_.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],h=i[4],v=i[5]==="-"?-1:1,b=+(i[6]||0),_=+(i[7]||0);if(b>23||_>59||e&&!h)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-_*v,S=n-b*v-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function b_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function j8(e,t){if(!(e&&t))return;let r=m_.exec(e),i=m_.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var y_=/t|\s/i;function O8(e){let t=g_(e);return function(i){let n=i.split(y_);return n.length===2&&z8(n[0])&&t(n[1])}}function U8(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function L8(e,t){if(!(e&&t))return;let[r,i]=e.split(y_),[n,o]=t.split(y_),s=v_(r,n);if(s===void 0)return;return s||b_(i,o)}var oH=/\/|:/,sH=/^(?:[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 aH(e){return oH.test(e)&&sH.test(e)}var D8=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function uH(e){return D8.lastIndex=0,D8.test(e)}var lH=-2147483648,cH=2147483647;function dH(e){return Number.isInteger(e)&&e<=cH&&e>=lH}function fH(e){return Number.isInteger(e)}function N8(){return!0}var hH=/[^\\]\\Z/;function pH(e){if(hH.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Z8=Xe(function(H8){Object.defineProperty(H8,"__esModule",{value:!0});H8.formatLimitDefinition=void 0;var gH=p_(),Vn=gt(),uo=Vn.operators,Qp={formatMaximum:{okStr:"<=",ok:uo.LTE,fail:uo.GT},formatMinimum:{okStr:">=",ok:uo.GTE,fail:uo.LT},formatExclusiveMaximum:{okStr:"<",ok:uo.LT,fail:uo.GTE},formatExclusiveMinimum:{okStr:">",ok:uo.GT,fail:uo.LTE}},yH={message:({keyword:e,schemaCode:t})=>Vn.str`should be ${Qp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Vn._`{comparison: ${Qp[e].okStr}, limit: ${t}}`};H8.formatLimitDefinition={keyword:Object.keys(Qp),type:"string",schemaType:"string",$data:!0,error:yH,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:h}=o;if(!s.validateFormats)return;let v=new gH.KeywordCxt(o,h.RULES.all.format.definition,"format");if(v.$data)b();else _();function b(){let S=t.scopeValue("formats",{ref:h.formats,code:s.code.formats}),x=t.const("fmt",Vn._`${S}[${v.schemaCode}]`);e.fail$data((0,Vn.or)(Vn._`typeof ${x} != "object"`,Vn._`${x} instanceof RegExp`,Vn._`typeof ${x}.compare != "function"`,g(x)))}function _(){let S=v.schema,x=h.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let M=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Vn._`${s.code.formats}${(0,Vn.getProperty)(S)}`:void 0});e.fail$data(g(M))}function g(S){return Vn._`${S}.compare(${r}, ${i}) ${Qp[n].fail} 0`}},dependencies:["format"]};var vH=(e)=>(e.addKeyword(H8.formatLimitDefinition),e);H8.default=vH});var G8=Xe(function(Ec,W8){Object.defineProperty(Ec,"__esModule",{value:!0});var pa=B8(),_H=Z8(),S_=gt(),K8=new S_.Name("fullFormats"),wH=new S_.Name("fastFormats"),x_=(e,t={keywords:!0})=>{if(Array.isArray(t))return V8(e,t,pa.fullFormats,K8),e;let[r,i]=t.mode==="fast"?[pa.fastFormats,wH]:[pa.fullFormats,K8],n=t.formats||pa.formatNames;if(V8(e,n,r,i),t.keywords)(0,_H.default)(e);return e};x_.get=(e,t="full")=>{let i=(t==="fast"?pa.fastFormats:pa.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function V8(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=S_._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}W8.exports=Ec=x_;Object.defineProperty(Ec,"__esModule",{value:!0});Ec.default=x_});var OH=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,DH=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;class On extends Error{}function z_(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((h,v,b)=>{h?.removeEventListener("abort",v),b()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}var{writeFileSync:Cpe}=(()=>({}));function yE(){this.__data__=[],this.size=0}var j_=yE;function vE(e,t){return e===t||e!==e&&t!==t}var U_=vE;function bE(e,t){var r=e.length;while(r--)if(U_(e[r][0],t))return r;return-1}var Ti=bE;var _E=Array.prototype,wE=_E.splice;function SE(e){var t=this.__data__,r=Ti(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else wE.call(t,r,1);return--this.size,!0}var L_=SE;function xE(e){var t=this.__data__,r=Ti(t,e);return r<0?void 0:t[r][1]}var F_=xE;function kE(e){return Ti(this.__data__,e)>-1}var q_=kE;function ME(e,t){var r=this.__data__,i=Ti(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var B_=ME;function Yo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Yo.prototype.clear=j_;Yo.prototype.delete=L_;Yo.prototype.get=F_;Yo.prototype.has=q_;Yo.prototype.set=B_;var H_=Yo;var EE=typeof global=="object"&&global&&global.Object===Object&&global,Z_=EE;var IE=typeof self=="object"&&self&&self.Object===Object&&self,$E=Z_||IE||Function("return this")(),Qo=$E;var TE=Qo.Symbol,es=TE;var K_=Object.prototype,PE=K_.hasOwnProperty,AE=K_.toString,ya=es?es.toStringTag:void 0;function RE(e){var t=PE.call(e,ya),r=e[ya];try{e[ya]=void 0;var i=!0}catch(o){}var n=AE.call(e);if(i)if(t)e[ya]=r;else delete e[ya];return n}var V_=RE;var CE=Object.prototype,OE=CE.toString;function DE(e){return OE.call(e)}var W_=DE;var NE="[object Null]",zE="[object Undefined]",G_=es?es.toStringTag:void 0;function jE(e){if(e==null)return e===void 0?zE:NE;return G_&&G_ in Object(e)?V_(e):W_(e)}var J_=jE;function UE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var $c=UE;var LE="[object AsyncFunction]",FE="[object Function]",qE="[object GeneratorFunction]",BE="[object Proxy]";function HE(e){if(!$c(e))return!1;var t=J_(e);return t==FE||t==qE||t==LE||t==BE}var X_=HE;var ZE=Qo["__core-js_shared__"],Tc=ZE;var Y_=function(){var e=/[^.]+$/.exec(Tc&&Tc.keys&&Tc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function KE(e){return!!Y_&&Y_ in e}var Q_=KE;var VE=Function.prototype,WE=VE.toString;function GE(e){if(e!=null){try{return WE.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var e1=GE;var JE=/[\\^$.*+?()[\]{}|]/g,XE=/^\[object .+?Constructor\]$/,YE=Function.prototype,QE=Object.prototype,eI=YE.toString,tI=QE.hasOwnProperty,rI=RegExp("^"+eI.call(tI).replace(JE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nI(e){if(!$c(e)||Q_(e))return!1;var t=X_(e)?rI:XE;return t.test(e1(e))}var t1=nI;function iI(e,t){return e==null?void 0:e[t]}var r1=iI;function oI(e,t){var r=r1(e,t);return t1(r)?r:void 0}var Pc=oI;var sI=Pc(Qo,"Map"),n1=sI;var aI=Pc(Object,"create"),ni=aI;function uI(){this.__data__=ni?ni(null):{},this.size=0}var i1=uI;function lI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var o1=lI;var cI="__lodash_hash_undefined__",dI=Object.prototype,fI=dI.hasOwnProperty;function hI(e){var t=this.__data__;if(ni){var r=t[e];return r===cI?void 0:r}return fI.call(t,e)?t[e]:void 0}var s1=hI;var pI=Object.prototype,mI=pI.hasOwnProperty;function gI(e){var t=this.__data__;return ni?t[e]!==void 0:mI.call(t,e)}var a1=gI;var yI="__lodash_hash_undefined__";function vI(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ni&&t===void 0?yI:t,this}var u1=vI;function ts(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}ts.prototype.clear=i1;ts.prototype.delete=o1;ts.prototype.get=s1;ts.prototype.has=a1;ts.prototype.set=u1;var nm=ts;function bI(){this.size=0,this.__data__={hash:new nm,map:new(n1||H_),string:new nm}}var l1=bI;function _I(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var c1=_I;function wI(e,t){var r=e.__data__;return c1(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Pi=wI;function SI(e){var t=Pi(this,e).delete(e);return this.size-=t?1:0,t}var d1=SI;function xI(e){return Pi(this,e).get(e)}var f1=xI;function kI(e){return Pi(this,e).has(e)}var h1=kI;function MI(e,t){var r=Pi(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var p1=MI;function rs(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}rs.prototype.clear=l1;rs.prototype.delete=d1;rs.prototype.get=f1;rs.prototype.has=h1;rs.prototype.set=p1;var im=rs;var{realpathSync:Qw}=(()=>({}));var EI="Expected a function";function om(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(EI);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(om.Cache||im),r}om.Cache=im;var Er=om;var m1=function(){return"/"};var va=()=>globalThis.crypto.randomUUID();Kr();Kr();var Ww="[\\w-]{1,63}",_A=new RegExp(`^${Ww}$`),qK=new RegExp(`^a(?:${Ww}-)?[0-9a-f]{16}$`);function Gw(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=Fm("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var wA="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function Jw(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?Gw(e,wA):null}var Xw=globalThis.process?.getBuiltinModule?.("async_hooks"),qm=Xw?(e)=>Xw.AsyncResource.bind(e):(e)=>e;function yo(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function Di(){let e=new Set;return{subscribe(t){let r=qm(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function Yw(){return{sent:new Set,rejected:new Set}}var xA={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function kA(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof Qw==="function"){let r=m1();try{e=eS(Qw(r))}catch{e=eS(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),sessionLogicalStartTime:void 0,lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,refusalFallbackHeaderArmed:!1,refusalFallbackLatchOriginRequestId:void 0,refusalFallbackModelLatch:void 0,sdkDialogHostActive:!1,sdkSupportedDialogKinds:void 0,sdkSupportedDialogKindsSource:void 0,replConfigArgv:[],settingsEffortAtStartup:void 0,initialMainLoopModel:void 0,resolvedOrgDefault:void 0,modelStrings:null,isInteractive:!1,thinkingDisplayExplicit:!1,permissionPromptToolName:void 0,attacherCaps:null,hasStreamingInput:!1,singleShotPrintSession:!1,modelOverrideOptOutForSession:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthTokenFromBgSnapshot:!1,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,startupPolicySnapshot:void 0,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:Jw()??va(),mainAgentId:null,parentSessionId:void 0,loggerProvider:null,eventLogger:null,pendingOTelEvents:[],meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:{direct:null,proxied:null},foundryDeploymentCapabilities:new Map,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginsNoMcp:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,teammateAgentId:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,loopEnded:!1,sessionCreatedTeams:new Set,surfacedHookSpawnFailures:new Set,bareMcpServerMatchersWarned:new Set,inheritedTeamName:void 0,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,longContext1mCreditsBlocked:!1,fableCreditsRequired:!1,fableConsentSessionFallback:!1,fableBridgeDialogTimedOut:!1,fableConsentDialogInteracted:!1,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:xA,replBridgeActive:!1,mainLoopBusy:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,deferredToolStubGateLatch:null,strictMcpConfig:!1,cliSessionConfigCarried:!1,sessionApprovedMcpServers:[],activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:Yw(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var MA=kA(),EA=()=>{return};function Bm(){return EA()?.sessionId??MA.sessionId}var IA=Di(),MV=IA.subscribe;function eS(e){return process.platform==="darwin"?e.normalize("NFC"):e}var $A=Di(),EV=$A.subscribe;var TA=Di(),IV=TA.subscribe;var PA=Di();var $V=PA.subscribe;var AA=Di();var TV=AA.subscribe;var{appendFile:Z2,mkdir:hC,rename:K2,stat:pC,symlink:mC,unlink:Pv}=(()=>({}));Dn();function uS({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,h=null,v=null;function b(){if(h)clearTimeout(h),h=null}function _(M){try{e(M)}catch{}}function g(){if(v)_(v.join("")),v=null;if(o.length===0)return;_(o.join("")),o=[],s=0,b()}function S(){if(!h)h=setTimeout(g,t)}function x(){if(v){v.push(...o),o=[],s=0,b();return}let M=o;o=[],s=0,b(),v=M,setImmediate(()=>{let I=v;if(v=null,I)_(I.join(""))})}return{write(M){if(n){_(M);return}if(o.push(M),s+=M.length,S(),o.length>=r||s>=i)x()},flush:g,dispose(){g()}}}var{realpathSync:OV}=(()=>({}));var Wc=function(){return"/"};Dn();function Wm(e){return process.platform==="darwin"?e.normalize("NFC"):e}function cS(e){return/^[\\/]{2}/.test(e)}function dS(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function OA(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function fS(e){if(/^\\\\\?\\volume\{/i.test(e))return lS(e);let t=OA(e);if(t!==e&&lS(t))return!0;return cS(t)&&!dS(t)}function lS(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)||e.includes("/")}function DA(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class Gm{#e=new Set;register(e){let t=DA(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var NA=new Gm;function hS(e){return NA.register(e)}var jV=new Gm;var pS=Er((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function zA(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function jA(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function mS(e,t){if(!t)return!0;let r=zA(e);return jA(r,t)}Dn();var qe={};wn(qe,{xid:()=>jR,void:()=>o5,uuidv7:()=>AR,uuidv6:()=>PR,uuidv4:()=>TR,uuid:()=>$R,url:()=>RR,uppercase:()=>vu,unknown:()=>qt,union:()=>Dt,undefined:()=>n5,ulid:()=>zR,uint64:()=>t5,uint32:()=>YR,tuple:()=>l5,trim:()=>ku,treeifyError:()=>Yc,transform:()=>zy,toUpperCase:()=>Eu,toLowerCase:()=>Mu,toJSONSchema:()=>xs,templateLiteral:()=>v5,symbol:()=>r5,superRefine:()=>xx,success:()=>g5,stringbool:()=>w5,stringFormat:()=>WR,string:()=>de,strictObject:()=>u5,startsWith:()=>_u,size:()=>mu,setErrorMap:()=>k5,set:()=>f5,safeParseAsync:()=>hy,safeParse:()=>fy,registry:()=>Va,regexes:()=>Fi,regex:()=>gu,refine:()=>Sx,record:()=>Nt,readonly:()=>gx,property:()=>ny,promise:()=>b5,prettifyError:()=>Qc,preprocess:()=>Gf,prefault:()=>lx,positive:()=>Qg,pipe:()=>qf,partialRecord:()=>c5,parseAsync:()=>dy,parse:()=>cy,overwrite:()=>fi,optional:()=>Lt,object:()=>Qe,number:()=>It,nullish:()=>m5,nullable:()=>Ff,null:()=>Bf,normalize:()=>xu,nonpositive:()=>ty,nonoptional:()=>cx,nonnegative:()=>ry,never:()=>Hf,negative:()=>ey,nativeEnum:()=>h5,nanoid:()=>OR,nan:()=>y5,multipleOf:()=>Eo,minSize:()=>Io,minLength:()=>Hi,mime:()=>Su,maxSize:()=>_s,maxLength:()=>ws,map:()=>d5,lte:()=>kn,lt:()=>ci,lowercase:()=>yu,looseObject:()=>Lr,locales:()=>vs,literal:()=>tt,length:()=>Ss,lazy:()=>bx,ksuid:()=>UR,keyof:()=>a5,jwt:()=>VR,json:()=>S5,iso:()=>ks,ipv6:()=>FR,ipv4:()=>LR,intersection:()=>Cu,int64:()=>e5,int32:()=>XR,int:()=>py,instanceof:()=>_5,includes:()=>bu,guid:()=>IR,gte:()=>rn,gt:()=>di,globalRegistry:()=>tn,getErrorMap:()=>M5,function:()=>Of,formatError:()=>fs,float64:()=>JR,float32:()=>GR,flattenError:()=>ds,file:()=>p5,enum:()=>Vr,endsWith:()=>wu,emoji:()=>CR,email:()=>ER,e164:()=>KR,discriminatedUnion:()=>Vf,date:()=>s5,custom:()=>Fy,cuid2:()=>NR,cuid:()=>DR,core:()=>Nn,config:()=>rr,coerce:()=>qy,clone:()=>Ur,cidrv6:()=>BR,cidrv4:()=>qR,check:()=>wx,catch:()=>hx,boolean:()=>or,bigint:()=>QR,base64url:()=>ZR,base64:()=>HR,array:()=>_t,any:()=>i5,_default:()=>ax,_ZodString:()=>my,ZodXID:()=>xy,ZodVoid:()=>JS,ZodUnknown:()=>WS,ZodUnion:()=>Oy,ZodUndefined:()=>ZS,ZodUUID:()=>hi,ZodURL:()=>yy,ZodULID:()=>Sy,ZodType:()=>vt,ZodTuple:()=>ex,ZodTransform:()=>Ny,ZodTemplateLiteral:()=>yx,ZodSymbol:()=>HS,ZodSuccess:()=>dx,ZodStringFormat:()=>Ut,ZodString:()=>Tu,ZodSet:()=>rx,ZodRecord:()=>Dy,ZodRealError:()=>Ms,ZodReadonly:()=>mx,ZodPromise:()=>_x,ZodPrefault:()=>ux,ZodPipe:()=>Ly,ZodOptional:()=>jy,ZodObject:()=>Kf,ZodNumberFormat:()=>Es,ZodNumber:()=>Pu,ZodNullable:()=>ox,ZodNull:()=>KS,ZodNonOptional:()=>Uy,ZodNever:()=>GS,ZodNanoID:()=>by,ZodNaN:()=>px,ZodMap:()=>tx,ZodLiteral:()=>nx,ZodLazy:()=>vx,ZodKSUID:()=>ky,ZodJWT:()=>Ry,ZodIssueCode:()=>x5,ZodIntersection:()=>QS,ZodISOTime:()=>jf,ZodISODuration:()=>Uf,ZodISODateTime:()=>Nf,ZodISODate:()=>zf,ZodIPv6:()=>Ey,ZodIPv4:()=>My,ZodGUID:()=>Lf,ZodFile:()=>ix,ZodError:()=>kR,ZodEnum:()=>$u,ZodEmoji:()=>vy,ZodEmail:()=>gy,ZodE164:()=>Ay,ZodDiscriminatedUnion:()=>YS,ZodDefault:()=>sx,ZodDate:()=>Zf,ZodCustomStringFormat:()=>BS,ZodCustom:()=>Wf,ZodCatch:()=>fx,ZodCUID2:()=>wy,ZodCUID:()=>_y,ZodCIDRv6:()=>$y,ZodCIDRv4:()=>Iy,ZodBoolean:()=>Au,ZodBigIntFormat:()=>Cy,ZodBigInt:()=>Ru,ZodBase64URL:()=>Py,ZodBase64:()=>Ty,ZodArray:()=>XS,ZodAny:()=>VS,TimePrecision:()=>cf,NEVER:()=>Gc,$output:()=>af,$input:()=>uf,$brand:()=>Jc});var Nn={};wn(Nn,{version:()=>Q0,util:()=>Be,treeifyError:()=>Yc,toJSONSchema:()=>xs,toDotPath:()=>vS,safeParseAsync:()=>Li,safeParse:()=>Ui,registry:()=>Va,regexes:()=>Fi,prettifyError:()=>Qc,parseAsync:()=>So,parse:()=>wo,locales:()=>vs,isValidJWT:()=>NS,isValidBase64URL:()=>DS,isValidBase64:()=>og,globalRegistry:()=>tn,globalConfig:()=>Ra,function:()=>Of,formatError:()=>fs,flattenError:()=>ds,config:()=>rr,clone:()=>Ur,_xid:()=>ou,_void:()=>Ef,_uuidv7:()=>Ya,_uuidv6:()=>Xa,_uuidv4:()=>Ja,_uuid:()=>Ga,_url:()=>Qa,_uppercase:()=>vu,_unknown:()=>Mo,_union:()=>rR,_undefined:()=>Sf,_ulid:()=>iu,_uint64:()=>_f,_uint32:()=>gf,_tuple:()=>iy,_trim:()=>ku,_transform:()=>dR,_toUpperCase:()=>Eu,_toLowerCase:()=>Mu,_templateLiteral:()=>_R,_symbol:()=>wf,_success:()=>gR,_stringbool:()=>Rf,_stringFormat:()=>Cf,_string:()=>lf,_startsWith:()=>_u,_size:()=>mu,_set:()=>aR,_safeParseAsync:()=>nd,_safeParse:()=>rd,_regex:()=>gu,_refine:()=>Af,_record:()=>oR,_readonly:()=>bR,_property:()=>ny,_promise:()=>SR,_positive:()=>Qg,_pipe:()=>vR,_parseAsync:()=>td,_parse:()=>ed,_overwrite:()=>fi,_optional:()=>fR,_number:()=>df,_nullable:()=>hR,_null:()=>xf,_normalize:()=>xu,_nonpositive:()=>ty,_nonoptional:()=>mR,_nonnegative:()=>ry,_never:()=>Mf,_negative:()=>ey,_nativeEnum:()=>lR,_nanoid:()=>tu,_nan:()=>$f,_multipleOf:()=>Eo,_minSize:()=>Io,_minLength:()=>Hi,_min:()=>rn,_mime:()=>Su,_maxSize:()=>_s,_maxLength:()=>ws,_max:()=>kn,_map:()=>sR,_lte:()=>kn,_lt:()=>ci,_lowercase:()=>yu,_literal:()=>cR,_length:()=>Ss,_lazy:()=>wR,_ksuid:()=>su,_jwt:()=>pu,_isoTime:()=>Vg,_isoDuration:()=>Wg,_isoDateTime:()=>Zg,_isoDate:()=>Kg,_ipv6:()=>uu,_ipv4:()=>au,_intersection:()=>iR,_int64:()=>bf,_int32:()=>mf,_int:()=>ff,_includes:()=>bu,_guid:()=>bs,_gte:()=>rn,_gt:()=>di,_float64:()=>pf,_float32:()=>hf,_file:()=>Tf,_enum:()=>uR,_endsWith:()=>wu,_emoji:()=>eu,_email:()=>Wa,_e164:()=>hu,_discriminatedUnion:()=>nR,_default:()=>pR,_date:()=>If,_custom:()=>Pf,_cuid2:()=>nu,_cuid:()=>ru,_coercedString:()=>Hg,_coercedNumber:()=>Gg,_coercedDate:()=>Yg,_coercedBoolean:()=>Jg,_coercedBigint:()=>Xg,_cidrv6:()=>cu,_cidrv4:()=>lu,_catch:()=>yR,_boolean:()=>yf,_bigint:()=>vf,_base64url:()=>fu,_base64:()=>du,_array:()=>Iu,_any:()=>kf,TimePrecision:()=>cf,NEVER:()=>Gc,JSONSchemaGenerator:()=>Df,JSONSchema:()=>LS,Doc:()=>ad,$output:()=>af,$input:()=>uf,$constructor:()=>ne,$brand:()=>Jc,$ZodXID:()=>bd,$ZodVoid:()=>zd,$ZodUnknown:()=>ko,$ZodUnion:()=>Ha,$ZodUndefined:()=>Cd,$ZodUUID:()=>dd,$ZodURL:()=>hd,$ZodULID:()=>vd,$ZodType:()=>ut,$ZodTuple:()=>Bi,$ZodTransform:()=>gs,$ZodTemplateLiteral:()=>rf,$ZodSymbol:()=>Rd,$ZodSuccess:()=>Yd,$ZodStringFormat:()=>Ot,$ZodString:()=>qi,$ZodSet:()=>Bd,$ZodRegistry:()=>Ka,$ZodRecord:()=>Fd,$ZodRealError:()=>cs,$ZodReadonly:()=>tf,$ZodPromise:()=>nf,$ZodPrefault:()=>Jd,$ZodPipe:()=>ys,$ZodOptional:()=>Vd,$ZodObject:()=>Ba,$ZodNumberFormat:()=>Pd,$ZodNumber:()=>Fa,$ZodNullable:()=>Wd,$ZodNull:()=>Od,$ZodNonOptional:()=>Xd,$ZodNever:()=>Nd,$ZodNanoID:()=>md,$ZodNaN:()=>ef,$ZodMap:()=>qd,$ZodLiteral:()=>Zd,$ZodLazy:()=>of,$ZodKSUID:()=>_d,$ZodJWT:()=>$d,$ZodIntersection:()=>Ld,$ZodISOTime:()=>ng,$ZodISODuration:()=>ig,$ZodISODateTime:()=>tg,$ZodISODate:()=>rg,$ZodIPv6:()=>Sd,$ZodIPv4:()=>wd,$ZodGUID:()=>cd,$ZodFunction:()=>oy,$ZodFile:()=>Kd,$ZodError:()=>La,$ZodEnum:()=>Hd,$ZodEmoji:()=>pd,$ZodEmail:()=>fd,$ZodE164:()=>Id,$ZodDiscriminatedUnion:()=>Ud,$ZodDefault:()=>Gd,$ZodDate:()=>jd,$ZodCustomStringFormat:()=>Td,$ZodCustom:()=>sf,$ZodCheckUpperCase:()=>K0,$ZodCheckStringFormat:()=>hs,$ZodCheckStartsWith:()=>W0,$ZodCheckSizeEquals:()=>L0,$ZodCheckRegex:()=>H0,$ZodCheckProperty:()=>J0,$ZodCheckOverwrite:()=>Y0,$ZodCheckNumberFormat:()=>N0,$ZodCheckMultipleOf:()=>D0,$ZodCheckMinSize:()=>U0,$ZodCheckMinLength:()=>q0,$ZodCheckMimeType:()=>X0,$ZodCheckMaxSize:()=>j0,$ZodCheckMaxLength:()=>F0,$ZodCheckLowerCase:()=>Z0,$ZodCheckLessThan:()=>od,$ZodCheckLengthEquals:()=>B0,$ZodCheckIncludes:()=>V0,$ZodCheckGreaterThan:()=>sd,$ZodCheckEndsWith:()=>G0,$ZodCheckBigIntFormat:()=>z0,$ZodCheck:()=>Ht,$ZodCatch:()=>Qd,$ZodCUID2:()=>yd,$ZodCUID:()=>gd,$ZodCIDRv6:()=>kd,$ZodCIDRv4:()=>xd,$ZodBoolean:()=>ps,$ZodBigIntFormat:()=>Ad,$ZodBigInt:()=>qa,$ZodBase64URL:()=>Ed,$ZodBase64:()=>Md,$ZodAsyncError:()=>ui,$ZodArray:()=>ms,$ZodAny:()=>Dd});var Gc=Object.freeze({status:"aborted"});function ne(e,t,r){function i(h,v){var b;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(b=h._zod).traits??(b.traits=new Set),h._zod.traits.add(e),t(h,v);for(let _ in s.prototype)if(!(_ in h))Object.defineProperty(h,_,{value:s.prototype[_].bind(h)});h._zod.constr=s,h._zod.def=v}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:e});function s(h){var v;let b=r?.Parent?new o:this;i(b,h),(v=b._zod).deferred??(v.deferred=[]);for(let _ of b._zod.deferred)_();return b}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var Jc=Symbol("zod_brand");class ui extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Ra={};function rr(e){if(e)Object.assign(Ra,e);return Ra}var Be={};wn(Be,{unwrapMessage:()=>Ca,stringifyPrimitive:()=>Ve,required:()=>t9,randomString:()=>KA,propertyKeyTypes:()=>za,promiseAllObject:()=>ZA,primitiveTypes:()=>t0,prefixIssues:()=>en,pick:()=>JA,partial:()=>e9,optionalKeys:()=>r0,omit:()=>XA,numKeys:()=>VA,nullish:()=>ji,normalizeParams:()=>Fe,merge:()=>QA,jsonStringifyReplacer:()=>Xm,joinValues:()=>be,issue:()=>o0,isPlainObject:()=>ls,isObject:()=>us,getSizableOrigin:()=>ja,getParsedType:()=>WA,getLengthableOrigin:()=>Ua,getEnumValues:()=>Oa,getElementAtPath:()=>HA,floatSafeRemainder:()=>Ym,finalizeIssue:()=>fn,extend:()=>YA,escapeRegex:()=>li,esc:()=>bo,defineLazy:()=>$t,createTransparentProxy:()=>GA,clone:()=>Ur,cleanRegex:()=>Na,cleanEnum:()=>r9,captureStackTrace:()=>Xc,cached:()=>Da,assignProp:()=>Qm,assertNotEqual:()=>LA,assertNever:()=>qA,assertIs:()=>FA,assertEqual:()=>UA,assert:()=>BA,allowsEval:()=>e0,aborted:()=>_o,NUMBER_FORMAT_RANGES:()=>n0,Class:()=>gS,BIGINT_FORMAT_RANGES:()=>i0});function UA(e){return e}function LA(e){return e}function FA(e){}function qA(e){throw Error()}function BA(e){}function Oa(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function be(e,t="|"){return e.map((r)=>Ve(r)).join(t)}function Xm(e,t){if(typeof t==="bigint")return t.toString();return t}function Da(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function ji(e){return e===null||e===void 0}function Na(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ym(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}function $t(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Qm(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function HA(e,t){if(!t)return e;return t.reduce((r,i)=>r?.[i],e)}function ZA(e){let t=Object.keys(e),r=t.map((i)=>e[i]);return Promise.all(r).then((i)=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function KA(e=10){let r="";for(let i=0;i<e;i++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function bo(e){return JSON.stringify(e)}var Xc=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function us(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var e0=Da(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ls(e){if(us(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(us(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function VA(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var WA=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},za=new Set(["string","number","symbol"]),t0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function li(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ur(e,t,r){let i=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)i._zod.parent=e;return i}function Fe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function GA(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function Ve(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function r0(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var n0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},i0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function JA(e,t){let r={},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=i.shape[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function XA(e,t){let r={...e._zod.def.shape},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function YA(e,t){if(!ls(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let i={...e._zod.def.shape,...t};return Qm(this,"shape",i),i},checks:[]};return Ur(e,r)}function QA(e,t){return Ur(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Qm(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function e9(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in i))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=e?new e({type:"optional",innerType:i[o]}):i[o]}else for(let o in i)n[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return Ur(t,{...t._zod.def,shape:n,checks:[]})}function t9(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in n))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=new e({type:"nonoptional",innerType:i[o]})}else for(let o in i)n[o]=new e({type:"nonoptional",innerType:i[o]});return Ur(t,{...t._zod.def,shape:n,checks:[]})}function _o(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function en(e,t){return t.map((r)=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Ca(e){return typeof e==="string"?e:e?.message}function fn(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let n=Ca(e.inst?._zod.def?.error?.(e))??Ca(t?.error?.(e))??Ca(r.customError?.(e))??Ca(r.localeError?.(e))??"Invalid input";i.message=n}if(delete i.inst,delete i.continue,!t?.reportInput)delete i.input;return i}function ja(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Ua(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function o0(...e){let[t,r,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:i};return{...t}}function r9(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}class gS{constructor(...e){}}var yS=(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,Xm,2)},enumerable:!0})},La=ne("$ZodError",yS),cs=ne("$ZodError",yS,{Parent:Error});function ds(e,t=(r)=>r.message){let r={},i=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else i.push(t(n));return{formErrors:i,fieldErrors:r}}function fs(e,t){let r=t||function(o){return o.message},i={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((h)=>n({issues:h}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)i._errors.push(r(s));else{let h=i,v=0;while(v<s.path.length){let b=s.path[v];if(v!==s.path.length-1)h[b]=h[b]||{_errors:[]};else h[b]=h[b]||{_errors:[]},h[b]._errors.push(r(s));h=h[b],v++}}};return n(e),i}function Yc(e,t){let r=t||function(o){return o.message},i={errors:[]},n=(o,s=[])=>{var h,v;for(let b of o.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((_)=>n({issues:_},b.path));else if(b.code==="invalid_key")n({issues:b.issues},b.path);else if(b.code==="invalid_element")n({issues:b.issues},b.path);else{let _=[...s,...b.path];if(_.length===0){i.errors.push(r(b));continue}let g=i,S=0;while(S<_.length){let x=_[S],M=S===_.length-1;if(typeof x==="string")g.properties??(g.properties={}),(h=g.properties)[x]??(h[x]={errors:[]}),g=g.properties[x];else g.items??(g.items=[]),(v=g.items)[x]??(v[x]={errors:[]}),g=g.items[x];if(M)g.errors.push(r(b));S++}}};return n(e),i}function vS(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function Qc(e){let t=[],r=[...e.issues].sort((i,n)=>i.path.length-n.path.length);for(let i of r)if(t.push(`✖ ${i.message}`),i.path?.length)t.push(` → at ${vS(i.path)}`);return t.join(`
|
|
27
27
|
`)}var ed=(e)=>(t,r,i,n)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ui;if(s.issues.length){let h=new(n?.Err??e)(s.issues.map((v)=>fn(v,o,rr())));throw Xc(h,n?.callee),h}return s.value},wo=ed(cs),td=(e)=>async(t,r,i,n)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;if(s.issues.length){let h=new(n?.Err??e)(s.issues.map((v)=>fn(v,o,rr())));throw Xc(h,n?.callee),h}return s.value},So=td(cs),rd=(e)=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new ui;return o.issues.length?{success:!1,error:new(e??La)(o.issues.map((s)=>fn(s,n,rr())))}:{success:!0,data:o.value}},Ui=rd(cs),nd=(e)=>async(t,r,i)=>{let n=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length?{success:!1,error:new e(o.issues.map((s)=>fn(s,n,rr())))}:{success:!0,data:o.value}},Li=nd(cs);var Fi={};wn(Fi,{xid:()=>l0,uuid7:()=>a9,uuid6:()=>s9,uuid4:()=>o9,uuid:()=>xo,uppercase:()=>O0,unicodeEmail:()=>c9,undefined:()=>R0,ulid:()=>u0,time:()=>k0,string:()=>E0,rfc5322Email:()=>l9,number:()=>T0,null:()=>A0,nanoid:()=>d0,lowercase:()=>C0,ksuid:()=>c0,ipv6:()=>y0,ipv4:()=>g0,integer:()=>$0,html5Email:()=>u9,hostname:()=>w0,guid:()=>h0,extendedDuration:()=>i9,emoji:()=>m0,email:()=>p0,e164:()=>S0,duration:()=>f0,domain:()=>h9,datetime:()=>M0,date:()=>x0,cuid2:()=>a0,cuid:()=>s0,cidrv6:()=>b0,cidrv4:()=>v0,browserEmail:()=>d9,boolean:()=>P0,bigint:()=>I0,base64url:()=>id,base64:()=>_0,_emoji:()=>f9});var s0=/^[cC][^\s-]{8,}$/,a0=/^[0-9a-z]+$/,u0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,l0=/^[0-9a-vA-V]{20}$/,c0=/^[A-Za-z0-9]{27}$/,d0=/^[a-zA-Z0-9_-]{21}$/,f0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,i9=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,h0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xo=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},o9=xo(4),s9=xo(6),a9=xo(7),p0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,u9=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,l9=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,c9=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,d9=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,f9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function m0(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var g0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,y0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,v0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,b0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,id=/^[A-Za-z0-9_-]*$/,w0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,h9=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,S0=/^\+(?:[0-9]){6,14}[0-9]$/,bS="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",x0=new RegExp(`^${bS}$`);function _S(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function k0(e){return new RegExp(`^${_S(e)}$`)}function M0(e){let t=_S({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let i=`${t}(?:${r.join("|")})`;return new RegExp(`^${bS}T(?:${i})$`)}var E0=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},I0=/^\d+n?$/,$0=/^\d+$/,T0=/^-?\d+(?:\.\d+)?/i,P0=/true|false/i,A0=/null/i;var R0=/undefined/i;var C0=/^[^A-Z]*$/,O0=/^[^a-z]*$/;var Ht=ne("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),SS={number:"number",bigint:"bigint",object:"date"},od=ne("$ZodCheckLessThan",(e,t)=>{Ht.init(e,t);let r=SS[typeof t.value];e._zod.onattach.push((i)=>{let n=i._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<o)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:r,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sd=ne("$ZodCheckGreaterThan",(e,t)=>{Ht.init(e,t);let r=SS[typeof t.value];e._zod.onattach.push((i)=>{let n=i._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>o)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:r,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),D0=ne("$ZodCheckMultipleOf",(e,t)=>{Ht.init(e,t),e._zod.onattach.push((r)=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Ym(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),N0=ne("$ZodCheckNumberFormat",(e,t)=>{Ht.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,o]=n0[t.format];e._zod.onattach.push((s)=>{let h=s._zod.bag;if(h.format=t.format,h.minimum=n,h.maximum=o,r)h.pattern=$0}),e._zod.check=(s)=>{let h=s.value;if(r){if(!Number.isInteger(h)){s.issues.push({expected:i,format:t.format,code:"invalid_type",input:h,inst:e});return}if(!Number.isSafeInteger(h)){if(h>0)s.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});else s.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}if(h<n)s.issues.push({origin:"number",input:h,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(h>o)s.issues.push({origin:"number",input:h,code:"too_big",maximum:o,inst:e})}}),z0=ne("$ZodCheckBigIntFormat",(e,t)=>{Ht.init(e,t);let[r,i]=i0[t.format];e._zod.onattach.push((n)=>{let o=n._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i}),e._zod.check=(n)=>{let o=n.value;if(o<r)n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(o>i)n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:e})}}),j0=ne("$ZodCheckMaxSize",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.size!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let i=r.value;if(i.size<=t.maximum)return;r.issues.push({origin:ja(i),code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),U0=ne("$ZodCheckMinSize",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.size!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let i=r.value;if(i.size>=t.minimum)return;r.issues.push({origin:ja(i),code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),L0=ne("$ZodCheckSizeEquals",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.size!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=(r)=>{let i=r.value,n=i.size;if(n===t.size)return;let o=n>t.size;r.issues.push({origin:ja(i),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),F0=ne("$ZodCheckMaxLength",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.length!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let i=r.value;if(i.length<=t.maximum)return;let o=Ua(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),q0=ne("$ZodCheckMinLength",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.length!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let i=r.value;if(i.length>=t.minimum)return;let o=Ua(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),B0=ne("$ZodCheckLengthEquals",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.length!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=(r)=>{let i=r.value,n=i.length;if(n===t.length)return;let o=Ua(i),s=n>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),hs=ne("$ZodCheckStringFormat",(e,t)=>{var r,i;if(Ht.init(e,t),e._zod.onattach.push((n)=>{let o=n._zod.bag;if(o.format=t.format,t.pattern)o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),H0=ne("$ZodCheckRegex",(e,t)=>{hs.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Z0=ne("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=C0),hs.init(e,t)}),K0=ne("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=O0),hs.init(e,t)}),V0=ne("$ZodCheckIncludes",(e,t)=>{Ht.init(e,t);let r=li(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),W0=ne("$ZodCheckStartsWith",(e,t)=>{Ht.init(e,t);let r=new RegExp(`^${li(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((i)=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),G0=ne("$ZodCheckEndsWith",(e,t)=>{Ht.init(e,t);let r=new RegExp(`.*${li(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((i)=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function wS(e,t,r){if(e.issues.length)t.issues.push(...en(r,e.issues))}var J0=ne("$ZodCheckProperty",(e,t)=>{Ht.init(e,t),e._zod.check=(r)=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then((n)=>wS(n,r,t.property));wS(i,r,t.property);return}}),X0=ne("$ZodCheckMimeType",(e,t)=>{Ht.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((i)=>{i._zod.bag.mime=t.mime}),e._zod.check=(i)=>{if(r.has(i.value.type))return;i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e})}}),Y0=ne("$ZodCheckOverwrite",(e,t)=>{Ht.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class ad{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
28
28
|
`).filter((o)=>o),i=Math.min(...r.map((o)=>o.length-o.trimStart().length)),n=r.map((o)=>o.slice(i)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of n)this.content.push(o)}compile(){let e=Function,t=this?.args,i=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,i.join(`
|
|
29
29
|
`))}}var Q0={major:4,minor:0,patch:0};var ut=ne("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Q0;let i=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))i.unshift(e);for(let n of i)for(let o of n._zod.onattach)o(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(o,s,h)=>{let v=_o(o),b;for(let _ of s){if(_._zod.when){if(!_._zod.when(o))continue}else if(v)continue;let g=o.issues.length,S=_._zod.check(o);if(S instanceof Promise&&h?.async===!1)throw new ui;if(b||S instanceof Promise)b=(b??Promise.resolve()).then(async()=>{if(await S,o.issues.length===g)return;if(!v)v=_o(o,g)});else{if(o.issues.length===g)continue;if(!v)v=_o(o,g)}}if(b)return b.then(()=>o);return o};e._zod.run=(o,s)=>{let h=e._zod.parse(o,s);if(h instanceof Promise){if(s.async===!1)throw new ui;return h.then((v)=>n(v,i,s))}return n(h,i,s)}}e["~standard"]={validate:(n)=>{try{let o=Ui(e,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch(o){return Li(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),qi=ne("$ZodString",(e,t)=>{ut.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??E0(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ot=ne("$ZodStringFormat",(e,t)=>{hs.init(e,t),qi.init(e,t)}),cd=ne("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=h0),Ot.init(e,t)}),dd=ne("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xo(i))}else t.pattern??(t.pattern=xo());Ot.init(e,t)}),fd=ne("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=p0),Ot.init(e,t)}),hd=ne("$ZodURL",(e,t)=>{Ot.init(e,t),e._zod.check=(r)=>{try{let i=r.value,n=new URL(i),o=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:w0.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!i.endsWith("/")&&o.endsWith("/"))r.value=o.slice(0,-1);else r.value=o;return}catch(i){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),pd=ne("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=m0()),Ot.init(e,t)}),md=ne("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=d0),Ot.init(e,t)}),gd=ne("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=s0),Ot.init(e,t)}),yd=ne("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=a0),Ot.init(e,t)}),vd=ne("$ZodULID",(e,t)=>{t.pattern??(t.pattern=u0),Ot.init(e,t)}),bd=ne("$ZodXID",(e,t)=>{t.pattern??(t.pattern=l0),Ot.init(e,t)}),_d=ne("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=c0),Ot.init(e,t)}),tg=ne("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=M0(t)),Ot.init(e,t)}),rg=ne("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=x0),Ot.init(e,t)}),ng=ne("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=k0(t)),Ot.init(e,t)}),ig=ne("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=f0),Ot.init(e,t)}),wd=ne("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=g0),Ot.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format="ipv4"})}),Sd=ne("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=y0),Ot.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),xd=ne("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=v0),Ot.init(e,t)}),kd=ne("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=b0),Ot.init(e,t),e._zod.check=(r)=>{let[i,n]=r.value.split("/");try{if(!n)throw Error();let o=Number(n);if(`${o}`!==n)throw Error();if(o<0||o>128)throw Error();new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function og(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Md=ne("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_0),Ot.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(og(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function DS(e){if(!id.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return og(r)}var Ed=ne("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=id),Ot.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(DS(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Id=ne("$ZodE164",(e,t)=>{t.pattern??(t.pattern=S0),Ot.init(e,t)});function NS(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var $d=ne("$ZodJWT",(e,t)=>{Ot.init(e,t),e._zod.check=(r)=>{if(NS(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Td=ne("$ZodCustomStringFormat",(e,t)=>{Ot.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Fa=ne("$ZodNumber",(e,t)=>{ut.init(e,t),e._zod.pattern=e._zod.bag.pattern??T0,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let o=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),r}}),Pd=ne("$ZodNumber",(e,t)=>{N0.init(e,t),Fa.init(e,t)}),ps=ne("$ZodBoolean",(e,t)=>{ut.init(e,t),e._zod.pattern=P0,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),qa=ne("$ZodBigInt",(e,t)=>{ut.init(e,t),e._zod.pattern=I0,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Ad=ne("$ZodBigInt",(e,t)=>{z0.init(e,t),qa.init(e,t)}),Rd=ne("$ZodSymbol",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Cd=ne("$ZodUndefined",(e,t)=>{ut.init(e,t),e._zod.pattern=R0,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,i)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Od=ne("$ZodNull",(e,t)=>{ut.init(e,t),e._zod.pattern=A0,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Dd=ne("$ZodAny",(e,t)=>{ut.init(e,t),e._zod.parse=(r)=>r}),ko=ne("$ZodUnknown",(e,t)=>{ut.init(e,t),e._zod.parse=(r)=>r}),Nd=ne("$ZodNever",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),zd=ne("$ZodVoid",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),jd=ne("$ZodDate",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(h){}let n=r.value,o=n instanceof Date;if(o&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:e}),r}});function kS(e,t,r){if(e.issues.length)t.issues.push(...en(r,e.issues));t.value[r]=e.value}var ms=ne("$ZodArray",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let o=[];for(let s=0;s<n.length;s++){let h=n[s],v=t.element._zod.run({value:h,issues:[]},i);if(v instanceof Promise)o.push(v.then((b)=>kS(b,r,s)));else kS(v,r,s)}if(o.length)return Promise.all(o).then(()=>r);return r}});function ud(e,t,r){if(e.issues.length)t.issues.push(...en(r,e.issues));t.value[r]=e.value}function MS(e,t,r,i){if(e.issues.length)if(i[r]===void 0)if(r in i)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...en(r,e.issues));else if(e.value===void 0){if(r in i)t.value[r]=void 0}else t.value[r]=e.value}var Ba=ne("$ZodObject",(e,t)=>{ut.init(e,t);let r=Da(()=>{let g=Object.keys(t.shape);for(let x of g)if(!(t.shape[x]instanceof ut))throw Error(`Invalid element at key "${x}": expected a Zod schema`);let S=r0(t.shape);return{shape:t.shape,keys:g,keySet:new Set(g),numKeys:g.length,optionalKeys:new Set(S)}});$t(e._zod,"propValues",()=>{let g=t.shape,S={};for(let x in g){let M=g[x]._zod;if(M.values){S[x]??(S[x]=new Set);for(let I of M.values)S[x].add(I)}}return S});let i=(g)=>{let S=new ad(["shape","payload","ctx"]),x=r.value,M=(P)=>{let R=bo(P);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};S.write("const input = payload.value;");let I=Object.create(null),$=0;for(let P of x.keys)I[P]=`key_${$++}`;S.write("const newResult = {}");for(let P of x.keys)if(x.optionalKeys.has(P)){let R=I[P];S.write(`const ${R} = ${M(P)};`);let C=bo(P);S.write(`
|
|
@@ -91,9 +91,9 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
91
91
|
|
|
92
92
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
93
93
|
`);this.baseURL=n.baseURL,this._baseURLIsExplicit=i.__baseURLIsExplicit??!!e,this.timeout=n.timeout??kv.DEFAULT_TIMEOUT,this.logger=n.logger??console;let o="warn";this.logLevel=o,this.logLevel=Yy(n.logLevel,"ClientOptions.logLevel",this)??Yy(Pt("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??o,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??jx(),We(this,$h,Lx,"f");let s=Pt("ANTHROPIC_CUSTOM_HEADERS");if(s){let v={};for(let b of s.split(`
|
|
94
|
-
`)){let _=b.indexOf(":");if(_>=0)v[b.substring(0,_).trim()]=b.substring(_+1).trim()}n.defaultHeaders={...v,...n.defaultHeaders}}let h=i.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let v=n.credentials??null;if(v)this._authState.provider=v,this._authState.tokenCache=this._makeTokenCache(v);else if(n.config!=null){let b=tv(n.config,this._credentialResolverOptions());this._authState.provider=b.provider,this._authState.tokenCache=this._makeTokenCache(b.provider),this._authState.extraHeaders=b.extraHeaders,this._applyCredentialBaseURL(b.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{nr(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{nr(this).warn(e)}}}_makeTokenCache(e){return new Jy(e,(t)=>{nr(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await o2(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Ye(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,_e([{Authorization:`Bearer ${t}`}])}return _e([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return _e([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return _e([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Fx(e)}getUserAgent(){return`${this.constructor.name}/JS ${Mn}`}defaultIdempotencyKey(){return`stainless-node-retry-${Hy()}`}makeStatusError(e,t,r,i){return wr.generate(e,t,r,i)}buildURL(e,t,r){let i=!oe(this,xv,"m",C2).call(this)&&r||this.baseURL,n=Px(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Vy(o)||!Vy(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Ye("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(To))i.append("anthropic-beta",To);e.headers=i}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new Po(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:h}=await this.buildRequest(i,{retryCount:n-t});await this.prepareRequest(o,{url:s,options:i});let v="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),b=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(nr(this).debug(`[${v}] sending request`,mi({retryOfRequestLogID:r,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Rr;let g=new AbortController,S=await this.fetchWithTimeout(s,o,h,g).catch(Ou),x=Date.now();if(S instanceof globalThis.Error){let $=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Rr;let T=pi(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):""));if(t)return nr(this).info(`[${v}] connection ${T?"timed out":"failed"} - ${$}`),nr(this).debug(`[${v}] connection ${T?"timed out":"failed"} (${$})`,mi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),this.retryRequest(i,t,r??v);if(nr(this).info(`[${v}] connection ${T?"timed out":"failed"} - error; no more retries left`),nr(this).debug(`[${v}] connection ${T?"timed out":"failed"} (error; no more retries left)`,mi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),T)throw new Du;throw new $o({cause:S})}let M=[...S.headers.entries()].filter(([$])=>$==="request-id").map(([$,T])=>", "+$+": "+JSON.stringify(T)).join(""),I=`[${v}${b}${M}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-_}ms`;if(!S.ok){let $=await this.shouldRetry(S,i);if(t&&$){let B=`retrying, ${t} attempts remaining`;return await Ux(S.body),nr(this).info(`${I} - ${B}`),nr(this).debug(`[${v}] response error (${B})`,mi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),this.retryRequest(i,t,r??v,S.headers)}let T=$?"error; no more retries left":"error; not retryable";nr(this).info(`${I} - ${T}`);let P=await S.text().catch((B)=>Ou(B).message),R=Xf(P),C=R?void 0:P;throw nr(this).debug(`[${v}] response error (${T})`,mi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:C,durationMs:Date.now()-_})),this.makeStatusError(S.status,R,C,S.headers)}return nr(this).info(I),nr(this).debug(`[${v}] response start`,mi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),{response:S,options:i,controller:g,requestLogID:v,retryOfRequestLogID:r,startTime:_}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new lh(this,r,e)}async fetchWithTimeout(e,t,r,i){let{signal:n,method:o,...s}=t||{},h=this._makeAbort(i);if(n)n.addEventListener("abort",h,{once:!0});let v=setTimeout(h,r),b=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,_={signal:i.signal,...b?{duplex:"half"}:{},method:"GET",...s};if(o)_.method=o.toUpperCase();try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(v)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);if(!Number.isNaN(h))n=h}let s=i?.get("retry-after");if(s&&!n){let h=parseFloat(s);if(!Number.isNaN(h))n=h*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let h=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,h)}return await Cx(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Ye("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(n,o,s);if("timeout"in r)Rx("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:v,body:b}=this.buildBody({options:r}),_=await this.buildHeaders({options:e,method:i,bodyHeaders:v,retryCount:t});return{req:{method:i,headers:_,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&b instanceof globalThis.ReadableStream&&{duplex:"half"},...b&&{body:b},...this.fetchOptions??{},...r.fetchOptions??{}},url:h,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=_e([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Hu(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=_e([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Yf(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return oe(this,$h,"f").call(this,{body:e,headers:r})}}kv=Yt,$h=new WeakMap,xv=new WeakSet,C2=function(){return this.baseURL!=="https://api.anthropic.com"};Yt.Anthropic=kv;Yt.HUMAN_PROMPT=O2;Yt.AI_PROMPT=D2;Yt.DEFAULT_TIMEOUT=600000;Yt.AnthropicError=Ye;Yt.APIError=wr;Yt.APIConnectionError=$o;Yt.APIConnectionTimeoutError=Du;Yt.APIUserAbortError=Rr;Yt.NotFoundError=Uu;Yt.ConflictError=Lu;Yt.RateLimitError=qu;Yt.BadRequestError=Nu;Yt.AuthenticationError=zu;Yt.InternalServerError=Bu;Yt.PermissionDeniedError=ju;Yt.UnprocessableEntityError=Fu;Yt.toFile=ch;class jo extends Yt{constructor(){super(...arguments);this.completions=new Us(this),this.messages=new zo(this),this.models=new Fs(this),this.beta=new Fr(this)}}jo.Completions=Us;jo.Messages=zo;jo.Models=Fs;jo.Beta=Fr;function L7(e){return e}function Il(e){return L7(e)}class Mv extends Error{telemetryMessage;constructor(e,t){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e}}function Ev(e){return e instanceof Error?e:Error(String(e))}function Th(e){return e instanceof Error?e.message:String(e)}function Uo(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function N2(e){return Uo(e)==="ENOENT"}function Iv(e){return Uo(e)==="EISDIR"}var dt=(()=>({}));var{appendFile:F7,chmod:q7,copyFile:B7,link:H7,lstat:Z7,mkdir:K7,open:z2,readdir:V7,readFile:j2,readlink:W7,realpath:G7,rename:J7,rmdir:X7,rm:Y7,stat:Q7,symlink:eC,unlink:tC}=(()=>({}));Dn();var Ph="→";var rC={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=Kt(r,Qt`fs.existsSync(${e})`,0);return dt.existsSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},async stat(e){return Q7(e)},async lstat(e){return Z7(e)},async readdir(e){return V7(e,{withFileTypes:!0})},async unlink(e){return tC(e)},async rmdir(e){return X7(e)},async rm(e,t){return Y7(e,t)},async mkdir(e,t){try{await K7(e,{recursive:!0,...t})}catch(r){if(Uo(r)!=="EEXIST")throw r}},async readFile(e,t){return j2(e,{encoding:t.encoding})},async rename(e,t){return J7(e,t)},async realpath(e){return Wm(await G7(e))},async readlink(e){return W7(e)},async copyFile(e,t){return B7(e,t)},async appendFile(e,t,r){if(r?.mode!==void 0)try{let i=await z2(e,"ax",r.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(Uo(i)!=="EEXIST")throw i}return F7(e,t)},async symlink(e,t,r){return eC(e,t,r)},async link(e,t){return H7(e,t)},async chmod(e,t){return q7(e,t)},statSync(e){let r=[];try{const t=Kt(r,Qt`fs.statSync(${e})`,0);return dt.statSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},lstatSync(e){let r=[];try{const t=Kt(r,Qt`fs.lstatSync(${e})`,0);return dt.lstatSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},readFileSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.readFileSync(${e})`,0);return dt.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},readFileBytesSync(e){let r=[];try{const t=Kt(r,Qt`fs.readFileBytesSync(${e})`,0);return dt.readFileSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},readSync(e,t){let n=[];try{const r=Kt(n,Qt`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=dt.openSync(e,"r");let v=Buffer.alloc(t.length),b=dt.readSync(i,v,0,t.length,0);return{buffer:v,bytesRead:b}}finally{if(i)dt.closeSync(i)}}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},appendFileSync(e,t,r){let n=[];try{const i=Kt(n,Qt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let v=dt.openSync(e,"ax",r.mode);try{dt.appendFileSync(v,t)}finally{dt.closeSync(v)}return}catch(v){if(Uo(v)!=="EEXIST")throw v}dt.appendFileSync(e,t)}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},copyFileSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.copyFileSync(${e} ${Ph} ${t})`,0);dt.copyFileSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},unlinkSync(e){let r=[];try{const t=Kt(r,Qt`fs.unlinkSync(${e})`,0);dt.unlinkSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},renameSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.renameSync(${e} ${Ph} ${t})`,0);dt.renameSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},linkSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.linkSync(${e} ${Ph} ${t})`,0);dt.linkSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},symlinkSync(e,t,r){let n=[];try{const i=Kt(n,Qt`fs.symlinkSync(${e} ${Ph} ${t})`,0);dt.symlinkSync(e,t,r)}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},readlinkSync(e){let r=[];try{const t=Kt(r,Qt`fs.readlinkSync(${e})`,0);return dt.readlinkSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},realpathSync(e){let r=[];try{const t=Kt(r,Qt`fs.realpathSync(${e})`,0);return Wm(dt.realpathSync(e))}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=Kt(n,Qt`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{dt.mkdirSync(e,i)}catch(v){if(Uo(v)!=="EEXIST")throw v}}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},readdirSync(e){let r=[];try{const t=Kt(r,Qt`fs.readdirSync(${e})`,0);return dt.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},readdirStringSync(e){let r=[];try{const t=Kt(r,Qt`fs.readdirStringSync(${e})`,0);return dt.readdirSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},rmdirSync(e){let r=[];try{const t=Kt(r,Qt`fs.rmdirSync(${e})`,0);dt.rmdirSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},rmSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.rmSync(${e})`,0);dt.rmSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},createWriteStream(e){return dt.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return j2(e);let r=await z2(e,"r");try{let{size:i}=await r.stat(),n=Math.min(i,t),o=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:h}=await r.read(o,s,n-s,s);if(h===0)break;s+=h}return s<n?o.subarray(0,s):o}finally{await r.close()}}},nC=rC;function Ah(){return nC}Dn();var{lstatSync:Yhe,readFileSync:Qhe,rmSync:epe,unlinkSync:tpe,writeFileSync:rpe}=(()=>({}));function iC(e,t){if(e.destroyed||e.writableEnded)return;e.write(t)}function U2(e){iC(process.stderr,e)}var oC=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,L2="[^\\s,;&}\\])]+",B2="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",sC=`[^\\s-]{0,4}${B2}['"\`]?`,F2=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${L2})|${sC}|${L2}`,aC=["sk","ant","api"].join("-"),uC=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${oC.source})[\\w.-]*["']?\\s*[=:]\\s*(${F2})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${F2})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${aC}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:B2,flags:"i",confidence:"high"}];var q2=null;function lC(e){return uC.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function cC(e,t){if(typeof t!=="string")return"[REDACTED]";let r=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",i=e.lastIndexOf(t);return`${e.slice(0,i)}${r}[REDACTED]${r}${e.slice(i+t.length)}`}var dC=512,fC=512,$l=new Map;function H2(e){let t=e.length<=dC;if(t){let i=$l.get(e);if(i!==void 0)return i}q2??=lC(!0);let r=e;for(let i of q2)r=r.replace(i.re,cC);if(t){if($l.size>=fC)$l.delete($l.keys().next().value);$l.set(e,r)}return r}var Av={verbose:0,debug:1,info:2,warn:3,error:4},gC=Er(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(Av,e))return e;return"debug"}),yC=!1;function Rh(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var G2=Er(()=>{let e=Rh();return yC||yo(process.env.DEBUG)||yo(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||J2()||e.some((t)=>t.startsWith("--debug="))||X2()!==null});var vC=Er(()=>{let e=Rh().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return pS(t)}),J2=Er(()=>{let e=Rh();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),X2=Er(()=>{let e=Rh();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return V2(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return V2(e[t+1])}return null});function V2(e){return fS(e)?null:Ni(e)}function bC(e){if(!G2())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=vC();return mS(e,t)}var _C=!1;var wC=10485760,Tl=null,$v=Promise.resolve(),qs=[],Al=null,W2=null;var Pl=-1,Tv=!1,Rv=null;async function SC(e,t,r=wC){if(Pl<0)Pl=await pC(e).then((i)=>i.size).catch(()=>0);else Pl+=t;if(Pl<=r||Tv)return;Tv=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await K2(e,i)}catch(n){if(!N2(n))await Pv(i).catch(()=>{}),await K2(e,i).catch(()=>Pv(e).catch(()=>{}))}Pl=0}finally{Tv=!1}}function Y2(e){return Rv=Yn(e,`${Bm()}.txt`),Rv}async function xC(e,t,r,i){if(e)await hC(t,{recursive:!0}).catch(()=>{});let n=r;try{await Z2(r,i)}catch(o){if(!Iv(o))throw o;n=Y2(r),await Z2(n,i)}await SC(n,Buffer.byteLength(i)).catch(Q2),EC()}function Q2(){}function kC(){qs.shift()}function MC(){if(!Tl){let e=null;if(Tl=uS({writeFn:(t)=>{if(Al){qs.push(t),Al();return}let r=Cv(),i=zi(r),n=e!==i;e=i,qs.push(t),$v=$v.then(xC.bind(null,n,i,r,t)).catch(Q2).then(kC)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:G2()}),hS(async()=>{Tl?.dispose(),await $v}),!W2)process.on("exit",W2=()=>{Al=()=>{if(qs.length===0)return;let t=qs.join("");qs.length=0;let r=Cv();try{Ah().mkdirSync(zi(r))}catch{}try{Ah().appendFileSync(r,t)}catch(i){if(Iv(i))try{Ah().appendFileSync(Y2(r),t)}catch{}}},Tl?.flush(),Al()})}return Tl}function Cr(e,{level:t}={level:"debug"}){if(Av[t]<Av[gC()])return;if(!bC(e))return;if(_C&&e.includes(`
|
|
94
|
+
`)){let _=b.indexOf(":");if(_>=0)v[b.substring(0,_).trim()]=b.substring(_+1).trim()}n.defaultHeaders={...v,...n.defaultHeaders}}let h=i.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let v=n.credentials??null;if(v)this._authState.provider=v,this._authState.tokenCache=this._makeTokenCache(v);else if(n.config!=null){let b=tv(n.config,this._credentialResolverOptions());this._authState.provider=b.provider,this._authState.tokenCache=this._makeTokenCache(b.provider),this._authState.extraHeaders=b.extraHeaders,this._applyCredentialBaseURL(b.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{nr(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{nr(this).warn(e)}}}_makeTokenCache(e){return new Jy(e,(t)=>{nr(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await o2(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Ye(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,_e([{Authorization:`Bearer ${t}`}])}return _e([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return _e([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return _e([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Fx(e)}getUserAgent(){return`${this.constructor.name}/JS ${Mn}`}defaultIdempotencyKey(){return`stainless-node-retry-${Hy()}`}makeStatusError(e,t,r,i){return wr.generate(e,t,r,i)}buildURL(e,t,r){let i=!oe(this,xv,"m",C2).call(this)&&r||this.baseURL,n=Px(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Vy(o)||!Vy(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Ye("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(To))i.append("anthropic-beta",To);e.headers=i}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new Po(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:h}=await this.buildRequest(i,{retryCount:n-t});await this.prepareRequest(o,{url:s,options:i});let v="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),b=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(nr(this).debug(`[${v}] sending request`,mi({retryOfRequestLogID:r,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Rr;let g=new AbortController,S=await this.fetchWithTimeout(s,o,h,g).catch(Ou),x=Date.now();if(S instanceof globalThis.Error){let $=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Rr;let T=pi(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):""));if(t)return nr(this).info(`[${v}] connection ${T?"timed out":"failed"} - ${$}`),nr(this).debug(`[${v}] connection ${T?"timed out":"failed"} (${$})`,mi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),this.retryRequest(i,t,r??v);if(nr(this).info(`[${v}] connection ${T?"timed out":"failed"} - error; no more retries left`),nr(this).debug(`[${v}] connection ${T?"timed out":"failed"} (error; no more retries left)`,mi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),T)throw new Du;throw new $o({cause:S})}let M=[...S.headers.entries()].filter(([$])=>$==="request-id").map(([$,T])=>", "+$+": "+JSON.stringify(T)).join(""),I=`[${v}${b}${M}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-_}ms`;if(!S.ok){let $=await this.shouldRetry(S,i);if(t&&$){let B=`retrying, ${t} attempts remaining`;return await Ux(S.body),nr(this).info(`${I} - ${B}`),nr(this).debug(`[${v}] response error (${B})`,mi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),this.retryRequest(i,t,r??v,S.headers)}let T=$?"error; no more retries left":"error; not retryable";nr(this).info(`${I} - ${T}`);let P=await S.text().catch((B)=>Ou(B).message),R=Xf(P),C=R?void 0:P;throw nr(this).debug(`[${v}] response error (${T})`,mi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:C,durationMs:Date.now()-_})),this.makeStatusError(S.status,R,C,S.headers)}return nr(this).info(I),nr(this).debug(`[${v}] response start`,mi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),{response:S,options:i,controller:g,requestLogID:v,retryOfRequestLogID:r,startTime:_}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new lh(this,r,e)}async fetchWithTimeout(e,t,r,i){let{signal:n,method:o,...s}=t||{},h=this._makeAbort(i);if(n)n.addEventListener("abort",h,{once:!0});let v=setTimeout(h,r),b=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,_={signal:i.signal,...b?{duplex:"half"}:{},method:"GET",...s};if(o)_.method=o.toUpperCase();try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(v)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);if(!Number.isNaN(h))n=h}let s=i?.get("retry-after");if(s&&!n){let h=parseFloat(s);if(!Number.isNaN(h))n=h*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let h=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,h)}return await Cx(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Ye("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(n,o,s);if("timeout"in r)Rx("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:v,body:b}=this.buildBody({options:r}),_=await this.buildHeaders({options:e,method:i,bodyHeaders:v,retryCount:t});return{req:{method:i,headers:_,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&b instanceof globalThis.ReadableStream&&{duplex:"half"},...b&&{body:b},...this.fetchOptions??{},...r.fetchOptions??{}},url:h,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=_e([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Hu(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=_e([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Yf(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return oe(this,$h,"f").call(this,{body:e,headers:r})}}kv=Yt,$h=new WeakMap,xv=new WeakSet,C2=function(){return this.baseURL!=="https://api.anthropic.com"};Yt.Anthropic=kv;Yt.HUMAN_PROMPT=O2;Yt.AI_PROMPT=D2;Yt.DEFAULT_TIMEOUT=600000;Yt.AnthropicError=Ye;Yt.APIError=wr;Yt.APIConnectionError=$o;Yt.APIConnectionTimeoutError=Du;Yt.APIUserAbortError=Rr;Yt.NotFoundError=Uu;Yt.ConflictError=Lu;Yt.RateLimitError=qu;Yt.BadRequestError=Nu;Yt.AuthenticationError=zu;Yt.InternalServerError=Bu;Yt.PermissionDeniedError=ju;Yt.UnprocessableEntityError=Fu;Yt.toFile=ch;class jo extends Yt{constructor(){super(...arguments);this.completions=new Us(this),this.messages=new zo(this),this.models=new Fs(this),this.beta=new Fr(this)}}jo.Completions=Us;jo.Messages=zo;jo.Models=Fs;jo.Beta=Fr;function L7(e){return e}function Il(e){return L7(e)}class Mv extends Error{telemetryMessage;constructor(e,t){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e}}function Ev(e){return e instanceof Error?e:Error(String(e))}function Th(e){return e instanceof Error?e.message:String(e)}function Uo(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function N2(e){return Uo(e)==="ENOENT"}function Iv(e){return Uo(e)==="EISDIR"}var dt=(()=>({}));var{appendFile:F7,chmod:q7,copyFile:B7,link:H7,lstat:Z7,mkdir:K7,open:z2,readdir:V7,readFile:j2,readlink:W7,realpath:G7,rename:J7,rmdir:X7,rm:Y7,stat:Q7,symlink:eC,unlink:tC}=(()=>({}));Dn();var Ph="→",Ghe=process.platform==="win32"?/[\\/]+/:/\/+/;var rC={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=Kt(r,Qt`fs.existsSync(${e})`,0);return dt.existsSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},async stat(e){return Q7(e)},async lstat(e){return Z7(e)},async readdir(e){return V7(e,{withFileTypes:!0})},async unlink(e){return tC(e)},async rmdir(e){return X7(e)},async rm(e,t){return Y7(e,t)},async mkdir(e,t){try{await K7(e,{recursive:!0,...t})}catch(r){if(Uo(r)!=="EEXIST")throw r}},async readFile(e,t){return j2(e,{encoding:t.encoding})},async rename(e,t){return J7(e,t)},async realpath(e){return Wm(await G7(e))},async readlink(e){return W7(e)},async copyFile(e,t){return B7(e,t)},async appendFile(e,t,r){if(r?.mode!==void 0)try{let i=await z2(e,"ax",r.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(Uo(i)!=="EEXIST")throw i}return F7(e,t)},async symlink(e,t,r){return eC(e,t,r)},async link(e,t){return H7(e,t)},async chmod(e,t){return q7(e,t)},statSync(e){let r=[];try{const t=Kt(r,Qt`fs.statSync(${e})`,0);return dt.statSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},lstatSync(e){let r=[];try{const t=Kt(r,Qt`fs.lstatSync(${e})`,0);return dt.lstatSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},readFileSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.readFileSync(${e})`,0);return dt.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},readFileBytesSync(e){let r=[];try{const t=Kt(r,Qt`fs.readFileBytesSync(${e})`,0);return dt.readFileSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},readSync(e,t){let n=[];try{const r=Kt(n,Qt`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=dt.openSync(e,"r");let v=Buffer.alloc(t.length),b=dt.readSync(i,v,0,t.length,0);return{buffer:v,bytesRead:b}}finally{if(i)dt.closeSync(i)}}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},appendFileSync(e,t,r){let n=[];try{const i=Kt(n,Qt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let v=dt.openSync(e,"ax",r.mode);try{dt.appendFileSync(v,t)}finally{dt.closeSync(v)}return}catch(v){if(Uo(v)!=="EEXIST")throw v}dt.appendFileSync(e,t)}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},copyFileSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.copyFileSync(${e} ${Ph} ${t})`,0);dt.copyFileSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},unlinkSync(e){let r=[];try{const t=Kt(r,Qt`fs.unlinkSync(${e})`,0);dt.unlinkSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},renameSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.renameSync(${e} ${Ph} ${t})`,0);dt.renameSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},linkSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.linkSync(${e} ${Ph} ${t})`,0);dt.linkSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},symlinkSync(e,t,r){let n=[];try{const i=Kt(n,Qt`fs.symlinkSync(${e} ${Ph} ${t})`,0);dt.symlinkSync(e,t,r)}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},readlinkSync(e){let r=[];try{const t=Kt(r,Qt`fs.readlinkSync(${e})`,0);return dt.readlinkSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},realpathSync(e){let r=[];try{const t=Kt(r,Qt`fs.realpathSync(${e})`,0);return Wm(dt.realpathSync(e))}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=Kt(n,Qt`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{dt.mkdirSync(e,i)}catch(v){if(Uo(v)!=="EEXIST")throw v}}catch(o){var s=o,h=1}finally{Vt(n,s,h)}},readdirSync(e){let r=[];try{const t=Kt(r,Qt`fs.readdirSync(${e})`,0);return dt.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},readdirStringSync(e){let r=[];try{const t=Kt(r,Qt`fs.readdirStringSync(${e})`,0);return dt.readdirSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},rmdirSync(e){let r=[];try{const t=Kt(r,Qt`fs.rmdirSync(${e})`,0);dt.rmdirSync(e)}catch(i){var n=i,o=1}finally{Vt(r,n,o)}},rmSync(e,t){let i=[];try{const r=Kt(i,Qt`fs.rmSync(${e})`,0);dt.rmSync(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}},createWriteStream(e){return dt.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return j2(e);let r=await z2(e,"r");try{let{size:i}=await r.stat(),n=Math.min(i,t),o=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:h}=await r.read(o,s,n-s,s);if(h===0)break;s+=h}return s<n?o.subarray(0,s):o}finally{await r.close()}}},nC=rC;function Ah(){return nC}Dn();var{lstatSync:Qhe,readFileSync:epe,rmSync:tpe,unlinkSync:rpe,writeFileSync:npe}=(()=>({}));function iC(e,t){if(e.destroyed||e.writableEnded)return;e.write(t)}function U2(e){iC(process.stderr,e)}var oC=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,L2="[^\\s,;&}\\])]+",B2="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",sC=`[^\\s-]{0,4}${B2}['"\`]?`,F2=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${L2})|${sC}|${L2}`,aC=["sk","ant","api"].join("-"),uC=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${oC.source})[\\w.-]*["']?\\s*[=:]\\s*(${F2})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${F2})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${aC}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:B2,flags:"i",confidence:"high"}];var q2=null;function lC(e){return uC.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function cC(e,t){if(typeof t!=="string")return"[REDACTED]";let r=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",i=e.lastIndexOf(t);return`${e.slice(0,i)}${r}[REDACTED]${r}${e.slice(i+t.length)}`}var dC=512,fC=512,$l=new Map;function H2(e){let t=e.length<=dC;if(t){let i=$l.get(e);if(i!==void 0)return i}q2??=lC(!0);let r=e;for(let i of q2)r=r.replace(i.re,cC);if(t){if($l.size>=fC)$l.delete($l.keys().next().value);$l.set(e,r)}return r}var Av={verbose:0,debug:1,info:2,warn:3,error:4},gC=Er(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(Av,e))return e;return"debug"}),yC=!1;function Rh(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var G2=Er(()=>{let e=Rh();return yC||yo(process.env.DEBUG)||yo(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||J2()||e.some((t)=>t.startsWith("--debug="))||X2()!==null});var vC=Er(()=>{let e=Rh().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return pS(t)}),J2=Er(()=>{let e=Rh();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),X2=Er(()=>{let e=Rh();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return V2(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return V2(e[t+1])}return null});function V2(e){return fS(e)?null:Ni(e)}function bC(e){if(!G2())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=vC();return mS(e,t)}var _C=!1;var wC=10485760,Tl=null,$v=Promise.resolve(),qs=[],Al=null,W2=null;var Pl=-1,Tv=!1,Rv=null;async function SC(e,t,r=wC){if(Pl<0)Pl=await pC(e).then((i)=>i.size).catch(()=>0);else Pl+=t;if(Pl<=r||Tv)return;Tv=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await K2(e,i)}catch(n){if(!N2(n))await Pv(i).catch(()=>{}),await K2(e,i).catch(()=>Pv(e).catch(()=>{}))}Pl=0}finally{Tv=!1}}function Y2(e){return Rv=Yn(e,`${Bm()}.txt`),Rv}async function xC(e,t,r,i){if(e)await hC(t,{recursive:!0}).catch(()=>{});let n=r;try{await Z2(r,i)}catch(o){if(!Iv(o))throw o;n=Y2(r),await Z2(n,i)}await SC(n,Buffer.byteLength(i)).catch(Q2),EC()}function Q2(){}function kC(){qs.shift()}function MC(){if(!Tl){let e=null;if(Tl=uS({writeFn:(t)=>{if(Al){qs.push(t),Al();return}let r=Cv(),i=zi(r),n=e!==i;e=i,qs.push(t),$v=$v.then(xC.bind(null,n,i,r,t)).catch(Q2).then(kC)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:G2()}),hS(async()=>{Tl?.dispose(),await $v}),!W2)process.on("exit",W2=()=>{Al=()=>{if(qs.length===0)return;let t=qs.join("");qs.length=0;let r=Cv();try{Ah().mkdirSync(zi(r))}catch{}try{Ah().appendFileSync(r,t)}catch(i){if(Iv(i))try{Ah().appendFileSync(Y2(r),t)}catch{}}},Tl?.flush(),Al()})}return Tl}function Cr(e,{level:t}={level:"debug"}){if(Av[t]<Av[gC()])return;if(!bC(e))return;if(_C&&e.includes(`
|
|
95
95
|
`))e=yn(e);let i=`${new Date().toISOString()} [${t.toUpperCase()}] ${H2(e.trim())}
|
|
96
|
-
`;if(J2()){U2(i);return}let n=MC();if(n.write(i),Al)n.flush()}function Cv(){return X2()??Rv??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Yn(Tx(),"debug",`${Bm()}.txt`)}var EC=Er(async()=>{try{let e=Cv(),t=zi(e),r=Yn(t,"latest");await Pv(r).catch(()=>{}),await mC(e,r)}catch{}});var
|
|
96
|
+
`;if(J2()){U2(i);return}let n=MC();if(n.write(i),Al)n.flush()}function Cv(){return X2()??Rv??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Yn(Tx(),"debug",`${Bm()}.txt`)}var EC=Er(async()=>{try{let e=Cv(),t=zi(e),r=Yn(t,"latest");await Pv(r).catch(()=>{}),await mC(e,r)}catch{}});var Npe=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var IC={[Symbol.dispose](){}};function $C(){return IC}var Qt=$C;function yn(e,t,r){let n=[];try{const i=Kt(n,Qt`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(o){var s=o,h=1}finally{Vt(n,s,h)}}var Bs=(e,t)=>{let i=[];try{const r=Kt(i,Qt`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var o=n,s=1}finally{Vt(i,o,s)}};class Lo{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}var TC=1000;function PC(){return{eventQueue:[],sink:null,droppedEventCount:0}}function AC(e,t){if(e.eventQueue.length>=TC)e.eventQueue.shift(),e.droppedEventCount++;e.eventQueue.push(t)}var RC=PC();function Rl(e,t){let r=RC;if(r.sink===null){AC(r,{eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function CC(e,t){Rl("tengu_feature_ok",{feature_name:Il(e),...t})}function OC(e,t,r){Rl("tengu_feature_bad",{...r,feature_name:Il(e),error_code:t})}async function vn(e,t,r){try{let i=await t();return CC(e),i}catch(i){throw OC(e,r?.(i)??"error"),i}}class Ov{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}var Dv=Symbol("suppressControlResponse");class Ch{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;unmatchedControlResponses=new Map;static UNMATCHED_CONTROL_RESPONSES_MAX=1024;cleanupPerformed=!1;sdkMessages;inputStream=new Lo;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:va(),session_id:e.sessionId};this.inputStream.enqueue(r)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(e,t,r,i,n,o=new Map,s,h,v,b,_,g){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=i;this.abortController=n;this.jsonSchema=s;this.initConfig=h;this.onElicitation=v;this.getOAuthToken=b;this.getHostAuthToken=_;this.onUserDialog=g;for(let[S,x]of o)this.connectSdkMcpServer(S,x);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear(),this.unmatchedControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),z_(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);else{if(this.unmatchedControlResponses.size>=Ch.UNMATCHED_CONTROL_RESPONSES_MAX){let r=this.unmatchedControlResponses.keys().next().value;if(r!==void 0)this.unmatchedControlResponses.delete(r)}this.unmatchedControlResponses.set(e.response.request_id,e.response)}continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="active_goal"){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();let t=e.is_error?e.subtype==="success"?e.result:e.errors.map((r)=>r.trim()).filter(Boolean).join("; "):void 0;if(this.lastErrorResultText=t||void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)Cr("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof On)&&e?.name!=="SSEHttpError"){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Cr(`[Query.readMessages] Replacing exit error with result text. Original: ${Th(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){Cr(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(r===Dv)return;let i={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(yn(i)+`
|
|
97
97
|
`))}catch(r){if(this.cleanupPerformed)return;let i={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Th(r)}};try{await Promise.resolve(this.transport.write(yn(i)+`
|
|
98
98
|
`))}catch(n){Cr(`[Query.handleControlRequest] Error-response write failed: ${Th(n)}`,{level:"error"})}}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let t=this.cancelControllers.get(e.request_id);if(t)t.abort(),this.cancelControllers.delete(e.request_id)}async processControlRequest(e,t){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");let r=await this.canUseTool(e.request.tool_name,e.request.input,{signal:t,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,title:e.request.title,displayName:e.request.display_name,description:e.request.description,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id,requestId:e.request_id});if(r===null)return Dv;return{...r,toolUseID:e.request.tool_use_id}}else if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,t);else if(e.request.subtype==="mcp_message"){let r=e.request,i=this.sdkMcpTransports.get(r.server_name);if(!i)throw Error(`SDK MCP server not found: ${r.server_name}`);if("method"in r.message&&"id"in r.message&&r.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(r.server_name,r,i)};else{if(i.onmessage)i.onmessage(r.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(e.request.subtype==="elicitation"){let r=e.request;if(this.onElicitation)return await this.onElicitation({serverName:r.mcp_server_name,message:r.message,mode:r.mode,url:r.url,elicitationId:r.elicitation_id,requestedSchema:r.requested_schema,title:r.title,displayName:r.display_name,description:r.description},{signal:t});return{action:"decline"}}else if(e.request.subtype==="request_user_dialog"){if(this.onUserDialog)return await this.onUserDialog({dialogKind:e.request.dialog_kind,payload:e.request.payload,toolUseID:e.request.tool_use_id},{signal:t});return Cr(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) — staying silent so a capable client (or the worker's park deadline) settles it`),Rl("tengu_request_user_dialog_response_ignored",{shape:Il("auto_cancel")}),Dv}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:t})??null}}else if(e.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");return{authToken:await this.getHostAuthToken({signal:t})??null}}throw Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){try{for await(let e of this.inputStream)yield e}finally{await this.cleanup()}}async initialize(){if(this.hooks&&!this.initHooksPayload){this.initHooksPayload={};for(let[i,n]of Object.entries(this.hooks))if(n.length>0)this.initHooksPayload[i]=n.map((o)=>{let s=[];for(let h of o.hooks){let v=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(v,h),s.push(v)}return{matcher:o.matcher,hookCallbackIds:s,timeout:o.timeout}})}let e=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,t={subtype:"initialize",hooks:this.initHooksPayload,sdkMcpServers:e,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt==="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds};return(await this.request(t)).response}async interrupt(){return vn("sdk_interrupt",async()=>{let t=(await this.request({subtype:"interrupt"})).response?.still_queued;return Array.isArray(t)?{still_queued:t.filter((r)=>typeof r==="string")}:void 0})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setMcpPermissionModeOverride(e,t){return(await this.request({subtype:"set_mcp_permission_mode_override",serverName:e,mode:t})).response??{}}awaitControlResponse(e){return this.transport.expectControlResponse?.(e),new Promise((t,r)=>{let i=(o)=>{if(o.subtype==="success"){let{pending_permission_requests:s,pending_user_dialog_requests:h,...v}=o;t(v)}else r(new Mv(o.error,"awaitControlResponse: CLI error verdict"));if(o.pending_permission_requests||o.pending_user_dialog_requests)Cr("[Query] Ignoring prompt-redelivery fields on awaitControlResponse response")};if(this.cleanupPerformed){r(Error("Query closed before response received"));return}let n=this.unmatchedControlResponses.get(e);if(n){this.unmatchedControlResponses.delete(e),i(n);return}this.pendingControlResponses.set(e,{handler:(o)=>{this.pendingControlResponses.delete(e),i(o)},reject:r})})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e,t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e,thinking_display:t})}async applyFlagSettings(e){return vn("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:e})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(e,t){return vn("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:e,dry_run:t?.dryRun})).response)}async cancelAsyncMessage(e){return(await this.request({subtype:"cancel_async_message",message_uuid:e})).response.cancelled}async seedReadState(e,t){await this.request({subtype:"seed_read_state",path:e,mtime:t})}async setCwd(e,t){return vn("sdk_set_cwd",async()=>(await this.request({subtype:"set_cwd",path:e,...t?.trustAccepted!==void 0&&{trust_accepted:t.trustAccepted},...t?.trustedDirectory!==void 0&&{trusted_directory:t.trustedDirectory}})).response)}async enableRemoteControl(e,t){return(await this.request({subtype:"remote_control",enabled:e,...t!==void 0&&{name:t}})).response}async submitFeedback(e,t){return(await this.request({subtype:"submit_feedback",description:e,surface:t?.surface})).response}async generateSessionTitle(e,t){return vn("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:e,persist:t?.persist})).response.title)}async askSideQuestion(e){return vn("sdk_side_question",async()=>{let r=(await this.request({subtype:"side_question",question:e})).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1}})}async launchUltrareview(e,t){return(await this.request({subtype:"ultrareview_launch",args:e,confirm:t?.confirm??!1})).response}async messageRated(e){await this.request({subtype:"message_rated",messageUuid:e.messageUuid,sentiment:e.sentiment,surface:e.surface,cleared:e.cleared??!1})}processPendingPermissionRequests(e){for(let t of e)if(t.request.subtype==="can_use_tool")this.handleControlRequest(t).catch(()=>{})}processPendingUserDialogRequests(e){for(let t of e)if(t.request.subtype==="request_user_dialog")this.handleControlRequest(t).catch(()=>{})}request(e){let t=Math.random().toString(36).substring(2,15);this.transport.expectControlResponse?.(t);let r={request_id:t,type:"control_request",request:e},i=e.subtype==="initialize";return new Promise((n,o)=>{this.pendingControlResponses.set(t,{handler:(s)=>{if(this.pendingControlResponses.delete(t),s.subtype==="success")n(s);else o(Error(s.error));if(!i&&(s.pending_permission_requests||s.pending_user_dialog_requests))Cr(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${e.subtype})`);else{if(s.pending_permission_requests)this.processPendingPermissionRequests(s.pending_permission_requests);if(s.pending_user_dialog_requests)this.processPendingUserDialogRequests(s.pending_user_dialog_requests)}},reject:o}),Promise.resolve(this.transport.write(yn(r)+`
|
|
99
99
|
`)).catch((s)=>{this.pendingControlResponses.delete(t),o(s)})})}initializationResult(){return this.initialization}reinitialize(){return vn("sdk_reinitialize",()=>this.initialize())}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(e){await this.request({subtype:"mcp_reconnect",serverName:e})}async toggleMcpServer(e,t){return vn("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:e,enabled:t})})}async enableChannel(e){return vn("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:e})})}async mcpAuthenticate(e,t){return(await this.request({subtype:"mcp_authenticate",serverName:e,redirectUri:t})).response}async mcpClearAuth(e){return(await this.request({subtype:"mcp_clear_auth",serverName:e})).response}async mcpSubmitOAuthCallbackUrl(e,t){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:e,callbackUrl:t})).response}async claudeAuthenticate(e){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:e})).response}async claudeOAuthCallback(e,t){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:e,state:t})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(e,t){try{return(await this.request({subtype:"read_file",path:e,max_bytes:t?.maxBytes,encoding:t?.encoding})).response}catch{return null}}async reloadPlugins(){return vn("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return vn("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(e){return vn("sdk_mcp_set_servers",async()=>{let t={},r={};for(let[h,v]of Object.entries(e))if(v.type==="sdk"&&"instance"in v)t[h]=v.instance;else r[h]=v;let i=new Set(this.sdkMcpServerInstances.keys()),n=new Set(Object.keys(t));for(let h of i)if(!n.has(h))await this.disconnectSdkMcpServer(h);for(let[h,v]of Object.entries(t))if(!i.has(h))this.connectSdkMcpServer(h,v);let o={};for(let h of Object.keys(t))o[h]={type:"sdk",name:h};return(await this.request({subtype:"mcp_set_servers",servers:{...r,...o}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(e){Cr("[Query.streamInput] Starting to process input stream");try{let t=0;for await(let r of e){if(t++,Cr(`[Query.streamInput] Processing message ${t}: ${r.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(yn(r)+`
|
|
@@ -102,8 +102,8 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
|
102
102
|
`+s:s;break}}return t.data||r?t:null}class zv{decoder=new TextDecoder;pending=[];pendingLength=0;push(e){let t=typeof e==="string"?e:this.decoder.decode(e,DC);if(!t)return[];return this.drain(t)}flush(){let e=this.decoder.decode();if(e)this.pending.push(e),this.pendingLength+=e.length;let t=this.joinPending();this.pending=[],this.pendingLength=0;let r=t6(t);return r?[r]:[]}buffered(){return this.joinPending()}drain(e){let t=[],r=this.pendingLength,i=Math.min(3,r),n=this.tail(i)+e,o=r-i,s=0,h=-1;for(;;){let v=NC(n,s);if(!v)break;let b=o+v.contentEnd,_;if(h===-1){let S=this.joinPending();_=b<=r?S.slice(0,b):S+e.slice(0,b-r)}else _=e.slice(h-r,b-r);let g=t6(_);if(g)t.push(g);h=o+v.afterDelim,s=v.afterDelim}if(h===-1)this.pending.push(e),this.pendingLength=r+e.length;else{let v=e.slice(h-r);this.pending=v?[v]:[],this.pendingLength=v.length}return t}tail(e){if(e<=0)return"";let t=e,r="";for(let i=this.pending.length-1;i>=0&&t>0;i--){let n=this.pending[i];if(n.length<=t)r=n+r,t-=n.length;else r=n.slice(n.length-t)+r,t=0}return r}joinPending(){return this.pending.length===1?this.pending[0]:this.pending.join("")}}var zC=15000,r6=1000,n6=30000,i6=5,jC=45000,UC=30000,LC=3,FC=1000,o6=new Set([401,403,404]);class Lv{options;ready=!1;closed=!1;abortController;streamAbort=null;messages=new Lo;exitError;readyPromise;readyResolve;readyReject;abortHandler;livenessTimer;reconnectTimer;reconnectAttempts=0;lastEventId="";expectedControlResponseIds=new Set;uploader;constructor(e){this.options=e;if(this.abortController=e.abortController||new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),this.readyPromise.catch(()=>{}),this.uploader=new Nv({maxBatchSize:1,maxQueueSize:FC,baseDelayMs:r6,maxDelayMs:n6,jitterMs:250,maxConsecutiveFailures:LC,send:(t)=>this.postOnce(t[0])}),this.abortHandler=()=>{this.exitError=new On("SSE connection aborted by user"),this.close()},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler);this.connect()}buildHeaders(e){return{...this.options.headers??{},...e}}async connect(){if(this.closed)return;this.streamAbort=new AbortController;let e=this.streamAbort.signal,t=this.buildHeaders({Accept:"text/event-stream"});if(this.lastEventId)t["Last-Event-ID"]=this.lastEventId;let r=this.options.connectTimeoutMs??zC,i=Date.now()+r,n=setTimeout(()=>{this.streamAbort?.abort(),this.handleStreamEnd(Error("SSE connect timeout"))},r),o;try{o=await fetch(this.options.streamUrl,{method:"GET",headers:t,signal:e})}catch(s){if(clearTimeout(n),this.closed||e.aborted)return;return this.handleStreamEnd(Ev(s))}if(!o.ok||!o.body){clearTimeout(n);let s=o.status,h=setTimeout(()=>{this.streamAbort?.abort()},Math.max(0,i-Date.now())),v=await s6(o);if(clearTimeout(h),this.closed)return;let b=new Uv("SSE connect failed",s,v);if(o6.has(s))return this.fail(b);return this.handleStreamEnd(b)}if(clearTimeout(n),this.closed){o.body.cancel().catch(()=>{});return}this.ready=!0,this.reconnectAttempts=0,this.resetLivenessTimer(),this.readyResolve?.(),this.readStream(o.body,e)}async readStream(e,t){let r=e.getReader(),i=new zv;try{while(!t.aborted){let{done:n,value:o}=await r.read();if(n)break;this.resetLivenessTimer();for(let s of i.push(o)){if(s.id)this.lastEventId=s.id;if(!s.data)continue;if(s.event!=="client_event"&&s.event!=="ephemeral_event")continue;try{let h=Bs(s.data),v=h.payload;if(!v||typeof v.type!=="string")continue;if(s.event==="ephemeral_event"){if(v.type==="stream_event"){this.messages.enqueue(v);continue}if(v.type==="system"&&v.subtype==="thinking_tokens"){let b=v;this.messages.enqueue({type:"system",subtype:"thinking_tokens",estimated_tokens:b.estimated_tokens,estimated_tokens_delta:b.estimated_tokens_delta,uuid:b.uuid,session_id:b.session_id});continue}console.debug(`[BrowserSSETransport] Dropping ${v.type} on ephemeral_event (only stream_event and system:thinking_tokens ride ephemeral)`);continue}if(h.source!=="worker"&&(v.type==="control_request"||v.type==="control_cancel_request"))continue;if(v.type==="control_response"&&v.response&&typeof v.response==="object"){let b=v.response,_=b.request_id;if(typeof _==="string"&&this.expectedControlResponseIds.has(_)){if(h.source!=="worker")continue;this.expectedControlResponseIds.delete(_)}if(h.source!=="worker"&&(("pending_user_dialog_requests"in b)||("pending_permission_requests"in b))){let{pending_user_dialog_requests:g,pending_permission_requests:S,...x}=b;this.messages.enqueue({...v,response:x});continue}}this.messages.enqueue(v)}catch{}}}}catch(n){if(!this.closed&&!t.aborted)return this.handleStreamEnd(Ev(n));return}finally{r.releaseLock()}if(!this.closed&&!t.aborted)this.handleStreamEnd()}handleStreamEnd(e){if(this.ready=!1,this.clearLivenessTimer(),this.closed)return;if(this.reconnectAttempts>=i6)return this.fail(e??Error(`SSE reconnect budget exhausted (${i6} attempts)`));this.reconnectAttempts++;let t=Math.min(r6*2**(this.reconnectAttempts-1),n6);clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.connect()},t)}fail(e){this.exitError=this.exitError??e,this.close()}resetLivenessTimer(){this.clearLivenessTimer(),this.livenessTimer=setTimeout(()=>{this.streamAbort?.abort(),this.handleStreamEnd(Error("SSE liveness timeout"))},jC)}clearLivenessTimer(){if(this.livenessTimer)clearTimeout(this.livenessTimer),this.livenessTimer=void 0}expectControlResponse(e){if(this.expectedControlResponseIds.add(e),this.expectedControlResponseIds.size>1024){let t=this.expectedControlResponseIds.values().next().value;if(t!==void 0)this.expectedControlResponseIds.delete(t)}}async write(e){if(this.abortController.signal.aborted)throw new On("Operation aborted");if(!this.ready)await this.readyPromise;if(this.closed)throw this.exitError??Error("SSETransport is closed");let t=Bs(e),r=!t||typeof t!=="object"||Array.isArray(t)||typeof t.uuid==="string"&&t.uuid?e:JSON.stringify({...t,uuid:crypto.randomUUID()});await this.uploader.enqueue(r)}async postOnce(e){let t=this.buildHeaders({"Content-Type":"application/json"}),r=JSON.stringify({session_id:this.options.sessionId,events:[{payload:Bs(e)}]}),i=BC([this.abortController.signal,AbortSignal.timeout(UC)]);try{let n=await fetch(this.options.sendUrl,{method:"POST",headers:t,body:r,signal:i.signal});if(n.ok){n.body?.cancel();return}if(o6.has(n.status)){let h=await s6(n);throw this.fail(new Uv(`POST ${this.options.sendUrl}`,n.status,h)),Error(`permanent HTTP ${n.status}`)}n.body?.cancel();let o=n.headers.get("Retry-After"),s=o?Number(o):NaN;throw new Oh(`POST ${this.options.sendUrl}: HTTP ${n.status}`,Number.isFinite(s)?s*1000:void 0)}finally{i.detach()}}close(){if(this.closed)return;if(this.closed=!0,!this.ready)this.readyReject?.(this.exitError??new On("SSE transport closed before connect"));if(this.ready=!1,clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0,this.clearLivenessTimer(),this.streamAbort?.abort(),this.uploader.close(),this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&!this.closed}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}var qC=128,jv=4096;class Uv extends Error{code;reason;constructor(e,t,r){super(`${e}: HTTP ${t}`);this.name="SSEHttpError",this.code=t,this.reason=r}}async function s6(e){let t=e.body?.getReader();if(!t)return;try{let r=new Uint8Array(jv),i=0;for(;;){let{done:h,value:v}=await t.read();if(h||!v)break;let b=Math.min(v.length,jv-i);if(r.set(v.subarray(0,b),i),i+=b,i>=jv)break}let n=JSON.parse(new TextDecoder().decode(r.subarray(0,i))),o=n?.error?.resource??n?.error?.type;if(typeof o!=="string")return;return o.replace(/[\p{Cc}\p{Cf}]/gu,"").slice(0,qC)||void 0}catch{return}finally{t.cancel().catch(()=>{})}}function BC(e){let t=AbortSignal;if(typeof t.any==="function")return{signal:t.any(e),detach:()=>{}};let r=new AbortController,i=[];for(let n of e){if(n.aborted){r.abort(n.reason);break}let o=()=>r.abort(n.reason);n.addEventListener("abort",o,{once:!0}),i.push([n,o])}return{signal:r.signal,detach:()=>{for(let[n,o]of i)n.removeEventListener("abort",o)}}}var a6=15000,HC=50000;class Fv{options;ws;ready=!1;abortController;messages=new Lo;exitError;readyPromise;readyResolve;readyReject;abortHandler;keepAliveTimer;partialLine="";constructor(e){this.options=e;this.abortController=e.abortController||new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),this.readyPromise.catch(()=>{}),this.initialize()}initialize(){try{let{url:e}=this.options,t=new URL(e);if(!t.protocol.startsWith("ws"))throw Error("WebSocket URL must use ws:// or wss:// protocol");this.ws=new globalThis.WebSocket(t.toString());let r=setTimeout(()=>{if(!this.ready){this.ws?.close();let i=Error(`WebSocket connection timeout after ${a6}ms`);if(this.exitError=i,this.readyReject)this.readyReject(i)}},a6);if(this.ws.onopen=()=>{if(clearTimeout(r),this.ready=!0,this.readyResolve)this.readyResolve();if(this.options.authMessage&&this.ws)try{this.ws.send(yn(this.options.authMessage)+`
|
|
103
103
|
`)}catch{}this.keepAliveTimer=setInterval(()=>{if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)try{this.ws.send(yn({type:"keep_alive"})+`
|
|
104
104
|
`)}catch{}},HC)},this.ws.onerror=(i)=>{clearTimeout(r),this.ready=!1;let n=Error("WebSocket connection error");if(this.exitError=n,this.readyReject)this.readyReject(n);this.messages.done()},this.ws.onclose=(i)=>{if(this.ready=!1,this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(i.code!==1000&&i.code!==1001)this.exitError=Error(`WebSocket closed abnormally with code ${i.code}: ${i.reason}`);this.messages.done()},this.ws.onmessage=(i)=>{if(typeof i.data!=="string")return;let o=(this.partialLine+i.data).split(`
|
|
105
|
-
`);this.partialLine=o.pop()??"";for(let s of o){if(!s)continue;try{this.messages.enqueue(Bs(s))}catch(h){}}},this.abortHandler=()=>{this.close(),this.exitError=new On("WebSocket connection aborted by user")},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler)}catch(e){if(this.ready=!1,this.exitError=e,this.readyReject)this.readyReject(e);throw e}}async write(e){if(this.abortController.signal.aborted)throw new On("Operation aborted");if(!this.ready)await this.readyPromise;if(!this.ready||!this.ws||this.ws.readyState!==globalThis.WebSocket.OPEN)throw Error("WebSocketTransport is not ready for writing");this.ws.send(e)}close(){if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)this.ws.close(1000,"Normal closure");this.ready=!1,this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&this.ws?.readyState===globalThis.WebSocket.OPEN}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function u6(e){return new AbortController}var wt;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let o={};for(let s of n)o[s]=s;return o},e.getValidEnumValues=(n)=>{let o=e.objectKeys(n).filter((h)=>typeof n[n[h]]!=="number"),s={};for(let h of o)s[h]=n[h];return e.objectValues(s)},e.objectValues=(n)=>e.objectKeys(n).map(function(o){return n[o]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let o=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))o.push(s);return o},e.find=(n,o)=>{for(let s of n)if(o(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(n,o)=>{if(typeof o==="bigint")return o.toString();return o}})(wt||(wt={}));var l6;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(l6||(l6={}));var Ze=wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bi=(e)=>{switch(typeof e){case"undefined":return Ze.undefined;case"string":return Ze.string;case"number":return Number.isNaN(e)?Ze.nan:Ze.number;case"boolean":return Ze.boolean;case"function":return Ze.function;case"bigint":return Ze.bigint;case"symbol":return Ze.symbol;case"object":if(Array.isArray(e))return Ze.array;if(e===null)return Ze.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return Ze.promise;if(typeof Map<"u"&&e instanceof Map)return Ze.map;if(typeof Set<"u"&&e instanceof Set)return Ze.set;if(typeof Date<"u"&&e instanceof Date)return Ze.date;return Ze.object;default:return Ze.unknown}};var Ue=wt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class bn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},i=(n)=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let s=r,h=0;while(h<o.path.length){let v=o.path[h];if(h!==o.path.length-1)s[v]=s[v]||{_errors:[]};else s[v]=s[v]||{_errors:[]},s[v]._errors.push(t(o));s=s[v],h++}}};return i(this),r}static assert(e){if(!(e instanceof bn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let n=i.path[0];t[n]=t[n]||[],t[n].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}bn.create=(e)=>new bn(e);var ZC=(e,t)=>{let r;switch(e.code){case Ue.invalid_type:if(e.received===Ze.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,wt.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${wt.joinValues(e.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${wt.joinValues(e.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${wt.joinValues(e.options)}, received '${e.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else wt.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case Ue.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case Ue.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=t.defaultError,wt.assertNever(e)}return{message:r}},Ji=ZC;var KC=Ji;function Cl(){return KC}var Dh=(e)=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let h="",v=i.filter((b)=>!!b).slice().reverse();for(let b of v)h=b(s,{data:t,defaultError:h}).message;return{...n,path:o,message:h}};function Je(e,t){let r=Cl(),i=Dh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ji?void 0:Ji].filter((n)=>!!n)});e.common.issues.push(i)}class qr{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ot;if(i.status==="dirty")e.dirty();r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let n=await i.key,o=await i.value;r.push({key:n,value:o})}return qr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:n,value:o}=i;if(n.status==="aborted")return ot;if(o.status==="aborted")return ot;if(n.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet))r[n.value]=o.value}return{status:e.value,value:r}}}var ot=Object.freeze({status:"aborted"}),Hs=(e)=>({status:"dirty",value:e}),Wr=(e)=>({status:"valid",value:e}),qv=(e)=>e.status==="aborted",Bv=(e)=>e.status==="dirty",Fo=(e)=>e.status==="valid",Ol=(e)=>typeof Promise<"u"&&e instanceof Promise;var et;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(et||(et={}));class Un{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var c6=(e,t)=>{if(Fo(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bn(e.common.issues);return this._error=r,this._error}}}};function ht(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,h)=>{let{message:v}=e;if(s.code==="invalid_enum_value")return{message:v??h.defaultError};if(typeof h.data>"u")return{message:v??i??h.defaultError};if(s.code!=="invalid_type")return{message:h.defaultError};return{message:v??r??h.defaultError}},description:n}}class bt{get description(){return this._def.description}_getType(e){return bi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qr,ctx:{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ol(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parseSync({data:e,path:r.path,parent:r});return c6(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Fo(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Fo(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parse({data:e,path:r.path,parent:r}),n=await(Ol(i)?i:Promise.resolve(i));return c6(r,n)}refine(e,t){let r=(i)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(i);else return t};return this._refinement((i,n)=>{let o=e(i),s=()=>n.addIssue({code:Ue.custom,...r(i)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((h)=>{if(!h)return s(),!1;else return!0});if(!o)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,i)=>{if(!e(r))return i.addIssue(typeof t==="function"?t(r,i):t),!1;else return!0})}_refinement(e){return new ei({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return $n.create(this,this._def)}nullable(){return Xi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qn.create(this)}promise(){return Gs.create(this,this._def)}or(e){return Ul.create([this,e],this._def)}and(e){return Ll.create(this,e,this._def)}transform(e){return new ei({...ht(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Hl({...ht(this._def),innerType:this,defaultValue:t,typeName:Le.ZodDefault})}brand(){return new Vv({typeName:Le.ZodBranded,type:this,...ht(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Zl({...ht(this._def),innerType:this,catchValue:t,typeName:Le.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Bh.create(this,e)}readonly(){return Kl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var VC=/^c[^\s-]{8,}$/i,WC=/^[0-9a-z]+$/,GC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JC=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,XC=/^[a-z0-9_-]{21}$/i,YC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,QC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,eO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hv,rO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,iO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,oO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,aO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d6="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",uO=new RegExp(`^${d6}$`);function f6(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function lO(e){return new RegExp(`^${f6(e)}$`)}function cO(e){let t=`${d6}T${f6(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function dO(e,t){if((t==="v4"||!t)&&rO.test(e))return!0;if((t==="v6"||!t)&&iO.test(e))return!0;return!1}function fO(e,t){if(!YC.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function hO(e,t){if((t==="v4"||!t)&&nO.test(e))return!0;if((t==="v6"||!t)&&oO.test(e))return!0;return!1}class wi extends bt{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==Ze.string){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.string,received:n.parsedType}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let o=e.data.length>n.value,s=e.data.length<n.value;if(o||s){if(i=this._getOrReturnCtx(e,i),o)Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!eO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"email",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Hv)Hv=new RegExp(tO,"u");if(!Hv.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"emoji",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!JC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"uuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!XC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"nanoid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!VC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!WC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid2",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!GC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ulid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Je(i,{validation:"url",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"regex",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!cO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!uO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!lO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!QC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"duration",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!dO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ip",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!fO(e.data,n.alg))i=this._getOrReturnCtx(e,i),Je(i,{validation:"jwt",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!hO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cidr",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!sO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!aO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64url",code:Ue.invalid_string,message:n.message}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((i)=>e.test(i),{validation:t,code:Ue.invalid_string,...et.errToObj(r)})}_addCheck(e){return new wi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...et.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...et.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...et.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...et.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...et.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...et.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...et.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...et.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...et.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...et.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...et.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...et.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...et.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...et.errToObj(t)})}nonempty(e){return this.min(1,et.errToObj(e))}trim(){return new wi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new wi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new wi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}wi.create=(e)=>new wi({checks:[],typeName:Le.ZodString,coerce:e?.coerce??!1,...ht(e)});function pO(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}class Ks extends bt{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==Ze.number){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.number,received:n.parsedType}),ot}let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="int"){if(!wt.isInteger(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(pO(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_finite,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Ks({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Ks({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&wt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ks.create=(e)=>new Ks({checks:[],typeName:Le.ZodNumber,coerce:e?.coerce||!1,...ht(e)});class Vs extends bt{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ze.bigint)return this._getInvalidInput(e);let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.bigint,received:t.parsedType}),ot}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Vs({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Vs.create=(e)=>new Vs({checks:[],typeName:Le.ZodBigInt,coerce:e?.coerce??!1,...ht(e)});class Nh extends bt{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==Ze.boolean){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.boolean,received:r.parsedType}),ot}return Wr(e.data)}}Nh.create=(e)=>new Nh({typeName:Le.ZodBoolean,coerce:e?.coerce||!1,...ht(e)});class Nl extends bt{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==Ze.date){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.date,received:n.parsedType}),ot}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_date}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Nl({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:et.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:et.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Nl.create=(e)=>new Nl({checks:[],coerce:e?.coerce||!1,typeName:Le.ZodDate,...ht(e)});class zh extends bt{_parse(e){if(this._getType(e)!==Ze.symbol){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.symbol,received:r.parsedType}),ot}return Wr(e.data)}}zh.create=(e)=>new zh({typeName:Le.ZodSymbol,...ht(e)});class zl extends bt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.undefined,received:r.parsedType}),ot}return Wr(e.data)}}zl.create=(e)=>new zl({typeName:Le.ZodUndefined,...ht(e)});class jl extends bt{_parse(e){if(this._getType(e)!==Ze.null){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.null,received:r.parsedType}),ot}return Wr(e.data)}}jl.create=(e)=>new jl({typeName:Le.ZodNull,...ht(e)});class jh extends bt{constructor(){super(...arguments);this._any=!0}_parse(e){return Wr(e.data)}}jh.create=(e)=>new jh({typeName:Le.ZodAny,...ht(e)});class qo extends bt{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Wr(e.data)}}qo.create=(e)=>new qo({typeName:Le.ZodUnknown,...ht(e)});class Si extends bt{_parse(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.never,received:t.parsedType}),ot}}Si.create=(e)=>new Si({typeName:Le.ZodNever,...ht(e)});class Uh extends bt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.void,received:r.parsedType}),ot}return Wr(e.data)}}Uh.create=(e)=>new Uh({typeName:Le.ZodVoid,...ht(e)});class Qn extends bt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ze.array)return Je(t,{code:Ue.invalid_type,expected:Ze.array,received:t.parsedType}),ot;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;if(o||s)Je(t,{code:o?Ue.too_big:Ue.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty()}if(i.minLength!==null){if(t.data.length<i.minLength.value)Je(t,{code:Ue.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()}if(i.maxLength!==null){if(t.data.length>i.maxLength.value)Je(t,{code:Ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,s)=>i.type._parseAsync(new Un(t,o,t.path,s)))).then((o)=>qr.mergeArray(r,o));let n=[...t.data].map((o,s)=>i.type._parseSync(new Un(t,o,t.path,s)));return qr.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Qn({...this._def,minLength:{value:e,message:et.toString(t)}})}max(e,t){return new Qn({...this._def,maxLength:{value:e,message:et.toString(t)}})}length(e,t){return new Qn({...this._def,exactLength:{value:e,message:et.toString(t)}})}nonempty(e){return this.min(1,e)}}Qn.create=(e,t)=>new Qn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...ht(t)});function Zs(e){if(e instanceof er){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=$n.create(Zs(i))}return new er({...e._def,shape:()=>t})}else if(e instanceof Qn)return new Qn({...e._def,type:Zs(e.element)});else if(e instanceof $n)return $n.create(Zs(e.unwrap()));else if(e instanceof Xi)return Xi.create(Zs(e.unwrap()));else if(e instanceof xi)return xi.create(e.items.map((t)=>Zs(t)));else return e}class er extends bt{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=wt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ze.object){let v=this._getOrReturnCtx(e);return Je(v,{code:Ue.invalid_type,expected:Ze.object,received:v.parsedType}),ot}let{status:r,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Si&&this._def.unknownKeys==="strip")){for(let v in i.data)if(!o.includes(v))s.push(v)}let h=[];for(let v of o){let b=n[v],_=i.data[v];h.push({key:{status:"valid",value:v},value:b._parse(new Un(i,_,i.path,v)),alwaysSet:v in i.data})}if(this._def.catchall instanceof Si){let v=this._def.unknownKeys;if(v==="passthrough")for(let b of s)h.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(v==="strict"){if(s.length>0)Je(i,{code:Ue.unrecognized_keys,keys:s}),r.dirty()}else if(v==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let b of s){let _=i.data[b];h.push({key:{status:"valid",value:b},value:v._parse(new Un(i,_,i.path,b)),alwaysSet:b in i.data})}}if(i.common.async)return Promise.resolve().then(async()=>{let v=[];for(let b of h){let _=await b.key,g=await b.value;v.push({key:_,value:g,alwaysSet:b.alwaysSet})}return v}).then((v)=>qr.mergeObjectSync(r,v));else return qr.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return et.errToObj,new er({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:et.errToObj(e).message??i};return{message:i}}}:{}})}strip(){return new er({...this._def,unknownKeys:"strip"})}passthrough(){return new er({...this._def,unknownKeys:"passthrough"})}extend(e){return new er({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new er({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Le.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new er({...this._def,catchall:e})}pick(e){let t={};for(let r of wt.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new er({...this._def,shape:()=>t})}omit(e){let t={};for(let r of wt.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new er({...this._def,shape:()=>t})}deepPartial(){return Zs(this)}partial(e){let t={};for(let r of wt.objectKeys(this.shape)){let i=this.shape[r];if(e&&!e[r])t[r]=i;else t[r]=i.optional()}return new er({...this._def,shape:()=>t})}required(e){let t={};for(let r of wt.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof $n)n=n._def.innerType;t[r]=n}return new er({...this._def,shape:()=>t})}keyof(){return h6(wt.objectKeys(this.shape))}}er.create=(e,t)=>new er({shape:()=>e,unknownKeys:"strip",catchall:Si.create(),typeName:Le.ZodObject,...ht(t)});er.strictCreate=(e,t)=>new er({shape:()=>e,unknownKeys:"strict",catchall:Si.create(),typeName:Le.ZodObject,...ht(t)});er.lazycreate=(e,t)=>new er({shape:e,unknownKeys:"strip",catchall:Si.create(),typeName:Le.ZodObject,...ht(t)});class Ul extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map((s)=>new bn(s.ctx.common.issues));return Je(t,{code:Ue.invalid_union,unionErrors:o}),ot}if(t.common.async)return Promise.all(r.map(async(n)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);else{let n=void 0,o=[];for(let h of r){let v={...t,common:{...t.common,issues:[]},parent:null},b=h._parseSync({data:t.data,path:t.path,parent:v});if(b.status==="valid")return b;else if(b.status==="dirty"&&!n)n={result:b,ctx:v};if(v.common.issues.length)o.push(v.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=o.map((h)=>new bn(h));return Je(t,{code:Ue.invalid_union,unionErrors:s}),ot}}get options(){return this._def.options}}Ul.create=(e,t)=>new Ul({options:e,typeName:Le.ZodUnion,...ht(t)});var _i=(e)=>{if(e instanceof Fl)return _i(e.schema);else if(e instanceof ei)return _i(e.innerType());else if(e instanceof ql)return[e.value];else if(e instanceof Bo)return e.options;else if(e instanceof Bl)return wt.objectValues(e.enum);else if(e instanceof Hl)return _i(e._def.innerType);else if(e instanceof zl)return[void 0];else if(e instanceof jl)return[null];else if(e instanceof $n)return[void 0,..._i(e.unwrap())];else if(e instanceof Xi)return[null,..._i(e.unwrap())];else if(e instanceof Vv)return _i(e.unwrap());else if(e instanceof Kl)return _i(e.unwrap());else if(e instanceof Zl)return _i(e._def.innerType);else return[]};class Kv extends bt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.object)return Je(t,{code:Ue.invalid_type,expected:Ze.object,received:t.parsedType}),ot;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);if(!n)return Je(t,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ot;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let n of t){let o=_i(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,n)}}return new Kv({typeName:Le.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ht(r)})}}function Zv(e,t){let r=bi(e),i=bi(t);if(e===t)return{valid:!0,data:e};else if(r===Ze.object&&i===Ze.object){let n=wt.objectKeys(t),o=wt.objectKeys(e).filter((h)=>n.indexOf(h)!==-1),s={...e,...t};for(let h of o){let v=Zv(e[h],t[h]);if(!v.valid)return{valid:!1};s[h]=v.data}return{valid:!0,data:s}}else if(r===Ze.array&&i===Ze.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let o=0;o<e.length;o++){let s=e[o],h=t[o],v=Zv(s,h);if(!v.valid)return{valid:!1};n.push(v.data)}return{valid:!0,data:n}}else if(r===Ze.date&&i===Ze.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Ll extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(n,o)=>{if(qv(n)||qv(o))return ot;let s=Zv(n.value,o.value);if(!s.valid)return Je(r,{code:Ue.invalid_intersection_types}),ot;if(Bv(n)||Bv(o))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,o])=>i(n,o));else return i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ll.create=(e,t,r)=>new Ll({left:e,right:t,typeName:Le.ZodIntersection,...ht(r)});class xi extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.array)return Je(r,{code:Ue.invalid_type,expected:Ze.array,received:r.parsedType}),ot;if(r.data.length<this._def.items.length)return Je(r,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;if(!this._def.rest&&r.data.length>this._def.items.length)Je(r,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((o,s)=>{let h=this._def.items[s]||this._def.rest;if(!h)return null;return h._parse(new Un(r,o,r.path,s))}).filter((o)=>!!o);if(r.common.async)return Promise.all(n).then((o)=>qr.mergeArray(t,o));else return qr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new xi({...this._def,rest:e})}}xi.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new xi({items:e,typeName:Le.ZodTuple,rest:null,...ht(t)})};class Lh extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.object)return Je(r,{code:Ue.invalid_type,expected:Ze.object,received:r.parsedType}),ot;let i=[],n=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:n._parse(new Un(r,s,r.path,s)),value:o._parse(new Un(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return qr.mergeObjectAsync(t,i);else return qr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof bt)return new Lh({keyType:e,valueType:t,typeName:Le.ZodRecord,...ht(r)});return new Lh({keyType:wi.create(),valueType:e,typeName:Le.ZodRecord,...ht(t)})}}class Fh extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.map)return Je(r,{code:Ue.invalid_type,expected:Ze.map,received:r.parsedType}),ot;let i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([s,h],v)=>({key:i._parse(new Un(r,s,r.path,[v,"key"])),value:n._parse(new Un(r,h,r.path,[v,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let h of o){let v=await h.key,b=await h.value;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let h of o){let{key:v,value:b}=h;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}}}}Fh.create=(e,t,r)=>new Fh({valueType:t,keyType:e,typeName:Le.ZodMap,...ht(r)});class Ws extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.set)return Je(r,{code:Ue.invalid_type,expected:Ze.set,received:r.parsedType}),ot;let i=this._def;if(i.minSize!==null){if(r.data.size<i.minSize.value)Je(r,{code:Ue.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()}if(i.maxSize!==null){if(r.data.size>i.maxSize.value)Je(r,{code:Ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty()}let n=this._def.valueType;function o(h){let v=new Set;for(let b of h){if(b.status==="aborted")return ot;if(b.status==="dirty")t.dirty();v.add(b.value)}return{status:t.value,value:v}}let s=[...r.data.values()].map((h,v)=>n._parse(new Un(r,h,r.path,v)));if(r.common.async)return Promise.all(s).then((h)=>o(h));else return o(s)}min(e,t){return new Ws({...this._def,minSize:{value:e,message:et.toString(t)}})}max(e,t){return new Ws({...this._def,maxSize:{value:e,message:et.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ws.create=(e,t)=>new Ws({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...ht(t)});class Dl extends bt{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.function)return Je(t,{code:Ue.invalid_type,expected:Ze.function,received:t.parsedType}),ot;function r(s,h){return Dh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_arguments,argumentsError:h}})}function i(s,h){return Dh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_return_type,returnTypeError:h}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Gs){let s=this;return Wr(async function(...h){let v=new bn([]),b=await s._def.args.parseAsync(h,n).catch((S)=>{throw v.addIssue(r(h,S)),v}),_=await Reflect.apply(o,this,b);return await s._def.returns._def.type.parseAsync(_,n).catch((S)=>{throw v.addIssue(i(_,S)),v})})}else{let s=this;return Wr(function(...h){let v=s._def.args.safeParse(h,n);if(!v.success)throw new bn([r(h,v.error)]);let b=Reflect.apply(o,this,v.data),_=s._def.returns.safeParse(b,n);if(!_.success)throw new bn([i(b,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Dl({...this._def,args:xi.create(e).rest(qo.create())})}returns(e){return new Dl({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Dl({args:e?e:xi.create([]).rest(qo.create()),returns:t||qo.create(),typeName:Le.ZodFunction,...ht(r)})}}class Fl extends bt{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Fl.create=(e,t)=>new Fl({getter:e,typeName:Le.ZodLazy,...ht(t)});class ql extends bt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Je(t,{received:t.data,code:Ue.invalid_literal,expected:this._def.value}),ot}return{status:"valid",value:e.data}}get value(){return this._def.value}}ql.create=(e,t)=>new ql({value:e,typeName:Le.ZodLiteral,...ht(t)});function h6(e,t){return new Bo({values:e,typeName:Le.ZodEnum,...ht(t)})}class Bo extends bt{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{expected:wt.joinValues(r),received:t.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{received:t.data,code:Ue.invalid_enum_value,options:r}),ot}return Wr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Bo.create(e,{...this._def,...t})}exclude(e,t=this._def){return Bo.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Bo.create=h6;class Bl extends bt{_parse(e){let t=wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ze.string&&r.parsedType!==Ze.number){let i=wt.objectValues(t);return Je(r,{expected:wt.joinValues(i),received:r.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(wt.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let i=wt.objectValues(t);return Je(r,{received:r.data,code:Ue.invalid_enum_value,options:i}),ot}return Wr(e.data)}get enum(){return this._def.values}}Bl.create=(e,t)=>new Bl({values:e,typeName:Le.ZodNativeEnum,...ht(t)});class Gs extends bt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.promise&&t.common.async===!1)return Je(t,{code:Ue.invalid_type,expected:Ze.promise,received:t.parsedType}),ot;let r=t.parsedType===Ze.promise?t.data:Promise.resolve(t.data);return Wr(r.then((i)=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Gs.create=(e,t)=>new Gs({type:e,typeName:Le.ZodPromise,...ht(t)});class ei extends bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:(o)=>{if(Je(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){let o=i.transform(r.data,n);if(r.common.async)return Promise.resolve(o).then(async(s)=>{if(t.value==="aborted")return ot;let h=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(h.status==="aborted")return ot;if(h.status==="dirty")return Hs(h.value);if(t.value==="dirty")return Hs(h.value);return h});else{if(t.value==="aborted")return ot;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")return Hs(s.value);if(t.value==="dirty")return Hs(s.value);return s}}if(i.type==="refinement"){let o=(s)=>{let h=i.refinement(s,n);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value).then(()=>({status:t.value,value:s.value}))})}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Fo(o))return ot;let s=i.transform(o.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!Fo(o))return ot;return Promise.resolve(i.transform(o.value,n)).then((s)=>({status:t.value,value:s}))});wt.assertNever(i)}}ei.create=(e,t,r)=>new ei({schema:e,typeName:Le.ZodEffects,effect:t,...ht(r)});ei.createWithPreprocess=(e,t,r)=>new ei({schema:t,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...ht(r)});class $n extends bt{_parse(e){if(this._getType(e)===Ze.undefined)return Wr(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Le.ZodOptional,...ht(t)});class Xi extends bt{_parse(e){if(this._getType(e)===Ze.null)return Wr(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xi.create=(e,t)=>new Xi({innerType:e,typeName:Le.ZodNullable,...ht(t)});class Hl extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===Ze.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...ht(t)});class Zl extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Ol(i))return i.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}));else return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zl.create=(e,t)=>new Zl({innerType:e,typeName:Le.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...ht(t)});class qh extends bt{_parse(e){if(this._getType(e)!==Ze.nan){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.nan,received:r.parsedType}),ot}return{status:"valid",value:e.data}}}qh.create=(e)=>new qh({typeName:Le.ZodNaN,...ht(e)});var Dme=Symbol("zod_brand");class Vv extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Bh extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return ot;if(n.status==="dirty")return t.dirty(),Hs(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return ot;if(i.status==="dirty")return t.dirty(),{status:"dirty",value:i.value};else return this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new Bh({in:e,out:t,typeName:Le.ZodPipeline})}}class Kl extends bt{_parse(e){let t=this._def.innerType._parse(e),r=(i)=>{if(Fo(i))i.value=Object.freeze(i.value);return i};return Ol(t)?t.then((i)=>r(i)):r(t)}unwrap(){return this._def.innerType}}Kl.create=(e,t)=>new Kl({innerType:e,typeName:Le.ZodReadonly,...ht(t)});var Nme={object:er.lazycreate},Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));var zme=wi.create,jme=Ks.create,Ume=qh.create,Lme=Vs.create,Fme=Nh.create,qme=Nl.create,Bme=zh.create,Hme=zl.create,Zme=jl.create,Kme=jh.create,Vme=qo.create,Wme=Si.create,Gme=Uh.create,Jme=Qn.create,p6=er.create,Xme=er.strictCreate,Yme=Ul.create,Qme=Kv.create,e0e=Ll.create,t0e=xi.create,r0e=Lh.create,n0e=Fh.create,i0e=Ws.create,o0e=Dl.create,s0e=Fl.create,a0e=ql.create,u0e=Bo.create,l0e=Bl.create,c0e=Gs.create,d0e=ei.create,f0e=$n.create,h0e=Xi.create,p0e=ei.createWithPreprocess,m0e=Bh.create;var gO=ne("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ut.init(e,t),e.def=t,e.parse=(r,i)=>wo(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ui(e,r,i),e.parseAsync=async(r,i)=>So(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Li(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((i)=>typeof i==="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(r,i)=>Ur(e,r,i),e.brand=()=>e,e.register=(r,i)=>(r.add(e,i),e)});var yO=ne("ZodMiniObject",(e,t)=>{Ba.init(e,t),gO.init(e,t),Be.defineLazy(e,"shape",()=>t.shape)});function Wv(e,t){let r={type:"object",get shape(){return Be.assignProp(this,"shape",{...e}),this.shape},...Be.normalizeParams(t)};return new yO(r)}function Tn(e){return!!e._zod}function Ho(e){let t=Object.values(e);if(t.length===0)return Wv({});let r=t.every(Tn),i=t.every((n)=>!Tn(n));if(r)return Wv(e);if(i)return p6(e);throw Error("Mixed Zod versions detected in object shape.")}function Yi(e,t){if(Tn(e))return Ui(e,t);return e.safeParse(t)}async function Hh(e,t){if(Tn(e))return await Li(e,t);return await e.safeParseAsync(t)}function Qi(e){if(!e)return;let t;if(Tn(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Js(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let i=Object.values(e);if(i.length>0&&i.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Ho(e)}}if(Tn(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Zh(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function m6(e){return e.description}function g6(e){if(Tn(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Kh(e){if(Tn(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=e.value;if(i!==void 0)return i;return}var Gv="2025-11-25";var y6=[Gv,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],eo="io.modelcontextprotocol/related-task",Wh="2.0",xr=Fy((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),v6=Dt([de(),It().int()]),b6=de(),P0e=Lr({ttl:It().optional(),pollInterval:It().optional()}),bO=Qe({ttl:It().optional()}),_O=Qe({taskId:de()}),Jv=Lr({progressToken:v6.optional(),[eo]:_O.optional()}),_n=Qe({_meta:Jv.optional()}),Vl=_n.extend({task:bO.optional()}),_6=(e)=>Vl.safeParse(e).success,Or=Qe({method:de(),params:_n.loose().optional()}),Pn=Qe({_meta:Jv.optional()}),An=Qe({method:de(),params:Pn.loose().optional()}),Dr=Lr({_meta:Jv.optional()}),Gh=Dt([de(),It().int()]),w6=Qe({jsonrpc:tt(Wh),id:Gh,...Or.shape}).strict(),Xv=(e)=>w6.safeParse(e).success,S6=Qe({jsonrpc:tt(Wh),...An.shape}).strict(),x6=(e)=>S6.safeParse(e).success,Yv=Qe({jsonrpc:tt(Wh),id:Gh,result:Dr}).strict(),Wl=(e)=>Yv.safeParse(e).success;var it;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(it||(it={}));var Qv=Qe({jsonrpc:tt(Wh),id:Gh.optional(),error:Qe({code:It().int(),message:de(),data:qt().optional()})}).strict();var k6=(e)=>Qv.safeParse(e).success;var A0e=Dt([w6,S6,Yv,Qv]),R0e=Dt([Yv,Qv]),Jh=Dr.strict(),wO=Pn.extend({requestId:Gh.optional(),reason:de().optional()}),Xh=An.extend({method:tt("notifications/cancelled"),params:wO}),SO=Qe({src:de(),mimeType:de().optional(),sizes:_t(de()).optional(),theme:Vr(["light","dark"]).optional()}),Gl=Qe({icons:_t(SO).optional()}),Xs=Qe({name:de(),title:de().optional()}),M6=Xs.extend({...Xs.shape,...Gl.shape,version:de(),websiteUrl:de().optional(),description:de().optional()}),xO=Cu(Qe({applyDefaults:or().optional()}),Nt(de(),qt())),kO=Gf((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Cu(Qe({form:xO.optional(),url:xr.optional()}),Nt(de(),qt()).optional())),MO=Lr({list:xr.optional(),cancel:xr.optional(),requests:Lr({sampling:Lr({createMessage:xr.optional()}).optional(),elicitation:Lr({create:xr.optional()}).optional()}).optional()}),EO=Lr({list:xr.optional(),cancel:xr.optional(),requests:Lr({tools:Lr({call:xr.optional()}).optional()}).optional()}),IO=Qe({experimental:Nt(de(),xr).optional(),sampling:Qe({context:xr.optional(),tools:xr.optional()}).optional(),elicitation:kO.optional(),roots:Qe({listChanged:or().optional()}).optional(),tasks:MO.optional(),extensions:Nt(de(),xr).optional()}),$O=_n.extend({protocolVersion:de(),capabilities:IO,clientInfo:M6}),eb=Or.extend({method:tt("initialize"),params:$O});var TO=Qe({experimental:Nt(de(),xr).optional(),logging:xr.optional(),completions:xr.optional(),prompts:Qe({listChanged:or().optional()}).optional(),resources:Qe({subscribe:or().optional(),listChanged:or().optional()}).optional(),tools:Qe({listChanged:or().optional()}).optional(),tasks:EO.optional(),extensions:Nt(de(),xr).optional()}),PO=Dr.extend({protocolVersion:de(),capabilities:TO,serverInfo:M6,instructions:de().optional()}),tb=An.extend({method:tt("notifications/initialized"),params:Pn.optional()});var Yh=Or.extend({method:tt("ping"),params:_n.optional()}),AO=Qe({progress:It(),total:Lt(It()),message:Lt(de())}),RO=Qe({...Pn.shape,...AO.shape,progressToken:v6}),Qh=An.extend({method:tt("notifications/progress"),params:RO}),CO=_n.extend({cursor:b6.optional()}),Jl=Or.extend({params:CO.optional()}),Xl=Dr.extend({nextCursor:b6.optional()}),OO=Vr(["working","input_required","completed","failed","cancelled"]),Yl=Qe({taskId:de(),status:OO,ttl:Dt([It(),Bf()]),createdAt:de(),lastUpdatedAt:de(),pollInterval:Lt(It()),statusMessage:Lt(de())}),Ys=Dr.extend({task:Yl}),DO=Pn.merge(Yl),Ql=An.extend({method:tt("notifications/tasks/status"),params:DO}),ep=Or.extend({method:tt("tasks/get"),params:_n.extend({taskId:de()})}),tp=Dr.merge(Yl),rp=Or.extend({method:tt("tasks/result"),params:_n.extend({taskId:de()})}),C0e=Dr.loose(),np=Jl.extend({method:tt("tasks/list")}),ip=Xl.extend({tasks:_t(Yl)}),op=Or.extend({method:tt("tasks/cancel"),params:_n.extend({taskId:de()})}),E6=Dr.merge(Yl),I6=Qe({uri:de(),mimeType:Lt(de()),_meta:Nt(de(),qt()).optional()}),$6=I6.extend({text:de()}),rb=de().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),T6=I6.extend({blob:rb}),ec=Vr(["user","assistant"]),Qs=Qe({audience:_t(ec).optional(),priority:It().min(0).max(1).optional(),lastModified:ks.datetime({offset:!0}).optional()}),P6=Qe({...Xs.shape,...Gl.shape,uri:de(),description:Lt(de()),mimeType:Lt(de()),size:Lt(It()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),NO=Qe({...Xs.shape,...Gl.shape,uriTemplate:de(),description:Lt(de()),mimeType:Lt(de()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),sp=Jl.extend({method:tt("resources/list")}),zO=Xl.extend({resources:_t(P6)}),ap=Jl.extend({method:tt("resources/templates/list")}),jO=Xl.extend({resourceTemplates:_t(NO)}),nb=_n.extend({uri:de()}),UO=nb,up=Or.extend({method:tt("resources/read"),params:UO}),LO=Dr.extend({contents:_t(Dt([$6,T6]))}),FO=An.extend({method:tt("notifications/resources/list_changed"),params:Pn.optional()}),qO=nb,BO=Or.extend({method:tt("resources/subscribe"),params:qO}),HO=nb,ZO=Or.extend({method:tt("resources/unsubscribe"),params:HO}),KO=Pn.extend({uri:de()}),VO=An.extend({method:tt("notifications/resources/updated"),params:KO}),WO=Qe({name:de(),description:Lt(de()),required:Lt(or())}),GO=Qe({...Xs.shape,...Gl.shape,description:Lt(de()),arguments:Lt(_t(WO)),_meta:Lt(Lr({}))}),lp=Jl.extend({method:tt("prompts/list")}),JO=Xl.extend({prompts:_t(GO)}),XO=_n.extend({name:de(),arguments:Nt(de(),de()).optional()}),cp=Or.extend({method:tt("prompts/get"),params:XO}),ib=Qe({type:tt("text"),text:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),ob=Qe({type:tt("image"),data:rb,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),sb=Qe({type:tt("audio"),data:rb,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),YO=Qe({type:tt("tool_use"),name:de(),id:de(),input:Nt(de(),qt()),_meta:Nt(de(),qt()).optional()}),QO=Qe({type:tt("resource"),resource:Dt([$6,T6]),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),eD=P6.extend({type:tt("resource_link")}),ab=Dt([ib,ob,sb,eD,QO]),tD=Qe({role:ec,content:ab}),rD=Dr.extend({description:de().optional(),messages:_t(tD)}),nD=An.extend({method:tt("notifications/prompts/list_changed"),params:Pn.optional()}),iD=Qe({title:de().optional(),readOnlyHint:or().optional(),destructiveHint:or().optional(),idempotentHint:or().optional(),openWorldHint:or().optional()}),oD=Qe({taskSupport:Vr(["required","optional","forbidden"]).optional()}),A6=Qe({...Xs.shape,...Gl.shape,description:de().optional(),inputSchema:Qe({type:tt("object"),properties:Nt(de(),xr).optional(),required:_t(de()).optional()}).catchall(qt()),outputSchema:Qe({type:tt("object"),properties:Nt(de(),xr).optional(),required:_t(de()).optional()}).catchall(qt()).optional(),annotations:iD.optional(),execution:oD.optional(),_meta:Nt(de(),qt()).optional()}),dp=Jl.extend({method:tt("tools/list")}),sD=Xl.extend({tools:_t(A6)}),fp=Dr.extend({content:_t(ab).default([]),structuredContent:Nt(de(),qt()).optional(),isError:or().optional()}),O0e=fp.or(Dr.extend({toolResult:qt()})),aD=Vl.extend({name:de(),arguments:Nt(de(),qt()).optional()}),ea=Or.extend({method:tt("tools/call"),params:aD}),uD=An.extend({method:tt("notifications/tools/list_changed"),params:Pn.optional()}),D0e=Qe({autoRefresh:or().default(!0),debounceMs:It().int().nonnegative().default(300)}),tc=Vr(["debug","info","notice","warning","error","critical","alert","emergency"]),lD=_n.extend({level:tc}),ub=Or.extend({method:tt("logging/setLevel"),params:lD}),cD=Pn.extend({level:tc,logger:de().optional(),data:qt()}),dD=An.extend({method:tt("notifications/message"),params:cD}),fD=Qe({name:de().optional()}),hD=Qe({hints:_t(fD).optional(),costPriority:It().min(0).max(1).optional(),speedPriority:It().min(0).max(1).optional(),intelligencePriority:It().min(0).max(1).optional()}),pD=Qe({mode:Vr(["auto","required","none"]).optional()}),mD=Qe({type:tt("tool_result"),toolUseId:de().describe("The unique identifier for the corresponding tool call."),content:_t(ab).default([]),structuredContent:Qe({}).loose().optional(),isError:or().optional(),_meta:Nt(de(),qt()).optional()}),gD=Vf("type",[ib,ob,sb]),Vh=Vf("type",[ib,ob,sb,YO,mD]),yD=Qe({role:ec,content:Dt([Vh,_t(Vh)]),_meta:Nt(de(),qt()).optional()}),vD=Vl.extend({messages:_t(yD),modelPreferences:hD.optional(),systemPrompt:de().optional(),includeContext:Vr(["none","thisServer","allServers"]).optional(),temperature:It().optional(),maxTokens:It().int(),stopSequences:_t(de()).optional(),metadata:xr.optional(),tools:_t(A6).optional(),toolChoice:pD.optional()}),bD=Or.extend({method:tt("sampling/createMessage"),params:vD}),rc=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens"]).or(de())),role:ec,content:gD}),lb=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens","toolUse"]).or(de())),role:ec,content:Dt([Vh,_t(Vh)])}),_D=Qe({type:tt("boolean"),title:de().optional(),description:de().optional(),default:or().optional()}),wD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),minLength:It().optional(),maxLength:It().optional(),format:Vr(["email","uri","date","date-time"]).optional(),default:de().optional()}),SD=Qe({type:Vr(["number","integer"]),title:de().optional(),description:de().optional(),minimum:It().optional(),maximum:It().optional(),default:It().optional()}),xD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:_t(de()),default:de().optional()}),kD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),oneOf:_t(Qe({const:de(),title:de()})),default:de().optional()}),MD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:_t(de()),enumNames:_t(de()).optional(),default:de().optional()}),ED=Dt([xD,kD]),ID=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({type:tt("string"),enum:_t(de())}),default:_t(de()).optional()}),$D=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({anyOf:_t(Qe({const:de(),title:de()}))}),default:_t(de()).optional()}),TD=Dt([ID,$D]),PD=Dt([MD,ED,TD]),AD=Dt([PD,_D,wD,SD]),RD=Vl.extend({mode:tt("form").optional(),message:de(),requestedSchema:Qe({type:tt("object"),properties:Nt(de(),AD),required:_t(de()).optional()})}),CD=Vl.extend({mode:tt("url"),message:de(),elicitationId:de(),url:de().url()}),OD=Dt([RD,CD]),DD=Or.extend({method:tt("elicitation/create"),params:OD}),ND=Pn.extend({elicitationId:de()}),zD=An.extend({method:tt("notifications/elicitation/complete"),params:ND}),ta=Dr.extend({action:Vr(["accept","decline","cancel"]),content:Gf((e)=>e===null?void 0:e,Nt(de(),Dt([de(),It(),or(),_t(de())])).optional())}),jD=Qe({type:tt("ref/resource"),uri:de()});var UD=Qe({type:tt("ref/prompt"),name:de()}),LD=_n.extend({ref:Dt([UD,jD]),argument:Qe({name:de(),value:de()}),context:Qe({arguments:Nt(de(),de()).optional()}).optional()}),hp=Or.extend({method:tt("completion/complete"),params:LD});function R6(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function C6(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var FD=Dr.extend({completion:Lr({values:_t(de()).max(100),total:Lt(It().int()),hasMore:Lt(or())})}),qD=Qe({uri:de().startsWith("file://"),name:de().optional(),_meta:Nt(de(),qt()).optional()}),BD=Or.extend({method:tt("roots/list"),params:_n.optional()}),cb=Dr.extend({roots:_t(qD)}),HD=An.extend({method:tt("notifications/roots/list_changed"),params:Pn.optional()}),N0e=Dt([Yh,eb,hp,ub,cp,lp,sp,ap,up,BO,ZO,ea,dp,ep,rp,np,op]),z0e=Dt([Xh,Qh,tb,HD,Ql]),j0e=Dt([Jh,rc,lb,ta,cb,tp,ip,Ys]),U0e=Dt([Yh,bD,DD,BD,ep,rp,np,op]),L0e=Dt([Xh,Qh,dD,VO,FO,uD,nD,Ql,zD]),F0e=Dt([Jh,PO,FD,rD,JO,zO,jO,LO,fp,sD,tp,ip,Ys]);class rt extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===it.UrlElicitationRequired&&r){let i=r;if(i.elicitations)return new O6(i.elicitations,t)}return new rt(e,t,r)}}class O6 extends rt{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(it.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function to(e){return e==="completed"||e==="failed"||e==="cancelled"}var N6=Symbol("Let zodToJsonSchema decide on which parser to use");var D6={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},z6=(e)=>typeof e==="string"?{...D6,name:e}:{...D6,...e};var j6=(e)=>{let t=z6(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};function db(e,t,r,i){if(!i?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function St(e,t,r,i,n){e[t]=r,db(e,t,i,n)}var pp=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Zt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?pp(t,e.currentPath):t.join("/")}}function U6(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==Le.ZodAny)r.items=st(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)St(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)St(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)St(r,"minItems",e.exactLength.value,e.exactLength.message,t),St(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function L6(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function F6(){return{type:"boolean"}}function mp(e,t){return st(e.type._def,t)}var q6=(e,t)=>st(e.innerType._def,t);function fb(e,t,r){let i=r??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>fb(e,t,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ZD(e,t)}}var ZD=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let i of e.checks)switch(i.kind){case"min":St(r,"minimum",i.value,i.message,t);break;case"max":St(r,"maximum",i.value,i.message,t);break}return r};function B6(e,t){return{...st(e.innerType._def,t),default:e.defaultValue()}}function H6(e,t){return t.effectStrategy==="input"?st(e.schema._def,t):Zt(t)}function Z6(e){return{type:"string",enum:Array.from(e.values)}}var KD=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function K6(e,t){let r=[st(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),st(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((o)=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((o)=>{if(KD(o)){if(n.push(...o.allOf),o.unevaluatedProperties===void 0)i=void 0}else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:h,...v}=o;s=v}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function V6(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var hb=void 0,Ln={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(hb===void 0)hb=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return hb},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function gp(e,t){let r={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t);break;case"max":St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Fn(r,"email",i.message,t);break;case"format:idn-email":Fn(r,"idn-email",i.message,t);break;case"pattern:zod":Gr(r,Ln.email,i.message,t);break}break;case"url":Fn(r,"uri",i.message,t);break;case"uuid":Fn(r,"uuid",i.message,t);break;case"regex":Gr(r,i.regex,i.message,t);break;case"cuid":Gr(r,Ln.cuid,i.message,t);break;case"cuid2":Gr(r,Ln.cuid2,i.message,t);break;case"startsWith":Gr(r,RegExp(`^${pb(i.value,t)}`),i.message,t);break;case"endsWith":Gr(r,RegExp(`${pb(i.value,t)}$`),i.message,t);break;case"datetime":Fn(r,"date-time",i.message,t);break;case"date":Fn(r,"date",i.message,t);break;case"time":Fn(r,"time",i.message,t);break;case"duration":Fn(r,"duration",i.message,t);break;case"length":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t),St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"includes":{Gr(r,RegExp(pb(i.value,t)),i.message,t);break}case"ip":{if(i.version!=="v6")Fn(r,"ipv4",i.message,t);if(i.version!=="v4")Fn(r,"ipv6",i.message,t);break}case"base64url":Gr(r,Ln.base64url,i.message,t);break;case"jwt":Gr(r,Ln.jwt,i.message,t);break;case"cidr":{if(i.version!=="v6")Gr(r,Ln.ipv4Cidr,i.message,t);if(i.version!=="v4")Gr(r,Ln.ipv6Cidr,i.message,t);break}case"emoji":Gr(r,Ln.emoji(),i.message,t);break;case"ulid":{Gr(r,Ln.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Fn(r,"binary",i.message,t);break}case"contentEncoding:base64":{St(r,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{Gr(r,Ln.base64,i.message,t);break}}break}case"nanoid":Gr(r,Ln.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(i)}return r}function pb(e,t){return t.patternStrategy==="escape"?WD(e):e}var VD=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function WD(e){let t="";for(let r=0;r<e.length;r++){if(!VD.has(e[r]))t+="\\";t+=e[r]}return t}function Fn(e,t,r,i){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&i.errorMessages&&{errorMessage:{format:r}}})}else St(e,"format",t,r,i)}function Gr(e,t,r,i){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:W6(t,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})}else St(e,"pattern",W6(t,i),r,i)}function W6(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source,n="",o=!1,s=!1,h=!1;for(let v=0;v<i.length;v++){if(o){n+=i[v],o=!1;continue}if(r.i){if(s){if(i[v].match(/[a-z]/)){if(h)n+=i[v],n+=`${i[v-2]}-${i[v]}`.toUpperCase(),h=!1;else if(i[v+1]==="-"&&i[v+2]?.match(/[a-z]/))n+=i[v],h=!0;else n+=`${i[v]}${i[v].toUpperCase()}`;continue}}else if(i[v].match(/[a-z]/)){n+=`[${i[v]}${i[v].toUpperCase()}]`;continue}}if(r.m){if(i[v]==="^"){n+=`(^|(?<=[\r
|
|
105
|
+
`);this.partialLine=o.pop()??"";for(let s of o){if(!s)continue;try{this.messages.enqueue(Bs(s))}catch(h){}}},this.abortHandler=()=>{this.close(),this.exitError=new On("WebSocket connection aborted by user")},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler)}catch(e){if(this.ready=!1,this.exitError=e,this.readyReject)this.readyReject(e);throw e}}async write(e){if(this.abortController.signal.aborted)throw new On("Operation aborted");if(!this.ready)await this.readyPromise;if(!this.ready||!this.ws||this.ws.readyState!==globalThis.WebSocket.OPEN)throw Error("WebSocketTransport is not ready for writing");this.ws.send(e)}close(){if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)this.ws.close(1000,"Normal closure");this.ready=!1,this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&this.ws?.readyState===globalThis.WebSocket.OPEN}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function u6(e){return new AbortController}var wt;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let o={};for(let s of n)o[s]=s;return o},e.getValidEnumValues=(n)=>{let o=e.objectKeys(n).filter((h)=>typeof n[n[h]]!=="number"),s={};for(let h of o)s[h]=n[h];return e.objectValues(s)},e.objectValues=(n)=>e.objectKeys(n).map(function(o){return n[o]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let o=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))o.push(s);return o},e.find=(n,o)=>{for(let s of n)if(o(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(n,o)=>{if(typeof o==="bigint")return o.toString();return o}})(wt||(wt={}));var l6;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(l6||(l6={}));var Ze=wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bi=(e)=>{switch(typeof e){case"undefined":return Ze.undefined;case"string":return Ze.string;case"number":return Number.isNaN(e)?Ze.nan:Ze.number;case"boolean":return Ze.boolean;case"function":return Ze.function;case"bigint":return Ze.bigint;case"symbol":return Ze.symbol;case"object":if(Array.isArray(e))return Ze.array;if(e===null)return Ze.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return Ze.promise;if(typeof Map<"u"&&e instanceof Map)return Ze.map;if(typeof Set<"u"&&e instanceof Set)return Ze.set;if(typeof Date<"u"&&e instanceof Date)return Ze.date;return Ze.object;default:return Ze.unknown}};var Ue=wt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class bn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},i=(n)=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let s=r,h=0;while(h<o.path.length){let v=o.path[h];if(h!==o.path.length-1)s[v]=s[v]||{_errors:[]};else s[v]=s[v]||{_errors:[]},s[v]._errors.push(t(o));s=s[v],h++}}};return i(this),r}static assert(e){if(!(e instanceof bn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let n=i.path[0];t[n]=t[n]||[],t[n].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}bn.create=(e)=>new bn(e);var ZC=(e,t)=>{let r;switch(e.code){case Ue.invalid_type:if(e.received===Ze.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,wt.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${wt.joinValues(e.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${wt.joinValues(e.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${wt.joinValues(e.options)}, received '${e.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else wt.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case Ue.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case Ue.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=t.defaultError,wt.assertNever(e)}return{message:r}},Ji=ZC;var KC=Ji;function Cl(){return KC}var Dh=(e)=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let h="",v=i.filter((b)=>!!b).slice().reverse();for(let b of v)h=b(s,{data:t,defaultError:h}).message;return{...n,path:o,message:h}};function Je(e,t){let r=Cl(),i=Dh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ji?void 0:Ji].filter((n)=>!!n)});e.common.issues.push(i)}class qr{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ot;if(i.status==="dirty")e.dirty();r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let n=await i.key,o=await i.value;r.push({key:n,value:o})}return qr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:n,value:o}=i;if(n.status==="aborted")return ot;if(o.status==="aborted")return ot;if(n.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet))r[n.value]=o.value}return{status:e.value,value:r}}}var ot=Object.freeze({status:"aborted"}),Hs=(e)=>({status:"dirty",value:e}),Wr=(e)=>({status:"valid",value:e}),qv=(e)=>e.status==="aborted",Bv=(e)=>e.status==="dirty",Fo=(e)=>e.status==="valid",Ol=(e)=>typeof Promise<"u"&&e instanceof Promise;var et;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(et||(et={}));class Un{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var c6=(e,t)=>{if(Fo(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bn(e.common.issues);return this._error=r,this._error}}}};function ht(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,h)=>{let{message:v}=e;if(s.code==="invalid_enum_value")return{message:v??h.defaultError};if(typeof h.data>"u")return{message:v??i??h.defaultError};if(s.code!=="invalid_type")return{message:h.defaultError};return{message:v??r??h.defaultError}},description:n}}class bt{get description(){return this._def.description}_getType(e){return bi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qr,ctx:{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ol(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parseSync({data:e,path:r.path,parent:r});return c6(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Fo(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Fo(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parse({data:e,path:r.path,parent:r}),n=await(Ol(i)?i:Promise.resolve(i));return c6(r,n)}refine(e,t){let r=(i)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(i);else return t};return this._refinement((i,n)=>{let o=e(i),s=()=>n.addIssue({code:Ue.custom,...r(i)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((h)=>{if(!h)return s(),!1;else return!0});if(!o)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,i)=>{if(!e(r))return i.addIssue(typeof t==="function"?t(r,i):t),!1;else return!0})}_refinement(e){return new ei({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return $n.create(this,this._def)}nullable(){return Xi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qn.create(this)}promise(){return Gs.create(this,this._def)}or(e){return Ul.create([this,e],this._def)}and(e){return Ll.create(this,e,this._def)}transform(e){return new ei({...ht(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Hl({...ht(this._def),innerType:this,defaultValue:t,typeName:Le.ZodDefault})}brand(){return new Vv({typeName:Le.ZodBranded,type:this,...ht(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Zl({...ht(this._def),innerType:this,catchValue:t,typeName:Le.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Bh.create(this,e)}readonly(){return Kl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var VC=/^c[^\s-]{8,}$/i,WC=/^[0-9a-z]+$/,GC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JC=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,XC=/^[a-z0-9_-]{21}$/i,YC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,QC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,eO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hv,rO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,iO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,oO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,aO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d6="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",uO=new RegExp(`^${d6}$`);function f6(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function lO(e){return new RegExp(`^${f6(e)}$`)}function cO(e){let t=`${d6}T${f6(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function dO(e,t){if((t==="v4"||!t)&&rO.test(e))return!0;if((t==="v6"||!t)&&iO.test(e))return!0;return!1}function fO(e,t){if(!YC.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function hO(e,t){if((t==="v4"||!t)&&nO.test(e))return!0;if((t==="v6"||!t)&&oO.test(e))return!0;return!1}class wi extends bt{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==Ze.string){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.string,received:n.parsedType}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let o=e.data.length>n.value,s=e.data.length<n.value;if(o||s){if(i=this._getOrReturnCtx(e,i),o)Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!eO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"email",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Hv)Hv=new RegExp(tO,"u");if(!Hv.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"emoji",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!JC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"uuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!XC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"nanoid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!VC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!WC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid2",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!GC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ulid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Je(i,{validation:"url",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"regex",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!cO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!uO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!lO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!QC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"duration",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!dO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ip",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!fO(e.data,n.alg))i=this._getOrReturnCtx(e,i),Je(i,{validation:"jwt",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!hO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cidr",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!sO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!aO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64url",code:Ue.invalid_string,message:n.message}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((i)=>e.test(i),{validation:t,code:Ue.invalid_string,...et.errToObj(r)})}_addCheck(e){return new wi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...et.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...et.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...et.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...et.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...et.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...et.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...et.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...et.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...et.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...et.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...et.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...et.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...et.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...et.errToObj(t)})}nonempty(e){return this.min(1,et.errToObj(e))}trim(){return new wi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new wi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new wi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}wi.create=(e)=>new wi({checks:[],typeName:Le.ZodString,coerce:e?.coerce??!1,...ht(e)});function pO(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}class Ks extends bt{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==Ze.number){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.number,received:n.parsedType}),ot}let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="int"){if(!wt.isInteger(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(pO(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_finite,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Ks({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Ks({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&wt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ks.create=(e)=>new Ks({checks:[],typeName:Le.ZodNumber,coerce:e?.coerce||!1,...ht(e)});class Vs extends bt{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ze.bigint)return this._getInvalidInput(e);let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.bigint,received:t.parsedType}),ot}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Vs({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Vs.create=(e)=>new Vs({checks:[],typeName:Le.ZodBigInt,coerce:e?.coerce??!1,...ht(e)});class Nh extends bt{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==Ze.boolean){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.boolean,received:r.parsedType}),ot}return Wr(e.data)}}Nh.create=(e)=>new Nh({typeName:Le.ZodBoolean,coerce:e?.coerce||!1,...ht(e)});class Nl extends bt{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==Ze.date){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.date,received:n.parsedType}),ot}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_date}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Nl({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:et.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:et.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Nl.create=(e)=>new Nl({checks:[],coerce:e?.coerce||!1,typeName:Le.ZodDate,...ht(e)});class zh extends bt{_parse(e){if(this._getType(e)!==Ze.symbol){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.symbol,received:r.parsedType}),ot}return Wr(e.data)}}zh.create=(e)=>new zh({typeName:Le.ZodSymbol,...ht(e)});class zl extends bt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.undefined,received:r.parsedType}),ot}return Wr(e.data)}}zl.create=(e)=>new zl({typeName:Le.ZodUndefined,...ht(e)});class jl extends bt{_parse(e){if(this._getType(e)!==Ze.null){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.null,received:r.parsedType}),ot}return Wr(e.data)}}jl.create=(e)=>new jl({typeName:Le.ZodNull,...ht(e)});class jh extends bt{constructor(){super(...arguments);this._any=!0}_parse(e){return Wr(e.data)}}jh.create=(e)=>new jh({typeName:Le.ZodAny,...ht(e)});class qo extends bt{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Wr(e.data)}}qo.create=(e)=>new qo({typeName:Le.ZodUnknown,...ht(e)});class Si extends bt{_parse(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.never,received:t.parsedType}),ot}}Si.create=(e)=>new Si({typeName:Le.ZodNever,...ht(e)});class Uh extends bt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.void,received:r.parsedType}),ot}return Wr(e.data)}}Uh.create=(e)=>new Uh({typeName:Le.ZodVoid,...ht(e)});class Qn extends bt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ze.array)return Je(t,{code:Ue.invalid_type,expected:Ze.array,received:t.parsedType}),ot;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;if(o||s)Je(t,{code:o?Ue.too_big:Ue.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty()}if(i.minLength!==null){if(t.data.length<i.minLength.value)Je(t,{code:Ue.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()}if(i.maxLength!==null){if(t.data.length>i.maxLength.value)Je(t,{code:Ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,s)=>i.type._parseAsync(new Un(t,o,t.path,s)))).then((o)=>qr.mergeArray(r,o));let n=[...t.data].map((o,s)=>i.type._parseSync(new Un(t,o,t.path,s)));return qr.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Qn({...this._def,minLength:{value:e,message:et.toString(t)}})}max(e,t){return new Qn({...this._def,maxLength:{value:e,message:et.toString(t)}})}length(e,t){return new Qn({...this._def,exactLength:{value:e,message:et.toString(t)}})}nonempty(e){return this.min(1,e)}}Qn.create=(e,t)=>new Qn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...ht(t)});function Zs(e){if(e instanceof er){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=$n.create(Zs(i))}return new er({...e._def,shape:()=>t})}else if(e instanceof Qn)return new Qn({...e._def,type:Zs(e.element)});else if(e instanceof $n)return $n.create(Zs(e.unwrap()));else if(e instanceof Xi)return Xi.create(Zs(e.unwrap()));else if(e instanceof xi)return xi.create(e.items.map((t)=>Zs(t)));else return e}class er extends bt{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=wt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ze.object){let v=this._getOrReturnCtx(e);return Je(v,{code:Ue.invalid_type,expected:Ze.object,received:v.parsedType}),ot}let{status:r,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Si&&this._def.unknownKeys==="strip")){for(let v in i.data)if(!o.includes(v))s.push(v)}let h=[];for(let v of o){let b=n[v],_=i.data[v];h.push({key:{status:"valid",value:v},value:b._parse(new Un(i,_,i.path,v)),alwaysSet:v in i.data})}if(this._def.catchall instanceof Si){let v=this._def.unknownKeys;if(v==="passthrough")for(let b of s)h.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(v==="strict"){if(s.length>0)Je(i,{code:Ue.unrecognized_keys,keys:s}),r.dirty()}else if(v==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let b of s){let _=i.data[b];h.push({key:{status:"valid",value:b},value:v._parse(new Un(i,_,i.path,b)),alwaysSet:b in i.data})}}if(i.common.async)return Promise.resolve().then(async()=>{let v=[];for(let b of h){let _=await b.key,g=await b.value;v.push({key:_,value:g,alwaysSet:b.alwaysSet})}return v}).then((v)=>qr.mergeObjectSync(r,v));else return qr.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return et.errToObj,new er({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:et.errToObj(e).message??i};return{message:i}}}:{}})}strip(){return new er({...this._def,unknownKeys:"strip"})}passthrough(){return new er({...this._def,unknownKeys:"passthrough"})}extend(e){return new er({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new er({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Le.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new er({...this._def,catchall:e})}pick(e){let t={};for(let r of wt.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new er({...this._def,shape:()=>t})}omit(e){let t={};for(let r of wt.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new er({...this._def,shape:()=>t})}deepPartial(){return Zs(this)}partial(e){let t={};for(let r of wt.objectKeys(this.shape)){let i=this.shape[r];if(e&&!e[r])t[r]=i;else t[r]=i.optional()}return new er({...this._def,shape:()=>t})}required(e){let t={};for(let r of wt.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof $n)n=n._def.innerType;t[r]=n}return new er({...this._def,shape:()=>t})}keyof(){return h6(wt.objectKeys(this.shape))}}er.create=(e,t)=>new er({shape:()=>e,unknownKeys:"strip",catchall:Si.create(),typeName:Le.ZodObject,...ht(t)});er.strictCreate=(e,t)=>new er({shape:()=>e,unknownKeys:"strict",catchall:Si.create(),typeName:Le.ZodObject,...ht(t)});er.lazycreate=(e,t)=>new er({shape:e,unknownKeys:"strip",catchall:Si.create(),typeName:Le.ZodObject,...ht(t)});class Ul extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map((s)=>new bn(s.ctx.common.issues));return Je(t,{code:Ue.invalid_union,unionErrors:o}),ot}if(t.common.async)return Promise.all(r.map(async(n)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);else{let n=void 0,o=[];for(let h of r){let v={...t,common:{...t.common,issues:[]},parent:null},b=h._parseSync({data:t.data,path:t.path,parent:v});if(b.status==="valid")return b;else if(b.status==="dirty"&&!n)n={result:b,ctx:v};if(v.common.issues.length)o.push(v.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=o.map((h)=>new bn(h));return Je(t,{code:Ue.invalid_union,unionErrors:s}),ot}}get options(){return this._def.options}}Ul.create=(e,t)=>new Ul({options:e,typeName:Le.ZodUnion,...ht(t)});var _i=(e)=>{if(e instanceof Fl)return _i(e.schema);else if(e instanceof ei)return _i(e.innerType());else if(e instanceof ql)return[e.value];else if(e instanceof Bo)return e.options;else if(e instanceof Bl)return wt.objectValues(e.enum);else if(e instanceof Hl)return _i(e._def.innerType);else if(e instanceof zl)return[void 0];else if(e instanceof jl)return[null];else if(e instanceof $n)return[void 0,..._i(e.unwrap())];else if(e instanceof Xi)return[null,..._i(e.unwrap())];else if(e instanceof Vv)return _i(e.unwrap());else if(e instanceof Kl)return _i(e.unwrap());else if(e instanceof Zl)return _i(e._def.innerType);else return[]};class Kv extends bt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.object)return Je(t,{code:Ue.invalid_type,expected:Ze.object,received:t.parsedType}),ot;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);if(!n)return Je(t,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ot;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let n of t){let o=_i(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,n)}}return new Kv({typeName:Le.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ht(r)})}}function Zv(e,t){let r=bi(e),i=bi(t);if(e===t)return{valid:!0,data:e};else if(r===Ze.object&&i===Ze.object){let n=wt.objectKeys(t),o=wt.objectKeys(e).filter((h)=>n.indexOf(h)!==-1),s={...e,...t};for(let h of o){let v=Zv(e[h],t[h]);if(!v.valid)return{valid:!1};s[h]=v.data}return{valid:!0,data:s}}else if(r===Ze.array&&i===Ze.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let o=0;o<e.length;o++){let s=e[o],h=t[o],v=Zv(s,h);if(!v.valid)return{valid:!1};n.push(v.data)}return{valid:!0,data:n}}else if(r===Ze.date&&i===Ze.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Ll extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(n,o)=>{if(qv(n)||qv(o))return ot;let s=Zv(n.value,o.value);if(!s.valid)return Je(r,{code:Ue.invalid_intersection_types}),ot;if(Bv(n)||Bv(o))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,o])=>i(n,o));else return i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ll.create=(e,t,r)=>new Ll({left:e,right:t,typeName:Le.ZodIntersection,...ht(r)});class xi extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.array)return Je(r,{code:Ue.invalid_type,expected:Ze.array,received:r.parsedType}),ot;if(r.data.length<this._def.items.length)return Je(r,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;if(!this._def.rest&&r.data.length>this._def.items.length)Je(r,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((o,s)=>{let h=this._def.items[s]||this._def.rest;if(!h)return null;return h._parse(new Un(r,o,r.path,s))}).filter((o)=>!!o);if(r.common.async)return Promise.all(n).then((o)=>qr.mergeArray(t,o));else return qr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new xi({...this._def,rest:e})}}xi.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new xi({items:e,typeName:Le.ZodTuple,rest:null,...ht(t)})};class Lh extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.object)return Je(r,{code:Ue.invalid_type,expected:Ze.object,received:r.parsedType}),ot;let i=[],n=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:n._parse(new Un(r,s,r.path,s)),value:o._parse(new Un(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return qr.mergeObjectAsync(t,i);else return qr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof bt)return new Lh({keyType:e,valueType:t,typeName:Le.ZodRecord,...ht(r)});return new Lh({keyType:wi.create(),valueType:e,typeName:Le.ZodRecord,...ht(t)})}}class Fh extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.map)return Je(r,{code:Ue.invalid_type,expected:Ze.map,received:r.parsedType}),ot;let i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([s,h],v)=>({key:i._parse(new Un(r,s,r.path,[v,"key"])),value:n._parse(new Un(r,h,r.path,[v,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let h of o){let v=await h.key,b=await h.value;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let h of o){let{key:v,value:b}=h;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}}}}Fh.create=(e,t,r)=>new Fh({valueType:t,keyType:e,typeName:Le.ZodMap,...ht(r)});class Ws extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.set)return Je(r,{code:Ue.invalid_type,expected:Ze.set,received:r.parsedType}),ot;let i=this._def;if(i.minSize!==null){if(r.data.size<i.minSize.value)Je(r,{code:Ue.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()}if(i.maxSize!==null){if(r.data.size>i.maxSize.value)Je(r,{code:Ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty()}let n=this._def.valueType;function o(h){let v=new Set;for(let b of h){if(b.status==="aborted")return ot;if(b.status==="dirty")t.dirty();v.add(b.value)}return{status:t.value,value:v}}let s=[...r.data.values()].map((h,v)=>n._parse(new Un(r,h,r.path,v)));if(r.common.async)return Promise.all(s).then((h)=>o(h));else return o(s)}min(e,t){return new Ws({...this._def,minSize:{value:e,message:et.toString(t)}})}max(e,t){return new Ws({...this._def,maxSize:{value:e,message:et.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ws.create=(e,t)=>new Ws({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...ht(t)});class Dl extends bt{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.function)return Je(t,{code:Ue.invalid_type,expected:Ze.function,received:t.parsedType}),ot;function r(s,h){return Dh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_arguments,argumentsError:h}})}function i(s,h){return Dh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_return_type,returnTypeError:h}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Gs){let s=this;return Wr(async function(...h){let v=new bn([]),b=await s._def.args.parseAsync(h,n).catch((S)=>{throw v.addIssue(r(h,S)),v}),_=await Reflect.apply(o,this,b);return await s._def.returns._def.type.parseAsync(_,n).catch((S)=>{throw v.addIssue(i(_,S)),v})})}else{let s=this;return Wr(function(...h){let v=s._def.args.safeParse(h,n);if(!v.success)throw new bn([r(h,v.error)]);let b=Reflect.apply(o,this,v.data),_=s._def.returns.safeParse(b,n);if(!_.success)throw new bn([i(b,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Dl({...this._def,args:xi.create(e).rest(qo.create())})}returns(e){return new Dl({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Dl({args:e?e:xi.create([]).rest(qo.create()),returns:t||qo.create(),typeName:Le.ZodFunction,...ht(r)})}}class Fl extends bt{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Fl.create=(e,t)=>new Fl({getter:e,typeName:Le.ZodLazy,...ht(t)});class ql extends bt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Je(t,{received:t.data,code:Ue.invalid_literal,expected:this._def.value}),ot}return{status:"valid",value:e.data}}get value(){return this._def.value}}ql.create=(e,t)=>new ql({value:e,typeName:Le.ZodLiteral,...ht(t)});function h6(e,t){return new Bo({values:e,typeName:Le.ZodEnum,...ht(t)})}class Bo extends bt{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{expected:wt.joinValues(r),received:t.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{received:t.data,code:Ue.invalid_enum_value,options:r}),ot}return Wr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Bo.create(e,{...this._def,...t})}exclude(e,t=this._def){return Bo.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Bo.create=h6;class Bl extends bt{_parse(e){let t=wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ze.string&&r.parsedType!==Ze.number){let i=wt.objectValues(t);return Je(r,{expected:wt.joinValues(i),received:r.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(wt.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let i=wt.objectValues(t);return Je(r,{received:r.data,code:Ue.invalid_enum_value,options:i}),ot}return Wr(e.data)}get enum(){return this._def.values}}Bl.create=(e,t)=>new Bl({values:e,typeName:Le.ZodNativeEnum,...ht(t)});class Gs extends bt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.promise&&t.common.async===!1)return Je(t,{code:Ue.invalid_type,expected:Ze.promise,received:t.parsedType}),ot;let r=t.parsedType===Ze.promise?t.data:Promise.resolve(t.data);return Wr(r.then((i)=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Gs.create=(e,t)=>new Gs({type:e,typeName:Le.ZodPromise,...ht(t)});class ei extends bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:(o)=>{if(Je(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){let o=i.transform(r.data,n);if(r.common.async)return Promise.resolve(o).then(async(s)=>{if(t.value==="aborted")return ot;let h=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(h.status==="aborted")return ot;if(h.status==="dirty")return Hs(h.value);if(t.value==="dirty")return Hs(h.value);return h});else{if(t.value==="aborted")return ot;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")return Hs(s.value);if(t.value==="dirty")return Hs(s.value);return s}}if(i.type==="refinement"){let o=(s)=>{let h=i.refinement(s,n);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value).then(()=>({status:t.value,value:s.value}))})}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Fo(o))return ot;let s=i.transform(o.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!Fo(o))return ot;return Promise.resolve(i.transform(o.value,n)).then((s)=>({status:t.value,value:s}))});wt.assertNever(i)}}ei.create=(e,t,r)=>new ei({schema:e,typeName:Le.ZodEffects,effect:t,...ht(r)});ei.createWithPreprocess=(e,t,r)=>new ei({schema:t,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...ht(r)});class $n extends bt{_parse(e){if(this._getType(e)===Ze.undefined)return Wr(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Le.ZodOptional,...ht(t)});class Xi extends bt{_parse(e){if(this._getType(e)===Ze.null)return Wr(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xi.create=(e,t)=>new Xi({innerType:e,typeName:Le.ZodNullable,...ht(t)});class Hl extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===Ze.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...ht(t)});class Zl extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Ol(i))return i.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}));else return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zl.create=(e,t)=>new Zl({innerType:e,typeName:Le.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...ht(t)});class qh extends bt{_parse(e){if(this._getType(e)!==Ze.nan){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.nan,received:r.parsedType}),ot}return{status:"valid",value:e.data}}}qh.create=(e)=>new qh({typeName:Le.ZodNaN,...ht(e)});var Nme=Symbol("zod_brand");class Vv extends bt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Bh extends bt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return ot;if(n.status==="dirty")return t.dirty(),Hs(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return ot;if(i.status==="dirty")return t.dirty(),{status:"dirty",value:i.value};else return this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new Bh({in:e,out:t,typeName:Le.ZodPipeline})}}class Kl extends bt{_parse(e){let t=this._def.innerType._parse(e),r=(i)=>{if(Fo(i))i.value=Object.freeze(i.value);return i};return Ol(t)?t.then((i)=>r(i)):r(t)}unwrap(){return this._def.innerType}}Kl.create=(e,t)=>new Kl({innerType:e,typeName:Le.ZodReadonly,...ht(t)});var zme={object:er.lazycreate},Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));var jme=wi.create,Ume=Ks.create,Lme=qh.create,Fme=Vs.create,qme=Nh.create,Bme=Nl.create,Hme=zh.create,Zme=zl.create,Kme=jl.create,Vme=jh.create,Wme=qo.create,Gme=Si.create,Jme=Uh.create,Xme=Qn.create,p6=er.create,Yme=er.strictCreate,Qme=Ul.create,e0e=Kv.create,t0e=Ll.create,r0e=xi.create,n0e=Lh.create,i0e=Fh.create,o0e=Ws.create,s0e=Dl.create,a0e=Fl.create,u0e=ql.create,l0e=Bo.create,c0e=Bl.create,d0e=Gs.create,f0e=ei.create,h0e=$n.create,p0e=Xi.create,m0e=ei.createWithPreprocess,g0e=Bh.create;var gO=ne("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ut.init(e,t),e.def=t,e.parse=(r,i)=>wo(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ui(e,r,i),e.parseAsync=async(r,i)=>So(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Li(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((i)=>typeof i==="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(r,i)=>Ur(e,r,i),e.brand=()=>e,e.register=(r,i)=>(r.add(e,i),e)});var yO=ne("ZodMiniObject",(e,t)=>{Ba.init(e,t),gO.init(e,t),Be.defineLazy(e,"shape",()=>t.shape)});function Wv(e,t){let r={type:"object",get shape(){return Be.assignProp(this,"shape",{...e}),this.shape},...Be.normalizeParams(t)};return new yO(r)}function Tn(e){return!!e._zod}function Ho(e){let t=Object.values(e);if(t.length===0)return Wv({});let r=t.every(Tn),i=t.every((n)=>!Tn(n));if(r)return Wv(e);if(i)return p6(e);throw Error("Mixed Zod versions detected in object shape.")}function Yi(e,t){if(Tn(e))return Ui(e,t);return e.safeParse(t)}async function Hh(e,t){if(Tn(e))return await Li(e,t);return await e.safeParseAsync(t)}function Qi(e){if(!e)return;let t;if(Tn(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Js(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let i=Object.values(e);if(i.length>0&&i.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Ho(e)}}if(Tn(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Zh(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function m6(e){return e.description}function g6(e){if(Tn(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Kh(e){if(Tn(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=e.value;if(i!==void 0)return i;return}var Gv="2025-11-25";var y6=[Gv,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],eo="io.modelcontextprotocol/related-task",Wh="2.0",xr=Fy((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),v6=Dt([de(),It().int()]),b6=de(),A0e=Lr({ttl:It().optional(),pollInterval:It().optional()}),bO=Qe({ttl:It().optional()}),_O=Qe({taskId:de()}),Jv=Lr({progressToken:v6.optional(),[eo]:_O.optional()}),_n=Qe({_meta:Jv.optional()}),Vl=_n.extend({task:bO.optional()}),_6=(e)=>Vl.safeParse(e).success,Or=Qe({method:de(),params:_n.loose().optional()}),Pn=Qe({_meta:Jv.optional()}),An=Qe({method:de(),params:Pn.loose().optional()}),Dr=Lr({_meta:Jv.optional()}),Gh=Dt([de(),It().int()]),w6=Qe({jsonrpc:tt(Wh),id:Gh,...Or.shape}).strict(),Xv=(e)=>w6.safeParse(e).success,S6=Qe({jsonrpc:tt(Wh),...An.shape}).strict(),x6=(e)=>S6.safeParse(e).success,Yv=Qe({jsonrpc:tt(Wh),id:Gh,result:Dr}).strict(),Wl=(e)=>Yv.safeParse(e).success;var it;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(it||(it={}));var Qv=Qe({jsonrpc:tt(Wh),id:Gh.optional(),error:Qe({code:It().int(),message:de(),data:qt().optional()})}).strict();var k6=(e)=>Qv.safeParse(e).success;var R0e=Dt([w6,S6,Yv,Qv]),C0e=Dt([Yv,Qv]),Jh=Dr.strict(),wO=Pn.extend({requestId:Gh.optional(),reason:de().optional()}),Xh=An.extend({method:tt("notifications/cancelled"),params:wO}),SO=Qe({src:de(),mimeType:de().optional(),sizes:_t(de()).optional(),theme:Vr(["light","dark"]).optional()}),Gl=Qe({icons:_t(SO).optional()}),Xs=Qe({name:de(),title:de().optional()}),M6=Xs.extend({...Xs.shape,...Gl.shape,version:de(),websiteUrl:de().optional(),description:de().optional()}),xO=Cu(Qe({applyDefaults:or().optional()}),Nt(de(),qt())),kO=Gf((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Cu(Qe({form:xO.optional(),url:xr.optional()}),Nt(de(),qt()).optional())),MO=Lr({list:xr.optional(),cancel:xr.optional(),requests:Lr({sampling:Lr({createMessage:xr.optional()}).optional(),elicitation:Lr({create:xr.optional()}).optional()}).optional()}),EO=Lr({list:xr.optional(),cancel:xr.optional(),requests:Lr({tools:Lr({call:xr.optional()}).optional()}).optional()}),IO=Qe({experimental:Nt(de(),xr).optional(),sampling:Qe({context:xr.optional(),tools:xr.optional()}).optional(),elicitation:kO.optional(),roots:Qe({listChanged:or().optional()}).optional(),tasks:MO.optional(),extensions:Nt(de(),xr).optional()}),$O=_n.extend({protocolVersion:de(),capabilities:IO,clientInfo:M6}),eb=Or.extend({method:tt("initialize"),params:$O});var TO=Qe({experimental:Nt(de(),xr).optional(),logging:xr.optional(),completions:xr.optional(),prompts:Qe({listChanged:or().optional()}).optional(),resources:Qe({subscribe:or().optional(),listChanged:or().optional()}).optional(),tools:Qe({listChanged:or().optional()}).optional(),tasks:EO.optional(),extensions:Nt(de(),xr).optional()}),PO=Dr.extend({protocolVersion:de(),capabilities:TO,serverInfo:M6,instructions:de().optional()}),tb=An.extend({method:tt("notifications/initialized"),params:Pn.optional()});var Yh=Or.extend({method:tt("ping"),params:_n.optional()}),AO=Qe({progress:It(),total:Lt(It()),message:Lt(de())}),RO=Qe({...Pn.shape,...AO.shape,progressToken:v6}),Qh=An.extend({method:tt("notifications/progress"),params:RO}),CO=_n.extend({cursor:b6.optional()}),Jl=Or.extend({params:CO.optional()}),Xl=Dr.extend({nextCursor:b6.optional()}),OO=Vr(["working","input_required","completed","failed","cancelled"]),Yl=Qe({taskId:de(),status:OO,ttl:Dt([It(),Bf()]),createdAt:de(),lastUpdatedAt:de(),pollInterval:Lt(It()),statusMessage:Lt(de())}),Ys=Dr.extend({task:Yl}),DO=Pn.merge(Yl),Ql=An.extend({method:tt("notifications/tasks/status"),params:DO}),ep=Or.extend({method:tt("tasks/get"),params:_n.extend({taskId:de()})}),tp=Dr.merge(Yl),rp=Or.extend({method:tt("tasks/result"),params:_n.extend({taskId:de()})}),O0e=Dr.loose(),np=Jl.extend({method:tt("tasks/list")}),ip=Xl.extend({tasks:_t(Yl)}),op=Or.extend({method:tt("tasks/cancel"),params:_n.extend({taskId:de()})}),E6=Dr.merge(Yl),I6=Qe({uri:de(),mimeType:Lt(de()),_meta:Nt(de(),qt()).optional()}),$6=I6.extend({text:de()}),rb=de().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),T6=I6.extend({blob:rb}),ec=Vr(["user","assistant"]),Qs=Qe({audience:_t(ec).optional(),priority:It().min(0).max(1).optional(),lastModified:ks.datetime({offset:!0}).optional()}),P6=Qe({...Xs.shape,...Gl.shape,uri:de(),description:Lt(de()),mimeType:Lt(de()),size:Lt(It()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),NO=Qe({...Xs.shape,...Gl.shape,uriTemplate:de(),description:Lt(de()),mimeType:Lt(de()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),sp=Jl.extend({method:tt("resources/list")}),zO=Xl.extend({resources:_t(P6)}),ap=Jl.extend({method:tt("resources/templates/list")}),jO=Xl.extend({resourceTemplates:_t(NO)}),nb=_n.extend({uri:de()}),UO=nb,up=Or.extend({method:tt("resources/read"),params:UO}),LO=Dr.extend({contents:_t(Dt([$6,T6]))}),FO=An.extend({method:tt("notifications/resources/list_changed"),params:Pn.optional()}),qO=nb,BO=Or.extend({method:tt("resources/subscribe"),params:qO}),HO=nb,ZO=Or.extend({method:tt("resources/unsubscribe"),params:HO}),KO=Pn.extend({uri:de()}),VO=An.extend({method:tt("notifications/resources/updated"),params:KO}),WO=Qe({name:de(),description:Lt(de()),required:Lt(or())}),GO=Qe({...Xs.shape,...Gl.shape,description:Lt(de()),arguments:Lt(_t(WO)),_meta:Lt(Lr({}))}),lp=Jl.extend({method:tt("prompts/list")}),JO=Xl.extend({prompts:_t(GO)}),XO=_n.extend({name:de(),arguments:Nt(de(),de()).optional()}),cp=Or.extend({method:tt("prompts/get"),params:XO}),ib=Qe({type:tt("text"),text:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),ob=Qe({type:tt("image"),data:rb,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),sb=Qe({type:tt("audio"),data:rb,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),YO=Qe({type:tt("tool_use"),name:de(),id:de(),input:Nt(de(),qt()),_meta:Nt(de(),qt()).optional()}),QO=Qe({type:tt("resource"),resource:Dt([$6,T6]),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),eD=P6.extend({type:tt("resource_link")}),ab=Dt([ib,ob,sb,eD,QO]),tD=Qe({role:ec,content:ab}),rD=Dr.extend({description:de().optional(),messages:_t(tD)}),nD=An.extend({method:tt("notifications/prompts/list_changed"),params:Pn.optional()}),iD=Qe({title:de().optional(),readOnlyHint:or().optional(),destructiveHint:or().optional(),idempotentHint:or().optional(),openWorldHint:or().optional()}),oD=Qe({taskSupport:Vr(["required","optional","forbidden"]).optional()}),A6=Qe({...Xs.shape,...Gl.shape,description:de().optional(),inputSchema:Qe({type:tt("object"),properties:Nt(de(),xr).optional(),required:_t(de()).optional()}).catchall(qt()),outputSchema:Qe({type:tt("object"),properties:Nt(de(),xr).optional(),required:_t(de()).optional()}).catchall(qt()).optional(),annotations:iD.optional(),execution:oD.optional(),_meta:Nt(de(),qt()).optional()}),dp=Jl.extend({method:tt("tools/list")}),sD=Xl.extend({tools:_t(A6)}),fp=Dr.extend({content:_t(ab).default([]),structuredContent:Nt(de(),qt()).optional(),isError:or().optional()}),D0e=fp.or(Dr.extend({toolResult:qt()})),aD=Vl.extend({name:de(),arguments:Nt(de(),qt()).optional()}),ea=Or.extend({method:tt("tools/call"),params:aD}),uD=An.extend({method:tt("notifications/tools/list_changed"),params:Pn.optional()}),N0e=Qe({autoRefresh:or().default(!0),debounceMs:It().int().nonnegative().default(300)}),tc=Vr(["debug","info","notice","warning","error","critical","alert","emergency"]),lD=_n.extend({level:tc}),ub=Or.extend({method:tt("logging/setLevel"),params:lD}),cD=Pn.extend({level:tc,logger:de().optional(),data:qt()}),dD=An.extend({method:tt("notifications/message"),params:cD}),fD=Qe({name:de().optional()}),hD=Qe({hints:_t(fD).optional(),costPriority:It().min(0).max(1).optional(),speedPriority:It().min(0).max(1).optional(),intelligencePriority:It().min(0).max(1).optional()}),pD=Qe({mode:Vr(["auto","required","none"]).optional()}),mD=Qe({type:tt("tool_result"),toolUseId:de().describe("The unique identifier for the corresponding tool call."),content:_t(ab).default([]),structuredContent:Qe({}).loose().optional(),isError:or().optional(),_meta:Nt(de(),qt()).optional()}),gD=Vf("type",[ib,ob,sb]),Vh=Vf("type",[ib,ob,sb,YO,mD]),yD=Qe({role:ec,content:Dt([Vh,_t(Vh)]),_meta:Nt(de(),qt()).optional()}),vD=Vl.extend({messages:_t(yD),modelPreferences:hD.optional(),systemPrompt:de().optional(),includeContext:Vr(["none","thisServer","allServers"]).optional(),temperature:It().optional(),maxTokens:It().int(),stopSequences:_t(de()).optional(),metadata:xr.optional(),tools:_t(A6).optional(),toolChoice:pD.optional()}),bD=Or.extend({method:tt("sampling/createMessage"),params:vD}),rc=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens"]).or(de())),role:ec,content:gD}),lb=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens","toolUse"]).or(de())),role:ec,content:Dt([Vh,_t(Vh)])}),_D=Qe({type:tt("boolean"),title:de().optional(),description:de().optional(),default:or().optional()}),wD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),minLength:It().optional(),maxLength:It().optional(),format:Vr(["email","uri","date","date-time"]).optional(),default:de().optional()}),SD=Qe({type:Vr(["number","integer"]),title:de().optional(),description:de().optional(),minimum:It().optional(),maximum:It().optional(),default:It().optional()}),xD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:_t(de()),default:de().optional()}),kD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),oneOf:_t(Qe({const:de(),title:de()})),default:de().optional()}),MD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:_t(de()),enumNames:_t(de()).optional(),default:de().optional()}),ED=Dt([xD,kD]),ID=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({type:tt("string"),enum:_t(de())}),default:_t(de()).optional()}),$D=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({anyOf:_t(Qe({const:de(),title:de()}))}),default:_t(de()).optional()}),TD=Dt([ID,$D]),PD=Dt([MD,ED,TD]),AD=Dt([PD,_D,wD,SD]),RD=Vl.extend({mode:tt("form").optional(),message:de(),requestedSchema:Qe({type:tt("object"),properties:Nt(de(),AD),required:_t(de()).optional()})}),CD=Vl.extend({mode:tt("url"),message:de(),elicitationId:de(),url:de().url()}),OD=Dt([RD,CD]),DD=Or.extend({method:tt("elicitation/create"),params:OD}),ND=Pn.extend({elicitationId:de()}),zD=An.extend({method:tt("notifications/elicitation/complete"),params:ND}),ta=Dr.extend({action:Vr(["accept","decline","cancel"]),content:Gf((e)=>e===null?void 0:e,Nt(de(),Dt([de(),It(),or(),_t(de())])).optional())}),jD=Qe({type:tt("ref/resource"),uri:de()});var UD=Qe({type:tt("ref/prompt"),name:de()}),LD=_n.extend({ref:Dt([UD,jD]),argument:Qe({name:de(),value:de()}),context:Qe({arguments:Nt(de(),de()).optional()}).optional()}),hp=Or.extend({method:tt("completion/complete"),params:LD});function R6(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function C6(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var FD=Dr.extend({completion:Lr({values:_t(de()).max(100),total:Lt(It().int()),hasMore:Lt(or())})}),qD=Qe({uri:de().startsWith("file://"),name:de().optional(),_meta:Nt(de(),qt()).optional()}),BD=Or.extend({method:tt("roots/list"),params:_n.optional()}),cb=Dr.extend({roots:_t(qD)}),HD=An.extend({method:tt("notifications/roots/list_changed"),params:Pn.optional()}),z0e=Dt([Yh,eb,hp,ub,cp,lp,sp,ap,up,BO,ZO,ea,dp,ep,rp,np,op]),j0e=Dt([Xh,Qh,tb,HD,Ql]),U0e=Dt([Jh,rc,lb,ta,cb,tp,ip,Ys]),L0e=Dt([Yh,bD,DD,BD,ep,rp,np,op]),F0e=Dt([Xh,Qh,dD,VO,FO,uD,nD,Ql,zD]),q0e=Dt([Jh,PO,FD,rD,JO,zO,jO,LO,fp,sD,tp,ip,Ys]);class rt extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===it.UrlElicitationRequired&&r){let i=r;if(i.elicitations)return new O6(i.elicitations,t)}return new rt(e,t,r)}}class O6 extends rt{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(it.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function to(e){return e==="completed"||e==="failed"||e==="cancelled"}var N6=Symbol("Let zodToJsonSchema decide on which parser to use");var D6={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},z6=(e)=>typeof e==="string"?{...D6,name:e}:{...D6,...e};var j6=(e)=>{let t=z6(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};function db(e,t,r,i){if(!i?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function St(e,t,r,i,n){e[t]=r,db(e,t,i,n)}var pp=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Zt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?pp(t,e.currentPath):t.join("/")}}function U6(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==Le.ZodAny)r.items=st(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)St(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)St(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)St(r,"minItems",e.exactLength.value,e.exactLength.message,t),St(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function L6(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function F6(){return{type:"boolean"}}function mp(e,t){return st(e.type._def,t)}var q6=(e,t)=>st(e.innerType._def,t);function fb(e,t,r){let i=r??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>fb(e,t,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ZD(e,t)}}var ZD=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let i of e.checks)switch(i.kind){case"min":St(r,"minimum",i.value,i.message,t);break;case"max":St(r,"maximum",i.value,i.message,t);break}return r};function B6(e,t){return{...st(e.innerType._def,t),default:e.defaultValue()}}function H6(e,t){return t.effectStrategy==="input"?st(e.schema._def,t):Zt(t)}function Z6(e){return{type:"string",enum:Array.from(e.values)}}var KD=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function K6(e,t){let r=[st(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),st(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((o)=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((o)=>{if(KD(o)){if(n.push(...o.allOf),o.unevaluatedProperties===void 0)i=void 0}else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:h,...v}=o;s=v}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function V6(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var hb=void 0,Ln={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(hb===void 0)hb=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return hb},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function gp(e,t){let r={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t);break;case"max":St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Fn(r,"email",i.message,t);break;case"format:idn-email":Fn(r,"idn-email",i.message,t);break;case"pattern:zod":Gr(r,Ln.email,i.message,t);break}break;case"url":Fn(r,"uri",i.message,t);break;case"uuid":Fn(r,"uuid",i.message,t);break;case"regex":Gr(r,i.regex,i.message,t);break;case"cuid":Gr(r,Ln.cuid,i.message,t);break;case"cuid2":Gr(r,Ln.cuid2,i.message,t);break;case"startsWith":Gr(r,RegExp(`^${pb(i.value,t)}`),i.message,t);break;case"endsWith":Gr(r,RegExp(`${pb(i.value,t)}$`),i.message,t);break;case"datetime":Fn(r,"date-time",i.message,t);break;case"date":Fn(r,"date",i.message,t);break;case"time":Fn(r,"time",i.message,t);break;case"duration":Fn(r,"duration",i.message,t);break;case"length":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t),St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"includes":{Gr(r,RegExp(pb(i.value,t)),i.message,t);break}case"ip":{if(i.version!=="v6")Fn(r,"ipv4",i.message,t);if(i.version!=="v4")Fn(r,"ipv6",i.message,t);break}case"base64url":Gr(r,Ln.base64url,i.message,t);break;case"jwt":Gr(r,Ln.jwt,i.message,t);break;case"cidr":{if(i.version!=="v6")Gr(r,Ln.ipv4Cidr,i.message,t);if(i.version!=="v4")Gr(r,Ln.ipv6Cidr,i.message,t);break}case"emoji":Gr(r,Ln.emoji(),i.message,t);break;case"ulid":{Gr(r,Ln.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Fn(r,"binary",i.message,t);break}case"contentEncoding:base64":{St(r,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{Gr(r,Ln.base64,i.message,t);break}}break}case"nanoid":Gr(r,Ln.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(i)}return r}function pb(e,t){return t.patternStrategy==="escape"?WD(e):e}var VD=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function WD(e){let t="";for(let r=0;r<e.length;r++){if(!VD.has(e[r]))t+="\\";t+=e[r]}return t}function Fn(e,t,r,i){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&i.errorMessages&&{errorMessage:{format:r}}})}else St(e,"format",t,r,i)}function Gr(e,t,r,i){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:W6(t,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})}else St(e,"pattern",W6(t,i),r,i)}function W6(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source,n="",o=!1,s=!1,h=!1;for(let v=0;v<i.length;v++){if(o){n+=i[v],o=!1;continue}if(r.i){if(s){if(i[v].match(/[a-z]/)){if(h)n+=i[v],n+=`${i[v-2]}-${i[v]}`.toUpperCase(),h=!1;else if(i[v+1]==="-"&&i[v+2]?.match(/[a-z]/))n+=i[v],h=!0;else n+=`${i[v]}${i[v].toUpperCase()}`;continue}}else if(i[v].match(/[a-z]/)){n+=`[${i[v]}${i[v].toUpperCase()}]`;continue}}if(r.m){if(i[v]==="^"){n+=`(^|(?<=[\r
|
|
106
106
|
]))`;continue}else if(i[v]==="$"){n+=`($|(?=[\r
|
|
107
107
|
]))`;continue}}if(r.s&&i[v]==="."){n+=s?`${i[v]}\r
|
|
108
108
|
`:`[${i[v]}\r
|
|
109
|
-
]`;continue}if(n+=i[v],i[v]==="\\")o=!0;else if(s&&i[v]==="]")s=!1;else if(!s&&i[v]==="[")s=!0}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function yp(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===Le.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,n)=>({...i,[n]:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Zt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===Le.ZodString&&e.keyType._def.checks?.length){let{type:i,...n}=gp(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===Le.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===Le.ZodBranded&&e.keyType._def.type._def.typeName===Le.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...n}=mp(e.keyType._def,t);return{...r,propertyNames:n}}return r}function G6(e,t){if(t.mapStrategy==="record")return yp(e,t);let r=st(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Zt(t),i=st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Zt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function J6(e){let t=e.values,i=Object.keys(e.values).filter((o)=>typeof t[t[o]]!=="number").map((o)=>t[o]),n=Array.from(new Set(i.map((o)=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function X6(e){return e.target==="openAi"?void 0:{not:Zt({...e,currentPath:[...e.currentPath,"not"]})}}function Y6(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var nc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ek(e,t){if(t.target==="openApi3")return Q6(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((i)=>(i._def.typeName in nc)&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=nc[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every((i)=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,h)=>h.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every((i)=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter((o)=>!i.includes(o))],[])};return Q6(e,t)}var Q6=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,n)=>st(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((i)=>!!i&&(!t.strictUnions||typeof i==="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function tk(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:nc[e.innerType._def.typeName],nullable:!0};return{type:[nc[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let i=st(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(i&&"$ref"in i)return{allOf:[i],nullable:!0};return i&&{...i,nullable:!0}}let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function rk(e,t){let r={type:"number"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"int":r.type="integer",db(r,"type",i.message,t);break;case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function nk(e,t){let r=t.target==="openAi",i={type:"object",properties:{}},n=[],o=e.shape();for(let h in o){let v=o[h];if(v===void 0||v._def===void 0)continue;let b=JD(v);if(b&&r){if(v._def.typeName==="ZodOptional")v=v._def.innerType;if(!v.isNullable())v=v.nullable();b=!1}let _=st(v._def,{...t,currentPath:[...t.currentPath,"properties",h],propertyPath:[...t.currentPath,"properties",h]});if(_===void 0)continue;if(i.properties[h]=_,!b)n.push(h)}if(n.length)i.required=n;let s=GD(e,t);if(s!==void 0)i.additionalProperties=s;return i}function GD(e,t){if(e.catchall._def.typeName!=="ZodNever")return st(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function JD(e){try{return e.isOptional()}catch{return!0}}var ik=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return st(e.innerType._def,t);let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Zt(t)},r]}:Zt(t)};var ok=(e,t)=>{if(t.pipeStrategy==="input")return st(e.in._def,t);else if(t.pipeStrategy==="output")return st(e.out._def,t);let r=st(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=st(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter((n)=>n!==void 0)}};function sk(e,t){return st(e.type._def,t)}function ak(e,t){let i={type:"array",uniqueItems:!0,items:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)St(i,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)St(i,"maxItems",e.maxSize.value,e.maxSize.message,t);return i}function uk(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:st(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function lk(e){return{not:Zt(e)}}function ck(e){return Zt(e)}var dk=(e,t)=>st(e.innerType._def,t);var fk=(e,t,r)=>{switch(t){case Le.ZodString:return gp(e,r);case Le.ZodNumber:return rk(e,r);case Le.ZodObject:return nk(e,r);case Le.ZodBigInt:return L6(e,r);case Le.ZodBoolean:return F6();case Le.ZodDate:return fb(e,r);case Le.ZodUndefined:return lk(r);case Le.ZodNull:return Y6(r);case Le.ZodArray:return U6(e,r);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return ek(e,r);case Le.ZodIntersection:return K6(e,r);case Le.ZodTuple:return uk(e,r);case Le.ZodRecord:return yp(e,r);case Le.ZodLiteral:return V6(e,r);case Le.ZodEnum:return Z6(e);case Le.ZodNativeEnum:return J6(e);case Le.ZodNullable:return tk(e,r);case Le.ZodOptional:return ik(e,r);case Le.ZodMap:return G6(e,r);case Le.ZodSet:return ak(e,r);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return sk(e,r);case Le.ZodNaN:case Le.ZodNever:return X6(r);case Le.ZodEffects:return H6(e,r);case Le.ZodAny:return Zt(r);case Le.ZodUnknown:return ck(r);case Le.ZodDefault:return B6(e,r);case Le.ZodBranded:return mp(e,r);case Le.ZodReadonly:return dk(e,r);case Le.ZodCatch:return q6(e,r);case Le.ZodPipeline:return ok(e,r);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return((i)=>{return})(t)}};function st(e,t,r=!1){let i=t.seen.get(e);if(t.override){let h=t.override?.(e,t,i,r);if(h!==N6)return h}if(i&&!r){let h=XD(i,t);if(h!==void 0)return h}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let o=fk(e,e.typeName,t),s=typeof o==="function"?st(o(),t):o;if(s)YD(e,t,s);if(t.postProcess){let h=t.postProcess(s,e,t);return n.jsonSchema=s,h}return n.jsonSchema=s,s}var XD=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:pp(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,i)=>t.currentPath[i]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Zt(t);return t.$refStrategy==="seen"?Zt(t):void 0}}},YD=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var mb=(e,t)=>{let r=j6(t),i=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((v,[b,_])=>({...v,[b]:st(_._def,{...r,currentPath:[...r.basePath,r.definitionPath,b]},!0)??Zt(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=st(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Zt(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)o.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!i)i={};if(!i[r.openAiAnyTypeName])i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let h=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};if(r.target==="jsonSchema7")h.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")h.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in h)||("oneOf"in h)||("allOf"in h)||("type"in h)&&Array.isArray(h.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return h};function QD(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function gb(e,t){if(Tn(e))return xs(e,{target:QD(t?.target),io:t?.pipeStrategy??"input"});return mb(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function yb(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Kh(r);if(typeof i!=="string")throw Error("Schema method literal must be a string");return i}function vb(e,t){let r=Yi(e,t);if(!r.success)throw r.error;return r.data}var eN=60000;class bb{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Xh,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Qh,(t)=>{this._onprogress(t)}),this.setRequestHandler(Yh,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(ep,async(t,r)=>{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(rp,async(t,r)=>{let i=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let h=s.message,v=h.id,b=this._requestResolvers.get(v);if(b)if(this._requestResolvers.delete(v),s.type==="response")b(h);else{let _=h,g=new rt(_.error.code,_.error.message,_.error.data);b(g)}else{let _=s.type==="response"?"Response":"Error";this._onerror(Error(`${_} handler missing for request ${v}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let o=await this._taskStore.getTask(n,r.sessionId);if(!o)throw new rt(it.InvalidParams,`Task not found: ${n}`);if(!to(o.status))return await this._waitForTaskUpdate(n,r.signal),await i();if(to(o.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[eo]:{taskId:n}}}}return await i()};return await i()}),this.setRequestHandler(np,async(t,r)=>{try{let{tasks:i,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:i,nextCursor:n,_meta:{}}}catch(i){throw new rt(it.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(op,async(t,r)=>{try{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,`Task not found: ${t.params.taskId}`);if(to(i.status))throw new rt(it.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new rt(it.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(i){if(i instanceof rt)throw i;throw new rt(it.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,i,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),rt.fromError(it.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let i=this._transport?.onmessage;this._transport.onmessage=(n,o)=>{if(i?.(n,o),Wl(n)||k6(n))this._onresponse(n);else if(Xv(n))this._onrequest(n,o);else if(x6(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=rt.fromError(it.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,n=e.params?._meta?.[eo]?.taskId;if(r===void 0){let b={jsonrpc:"2.0",id:e.id,error:{code:it.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:b,timestamp:Date.now()},i?.sessionId).catch((_)=>this._onerror(Error(`Failed to enqueue error response: ${_}`)));else i?.send(b).catch((_)=>this._onerror(Error(`Failed to send an error response: ${_}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=_6(e.params)?e.params.task:void 0,h=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,v={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async(b)=>{if(o.signal.aborted)return;let _={relatedRequestId:e.id};if(n)_.relatedTask={taskId:n};await this.notification(b,_)},sendRequest:async(b,_,g)=>{if(o.signal.aborted)throw new rt(it.ConnectionClosed,"Request was cancelled");let S={...g,relatedRequestId:e.id};if(n&&!S.relatedTask)S.relatedTask={taskId:n};let x=S.relatedTask?.taskId??n;if(x&&h)await h.updateTaskStatus(x,"input_required");return await this.request(b,_,S)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:h,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,v)).then(async(b)=>{if(o.signal.aborted)return;let _={result:b,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)},async(b)=>{if(o.signal.aborted)return;let _={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(b.code)?b.code:it.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)}).catch((b)=>this._onerror(Error(`Failed to send response: ${b}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===o)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,i=Number(t),n=this._progressHandlers.get(i);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(h){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(h);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Wl(e))r(e);else{let o=new rt(e.error.code,e.error.message,e.error.data);r(o)}return}let i=this._responseHandlers.get(t);if(i===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Wl(e)&&e.result&&typeof e.result==="object"){let o=e.result;if(o.task&&typeof o.task==="object"){let s=o.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Wl(e))i(e);else{let o=rt.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(e,t,r)}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}return}let n;try{let o=await this.request(e,Ys,r);if(o.task)n=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new rt(it.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},to(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new rt(it.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new rt(it.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let h=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((v)=>setTimeout(v,h)),r?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}}request(e,t,r){let{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o,task:s,relatedTask:h}=r??{};return new Promise((v,b)=>{let _=(T)=>{b(T)};if(!this._transport){_(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(T){_(T);return}r?.signal?.throwIfAborted();let g=this._requestMessageId++,S={...e,jsonrpc:"2.0",id:g};if(r?.onprogress)this._progressHandlers.set(g,r.onprogress),S.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}};if(s)S.params={...S.params,task:s};if(h)S.params={...S.params,_meta:{...S.params?._meta||{},[eo]:h}};let x=(T)=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(T)}},{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((R)=>this._onerror(Error(`Failed to send cancellation: ${R}`)));let P=T instanceof rt?T:new rt(it.RequestTimeout,String(T));b(P)};this._responseHandlers.set(g,(T)=>{if(r?.signal?.aborted)return;if(T instanceof Error)return b(T);try{let P=Yi(t,T.result);if(!P.success)b(P.error);else v(P.data)}catch(P){b(P)}}),r?.signal?.addEventListener("abort",()=>{x(r?.signal?.reason)});let M=r?.timeout??eN,I=()=>x(rt.fromError(it.RequestTimeout,"Request timed out",{timeout:M}));this._setupTimeout(g,M,r?.maxTotalTimeout,I,r?.resetTimeoutOnProgress??!1);let $=h?.taskId;if($){let T=(P)=>{let R=this._responseHandlers.get(g);if(R)R(P);else this._onerror(Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,T),this._enqueueTaskMessage($,{type:"request",message:S,timestamp:Date.now()}).catch((P)=>{this._cleanupTimeout(g),b(P)})}else this._transport.send(S,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((T)=>{this._cleanupTimeout(g),b(T)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},tp,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ip,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},E6,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[eo]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[eo]:t.relatedTask}}};this._transport?.send(s,t).catch((h)=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};if(t?.relatedTask)o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[eo]:t.relatedTask}}};await this._transport.send(o,t)}setRequestHandler(e,t){let r=yb(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,n)=>{let o=vb(e,i);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=yb(e);this._notificationHandlers.set(r,(i)=>{let n=vb(e,i);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,i)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let i of r)if(i.type==="request"&&Xv(i.message)){let n=i.message.id,o=this._requestResolvers.get(n);if(o)o(new rt(it.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let i=await this._taskStore?.getTask(e);if(i?.pollInterval)r=i.pollInterval}catch{}return new Promise((i,n)=>{if(t.aborted){n(new rt(it.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,r);t.addEventListener("abort",()=>{clearTimeout(o),n(new rt(it.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(i)=>{if(!e)throw Error("No request provided");return await r.createTask(i,e.id,{method:e.method,params:e.params},t)},getTask:async(i)=>{let n=await r.getTask(i,t);if(!n)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(i,n,o)=>{await r.storeTaskResult(i,n,o,t);let s=await r.getTask(i,t);if(s){let h=Ql.parse({method:"notifications/tasks/status",params:s});if(await this.notification(h),to(s.status))this._cleanupTaskProgressHandler(i)}},getTaskResult:(i)=>r.getTaskResult(i,t),updateTaskStatus:async(i,n,o)=>{let s=await r.getTask(i,t);if(!s)throw new rt(it.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(to(s.status))throw new rt(it.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,n,o,t);let h=await r.getTask(i,t);if(h){let v=Ql.parse({method:"notifications/tasks/status",params:h});if(await this.notification(v),to(h.status))this._cleanupTaskProgressHandler(i)}},listTasks:(i)=>r.listTasks(i,t)}}}function hk(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function pk(e,t){let r={...e};for(let i in t){let n=i,o=t[n];if(o===void 0)continue;let s=r[n];if(hk(s)&&hk(o))r[n]={...s,...o};else r[n]=o}return r}var J8=N_(p_(),1),X8=N_(G8(),1);function SH(){let e=new J8.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return X8.default(e),e}class k_{constructor(e){this._ajv=e??SH()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class M_{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some((b)=>b.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,h=s?Array.isArray(s.content)?s.content:[s.content]:[],v=h.some((b)=>b.type==="tool_use");if(o){if(n.some((b)=>b.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!v)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(v){let b=new Set(h.filter((g)=>g.type==="tool_use").map((g)=>g.id)),_=new Set(n.filter((g)=>g.type==="tool_result").map((g)=>g.toolUseId));if(b.size!==_.size||![...b].every((g)=>_.has(g)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},rc,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},ta,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function Y8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Q8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class E_ extends bb{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(tc.options.map((r,i)=>[r,i])),this.isMessageIgnored=(r,i)=>{let n=this._loggingLevels.get(i);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new k_,this.setRequestHandler(eb,(r)=>this._oninitialize(r)),this.setNotificationHandler(tb,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(ub,async(r,i)=>{let n=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=r.params,s=tc.safeParse(o);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new M_(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=pk(this._capabilities,e)}setRequestHandler(e,t){let i=Qi(e)?.method;if(!i)throw Error("Schema is missing a method literal");let n;if(Tn(i)){let s=i;n=s._zod?.def?.value??s.value}else{let s=i;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(h,v)=>{let b=Yi(ea,h);if(!b.success){let x=b.error instanceof Error?b.error.message:String(b.error);throw new rt(it.InvalidParams,`Invalid tools/call request: ${x}`)}let{params:_}=b.data,g=await Promise.resolve(t(h,v));if(_.task){let x=Yi(Ys,g);if(!x.success){let M=x.error instanceof Error?x.error.message:String(x.error);throw new rt(it.InvalidParams,`Invalid task creation result: ${M}`)}return x.data}let S=Yi(fp,g);if(!S.success){let x=S.error instanceof Error?S.error.message:String(S.error);throw new rt(it.InvalidParams,`Invalid tools/call result: ${x}`)}return S.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Q8(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Y8(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:y6.includes(t)?t:Gv,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Jh)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],n=i.some((v)=>v.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],h=s.some((v)=>v.type==="tool_use");if(n){if(i.some((v)=>v.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!h)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(h){let v=new Set(s.filter((_)=>_.type==="tool_use").map((_)=>_.id)),b=new Set(i.filter((_)=>_.type==="tool_result").map((_)=>_.toolUseId));if(v.size!==b.size||![...v].every((_)=>b.has(_)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},lb,t);return this.request({method:"sampling/createMessage",params:e},rc,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},ta,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:i},ta,t);if(n.action==="accept"&&n.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(n.content);if(!s.valid)throw new rt(it.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){if(o instanceof rt)throw o;throw new rt(it.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},cb,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var tE=Symbol.for("mcp.completable");function I_(e){return!!e&&typeof e==="object"&&tE in e}function rE(e){return e[tE]?.complete}var eE;(function(e){e.Completable="McpCompletable"})(eE||(eE={}));var xH=/^[A-Za-z0-9._-]{1,128}$/;function kH(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!xH.test(e)){let r=e.split("").filter((i)=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return t.push(`Tool name contains invalid characters: ${r.map((i)=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function MH(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function $_(e){let t=kH(e);return MH(e,t.warnings),t.isValid}class T_{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let i={taskSupport:"required",...t.execution};if(i.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,i,t._meta,r)}}class A_{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new E_(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new T_(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(dp)),this.server.assertCanSetRequestHandler(lo(ea)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(dp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let i=Js(t.inputSchema);return i?gb(i,{strictUnions:!0,pipeStrategy:"input"}):EH})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let i=Js(t.outputSchema);if(i)r.outputSchema=gb(i,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(ea,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new rt(it.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Tool ${e.params.name} disabled`);let i=!!e.params.task,n=r.execution?.taskSupport,o="createTask"in r.handler;if((n==="required"||n==="optional")&&!o)throw new rt(it.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new rt(it.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&o)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),h=await this.executeToolHandler(r,s,t);if(i)return h;return await this.validateToolOutput(r,h,e.params.name),h}catch(r){if(r instanceof rt){if(r.code===it.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=Js(e.inputSchema)??e.inputSchema,o=await Hh(n,t);if(!o.success){let s="error"in o?o.error:"Unknown error",h=Zh(s);throw new rt(it.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${h}`)}return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new rt(it.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let i=Js(e.outputSchema),n=await Hh(i,t.structuredContent);if(!n.success){let o="error"in n?n.error:"Unknown error",s=Zh(o);throw new rt(it.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let i=e.handler;if("createTask"in i){if(!r.taskStore)throw Error("No task store provided.");let o={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(i.createTask(t,o));else return await Promise.resolve(i.createTask(o))}if(e.inputSchema)return await Promise.resolve(i(t,r));else return await Promise.resolve(i(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,o={...r,taskStore:r.taskStore},s=i?await Promise.resolve(n.createTask(i,o)):await Promise.resolve(n.createTask(o)),h=s.task.taskId,v=s.task,b=v.pollInterval??5000;while(v.status!=="completed"&&v.status!=="failed"&&v.status!=="cancelled"){await new Promise((g)=>setTimeout(g,b));let _=await r.taskStore.getTask(h);if(!_)throw new rt(it.InternalError,`Task ${h} not found during polling`);v=_}return await r.taskStore.getTaskResult(h)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(lo(hp)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(hp,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return R6(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return C6(e),this.handleResourceCompletion(e,e.params.ref);default:throw new rt(it.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Ic;let n=Qi(r.argsSchema)?.[e.params.argument.name];if(!I_(n))return Ic;let o=rE(n);if(!o)return Ic;let s=await o(e.params.argument.value,e.params.context);return iE(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((o)=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Ic;throw new rt(it.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let i=r.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return Ic;let n=await i(e.params.argument.value,e.params.context);return iE(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(sp)),this.server.assertCanSetRequestHandler(lo(ap)),this.server.assertCanSetRequestHandler(lo(up)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(sp,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let o=await n.resourceTemplate.listCallback(t);for(let s of o.resources)i.push({...n.metadata,...s})}return{resources:[...r,...i]}}),this.server.setRequestHandler(ap,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(up,async(e,t)=>{let r=new URL(e.params.uri),i=this._registeredResources[r.toString()];if(i){if(!i.enabled)throw new rt(it.InvalidParams,`Resource ${r} disabled`);return i.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let o=n.resourceTemplate.uriTemplate.match(r.toString());if(o)return n.readCallback(r,o,t)}throw new rt(it.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(lp)),this.server.assertCanSetRequestHandler(lo(cp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(lp,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?IH(t.argsSchema):void 0}))})),this.server.setRequestHandler(cp,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let i=Js(r.argsSchema),n=await Hh(i,e.params.arguments);if(!n.success){let h="error"in n?n.error:"Unknown error",v=Zh(h);throw new rt(it.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${v}`)}let o=n.data,s=r.callback;return await Promise.resolve(s(o,t))}else{let i=r.callback;return await Promise.resolve(i(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let i;if(typeof r[0]==="object")i=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,t,r,i){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,i,n){let o={name:e,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=o}if(typeof s.name<"u")o.name=s.name;if(typeof s.title<"u")o.title=s.title;if(typeof s.metadata<"u")o.metadata=s.metadata;if(typeof s.callback<"u")o.readCallback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=o,o}_createRegisteredResourceTemplate(e,t,r,i,n){let o={resourceTemplate:r,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(v)=>{if(typeof v.name<"u"&&v.name!==e){if(delete this._registeredResourceTemplates[e],v.name)this._registeredResourceTemplates[v.name]=o}if(typeof v.title<"u")o.title=v.title;if(typeof v.template<"u")o.resourceTemplate=v.template;if(typeof v.metadata<"u")o.metadata=v.metadata;if(typeof v.callback<"u")o.readCallback=v.callback;if(typeof v.enabled<"u")o.enabled=v.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=o;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((v)=>!!r.completeCallback(v)))this.setCompletionRequestHandler();return o}_createRegisteredPrompt(e,t,r,i,n){let o={title:t,description:r,argsSchema:i===void 0?void 0:Ho(i),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=o}if(typeof s.title<"u")o.title=s.title;if(typeof s.description<"u")o.description=s.description;if(typeof s.argsSchema<"u")o.argsSchema=Ho(s.argsSchema);if(typeof s.callback<"u")o.callback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=o,i){if(Object.values(i).some((h)=>{let v=h instanceof $n?h._def?.innerType:h;return I_(v)}))this.setCompletionRequestHandler()}return o}_createRegisteredTool(e,t,r,i,n,o,s,h,v){$_(e);let b={title:t,description:r,inputSchema:nE(i),outputSchema:nE(n),annotations:o,execution:s,_meta:h,handler:v,enabled:!0,disable:()=>b.update({enabled:!1}),enable:()=>b.update({enabled:!0}),remove:()=>b.update({name:null}),update:(_)=>{if(typeof _.name<"u"&&_.name!==e){if(typeof _.name==="string")$_(_.name);if(delete this._registeredTools[e],_.name)this._registeredTools[_.name]=b}if(typeof _.title<"u")b.title=_.title;if(typeof _.description<"u")b.description=_.description;if(typeof _.paramsSchema<"u")b.inputSchema=Ho(_.paramsSchema);if(typeof _.outputSchema<"u")b.outputSchema=Ho(_.outputSchema);if(typeof _.callback<"u")b.handler=_.callback;if(typeof _.annotations<"u")b.annotations=_.annotations;if(typeof _._meta<"u")b._meta=_._meta;if(typeof _.enabled<"u")b.enabled=_.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=b,this.setToolRequestHandlers(),this.sendToolListChanged(),b}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,i,n,o;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let h=t[0];if(P_(h)){if(i=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!P_(t[0]))o=t.shift()}else if(typeof h==="object"&&h!==null){if(Object.values(h).some((v)=>typeof v==="object"&&v!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);o=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,i,n,o,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:h,_meta:v}=t;return this._createRegisteredTool(e,i,n,o,s,h,{taskSupport:"forbidden"},v,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let i;if(t.length>1)i=t.shift();let n=t[0],o=this._createRegisteredPrompt(e,void 0,r,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:i,description:n,argsSchema:o}=t,s=this._createRegisteredPrompt(e,i,n,o,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var EH={type:"object",properties:{}};function oE(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function sE(e){return"_def"in e||"_zod"in e||oE(e)}function P_(e){if(typeof e!=="object"||e===null)return!1;if(sE(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(oE)}function nE(e){if(!e)return;if(P_(e))return Ho(e);if(!sE(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function IH(e){let t=Qi(e);if(!t)return[];return Object.entries(t).map(([r,i])=>{let n=m6(i),o=g6(i);return{name:r,description:n,required:!o}})}function lo(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Kh(r);if(typeof i==="string")return i;throw Error("Schema method literal must be a string")}function iE(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Ic={completion:{values:[],hasMore:!1}};function $H(e,t,r,i,n){let o={};if(n?.searchHint)o["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)o["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:i,annotations:n?.annotations,_meta:Object.keys(o).length>0?o:void 0}}function TH(e){let t=new A_({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let i of Object.values(r.inputSchema)){if(!PH(i))continue;let n=i.description;if(n&&!tn.has(i))tn.add(i,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function PH(e){return typeof e==="object"&&e!==null&&"_zod"in e}function l1e(e){let t=e.abortController||u6(),r=new Map;if(e.mcpServers)for(let[o,s]of Object.entries(e.mcpServers))if(s.type==="sdk"&&s.instance)r.set(o,s.instance);else throw Error("Browser SDK only supports SDK MCP servers for now");let i;if(e.sse)i=new Lv({streamUrl:e.sse.streamUrl,sendUrl:e.sse.sendUrl,sessionId:e.sse.sessionId,headers:e.sse.headers,abortController:t});else i=new Fv({url:e.websocket.url,headers:e.websocket.headers,authMessage:e.websocket.authMessage,abortController:t});let n=new Ch(i,!1,e.canUseTool,e.hooks,t,r,e.jsonSchema,e.promptSuggestions!==void 0?{promptSuggestions:e.promptSuggestions}:void 0,e.onElicitation,void 0,void 0,e.onUserDialog);return n.streamInput(e.prompt).catch((o)=>t.abort(o)),n}export{qe as z,$H as tool,l1e as query,TH as createSdkMcpServer};
|
|
109
|
+
]`;continue}if(n+=i[v],i[v]==="\\")o=!0;else if(s&&i[v]==="]")s=!1;else if(!s&&i[v]==="[")s=!0}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function yp(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===Le.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,n)=>({...i,[n]:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Zt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===Le.ZodString&&e.keyType._def.checks?.length){let{type:i,...n}=gp(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===Le.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===Le.ZodBranded&&e.keyType._def.type._def.typeName===Le.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...n}=mp(e.keyType._def,t);return{...r,propertyNames:n}}return r}function G6(e,t){if(t.mapStrategy==="record")return yp(e,t);let r=st(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Zt(t),i=st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Zt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function J6(e){let t=e.values,i=Object.keys(e.values).filter((o)=>typeof t[t[o]]!=="number").map((o)=>t[o]),n=Array.from(new Set(i.map((o)=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function X6(e){return e.target==="openAi"?void 0:{not:Zt({...e,currentPath:[...e.currentPath,"not"]})}}function Y6(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var nc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ek(e,t){if(t.target==="openApi3")return Q6(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((i)=>(i._def.typeName in nc)&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=nc[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every((i)=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,h)=>h.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every((i)=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter((o)=>!i.includes(o))],[])};return Q6(e,t)}var Q6=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,n)=>st(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((i)=>!!i&&(!t.strictUnions||typeof i==="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function tk(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:nc[e.innerType._def.typeName],nullable:!0};return{type:[nc[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let i=st(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(i&&"$ref"in i)return{allOf:[i],nullable:!0};return i&&{...i,nullable:!0}}let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function rk(e,t){let r={type:"number"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"int":r.type="integer",db(r,"type",i.message,t);break;case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function nk(e,t){let r=t.target==="openAi",i={type:"object",properties:{}},n=[],o=e.shape();for(let h in o){let v=o[h];if(v===void 0||v._def===void 0)continue;let b=JD(v);if(b&&r){if(v._def.typeName==="ZodOptional")v=v._def.innerType;if(!v.isNullable())v=v.nullable();b=!1}let _=st(v._def,{...t,currentPath:[...t.currentPath,"properties",h],propertyPath:[...t.currentPath,"properties",h]});if(_===void 0)continue;if(i.properties[h]=_,!b)n.push(h)}if(n.length)i.required=n;let s=GD(e,t);if(s!==void 0)i.additionalProperties=s;return i}function GD(e,t){if(e.catchall._def.typeName!=="ZodNever")return st(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function JD(e){try{return e.isOptional()}catch{return!0}}var ik=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return st(e.innerType._def,t);let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Zt(t)},r]}:Zt(t)};var ok=(e,t)=>{if(t.pipeStrategy==="input")return st(e.in._def,t);else if(t.pipeStrategy==="output")return st(e.out._def,t);let r=st(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=st(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter((n)=>n!==void 0)}};function sk(e,t){return st(e.type._def,t)}function ak(e,t){let i={type:"array",uniqueItems:!0,items:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)St(i,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)St(i,"maxItems",e.maxSize.value,e.maxSize.message,t);return i}function uk(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:st(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function lk(e){return{not:Zt(e)}}function ck(e){return Zt(e)}var dk=(e,t)=>st(e.innerType._def,t);var fk=(e,t,r)=>{switch(t){case Le.ZodString:return gp(e,r);case Le.ZodNumber:return rk(e,r);case Le.ZodObject:return nk(e,r);case Le.ZodBigInt:return L6(e,r);case Le.ZodBoolean:return F6();case Le.ZodDate:return fb(e,r);case Le.ZodUndefined:return lk(r);case Le.ZodNull:return Y6(r);case Le.ZodArray:return U6(e,r);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return ek(e,r);case Le.ZodIntersection:return K6(e,r);case Le.ZodTuple:return uk(e,r);case Le.ZodRecord:return yp(e,r);case Le.ZodLiteral:return V6(e,r);case Le.ZodEnum:return Z6(e);case Le.ZodNativeEnum:return J6(e);case Le.ZodNullable:return tk(e,r);case Le.ZodOptional:return ik(e,r);case Le.ZodMap:return G6(e,r);case Le.ZodSet:return ak(e,r);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return sk(e,r);case Le.ZodNaN:case Le.ZodNever:return X6(r);case Le.ZodEffects:return H6(e,r);case Le.ZodAny:return Zt(r);case Le.ZodUnknown:return ck(r);case Le.ZodDefault:return B6(e,r);case Le.ZodBranded:return mp(e,r);case Le.ZodReadonly:return dk(e,r);case Le.ZodCatch:return q6(e,r);case Le.ZodPipeline:return ok(e,r);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return((i)=>{return})(t)}};function st(e,t,r=!1){let i=t.seen.get(e);if(t.override){let h=t.override?.(e,t,i,r);if(h!==N6)return h}if(i&&!r){let h=XD(i,t);if(h!==void 0)return h}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let o=fk(e,e.typeName,t),s=typeof o==="function"?st(o(),t):o;if(s)YD(e,t,s);if(t.postProcess){let h=t.postProcess(s,e,t);return n.jsonSchema=s,h}return n.jsonSchema=s,s}var XD=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:pp(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,i)=>t.currentPath[i]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Zt(t);return t.$refStrategy==="seen"?Zt(t):void 0}}},YD=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var mb=(e,t)=>{let r=j6(t),i=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((v,[b,_])=>({...v,[b]:st(_._def,{...r,currentPath:[...r.basePath,r.definitionPath,b]},!0)??Zt(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=st(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Zt(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)o.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!i)i={};if(!i[r.openAiAnyTypeName])i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let h=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};if(r.target==="jsonSchema7")h.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")h.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in h)||("oneOf"in h)||("allOf"in h)||("type"in h)&&Array.isArray(h.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return h};function QD(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function gb(e,t){if(Tn(e))return xs(e,{target:QD(t?.target),io:t?.pipeStrategy??"input"});return mb(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function yb(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Kh(r);if(typeof i!=="string")throw Error("Schema method literal must be a string");return i}function vb(e,t){let r=Yi(e,t);if(!r.success)throw r.error;return r.data}var eN=60000;class bb{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Xh,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Qh,(t)=>{this._onprogress(t)}),this.setRequestHandler(Yh,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(ep,async(t,r)=>{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(rp,async(t,r)=>{let i=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let h=s.message,v=h.id,b=this._requestResolvers.get(v);if(b)if(this._requestResolvers.delete(v),s.type==="response")b(h);else{let _=h,g=new rt(_.error.code,_.error.message,_.error.data);b(g)}else{let _=s.type==="response"?"Response":"Error";this._onerror(Error(`${_} handler missing for request ${v}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let o=await this._taskStore.getTask(n,r.sessionId);if(!o)throw new rt(it.InvalidParams,`Task not found: ${n}`);if(!to(o.status))return await this._waitForTaskUpdate(n,r.signal),await i();if(to(o.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[eo]:{taskId:n}}}}return await i()};return await i()}),this.setRequestHandler(np,async(t,r)=>{try{let{tasks:i,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:i,nextCursor:n,_meta:{}}}catch(i){throw new rt(it.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(op,async(t,r)=>{try{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,`Task not found: ${t.params.taskId}`);if(to(i.status))throw new rt(it.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new rt(it.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(i){if(i instanceof rt)throw i;throw new rt(it.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,i,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),rt.fromError(it.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let i=this._transport?.onmessage;this._transport.onmessage=(n,o)=>{if(i?.(n,o),Wl(n)||k6(n))this._onresponse(n);else if(Xv(n))this._onrequest(n,o);else if(x6(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=rt.fromError(it.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,n=e.params?._meta?.[eo]?.taskId;if(r===void 0){let b={jsonrpc:"2.0",id:e.id,error:{code:it.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:b,timestamp:Date.now()},i?.sessionId).catch((_)=>this._onerror(Error(`Failed to enqueue error response: ${_}`)));else i?.send(b).catch((_)=>this._onerror(Error(`Failed to send an error response: ${_}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=_6(e.params)?e.params.task:void 0,h=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,v={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async(b)=>{if(o.signal.aborted)return;let _={relatedRequestId:e.id};if(n)_.relatedTask={taskId:n};await this.notification(b,_)},sendRequest:async(b,_,g)=>{if(o.signal.aborted)throw new rt(it.ConnectionClosed,"Request was cancelled");let S={...g,relatedRequestId:e.id};if(n&&!S.relatedTask)S.relatedTask={taskId:n};let x=S.relatedTask?.taskId??n;if(x&&h)await h.updateTaskStatus(x,"input_required");return await this.request(b,_,S)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:h,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,v)).then(async(b)=>{if(o.signal.aborted)return;let _={result:b,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)},async(b)=>{if(o.signal.aborted)return;let _={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(b.code)?b.code:it.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)}).catch((b)=>this._onerror(Error(`Failed to send response: ${b}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===o)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,i=Number(t),n=this._progressHandlers.get(i);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(h){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(h);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Wl(e))r(e);else{let o=new rt(e.error.code,e.error.message,e.error.data);r(o)}return}let i=this._responseHandlers.get(t);if(i===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Wl(e)&&e.result&&typeof e.result==="object"){let o=e.result;if(o.task&&typeof o.task==="object"){let s=o.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Wl(e))i(e);else{let o=rt.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(e,t,r)}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}return}let n;try{let o=await this.request(e,Ys,r);if(o.task)n=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new rt(it.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},to(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new rt(it.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new rt(it.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let h=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((v)=>setTimeout(v,h)),r?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}}request(e,t,r){let{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o,task:s,relatedTask:h}=r??{};return new Promise((v,b)=>{let _=(T)=>{b(T)};if(!this._transport){_(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(T){_(T);return}r?.signal?.throwIfAborted();let g=this._requestMessageId++,S={...e,jsonrpc:"2.0",id:g};if(r?.onprogress)this._progressHandlers.set(g,r.onprogress),S.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}};if(s)S.params={...S.params,task:s};if(h)S.params={...S.params,_meta:{...S.params?._meta||{},[eo]:h}};let x=(T)=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(T)}},{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((R)=>this._onerror(Error(`Failed to send cancellation: ${R}`)));let P=T instanceof rt?T:new rt(it.RequestTimeout,String(T));b(P)};this._responseHandlers.set(g,(T)=>{if(r?.signal?.aborted)return;if(T instanceof Error)return b(T);try{let P=Yi(t,T.result);if(!P.success)b(P.error);else v(P.data)}catch(P){b(P)}}),r?.signal?.addEventListener("abort",()=>{x(r?.signal?.reason)});let M=r?.timeout??eN,I=()=>x(rt.fromError(it.RequestTimeout,"Request timed out",{timeout:M}));this._setupTimeout(g,M,r?.maxTotalTimeout,I,r?.resetTimeoutOnProgress??!1);let $=h?.taskId;if($){let T=(P)=>{let R=this._responseHandlers.get(g);if(R)R(P);else this._onerror(Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,T),this._enqueueTaskMessage($,{type:"request",message:S,timestamp:Date.now()}).catch((P)=>{this._cleanupTimeout(g),b(P)})}else this._transport.send(S,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((T)=>{this._cleanupTimeout(g),b(T)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},tp,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ip,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},E6,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[eo]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[eo]:t.relatedTask}}};this._transport?.send(s,t).catch((h)=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};if(t?.relatedTask)o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[eo]:t.relatedTask}}};await this._transport.send(o,t)}setRequestHandler(e,t){let r=yb(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,n)=>{let o=vb(e,i);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=yb(e);this._notificationHandlers.set(r,(i)=>{let n=vb(e,i);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,i)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let i of r)if(i.type==="request"&&Xv(i.message)){let n=i.message.id,o=this._requestResolvers.get(n);if(o)o(new rt(it.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let i=await this._taskStore?.getTask(e);if(i?.pollInterval)r=i.pollInterval}catch{}return new Promise((i,n)=>{if(t.aborted){n(new rt(it.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,r);t.addEventListener("abort",()=>{clearTimeout(o),n(new rt(it.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(i)=>{if(!e)throw Error("No request provided");return await r.createTask(i,e.id,{method:e.method,params:e.params},t)},getTask:async(i)=>{let n=await r.getTask(i,t);if(!n)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(i,n,o)=>{await r.storeTaskResult(i,n,o,t);let s=await r.getTask(i,t);if(s){let h=Ql.parse({method:"notifications/tasks/status",params:s});if(await this.notification(h),to(s.status))this._cleanupTaskProgressHandler(i)}},getTaskResult:(i)=>r.getTaskResult(i,t),updateTaskStatus:async(i,n,o)=>{let s=await r.getTask(i,t);if(!s)throw new rt(it.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(to(s.status))throw new rt(it.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,n,o,t);let h=await r.getTask(i,t);if(h){let v=Ql.parse({method:"notifications/tasks/status",params:h});if(await this.notification(v),to(h.status))this._cleanupTaskProgressHandler(i)}},listTasks:(i)=>r.listTasks(i,t)}}}function hk(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function pk(e,t){let r={...e};for(let i in t){let n=i,o=t[n];if(o===void 0)continue;let s=r[n];if(hk(s)&&hk(o))r[n]={...s,...o};else r[n]=o}return r}var J8=N_(p_(),1),X8=N_(G8(),1);function SH(){let e=new J8.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return X8.default(e),e}class k_{constructor(e){this._ajv=e??SH()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class M_{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some((b)=>b.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,h=s?Array.isArray(s.content)?s.content:[s.content]:[],v=h.some((b)=>b.type==="tool_use");if(o){if(n.some((b)=>b.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!v)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(v){let b=new Set(h.filter((g)=>g.type==="tool_use").map((g)=>g.id)),_=new Set(n.filter((g)=>g.type==="tool_result").map((g)=>g.toolUseId));if(b.size!==_.size||![...b].every((g)=>_.has(g)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},rc,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},ta,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function Y8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Q8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class E_ extends bb{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(tc.options.map((r,i)=>[r,i])),this.isMessageIgnored=(r,i)=>{let n=this._loggingLevels.get(i);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new k_,this.setRequestHandler(eb,(r)=>this._oninitialize(r)),this.setNotificationHandler(tb,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(ub,async(r,i)=>{let n=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=r.params,s=tc.safeParse(o);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new M_(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=pk(this._capabilities,e)}setRequestHandler(e,t){let i=Qi(e)?.method;if(!i)throw Error("Schema is missing a method literal");let n;if(Tn(i)){let s=i;n=s._zod?.def?.value??s.value}else{let s=i;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(h,v)=>{let b=Yi(ea,h);if(!b.success){let x=b.error instanceof Error?b.error.message:String(b.error);throw new rt(it.InvalidParams,`Invalid tools/call request: ${x}`)}let{params:_}=b.data,g=await Promise.resolve(t(h,v));if(_.task){let x=Yi(Ys,g);if(!x.success){let M=x.error instanceof Error?x.error.message:String(x.error);throw new rt(it.InvalidParams,`Invalid task creation result: ${M}`)}return x.data}let S=Yi(fp,g);if(!S.success){let x=S.error instanceof Error?S.error.message:String(S.error);throw new rt(it.InvalidParams,`Invalid tools/call result: ${x}`)}return S.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Q8(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Y8(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:y6.includes(t)?t:Gv,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Jh)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],n=i.some((v)=>v.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],h=s.some((v)=>v.type==="tool_use");if(n){if(i.some((v)=>v.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!h)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(h){let v=new Set(s.filter((_)=>_.type==="tool_use").map((_)=>_.id)),b=new Set(i.filter((_)=>_.type==="tool_result").map((_)=>_.toolUseId));if(v.size!==b.size||![...v].every((_)=>b.has(_)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},lb,t);return this.request({method:"sampling/createMessage",params:e},rc,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},ta,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:i},ta,t);if(n.action==="accept"&&n.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(n.content);if(!s.valid)throw new rt(it.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){if(o instanceof rt)throw o;throw new rt(it.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},cb,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var tE=Symbol.for("mcp.completable");function I_(e){return!!e&&typeof e==="object"&&tE in e}function rE(e){return e[tE]?.complete}var eE;(function(e){e.Completable="McpCompletable"})(eE||(eE={}));var xH=/^[A-Za-z0-9._-]{1,128}$/;function kH(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!xH.test(e)){let r=e.split("").filter((i)=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return t.push(`Tool name contains invalid characters: ${r.map((i)=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function MH(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function $_(e){let t=kH(e);return MH(e,t.warnings),t.isValid}class T_{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let i={taskSupport:"required",...t.execution};if(i.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,i,t._meta,r)}}class A_{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new E_(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new T_(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(dp)),this.server.assertCanSetRequestHandler(lo(ea)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(dp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let i=Js(t.inputSchema);return i?gb(i,{strictUnions:!0,pipeStrategy:"input"}):EH})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let i=Js(t.outputSchema);if(i)r.outputSchema=gb(i,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(ea,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new rt(it.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Tool ${e.params.name} disabled`);let i=!!e.params.task,n=r.execution?.taskSupport,o="createTask"in r.handler;if((n==="required"||n==="optional")&&!o)throw new rt(it.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new rt(it.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&o)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),h=await this.executeToolHandler(r,s,t);if(i)return h;return await this.validateToolOutput(r,h,e.params.name),h}catch(r){if(r instanceof rt){if(r.code===it.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=Js(e.inputSchema)??e.inputSchema,o=await Hh(n,t);if(!o.success){let s="error"in o?o.error:"Unknown error",h=Zh(s);throw new rt(it.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${h}`)}return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new rt(it.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let i=Js(e.outputSchema),n=await Hh(i,t.structuredContent);if(!n.success){let o="error"in n?n.error:"Unknown error",s=Zh(o);throw new rt(it.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let i=e.handler;if("createTask"in i){if(!r.taskStore)throw Error("No task store provided.");let o={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(i.createTask(t,o));else return await Promise.resolve(i.createTask(o))}if(e.inputSchema)return await Promise.resolve(i(t,r));else return await Promise.resolve(i(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,o={...r,taskStore:r.taskStore},s=i?await Promise.resolve(n.createTask(i,o)):await Promise.resolve(n.createTask(o)),h=s.task.taskId,v=s.task,b=v.pollInterval??5000;while(v.status!=="completed"&&v.status!=="failed"&&v.status!=="cancelled"){await new Promise((g)=>setTimeout(g,b));let _=await r.taskStore.getTask(h);if(!_)throw new rt(it.InternalError,`Task ${h} not found during polling`);v=_}return await r.taskStore.getTaskResult(h)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(lo(hp)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(hp,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return R6(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return C6(e),this.handleResourceCompletion(e,e.params.ref);default:throw new rt(it.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Ic;let n=Qi(r.argsSchema)?.[e.params.argument.name];if(!I_(n))return Ic;let o=rE(n);if(!o)return Ic;let s=await o(e.params.argument.value,e.params.context);return iE(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((o)=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Ic;throw new rt(it.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let i=r.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return Ic;let n=await i(e.params.argument.value,e.params.context);return iE(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(sp)),this.server.assertCanSetRequestHandler(lo(ap)),this.server.assertCanSetRequestHandler(lo(up)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(sp,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let o=await n.resourceTemplate.listCallback(t);for(let s of o.resources)i.push({...n.metadata,...s})}return{resources:[...r,...i]}}),this.server.setRequestHandler(ap,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(up,async(e,t)=>{let r=new URL(e.params.uri),i=this._registeredResources[r.toString()];if(i){if(!i.enabled)throw new rt(it.InvalidParams,`Resource ${r} disabled`);return i.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let o=n.resourceTemplate.uriTemplate.match(r.toString());if(o)return n.readCallback(r,o,t)}throw new rt(it.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(lp)),this.server.assertCanSetRequestHandler(lo(cp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(lp,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?IH(t.argsSchema):void 0}))})),this.server.setRequestHandler(cp,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let i=Js(r.argsSchema),n=await Hh(i,e.params.arguments);if(!n.success){let h="error"in n?n.error:"Unknown error",v=Zh(h);throw new rt(it.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${v}`)}let o=n.data,s=r.callback;return await Promise.resolve(s(o,t))}else{let i=r.callback;return await Promise.resolve(i(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let i;if(typeof r[0]==="object")i=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,t,r,i){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,i,n){let o={name:e,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=o}if(typeof s.name<"u")o.name=s.name;if(typeof s.title<"u")o.title=s.title;if(typeof s.metadata<"u")o.metadata=s.metadata;if(typeof s.callback<"u")o.readCallback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=o,o}_createRegisteredResourceTemplate(e,t,r,i,n){let o={resourceTemplate:r,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(v)=>{if(typeof v.name<"u"&&v.name!==e){if(delete this._registeredResourceTemplates[e],v.name)this._registeredResourceTemplates[v.name]=o}if(typeof v.title<"u")o.title=v.title;if(typeof v.template<"u")o.resourceTemplate=v.template;if(typeof v.metadata<"u")o.metadata=v.metadata;if(typeof v.callback<"u")o.readCallback=v.callback;if(typeof v.enabled<"u")o.enabled=v.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=o;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((v)=>!!r.completeCallback(v)))this.setCompletionRequestHandler();return o}_createRegisteredPrompt(e,t,r,i,n){let o={title:t,description:r,argsSchema:i===void 0?void 0:Ho(i),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=o}if(typeof s.title<"u")o.title=s.title;if(typeof s.description<"u")o.description=s.description;if(typeof s.argsSchema<"u")o.argsSchema=Ho(s.argsSchema);if(typeof s.callback<"u")o.callback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=o,i){if(Object.values(i).some((h)=>{let v=h instanceof $n?h._def?.innerType:h;return I_(v)}))this.setCompletionRequestHandler()}return o}_createRegisteredTool(e,t,r,i,n,o,s,h,v){$_(e);let b={title:t,description:r,inputSchema:nE(i),outputSchema:nE(n),annotations:o,execution:s,_meta:h,handler:v,enabled:!0,disable:()=>b.update({enabled:!1}),enable:()=>b.update({enabled:!0}),remove:()=>b.update({name:null}),update:(_)=>{if(typeof _.name<"u"&&_.name!==e){if(typeof _.name==="string")$_(_.name);if(delete this._registeredTools[e],_.name)this._registeredTools[_.name]=b}if(typeof _.title<"u")b.title=_.title;if(typeof _.description<"u")b.description=_.description;if(typeof _.paramsSchema<"u")b.inputSchema=Ho(_.paramsSchema);if(typeof _.outputSchema<"u")b.outputSchema=Ho(_.outputSchema);if(typeof _.callback<"u")b.handler=_.callback;if(typeof _.annotations<"u")b.annotations=_.annotations;if(typeof _._meta<"u")b._meta=_._meta;if(typeof _.enabled<"u")b.enabled=_.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=b,this.setToolRequestHandlers(),this.sendToolListChanged(),b}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,i,n,o;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let h=t[0];if(P_(h)){if(i=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!P_(t[0]))o=t.shift()}else if(typeof h==="object"&&h!==null){if(Object.values(h).some((v)=>typeof v==="object"&&v!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);o=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,i,n,o,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:h,_meta:v}=t;return this._createRegisteredTool(e,i,n,o,s,h,{taskSupport:"forbidden"},v,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let i;if(t.length>1)i=t.shift();let n=t[0],o=this._createRegisteredPrompt(e,void 0,r,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:i,description:n,argsSchema:o}=t,s=this._createRegisteredPrompt(e,i,n,o,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var EH={type:"object",properties:{}};function oE(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function sE(e){return"_def"in e||"_zod"in e||oE(e)}function P_(e){if(typeof e!=="object"||e===null)return!1;if(sE(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(oE)}function nE(e){if(!e)return;if(P_(e))return Ho(e);if(!sE(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function IH(e){let t=Qi(e);if(!t)return[];return Object.entries(t).map(([r,i])=>{let n=m6(i),o=g6(i);return{name:r,description:n,required:!o}})}function lo(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Kh(r);if(typeof i==="string")return i;throw Error("Schema method literal must be a string")}function iE(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Ic={completion:{values:[],hasMore:!1}};function $H(e,t,r,i,n){let o={};if(n?.searchHint)o["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)o["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:i,annotations:n?.annotations,_meta:Object.keys(o).length>0?o:void 0}}function TH(e){let t=new A_({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let i of Object.values(r.inputSchema)){if(!PH(i))continue;let n=i.description;if(n&&!tn.has(i))tn.add(i,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function PH(e){return typeof e==="object"&&e!==null&&"_zod"in e}function c1e(e){let t=e.abortController||u6(),r=new Map;if(e.mcpServers)for(let[o,s]of Object.entries(e.mcpServers))if(s.type==="sdk"&&s.instance)r.set(o,s.instance);else throw Error("Browser SDK only supports SDK MCP servers for now");let i;if(e.sse)i=new Lv({streamUrl:e.sse.streamUrl,sendUrl:e.sse.sendUrl,sessionId:e.sse.sessionId,headers:e.sse.headers,abortController:t});else i=new Fv({url:e.websocket.url,headers:e.websocket.headers,authMessage:e.websocket.authMessage,abortController:t});let n=new Ch(i,!1,e.canUseTool,e.hooks,t,r,e.jsonSchema,e.promptSuggestions!==void 0?{promptSuggestions:e.promptSuggestions}:void 0,e.onElicitation,void 0,void 0,e.onUserDialog);return n.streamInput(e.prompt).catch((o)=>t.abort(o)),n}export{qe as z,$H as tool,c1e as query,TH as createSdkMcpServer};
|