1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,55419,(e,t,r)=>{var a={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],a=t[1];return(r+a)*3/4-a},t.toByteArray=function(e){var t,r,i=l(e),s=i[0],o=i[1],u=new n((s+o)*3/4-o),d=0,c=o>0?s-4:s;for(r=0;r<c;r+=4)t=a[e.charCodeAt(r)]<<18|a[e.charCodeAt(r+1)]<<12|a[e.charCodeAt(r+2)]<<6|a[e.charCodeAt(r+3)],u[d++]=t>>16&255,u[d++]=t>>8&255,u[d++]=255&t;return 2===o&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,u[d++]=255&t),1===o&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,u[d++]=t>>8&255,u[d++]=255&t),u},t.fromByteArray=function(e){for(var t,a=e.length,n=a%3,i=[],s=0,o=a-n;s<o;s+=16383)i.push(function(e,t,a){for(var n,i=[],s=t;s<a;s+=3)n=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),i.push(r[n>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return i.join("")}(e,s,s+16383>o?o:s+16383));return 1===n?i.push(r[(t=e[a-1])>>2]+r[t<<4&63]+"=="):2===n&&i.push(r[(t=(e[a-2]<<8)+e[a-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],a=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,o=i.length;s<o;++s)r[s]=i[s],a[i.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var a=r===t?0:4-r%4;return[r,a]}a[45]=62,a[95]=63},72:function(e,t,r){"use strict";var a=r(675),n=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var a=e,n=t;if(("string"!=typeof n||""===n)&&(n="utf8"),!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);var i=0|f(a,n),l=s(i),u=l.write(a,n);return u!==i&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return function(e,t,r){var a;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');return Object.setPrototypeOf(a=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),a}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return o.from(d,t,r);var h=function(e){if(o.isBuffer(e)){var t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(h)return h;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.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 u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),s(e<0?0:0|p(e))}function c(e){for(var t=e.length<0?0:0|p(e.length),r=s(t),a=0;a<t;a+=1)r[a]=255&e[a];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},o.allocUnsafe=function(e){return d(e)},o.allocUnsafeSlow=function(e){return d(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return S(e).length;default:if(n)return a?-1:Z(e).length;t=(""+t).toLowerCase(),n=!0}}function h(e,t,r){var n,i,s,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var a=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>a)&&(r=a);for(var n="",i=t;i<r;++i)n+=O[e[i]];return n}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;n<r;++n)a+=String.fromCharCode(127&e[n]);return a}(this,t,r);case"latin1":case"binary":return function(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;n<r;++n)a+=String.fromCharCode(e[n]);return a}(this,t,r);case"base64":return n=this,i=t,s=r,0===i&&s===n.length?a.fromByteArray(n):a.fromByteArray(n.slice(i,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var a=e.slice(t,r),n="",i=0;i<a.length;i+=2)n+=String.fromCharCode(a[i]+256*a[i+1]);return n}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function g(e,t,r,a,n){var i;if(0===e.length)return -1;if("string"==typeof r?(a=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(n)return -1;else r=e.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,a)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,a,n);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,a,n)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,a,n){var i,s=1,o=e.length,l=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return -1;s=2,o/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var d=-1;for(i=r;i<o;i++)if(u(e,i)===u(t,-1===d?0:i-d)){if(-1===d&&(d=i),i-d+1===l)return d*s}else -1!==d&&(i-=i-d),d=-1}else for(r+l>o&&(r=o-l),i=r;i>=0;i--){for(var c=!0,p=0;p<l;p++)if(u(e,i+p)!==u(t,p)){c=!1;break}if(c)return i}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(A(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),A(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,a=t.length,n=0,i=Math.min(r,a);n<i;++n)if(e[n]!==t[n]){r=e[n],a=t[n];break}return r<a?-1:+(a<r)},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,a=o.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var i=e[r];if(A(i,Uint8Array)&&(i=o.from(i)),!o.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(a,n),n+=i.length}return a},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):h.apply(this,arguments)}
vendor: 10,368 bytes, line 1
1,o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(o.prototype[i]=o.prototype.inspect),o.prototype.compare=function(e,t,r,a,n){if(A(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,a>>>=0,n>>>=0,this===e)return 0;for(var i=n-a,s=r-t,l=Math.min(i,s),u=this.slice(a,n),d=e.slice(t,r),c=0;c<l;++c)if(u[c]!==d[c]){i=u[c],s=d[c];break}return i<s?-1:+(s<i)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function v(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n<r;){var i,s,o,l,u=e[n],d=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(d=u);break;case 2:(192&(i=e[n+1]))==128&&(l=(31&u)<<6|63&i)>127&&(d=l);break;case 3:i=e[n+1],s=e[n+2],(192&i)==128&&(192&s)==128&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:i=e[n+1],s=e[n+2],o=e[n+3],(192&i)==128&&(192&s)==128&&(192&o)==128&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(d=l)}null===d?(d=65533,c=1):d>65535&&(d-=65536,a.push(d>>>10&1023|55296),d=56320|1023&d),a.push(d),n+=c}var p=a,f=p.length;if(f<=4096)return String.fromCharCode.apply(String,p);for(var h="",m=0;m<f;)h+=String.fromCharCode.apply(String,p.slice(m,m+=4096));return h}function _(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 b(e,t,r,a,n,i){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw RangeError('"value" argument is out of bounds');if(r+a>e.length)throw RangeError("Index out of range")}function w(e,t,r,a,n,i){if(r+a>e.length||r<0)throw RangeError("Index out of range")}function x(e,t,r,a,i){return t*=1,r>>>=0,i||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,a,23,4),r+4}function E(e,t,r,a,i){return t*=1,r>>>=0,i||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,a,52,8),r+8}o.prototype.write=function(e,t,r,a){if(void 0===t)a="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)a=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,i,s,o,l,u,d,c,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var f=!1;;)switch(a){case"hex":return function(e,t,r,a){r=Number(r)||0;var n=e.length-r;a?(a=Number(a))>n&&(a=n):a=n;var i=t.length;a>i/2&&(a=i/2);for(var s=0;s<a;++s){var o,l=parseInt(t.substr(2*s,2),16);if((o=l)!=o)break;e[r+s]=l}return s}(this,e,t,r);case"utf8":case"utf-8":return n=t,i=r,T(Z(e,this.length-n),this,n,i);case"ascii":return s=t,o=r,T(I(e),this,s,o);case"latin1":case"binary":return function(e,t,r,a){return T(I(t),e,r,a)}(this,e,t,r);case"base64":return l=t,u=r,T(S(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,c=r,T(function(e,t){for(var r,a,n=[],i=0;i<e.length&&!((t-=2)<0);++i)a=(r=e.charCodeAt(i))>>8,n.push(r%256),n.push(a);return n}(e,this.length-d),this,d,c);default:if(f)throw TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var a=this.subarray(e,t);return Object.setPrototypeOf(a,o.prototype),a},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var a=this[e],n=1,i=0;++i<t&&(n*=256);)a+=this[e+i]*n;return a},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},o.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var a=this[e],n=1,i=0;++i<t&&(n*=256);)a+=this[e+i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var a=t,n=1,i=this[e+--a];a>0&&(n*=256);)i+=this[e+--a]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return(e>>>=0,t||_(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,a){if(e*=1,t>>>=0,r>>>=0,!a){var n=Math.pow(2,8*r)-1;b(this,e,t,r,n,0)}var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,a){if(e*=1,t>>>=0,r>>>=0,!a){var n=Math.pow(2,8*r)-1;b(this,e,t,r,n,0)}var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,a){if(e*=1,t>>>=0,!a){var n=Math.pow(2,8*r-1);b(this,e,t,r,n-1,-n)}var i=0,s=1,o=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,a){if(e*=1,t>>>=0,!a){var n=Math.pow(2,8*r-1);b(this,e,t,r,n-1,-n)}var i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,a){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a<r&&(a=r),a===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(a<0)throw RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-r&&(a=e.length-t+r);var n=a-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,a);else if(this===e&&r<t&&t<a)for(var i=n-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,a),t);return n},o.prototype.fill=function(e,t,r,a){if("string"==typeof e){if("string"==typeof t?(a=t,t=0,r=this.length):"string"==typeof r&&(a=r,r=this.length),void 0!==a&&"string"!=typeof a)throw TypeError("encoding must be a string");if("string"==typeof a&&!o.isEncoding(a))throw TypeError("Unknown encoding: "+a);if(1===e.length){var n,i=e.charCodeAt(0);("utf8"===a&&i<128||"latin1"===a)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(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>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{var s=o.isBuffer(e)?e:o.from(e,a),l=s.length;
1if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%l]}return this};var k=/[^+/0-9A-Za-z-_]/g;function Z(e,t){t=t||1/0;for(var r,a=e.length,n=null,i=[],s=0;s<a;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319||s+1===a){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function I(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function S(e){return a.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,a){for(var n=0;n<a&&!(n+r>=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var O=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},783:function(e,t){t.read=function(e,t,r,a,n){var i,s,o=8*n-a-1,l=(1<<o)-1,u=l>>1,d=-7,c=r?n-1:0,p=r?-1:1,f=e[t+c];for(c+=p,i=f&(1<<-d)-1,f>>=-d,d+=o;d>0;i=256*i+e[t+c],c+=p,d-=8);for(s=i&(1<<-d)-1,i>>=-d,d+=a;d>0;s=256*s+e[t+c],c+=p,d-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,a),i-=u}return(f?-1:1)*s*Math.pow(2,i-a)},t.write=function(e,t,r,a,n,i){var s,o,l,u=8*i-n-1,d=(1<<u)-1,c=d>>1,p=5960464477539062e-23*(23===n),f=a?0:i-1,h=a?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+c>=1?t+=p/l:t+=p*Math.pow(2,1-c),t*l>=2&&(s++,l/=2),s+c>=d?(o=0,s=d):s+c>=1?(o=(t*l-1)*Math.pow(2,n),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;e[r+f]=255&o,f+=h,o/=256,n-=8);for(s=s<<n|o,u+=n;u>0;e[r+f]=255&s,f+=h,s/=256,u-=8);e[r+f-h]|=128*m}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}},s=!0;try{a[e](r,r.exports,i),s=!1}finally{s&&delete n[e]}return r.exports}i.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/buffer/",t.exports=i(72)},99258,(e,t,r)=>{"use strict";var a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,o={},l={SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>c};for(var u in l)a(o,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))s.call(e,l)||l===r||a(e,l,{get:()=>t[l],enumerable:!(o=n(t,l))||o.enumerable});return e})(a({},"__esModule",{value:!0}),o);let d=Symbol.for("@vercel/request-context");function c(){let e=globalThis;return e[d]?.get?.()??{}}},60773,(e,t,r)=>{"use strict";var a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,o={},l={getContext:()=>d.getContext,getVercelOidcToken:()=>c,getVercelOidcTokenSync:()=>p};for(var u in l)a(o,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))s.call(e,l)||l===r||a(e,l,{get:()=>t[l],enumerable:!(o=n(t,l))||o.enumerable});return e})(a({},"__esModule",{value:!0}),o);var d=e.r(99258);async function c(){return""}function p(){return""}},61030,(e,t,r)=>{t.exports=function(e,t){let r;if("function"!=typeof e)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a=0;return function(...n){clearTimeout(r);let i=Date.now(),s=t-(i-a);s<=0?(a=i,e.apply(this,n)):r=setTimeout(()=>{a=Date.now(),e.apply(this,n)},s)}}},7983,(e,t,r)=>{"use strict";var a=e.r(61224),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=a.useState,s=a.useEffect,o=a.useLayoutEffect,l=a.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),a=i({inst:{value:r,getSnapshot:t}}),n=a[0].inst,d=a[1];return o(function(){n.value=r,n.getSnapshot=t,u(n)&&d({inst:n})},[e,r,t]),s(function(){return u(n)&&d({inst:n}),e(function(){u(n)&&d({inst:n})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==a.useSyncExternalStore?a.useSyncExternalStore:d},68373,(e,t,r)=>{"use strict";
1t.exports=e.r(7983)},54586,34681,e=>{"use strict";let t;var r,a,n,i,s,o,l,u,d,c,p,f,h,m,g,y,v,_,b,w,x,E,k,Z,I,S,T,A,O,C,R,$,N,j,P,M,L,D,U,B,F,z,V,W,q,J,K,G,Y,H,X,Q=e.i(61224),ee=e.i(22771),et=e.i(55419),er="vercel.ai.error",ea=Symbol.for(er),en=class e extends(u=Error,l=ea,u){constructor({name:e,message:t,cause:r}){super(t),this[l]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,er)}static hasMarker(e,t){let r=Symbol.for(t);return null!=e&&"object"==typeof e&&r in e&&"boolean"==typeof e[r]&&!0===e[r]}},ei="AI_APICallError",es=`vercel.ai.error.${ei}`,eo=Symbol.for(es),el=class extends(c=en,d=eo,c){constructor({message:e,url:t,requestBodyValues:r,statusCode:a,responseHeaders:n,responseBody:i,cause:s,isRetryable:o=null!=a&&(408===a||409===a||429===a||a>=500),data:l}){super({name:ei,message:e,cause:s}),this[d]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=a,this.responseHeaders=n,this.responseBody=i,this.isRetryable=o,this.data=l}static isInstance(e){return en.hasMarker(e,es)}},eu="AI_EmptyResponseBodyError",ed=`vercel.ai.error.${eu}`,ec=Symbol.for(ed),ep=class extends(f=en,p=ec,f){constructor({message:e="Empty response body"}={}){super({name:eu,message:e}),this[p]=!0}static isInstance(e){return en.hasMarker(e,ed)}};function ef(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var eh="AI_InvalidArgumentError",em=`vercel.ai.error.${eh}`,eg=Symbol.for(em),ey=class extends(m=en,h=eg,m){constructor({message:e,cause:t,argument:r}){super({name:eh,message:e,cause:t}),this[h]=!0,this.argument=r}static isInstance(e){return en.hasMarker(e,em)}},ev=Symbol.for("vercel.ai.error.AI_InvalidPromptError");Symbol.for("vercel.ai.error.AI_InvalidResponseDataError");var e_="AI_JSONParseError",eb=`vercel.ai.error.${e_}`,ew=Symbol.for(eb),ex=class extends(y=en,g=ew,y){constructor({text:e,cause:t}){super({name:e_,message:`JSON parsing failed: Text: ${e}. 2Error message: ${ef(t)}`,cause:t}),this[g]=!0,this.text=e}static isInstance(e){return en.hasMarker(e,eb)}},eE=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError");Symbol.for("vercel.ai.error.AI_LoadSettingError");Symbol.for("vercel.ai.error.AI_NoContentGeneratedError");Symbol.for("vercel.ai.error.AI_NoSuchModelError");Symbol.for("vercel.ai.error.AI_TooManyEmbeddingValuesForCallError");var ek="AI_TypeValidationError",eZ=`vercel.ai.error.${ek}`,eI=Symbol.for(eZ),eS=class e extends(_=en,v=eI,_){constructor({value:e,cause:t}){super({name:ek,message:`Type validation failed: Value: ${JSON.stringify(e)}. 3Error message: ${ef(t)}`,cause:t}),this[v]=!0,this.value=e}static isInstance(e){return en.hasMarker(e,eZ)}static wrap({value:t,cause:r}){return e.isInstance(r)&&r.value===t?r:new e({value:t,cause:r})}},eT=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");e.i(17944);var eA=e.i(24017);e.i(43141);var eO=e.i(78444),eC=e.i(13702),eR=e.i(28875);let e$={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function eN(e){eR.config({customError:e})}function ej(){return eR.config().customError}b||(b={}),e.s(["ZodFirstPartyTypeKind",()=>b,"ZodIssueCode",0,e$,"getErrorMap",()=>ej,"setErrorMap",()=>eN],47062);var eP=e.i(64920),eM=e.i(15853),eL=e.i(3918),eD=e.i(54976);e.s(["endsWith",()=>eD._endsWith,"gt",()=>eD._gt,"gte",()=>eD._gte,"includes",()=>eD._includes,"length",()=>eD._length,"lowercase",()=>eD._lowercase,"lt",()=>eD._lt,"lte",()=>eD._lte,"maxLength",()=>eD._maxLength,"maxSize",()=>eD._maxSize,"mime",()=>eD._mime,"minLength",()=>eD._minLength,"minSize",()=>eD._minSize,"multipleOf",()=>eD._multipleOf,"negative",()=>eD._negative,"nonnegative",()=>eD._nonnegative,"nonpositive",()=>eD._nonpositive,"normalize",()=>eD._normalize,"overwrite",()=>eD._overwrite,"positive",()=>eD._positive,"property",()=>eD._property,"regex",()=>eD._regex,"size",()=>eD._size,"slugify",()=>eD._slugify,"startsWith",()=>eD._startsWith,"toLowerCase",()=>eD._toLowerCase,"toUpperCase",()=>eD._toUpperCase,"trim",()=>eD._trim,"uppercase",()=>eD._uppercase],30112);var eU=e.i(30112),eB=e.i(98707);let eF={...eA,...eU,iso:eB},ez=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function eV(e,t){var r;let a;if("boolean"==typeof e)return e?eF.any():eF.never();let n={version:(r=t?.defaultTarget,"https://json-schema.org/draft/2020-12/schema"===(a=e.$schema)?"draft-2
3020-12":"http://json-schema.org/draft-07/schema#"===a?"draft-7":"http://json-schema.org/draft-04/schema#"===a?"draft-4":r??"draft-2020-12"),defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??eL.globalRegistry};return function e(t,r){if("boolean"==typeof t)return t?eF.any():eF.never();let a=function t(r,a){let n;if(void 0!==r.not){if("object"==typeof r.not&&0===Object.keys(r.not).length)return eF.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(void 0!==r.unevaluatedItems)throw Error("unevaluatedItems is not supported");if(void 0!==r.unevaluatedProperties)throw Error("unevaluatedProperties is not supported");if(void 0!==r.if||void 0!==r.then||void 0!==r.else)throw Error("Conditional schemas (if/then/else) are not supported");if(void 0!==r.dependentSchemas||void 0!==r.dependentRequired)throw Error("dependentSchemas and dependentRequired are not supported");if(r.$ref){let t=r.$ref;if(a.refs.has(t))return a.refs.get(t);if(a.processing.has(t))return eF.lazy(()=>{if(!a.refs.has(t))throw Error(`Circular reference not resolved: ${t}`);return a.refs.get(t)});a.processing.add(t);let n=e(function(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(0===r.length)return t.rootSchema;let a="draft-2020-12"===t.version?"$defs":"definitions";if(r[0]===a){let a=r[1];if(!a||!t.defs[a])throw Error(`Reference not found: ${e}`);return t.defs[a]}throw Error(`Reference not found: ${e}`)}(t,a),a);return a.refs.set(t,n),a.processing.delete(t),n}if(void 0!==r.enum){let e=r.enum;if("openapi-3.0"===a.version&&!0===r.nullable&&1===e.length&&null===e[0])return eF.null();if(0===e.length)return eF.never();if(1===e.length)return eF.literal(e[0]);if(e.every(e=>"string"==typeof e))return eF.enum(e);let t=e.map(e=>eF.literal(e));return t.length<2?t[0]:eF.union([t[0],t[1],...t.slice(2)])}if(void 0!==r.const)return eF.literal(r.const);let i=r.type;if(Array.isArray(i)){let e=i.map(e=>t({...r,type:e},a));return 0===e.length?eF.never():1===e.length?e[0]:eF.union(e)}if(!i)return eF.any();switch(i){case"string":{let e=eF.string();if(r.format){let t=r.format;"email"===t?e=e.check(eF.email()):"uri"===t||"uri-reference"===t?e=e.check(eF.url()):"uuid"===t||"guid"===t?e=e.check(eF.uuid()):"date-time"===t?e=e.check(eF.iso.datetime()):"date"===t?e=e.check(eF.iso.date()):"time"===t?e=e.check(eF.iso.time()):"duration"===t?e=e.check(eF.iso.duration()):"ipv4"===t?e=e.check(eF.ipv4()):"ipv6"===t?e=e.check(eF.ipv6()):"mac"===t?e=e.check(eF.mac()):"cidr"===t?e=e.check(eF.cidrv4()):"cidr-v6"===t?e=e.check(eF.cidrv6()):"base64"===t?e=e.check(eF.base64()):"base64url"===t?e=e.check(eF.base64url()):"e164"===t?e=e.check(eF.e164()):"jwt"===t?e=e.check(eF.jwt()):"emoji"===t?e=e.check(eF.emoji()):"nanoid"===t?e=e.check(eF.nanoid()):"cuid"===t?e=e.check(eF.cuid()):"cuid2"===t?e=e.check(eF.cuid2()):"ulid"===t?e=e.check(eF.ulid()):"xid"===t?e=e.check(eF.xid()):"ksuid"===t&&(e=e.check(eF.ksuid()))}"number"==typeof r.minLength&&(e=e.min(r.minLength)),"number"==typeof r.maxLength&&(e=e.max(r.maxLength)),r.pattern&&(e=e.regex(new RegExp(r.pattern))),n=e;break}case"number":case"integer":{let e="integer"===i?eF.number().int():eF.number();"number"==typeof r.minimum&&(e=e.min(r.minimum)),"number"==typeof r.maximum&&(e=e.max(r.maximum)),"number"==typeof r.exclusiveMinimum?e=e.gt(r.exclusiveMinimum):!0===r.exclusiveMinimum&&"number"==typeof r.minimum&&(e=e.gt(r.minimum)),"number"==typeof r.exclusiveMaximum?e=e.lt(r.exclusiveMaximum):!0===r.exclusiveMaximum&&"number"==typeof r.maximum&&(e=e.lt(r.maximum)),"number"==typeof r.multipleOf&&(e=e.multipleOf(r.multipleOf)),n=e;break}case"boolean":n=eF.boolean();break;case"null":n=eF.null();break;case"object":{let t={},i=r.properties||{},s=new Set(r.required||[]);for(let[r,n]of Object.entries(i)){let i=e(n,a);t[r]=s.has(r)?i:i.optional()}if(r.propertyNames){let i=e(r.propertyNames,a),s=r.additionalProperties&&"object"==typeof r.additionalProperties?e(r.additionalProperties,a):eF.any();if(0===Object.keys(t).length){n=eF.record(i,s);break}let o=eF.object(t).passthrough(),l=eF.looseRecord(i,s);n=eF.intersection(o,l);break}if(r.patternProperties){let i=r.patternProperties,s=Object.keys(i),o=[];for(let t of s){let r=e(i[t],a),n=eF.string().regex(new RegExp(t));o.push(eF.looseRecord(n,r))}let l=[];
3if(Object.keys(t).length>0&&l.push(eF.object(t).passthrough()),l.push(...o),0===l.length)n=eF.object({}).passthrough();else if(1===l.length)n=l[0];else{let e=eF.intersection(l[0],l[1]);for(let t=2;t<l.length;t++)e=eF.intersection(e,l[t]);n=e}break}let o=eF.object(t);n=!1===r.additionalProperties?o.strict():"object"==typeof r.additionalProperties?o.catchall(e(r.additionalProperties,a)):o.passthrough();break}case"array":{let t=r.prefixItems,i=r.items;if(t&&Array.isArray(t)){let s=t.map(t=>e(t,a)),o=i&&"object"==typeof i&&!Array.isArray(i)?e(i,a):void 0;n=o?eF.tuple(s).rest(o):eF.tuple(s),"number"==typeof r.minItems&&(n=n.check(eF.minLength(r.minItems))),"number"==typeof r.maxItems&&(n=n.check(eF.maxLength(r.maxItems)))}else if(Array.isArray(i)){let t=i.map(t=>e(t,a)),s=r.additionalItems&&"object"==typeof r.additionalItems?e(r.additionalItems,a):void 0;n=s?eF.tuple(t).rest(s):eF.tuple(t),"number"==typeof r.minItems&&(n=n.check(eF.minLength(r.minItems))),"number"==typeof r.maxItems&&(n=n.check(eF.maxLength(r.maxItems)))}else if(void 0!==i){let t=e(i,a),s=eF.array(t);"number"==typeof r.minItems&&(s=s.min(r.minItems)),"number"==typeof r.maxItems&&(s=s.max(r.maxItems)),n=s}else n=eF.array(eF.any());break}default:throw Error(`Unsupported type: ${i}`)}return r.description&&(n=n.describe(r.description)),void 0!==r.default&&(n=n.default(r.default)),n}(t,r),n=t.type||void 0!==t.enum||void 0!==t.const;if(t.anyOf&&Array.isArray(t.anyOf)){let i=t.anyOf.map(t=>e(t,r)),s=eF.union(i);a=n?eF.intersection(a,s):s}if(t.oneOf&&Array.isArray(t.oneOf)){let i=t.oneOf.map(t=>e(t,r)),s=eF.xor(i);a=n?eF.intersection(a,s):s}if(t.allOf&&Array.isArray(t.allOf))if(0===t.allOf.length)a=n?a:eF.any();else{let i=n?a:e(t.allOf[0],r),s=+!n;for(let a=s;a<t.allOf.length;a++)i=eF.intersection(i,e(t.allOf[a],r));a=i}!0===t.nullable&&"openapi-3.0"===r.version&&(a=eF.nullable(a)),!0===t.readOnly&&(a=eF.readonly(a));let i={};for(let e of["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"])e in t&&(i[e]=t[e]);for(let e of["contentEncoding","contentMediaType","contentSchema"])e in t&&(i[e]=t[e]);for(let e of Object.keys(t))ez.has(e)||(i[e]=t[e]);return Object.keys(i).length>0&&r.registry.add(a,i),a}(e,n)}function eW(e){return eD._coercedString(eA.ZodString,e)}function eq(e){return eD._coercedNumber(eA.ZodNumber,e)}function eJ(e){return eD._coercedBoolean(eA.ZodBoolean,e)}function eK(e){return eD._coercedBigint(eA.ZodBigInt,e)}function eG(e){return eD._coercedDate(eA.ZodDate,e)}e.i(31529),e.s(["bigint",()=>eK,"boolean",()=>eJ,"date",()=>eG,"number",()=>eq,"string",()=>eW],98775),(0,eR.config)((0,eP.default)()),e.s([],61363),e.i(61363);var eY=e.i(9331),eH=e.i(42088),eX=e.i(92541),eQ=e.i(45016),e0=e.i(87409),e1=e.i(50594),e2=e.i(25996),e4=e.i(16400),e6=e.i(23545),e5=e.i(98954),e9=e.i(9972),e3=e.i(9580),e8=e.i(82184),e7=e.i(65453),te=e.i(5294),tt=e.i(33450),tr=e.i(18707),ta=e.i(88689),tn=e.i(72274),ti=e.i(16447),ts=e.i(9586),to=e.i(65338),tl=e.i(96372),tu=e.i(25480),td=e.i(60300),tc=e.i(9974),tp=e.i(41735),tf=e.i(5785),th=e.i(34160),tm=e.i(6820),tg=e.i(50976),ty=e.i(532),tv=e.i(34960),t_=e.i(5950),tb=e.i(30308),tw=e.i(80142),tx=e.i(96492),tE=e.i(2088),tk=e.i(34746),tZ=e.i(24868),tI=e.i(53035),tS=e.i(86555),tT=e.i(9641),tA=e.i(11557),tO=e.i(22939),tC=e.i(11034),tR=e.i(46323),t$=e.i(19910),tN=e.i(94268),tj=e.i(23690),tP=e.i(33250),tM=e.i(26172),tL=e.i(7391),tD=e.i(60686),tU=e.i(68935);e.s(["ar",()=>e4.default,"az",()=>e6.default,"be",()=>e5.default,"bg",()=>e9.default,"ca",()=>e3.default,"cs",()=>e8.default,"da",()=>e7.default,"de",()=>te.default,"en",()=>eP.default,"eo",()=>tt.default,"es",()=>tr.default,"fa",()=>ta.default,"fi",()=>tn.default,"fr",()=>ti.default,"frCA",()=>ts.default,"he",()=>to.default,"hu",()=>tl.default,"hy",()=>tu.default,"id",()=>td.default,"is",()=>tc.default,"it",()=>tp.default,"ja",()=>tf.default,"ka",()=>th.default,"kh",()=>tm.default,"km",()=>tg.default,"ko",()=>ty.default,"lt",()=>tv.default,"mk",()=>t_.default,"ms",()=>tb.default,"nl",()=>tw.default,"no",()=>tx.default,"ota",()=>tE.default,"pl",()=>tZ.default,"ps",()=>tk.default,"pt",()=>tI.default,"ru",()=>tS.default,"sl",()=>tT.default,"sv",()=>tA.default,"ta",()=>tO.default,"th",()=>tC.default,"tr",()=>tR.default,"ua",()=>t$.default,"uk",()=>tN.default,"ur",()=>tj.default,"uz",()=>tP.default,"vi",()=>tM.default,"yo",()=>tU.default,"zhCN",()=>tL.default,"zhTW",()=>tD.default],21305);var tB=e.i(21305),tF=e.i(78540),tz=e.i(19135),tV=e.i(56267),tW=e.i(88286);e.s(["$ZodAny",()=>eX.$ZodAny,"$ZodArray",()=>eX.$ZodArray,"$ZodAsyncError",()=>eR.$ZodAsyncError,"$ZodBase64",()=>eX.$ZodBase64,"$ZodBase64URL",()=>eX.$ZodBase64URL,"$ZodBigInt",()=>eX.$ZodBigInt,"$ZodBigIntFormat",()=>eX.$ZodBigIntFormat,"$ZodBoolean",()=>eX.$ZodBoolean,"$ZodCIDRv4",()=>eX.$ZodCIDRv4,"$ZodCIDRv6",()=>eX.$ZodCIDRv6,"$ZodCUID",()=>eX.$ZodCUID,"$ZodCUID2",()=>eX.$ZodCUID2,"$ZodCatch",()=>eX.$ZodCatch,"$ZodCheck",()=>eQ.$ZodCheck,"$ZodCheckBigIntFormat",()=>eQ.$ZodCheckBigIntFormat,"$ZodCheckEndsWith",()=>eQ.$ZodCheckEndsWith,"$ZodCheckGreaterThan",()=>eQ.$ZodCheckGreaterThan,"$ZodCheckIncludes",()=>eQ.$ZodCheckIncludes,"$ZodCheckLengthEquals",()=>eQ.$ZodCheckLengthEquals,"$ZodCheckLessThan",()=>eQ.$ZodCheckLessThan,"$ZodCheckLowerCase",()=>eQ.$ZodCheckLowerCase,"$ZodCheckMaxLength",()=>eQ.$ZodCheckMaxLength,"$ZodCheckMaxSize",()=>eQ.$ZodCheckMaxSize,"$ZodCheckMimeType",()=>eQ.$ZodCheckMimeType,"$ZodCheckMinLength",()=>eQ.$ZodCheckMinLength,"$ZodCheckMinSize",()=>eQ.$ZodCheckMinSize,"$ZodCheckMultipleOf",()=>eQ.$ZodCheckMultipleOf,"$ZodCheckNumberFormat",()=>eQ.$ZodCheckNumberFormat,"$ZodCheckOverwrite",()=>eQ.$ZodCheckOverwrite,"$ZodCheckProperty",()=>eQ.$ZodCheckProperty,"$ZodCheckRegex",()=>eQ.$ZodCheckRegex,"$ZodCheckSizeEquals",()=>eQ.$ZodCheckSizeEquals,"$ZodCheckStartsWith",()=>eQ.$ZodCheckStartsWith,"$ZodCheckStringFormat",()=>eQ.$ZodCheckStringFormat,"$ZodCheckUpperCase",()=>eQ.$ZodCheckUpperCase,"$ZodCodec",()=>eX.$ZodCodec,"$ZodCustom",()=>eX.$ZodCustom,"$ZodCustomStringFormat",()=>eX.$ZodCustomStringFormat,"$ZodDate",()=>eX.$ZodDate,"$ZodDefault",()=>eX.$ZodDefault,"$ZodDiscriminatedUnion",()=>eX.$ZodDiscriminatedUnion,"$ZodE164",()=>eX.$ZodE164,"$ZodEmail",()=>eX.$ZodEmail,"$ZodEmoji",()=>eX.$ZodEmoji,"$ZodEncodeError",()=>eR.$ZodEncodeError,"$ZodEnum",()=>eX.$ZodEnum,"$ZodError",()=>eH.$ZodError,"$ZodExactOptional",()=>eX.$ZodExactOptional,"$ZodFile",()=>eX.$ZodFile,"$ZodFunction",()=>eX.$ZodFunction,"$ZodGUID",()=>
3eX.$ZodGUID,"$ZodIPv4",()=>eX.$ZodIPv4,"$ZodIPv6",()=>eX.$ZodIPv6,"$ZodISODate",()=>eX.$ZodISODate,"$ZodISODateTime",()=>eX.$ZodISODateTime,"$ZodISODuration",()=>eX.$ZodISODuration,"$ZodISOTime",()=>eX.$ZodISOTime,"$ZodIntersection",()=>eX.$ZodIntersection,"$ZodJWT",()=>eX.$ZodJWT,"$ZodKSUID",()=>eX.$ZodKSUID,"$ZodLazy",()=>eX.$ZodLazy,"$ZodLiteral",()=>eX.$ZodLiteral,"$ZodMAC",()=>eX.$ZodMAC,"$ZodMap",()=>eX.$ZodMap,"$ZodNaN",()=>eX.$ZodNaN,"$ZodNanoID",()=>eX.$ZodNanoID,"$ZodNever",()=>eX.$ZodNever,"$ZodNonOptional",()=>eX.$ZodNonOptional,"$ZodNull",()=>eX.$ZodNull,"$ZodNullable",()=>eX.$ZodNullable,"$ZodNumber",()=>eX.$ZodNumber,"$ZodNumberFormat",()=>eX.$ZodNumberFormat,"$ZodObject",()=>eX.$ZodObject,"$ZodObjectJIT",()=>eX.$ZodObjectJIT,"$ZodOptional",()=>eX.$ZodOptional,"$ZodPipe",()=>eX.$ZodPipe,"$ZodPrefault",()=>eX.$ZodPrefault,"$ZodPromise",()=>eX.$ZodPromise,"$ZodReadonly",()=>eX.$ZodReadonly,"$ZodRealError",()=>eH.$ZodRealError,"$ZodRecord",()=>eX.$ZodRecord,"$ZodRegistry",()=>eL.$ZodRegistry,"$ZodSet",()=>eX.$ZodSet,"$ZodString",()=>eX.$ZodString,"$ZodStringFormat",()=>eX.$ZodStringFormat,"$ZodSuccess",()=>eX.$ZodSuccess,"$ZodSymbol",()=>eX.$ZodSymbol,"$ZodTemplateLiteral",()=>eX.$ZodTemplateLiteral,"$ZodTransform",()=>eX.$ZodTransform,"$ZodTuple",()=>eX.$ZodTuple,"$ZodType",()=>eX.$ZodType,"$ZodULID",()=>eX.$ZodULID,"$ZodURL",()=>eX.$ZodURL,"$ZodUUID",()=>eX.$ZodUUID,"$ZodUndefined",()=>eX.$ZodUndefined,"$ZodUnion",()=>eX.$ZodUnion,"$ZodUnknown",()=>eX.$ZodUnknown,"$ZodVoid",()=>eX.$ZodVoid,"$ZodXID",()=>eX.$ZodXID,"$ZodXor",()=>eX.$ZodXor,"$brand",()=>eR.$brand,"$constructor",()=>eR.$constructor,"$input",()=>eL.$input,"$output",()=>eL.$output,"Doc",()=>tF.Doc,"JSONSchema",0,tW,"JSONSchemaGenerator",()=>tV.JSONSchemaGenerator,"NEVER",()=>eR.NEVER,"TimePrecision",()=>eD.TimePrecision,"_any",()=>eD._any,"_array",()=>eD._array,"_base64",()=>eD._base64,"_base64url",()=>eD._base64url,"_bigint",()=>eD._bigint,"_boolean",()=>eD._boolean,"_catch",()=>eD._catch,"_check",()=>eD._check,"_cidrv4",()=>eD._cidrv4,"_cidrv6",()=>eD._cidrv6,"_coercedBigint",()=>eD._coercedBigint,"_coercedBoolean",()=>eD._coercedBoolean,"_coercedDate",()=>eD._coercedDate,"_coercedNumber",()=>eD._coercedNumber,"_coercedString",()=>eD._coercedString,"_cuid",()=>eD._cuid,"_cuid2",()=>eD._cuid2,"_custom",()=>eD._custom,"_date",()=>eD._date,"_decode",()=>eY._decode,"_decodeAsync",()=>eY._decodeAsync,"_default",()=>eD._default,"_discriminatedUnion",()=>eD._discriminatedUnion,"_e164",()=>eD._e164,"_email",()=>eD._email,"_emoji",()=>eD._emoji,"_encode",()=>eY._encode,"_encodeAsync",()=>eY._encodeAsync,"_endsWith",()=>eD._endsWith,"_enum",()=>eD._enum,"_file",()=>eD._file,"_float32",()=>eD._float32,"_float64",()=>eD._float64,"_gt",()=>eD._gt,"_gte",()=>eD._gte,"_guid",()=>eD._guid,"_includes",()=>eD._includes,"_int",()=>eD._int,"_int32",()=>eD._int32,"_int64",()=>eD._int64,"_intersection",()=>eD._intersection,"_ipv4",()=>eD._ipv4,"_ipv6",()=>eD._ipv6,"_isoDate",()=>eD._isoDate,"_isoDateTime",()=>eD._isoDateTime,"_isoDuration",()=>eD._isoDuration,"_isoTime",()=>eD._isoTime,"_jwt",()=>eD._jwt,"_ksuid",()=>eD._ksuid,"_lazy",()=>eD._lazy,"_length",()=>eD._length,"_literal",()=>eD._literal,"_lowercase",()=>eD._lowercase,"_lt",()=>eD._lt,"_lte",()=>eD._lte,"_mac",()=>eD._mac,"_map",()=>eD._map,"_max",()=>eD._max,"_maxLength",()=>eD._maxLength,"_maxSize",()=>eD._maxSize,"_mime",()=>eD._mime,"_min",()=>eD._min,"_minLength",()=>eD._minLength,"_minSize",()=>eD._minSize,"_multipleOf",()=>eD._multipleOf,"_nan",()=>eD._nan,"_nanoid",()=>eD._nanoid,"_nativeEnum",()=>eD._nativeEnum,"_negative",()=>eD._negative,"_never",()=>eD._never,"_nonnegative",()=>eD._nonnegative,"_nonoptional",()=>eD._nonoptional,"_nonpositive",()=>eD._nonpositive,"_normalize",()=>eD._normalize,"_null",()=>eD._null,"_nullable",()=>eD._nullable,"_number",()=>eD._number,"_optional",()=>eD._optional,"_overwrite",()=>eD._overwrite,"_parse",()=>eY._parse,"_parseAsync",()=>eY._parseAsync,"_pipe",()=>eD._pipe,"_positive",()=>eD._positive,"_promise",()=>eD._promise,"_property",()=>eD._property,"_readonly",()=>eD._readonly,"_record",()=>eD._record,"_refine",()=>eD._refine,"_regex",()=>eD._regex,"_safeDecode",()=>eY._safeDecode,"_safeDecodeAsync",()=>eY._safeDecodeAsync,"_safeEncode",()=>eY._safeEncode,"_safeEncodeAsync",()=>eY._safeEncodeAsync,"_safeParse",()=>eY._safeParse,"_safeParseAsync",()=>eY._safeParseAsync,"_set",()=>eD._set,"_size",()=>eD._size,"_slugify",()=>eD._slugify,"_startsWith",()=>eD._startsWith,"_string",()=>eD._string,"_stringFormat",()=>eD._stringFormat,"_stringbool",()=>eD._stringbool,"_success",()=>eD._success,"_superRefine",()=>eD._superRefine,"_symbol",()=>eD._symbol,"_templateLiteral",()=>eD._templateLiteral,"_toLowerCase",()=>eD._toLowerCase,"_toUpperCase",()=>eD._toUpperCase,"_transform",()=>eD._transform,"_trim",()=>eD._trim,"_tuple",()=>eD._tuple,"_uint32",()=>eD._uint32,"_uint64",()=>eD._uint64,"_ulid",()=>eD._ulid,"_undefined",()=>eD._undefined,"_union",()=>eD._union,"_unknown",()=>eD._unknown,"_uppercase",()=>eD._uppercase,"_url",()=>eD._url,"_uuid",()=>eD._uuid,"_uuidv4",()=>eD._uuidv4,"_uuidv6",()=>eD._uuidv6,"_uuidv7",()=>eD._uuidv7,"_void",()=>eD._void,"_xid",()=>eD._xid,"_xor",()=>eD._xor,"clone",()=>eX.clone,"config",()=>eR.config,"createStandardJSONSchemaMethod",()=>tz.createStandardJSONSchemaMethod,"createToJSONSchemaMethod",()=>tz.createToJSONSchemaMethod,"decode",()=>eY.decode,"decodeAsync",()=>eY.decodeAsync,"describe",()=>eD.describe,"encode",()=>eY.encode,"encodeAsync",()=>eY.encodeAsync,"extractDefs",()=>tz.extractDefs,"finalize",()=>tz.finalize,"flattenError",()=>eH.flattenError,"formatError",()=>eH.formatError,"globalConfig",()=>eR.globalConfig,"globalRegistry",()=>eL.globalRegistry,"initializeContext",()=>tz.initializeContext,"isValidBase64",()=>eX.isValidBase64,"isValidBase64URL",()=>eX.isValidBase64URL,"isValidJWT",()=>eX.isValidJWT,"locales",0,tB,"meta",()=>eD.meta,"parse",()=>eY.parse,"parseAsync",()=>eY.parseAsync,"prettifyError",()=>eH.prettifyError,"process",()=>tz.process,"regexes",0,e2,"registry",()=>eL.registry,"safeDecode",()=>eY.safeDecode,"safeDecodeAsync",()=>eY.safeDecodeAsync,"safeEncode",()=>eY.safeEncode,"safeEncodeAsync",()=>eY.safeEncodeAsync,"safeParse",()=>eY.safeParse,"safeParseAsync",()=>eY.safeParseAsync,"toDotPath",()=>eH.toDotPath,"toJSONSchema",()=>eM.toJSONSchema,"treeifyError",()=>eH.treeifyError,"util",0,e1,"version",()=>e0.version],66613);var tq=e.i(66613);e.i(47062),e.s(["$brand",()=>eR.$brand,"ZodFirstPartyTypeKind",()=>b,"ZodIssueCode",0,e$,"config",()=>eR.config,"getErrorMap",()=>ej,"setErrorMap",()=>
3eN],11307),e.i(11307);var tJ=e.i(42786),tK=e.i(54976),tG=e.i(41801),tY=eM,tH=e.i(98775);e.s(["$brand",()=>eR.$brand,"$input",()=>eL.$input,"$output",()=>eL.$output,"NEVER",()=>eR.NEVER,"TimePrecision",()=>tK.TimePrecision,"ZodAny",()=>eA.ZodAny,"ZodArray",()=>eA.ZodArray,"ZodBase64",()=>eA.ZodBase64,"ZodBase64URL",()=>eA.ZodBase64URL,"ZodBigInt",()=>eA.ZodBigInt,"ZodBigIntFormat",()=>eA.ZodBigIntFormat,"ZodBoolean",()=>eA.ZodBoolean,"ZodCIDRv4",()=>eA.ZodCIDRv4,"ZodCIDRv6",()=>eA.ZodCIDRv6,"ZodCUID",()=>eA.ZodCUID,"ZodCUID2",()=>eA.ZodCUID2,"ZodCatch",()=>eA.ZodCatch,"ZodCodec",()=>eA.ZodCodec,"ZodCustom",()=>eA.ZodCustom,"ZodCustomStringFormat",()=>eA.ZodCustomStringFormat,"ZodDate",()=>eA.ZodDate,"ZodDefault",()=>eA.ZodDefault,"ZodDiscriminatedUnion",()=>eA.ZodDiscriminatedUnion,"ZodE164",()=>eA.ZodE164,"ZodEmail",()=>eA.ZodEmail,"ZodEmoji",()=>eA.ZodEmoji,"ZodEnum",()=>eA.ZodEnum,"ZodError",()=>eO.ZodError,"ZodExactOptional",()=>eA.ZodExactOptional,"ZodFile",()=>eA.ZodFile,"ZodFirstPartyTypeKind",()=>b,"ZodFunction",()=>
3eA.ZodFunction,"ZodGUID",()=>eA.ZodGUID,"ZodIPv4",()=>eA.ZodIPv4,"ZodIPv6",()=>eA.ZodIPv6,"ZodISODate",()=>eB.ZodISODate,"ZodISODateTime",()=>eB.ZodISODateTime,"ZodISODuration",()=>eB.ZodISODuration,"ZodISOTime",()=>eB.ZodISOTime,"ZodIntersection",()=>eA.ZodIntersection,"ZodIssueCode",0,e$,"ZodJWT",()=>eA.ZodJWT,"ZodKSUID",()=>eA.ZodKSUID,"ZodLazy",()=>eA.ZodLazy,"ZodLiteral",()=>eA.ZodLiteral,"ZodMAC",()=>eA.ZodMAC,"ZodMap",()=>eA.ZodMap,"ZodNaN",()=>eA.ZodNaN,"ZodNanoID",()=>eA.ZodNanoID,"ZodNever",()=>eA.ZodNever,"ZodNonOptional",()=>eA.ZodNonOptional,"ZodNull",()=>eA.ZodNull,"ZodNullable",()=>eA.ZodNullable,"ZodNumber",()=>eA.ZodNumber,"ZodNumberFormat",()=>eA.ZodNumberFormat,"ZodObject",()=>eA.ZodObject,"ZodOptional",()=>eA.ZodOptional,"ZodPipe",()=>eA.ZodPipe,"ZodPrefault",()=>eA.ZodPrefault,"ZodPromise",()=>eA.ZodPromise,"ZodReadonly",()=>eA.ZodReadonly,"ZodRealError",()=>eO.ZodRealError,"ZodRecord",()=>eA.ZodRecord,"ZodSet",()=>eA.ZodSet,"ZodString",()=>eA.ZodString,"ZodStringFormat",()=>eA.ZodStringFormat,"ZodSuccess",()=>eA.ZodSuccess,"ZodSymbol",()=>eA.ZodSymbol,"ZodTemplateLiteral",()=>eA.ZodTemplateLiteral,"ZodTransform",()=>eA.ZodTransform,"ZodTuple",()=>eA.ZodTuple,"ZodType",()=>eA.ZodType,"ZodULID",()=>eA.ZodULID,"ZodURL",()=>eA.ZodURL,"ZodUUID",()=>eA.ZodUUID,"ZodUndefined",()=>eA.ZodUndefined,"ZodUnion",()=>eA.ZodUnion,"ZodUnknown",()=>eA.ZodUnknown,"ZodVoid",()=>eA.ZodVoid,"ZodXID",()=>eA.ZodXID,"ZodXor",()=>eA.ZodXor,"_ZodString",()=>eA._ZodString,"_default",()=>eA._default,"_function",()=>eA._function,"any",()=>eA.any,"array",()=>eA.array,"base64",()=>eA.base64,"base64url",()=>eA.base64url,"bigint",()=>eA.bigint,"boolean",()=>eA.boolean,"catch",()=>eA.catch,"check",()=>eA.check,"cidrv4",()=>eA.cidrv4,"cidrv6",()=>eA.cidrv6,"clone",()=>eX.clone,"codec",()=>eA.codec,"coerce",0,tH,"config",()=>eR.config,"core",0,tq,"cuid",()=>eA.cuid,"cuid2",()=>eA.cuid2,"custom",()=>eA.custom,"date",()=>eA.date,"decode",()=>eC.decode,"decodeAsync",()=>eC.decodeAsync,"describe",()=>eA.describe,"discriminatedUnion",()=>eA.discriminatedUnion,"e164",()=>eA.e164,"email",()=>eA.email,"emoji",()=>eA.emoji,"encode",()=>eC.encode,"encodeAsync",()=>eC.encodeAsync,"endsWith",()=>eD._endsWith,"enum",()=>eA.enum,"exactOptional",()=>eA.exactOptional,"file",()=>eA.file,"flattenError",()=>eH.flattenError,"float32",()=>eA.float32,"float64",()=>eA.float64,"formatError",()=>eH.formatError,"fromJSONSchema",()=>eV,"function",()=>eA.function,"getErrorMap",()=>ej,"globalRegistry",()=>eL.globalRegistry,"gt",()=>eD._gt,"gte",()=>eD._gte,"guid",()=>eA.guid,"hash",()=>eA.hash,"hex",()=>eA.hex,"hostname",()=>eA.hostname,"httpUrl",()=>eA.httpUrl,"includes",()=>eD._includes,"instanceof",()=>eA.instanceof,"int",()=>eA.int,"int32",()=>eA.int32,"int64",()=>eA.int64,"intersection",()=>eA.intersection,"ipv4",()=>eA.ipv4,"ipv6",()=>eA.ipv6,"iso",0,eB,"json",()=>eA.json,"jwt",()=>eA.jwt,"keyof",()=>eA.keyof,"ksuid",()=>eA.ksuid,"lazy",()=>eA.lazy,"length",()=>eD._length,"literal",()=>eA.literal,"locales",0,tB,"looseObject",()=>eA.looseObject,"looseRecord",()=>eA.looseRecord,"lowercase",()=>eD._lowercase,"lt",()=>eD._lt,"lte",()=>eD._lte,"mac",()=>eA.mac,"map",()=>eA.map,"maxLength",()=>eD._maxLength,"maxSize",()=>eD._maxSize,"meta",()=>eA.meta,"mime",()=>eD._mime,"minLength",()=>eD._minLength,"minSize",()=>eD._minSize,"multipleOf",()=>eD._multipleOf,"nan",()=>eA.nan,"nanoid",()=>eA.nanoid,"nativeEnum",()=>eA.nativeEnum,"negative",()=>eD._negative,"never",()=>eA.never,"nonnegative",()=>eD._nonnegative,"nonoptional",()=>eA.nonoptional,"nonpositive",()=>eD._nonpositive,"normalize",()=>eD._normalize,"null",()=>eA.null,"nullable",()=>eA.nullable,"nullish",()=>eA.nullish,"number",()=>eA.number,"object",()=>eA.object,"optional",()=>eA.optional,"overwrite",()=>eD._overwrite,"parse",()=>eC.parse,"parseAsync",()=>eC.parseAsync,"partialRecord",()=>eA.partialRecord,"pipe",()=>eA.pipe,"positive",()=>eD._positive,"prefault",()=>eA.prefault,"preprocess",()=>eA.preprocess,"prettifyError",()=>eH.prettifyError,"promise",()=>eA.promise,"property",()=>eD._property,"readonly",()=>eA.readonly,"record",()=>eA.record,"refine",()=>eA.refine,"regex",()=>eD._regex,"regexes",()=>tJ.regexes,"registry",()=>eL.registry,"safeDecode",()=>eC.safeDecode,"safeDecodeAsync",()=>eC.safeDecodeAsync,"safeEncode",()=>eC.safeEncode,"safeEncodeAsync",()=>eC.safeEncodeAsync,"safeParse",()=>eC.safeParse,"safeParseAsync",()=>eC.safeParseAsync,"set",()=>eA.set,"setErrorMap",()=>eN,"size",()=>eD._size,"slugify",()=>eD._slugify,"startsWith",()=>eD._startsWith,"strictObject",()=>eA.strictObject,"string",()=>
3eA.string,"stringFormat",()=>eA.stringFormat,"stringbool",()=>eA.stringbool,"success",()=>eA.success,"superRefine",()=>eA.superRefine,"symbol",()=>eA.symbol,"templateLiteral",()=>eA.templateLiteral,"toJSONSchema",()=>tY.toJSONSchema,"toLowerCase",()=>eD._toLowerCase,"toUpperCase",()=>eD._toUpperCase,"transform",()=>eA.transform,"treeifyError",()=>eH.treeifyError,"trim",()=>eD._trim,"tuple",()=>eA.tuple,"uint32",()=>eA.uint32,"uint64",()=>eA.uint64,"ulid",()=>eA.ulid,"undefined",()=>eA.undefined,"union",()=>eA.union,"unknown",()=>eA.unknown,"uppercase",()=>eD._uppercase,"url",()=>eA.url,"util",()=>tG.util,"uuid",()=>eA.uuid,"uuidv4",()=>eA.uuidv4,"uuidv6",()=>eA.uuidv6,"uuidv7",()=>eA.uuidv7,"void",()=>eA.void,"xid",()=>eA.xid,"xor",()=>eA.xor],69547);var tX=e.i(69547);e.s(["default",0,tX],62341);var tY=eM;(r=w||(w={})).assertEqual=e=>{},r.assertIs=function(e){},r.assertNever=function(e){throw Error()},r.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},r.getValidEnumValues=e=>{let t=r.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(let r of t)a[r]=e[r];return r.objectValues(a)},r.objectValues=e=>r.objectKeys(e).map(function(t){return e[t]}),r.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},r.find=(e,t)=>{for(let r of e)if(t(r))return r},r.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,r.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},r.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(x||(x={})).mergeShapes=(e,t)=>({...e,...t});let tQ=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t0=e=>{switch(typeof e){case"undefined":return tQ.undefined;case"string":return tQ.string;case"number":return Number.isNaN(e)?tQ.nan:tQ.number;case"boolean":return tQ.boolean;case"function":return tQ.function;case"bigint":return tQ.bigint;case"symbol":return tQ.symbol;case"object":if(Array.isArray(e))return tQ.array;if(null===e)return tQ.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return tQ.promise;if("undefined"!=typeof Map&&e instanceof Map)return tQ.map;if("undefined"!=typeof Set&&e instanceof Set)return tQ.set;if("undefined"!=typeof Date&&e instanceof Date)return tQ.date;return tQ.object;default:return tQ.unknown}};e.s(["ZodParsedType",0,tQ,"getParsedType",0,t0,"objectUtil",()=>x,"util",()=>w],77453);
3let t1=w.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"]),t2=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class t4 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,a=0;for(;a<n.path.length;){let r=n.path[a];a===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof t4))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}t4.create=e=>new t4(e),e.s(["ZodError",()=>t4,"ZodIssueCode",0,t1,"quotelessJson",0,t2],39216);let t6=(e,t)=>{let r;switch(e.code){case t1.invalid_type:r=e.received===tQ.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case t1.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,w.jsonStringifyReplacer)}`;break;case t1.unrecognized_keys:r=`Unrecognized key(s) in object: ${w.joinValues(e.keys,", ")}`;break;case t1.invalid_union:r="Invalid input";break;case t1.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${w.joinValues(e.options)}`;break;case t1.invalid_enum_value:r=`Invalid enum value. Expected ${w.joinValues(e.options)}, received '${e.received}'`;break;case t1.invalid_arguments:r="Invalid function arguments";break;case t1.invalid_return_type:r="Invalid function return type";break;case t1.invalid_date:r="Invalid date";break;case t1.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:w.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case t1.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case t1.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case t1.custom:r="Invalid input";break;case t1.invalid_intersection_types:r="Intersection results could not be merged";break;case t1.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case t1.not_finite:r="Number must be finite";break;default:r=t.defaultError,w.assertNever(e)}return{message:r}},t5=t6;function t9(e){t5=e}function t3(){return t5}e.s(["getErrorMap",()=>t3,"setErrorMap",()=>t9],57655);let t8=e=>{let{data:t,path:r,errorMaps:a,issueData:n}=e,i=[...r,...n.path||[]],s={...n,path:i};if(void 0!==n.message)return{...n,path:i,message:n.message};let o="";for(let e of a.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...n,path:i,message:o}},t7=[];function re(e,t){let r=t5,a=t8({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===t6?void 0:t6].filter(e=>!!e)});e.common.issues.push(a)}class rt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return rr;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return rt.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:n}=a;if("aborted"===t.status||"aborted"===n.status)return rr;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==n.value||a.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}let rr=Object.freeze({status:"aborted"}),ra=e=>({status:"dirty",value:e}),rn=e=>
3({status:"valid",value:e}),ri=e=>"aborted"===e.status,rs=e=>"dirty"===e.status,ro=e=>"valid"===e.status,rl=e=>"undefined"!=typeof Promise&&e instanceof Promise;e.s(["DIRTY",0,ra,"EMPTY_PATH",0,t7,"INVALID",0,rr,"OK",0,rn,"ParseStatus",()=>rt,"addIssueToContext",()=>re,"isAborted",0,ri,"isAsync",0,rl,"isDirty",0,rs,"isValid",0,ro,"makeIssue",0,t8],89495),e.s([],69657),(a=E||(E={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},a.toString=e=>"string"==typeof e?e:e?.message;class ru{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let rd=(e,t)=>{if(ro(t))return{success:!0,data:t.value};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 t=new t4(e.common.issues);return this._error=t,this._error}}};function rc(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:n}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{let{message:i}=e;return"invalid_enum_value"===t.code?{message:i??n.defaultError}:void 0===n.data?{message:i??a??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:i??r??n.defaultError}},description:n}}class rp{get description(){return this._def.description}_getType(e){return t0(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:t0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rt,ctx:{common:e.parent.common,data:e.data,parsedType:t0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(rl(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}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:t0(e)},a=this._parseSync({data:e,path:r.path,parent:r});return rd(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:t0(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return ro(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>ro(e)?{value:e.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:t0(e)},a=this._parse({data:e,path:r.path,parent:r});return rd(r,await (rl(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let n=e(r),i=()=>a.addIssue({code:t1.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(i(),!1)):!!n||(i(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new r9({schema:this,typeName:k.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:e=>this["~validate"](e)}}optional(){return r3.create(this,this._def)}nullable(){return r8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rz.create(this)}promise(){return r5.create(this,this._def)}or(e){return rW.create([this,e],this._def)}and(e){return rK.create(this,e,this._def)}transform(e){return new r9({...rc(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new r7({...rc(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:k.ZodDefault})}brand(){return new aa({typeName:k.ZodBranded,type:this,...rc(this._def)})}catch(e){return new ae({...rc(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:k.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return an.create(this,e)}readonly(){return ai.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let rf=/^c[^\s-]{8,}
vendor: 26,545 bytes, line 3
3$/i,rh=/^[0-9a-z]+$/,rm=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rg=/^[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,ry=/^[a-z0-9_-]{21}$/i,rv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,r_=/^[-+]?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)?)??$/,rb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rw=/^(?:(?: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])$/,rx=/^(?:(?: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])$/,rE=/^(([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]))$/,rk=/^(([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])$/,rZ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rS="((\\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])))",rT=RegExp(`^${rS}$`);function rA(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function rO(e){let t=`${rS}T${rA(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class rC extends rp{_parse(e){var r,a,n,i;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==tQ.string){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.string,received:t.parsedType}),rr}let o=new rt;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(re(s=this._getOrReturnCtx(e,s),{code:t1.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)e.data.length>l.value&&(re(s=this._getOrReturnCtx(e,s),{code:t1.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let t=e.data.length>l.value,r=e.data.length<l.value;(t||r)&&(s=this._getOrReturnCtx(e,s),t?re(s,{code:t1.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&re(s,{code:t1.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)rb.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"email",code:t1.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)t||(t=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),t.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:t1.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)rg.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:t1.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)ry.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:t1.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)rf.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:t1.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)rh.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:t1.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)rm.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:t1.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{re(s=this._getOrReturnCtx(e,s),{validation:"url",code:t1.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"regex",code:t1.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(re(s=this._getOrReturnCtx(e,s),{code:t1.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?e.data=e.data.toLowerCase():"toUpperCase"===l.kind?e.data=e.data.toUpperCase():"startsWith"===l.kind?e.data.startsWith(l.value)||(re(s=this._getOrReturnCtx(e,s),{code:t1.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(re(s=this._getOrReturnCtx(e,s),{code:t1.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?rO(l).test(e.data)||(re(s=this._getOrReturnCtx(e,s),{code:t1.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?rT.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{code:t1.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${rA(l)}$`).test(e.data)||(re(s=this._getOrReturnCtx(e,s),{code:t1.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?r_.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"duration",code:t1.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(r=e.data,!(("v4"===(a=l.version)||!a)&&rw.test(r)||("v6"===a||!a)&&rE.test(r))&&1&&(re(s=this._getOrReturnCtx(e,s),{validation:"ip",code:t1.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!rv.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(a));if("object"!=typeof n||null===n||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(re(s=this._getOrReturnCtx(e,s),{validation:"jwt",code:t1.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(n=e.data,!(("v4"===(i=l.version)||!i)&&rx.test(n)||("v6"===i||!i)&&rk.test(n))&&1&&(re(s=this._getOrReturnCtx(e,s),{validation:"cidr",code:t1.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?rZ.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"base64",code:t1.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?rI.test(e.data)||(re(s=this._getOrReturnCtx(e,s),{validation:"base64url",code:t1.invalid_string,message:l.message}),o.dirty()):w.assertNever(l);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:t1.invalid_string,...E.errToObj(r)})}_addCheck(e){return new rC({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...E.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...E.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new rC({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new rC({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new rC({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}rC.create=e=>new rC({checks:[],typeName:k.ZodString,coerce:e?.coerce??!1,...rc(e)});class rR extends rp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==tQ.number){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.number,received:t.parsedType}),rr}let r=new rt;for(let a of this._def.checks)"int"===a.kind?w.isInteger(e.data)||(re(t=this._getOrReturnCtx(e,t),{code:t1.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(re(t=this._getOrReturnCtx(e,t),{code:t1.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(re(t=this._getOrReturnCtx(e,t),{code:t1.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=r>a?r:a;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}(e.data,a.value)&&(re(t=this._getOrReturnCtx(e,t),{code:t1.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(re(t=this._getOrReturnCtx(e,t),{code:t1.not_finite,message:a.message}),r.dirty()):w.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new rR({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(a)}]})}_addCheck(e){return new rR({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&w.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}rR.create=e=>new rR({checks:[],typeName:k.ZodNumber,coerce:e?.coerce||!1,...rc(e)});class r$ extends rp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==tQ.bigint)return this._getInvalidInput(e);let r=new rt;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(re(t=this._getOrReturnCtx(e,t),{code:t1.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(re(t=this._getOrReturnCtx(e,t),{code:t1.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(re(t=this._getOrReturnCtx(e,t),{code:t1.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):w.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.bigint,received:t.parsedType}),rr}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new r$({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(a)}]})}_addCheck(e){return new r$({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}r$.create=e=>new r$({checks:[],typeName:k.ZodBigInt,coerce:e?.coerce??!1,...rc(e)});class rN extends rp{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==tQ.boolean){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.boolean,received:t.parsedType}),rr}return rn(e.data)}}rN.create=e=>new rN({typeName:k.ZodBoolean,coerce:e?.coerce||!1,...rc(e)});class rj extends rp{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==tQ.date){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.date,received:t.parsedType}),rr}if(Number.isNaN(e.data.getTime()))return re(this._getOrReturnCtx(e),{code:t1.invalid_date}),rr;let r=new rt;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(re(t=this._getOrReturnCtx(e,t),{code:t1.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(re(t=this._getOrReturnCtx(e,t),{code:t1.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):w.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rj({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}rj.create=e=>new rj({checks:[],coerce:e?.coerce||!1,typeName:k.ZodDate,...rc(e)});class rP extends rp{_parse(e){if(this._getType(e)!==tQ.symbol){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.symbol,received:t.parsedType}),rr}return rn(e.data)}}rP.create=e=>new rP({typeName:k.ZodSymbol,...rc(e)});class rM extends rp{_parse(e){if(this._getType(e)!==tQ.undefined){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.undefined,received:t.parsedType}),rr}return rn(e.data)}}rM.create=e=>new rM({typeName:k.ZodUndefined,...rc(e)});class rL extends rp{_parse(e){if(this._getType(e)!==tQ.null){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.null,received:t.parsedType}),rr}return rn(e.data)}}rL.create=e=>new rL({typeName:k.ZodNull,...rc(e)});class rD extends rp{constructor(){super(...arguments),this._any=!0}_parse(e){return rn(e.data)}}rD.create=e=>new rD({typeName:k.ZodAny,...rc(e)});class rU extends rp{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rn(e.data)}}rU.create=e=>new rU({typeName:k.ZodUnknown,...rc(e)});class rB extends rp{_parse(e){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.never,received:t.parsedType}),rr}}rB.create=e=>new rB({typeName:k.ZodNever,...rc(e)});class rF extends rp{_parse(e){if(this._getType(e)!==tQ.undefined){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.void,received:t.parsedType}),rr}return rn(e.data)}}rF.create=e=>new rF({typeName:k.ZodVoid,...rc(e)});class rz extends rp{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==tQ.array)return re(t,{code:t1.invalid_type,expected:tQ.array,received:t.parsedType}),rr;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(re(t,{code:e?t1.too_big:t1.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(re(t,{code:t1.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(re(t,{code:t1.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new ru(t,e,t.path,r)))).then(e=>rt.mergeArray(r,e));let n=[...t.data].map((e,r)=>a.type._parseSync(new ru(t,e,t.path,r)));return rt.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new rz({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new rz({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new rz({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}rz.create=(e,t)=>new rz({type:e,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...rc(t)});class rV extends rp{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=w.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==tQ.object){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.object,received:t.parsedType}),rr}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),i=[];if(!(this._def.catchall instanceof rB&&"strip"===this._def.unknownKeys))for(let e in r.data)n.includes(e)||i.push(e);let s=[];for(let e of n){let t=a[e],n=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new ru(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof rB){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of i)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(re(r,{code:t1.unrecognized_keys,keys:i}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of i){let a=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new ru(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>rt.mergeObjectSync(t,e)):rt.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new rV({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:E.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new rV({...this._def,unknownKeys:"strip"})}passthrough(){return new rV({...this._def,unknownKeys:"passthrough"})}extend(e){return new rV({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new rV({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new rV({...this._def,catchall:e})}pick(e){let t={};for(let r of w.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new rV({...this._def,shape:()=>t})}omit(e){let t={};for(let r of w.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new rV({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof rV){let r={};for(let a in t.shape){let n=t.shape[a];r[a]=r3.create(e(n))}return new rV({...t._def,shape:()=>r})}if(t instanceof rz)return new rz({...t._def,type:e(t.element)});if(t instanceof r3)return r3.create(e(t.unwrap()));if(t instanceof r8)return r8.create(e(t.unwrap()));if(t instanceof rG)return rG.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of w.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new rV({...this._def,shape:()=>t})}required(e){let t={};for(let r of w.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof r3;)e=e._def.innerType;t[r]=e}return new rV({...this._def,shape:()=>t})}keyof(){return r2(w.objectKeys(this.shape))}}rV.create=(e,t)=>new rV({shape:()=>e,unknownKeys:"strip",catchall:rB.create(),typeName:k.ZodObject,...rc(t)}),rV.strictCreate=(e,t)=>new rV({shape:()=>e,unknownKeys:"strict",catchall:rB.create(),typeName:k.ZodObject,...rc(t)}),rV.lazycreate=(e,t)=>new rV({shape:e,unknownKeys:"strip",catchall:rB.create(),typeName:k.ZodObject,...rc(t)});class rW extends rp{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new t4(e.ctx.common.issues));return re(t,{code:t1.invalid_union,unionErrors:r}),rr});{let e,a=[];for(let n of r){let r={...t,common:{...t.common,issues:[]},parent:null},i=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let n=a.map(e=>new t4(e));return re(t,{code:t1.invalid_union,unionErrors:n}),rr}}
3get options(){return this._def.options}}rW.create=(e,t)=>new rW({options:e,typeName:k.ZodUnion,...rc(t)});let rq=e=>{if(e instanceof r0)return rq(e.schema);if(e instanceof r9)return rq(e.innerType());if(e instanceof r1)return[e.value];if(e instanceof r4)return e.options;if(e instanceof r6)return w.objectValues(e.enum);else if(e instanceof r7)return rq(e._def.innerType);else if(e instanceof rM)return[void 0];else if(e instanceof rL)return[null];else if(e instanceof r3)return[void 0,...rq(e.unwrap())];else if(e instanceof r8)return[null,...rq(e.unwrap())];else if(e instanceof aa)return rq(e.unwrap());else if(e instanceof ai)return rq(e.unwrap());else if(e instanceof ae)return rq(e._def.innerType);else return[]};class rJ extends rp{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tQ.object)return re(t,{code:t1.invalid_type,expected:tQ.object,received:t.parsedType}),rr;let r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(re(t,{code:t1.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),rr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=rq(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let n of t){if(a.has(n))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,r)}}return new rJ({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...rc(r)})}}class rK extends rp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(ri(e)||ri(a))return rr;let n=function e(t,r){let a=t0(t),n=t0(r);if(t===r)return{valid:!0,data:t};if(a===tQ.object&&n===tQ.object){let a=w.objectKeys(r),n=w.objectKeys(t).filter(e=>-1!==a.indexOf(e)),i={...t,...r};for(let a of n){let n=e(t[a],r[a]);if(!n.valid)return{valid:!1};i[a]=n.data}return{valid:!0,data:i}}if(a===tQ.array&&n===tQ.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let n=0;n<t.length;n++){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a.push(i.data)}return{valid:!0,data:a}}if(a===tQ.date&&n===tQ.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,a.value);return n.valid?((rs(e)||rs(a))&&t.dirty(),{status:t.value,value:n.data}):(re(r,{code:t1.invalid_intersection_types}),rr)};return r.common.async?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(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}rK.create=(e,t,r)=>new rK({left:e,right:t,typeName:k.ZodIntersection,...rc(r)});class rG extends rp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tQ.array)return re(r,{code:t1.invalid_type,expected:tQ.array,received:r.parsedType}),rr;if(r.data.length<this._def.items.length)return re(r,{code:t1.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),rr;!this._def.rest&&r.data.length>this._def.items.length&&(re(r,{code:t1.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new ru(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>rt.mergeArray(t,e)):rt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new rG({...this._def,rest:e})}}rG.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new rG({items:e,typeName:k.ZodTuple,rest:null,...rc(t)})};class rY extends rp{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!==tQ.object)return re(r,{code:t1.invalid_type,expected:tQ.object,received:r.parsedType}),rr;let a=[],n=this._def.keyType,i=this._def.valueType;for(let e in r.data)a.push({key:n._parse(new ru(r,e,r.path,e)),value:i._parse(new ru(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?rt.mergeObjectAsync(t,a):rt.mergeObjectSync(t,a)}
3get element(){return this._def.valueType}static create(e,t,r){return new rY(t instanceof rp?{keyType:e,valueType:t,typeName:k.ZodRecord,...rc(r)}:{keyType:rC.create(),valueType:e,typeName:k.ZodRecord,...rc(t)})}}class rH extends rp{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!==tQ.map)return re(r,{code:t1.invalid_type,expected:tQ.map,received:r.parsedType}),rr;let a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new ru(r,e,r.path,[i,"key"])),value:n._parse(new ru(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of i){let a=await r.key,n=await r.value;if("aborted"===a.status||"aborted"===n.status)return rr;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of i){let a=r.key,n=r.value;if("aborted"===a.status||"aborted"===n.status)return rr;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}rH.create=(e,t,r)=>new rH({valueType:t,keyType:e,typeName:k.ZodMap,...rc(r)});class rX extends rp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tQ.set)return re(r,{code:t1.invalid_type,expected:tQ.set,received:r.parsedType}),rr;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(re(r,{code:t1.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(re(r,{code:t1.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let n=this._def.valueType;function i(e){let r=new Set;for(let a of e){if("aborted"===a.status)return rr;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>n._parse(new ru(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>i(e)):i(s)}min(e,t){return new rX({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new rX({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}rX.create=(e,t)=>new rX({valueType:e,minSize:null,maxSize:null,typeName:k.ZodSet,...rc(t)});class rQ extends rp{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tQ.function)return re(t,{code:t1.invalid_type,expected:tQ.function,received:t.parsedType}),rr;function r(e,r){return t8({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,t5,t6].filter(e=>!!e),issueData:{code:t1.invalid_arguments,argumentsError:r}})}function a(e,r){return t8({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,t5,t6].filter(e=>!!e),issueData:{code:t1.invalid_return_type,returnTypeError:r}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof r5){let e=this;return rn(async function(...t){let s=new t4([]),o=await e._def.args.parseAsync(t,n).catch(e=>{throw s.addIssue(r(t,e)),s}),l=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(l,n).catch(e=>{throw s.addIssue(a(l,e)),s})})}{let e=this;return rn(function(...t){let s=e._def.args.safeParse(t,n);if(!s.success)throw new t4([r(t,s.error)]);let o=Reflect.apply(i,this,s.data),l=e._def.returns.safeParse(o,n);if(!l.success)throw new t4([a(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new rQ({...this._def,args:rG.create(e).rest(rU.create())})}returns(e){return new rQ({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new rQ({args:e||rG.create([]).rest(rU.create()),returns:t||rU.create(),typeName:k.ZodFunction,...rc(r)})}}class r0 extends rp{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})}}r0.create=(e,t)=>
3new r0({getter:e,typeName:k.ZodLazy,...rc(t)});class r1 extends rp{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return re(t,{received:t.data,code:t1.invalid_literal,expected:this._def.value}),rr}return{status:"valid",value:e.data}}get value(){return this._def.value}}function r2(e,t){return new r4({values:e,typeName:k.ZodEnum,...rc(t)})}r1.create=(e,t)=>new r1({value:e,typeName:k.ZodLiteral,...rc(t)});class r4 extends rp{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return re(t,{expected:w.joinValues(r),received:t.parsedType,code:t1.invalid_type}),rr}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return re(t,{received:t.data,code:t1.invalid_enum_value,options:r}),rr}return rn(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 r4.create(e,{...this._def,...t})}exclude(e,t=this._def){return r4.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}r4.create=r2;class r6 extends rp{_parse(e){let t=w.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==tQ.string&&r.parsedType!==tQ.number){let e=w.objectValues(t);return re(r,{expected:w.joinValues(e),received:r.parsedType,code:t1.invalid_type}),rr}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=w.objectValues(t);return re(r,{received:r.data,code:t1.invalid_enum_value,options:e}),rr}return rn(e.data)}get enum(){return this._def.values}}r6.create=(e,t)=>new r6({values:e,typeName:k.ZodNativeEnum,...rc(t)});class r5 extends rp{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==tQ.promise&&!1===t.common.async?(re(t,{code:t1.invalid_type,expected:tQ.promise,received:t.parsedType}),rr):rn((t.parsedType===tQ.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}r5.create=(e,t)=>new r5({type:e,typeName:k.ZodPromise,...rc(t)});class r9 extends rp{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{re(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){let e=a.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return rr;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?rr:"dirty"===a.status||"dirty"===t.value?ra(a.value):a});{if("aborted"===t.value)return rr;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?rr:"dirty"===a.status||"dirty"===t.value?ra(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?rr:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?rr:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>ro(e)?Promise.resolve(a.transform(e.value,n)).then(e=>({status:t.value,value:e})):rr);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ro(e))return rr;let i=a.transform(e.value,n);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}w.assertNever(a)}}r9.create=(e,t,r)=>new r9({schema:e,typeName:k.ZodEffects,effect:t,...rc(r)}),r9.createWithPreprocess=(e,t,r)=>new r9({schema:t,effect:{type:"preprocess",transform:e},typeName:k.ZodEffects,...rc(r)});class r3 extends rp{_parse(e){return this._getType(e)===tQ.undefined?rn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}r3.create=(e,t)=>
3new r3({innerType:e,typeName:k.ZodOptional,...rc(t)});class r8 extends rp{_parse(e){return this._getType(e)===tQ.null?rn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}r8.create=(e,t)=>new r8({innerType:e,typeName:k.ZodNullable,...rc(t)});class r7 extends rp{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===tQ.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}r7.create=(e,t)=>new r7({innerType:e,typeName:k.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...rc(t)});class ae extends rp{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return rl(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new t4(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new t4(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ae.create=(e,t)=>new ae({innerType:e,typeName:k.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...rc(t)});class at extends rp{_parse(e){if(this._getType(e)!==tQ.nan){let t=this._getOrReturnCtx(e);return re(t,{code:t1.invalid_type,expected:tQ.nan,received:t.parsedType}),rr}return{status:"valid",value:e.data}}}at.create=e=>new at({typeName:k.ZodNaN,...rc(e)});let ar=Symbol("zod_brand");class aa extends rp{_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 an extends rp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?rr:"dirty"===e.status?(t.dirty(),ra(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?rr:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new an({in:e,out:t,typeName:k.ZodPipeline})}}class ai extends rp{_parse(e){let t=this._def.innerType._parse(e),r=e=>(ro(e)&&(e.value=Object.freeze(e.value)),e);return rl(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function as(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function ao(e,t={},r){return e?rD.create().superRefine((a,n)=>{let i=e(a);if(i instanceof Promise)return i.then(e=>{if(!e){let e=as(t,a),i=e.fatal??r??!0;n.addIssue({code:"custom",...e,fatal:i})}});if(!i){let e=as(t,a),i=e.fatal??r??!0;n.addIssue({code:"custom",...e,fatal:i})}}):rD.create()}ai.create=(e,t)=>new ai({innerType:e,typeName:k.ZodReadonly,...rc(t)});let al={object:rV.lazycreate};(n=k||(k={})).ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",
3n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly";let au=(e,t={message:`Input not instance of ${e.name}`})=>ao(t=>t instanceof e,t),ad=rC.create,ac=rR.create,ap=at.create,af=r$.create,ah=rN.create,am=rj.create,ag=rP.create,ay=rM.create,av=rL.create,a_=rD.create,ab=rU.create,aw=rB.create,ax=rF.create,aE=rz.create,ak=rV.create,aZ=rV.strictCreate,aI=rW.create,aS=rJ.create,aT=rK.create,aA=rG.create,aO=rY.create,aC=rH.create,aR=rX.create,a$=rQ.create,aN=r0.create,aj=r1.create,aP=r4.create,aM=r6.create,aL=r5.create,aD=r9.create,aU=r3.create,aB=r8.create,aF=r9.createWithPreprocess,az=an.create,aV=()=>ad().optional(),aW=()=>ac().optional(),aq=()=>ah().optional(),aJ={string:e=>rC.create({...e,coerce:!0}),number:e=>rR.create({...e,coerce:!0}),boolean:e=>rN.create({...e,coerce:!0}),bigint:e=>r$.create({...e,coerce:!0}),date:e=>rj.create({...e,coerce:!0})};e.s(["BRAND",0,ar,"NEVER",0,rr,"Schema",()=>rp,"ZodAny",()=>rD,"ZodArray",()=>rz,"ZodBigInt",()=>r$,"ZodBoolean",()=>rN,"ZodBranded",()=>aa,"ZodCatch",()=>ae,"ZodDate",()=>rj,"ZodDefault",()=>r7,"ZodDiscriminatedUnion",()=>rJ,"ZodEffects",()=>r9,"ZodEnum",()=>r4,"ZodFirstPartyTypeKind",()=>k,"ZodFunction",()=>rQ,"ZodIntersection",()=>rK,"ZodLazy",()=>r0,"ZodLiteral",()=>r1,"ZodMap",()=>rH,"ZodNaN",()=>at,"ZodNativeEnum",()=>r6,"ZodNever",()=>rB,"ZodNull",()=>rL,"ZodNullable",()=>r8,"ZodNumber",()=>rR,"ZodObject",()=>rV,"ZodOptional",()=>r3,"ZodPipeline",()=>an,"ZodPromise",()=>r5,"ZodReadonly",()=>ai,"ZodRecord",()=>rY,"ZodSchema",()=>rp,"ZodSet",()=>rX,"ZodString",()=>rC,"ZodSymbol",()=>rP,"ZodTransformer",()=>r9,"ZodTuple",()=>rG,"ZodType",()=>rp,"ZodUndefined",()=>rM,"ZodUnion",()=>rW,"ZodUnknown",()=>rU,"ZodVoid",()=>rF,"any",()=>a_,"array",()=>aE,"bigint",()=>af,"boolean",()=>ah,"coerce",0,aJ,"custom",()=>ao,"date",()=>am,"datetimeRegex",()=>rO,"discriminatedUnion",()=>aS,"effect",()=>aD,"enum",()=>aP,"function",()=>a$,"instanceof",()=>au,"intersection",()=>aT,"late",0,al,"lazy",()=>aN,"literal",()=>aj,"map",()=>aC,"nan",()=>ap,"nativeEnum",()=>aM,"never",()=>aw,"null",()=>av,"nullable",()=>aB,"number",()=>ac,"object",()=>ak,"oboolean",()=>aq,"onumber",()=>aW,"optional",()=>aU,"ostring",()=>aV,"pipeline",()=>az,"preprocess",()=>aF,"promise",()=>aL,"record",()=>aO,"set",()=>aR,"strictObject",()=>aZ,"string",()=>ad,"symbol",()=>ag,"transformer",()=>aD,"tuple",()=>aA,"undefined",()=>ay,"union",()=>aI,"unknown",()=>ab,"void",()=>ax],12124),e.s([],56803),e.i(56803),e.i(57655),e.s(["defaultErrorMap",0,t6,"getErrorMap",()=>t3,"setErrorMap",()=>t9],3156),e.i(3156),e.i(89495),e.i(69657),e.i(77453),e.i(12124),e.i(39216),e.s(["BRAND",0,ar,"DIRTY",0,ra,"EMPTY_PATH",0,t7,"INVALID",0,rr,"NEVER",0,rr,"OK",0,rn,"ParseStatus",()=>rt,"Schema",()=>rp,"ZodAny",()=>rD,"ZodArray",()=>rz,"ZodBigInt",()=>r$,"ZodBoolean",()=>rN,"ZodBranded",()=>aa,"ZodCatch",()=>ae,"ZodDate",()=>rj,"ZodDefault",()=>r7,"ZodDiscriminatedUnion",()=>rJ,"ZodEffects",()=>r9,"ZodEnum",()=>r4,"ZodError",()=>t4,"ZodFirstPartyTypeKind",()=>k,"ZodFunction",()=>rQ,"ZodIntersection",()=>rK,"ZodIssueCode",0,t1,"ZodLazy",()=>r0,"ZodLiteral",()=>r1,"ZodMap",()=>rH,"ZodNaN",()=>at,"ZodNativeEnum",()=>r6,"ZodNever",()=>rB,"ZodNull",()=>rL,"ZodNullable",()=>r8,"ZodNumber",()=>rR,"ZodObject",()=>rV,"ZodOptional",()=>r3,"ZodParsedType",0,tQ,"ZodPipeline",()=>an,"ZodPromise",()=>r5,"ZodReadonly",()=>ai,"ZodRecord",()=>rY,"ZodSchema",()=>rp,"ZodSet",()=>rX,"ZodString",()=>rC,"ZodSymbol",()=>rP,"ZodTransformer",()=>r9,"ZodTuple",()=>rG,"ZodType",()=>rp,"ZodUndefined",()=>rM,"ZodUnion",()=>rW,"ZodUnknown",()=>rU,"ZodVoid",()=>rF,"addIssueToContext",()=>re,"any",()=>a_,"array",()=>aE,"bigint",()=>af,"boolean",()=>ah,"coerce",0,aJ,"custom",()=>ao,"date",()=>am,"datetimeRegex",()=>rO,"defaultErrorMap",0,t6,"discriminatedUnion",()=>aS,"effect",()=>
3aD,"enum",()=>aP,"function",()=>a$,"getErrorMap",()=>t3,"getParsedType",0,t0,"instanceof",()=>au,"intersection",()=>aT,"isAborted",0,ri,"isAsync",0,rl,"isDirty",0,rs,"isValid",0,ro,"late",0,al,"lazy",()=>aN,"literal",()=>aj,"makeIssue",0,t8,"map",()=>aC,"nan",()=>ap,"nativeEnum",()=>aM,"never",()=>aw,"null",()=>av,"nullable",()=>aB,"number",()=>ac,"object",()=>ak,"objectUtil",()=>x,"oboolean",()=>aq,"onumber",()=>aW,"optional",()=>aU,"ostring",()=>aV,"pipeline",()=>az,"preprocess",()=>aF,"promise",()=>aL,"quotelessJson",0,t2,"record",()=>aO,"set",()=>aR,"setErrorMap",()=>t9,"strictObject",()=>aZ,"string",()=>ad,"symbol",()=>ag,"transformer",()=>aD,"tuple",()=>aA,"undefined",()=>ay,"union",()=>aI,"unknown",()=>ab,"util",()=>w,"void",()=>ax],350),e.i(350);class aK extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function aG(e){}class aY extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let a;super({start(n){a=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=aG,onError:r=aG,onRetry:a=aG,onComment:n}=e,i="",s=!0,o,l="",u="";function d(e){if(""===e)return void(l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(` 4`)?l.slice(0,-1):l}),o=void 0,l="",u="");if(e.startsWith(":")){n&&n(e.slice(e.startsWith(": ")?2:1));return}let r=e.indexOf(":");if(-1!==r){let t=e.slice(0,r),a=" "===e[r+1]?2:1;c(t,e.slice(r+a),e);return}c(e,"",e)}function c(e,t,n){switch(e){case"event":u=t;break;case"data":l=`${l}${t} 5`;break;case"id":o=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?a(parseInt(t,10)):r(new aK(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:n}));break;default:r(new aK(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:n}))}}return{feed:function(e){let t=s?e.replace(/^\xEF\xBB\xBF/,""):e,[r,a]=function(e){let t=[],r="",a=0;for(;a<e.length;){let n=e.indexOf("\r",a),i=e.indexOf(` 6`,a),s=-1;
6if(-1!==n&&-1!==i?s=Math.min(n,i):-1!==n?s=n===e.length-1?-1:n:-1!==i&&(s=i),-1===s){r=e.slice(a);break}{let r=e.slice(a,s);t.push(r),"\r"===e[(a=s+1)-1]&&e[a]===` 7`&&a++}}return[t,r]}(`${i}${t}`);for(let e of r)d(e);i=a,s=!1},reset:function(e={}){i&&e.consume&&d(i),s=!0,o=void 0,l="",u="",i=""}}}({onEvent:e=>{n.enqueue(e)},onError(t){"terminate"===e?n.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){a.feed(e)}})}}function aH(...e){return e.reduce((e,t)=>({...e,...null!=t?t:{}}),{})}function aX(e){return Object.fromEntries([...e.headers])}var{btoa:aQ,atob:a0}=globalThis,a1=Symbol.for("vercel.ai.error.AI_DownloadError"),a2=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{let n=()=>{let e=r.length,a=Array(t);for(let n=0;n<t;n++)a[n]=r[Math.random()*e|0];return a.join("")};if(null==e)return n;if(r.includes(a))throw new ey({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${r}".`});return()=>`${e}${a}${n()}`},a4=a2();function a6(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}var a5=["fetch failed","failed to fetch"];function a9({error:e,url:t,requestBodyValues:r}){if(a6(e))return e;if(e instanceof TypeError&&a5.includes(e.message.toLowerCase())){let a=e.cause;if(null!=a)return new el({message:`Cannot connect to API: ${a.message}`,cause:a,url:t,requestBodyValues:r,isRetryable:!0})}return e}function a3(e=globalThis){var t,r,a;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(a=null==(r=e.process)?void 0:r.versions)?void 0:a.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function a8(e){if(null==e)return{};let t={};if(e instanceof Headers)e.forEach((e,r)=>{t[r.toLowerCase()]=e});else for(let[r,a]of(Array.isArray(e)||(e=Object.entries(e)),e))null!=a&&(t[r.toLowerCase()]=a);return t}function a7(e,...t){let r=new Headers(a8(e)),a=r.get("user-agent")||"";return r.set("user-agent",[a,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var ne="4.0.2",nt=()=>globalThis.fetch,nr=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:a,abortSignal:n,fetch:i=nt()})=>{try{let s=await i(e,{method:"GET",headers:a7(t,`ai-sdk/provider-utils/${ne}`,a3()),signal:n}),o=aX(s);if(!s.ok){let t;try{t=await a({response:s,url:e,requestBodyValues:{}})}catch(t){if(a6(t)||el.isInstance(t))throw t;throw new el({message:"Failed to process error response",cause:t,statusCode:s.status,url:e,responseHeaders:o,requestBodyValues:{}})}throw t.value}try{return await r({response:s,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(a6(t)||el.isInstance(t)))throw t;throw new el({message:"Failed to process successful response",cause:t,statusCode:s.status,url:e,responseHeaders:o,requestBodyValues:{}})}}catch(t){throw a9({error:t,url:e,requestBodyValues:{}})}};function na({settingValue:e,environmentVariableName:t}){return"string"==typeof e?e:null!=e||void 0===ee.default?void 0:null!=(e=ee.default.env[t])&&"string"==typeof e?e:void 0}var nn=/"__proto__"\s*:/,ni=/"constructor"\s*:/;function ns(e){let t=JSON.parse(e);return null===t||"object"!=typeof t||!1===nn.test(e)&&!1===ni.test(e)?t:function(e){let t=[e];for(;t.length;){let e=t;for(let r of(t=[],e)){if(Object.prototype.hasOwnProperty.call(r,"__proto__")||Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let e in r){let a=r[e];a&&"object"==typeof a&&t.push(a)}}}return e}(t)}function no(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return ns(e)}try{return ns(e)}finally{Error.stackTraceLimit=t}}var nl=Symbol("Let zodToJsonSchema decide on which parser to use"),nu={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};
7function nd(e,t){return nC(e.type._def,t)}var nc=void 0,np=/^[cC][^\s-]{8,}$/,nf=/^[0-9a-z]+$/,nh=/^[0-9A-HJKMNP-TV-Z]{26}$/,nm=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ng=()=>(void 0===nc&&(nc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nc),ny=/^(?:(?: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])$/,nv=/^(([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])$/,n_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nw=/^[a-zA-Z0-9_-]{21}$/,nx=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function nE(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":nI(r,"email",a.message,t);break;case"format:idn-email":nI(r,"idn-email",a.message,t);break;case"pattern:zod":nS(r,nm,a.message,t)}break;case"url":nI(r,"uri",a.message,t);break;case"uuid":nI(r,"uuid",a.message,t);break;case"regex":nS(r,a.regex,a.message,t);break;case"cuid":nS(r,np,a.message,t);break;case"cuid2":nS(r,nf,a.message,t);break;case"startsWith":nS(r,RegExp(`^${nk(a.value,t)}`),a.message,t);break;case"endsWith":nS(r,RegExp(`${nk(a.value,t)}$`),a.message,t);break;case"datetime":nI(r,"date-time",a.message,t);break;case"date":nI(r,"date",a.message,t);break;case"time":nI(r,"time",a.message,t);break;case"duration":nI(r,"duration",a.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"includes":nS(r,RegExp(nk(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&nI(r,"ipv4",a.message,t),"v4"!==a.version&&nI(r,"ipv6",a.message,t);break;case"base64url":nS(r,nb,a.message,t);break;case"jwt":nS(r,nx,a.message,t);break;case"cidr":"v6"!==a.version&&nS(r,ny,a.message,t),"v4"!==a.version&&nS(r,nv,a.message,t);break;case"emoji":nS(r,ng(),a.message,t);break;case"ulid":nS(r,nh,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":nI(r,"binary",a.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":nS(r,n_,a.message,t)}break;case"nanoid":nS(r,nw,a.message,t)}return r}function nk(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)nZ.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var nZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function nI(e,t,r,a){var n;e.format||(null==(n=e.anyOf)?void 0:n.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function nS(e,t,r,a){var n;e.pattern||(null==(n=e.allOf)?void 0:n.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:nT(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=nT(t,a)}function nT(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;let a={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=a.i?e.source.toLowerCase():e.source,i="",s=!1,o=!1,l=!1;for(let e=0;e<n.length;e++){if(s){i+=n[e],s=!1;continue}if(a.i){if(o){if(n[e].match(/[a-z]/)){l?(i+=n[e],i+=`${n[e-2]}-${n[e]}`.toUpperCase(),l=!1):"-"===n[e+1]&&(null==(r=n[e+2])?void 0:r.match(/[a-z]/))?(i+=n[e],l=!0):i+=`${n[e]}${n[e].toUpperCase()}`;continue}}else if(n[e].match(/[a-z]/)){i+=`[${n[e]}${n[e].toUpperCase()}]`;continue}}if(a.m){if("^"===n[e]){i+=`(^|(?<=[\r 8]))`;continue}else if("$"===n[e]){i+=`($|(?=[\r 9]))`;continue}}if(a.s&&"."===n[e]){i+=o?`${n[e]}\r 10`:`[${n[e]}\r 11]`;continue}i+=n[e],"\\"===n[e]?s=!0:o&&"]"===n[e]?o=!1:o||"["!==n[e]||(o=!0)}try{new RegExp(i)}catch(r){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 i}function nA(e,t){var r,a,n,i,s,o;let l={type:"object",additionalProperties:null!=(r=nC(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(a=e.keyType)?void 0:a._def.typeName)===k.ZodString&&(null==(n=e.keyType._def.checks)?void 0:n.length)){let{type:r,...a}=nE(e.keyType._def,t);return{...l,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===k.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(s=e.keyType)?void 0:s._def.typeName)===k.ZodBranded&&e.keyType._def.type._def.typeName===k.ZodString&&(null==(o=e.keyType._def.type._def.checks)?void 0:o.length)){let{type:r,...a}=nd(e.keyType._def,t);return{...l,propertyNames:a}}return l}var nO={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function nC(e,t,r=!1){var a;let n=t.seen.get(e);if(t.override){let i=null==(a=t.override)?void 0:a.call(t,e,t,n,r);if(i!==nl)return i}if(n&&!r){let e=nR(n,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let s=((e,t,r)=>{var a,n,i,s,o,l;switch(t){case k.ZodString:return nE(e,r);case k.ZodNumber:let u={type:"number"};if(!e.checks)return u;for(let t of e.checks)switch(t.kind){case"int":u.type="integer";break;case"min":t.inclusive?u.minimum=t.value:u.exclusiveMinimum=t.value;break;case"max":t.inclusive?u.maximum=t.value:u.exclusiveMaximum=t.value;break;case"multipleOf":u.multipleOf=t.value}return u;case k.ZodObject:return function(e,t){let r={type:"object",properties:{}},a=[],n=e.shape();for(let e in n){let i=n[e];if(void 0===i||void 0===i._def)continue;let s=function(e){try{return e.isOptional()}catch(e){return!0}}(i),o=nC(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==o&&(r.properties[e]=o,s||a.push(e))}a.length&&(r.required=a);let i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return nC(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(r.additionalProperties=i),r}(e,r);case k.ZodBigInt:let d={type:"integer",format:"int64"};if(!e.checks)return d;for(let t of e.checks)switch(t.kind){case"min":t.inclusive?d.minimum=t.value:d.exclusiveMinimum=t.value;break;case"max":t.inclusive?d.maximum=t.value:d.exclusiveMaximum=t.value;break;case"multipleOf":d.multipleOf=t.value}return d;case k.ZodBoolean:return{type:"boolean"};case k.ZodDate:return function e(t,r,a){let n=null!=a?a:r.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,n)=>e(t,r,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var i=t;let s={type:"integer",format:"unix-time"};for(let e of i.checks)switch(e.kind){case"min":s.minimum=e.value;break;case"max":s.maximum=e.value}return s}}(e,r);case k.ZodUndefined:return{not:{}};case k.ZodNull:return{type:"null"};case k.ZodArray:let c;return c={type:"array"},(null==(i=e.type)?void 0:i._def)&&(null==(o=null==(s=e.type)?void 0:s._def)?void 0:o.typeName)!==k.ZodAny&&(c.items=nC(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&(c.minItems=e.minLength.value),e.maxLength&&(c.maxItems=e.maxLength.value),e.exactLength&&(c.minItems=e.exactLength.value,c.maxItems=e.exactLength.value),
11c;case k.ZodUnion:case k.ZodDiscriminatedUnion:let p,f=e.options instanceof Map?Array.from(e.options.values()):e.options;if(f.every(e=>e._def.typeName in nO&&(!e._def.checks||!e._def.checks.length))){let e=f.reduce((e,t)=>{let r=nO[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(f.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=f.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===f.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:f.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(f.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:f.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return a=e,n=r,(p=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((e,t)=>nC(e._def,{...n,currentPath:[...n.currentPath,"anyOf",`${t}`]})).filter(e=>!!e&&(!n.strictUnions||"object"==typeof e&&Object.keys(e).length>0))).length?{anyOf:p}:void 0;case k.ZodIntersection:let h,m;return h=[nC(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),nC(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),m=[],h.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)m.push(...e.allOf);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}m.push(t)}}),m.length?{allOf:m}:void 0;case k.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>nC(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:nC(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>nC(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case k.ZodRecord:return nA(e,r);case k.ZodLiteral:let g;return"bigint"!=(g=typeof e.value)&&"number"!==g&&"boolean"!==g&&"string"!==g?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===g?"integer":g,const:e.value};case k.ZodEnum:return{type:"string",enum:Array.from(e.values)};case k.ZodNativeEnum:let y,v,_;return y=e.values,{type:1===(_=Array.from(new Set((v=Object.keys(e.values).filter(e=>"number"!=typeof y[y[e]]).map(e=>y[e])).map(e=>typeof e)))).length?"string"===_[0]?"string":"number":["string","number"],enum:v};case k.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[nO[e.innerType._def.typeName],"null"]};let b=nC(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return b&&{anyOf:[b,{type:"null"}]};case k.ZodOptional:if(r.currentPath.toString()===(null==(l=r.propertyPath)?void 0:l.toString()))return nC(e.innerType._def,r);let w=nC(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return w?{anyOf:[{not:{}},w]}:{};case k.ZodMap:if("record"===r.mapStrategy)return nA(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[nC(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||{},nC(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}};case k.ZodSet:let x;return x={type:"array",uniqueItems:!0,items:nC(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&(x.minItems=e.minSize.value),e.maxSize&&(x.maxItems=e.maxSize.value),x;case k.ZodLazy:return()=>e.getter()._def;case k.ZodPromise:return nC(e.type._def,r);case k.ZodNaN:case k.ZodNever:return{not:{}};case k.ZodEffects:return"input"===r.effectStrategy?nC(e.schema._def,r):{};case k.ZodAny:case k.ZodUnknown:return{};case k.ZodDefault:return{...nC(e.innerType._def,r),default:e.defaultValue()};case k.ZodBranded:return nd(e,r);case k.ZodReadonly:case k.ZodCatch:return nC(e.innerType._def,r);case k.ZodPipeline:if("input"===r.pipeStrategy)return nC(e.in._def,r);if("output"===r.pipeStrategy)return nC(e.out._def,r);let E=nC(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),Z=nC(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",E?"1":"0"]});return{allOf:[E,Z].filter(e=>void 0!==e)};case k.ZodFunction:case k.ZodVoid:case k.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof s?nC(s(),t):s;if(o&&n$(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}var nR=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:((e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")})(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{};return"seen"===t.$refStrategy?{}:void 0}},n$=(e,t,r)=>(e.description&&(r.description=e.description),r),nN=Symbol.for("vercel.ai.schema");function nj(e){let t;return()=>(null==t&&(t=e()),t)}function nP(e,{validate:t}={}){return{[nN]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function nM(e){var t;return null==e?nP({properties:{},additionalProperties:!1}):"object"==typeof e&&null!==e&&nN in e&&!0===e[nN]&&"jsonSchema"in e&&"validate"in e?e:"~standard"in e?"zod"===e["~standard"].vendor?nL(e):(t=e,nP(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{let r=await t["~standard"].validate(e);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new eS({value:e,cause:r.issues})}}})):e()}function nL(e,t){var r,a;let n;if("_zod"in e){let a;return a=null!=(r=null==t?void 0:t.useReferences)&&r,nP(()=>(function e(t){if("object"===t.type){t.additionalProperties=!1;let r=t.properties;if(null!=r)for(let t in r)r[t]=e(r[t])}return"array"===t.type&&null!=t.items&&(Array.isArray(t.items)?t.items=t.items.map(t=>e(t)):t.items=e(t.items)),t})(tY.toJSONSchema(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"})),{validate:async t=>{let r=await eC.safeParseAsync(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}return n=null!=(a=null==t?void 0:t.useReferences)&&a,nP(()=>((e,t)=>{var r;let a,n,i=(n=void 0!==(a="string"==typeof t?{...nu,name:t}:{...nu,...t}).name?[...a.basePath,a.definitionPath,a.name]:a.basePath,{...a,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(a.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...a.basePath,a.definitionPath,e],jsonSchema:void 0}]))}),s="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>{var a;return{...e,[t]:null!=(a=nC(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0))?a:{}}},{}):void 0,o="string"==typeof t?t:(null==t?void 0:t.nameStrategy)==="title"||null==t?void 0:t.name,l=null!=(r=nC(e._def,void 0===o?i:{...i,currentPath:[...i.basePath,i.definitionPath,o]},!1))?r:{},u="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==u&&(l.title=u);let d=void 0===o?s?{...l,[i.definitionPath]:s}:l:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,o].join("/"),[i.definitionPath]:{...s,[o]:l}};return d.$schema="http://json-schema.org/draft-07/schema#",d})(e,{$refStrategy:n?"root":"none"}),{validate:async t=>{let r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}async function nD({value:e,schema:t}){let r=await nU({value:e,schema:t});if(!r.success)throw eS.wrap({value:e,cause:r.error});return r.value}async function nU({value:e,schema:t}){let r=nM(t);try{if(null==r.validate)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);if(t.success)return{success:!0,value:t.value,rawValue:e};return{success:!1,error:eS.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:eS.wrap({value:e,cause:t}),rawValue:e}}}async function nB({text:e,schema:t}){try{let r=no(e);if(null==t)return r;return nD({value:r,schema:t})}catch(t){if(ex.isInstance(t)||eS.isInstance(t))throw t;throw new ex({text:e,cause:t})}}async function nF({text:e,schema:t}){try{let r=no(e);if(null==t)return{success:!0,value:r,rawValue:r};return await nU({value:r,schema:t})}catch(t){return{success:!1,error:ex.isInstance(t)?t:new ex({text:e,cause:t}),rawValue:void 0}}}
11function nz({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new aY).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await nF({text:e,schema:t}))}}))}var nV=()=>globalThis.fetch,nW=async({url:e,headers:t,body:r,failedResponseHandler:a,successfulResponseHandler:n,abortSignal:i,fetch:s})=>nq({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:a,successfulResponseHandler:n,abortSignal:i,fetch:s}),nq=async({url:e,headers:t={},body:r,successfulResponseHandler:a,failedResponseHandler:n,abortSignal:i,fetch:s=nV()})=>{try{let o=await s(e,{method:"POST",headers:a7(t,`ai-sdk/provider-utils/${ne}`,a3()),body:r.content,signal:i}),l=aX(o);if(!o.ok){let t;try{t=await n({response:o,url:e,requestBodyValues:r.values})}catch(t){if(a6(t)||el.isInstance(t))throw t;throw new el({message:"Failed to process error response",cause:t,statusCode:o.status,url:e,responseHeaders:l,requestBodyValues:r.values})}throw t.value}try{return await a({response:o,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(a6(t)||el.isInstance(t)))throw t;throw new el({message:"Failed to process successful response",cause:t,statusCode:o.status,url:e,responseHeaders:l,requestBodyValues:r.values})}}catch(t){throw a9({error:t,url:e,requestBodyValues:r.values})}};async function nJ(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var nK=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:a,url:n,requestBodyValues:i})=>{let s=await a.text(),o=aX(a);if(""===s.trim())return{responseHeaders:o,value:new el({message:a.statusText,url:n,requestBodyValues:i,statusCode:a.status,responseHeaders:o,responseBody:s,isRetryable:null==r?void 0:r(a)})};try{let l=await nB({text:s,schema:e});return{responseHeaders:o,value:new el({message:t(l),url:n,requestBodyValues:i,statusCode:a.status,responseHeaders:o,responseBody:s,data:l,isRetryable:null==r?void 0:r(a,l)})}}catch(e){return{responseHeaders:o,value:new el({message:a.statusText,url:n,requestBodyValues:i,statusCode:a.status,responseHeaders:o,responseBody:s,isRetryable:null==r?void 0:r(a)})}}},nG=e=>async({response:t,url:r,requestBodyValues:a})=>{let n=await t.text(),i=await nF({text:n,schema:e}),s=aX(t);if(!i.success)throw new el({message:"Invalid JSON response",cause:i.error,statusCode:t.status,responseHeaders:s,responseBody:n,url:r,requestBodyValues:a});return{responseHeaders:s,value:i.value,rawValue:i.rawValue}};e.i(62341);var nY=tX,nH=e.i(60773),nX=Symbol.for("vercel.ai.gateway.error"),nQ=class e extends(I=Error,Z=nX,I){constructor({message:e,statusCode:t=500,cause:r}){super(e),this[Z]=!0,this.statusCode=t,this.cause=r}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&nX in e&&!0===e[nX]}},n0="GatewayAuthenticationError",n1=Symbol.for(`vercel.ai.gateway.error.${n0}`),n2=class e extends(T=nQ,S=n1,T){constructor({message:e="Authentication failed",statusCode:t=401,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[S]=!0,this.name=n0,this.type="authentication_error"}static isInstance(e){return nQ.hasMarker(e)&&n1 in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:a="Authentication failed",statusCode:n=401,cause:i}){return new e({message:t?`AI Gateway authentication failed: Invalid API key. 12 13Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys 14 15Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:r?`AI Gateway authentication failed: Invalid OIDC token. 16 17Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token. 18 19Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:`AI Gateway authentication failed: No authentication provided. 20 21Option 1 - API key: 22Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys 23Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable. 24 25Option 2 - OIDC token: 26Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,statusCode:n,cause:i})}},n4="GatewayInvalidRequestError",n6=Symbol.for(`vercel.ai.gateway.error.${n4}`),n5=class extends(O=nQ,A=n6,O){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[A]=!0,this.name=n4,this.type="invalid_request_error"}static isInstance(e){return nQ.hasMarker(e)&&n6 in e}},n9="GatewayRateLimitError",n3=Symbol.for(`vercel.ai.gateway.error.${n9}`),n8=class extends(R=nQ,C=n3,R){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[C]=!0,this.name=n9,this.type="rate_limit_exceeded"}static isInstance(e){return nQ.hasMarker(e)&&n3 in e}},n7="GatewayModelNotFoundError",ie=Symbol.for(`vercel.ai.gateway.error.${n7}`),it=nj(()=>nL(nY.object({modelId:nY.string()}))),ir=class extends(N=nQ,$=ie,N){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:a}={}){super({message:e,statusCode:t,cause:a}),this[$]=!0,this.name=n7,this.type="model_not_found",this.modelId=r}static isInstance(e){return nQ.hasMarker(e)&&ie in e}},ia="GatewayInternalServerError",ii=Symbol.for(`vercel.ai.gateway.error.${ia}`),is=class extends(P=nQ,j=ii,P){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[j]=!0,this.name=ia,this.type="internal_server_error"}static isInstance(e){return nQ.hasMarker(e)&&ii in e}},io="GatewayResponseError",il=Symbol.for(`vercel.ai.gateway.error.${io}`),iu=class extends(L=nQ,M=il,L){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:a,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[M]=!0,this.name=io,this.type="response_error",this.response=r,this.validationError=a}static isInstance(e){return nQ.hasMarker(e)&&il in e}};async function id({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:a,authMethod:n}){let i=await nU({value:e,schema:ic});if(!i.success)return new iu({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:i.error,cause:a});let s=i.value,o=s.error.type,l=s.error.message;switch(o){case"authentication_error":return n2.createContextualError({apiKeyProvided:"api-key"===n,oidcTokenProvided:"oidc"===n,statusCode:t,cause:a});
26case"invalid_request_error":return new n5({message:l,statusCode:t,cause:a});case"rate_limit_exceeded":return new n8({message:l,statusCode:t,cause:a});case"model_not_found":{let e=await nU({value:s.error.param,schema:it});return new ir({message:l,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:a})}default:return new is({message:l,statusCode:t,cause:a})}}var ic=nj(()=>nL(nY.object({error:nY.object({message:nY.string(),type:nY.string().nullish(),param:nY.unknown().nullish(),code:nY.union([nY.string(),nY.number()]).nullish()})})));function ip(e,t){var r;return nQ.isInstance(e)?e:el.isInstance(e)?id({response:function(e){if(void 0!==e.data)return e.data;if(null!=e.responseBody)try{return JSON.parse(e.responseBody)}catch(t){return e.responseBody}return{}}(e),statusCode:null!=(r=e.statusCode)?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):id({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}var ih="ai-gateway-auth-method";async function im(e){let t=await nU({value:e[ih],schema:ig});return t.success?t.value:void 0}var ig=nj(()=>nL(nY.union([nY.literal("api-key"),nY.literal("oidc")]))),iy=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await nr({url:`${this.config.baseURL}/config`,headers:await nJ(this.config.headers()),successfulResponseHandler:nG(iv),failedResponseHandler:nK({errorSchema:nY.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await ip(e)}}async getCredits(){try{let e=new URL(this.config.baseURL),{value:t}=await nr({url:`${e.origin}/v1/credits`,headers:await nJ(this.config.headers()),successfulResponseHandler:nG(i_),failedResponseHandler:nK({errorSchema:nY.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await ip(e)}}},iv=nj(()=>nL(nY.object({models:nY.array(nY.object({id:nY.string(),name:nY.string(),description:nY.string().nullish(),pricing:nY.object({input:nY.string(),output:nY.string(),input_cache_read:nY.string().nullish(),input_cache_write:nY.string().nullish()}).transform(({input:e,output:t,input_cache_read:r,input_cache_write:a})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...a?{cacheCreationInputTokens:a}:{}})).nullish(),specification:nY.object({specificationVersion:nY.literal("v3"),provider:nY.string(),modelId:nY.string()}),modelType:nY.enum(["language","embedding","image"]).nullish()}))}))),i_=nj(()=>nL(nY.object({balance:nY.string(),total_used:nY.string()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),ib=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...r}=e;return{args:this.maybeEncodeFileParts(r),warnings:[]}}async doGenerate(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:a}=e,n=await nJ(this.config.headers());try{let{responseHeaders:i,value:s,rawValue:o}=await nW({url:this.getUrl(),headers:aH(n,e.headers,this.getModelConfigHeaders(this.modelId,!1),await nJ(this.config.o11yHeaders)),body:t,successfulResponseHandler:nG(nY.any()),failedResponseHandler:nK({errorSchema:nY.any(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{...s,request:{body:t},response:{headers:i,body:o},warnings:r}}catch(e){throw await ip(e,await im(n))}}async doStream(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:a}=e,n=await nJ(this.config.headers());try{let i,{value:s,responseHeaders:o}=await nW({url:this.getUrl(),headers:aH(n,e.headers,this.getModelConfigHeaders(this.modelId,!0),await nJ(this.config.o11yHeaders)),body:t,successfulResponseHandler:(i=nY.any(),async({response:e})=>{let t=aX(e);if(null==e.body)throw new ep({});return{responseHeaders:t,value:nz({stream:e.body,schema:i})}}),failedResponseHandler:nK({errorSchema:nY.any(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{stream:s.pipeThrough(new TransformStream({start(e){r.length>0&&e.enqueue({type:"stream-start",warnings:r})},transform(t,r){if(t.success){let a=t.value;("raw"!==a.type||e.includeRawChunks)&&("response-metadata"===a.type&&a.timestamp&&"string"==typeof a.timestamp&&(a.timestamp=new Date(a.timestamp)),r.enqueue(a))}else r.error(t.error)}})),request:{body:t},response:{headers:o}}}catch(e){throw await ip(e,await im(n))}}isFilePart(e){return e&&"object"==typeof e&&"type"in e&&"file"===e.type}maybeEncodeFileParts(e){for(let t of e.prompt)for(let e of t.content)if(this.isFilePart(e)&&e.data instanceof Uint8Array){let t=Uint8Array.from(e.data),r=et.Buffer.from(t).toString("base64");e.data=new URL(`data:${e.mediaType||"application/octet-stream"};base64,${r}`)}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"3","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},iw=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:r,providerOptions:a}){var n;let i=await nJ(this.config.headers());try{let{responseHeaders:s,value:o,rawValue:l}=await nW({url:this.getUrl(),headers:aH(i,null!=t?t:{},this.getModelConfigHeaders(),await nJ(this.config.o11yHeaders)),body:{values:e,...a?{providerOptions:a}:{}},successfulResponseHandler:nG(ix),failedResponseHandler:nK({errorSchema:nY.any(),errorToMessage:e=>e}
26),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:o.embeddings,usage:null!=(n=o.usage)?n:void 0,providerMetadata:o.providerMetadata,response:{headers:s,body:l},warnings:[]}}catch(e){throw await ip(e,await im(i))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},ix=nj(()=>nL(nY.object({embeddings:nY.array(nY.array(nY.number())),usage:nY.object({tokens:nY.number()}).nullish(),providerMetadata:nY.record(nY.string(),nY.record(nY.string(),nY.unknown())).optional()}))),iE=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:r,aspectRatio:a,seed:n,providerOptions:i,headers:s,abortSignal:o}){var l;let u=await nJ(this.config.headers());try{let{responseHeaders:d,value:c,rawValue:p}=await nW({url:this.getUrl(),headers:aH(u,null!=s?s:{},this.getModelConfigHeaders(),await nJ(this.config.o11yHeaders)),body:{prompt:e,n:t,...r&&{size:r},...a&&{aspectRatio:a},...n&&{seed:n},...i&&{providerOptions:i}},successfulResponseHandler:nG(iZ),failedResponseHandler:nK({errorSchema:nY.any(),errorToMessage:e=>e}),...o&&{abortSignal:o},fetch:this.config.fetch});return{images:c.images,warnings:null!=(l=c.warnings)?l:[],providerMetadata:c.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d}}}catch(e){throw ip(e,await im(u))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}},ik=nY.object({images:nY.array(nY.unknown()).optional()}).catchall(nY.unknown()),iZ=nY.object({images:nY.array(nY.string()),warnings:nY.array(nY.object({type:nY.literal("other"),message:nY.string()})).optional(),providerMetadata:nY.record(nY.string(),ik).optional()});async function iI(){var e;return null==(e=(0,nH.getContext)().headers)?void 0:e["x-vercel-id"]}async function iS(e){let t=na({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await (0,nH.getVercelOidcToken)(),authMethod:"oidc"}}!function(e={}){var t,r,a;let n=null,i=null,s=null!=(t=e.metadataCacheRefreshMillis)?t:3e5,o=0,l=null!=(r=null==(a=e.baseURL)?void 0:a.replace(/\/$/,""))?r:"https://ai-gateway.vercel.sh/v3/ai",u=async()=>{try{let t=await iS(e);return a7({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[ih]:t.authMethod,...e.headers},"ai-sdk/gateway/3.0.5")}catch(e){throw n2.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},d=()=>{let e=na({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=na({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),r=na({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{let a=await iI();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...r&&{"ai-o11y-region":r},...a&&{"ai-o11y-request-id":a}}}},c=t=>new ib(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()}),p=async()=>{var t,r,a;let d=null!=(a=null==(r=null==(t=e._internal)?void 0:t.currentDate)?void 0:r.call(t).getTime())?a:Date.now();return(!n||d-o>s)&&(o=d,n=new iy({baseURL:l,headers:u,fetch:e.fetch}).getAvailableModels().then(e=>(i=e,e)).catch(async e=>{throw await ip(e,await im(await u()))})),i?Promise.resolve(i):n},f=async()=>new iy({baseURL:l,headers:u,fetch:e.fetch}).getCredits().catch(async e=>{throw await ip(e,await im(await u()))}),h=function(e){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return c(e)};h.specificationVersion="v3",h.getAvailableModels=p,h.getCredits=f,h.imageModel=t=>new iE(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()}),h.languageModel=c;let m=t=>new iw(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});h.embeddingModel=m,h.textEmbeddingModel=m}();var nY=tX,iT="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:e.g,iA="1.9.0",iO=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,iC=function(e){var t=new Set([e]),r=new Set,a=e.match(iO);if(!a)return function(){return!1};var n={major:+a[1],minor:+a[2],patch:+a[3],prerelease:a[4]};if(null!=n.prerelease)return function(t){return t===e};function i(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;
26if(r.has(e))return!1;var a=e.match(iO);if(!a)return i(e);var s={major:+a[1],minor:+a[2],patch:+a[3],prerelease:a[4]};if(null!=s.prerelease||n.major!==s.major)return i(e);if(0===n.major)return n.minor===s.minor&&n.patch<=s.patch?(t.add(e),!0):i(e);return n.minor<=s.minor?(t.add(e),!0):i(e)}}(iA),iR=Symbol.for("opentelemetry.js.api."+iA.split(".")[0]);function i$(e,t,r,a){void 0===a&&(a=!1);var n,i=iT[iR]=null!=(n=iT[iR])?n:{version:iA};if(!a&&i[e]){var s=Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(s.stack||s.message),!1}if(i.version!==iA){var s=Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+iA);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+iA+"."),!0}function iN(e){var t,r,a=null==(t=iT[iR])?void 0:t.version;if(a&&iC(a))return null==(r=iT[iR])?void 0:r[e]}function ij(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+iA+".");var r=iT[iR];r&&delete r[e]}var iP=new function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(e){return r._currentContext.get(e)},r.setValue=function(t,a){var n=new e(r._currentContext);return n._currentContext.set(t,a),n},r.deleteValue=function(t){var a=new e(r._currentContext);return a._currentContext.delete(t),a}},iM=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s},iL=function(e,t,r){if(r||2==arguments.length)for(var a,n=0,i=t.length;n<i;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},iD=function(){function e(){}return e.prototype.active=function(){return iP},e.prototype.with=function(e,t,r){for(var a=[],n=3;n<arguments.length;n++)a[n-3]=arguments[n];return t.call.apply(t,iL([r],iM(a),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),iU=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s},iB=function(e,t,r){if(r||2==arguments.length)for(var a,n=0,i=t.length;n<i;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},iF=function(){function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return iz("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return iz("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return iz("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return iz("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return iz("verbose",this._namespace,e)},e}();function iz(e,t,r){var a=iN("diag");if(a)return r.unshift(t),a[e].apply(a,iB([],iU(r),!1))}(i=D||(D={}))[i.NONE=0]="NONE",i[i.ERROR=30]="ERROR",i[i.WARN=50]="WARN",i[i.INFO=60]="INFO",i[i.DEBUG=70]="DEBUG",i[i.VERBOSE=80]="VERBOSE",i[i.ALL=9999]="ALL";var iV=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s},iW=function(e,t,r){if(r||2==arguments.length)for(var a,n=0,i=t.length;n<i;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},iq=function(){function e(){function e(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var a=iN("diag");if(a)return a[e].apply(a,iW([],iV(t),!1))}}var t=this;t.setLogger=function(e,r){if(void 0===r&&(r={logLevel:D.INFO}),e===t){var a,n,i,s=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!=(a=s.stack)?a:s.message),!1}"number"==typeof r&&(r={logLevel:r});var o=iN("diag"),l=function(e,t){function r(r,a){var n=t[r];return"function"==typeof n&&e>=a?n.bind(t):function(){}}return e<D.NONE?e=D.NONE:e>D.ALL&&(e=D.ALL),t=t||{},{error:r("error",D.ERROR),warn:r("warn",D.WARN),info:r("info",D.INFO),debug:r("debug",D.DEBUG),verbose
26:r("verbose",D.VERBOSE)}}(null!=(n=r.logLevel)?n:D.INFO,e);if(o&&!r.suppressOverrideMessage){var u=null!=(i=Error().stack)?i:"<failed to generate stacktrace>";o.warn("Current logger will be overwritten from "+u),l.warn("Current logger will overwrite one already registered from "+u)}return i$("diag",l,t,!0)},t.disable=function(){ij("diag",t)},t.createComponentLogger=function(e){return new iF(e)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}(),iJ=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s},iK=function(e,t,r){if(r||2==arguments.length)for(var a,n=0,i=t.length;n<i;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},iG="context",iY=new iD,iH=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return i$(iG,e,iq.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var a,n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return(a=this._getContextManager()).with.apply(a,iK([e,t,r],iJ(n),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return iN(iG)||iY},e.prototype.disable=function(){this._getContextManager().disable(),ij(iG,iq.instance())},e}();(s=U||(U={}))[s.NONE=0]="NONE",s[s.SAMPLED=1]="SAMPLED";var iX="0000000000000000",iQ="00000000000000000000000000000000",i0={traceId:iQ,spanId:iX,traceFlags:U.NONE},i1=function(){function e(e){void 0===e&&(e=i0),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),i2=Symbol.for("OpenTelemetry Context Key SPAN");function i4(e){return e.getValue(i2)||void 0}function i6(){return i4(iH.getInstance().active())}function i5(e,t){return e.setValue(i2,t)}function i9(e){return e.deleteValue(i2)}function i3(e,t){return i5(e,new i1(t))}function i8(e){var t;return null==(t=i4(e))?void 0:t.spanContext()}var i7=/^([0-9a-f]{32})$/i,se=/^[0-9a-f]{16}$/i;function st(e){var t,r;return t=e.traceId,i7.test(t)&&t!==iQ&&(r=e.spanId,se.test(r)&&r!==iX)}function sr(e){return new i1(e)}var sa=iH.getInstance(),sn=function(){function e(){}return e.prototype.startSpan=function(e,t,r){if(void 0===r&&(r=sa.active()),null==t?void 0:t.root)return new i1;var a,n=r&&i8(r);return"object"==typeof(a=n)&&"string"==typeof a.spanId&&"string"==typeof a.traceId&&"number"==typeof a.traceFlags&&st(n)?new i1(n):new i1},e.prototype.startActiveSpan=function(e,t,r,a){if(!(arguments.length<2)){2==arguments.length?s=t:3==arguments.length?(n=t,s=r):(n=t,i=r,s=a);var n,i,s,o=null!=i?i:sa.active(),l=this.startSpan(e,n,o),u=i5(o,l);return sa.with(u,s,void 0,l)}},e}(),si=new sn,ss=function(){function e(e,t,r,a){this._provider=e,this.name=t,this.version=r,this.options=a}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,a){var n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):si},e}(),so=new(function(){function e(){}return e.prototype.getTracer=function(e,t,r){return new sn},e}()),sl=function(){function e(){}return e.prototype.getTracer=function(e,t,r){var a;return null!=(a=this.getDelegateTracer(e,t,r))?a:new ss(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:so},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var a;return null==(a=this._delegate)?void 0:a.getTracer(e,t,r)},e}(),su="trace";(function(){function e(){this._proxyTracerProvider=new sl,this.wrapSpanContext=sr,this.isSpanContextValid=st,this.deleteSpan=i9,this.get
26Span=i4,this.getActiveSpan=i6,this.getSpanContext=i8,this.setSpan=i5,this.setSpanContext=i3}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=i$(su,this._proxyTracerProvider,iq.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return iN(su)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){ij(su,iq.instance()),this._proxyTracerProvider=new sl},e})().getInstance(),(o=B||(B={}))[o.UNSET=0]="UNSET",o[o.OK=1]="OK",o[o.ERROR=2]="ERROR";var sd=Object.defineProperty,sc=(Symbol.for("vercel.ai.error.AI_InvalidArgumentError"),Symbol.for("vercel.ai.error.AI_InvalidStreamPartError"),Symbol.for("vercel.ai.error.AI_InvalidToolApprovalError"),Symbol.for("vercel.ai.error.AI_InvalidToolInputError"),Symbol.for("vercel.ai.error.AI_ToolCallNotFoundForApprovalError"),Symbol.for("vercel.ai.error.AI_NoImageGeneratedError"),"AI_NoObjectGeneratedError"),sp=`vercel.ai.error.${sc}`,sf=Symbol.for(sp),sh=class extends en{constructor({message:e="No object generated.",cause:t,text:r,response:a,usage:n,finishReason:i}){super({name:sc,message:e,cause:t}),this[F]=!0,this.text=r,this.response=a,this.usage=n,this.finishReason=i}static isInstance(e){return en.hasMarker(e,sp)}};F=sf,Symbol.for("vercel.ai.error.AI_NoOutputGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSuchToolError"),Symbol.for("vercel.ai.error.AI_ToolCallRepairError"),Symbol.for("vercel.ai.error.AI_InvalidDataContentError"),Symbol.for("vercel.ai.error.AI_InvalidMessageRoleError"),Symbol.for("vercel.ai.error.AI_MessageConversionError"),Symbol.for("vercel.ai.error.AI_RetryError");var sm="6.0.6",sg=nY.union([nY.string(),nY.instanceof(Uint8Array),nY.instanceof(ArrayBuffer),nY.custom(e=>{var t,r;return null!=(r=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&r},{message:"Must be a Buffer"})]),sy=nY.lazy(()=>nY.union([nY.null(),nY.string(),nY.number(),nY.boolean(),nY.record(nY.string(),sy.optional()),nY.array(sy)])),sv=nY.record(nY.string(),nY.record(nY.string(),sy.optional())),s_=nY.object({type:nY.literal("text"),text:nY.string(),providerOptions:sv.optional()}),sb=nY.object({type:nY.literal("image"),image:nY.union([sg,nY.instanceof(URL)]),mediaType:nY.string().optional(),providerOptions:sv.optional()}),sw=nY.object({type:nY.literal("file"),data:nY.union([sg,nY.instanceof(URL)]),filename:nY.string().optional(),mediaType:nY.string(),providerOptions:sv.optional()}),sx=nY.object({type:nY.literal("reasoning"),text:nY.string(),providerOptions:sv.optional()}),sE=nY.object({type:nY.literal("tool-call"),toolCallId:nY.string(),toolName:nY.string(),input:nY.unknown(),providerOptions:sv.optional(),providerExecuted:nY.boolean().optional()}),sk=nY.discriminatedUnion("type",[nY.object({type:nY.literal("text"),value:nY.string(),providerOptions:sv.optional()}),nY.object({type:nY.literal("json"),value:sy,providerOptions:sv.optional()}),nY.object({type:nY.literal("execution-denied"),reason:nY.string().optional(),providerOptions:sv.optional()}),nY.object({type:nY.literal("error-text"),value:nY.string(),providerOptions:sv.optional()}),nY.object({type:nY.literal("error-json"),value:sy,providerOptions:sv.optional()}),nY.object({type:nY.literal("content"),value:nY.array(nY.union([nY.object({type:nY.literal("text"),text:nY.string(),providerOptions:sv.optional()}),nY.object({type:nY.literal("media"),data:nY.string(),mediaType:nY.string()}),nY.object({type:nY.literal("file-data"),data:nY.string(),mediaType:nY.string(),filename:nY.string().optional(),providerOptions:sv.optional()}),nY.object({type:nY.literal("file-url"),url:nY.string(),providerOptions:sv.optional()}),nY.object({type:nY.literal("file-id"),fileId:nY.union([nY.string(),nY.record(nY.string(),nY.string())]),providerOptions:sv.optional()}),nY.object({type:nY.literal("image-data"),data:nY.string(),mediaType:nY.string(),providerOptions:sv.optional()}),nY.object({type:nY.literal("image-url"),url:nY.string(),providerOptions:sv.optional()}),nY.object({type:nY.literal("image-file-id"),fileId:nY.union([nY.string(),nY.record(nY.string(),nY.string())]),providerOptions:sv.optional()}),nY.object({type:nY.literal("custom"),providerOptions:sv.optional()})]))})]),sZ=nY.object({type:nY.literal("tool-result"),toolCallId:nY.string(),toolName:nY.string(),output:sk,providerOptions:sv.optional()}),sI=nY.object({type:nY.literal("tool-approval-request"),approvalId:nY.string(),toolCallId:nY.string()}),sS=nY.object({type:nY.literal("tool-approval-response"),approvalId:nY.string(),approved:nY.boolean(),reason:nY.string().optional()}),sT=nY.object({role:nY.literal("system"),content:nY.string(),providerOptions:sv.optional()}),sA=nY.object({role:nY.literal("user"),content:nY.union([nY.string(),nY.array(nY.union([s_,sb,sw]))]),providerOptions:sv.optional()}),sO=nY.object({role:nY.literal("assistant"),content:nY.union([nY.string(),nY.array(nY.union([s_,sw,sx,sE,sZ,sI]))]),providerOptions:sv.optional()}),sC=nY.object({role:nY.literal("tool"),content:nY.array(nY.union([sZ,sS])),providerOptions:sv.optional()});nY.union([sT,sA,sO,sC]);var sR={},s$={array:()=>sL,choice:()=>sD,json:()=>sU,object:()=>sM,text:()=>sP};for(var sN in s$)sd(sR,sN,{get:s$[sN],enumerable:!0});async function sj(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await nF({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await nF({text:function(e){let t=["ROOT"],r=-1,a=null;function n(e,n,i){switch(e){case'"':r=n,t.pop(),t.push(i),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=n,a=n,t.pop(),t.push(i),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(i),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=n,t.pop(),t.push(i),t.push("INSIDE_NUMBER");break;case"{":r=n,t.pop(),t.push(i),t.push("INSIDE_OBJECT_START");break;case"[":r=n,t.pop(),t.push(i),t.push("INSIDE_ARRAY_START")}}function i(e,a){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=a,t.pop()}}function s(e,a){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=a,t.pop()}}for(let o=0;o<e.length;o++){let l=e[o];switch(t[t.length-1]){case"ROOT":n(l,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=o,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":n(l,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":i(l,o);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),r=o;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=o}break;case"INSIDE_ARRAY_START":"]"===l?(r=o,t.pop()):(r=o,n(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=o,t.pop();break;default:r=o}break;case"INSIDE_ARRAY_AFTER_COMMA":n(l,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),r=o;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=o;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&i(l,o);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&i(l,o);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o);break;default:t.pop()}break;case"INSIDE_LITERAL":{let n=e.substring(a,o+1);"false".startsWith(n)||"true".startsWith(n)||"null".startsWith(n)?r=o:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?i(l,o):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o))}}}let o=e.slice(0,r+1);for(let r=t.length-1;r>=0;r--)switch(t[r]){case"INSIDE_STRING":o+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":o+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":o+="]";break;case"INSIDE_LITERAL":{let t=e.substring(a,e.length);"true".startsWith(t)?o+="true".slice(t.length):"false".startsWith(t)?o+="false".slice(t.length):"null".startsWith(t)&&(o+="null".slice(t.length))}}return o}(e)})).success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"}}var sP=()=>({responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e})}),sM=({schema:e,name:t,description:r})=>{let a=nM(e);return{responseFormat:nJ(a.jsonSchema).then(e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=r&&{description:r}})),async parseCompleteOutput({text:e},t){let r=await nF({text:e});if(!r.success)throw new sh({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let n=await nU({value:r.value,schema:a});if(!n.success)throw new sh({message:"No object generated: response did not match sc
26hema.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await sj(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}}}},sL=({element:e,name:t,description:r})=>{let a=nM(e);return{responseFormat:nJ(a.jsonSchema).then(e=>{let{$schema:a,...n}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:n}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}}),async parseCompleteOutput({text:e},t){let r=await nF({text:e});if(!r.success)throw new sh({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let n=r.value;if(null==n||"object"!=typeof n||!("elements"in n)||!Array.isArray(n.elements))throw new sh({message:"No object generated: response did not match schema.",cause:new eS({value:n,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let r of n.elements){let n=await nU({value:r,schema:a});if(!n.success)throw new sh({message:"No object generated: response did not match schema.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return n.elements},async parsePartialOutput({text:e}){let t=await sj(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let e=t.value;if(null==e||"object"!=typeof e||!("elements"in e)||!Array.isArray(e.elements))return;let r="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,n=[];for(let e of r){let t=await nU({value:e,schema:a});t.success&&n.push(t.value)}return{partial:n}}}}}},sD=({options:e,name:t,description:r})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}),async parseCompleteOutput({text:t},r){let a=await nF({text:t});if(!a.success)throw new sh({message:"No object generated: could not parse the response.",cause:a.error,text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});let n=a.value;if(null==n||"object"!=typeof n||!("result"in n)||"string"!=typeof n.result||!e.includes(n.result))throw new sh({message:"No object generated: response did not match schema.",cause:new eS({value:n,cause:"response must be an object that contains a choice value."}),text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});return n.result},async parsePartialOutput({text:t}){let r=await sj(t);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let t=r.value;if(null==t||"object"!=typeof t||!("result"in t)||"string"!=typeof t.result)return;let a=e.filter(e=>e.startsWith(t.result));if("successful-parse"===r.state)return a.includes(t.result)?{partial:t.result}:void 0;return 1===a.length?{partial:a[0]}:void 0}}}}
26),sU=({name:e,description:t}={})=>({responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){let r=await nF({text:e});if(!r.success)throw new sh({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return r.value},async parsePartialOutput({text:e}){let t=await sj(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return void 0===t.value?void 0:{partial:t.value}}}});a2({prefix:"aitxt",size:24}),TransformStream;var sB=nj(()=>nL(nY.union([nY.strictObject({type:nY.literal("text-start"),id:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("text-delta"),id:nY.string(),delta:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("text-end"),id:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("error"),errorText:nY.string()}),nY.strictObject({type:nY.literal("tool-input-start"),toolCallId:nY.string(),toolName:nY.string(),providerExecuted:nY.boolean().optional(),dynamic:nY.boolean().optional(),title:nY.string().optional()}),nY.strictObject({type:nY.literal("tool-input-delta"),toolCallId:nY.string(),inputTextDelta:nY.string()}),nY.strictObject({type:nY.literal("tool-input-available"),toolCallId:nY.string(),toolName:nY.string(),input:nY.unknown(),providerExecuted:nY.boolean().optional(),providerMetadata:sv.optional(),dynamic:nY.boolean().optional(),title:nY.string().optional()}),nY.strictObject({type:nY.literal("tool-input-error"),toolCallId:nY.string(),toolName:nY.string(),input:nY.unknown(),providerExecuted:nY.boolean().optional(),providerMetadata:sv.optional(),dynamic:nY.boolean().optional(),errorText:nY.string(),title:nY.string().optional()}),nY.strictObject({type:nY.literal("tool-approval-request"),approvalId:nY.string(),toolCallId:nY.string()}),nY.strictObject({type:nY.literal("tool-output-available"),toolCallId:nY.string(),output:nY.unknown(),providerExecuted:nY.boolean().optional(),dynamic:nY.boolean().optional(),preliminary:nY.boolean().optional()}),nY.strictObject({type:nY.literal("tool-output-error"),toolCallId:nY.string(),errorText:nY.string(),providerExecuted:nY.boolean().optional(),dynamic:nY.boolean().optional()}),nY.strictObject({type:nY.literal("tool-output-denied"),toolCallId:nY.string()}),nY.strictObject({type:nY.literal("reasoning-start"),id:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("reasoning-delta"),id:nY.string(),delta:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("reasoning-end"),id:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("source-url"),sourceId:nY.string(),url:nY.string(),title:nY.string().optional(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("source-document"),sourceId:nY.string(),mediaType:nY.string(),title:nY.string(),filename:nY.string().optional(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.literal("file"),url:nY.string(),mediaType:nY.string(),providerMetadata:sv.optional()}),nY.strictObject({type:nY.custom(e=>"string"==typeof e&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:nY.string().optional(),data:nY.unknown(),transient:nY.boolean().optional()}),nY.strictObject({type:nY.literal("start-step")}),nY.strictObject({type:nY.literal("finish-step")}),nY.strictObject({type:nY.literal("start"),messageId:nY.string().optional(),messageMetadata:nY.unknown().optional()}),nY.strictObject({type:nY.literal("finish"),finishReason:nY.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:nY.unknown().optional()}),nY.strictObject({type:nY.literal("abort")}),nY.strictObject({type:nY.literal("message-metadata"),messageMetadata:nY.unknown()})])));function sF(e){return e.type.startsWith("tool-")}function sz(e){return sF(e)||"dynamic-tool"===e.type}function sV(e){return e.type.split("-").slice(1).join("-")}
26async function sW({stream:e,onError:t}){let r=e.getReader();try{for(;;){let{done:e}=await r.read();if(e)break}}catch(e){null==t||t(e)}finally{r.releaseLock()}}a2({prefix:"aitxt",size:24}),nj(()=>nL(nY.array(nY.object({id:nY.string(),role:nY.enum(["system","user","assistant"]),metadata:nY.unknown().optional(),parts:nY.array(nY.union([nY.object({type:nY.literal("text"),text:nY.string(),state:nY.enum(["streaming","done"]).optional(),providerMetadata:sv.optional()}),nY.object({type:nY.literal("reasoning"),text:nY.string(),state:nY.enum(["streaming","done"]).optional(),providerMetadata:sv.optional()}),nY.object({type:nY.literal("source-url"),sourceId:nY.string(),url:nY.string(),title:nY.string().optional(),providerMetadata:sv.optional()}),nY.object({type:nY.literal("source-document"),sourceId:nY.string(),mediaType:nY.string(),title:nY.string(),filename:nY.string().optional(),providerMetadata:sv.optional()}),nY.object({type:nY.literal("file"),mediaType:nY.string(),filename:nY.string().optional(),url:nY.string(),providerMetadata:sv.optional()}),nY.object({type:nY.literal("step-start")}),nY.object({type:nY.string().startsWith("data-"),id:nY.string().optional(),data:nY.unknown()}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("input-streaming"),input:nY.unknown().optional(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),approval:nY.never().optional()}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("input-available"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.never().optional()}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("approval-requested"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.never().optional(),reason:nY.never().optional()})}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("approval-responded"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.boolean(),reason:nY.string().optional()})}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("output-available"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.unknown(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),preliminary:nY.boolean().optional(),approval:nY.object({id:nY.string(),approved:nY.literal(!0),reason:nY.string().optional()}).optional()}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("output-error"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.string(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.literal(!0),reason:nY.string().optional()}).optional()}),nY.object({type:nY.literal("dynamic-tool"),toolName:nY.string(),toolCallId:nY.string(),state:nY.literal("output-denied"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.literal(!1),reason:nY.string().optional()})}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("input-streaming"),providerExecuted:nY.boolean().optional(),input:nY.unknown().optional(),output:nY.never().optional(),errorText:nY.never().optional(),approval:nY.never().optional()}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("input-available"),providerExecuted:nY.boolean().optional(),input
26:nY.unknown(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.never().optional()}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("approval-requested"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.never().optional(),reason:nY.never().optional()})}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("approval-responded"),input:nY.unknown(),providerExecuted:nY.boolean().optional(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.boolean(),reason:nY.string().optional()})}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("output-available"),providerExecuted:nY.boolean().optional(),input:nY.unknown(),output:nY.unknown(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),preliminary:nY.boolean().optional(),approval:nY.object({id:nY.string(),approved:nY.literal(!0),reason:nY.string().optional()}).optional()}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("output-error"),providerExecuted:nY.boolean().optional(),input:nY.unknown(),output:nY.never().optional(),errorText:nY.string(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.literal(!0),reason:nY.string().optional()}).optional()}),nY.object({type:nY.string().startsWith("tool-"),toolCallId:nY.string(),state:nY.literal("output-denied"),providerExecuted:nY.boolean().optional(),input:nY.unknown(),output:nY.never().optional(),errorText:nY.never().optional(),callProviderMetadata:sv.optional(),approval:nY.object({id:nY.string(),approved:nY.literal(!1),reason:nY.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty"))),a2({prefix:"aiobj",size:24});var sq=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,r)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){r(e)}}),this.processQueue()})}};async function sJ({stream:e,onTextPart:t}){let r=e.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:e,value:a}=await r.read();if(e)break;await t(a)}}async function sK({api:e,prompt:t,credentials:r,headers:a,body:n,streamProtocol:i="data",setCompletion:s,setLoading:o,setError:l,setAbortController:u,onFinish:d,onError:c,fetch:p=fetch}){var f;try{o(!0),l(void 0);let c=new AbortController;u(c),s("");let h=await p(e,{method:"POST",body:JSON.stringify({prompt:t,...n}),credentials:r,headers:a7({"Content-Type":"application/json",...a},`ai-sdk/${sm}`,a3()),signal:c.signal}).catch(e=>{throw e});if(!h.ok)throw Error(null!=(f=await h.text())?f:"Failed to fetch the chat response.");if(!h.body)throw Error("The response body is empty.");let m="";switch(i){case"text":await sJ({stream:h.body,onTextPart:e=>{m+=e,s(m)}});break;case"data":await sW({stream:nz({stream:h.body,schema:sB}).pipeThrough(new TransformStream({async transform(e){if(!e.success)throw e.error;let t=e.value;if("text-delta"===t.type)m+=t.delta,s(m);else if("error"===t.type)throw Error(t.errorText)}})),onError:e=>{throw e}});break;default:throw Error(`Unknown stream protocol: ${i}`)}return d&&d(t,m),u(null),m}catch(e){if("AbortError"===e.name)return u(null),null;e instanceof Error&&c&&c(e),l(e)}finally{o(!1)}}async function sG(e){if(null==e)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async e=>{let{name:t,type:r}=e;return{type:"file",mediaType:r,filename:t,url:await new Promise((t,r)=>{let a=new FileReader;a.onload=e=>{var r;t(null==(r=e.target)?void 0:r.result)},a.onerror=e=>r(e),a.readAsDataURL(e)})}}))}a2({prefix:"aiobj",size:24}
26),Symbol.for("vercel.ai.error.AI_NoSuchProviderError");var sY=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:a,fetch:n,prepareSendMessagesRequest:i,prepareReconnectToStreamRequest:s}){this.api=e,this.credentials=t,this.headers=r,this.body=a,this.fetch=n,this.prepareSendMessagesRequest=i,this.prepareReconnectToStreamRequest=s}async sendMessages({abortSignal:e,...t}){var r,a,n,i,s;let o=await nJ(this.body),l=await nJ(this.headers),u=await nJ(this.credentials),d={...a8(l),...a8(t.headers)},c=await (null==(r=this.prepareSendMessagesRequest)?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...o,...t.body},headers:d,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=null!=(a=null==c?void 0:c.api)?a:this.api,f=(null==c?void 0:c.headers)!==void 0?a8(c.headers):d,h=(null==c?void 0:c.body)!==void 0?c.body:{...o,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},m=null!=(n=null==c?void 0:c.credentials)?n:u,g=null!=(i=this.fetch)?i:globalThis.fetch,y=await g(p,{method:"POST",headers:a7({"Content-Type":"application/json",...f},`ai-sdk/${sm}`,a3()),body:JSON.stringify(h),credentials:m,signal:e});if(!y.ok)throw Error(null!=(s=await y.text())?s:"Failed to fetch the chat response.");if(!y.body)throw Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,r,a,n,i;let s=await nJ(this.body),o=await nJ(this.headers),l=await nJ(this.credentials),u={...a8(o),...a8(e.headers)},d=await (null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...s,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),c=null!=(r=null==d?void 0:d.api)?r:`${this.api}/${e.chatId}/stream`,p=(null==d?void 0:d.headers)!==void 0?a8(d.headers):u,f=null!=(a=null==d?void 0:d.credentials)?a:l,h=null!=(n=this.fetch)?n:globalThis.fetch,m=await h(c,{method:"GET",headers:a7(p,`ai-sdk/${sm}`,a3()),credentials:f});if(204===m.status)return null;if(!m.ok)throw Error(null!=(i=await m.text())?i:"Failed to fetch the chat response.");if(!m.body)throw Error("The response body is empty.");return this.processResponseStream(m.body)}},sH=class extends sY{constructor(e={}){super(e)}processResponseStream(e){return nz({stream:e,schema:sB}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},sX=class{constructor({generateId:e=a4,id:t=e(),transport:r=new sH,messageMetadataSchema:a,dataPartSchemas:n,state:i,onError:s,onToolCall:o,onFinish:l,onData:u,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new sq,this.sendMessage=async(e,t)=>{var r,a,n,i;let s;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(r=this.lastMessage)?void 0:r.id,...t});if(s="text"in e||"files"in e?{parts:[...Array.isArray(e.files)?e.files:await sG(e.files),..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}:e,null!=e.messageId){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(-1===t)throw Error(`message with id ${e.messageId} not found`);if("user"!==this.state.messages[t].role)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...s,id:e.messageId,role:null!=(a=s.role)?a:"user",metadata:e.metadata})}else this.state.pushMessage({...s,id:null!=(n=s.id)?n:this.generateId(),role:null!=(i=s.role)?i:"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let r=null==e?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(-1===r)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[r].role?r:r+1),await this.makeRequest({trigger:"regenerate-message",messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:"resume-stream",...e})},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:r})=>this.jobExecutor.run(async()=>{var a,n;let i=this.state.messages,s=i[i.length-1],o=a=>sz(a)&&"approval-requested"===a.state&&a.approval.id===e?{...a,state:"approval-responded",approval:{id:e,approved:t,reason:r}}:a;this.state.replaceMessage(i.length-1,{...s,parts:s.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),"streaming"!==this.status&&"submitted"!==this.status&&(null==(a=this.sendAutomaticallyWhen)?void 0:a.call(this,{messages:this.state.messages}
26))&&this.makeRequest({trigger:"submit-message",messageId:null==(n=this.lastMessage)?void 0:n.id})}),this.addToolOutput=async({state:e="output-available",tool:t,toolCallId:r,output:a,errorText:n})=>this.jobExecutor.run(async()=>{var t,i;let s=this.state.messages,o=s[s.length-1],l=t=>sz(t)&&t.toolCallId===r?{...t,state:e,output:a,errorText:n}:t;this.state.replaceMessage(s.length-1,{...o,parts:o.parts.map(l)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(l)),"streaming"!==this.status&&"submitted"!==this.status&&(null==(t=this.sendAutomaticallyWhen)?void 0:t.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:null==(i=this.lastMessage)?void 0:i.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;("streaming"===this.status||"submitted"===this.status)&&(null==(e=this.activeResponse)?void 0:e.abortController)&&this.activeResponse.abortController.abort()},this.id=t,this.transport=r,this.generateId=e,this.messageMetadataSchema=a,this.dataPartSchemas=n,this.state=i,this.onError=s,this.onToolCall=o,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async makeRequest({trigger:e,metadata:t,headers:r,body:a,messageId:n}){var i,s,o,l;this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,d=!1,c=!1,p=!1;try{let i,s={state:function({lastMessage:e,messageId:t}){return{message:(null==e?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};if(s.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=s,"resume-stream"===e){let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:a});if(null==e)return void this.setStatus({status:"ready"});i=e}else i=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:s.abortController.signal,metadata:t,headers:r,body:a,trigger:e,messageId:n});let o=e=>this.jobExecutor.run(()=>e({state:s.state,write:()=>{var e;this.setStatus({status:"streaming"}),s.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,s.state.message):this.state.pushMessage(s.state.message)}}));await sW({stream:function({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:a,onError:n,onToolCall:i,onData:s}){return e.pipeThrough(new TransformStream({async transform(e,o){await a(async({state:a,write:l})=>{var u,d,c,p;function f(e){let t=a.message.parts.filter(sz).find(t=>t.toolCallId===e);if(null==t)throw Error(`no tool invocation found for tool call ${e}`);return t}function h(e){var t;let r=a.message.parts.find(t=>sF(t)&&t.toolCallId===e.toolCallId);null!=r?(r.state=e.state,r.input=e.input,r.output=e.output,r.errorText=e.errorText,r.rawInput=e.rawInput,r.preliminary=e.preliminary,void 0!==e.title&&(r.title=e.title),r.providerExecuted=null!=(t=e.providerExecuted)?t:r.providerExecuted,null!=e.providerMetadata&&"input-available"===r.state&&(r.callProviderMetadata=e.providerMetadata)):a.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:e.input,output:e.output,rawInput:e.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,preliminary:e.preliminary,...null!=e.providerMetadata?{callProviderMetadata:e.providerMetadata}:{}})}function m(e){var t,r;let n=a.message.parts.find(t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId);null!=n?(n.state=e.state,n.toolName=e.toolName,n.input=e.input,n.output=e.output,n.errorText=e.errorText,n.rawInput=null!=(t=e.rawInput)?t:n.rawInput,n.preliminary=e.preliminary,void 0!==e.title&&(n.title=e.title),n.providerExecuted=null!=(r=e.providerExecuted)?r:n.providerExecuted,null!=e.providerMetadata&&"input-available"===n.state&&(n.callProviderMetadata=e.providerMetadata)):a.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:e.input,output:e.output,errorText:e.errorText,preliminary:e.preliminary,providerExecuted:e.providerExecuted,title:e.title,...null!=e.providerMetadata?{callProviderMetadata:e.providerMetadata}:{}})}async function g(e){if(null!=e){let r=null!=a.message.metadata?function e(t,r){if(void 0===t&&void 0===r)return;if(void 0===t)return r;if(void 0===r)return t;let a={...t};for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n)){let i=r[n];if(void 0===i)continue;let s=n in t?t[n]:void 0,o=null!==i&&"object"==typeof i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),l=null!=s&&"object"==typeof s&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);o&&l?a[n]=e(s,i):a[n]=i}return a}(a.message.metadata,e):e;null!=t&&await nD({value:r,schema:t}),a.message.metadata=r}}switch(e.type){case"text-start":{let t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};a.activeTextParts[e.id]=t,a.message.parts.push(t),l();break}case"text-delta":{let t=a.activeTextParts[e.id];t.text+=e.delta,t.providerMetadata=null!=(u=e.providerMetadata)?u:t.providerMetadata,l();break}case"text-end":{let t=a.activeTextParts[e.id];t.state="done",t.providerMetadata=null!=(d=e.providerMetadata)?d:t.providerMetadata,delete a.activeTextParts[e.id],l();break}case"reasoning-start":{let t={type:"reasoning",text:"",providerMetadata:e.providerMetadata,state:"streaming"};a.activeReasoningParts[e.id]=t,a.message.parts.push(t),l();break}case"reasoning-delta":{let t=a.activeReasoningParts[e.id];t.text+=e.delta,t.providerMetadata=null!=(c=e.providerMetadata)?c:t.providerMetadata,l();break}case"reasoning-end":{let t=a.activeReasoningParts[e.id];t.providerMetadata=null!=(p=e.providerMetadata)?p:t.providerMetadata,t.state="done",delete a.activeReasoningParts[e.id],l();break}case"file":a.message.parts.push({type:"file",mediaType:e.mediaType,url:e.url}),l();break;case"source-url":a.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),l();break;case"source-document":a.message.parts.push({type:"source-document",sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),l();break;case"tool-input-start":{let t=a.message.parts.filter(sF);a.partialToolCalls[e.toolCallId]={text:"",toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title}),l();break}case"tool-input-delta":{let t=a.partialToolCalls[e.toolCallId];t.text+=e.inputTextDelta;let{value:r}=await sj(t.text);t.dynamic?m({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title}):h({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title}),l();break}case"tool-input-available":e.dynamic?m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),l(),i&&!e.providerExecuted&&await i({toolCall:e});break;case"tool-input-error":e.dynamic?m({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),l();break;case"tool-approval-request":{let t=f(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},l();break}case"tool-output-denied":f(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{let t=f(e.toolCallId);"dynamic-tool"===t.type?m({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-available",input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,title:t.title}):h({toolCallId:e.toolCallId,toolName:sV(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,title:t.title}),l();break}case"tool-output-error":{let t=f(e.toolCallId);"dynamic-tool"===t.type?m({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,title:t.title}):h({toolCallId:e.toolCallId,toolName:sV(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,title:t.title}),l();break}case"start-step":a.message.parts.push({type:"step-start"});break;case"finish-step":a.activeTextParts={},a.activeReasoningParts={};break;case"start":null!=e.messageId&&(a.message.id=e.messageId),await g(e.messageMetadata),(null!=e.messageId||null!=e.messageMetadata)&&l();break;
26case"finish":null!=e.finishReason&&(a.finishReason=e.finishReason),await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"message-metadata":await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"error":null==n||n(Error(e.errorText));break;default:if(e.type.startsWith("data-")){if((null==r?void 0:r[e.type])!=null&&await nD({value:e.data,schema:r[e.type]}),e.transient){null==s||s(e);break}let t=null!=e.id?a.message.parts.find(t=>e.type===t.type&&e.id===t.id):void 0;null!=t?t.data=e.data:a.message.parts.push(e),null==s||s(e),l()}}o.enqueue(e)})}}))}({stream:i,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:o,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:"ready"})}catch(e){if(d||"AbortError"===e.name)return d=!0,this.setStatus({status:"ready"}),null;p=!0,e instanceof TypeError&&(e.message.toLowerCase().includes("fetch")||e.message.toLowerCase().includes("network"))&&(c=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{null==(s=this.onFinish)||s.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:c,isError:p,finishReason:null==(i=this.activeResponse)?void 0:i.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}(null==(o=this.sendAutomaticallyWhen)?void 0:o.call(this,{messages:this.state.messages}))&&!p&&await this.makeRequest({trigger:"submit-message",messageId:null==(l=this.lastMessage)?void 0:l.id,metadata:t,headers:r,body:a})}};function sQ({messages:e}){let t=e[e.length-1];if(!t||"assistant"!==t.role)return!1;let r=t.parts.reduce((e,t,r)=>"step-start"===t.type?r:e,-1),a=t.parts.slice(r+1).filter(sz).filter(e=>!e.providerExecuted);return a.length>0&&a.every(e=>"output-available"===e.state||"output-error"===e.state)}e.s(["AbstractChat",()=>sX,"DefaultChatTransport",()=>sH,"callCompletionApi",()=>sK,"isDeepEqualData",()=>function e(t,r){if(t===r)return!0;if(null==t||null==r)return!1;if("object"!=typeof t&&"object"!=typeof r)return t===r;if(t.constructor!==r.constructor)return!1;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(Array.isArray(t)){if(t.length!==r.length)return!1;for(let a=0;a<t.length;a++)if(!e(t[a],r[a]))return!1;return!0}let a=Object.keys(t),n=Object.keys(r);if(a.length!==n.length)return!1;for(let i of a)if(!n.includes(i)||!e(t[i],r[i]))return!1;return!0},"lastAssistantMessageIsCompleteWithToolCalls",()=>sQ,"parsePartialJson",()=>sj],34681);var s0=e.i(61030),s1=e.i(68373);e.s(["ERROR_REVALIDATE_EVENT",()=>3,"FOCUS_EVENT",()=>0,"MUTATE_EVENT",()=>2,"RECONNECT_EVENT",()=>1],88130);var s2=Object.prototype.hasOwnProperty;let s4=new WeakMap,s6=()=>{},s5=s6(),s9=Object,s3=e=>e===s5,s8=(e,t)=>({...e,...t}),s7={},oe={},ot="undefined",or=typeof window!=ot,oa=typeof document!=ot,on=or&&"Deno"in window,oi=(e,t)=>{let r=s4.get(e);return[()=>!s3(t)&&e.get(t)||s7,a=>{if(!s3(t)){let n=e.get(t);t in oe||(oe[t]=n),r[5](t,s8(n,a),n||s7)}},r[6],()=>!s3(t)&&t in oe?oe[t]:!s3(t)&&e.get(t)||s7]},os=!0,[oo,ol]=or&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[s6,s6],ou={initFocus:e=>(oa&&document.addEventListener("visibilitychange",e),oo("focus",e),()=>{oa&&document.removeEventListener("visibilitychange",e),ol("focus",e)}),initReconnect:e=>{let t=()=>{os=!0,e()},r=()=>{os=!1}
26;return oo("online",t),oo("offline",r),()=>{ol("online",t),ol("offline",r)}}},od=!Q.default.useId,oc=!or||on,op=oc?Q.useEffect:Q.useLayoutEffect,of="undefined"!=typeof navigator&&navigator.connection,oh=!oc&&of&&(["slow-2g","2g"].includes(of.effectiveType)||of.saveData),om=new WeakMap,og=(e,t)=>e===`[object ${t}]`,oy=0,ov=e=>{let t,r,a=typeof e,n=s9.prototype.toString.call(e),i=og(n,"Date"),s=og(n,"RegExp"),o=og(n,"Object");if(s9(e)!==e||i||s)t=i?e.toJSON():"symbol"==a?e.toString():"string"==a?JSON.stringify(e):""+e;else{if(t=om.get(e))return t;if(t=++oy+"~",om.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=ov(e[r])+",";om.set(e,t)}if(o){t="#";let a=s9.keys(e).sort();for(;!s3(r=a.pop());)s3(e[r])||(t+=r+":"+ov(e[r])+",");om.set(e,t)}}return t},o_=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?ov(e):"",t]},ob=0,ow=()=>++ob;async function ox(...e){let[t,r,a,n]=e,i=s8({populateCache:!0,throwOnError:!0},"boolean"==typeof n?{revalidate:n}:n||{}),s=i.populateCache,o=i.rollbackOnError,l=i.optimisticData,u=i.throwOnError;if("function"==typeof r){let e=[];for(let a of t.keys())!/^\$(inf|sub)\$/.test(a)&&r(t.get(a)._k)&&e.push(a);return Promise.all(e.map(d))}return d(r);async function d(r){let n,[d]=o_(r);if(!d)return;let[c,p]=oi(t,d),[f,h,m,g]=s4.get(t),y=()=>{let e=f[d];return("function"==typeof i.revalidate?i.revalidate(c().data,r):!1!==i.revalidate)&&(delete m[d],delete g[d],e&&e[0])?e[0](2).then(()=>c().data):c().data};if(e.length<3)return y();let v=a,_=!1,b=ow();h[d]=[b,0];let w=!s3(l),x=c(),E=x.data,k=x._c,Z=s3(k)?E:k;if(w&&p({data:l="function"==typeof l?l(Z,E):l,_c:Z}),"function"==typeof v)try{v=v(Z)}catch(e){n=e,_=!0}if(v&&"function"==typeof v.then){let e;if(v=await v.catch(e=>{n=e,_=!0}),b!==h[d][0]){if(_)throw n;return v}_&&w&&(e=n,"function"==typeof o?o(e):!1!==o)&&(s=!0,p({data:Z,_c:s5}))}if(s&&!_&&("function"==typeof s?p({data:s(v,Z),error:s5,_c:s5}):p({data:v,error:s5,_c:s5})),h[d][1]=ow(),Promise.resolve(y()).then(()=>{p({_c:s5})}),_){if(u)throw n;return}return v}}let oE=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},ok=(e,t)=>{if(!s4.has(e)){let r=s8(ou,t),a=Object.create(null),n=ox.bind(s5,e),i=s6,s=Object.create(null),o=(e,t)=>{let r=s[e]||[];return s[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},l=(t,r,a)=>{e.set(t,r);let n=s[t];if(n)for(let e of n)e(r,a)},u=()=>{if(!s4.has(e)&&(s4.set(e,[a,Object.create(null),Object.create(null),Object.create(null),n,l,o]),!oc)){let t=r.initFocus(setTimeout.bind(s5,oE.bind(s5,a,0))),n=r.initReconnect(setTimeout.bind(s5,oE.bind(s5,a,1)));i=()=>{t&&t(),n&&n(),s4.delete(e)}}};return u(),[e,n,u,i]}return[e,s4.get(e)[4]]},[oZ,oI]=ok(new Map),oS=s8({onLoadingSlow:s6,onSuccess:s6,onError:s6,onErrorRetry:(e,t,r,a,n)=>{let i=r.errorRetryCount,s=n.retryCount,o=~~((Math.random()+.5)*(1<<(s<8?s:8)))*r.errorRetryInterval;(s3(i)||!(s>i))&&setTimeout(a,o,n)},onDiscarded:s6,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:oh?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:oh?5e3:3e3,compare:function e(t,r){var a,n;if(t===r)return!0;if(t&&r&&(a=t.constructor)===r.constructor){if(a===Date)return t.getTime()===r.getTime();if(a===RegExp)return t.toString()===r.toString();if(a===Array){if((n=t.length)===r.length)for(;n--&&e(t[n],r[n]););return -1===n}if(!a||"object"==typeof t){for(a in n=0,t)if(s2.call(t,a)&&++n&&!s2.call(r,a)||!(a in r)||!e(t[a],r[a]))return!1;return Object.keys(r).length===n}}return t!=t&&r!=r},isPaused:()=>!1,cache:oZ,mutate:oI,fallback:{}},{isOnline:()=>os,isVisible:()=>{let e=oa&&document.visibilityState;return s3(e)||"hidden"!==e}}),oT=(0,Q.createContext)({});e.i(88130);let oA=or&&window.__SWR_DEVTOOLS_USE__;(oA?window.__SWR_DEVTOOLS_USE__:[]).concat(e=>(t,r,a)=>{let n=r&&((...e)=>{let[a]=o_(t),[,,,n]=s4.get(oZ);if(a.startsWith("$inf$"))return r(...e);let i=n[a];return s3(i)?r(...e):(delete n[a],i)});return e(t,n,a)}),oA&&(window.__SWR_DEVTOOLS_REACT__=Q.default);let oO=()=>{},oC=oO(),oR=(new WeakMap,Q.default.use||(e=>
26{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),o$={dedupe:!0},oN=Promise.resolve(s5);s9.defineProperty(e=>{let{value:t}=e,r=(0,Q.useContext)(oT),a="function"==typeof t,n=(0,Q.useMemo)(()=>a?t(r):t,[a,r,t]),i=(0,Q.useMemo)(()=>a?n:((e,t)=>{let r=s8(e,t);if(t){let{use:a,fallback:n}=e,{use:i,fallback:s}=t;a&&i&&(r.use=a.concat(i)),n&&s&&(r.fallback=s8(n,s))}return r})(r,n),[a,r,n]),s=n&&n.provider,o=(0,Q.useRef)(s5);s&&!o.current&&(o.current=ok(s(i.cache||oZ),n));let l=o.current;return l&&(i.cache=l[0],i.mutate=l[1]),op(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,Q.createElement)(oT.Provider,s8(e,{value:i}))},"defaultValue",{value:oS});var oj=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},oP=(e,t,r)=>(oj(e,t,"read from private field"),r?r.call(e):t.get(e)),oM=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},oL=(e,t,r,a)=>(oj(e,t,"write to private field"),a?a.call(e,r):t.set(e,r),r),oD=class{constructor(e=[]){oM(this,z,void 0),oM(this,V,"ready"),oM(this,W,void 0),oM(this,q,new Set),oM(this,J,new Set),oM(this,K,new Set),this.pushMessage=e=>{oL(this,z,oP(this,z).concat(e)),oP(this,G).call(this)},this.popMessage=()=>{oL(this,z,oP(this,z).slice(0,-1)),oP(this,G).call(this)},this.replaceMessage=(e,t)=>{oL(this,z,[...oP(this,z).slice(0,e),this.snapshot(t),...oP(this,z).slice(e+1)]),oP(this,G).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{let r=t?null!=t?(0,s0.default)(e,t):e:e;return oP(this,q).add(r),()=>{oP(this,q).delete(r)}},this["~registerStatusCallback"]=e=>(oP(this,J).add(e),()=>{oP(this,J).delete(e)}),this["~registerErrorCallback"]=e=>(oP(this,K).add(e),()=>{oP(this,K).delete(e)}),oM(this,G,()=>{oP(this,q).forEach(e=>e())}),oM(this,Y,()=>{oP(this,J).forEach(e=>e())}),oM(this,H,()=>{oP(this,K).forEach(e=>e())}),oL(this,z,e)}get status(){return oP(this,V)}set status(e){oL(this,V,e),oP(this,Y).call(this)}get error(){return oP(this,W)}set error(e){oL(this,W,e),oP(this,H).call(this)}get messages(){return oP(this,z)}set messages(e){oL(this,z,[...e]),oP(this,G).call(this)}};z=new WeakMap,V=new WeakMap,W=new WeakMap,q=new WeakMap,J=new WeakMap,K=new WeakMap,G=new WeakMap,Y=new WeakMap,H=new WeakMap;var oU=class extends sX{constructor({messages:e,...t}){const r=new oD(e);super({...t,state:r}),oM(this,X,void 0),this["~registerMessagesCallback"]=(e,t)=>oP(this,X)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>oP(this,X)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>oP(this,X)["~registerErrorCallback"](e),oL(this,X,r)}};function oB({experimental_throttle:e,resume:t=!1,...r}={}){let a=(0,Q.useRef)("chat"in r?r.chat:new oU(r));("chat"in r&&r.chat!==a.current||"id"in r&&a.current.id!==r.id)&&(a.current="chat"in r?r.chat:new oU(r));let n=(0,Q.useCallback)(t=>a.current["~registerMessagesCallback"](t,e),[e,a.current.id]),i=(0,Q.useSyncExternalStore)(n,()=>a.current.messages,()=>a.current.messages),s=(0,Q.useSyncExternalStore)(a.current["~registerStatusCallback"],()=>a.current.status,()=>a.current.status),o=(0,Q.useSyncExternalStore)(a.current["~registerErrorCallback"],()=>a.current.error,()=>a.current.error),l=(0,Q.useCallback)(e=>{"function"==typeof e&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,Q.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:i,setMessages:l,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:o,resumeStream:a.current.resumeStream,status:s,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}X=new WeakMap,e.s(["useChat",()=>oB],54586)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.