(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5419],{39588:(e,t,r)=>{"use strict";r.d(t,{E:()=>n});let n=(0,r(39142).l)('<path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 2.5H1.5V9.18933L2.96966 7.71967L3.18933 7.5H3.49999H6.63001H6.93933L6.96966 7.46967L10.4697 3.96967L11.5303 3.96967L14.5 6.93934V2.5ZM8.00066 8.55999L9.53034 10.0897L10.0607 10.62L9.00001 11.6807L8.46968 11.1503L6.31935 9H3.81065L1.53032 11.2803L1.5 11.3106V12.5C1.5 13.0523 1.94772 13.5 2.5 13.5H13.5C14.0523 13.5 14.5 13.0523 14.5 12.5V9.06066L11 5.56066L8.03032 8.53033L8.00066 8.55999ZM4.05312e-06 10.8107V12.5C4.05312e-06 13.8807 1.11929 15 2.5 15H13.5C14.8807 15 16 13.8807 16 12.5V9.56066L16.5607 9L16.0303 8.46967L16 8.43934V2.5V1H14.5H1.5H4.05312e-06V2.5V10.6893L-0.0606689 10.75L4.05312e-06 10.8107Z" fill="currentColor"/>')},76530:e=>{!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],l=i[1],u=new o((a+l)*3/4-l),c=0,f=l>0?a-4:a;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,l=n-o;a<l;a+=16383)i.push(function(e,t,n){for(var o,i=[],a=t;a<n;a+=3)i.push(r[(o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]))>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}(e,a,a+16383>l?l:a+16383));return 1===o?i.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===o&&i.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=i.length;a<l;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function s(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 n=r===t?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},72:function(e,t,r){"use strict";var n=r(675),o=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(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 c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!l.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|h(e,t),n=a(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return f(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(C(e,ArrayBuffer)||e&&C(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(C(e,SharedArrayBuffer)||e&&C(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;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(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),l.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);var o=function(e){if(l.isBuffer(e)){var t,r=0|p(e.length),n=a(r);return 0===n.length||e.copy(n,0,0,r),n}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.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 c(e){return u(e),a(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e){if(e>=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||C(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,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(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(o)return n?-1:T(e).length;t=(""+t).toLowerCase(),o=!0}}function d(e,t,r){var o,i,a=!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 n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=k[e[i]];return o}(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}(this,t,r);case"base64":return o=t,i=r,0===o&&i===this.length?n.fromByteArray(this):n.fromByteArray(this.slice(o,i));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){var i;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(i=r=+r)!=i&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return -1;r=e.length-1}else if(r<0){if(!o)return -1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,o);throw TypeError("val must be string, number or Buffer")}function m(e,t,r,n,o){var i,a=1,l=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,l/=2,s/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=r;i<l;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===s)return c*a}else -1!==c&&(i-=i-c),c=-1}else for(r+s>l&&(r=l-s),i=r;i>=0;i--){for(var f=!0,p=0;p<s;p++)if(u(e,i+p)!==u(t,p)){f=!1;break}if(f)return i}return -1}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,a,l,s,u=e[o],c=null,f=u>239?4:u>223?3:u>191?2:1;if(o+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:(192&(i=e[o+1]))==128&&(s=(31&u)<<6|63&i)>127&&(c=s);break;case 3:i=e[o+1],a=e[o+2],(192&i)==128&&(192&a)==128&&(s=(15&u)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=e[o+1],a=e[o+2],l=e[o+3],(192&i)==128&&(192&a)==128&&(192&l)==128&&(s=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&l)>65535&&s<1114112&&(c=s)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function b(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 v(e,t,r,n,o,i){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function w(e,t,r,n,o,i){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function _(e,t,r,n,i){return t=+t,r>>>=0,i||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,i){return t=+t,r>>>=0,i||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,n,52,8),r+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,l.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}}(),l.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(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},l.allocUnsafe=function(e){return c(e)},l.allocUnsafeSlow=function(e){return c(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(C(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),C(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.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,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(C(i,Uint8Array)&&(i=l.from(i)),!l.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},l.byteLength=h,l.prototype._isBuffer=!0,l.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)y(this,t,t+1);return this},l.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)y(this,t,t+3),y(this,t+1,t+2);return this},l.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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?E(this,0,e):d.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.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&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,o){if(C(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.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===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var i=o-n,a=r-t,s=Math.min(i,a),u=this.slice(n,o),c=e.slice(t,r),f=0;f<s;++f)if(u[f]!==c[f]){i=u[f],a=c[f];break}return i<a?-1:a<i?1:0},l.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o,i,a,l,s,u,c,f,p,h,d,y,g=this.length-t;if((void 0===r||r>g)&&(r=g),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var m=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var l=parseInt(t.substr(2*a,2),16);if(l!=l)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return s=t,u=r,R(T(e,this.length-s),this,s,u);case"ascii":return c=t,f=r,R(A(e),this,c,f);case"latin1":case"binary":return o=this,i=e,a=t,l=r,R(A(i),o,a,l);case"base64":return p=t,h=r,R(S(e),this,p,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,y=r,R(function(e,t){for(var r,n,o=[],i=0;i<e.length&&!((t-=2)<0);++i)n=(r=e.charCodeAt(i))>>8,o.push(r%256),o.push(n);return o}(e,this.length-d),this,d,y);default:if(m)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),m=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.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 n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;v(this,e,t,r,o,0)}var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},l.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;v(this,e,t,r,o,0)}var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);v(this,e,t,r,o-1,-o)}var i=0,a=1,l=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===l&&0!==this[t+i-1]&&(l=1),this[t+i]=(e/a>>0)-l&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);v(this,e,t,r,o-1,-o)}var i=r-1,a=1,l=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===l&&0!==this[t+i+1]&&(l=1),this[t+i]=(e/a>>0)-l&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return _(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return _(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===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(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=o-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return o},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var o,i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(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(o=t;o<r;++o)this[o]=e;else{var a=l.isBuffer(e)?e:l.from(e,n),s=a.length;if(0===s)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%s]}return this};var x=/[^+/0-9A-Za-z-_]/g;function T(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319||a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=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 A(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function S(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length)&&!(o>=e.length);++o)t[o+r]=e[o];return o}function C(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var k=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},783:function(e,t){t.read=function(e,t,r,n,o){var i,a,l=8*o-n-1,s=(1<<l)-1,u=s>>1,c=-7,f=r?o-1:0,p=r?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-c)-1,h>>=-c,c+=l;c>0;i=256*i+e[t+f],f+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+e[t+f],f+=p,c-=8);if(0===i)i=1-u;else{if(i===s)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=u}return(h?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var a,l,s,u=8*i-o-1,c=(1<<u)-1,f=c>>1,p=23===o?5960464477539062e-23:0,h=n?0:i-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(l=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),a+f>=1?t+=p/s:t+=p*Math.pow(2,1-f),t*s>=2&&(a++,s/=2),a+f>=c?(l=0,a=c):a+f>=1?(l=(t*s-1)*Math.pow(2,o),a+=f):(l=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[r+h]=255&l,h+=d,l/=256,o-=8);for(a=a<<o|l,u+=o;u>0;e[r+h]=255&a,h+=d,a/=256,u-=8);e[r+h-d]|=128*y}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}},a=!0;try{t[e](i,i.exports,n),a=!1}finally{a&&delete r[e]}return i.exports}n.ab="//";var o=n(72);e.exports=o}()},42698:(e,t,r)=>{"use strict";var n=r(76530).Buffer;let o=void 0!==n,i=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,a=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function l(e,t,r){null==r&&null!==t&&"object"==typeof t&&(r=t,t=void 0),o&&n.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let l=JSON.parse(e,t);if(null===l||"object"!=typeof l)return l;let u=r&&r.protoAction||"error",c=r&&r.constructorAction||"error";if("ignore"===u&&"ignore"===c)return l;if("ignore"!==u&&"ignore"!==c){if(!1===i.test(e)&&!1===a.test(e))return l}else if("ignore"!==u&&"ignore"===c){if(!1===i.test(e))return l}else if(!1===a.test(e))return l;return s(l,{protoAction:u,constructorAction:c,safe:r&&r.safe})}function s(e,{protoAction:t="error",constructorAction:r="error",safe:n}={}){let o=[e];for(;o.length;){let e=o;for(let i of(o=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(i,"__proto__")){if(!0===n)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete i.__proto__}if("ignore"!==r&&Object.prototype.hasOwnProperty.call(i,"constructor")&&Object.prototype.hasOwnProperty.call(i.constructor,"prototype")){if(!0===n)return null;if("error"===r)throw SyntaxError("Object contains forbidden prototype property");delete i.constructor}for(let e in i){let t=i[e];t&&"object"==typeof t&&o.push(t)}}}return e}function u(e,t,r){let n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return l(e,t,r)}finally{Error.stackTraceLimit=n}}e.exports=u,e.exports.default=u,e.exports.parse=u,e.exports.safeParse=function(e,t){let r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return l(e,t,{safe:!0})}catch(e){return null}finally{Error.stackTraceLimit=r}},e.exports.scan=s},5432:(e,t,r)=>{"use strict";r.d(t,{Ox:()=>o});let n=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n};r(42698),r(32608);var o=(({prefix:e="",size:t=7,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"}={})=>{let o=n(r,t);return t=>`${e}${o(t)}`})();Symbol.for("vercel.ai.validator");var{btoa:i,atob:a}=globalThis},70130:(e,t,r)=>{"use strict";r.d(t,{PL:()=>C,V6:()=>B,fe:()=>D});var n=r(5432),o=r(42698);Symbol("Let zodToJsonSchema decide on which parser to use");let i=(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("/")};var a={code:"0",name:"text",parse:e=>{if("string"!=typeof e)throw Error('"text" parts expect a string value.');return{type:"text",value:e}}},l={code:"1",name:"function_call",parse:e=>{if(null==e||"object"!=typeof e||!("function_call"in e)||"object"!=typeof e.function_call||null==e.function_call||!("name"in e.function_call)||!("arguments"in e.function_call)||"string"!=typeof e.function_call.name||"string"!=typeof e.function_call.arguments)throw Error('"function_call" parts expect an object with a "function_call" property.');return{type:"function_call",value:e}}},s={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw Error('"data" parts expect an array value.');return{type:"data",value:e}}},u={code:"3",name:"error",parse:e=>{if("string"!=typeof e)throw Error('"error" parts expect a string value.');return{type:"error",value:e}}},c={code:"4",name:"assistant_message",parse:e=>{if(null==e||"object"!=typeof e||!("id"in e)||!("role"in e)||!("content"in e)||"string"!=typeof e.id||"string"!=typeof e.role||"assistant"!==e.role||!Array.isArray(e.content)||!e.content.every(e=>null!=e&&"object"==typeof e&&"type"in e&&"text"===e.type&&"text"in e&&null!=e.text&&"object"==typeof e.text&&"value"in e.text&&"string"==typeof e.text.value))throw Error('"assistant_message" parts expect an object with an "id", "role", and "content" property.');return{type:"assistant_message",value:e}}},f={code:"5",name:"assistant_control_data",parse:e=>{if(null==e||"object"!=typeof e||!("threadId"in e)||!("messageId"in e)||"string"!=typeof e.threadId||"string"!=typeof e.messageId)throw Error('"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.');return{type:"assistant_control_data",value:{threadId:e.threadId,messageId:e.messageId}}}},p={code:"6",name:"data_message",parse:e=>{if(null==e||"object"!=typeof e||!("role"in e)||!("data"in e)||"string"!=typeof e.role||"data"!==e.role)throw Error('"data_message" parts expect an object with a "role" and "data" property.');return{type:"data_message",value:e}}},h={code:"7",name:"tool_calls",parse:e=>{if(null==e||"object"!=typeof e||!("tool_calls"in e)||"object"!=typeof e.tool_calls||null==e.tool_calls||!Array.isArray(e.tool_calls)||e.tool_calls.some(e=>null==e||"object"!=typeof e||!("id"in e)||"string"!=typeof e.id||!("type"in e)||"string"!=typeof e.type||!("function"in e)||null==e.function||"object"!=typeof e.function||!("arguments"in e.function)||"string"!=typeof e.function.name||"string"!=typeof e.function.arguments))throw Error('"tool_calls" parts expect an object with a ToolCallPayload.');return{type:"tool_calls",value:e}}},d={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},y={code:"9",name:"tool_call",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("toolName"in e)||"string"!=typeof e.toolName||!("args"in e)||"object"!=typeof e.args)throw Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},g={code:"a",name:"tool_result",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("result"in e))throw Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},m={code:"b",name:"tool_call_streaming_start",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("toolName"in e)||"string"!=typeof e.toolName)throw Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},E={code:"c",name:"tool_call_delta",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("argsTextDelta"in e)||"string"!=typeof e.argsTextDelta)throw Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},b={code:"d",name:"finish_message",parse:e=>{if(null==e||"object"!=typeof e||!("finishReason"in e)||"string"!=typeof e.finishReason)throw Error('"finish_message" parts expect an object with a "finishReason" property.');let t={finishReason:e.finishReason};return"usage"in e&&null!=e.usage&&"object"==typeof e.usage&&"promptTokens"in e.usage&&"completionTokens"in e.usage&&(t.usage={promptTokens:"number"==typeof e.usage.promptTokens?e.usage.promptTokens:Number.NaN,completionTokens:"number"==typeof e.usage.completionTokens?e.usage.completionTokens:Number.NaN}),{type:"finish_message",value:t}}},v={code:"e",name:"finish_step",parse:e=>{if(null==e||"object"!=typeof e||!("finishReason"in e)||"string"!=typeof e.finishReason)throw Error('"finish_step" parts expect an object with a "finishReason" property.');let t={finishReason:e.finishReason};return"usage"in e&&null!=e.usage&&"object"==typeof e.usage&&"promptTokens"in e.usage&&"completionTokens"in e.usage&&(t.usage={promptTokens:"number"==typeof e.usage.promptTokens?e.usage.promptTokens:Number.NaN,completionTokens:"number"==typeof e.usage.completionTokens?e.usage.completionTokens:Number.NaN}),{type:"finish_step",value:t}}},w=[a,l,s,u,c,f,p,h,d,y,g,m,E,b,v],_={[a.code]:a,[l.code]:l,[s.code]:s,[u.code]:u,[c.code]:c,[f.code]:f,[p.code]:p,[h.code]:h,[d.code]:d,[y.code]:y,[g.code]:g,[m.code]:m,[E.code]:E,[b.code]:b,[v.code]:v};a.name,a.code,l.name,l.code,s.name,s.code,u.name,u.code,c.name,c.code,f.name,f.code,p.name,p.code,h.name,h.code,d.name,d.code,y.name,y.code,g.name,g.code,m.name,m.code,E.name,E.code,b.name,b.code,v.name,v.code;var I=w.map(e=>e.code),x=e=>{let t=e.indexOf(":");if(-1===t)throw Error("Failed to parse stream string. No separator found.");let r=e.slice(0,t);if(!I.includes(r))throw Error(`Failed to parse stream string. Invalid code ${r}.`);let n=JSON.parse(e.slice(t+1));return _[r].parse(n)};async function*T(e,{isAborted:t}={}){let r=new TextDecoder,n=[],o=0;for(;;){let{value:i}=await e.read();if(i&&(n.push(i),o+=i.length,10!==i[i.length-1]))continue;if(0===n.length)break;let a=function(e,t){let r=new Uint8Array(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return e.length=0,r}(n,o);for(let e of(o=0,r.decode(a,{stream:!0}).split("\n").filter(e=>""!==e).map(x)))yield e;if(null==t?void 0:t()){e.cancel();break}}}function A(e,t){return e&&t&&t.length?{...e,annotations:[...t]}:e}async function S({reader:e,abortControllerRef:t,update:r,onToolCall:i,onFinish:a,generateId:l=n.Ox,getCurrentDate:s=()=>new Date}){var u;let c,f;let p=s(),h={},d=[],y=[],g={},m={completionTokens:NaN,promptTokens:NaN,totalTokens:NaN},E="unknown";for await(let{type:n,value:a}of T(e,{isAborted:()=>(null==t?void 0:t.current)===null})){if("error"===n)throw Error(a);if("finish_step"===n){c={};continue}if("finish_message"===n){if(E=a.finishReason,null!=a.usage){let{completionTokens:e,promptTokens:t}=a.usage;m={completionTokens:e,promptTokens:t,totalTokens:e+t}}continue}if(c&&(h.text&&d.push(h.text),h.function_call&&d.push(h.function_call),h.tool_calls&&d.push(h.tool_calls),h=c,c=void 0),"text"===n&&(h.text?h.text={...h.text,content:(h.text.content||"")+a}:h.text={id:l(),role:"assistant",content:a,createdAt:p}),"tool_call_streaming_start"===n)null==h.text&&(h.text={id:l(),role:"assistant",content:"",createdAt:p}),null==h.text.toolInvocations&&(h.text.toolInvocations=[]),g[a.toolCallId]={text:"",toolName:a.toolName,prefixMapIndex:h.text.toolInvocations.length},h.text.toolInvocations.push({state:"partial-call",toolCallId:a.toolCallId,toolName:a.toolName,args:void 0});else if("tool_call_delta"===n){let e=g[a.toolCallId];e.text+=a.argsTextDelta;let{value:t}=function(e){if(void 0===e)return{value:void 0,state:"undefined-input"};try{return{value:o.parse(e),state:"successful-parse"}}catch(t){try{return{value:o.parse(function(e){let t=["ROOT"],r=-1,n=null;function o(e,o,i){switch(e){case'"':r=o,t.pop(),t.push(i),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=o,n=o,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=o,t.pop(),t.push(i),t.push("INSIDE_NUMBER");break;case"{":r=o,t.pop(),t.push(i),t.push("INSIDE_OBJECT_START");break;case"[":r=o,t.pop(),t.push(i),t.push("INSIDE_ARRAY_START")}}function i(e,n){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=n,t.pop()}}function a(e,n){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=n,t.pop()}}for(let l=0;l<e.length;l++){let s=e[l];switch(t[t.length-1]){case"ROOT":o(s,l,"FINISH");break;case"INSIDE_OBJECT_START":switch(s){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=l,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===s&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===s&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===s&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":o(s,l,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":i(s,l);break;case"INSIDE_STRING":switch(s){case'"':t.pop(),r=l;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=l}break;case"INSIDE_ARRAY_START":"]"===s?(r=l,t.pop()):(r=l,o(s,l,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(s){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=l,t.pop();break;default:r=l}break;case"INSIDE_ARRAY_AFTER_COMMA":o(s,l,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),r=l;break;case"INSIDE_NUMBER":switch(s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=l;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&a(s,l),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&i(s,l);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&i(s,l);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&a(s,l);break;default:t.pop()}break;case"INSIDE_LITERAL":{let o=e.substring(n,l+1);"false".startsWith(o)||"true".startsWith(o)||"null".startsWith(o)?r=l:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?i(s,l):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&a(s,l))}}}let l=e.slice(0,r+1);for(let r=t.length-1;r>=0;r--)switch(t[r]){case"INSIDE_STRING":l+='"';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":l+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":l+="]";break;case"INSIDE_LITERAL":{let t=e.substring(n,e.length);"true".startsWith(t)?l+="true".slice(t.length):"false".startsWith(t)?l+="false".slice(t.length):"null".startsWith(t)&&(l+="null".slice(t.length))}}return l}(e)),state:"repaired-parse"}}catch(e){}}return{value:void 0,state:"failed-parse"}}(e.text);h.text.toolInvocations[e.prefixMapIndex]={state:"partial-call",toolCallId:a.toolCallId,toolName:e.toolName,args:t},h.text.internalUpdateId=l()}else if("tool_call"===n){if(null!=g[a.toolCallId]?h.text.toolInvocations[g[a.toolCallId].prefixMapIndex]={state:"call",...a}:(null==h.text&&(h.text={id:l(),role:"assistant",content:"",createdAt:p}),null==h.text.toolInvocations&&(h.text.toolInvocations=[]),h.text.toolInvocations.push({state:"call",...a})),h.text.internalUpdateId=l(),i){let e=await i({toolCall:a});null!=e&&(h.text.toolInvocations[h.text.toolInvocations.length-1]={state:"result",...a,result:e})}}else if("tool_result"===n){let e=null==(u=h.text)?void 0:u.toolInvocations;if(null==e)throw Error("tool_result must be preceded by a tool_call");let t=e.findIndex(e=>e.toolCallId===a.toolCallId);if(-1===t)throw Error("tool_result must be preceded by a tool_call with the same toolCallId");e[t]={...e[t],state:"result",...a}}let e=null;"function_call"===n&&(h.function_call={id:l(),role:"assistant",content:"",function_call:a.function_call,name:a.function_call.name,createdAt:p},e=h.function_call);let t=null;"tool_calls"===n&&(h.tool_calls={id:l(),role:"assistant",content:"",tool_calls:a.tool_calls,createdAt:p},t=h.tool_calls),"data"===n&&y.push(...a);let s=h.text;"message_annotations"===n&&(f?f.push(...a):f=[...a],e=A(h.function_call,f),t=A(h.tool_calls,f),s=A(h.text,f)),(null==f?void 0:f.length)&&(h.text&&(h.text.annotations=[...f]),h.function_call&&(h.function_call.annotations=[...f]),h.tool_calls&&(h.tool_calls.annotations=[...f])),r([...d,...[e,t,s].filter(Boolean).map(e=>({...A(e,f)}))],[...y])}return null==a||a({message:h.text,finishReason:E,usage:m}),{messages:[h.text,h.function_call,h.tool_calls].filter(Boolean),data:y}}var R=()=>fetch;async function C({api:e,body:t,streamProtocol:r="data",credentials:n,headers:o,abortController:i,restoreMessagesOnFailure:a,onResponse:l,onUpdate:s,onFinish:u,onToolCall:c,generateId:f,fetch:p=R()}){var h,d;let y=await p(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",...o},signal:null==(h=null==i?void 0:i())?void 0:h.signal,credentials:n}).catch(e=>{throw a(),e});if(l)try{await l(y)}catch(e){throw e}if(!y.ok)throw a(),Error(null!=(d=await y.text())?d:"Failed to fetch the chat response.");if(!y.body)throw Error("The response body is empty.");let g=y.body.getReader();switch(r){case"text":{let e=N(),t={id:f(),createdAt:new Date,role:"assistant",content:""};for(;;){let{done:r,value:n}=await g.read();if(r)break;if(t.content+=e(n),s([{...t}],[]),(null==i?void 0:i())===null){g.cancel();break}}return null==u||u(t,{usage:{completionTokens:NaN,promptTokens:NaN,totalTokens:NaN},finishReason:"unknown"}),{messages:[t],data:[]}}case"data":return await S({reader:g,abortControllerRef:null!=i?{current:i()}:void 0,update:s,onToolCall:c,onFinish({message:e,finishReason:t,usage:r}){u&&null!=e&&u(e,{usage:r,finishReason:t})},generateId:f});default:throw Error(`Unknown stream protocol: ${r}`)}}var k=()=>fetch;async function B({api:e,prompt:t,credentials:r,headers:n,body:o,streamProtocol:i="data",setCompletion:a,setLoading:l,setError:s,setAbortController:u,onResponse:c,onFinish:f,onError:p,onData:h,fetch:d=k()}){try{l(!0),s(void 0);let p=new AbortController;u(p),a("");let y=await d(e,{method:"POST",body:JSON.stringify({prompt:t,...o}),credentials:r,headers:{"Content-Type":"application/json",...n},signal:p.signal}).catch(e=>{throw e});if(c)try{await c(y)}catch(e){throw e}if(!y.ok)throw Error(await y.text()||"Failed to fetch the chat response.");if(!y.body)throw Error("The response body is empty.");let g="",m=y.body.getReader();switch(i){case"text":{let e=N();for(;;){let{done:t,value:r}=await m.read();if(t)break;if(g+=e(r),a(g),null===p){m.cancel();break}}break}case"data":for await(let{type:e,value:t}of T(m,{isAborted:()=>null===p}))switch(e){case"text":g+=t,a(g);break;case"data":null==h||h(t)}break;default:throw Error(`Unknown stream protocol: ${i}`)}return f&&f(t,g),u(null),g}catch(e){if("AbortError"===e.name)return u(null),null;e instanceof Error&&p&&p(e),s(e)}finally{l(!1)}}function N(e){let t=new TextDecoder;return e?function(e){return t.decode(e,{stream:!0}).split("\n").filter(e=>""!==e).map(x).filter(Boolean)}:function(e){return e?t.decode(e,{stream:!0}):""}}async function D({getStreamedResponse:e,experimental_onFunctionCall:t,experimental_onToolCall:r,updateChatRequest:n,getCurrentMessages:o}){for(;;){let i=await e();if("messages"in i){let e=!1;for(let a of i.messages)if(void 0!==a.function_call&&"string"!=typeof a.function_call||void 0!==a.tool_calls&&"string"!=typeof a.tool_calls){if(e=!0,t){let r=a.function_call;if("object"!=typeof r){console.warn("experimental_onFunctionCall should not be defined when using tools");continue}let i=await t(o(),r);if(void 0===i){e=!1;break}n(i)}if(r){let t=a.tool_calls;if(!Array.isArray(t)||t.some(e=>"object"!=typeof e)){console.warn("experimental_onToolCall should not be defined when using tools");continue}let i=await r(o(),t);if(void 0===i){e=!1;break}n(i)}}if(!e)break}else{let e=function(e){for(let t of e.messages){if(void 0!==t.tool_calls)for(let e of t.tool_calls)"object"==typeof e&&e.function.arguments&&"string"!=typeof e.function.arguments&&(e.function.arguments=JSON.stringify(e.function.arguments));void 0!==t.function_call&&"object"==typeof t.function_call&&t.function_call.arguments&&"string"!=typeof t.function_call.arguments&&(t.function_call.arguments=JSON.stringify(t.function_call.arguments))}};if((void 0===i.function_call||"string"==typeof i.function_call)&&(void 0===i.tool_calls||"string"==typeof i.tool_calls))break;if(t){let r=i.function_call;if("object"!=typeof r){console.warn("experimental_onFunctionCall should not be defined when using tools");continue}let a=await t(o(),r);if(void 0===a)break;e(a),n(a)}if(r){let t=i.tool_calls;if("object"!=typeof t){console.warn("experimental_onToolCall should not be defined when using functions");continue}let a=await r(o(),t);if(void 0===a)break;e(a),n(a)}}}}Symbol.for("vercel.ai.schema")},72574:(e,t,r)=>{"use strict";function n(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}r.d(t,{Z:()=>n})},13698:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(84173);let o=n.forwardRef(function(e,t){let{title:r,titleId:o,...i}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":o},i),r?n.createElement("title",{id:o},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))})},41750:(e,t,r)=>{"use strict";function n(e,[t,r]){return Math.min(r,Math.max(t,e))}r.d(t,{u:()=>n})},69084:(e,t,r)=>{"use strict";r.d(t,{B:()=>l});var n=r(84173),o=r(15564),i=r(71875),a=r(84781);function l(e){let t=e+"CollectionProvider",[r,l]=(0,o.b)(t),[s,u]=r(t,{collectionRef:{current:null},itemMap:new Map}),c=e+"CollectionSlot",f=n.forwardRef((e,t)=>{let{scope:r,children:o}=e,l=u(c,r),s=(0,i.e)(t,l.collectionRef);return n.createElement(a.g7,{ref:s},o)}),p=e+"CollectionItemSlot",h="data-radix-collection-item";return[{Provider:e=>{let{scope:t,children:r}=e,o=n.useRef(null),i=n.useRef(new Map).current;return n.createElement(s,{scope:t,itemMap:i,collectionRef:o},r)},Slot:f,ItemSlot:n.forwardRef((e,t)=>{let{scope:r,children:o,...l}=e,s=n.useRef(null),c=(0,i.e)(t,s),f=u(p,r);return n.useEffect(()=>(f.itemMap.set(s,{ref:s,...l}),()=>void f.itemMap.delete(s))),n.createElement(a.g7,{[h]:"",ref:c},o)})},function(t){let r=u(e+"CollectionConsumer",t);return n.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},l]}},44322:(e,t,r)=>{"use strict";r.d(t,{gm:()=>i});var n=r(84173);let o=(0,n.createContext)(void 0);function i(e){let t=(0,n.useContext)(o);return e||t||"ltr"}},16295:(e,t,r)=>{"use strict";r.d(t,{bU:()=>H,e6:()=>J,fC:()=>V,fQ:()=>Y});var n=r(34109),o=r(84173),i=r(41750),a=r(89641),l=r(71875),s=r(15564),u=r(7340),c=r(44322),f=r(81001),p=r(42638),h=r(69663),d=r(69084);let y=["PageUp","PageDown"],g=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],m={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},E="Slider",[b,v,w]=(0,d.B)(E),[_,I]=(0,s.b)(E,[w]),[x,T]=_(E),A=(0,o.forwardRef)((e,t)=>{let{name:r,min:s=0,max:c=100,step:f=1,orientation:p="horizontal",disabled:h=!1,minStepsBetweenThumbs:d=0,defaultValue:m=[s],value:E,onValueChange:v=()=>{},onValueCommit:w=()=>{},inverted:_=!1,...I}=e,[T,A]=(0,o.useState)(null),S=(0,l.e)(t,e=>A(e)),R=(0,o.useRef)(new Set),B=(0,o.useRef)(0),N="horizontal"===p,D=!T||!!T.closest("form"),[O=[],L]=(0,u.T)({prop:E,defaultProp:m,onChange:e=>{var t;null===(t=[...R.current][B.current])||void 0===t||t.focus(),v(e)}}),M=(0,o.useRef)(O);function U(e,t,{commit:r}={commit:!1}){let n=(String(f).split(".")[1]||"").length,o=function(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}(Math.round((e-s)/f)*f+s,n),a=(0,i.u)(o,[s,c]);L((e=[])=>{var n,o;let i=function(e=[],t,r){let n=[...e];return n[r]=t,n.sort((e,t)=>e-t)}(e,a,t);if(n=i,!(!((o=d*f)>0)||Math.min(...n.slice(0,-1).map((e,t)=>n[t+1]-e))>=o))return e;{B.current=i.indexOf(a);let t=String(i)!==String(e);return t&&r&&w(i),t?i:e}})}return(0,o.createElement)(x,{scope:e.__scopeSlider,disabled:h,min:s,max:c,valueIndexToChangeRef:B,thumbs:R.current,values:O,orientation:p},(0,o.createElement)(b.Provider,{scope:e.__scopeSlider},(0,o.createElement)(b.Slot,{scope:e.__scopeSlider},(0,o.createElement)(N?C:k,(0,n.Z)({"aria-disabled":h,"data-disabled":h?"":void 0},I,{ref:S,onPointerDown:(0,a.M)(I.onPointerDown,()=>{h||(M.current=O)}),min:s,max:c,inverted:_,onSlideStart:h?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let r=e.map(e=>Math.abs(e-t)),n=Math.min(...r);return r.indexOf(n)}(O,e);U(e,t)},onSlideMove:h?void 0:function(e){U(e,B.current)},onSlideEnd:h?void 0:function(){let e=M.current[B.current];O[B.current]!==e&&w(O)},onHomeKeyDown:()=>!h&&U(s,0,{commit:!0}),onEndKeyDown:()=>!h&&U(c,O.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!h){let r=y.includes(e.key)||e.shiftKey&&g.includes(e.key),n=B.current;U(O[n]+f*(r?10:1)*t,n,{commit:!0})}}})))),D&&O.map((e,t)=>(0,o.createElement)(P,{key:t,name:r?r+(O.length>1?"[]":""):void 0,value:e})))}),[S,R]=_(E,{startEdge:"left",endEdge:"right",size:"width",direction:1}),C=(0,o.forwardRef)((e,t)=>{let{min:r,max:i,dir:a,inverted:s,onSlideStart:u,onSlideMove:f,onSlideEnd:p,onStepKeyDown:h,...d}=e,[y,g]=(0,o.useState)(null),E=(0,l.e)(t,e=>g(e)),b=(0,o.useRef)(),v=(0,c.gm)(a),w="ltr"===v,_=w&&!s||!w&&s;function I(e){let t=b.current||y.getBoundingClientRect(),n=F([0,t.width],_?[r,i]:[i,r]);return b.current=t,n(e-t.left)}return(0,o.createElement)(S,{scope:e.__scopeSlider,startEdge:_?"left":"right",endEdge:_?"right":"left",direction:_?1:-1,size:"width"},(0,o.createElement)(B,(0,n.Z)({dir:v,"data-orientation":"horizontal"},d,{ref:E,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=I(e.clientX);null==u||u(t)},onSlideMove:e=>{let t=I(e.clientX);null==f||f(t)},onSlideEnd:()=>{b.current=void 0,null==p||p()},onStepKeyDown:e=>{let t=m[_?"from-left":"from-right"].includes(e.key);null==h||h({event:e,direction:t?-1:1})}})))}),k=(0,o.forwardRef)((e,t)=>{let{min:r,max:i,inverted:a,onSlideStart:s,onSlideMove:u,onSlideEnd:c,onStepKeyDown:f,...p}=e,h=(0,o.useRef)(null),d=(0,l.e)(t,h),y=(0,o.useRef)(),g=!a;function E(e){let t=y.current||h.current.getBoundingClientRect(),n=F([0,t.height],g?[i,r]:[r,i]);return y.current=t,n(e-t.top)}return(0,o.createElement)(S,{scope:e.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1},(0,o.createElement)(B,(0,n.Z)({"data-orientation":"vertical"},p,{ref:d,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=E(e.clientY);null==s||s(t)},onSlideMove:e=>{let t=E(e.clientY);null==u||u(t)},onSlideEnd:()=>{y.current=void 0,null==c||c()},onStepKeyDown:e=>{let t=m[g?"from-bottom":"from-top"].includes(e.key);null==f||f({event:e,direction:t?-1:1})}})))}),B=(0,o.forwardRef)((e,t)=>{let{__scopeSlider:r,onSlideStart:i,onSlideMove:l,onSlideEnd:s,onHomeKeyDown:u,onEndKeyDown:c,onStepKeyDown:f,...p}=e,d=T(E,r);return(0,o.createElement)(h.WV.span,(0,n.Z)({},p,{ref:t,onKeyDown:(0,a.M)(e.onKeyDown,e=>{"Home"===e.key?(u(e),e.preventDefault()):"End"===e.key?(c(e),e.preventDefault()):y.concat(g).includes(e.key)&&(f(e),e.preventDefault())}),onPointerDown:(0,a.M)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),d.thumbs.has(t)?t.focus():i(e)}),onPointerMove:(0,a.M)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&l(e)}),onPointerUp:(0,a.M)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),s(e))})}))}),N=(0,o.forwardRef)((e,t)=>{let{__scopeSlider:r,...i}=e,a=T("SliderTrack",r);return(0,o.createElement)(h.WV.span,(0,n.Z)({"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation},i,{ref:t}))}),D="SliderRange",O=(0,o.forwardRef)((e,t)=>{let{__scopeSlider:r,...i}=e,a=T(D,r),s=R(D,r),u=(0,o.useRef)(null),c=(0,l.e)(t,u),f=a.values.length,p=a.values.map(e=>j(e,a.min,a.max)),d=f>1?Math.min(...p):0,y=100-Math.max(...p);return(0,o.createElement)(h.WV.span,(0,n.Z)({"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0},i,{ref:c,style:{...e.style,[s.startEdge]:d+"%",[s.endEdge]:y+"%"}}))}),L="SliderThumb",M=(0,o.forwardRef)((e,t)=>{let r=v(e.__scopeSlider),[i,a]=(0,o.useState)(null),s=(0,l.e)(t,e=>a(e)),u=(0,o.useMemo)(()=>i?r().findIndex(e=>e.ref.current===i):-1,[r,i]);return(0,o.createElement)(U,(0,n.Z)({},e,{ref:s,index:u}))}),U=(0,o.forwardRef)((e,t)=>{let{__scopeSlider:r,index:i,...s}=e,u=T(L,r),c=R(L,r),[f,d]=(0,o.useState)(null),y=(0,l.e)(t,e=>d(e)),g=(0,p.t)(f),m=u.values[i],E=void 0===m?0:j(m,u.min,u.max),v=function(e,t){return t>2?`Value ${e+1} of ${t}`:2===t?["Minimum","Maximum"][e]:void 0}(i,u.values.length),w=null==g?void 0:g[c.size],_=w?function(e,t,r){let n=e/2,o=F([0,50],[0,n]);return(n-o(t)*r)*r}(w,E,c.direction):0;return(0,o.useEffect)(()=>{if(f)return u.thumbs.add(f),()=>{u.thumbs.delete(f)}},[f,u.thumbs]),(0,o.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${E}% + ${_}px)`}},(0,o.createElement)(b.ItemSlot,{scope:e.__scopeSlider},(0,o.createElement)(h.WV.span,(0,n.Z)({role:"slider","aria-label":e["aria-label"]||v,"aria-valuemin":u.min,"aria-valuenow":m,"aria-valuemax":u.max,"aria-orientation":u.orientation,"data-orientation":u.orientation,"data-disabled":u.disabled?"":void 0,tabIndex:u.disabled?void 0:0},s,{ref:y,style:void 0===m?{display:"none"}:e.style,onFocus:(0,a.M)(e.onFocus,()=>{u.valueIndexToChangeRef.current=i})}))))}),P=e=>{let{value:t,...r}=e,i=(0,o.useRef)(null),a=(0,f.D)(t);return(0,o.useEffect)(()=>{let e=i.current,r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(a!==t&&r){let n=new Event("input",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[a,t]),(0,o.createElement)("input",(0,n.Z)({style:{display:"none"}},r,{ref:i,defaultValue:t}))};function j(e,t,r){return(0,i.u)(100/(r-t)*(e-t),[0,100])}function F(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}let V=A,Y=N,J=O,H=M},61779:(e,t,r)=>{"use strict";r.d(t,{VY:()=>V,fC:()=>P,h_:()=>F,xz:()=>j,zt:()=>U});var n=r(34109),o=r(84173),i=r(89641),a=r(71875),l=r(15564),s=r(40209),u=r(43182),c=r(49452),f=r(51068),p=r(945),h=r(69663),d=r(84781),y=r(7340),g=r(18936);let[m,E]=(0,l.b)("Tooltip",[c.D7]),b=(0,c.D7)(),v="tooltip.open",[w,_]=m("TooltipProvider"),I="Tooltip",[x,T]=m(I),A="TooltipTrigger",S=(0,o.forwardRef)((e,t)=>{let{__scopeTooltip:r,...l}=e,s=T(A,r),u=_(A,r),f=b(r),p=(0,o.useRef)(null),d=(0,a.e)(t,p,s.onTriggerChange),y=(0,o.useRef)(!1),g=(0,o.useRef)(!1),m=(0,o.useCallback)(()=>y.current=!1,[]);return(0,o.useEffect)(()=>()=>document.removeEventListener("pointerup",m),[m]),(0,o.createElement)(c.ee,(0,n.Z)({asChild:!0},f),(0,o.createElement)(h.WV.button,(0,n.Z)({"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute},l,{ref:d,onPointerMove:(0,i.M)(e.onPointerMove,e=>{"touch"===e.pointerType||g.current||u.isPointerInTransitRef.current||(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:(0,i.M)(e.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:(0,i.M)(e.onPointerDown,()=>{y.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:(0,i.M)(e.onFocus,()=>{y.current||s.onOpen()}),onBlur:(0,i.M)(e.onBlur,s.onClose),onClick:(0,i.M)(e.onClick,s.onClose)})))}),R="TooltipPortal",[C,k]=m(R,{forceMount:void 0}),B="TooltipContent",N=(0,o.forwardRef)((e,t)=>{let r=k(B,e.__scopeTooltip),{forceMount:i=r.forceMount,side:a="top",...l}=e,s=T(B,e.__scopeTooltip);return(0,o.createElement)(p.z,{present:i||s.open},s.disableHoverableContent?(0,o.createElement)(M,(0,n.Z)({side:a},l,{ref:t})):(0,o.createElement)(D,(0,n.Z)({side:a},l,{ref:t})))}),D=(0,o.forwardRef)((e,t)=>{let r=T(B,e.__scopeTooltip),i=_(B,e.__scopeTooltip),l=(0,o.useRef)(null),s=(0,a.e)(t,l),[u,c]=(0,o.useState)(null),{trigger:f,onClose:p}=r,h=l.current,{onPointerInTransitChange:d}=i,y=(0,o.useCallback)(()=>{c(null),d(!1)},[d]),g=(0,o.useCallback)((e,t)=>{let r=e.currentTarget,n={x:e.clientX,y:e.clientY},o=function(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,o,i)){case i:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}(n,r.getBoundingClientRect());c(function(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r<e.length;r++){let n=e[r];for(;t.length>=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x))t.pop();else break}t.push(n)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let n=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x))r.pop();else break}r.push(n)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}(t)}([...function(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}(n,o),...function(e){let{top:t,right:r,bottom:n,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:n},{x:o,y:n}]}(t.getBoundingClientRect())])),d(!0)},[d]);return(0,o.useEffect)(()=>()=>y(),[y]),(0,o.useEffect)(()=>{if(f&&h){let e=e=>g(e,h),t=e=>g(e,f);return f.addEventListener("pointerleave",e),h.addEventListener("pointerleave",t),()=>{f.removeEventListener("pointerleave",e),h.removeEventListener("pointerleave",t)}}},[f,h,g,y]),(0,o.useEffect)(()=>{if(u){let e=e=>{let t=e.target,r={x:e.clientX,y:e.clientY},n=(null==f?void 0:f.contains(t))||(null==h?void 0:h.contains(t)),o=!function(e,t){let{x:r,y:n}=e,o=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let a=t[e].x,l=t[e].y,s=t[i].x,u=t[i].y;l>n!=u>n&&r<(s-a)*(n-l)/(u-l)+a&&(o=!o)}return o}(r,u);n?y():o&&(y(),p())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[f,h,u,p,y]),(0,o.createElement)(M,(0,n.Z)({},e,{ref:s}))}),[O,L]=m(I,{isInside:!1}),M=(0,o.forwardRef)((e,t)=>{let{__scopeTooltip:r,children:i,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:u,...f}=e,p=T(B,r),h=b(r),{onClose:y}=p;return(0,o.useEffect)(()=>(document.addEventListener(v,y),()=>document.removeEventListener(v,y)),[y]),(0,o.useEffect)(()=>{if(p.trigger){let e=e=>{let t=e.target;null!=t&&t.contains(p.trigger)&&y()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[p.trigger,y]),(0,o.createElement)(s.XB,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:e=>e.preventDefault(),onDismiss:y},(0,o.createElement)(c.VY,(0,n.Z)({"data-state":p.stateAttribute},h,f,{ref:t,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),(0,o.createElement)(d.A4,null,i),(0,o.createElement)(O,{scope:r,isInside:!0},(0,o.createElement)(g.f,{id:p.contentId,role:"tooltip"},a||i))))}),U=e=>{let{__scopeTooltip:t,delayDuration:r=700,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:a}=e,[l,s]=(0,o.useState)(!0),u=(0,o.useRef)(!1),c=(0,o.useRef)(0);return(0,o.useEffect)(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,o.createElement)(w,{scope:t,isOpenDelayed:l,delayDuration:r,onOpen:(0,o.useCallback)(()=>{window.clearTimeout(c.current),s(!1)},[]),onClose:(0,o.useCallback)(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:(0,o.useCallback)(e=>{u.current=e},[]),disableHoverableContent:i},a)},P=e=>{let{__scopeTooltip:t,children:r,open:n,defaultOpen:i=!1,onOpenChange:a,disableHoverableContent:l,delayDuration:s}=e,f=_(I,e.__scopeTooltip),p=b(t),[h,d]=(0,o.useState)(null),g=(0,u.M)(),m=(0,o.useRef)(0),E=null!=l?l:f.disableHoverableContent,w=null!=s?s:f.delayDuration,T=(0,o.useRef)(!1),[A=!1,S]=(0,y.T)({prop:n,defaultProp:i,onChange:e=>{e?(f.onOpen(),document.dispatchEvent(new CustomEvent(v))):f.onClose(),null==a||a(e)}}),R=(0,o.useMemo)(()=>A?T.current?"delayed-open":"instant-open":"closed",[A]),C=(0,o.useCallback)(()=>{window.clearTimeout(m.current),T.current=!1,S(!0)},[S]),k=(0,o.useCallback)(()=>{window.clearTimeout(m.current),S(!1)},[S]),B=(0,o.useCallback)(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{T.current=!0,S(!0)},w)},[w,S]);return(0,o.useEffect)(()=>()=>window.clearTimeout(m.current),[]),(0,o.createElement)(c.fC,p,(0,o.createElement)(x,{scope:t,contentId:g,open:A,stateAttribute:R,trigger:h,onTriggerChange:d,onTriggerEnter:(0,o.useCallback)(()=>{f.isOpenDelayed?B():C()},[f.isOpenDelayed,B,C]),onTriggerLeave:(0,o.useCallback)(()=>{E?k():window.clearTimeout(m.current)},[k,E]),onOpen:C,onClose:k,disableHoverableContent:E},r))},j=S,F=e=>{let{__scopeTooltip:t,forceMount:r,children:n,container:i}=e,a=T(R,t);return(0,o.createElement)(C,{scope:t,forceMount:r},(0,o.createElement)(p.z,{present:r||a.open},(0,o.createElement)(f.h,{asChild:!0,container:i},n)))},V=N},81001:(e,t,r)=>{"use strict";r.d(t,{D:()=>o});var n=r(84173);function o(e){let t=(0,n.useRef)({value:e,previous:e});return(0,n.useMemo)(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}},18936:(e,t,r)=>{"use strict";r.d(t,{T:()=>a,f:()=>l});var n=r(34109),o=r(84173),i=r(69663);let a=(0,o.forwardRef)((e,t)=>(0,o.createElement)(i.WV.span,(0,n.Z)({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),l=a}}]);