1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,467034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),o=a[0],s=a[1],u=new i((o+s)*3/4-s),c=0,d=s>0?o-4:o;for(r=0;r<d;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===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(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,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(function(e,t,n){for(var i,a=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;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 n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(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 l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|h(n,i),l=o(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(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(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(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),s.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return s.from(c,t,r);var f=function(e){if(s.isBuffer(e)){var t=0|p(e.length),r=o(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)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.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),o(e<0?0:0|p(e))}function d(e){for(var t=e.length<0?0:0|p(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.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}}(),!s.TYPED_ARRAY_SUPPORT&&"u">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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(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 i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(e).length;default:if(i)return n?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,r){var i,a,o,s=!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 i="",a=t;a<r;++a)i+=N[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,o=r,0===a&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var a,o=1,s=e.length,l=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;o=2,s/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=r;a<s;
vendor: 12,407 bytes, line 1
1a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===l)return c*o}else -1!==c&&(a-=a-c),c=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){for(var d=!0,p=0;p<l;p++)if(u(e,a+p)!==u(t,p)){d=!1;break}if(d)return a}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.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,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.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}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(I(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=h,s.prototype._isBuffer=!0,s.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},s.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},s.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},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):f.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.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+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.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===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,l=Math.min(a,o),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){a=u[d],o=c[d];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},s.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 n=[],i=t;i<r;){var a,o,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}var p=n,h=p.length;if(h<=4096)return String.fromCharCode.apply(String,p);for(var f="",m=0;m<h;)f+=String.fromCharCode.apply(String,p.slice(m,m+=4096));return f}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 x(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function k(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function w(e,t,r,n,a){return t*=1,r>>>=0,a||k(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,a){return t*=1,r>>>=0,a||k(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}s.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 i,a,o,s,l,u,c,d,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");n||(n="utf8");for(var h=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s,l=parseInt(t.substr(2*o,2),16);if((s=l)!=s)break;e[r+o]=l}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,T(E(e,this.length-i),this,i,a);case"ascii":return o=t,s=r,T(C(e),this,o,s);case"latin1":case"binary":return function(e,t,r,n){return T(C(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,T($(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,T(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(h)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),h=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.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,s.prototype),n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.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},s.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]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(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},s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(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},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(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},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(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},s.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.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 i=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 a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.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&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}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(i=t;i<r;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),l=o.length;
1if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var S=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function C(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function $(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var N=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,p=r?-1:1,h=e[t+d];for(d+=p,a=h&(1<<-c)-1,h>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=p,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=p,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=u}return(h?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<<u)-1,d=c>>1,p=5960464477539062e-23*(23===i),h=n?0:a-1,f=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=p/l:t+=p*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=255&s,h+=f,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+h]=255&o,h+=f,o/=256,u-=8);e[r+h-f]|=128*m}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},o=!0;try{n[e](r,r.exports,a),o=!1}finally{o&&delete i[e]}return r.exports}a.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},99970,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={SYMBOL_FOR_REQ_CONTEXT:()=>c,getContext:()=>d};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);let c=Symbol.for("@vercel/request-context");function d(){let e=globalThis;return e[c]?.get?.()??{}}},891754,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={AccessTokenMissingError:()=>c,RefreshAccessTokenFailedError:()=>d};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);class c extends Error{constructor(){super("No authentication found. Please log in with the Vercel CLI (vercel login)."),this.name="AccessTokenMissingError"}}class d extends Error{constructor(e){super("Failed to refresh authentication token.",{cause:e}),this.name="RefreshAccessTokenFailedError"}}},725150,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={AccessTokenMissingError:()=>d.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>d.RefreshAccessTokenFailedError,getContext:()=>c.getContext,getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h,getVercelToken:()=>f};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);var c=e.r(99970),d=e.r(891754);async function p(){return""}function h(){return""}async function f(){throw Error("getVercelToken is not supported in browser environments")}},561866,(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 n=0;return function(...i){clearTimeout(r);let a=Date.now(),o=t-(a-n);o<=0?(n=a,e.apply(this,i)):r=setTimeout(()=>{n=Date.now(),e.apply(this,i)},o)}}},696736,(e,t,r)=>{var n=!0,i=!1,a=!1;function o(e,t,r){var n=e.attrIndex(t),i=[t,r];n<0?e.attrPush(i):e.attrs[n]=i}t.exports=function(e,t){t&&(n=!t.enabled,i=!!t.label,a=!!t.labelAfter),e.core.ruler.after("inl
1ine","github-task-lists",function(e){for(var t=e.tokens,r=2;r<t.length;r++)(function(e,t){var r;return"inline"===e[t].type&&"paragraph_open"===e[t-1].type&&"list_item_open"===e[t-2].type&&(0===(r=e[t]).content.indexOf("[ ] ")||0===r.content.indexOf("[x] ")||0===r.content.indexOf("[X] "))})(t,r)&&(function(e,t){if(e.children.unshift(function(e,t){var r=new t("html_inline","",0),i=n?' disabled="" ':"";return 0===e.content.indexOf("[ ] ")?r.content='<input class="task-list-item-checkbox"'+i+'type="checkbox">':(0===e.content.indexOf("[x] ")||0===e.content.indexOf("[X] "))&&(r.content='<input class="task-list-item-checkbox" checked=""'+i+'type="checkbox">'),r}(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),i)if(a){e.children.pop();var r="task-item-"+Math.ceil(1e7*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+r+'">',e.children.push(function(e,t,r){var n=new r("html_inline","",0);return n.content='<label class="task-list-item-label" for="'+t+'">'+e+"</label>",n.attrs=[{for:t}],n}(e.content,r,t))}else e.children.unshift(function(e){var t=new e("html_inline","",0);return t.content="<label>",t}(t)),e.children.push(function(e){var t=new e("html_inline","",0);return t.content="</label>",t}(t))}(t[r],e.Token),o(t[r-2],"class","task-list-item"+(n?"":" enabled")),o(t[function(e,t){for(var r=e[t].level-1,n=t-1;n>=0;n--)if(e[n].level===r)return n;return -1}(t,r-2)],"class","contains-task-list"))})}},93987,e=>{"use strict";let t;var r,n,i,a,o,s,l,u,c,d,p,h,f,m,g,y,v,b,x,k,w,_,S,E,C,$,T,I,N,A,j,M,O,D,R,P,z,L,F,U,B,Z,q,V,H,K,W,J,G,X,Y,Q,ee,et,er,en,ei,ea,eo,es,el,eu,ec,ed,ep,eh,ef,em,eg,ey,ev,eb,ex,ek,ew=e.i(843476),e_=e.i(271645),eS=e.i(948148),eE=e.i(88653),eC=e.i(846932),e$=e.i(791902),eT=e.i(247167),eI=e.i(467034),eN="vercel.ai.error",eA=Symbol.for(eN),ej=class e extends(m=Error,f=eA,m){constructor({name:e,message:t,cause:r}){super(t),this[f]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,eN)}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]}},eM="AI_APICallError",eO=`vercel.ai.error.${eM}`,eD=Symbol.for(eO),eR=class extends(y=ej,g=eD,y){constructor({message:e,url:t,requestBodyValues:r,statusCode:n,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=null!=n&&(408===n||409===n||429===n||n>=500),data:l}){super({name:eM,message:e,cause:o}),this[g]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=n,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=l}static isInstance(e){return ej.hasMarker(e,eO)}},eP="AI_EmptyResponseBodyError",ez=`vercel.ai.error.${eP}`,eL=Symbol.for(ez),eF=class extends(b=ej,v=eL,b){constructor({message:e="Empty response body"}={}){super({name:eP,message:e}),this[v]=!0}static isInstance(e){return ej.hasMarker(e,ez)}};function eU(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var eB="AI_InvalidArgumentError",eZ=`vercel.ai.error.${eB}`,eq=Symbol.for(eZ),eV=class extends(k=ej,x=eq,k){constructor({message:e,cause:t,argument:r}){super({name:eB,message:e,cause:t}),this[x]=!0,this.argument=r}static isInstance(e){return ej.hasMarker(e,eZ)}},eH=Symbol.for("vercel.ai.error.AI_InvalidPromptError");Symbol.for("vercel.ai.error.AI_InvalidResponseDataError");var eK="AI_JSONParseError",eW=`vercel.ai.error.${eK}`,eJ=Symbol.for(eW),eG=class extends(_=ej,w=eJ,_){constructor({text:e,cause:t}){super({name:eK,message:`JSON parsing failed: Text: ${e}. 2Error message: ${eU(t)}`,cause:t}),this[w]=!0,this.text=e}static isInstance(e){return ej.hasMarker(e,eW)}},eX=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 eY="AI_TypeValidationError",eQ=`vercel.ai.error.${eY}`,e0=Symbol.for(eQ),e1=class e extends(E=ej,S=e0,E){constructor({value:e,cause:t,context:r}){let n="Type validation failed";if((null==r?void 0:r.field)&&(n+=` for ${r.field}`),(null==r?void 0:r.entityName)||(null==r?void 0:r.entityId)){n+=" (";const e=[];r.entityName&&e.push(r.entityName),r.entityId&&e.push(`id: "${r.entityId}"`),n+=e.join(", "),n+=")"}super({name:eY,message:`${n}: Value: ${JSON.stringify(e)}. 3Error message: ${eU(t)}`,cause:t}),this[S]=!0,this.value=e,this.context=r}static isInstance(e){return ej.hasMarker(e,eQ)}static wrap({value:t,cause:r,context:n}){var i,a,o;return e.isInstance(r)&&r.value===t&&(null==(i=r.context)?void 0:i.field)===(null==n?void 0:n.field)&&(null==(a=r.context)?void 0:a.entityName)===(null==n?void 0:n.entityName)&&(null==(o=r.context)?void 0:o.entityId)===(null==n?void 0:n.entity
3Id)?r:new e({value:t,cause:r,context:n})}},e2=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");let e4=Object.freeze({status:"aborted"});function e5(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}let e6=Symbol("zod_brand");class e3 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class e9 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let e8={};function e7(e){return e&&Object.assign(e8,e),e8}function te(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function tt(e,t="|"){return e.map(e=>t_(e)).join(t)}function tr(e,t){return"bigint"==typeof t?t.toString():t}function tn(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ti(e){return null==e}function ta(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function to(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(n)){let e=n.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=r>i?r:i;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}e.s(["$ZodAsyncError",0,e3,"$ZodEncodeError",0,e9,"$brand",0,e6,"$constructor",0,e5,"NEVER",0,e4,"config",0,e7,"globalConfig",0,e8],197753);let ts=Symbol("evaluating");function tl(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ts)return void 0===n&&(n=ts,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tu(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tc(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function td(e){return JSON.stringify(e)}function tp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let th="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tf(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let tm=tn(()=>{if("u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function tg(e){if(!1===tf(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==tf(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ty(e){return tg(e)?{...e}:Array.isArray(e)?[...e]:e}let tv=new Set(["string","number","symbol"]),tb=new Set(["string","number","bigint","boolean","symbol","undefined"]);function tx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tk(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function tw(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function t_(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function tS(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let tE={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},tC={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function t$(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function tT(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function tI(e){return"string"==typeof e?e:e?.message}function tN(e,t,r){let n={...e,path:e.path??[]};return e.message||(n.message=tI(e.inst?._zod.def?.error?.(e))??tI(t?.error?.(e))??tI(r.customError?.(e))??tI(r.localeError?.(e))??"Invalid input"),delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function tA(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function tj(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function tM(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t}function tO(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function tD(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function tR(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,tC,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,tE,"aborted",0,t$,"allowsEval",0,tm,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,tu,"base64ToUint8Array",0,tD,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return tD(t+r)},"cached",0,tn,"captureStackTrace",0,th,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,ta,"clone",0,tk,"cloneDef",0,function(e){return tc(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,tl,"esc",0,td,"escapeRegex",0,tx,"extend",0,function(e,t){if(!tg(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot over
3write keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=tc(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return tu(this,"shape",r),r}});return tk(e,n)},"finalizeIssue",0,tN,"floatSafeRemainder",0,to,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,te,"getLengthableOrigin",0,tj,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,tA,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,tf,"isPlainObject",0,tg,"issue",0,tO,"joinValues",0,tt,"jsonStringifyReplacer",0,tr,"merge",0,function(e,t){let r=tc(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return tu(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return tk(e,r)},"mergeDefs",0,tc,"normalizeParams",0,tw,"nullish",0,ti,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=tc(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return tu(this,"shape",n),n},checks:[]});return tk(e,i)},"optionalKeys",0,tS,"parsedType",0,tM,"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=tc(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return tu(this,"shape",i),i},checks:[]});return tk(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=tc(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return tu(this,"shape",e),e},checks:[]});return tk(e,i)},"prefixIssues",0,tT,"primitiveTypes",0,tb,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,tv,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=tc(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return tu(this,"shape",i),i}});return tk(t,n)},"safeExtend",0,function(e,t){if(!tg(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=tc(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return tu(this,"shape",r),r}});return tk(e,r)},"shallowClone",0,ty,"slugify",0,tp,"stringifyPrimitive",0,t_,"uint8ArrayToBase64",0,tR,"uint8ArrayToBase64url",0,function(e){return tR(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,tI],922143);let tP=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,tr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tz=e5("$ZodError",tP),tL=e5("$ZodError",tP,{Parent:Error});function tF(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function tU(e,t=e=>e.message){let r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>n({issues:e}));else if("invalid_key"===i.code)n({issues:i.issues});else if("invalid_element"===i.code)n({issues:i.issues});else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}function tB(e,t=e=>e.message){let r={errors:[]},n=(e,i=[])=>{var a,o;
3for(let s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>n({issues:e},s.path));else if("invalid_key"===s.code)n({issues:s.issues},s.path);else if("invalid_element"===s.code)n({issues:s.issues},s.path);else{let e=[...i,...s.path];if(0===e.length){r.errors.push(t(s));continue}let n=r,l=0;for(;l<e.length;){let r=e[l],i=l===e.length-1;"string"==typeof r?(n.properties??(n.properties={}),(a=n.properties)[r]??(a[r]={errors:[]}),n=n.properties[r]):(n.items??(n.items=[]),(o=n.items)[r]??(o[r]={errors:[]}),n=n.items[r]),i&&n.errors.push(t(s)),l++}}};return n(e),r}function tZ(e){let t=[];for(let r of e.map(e=>"object"==typeof e?e.key:e))"number"==typeof r?t.push(`[${r}]`):"symbol"==typeof r?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function tq(e){let t=[];for(let r of[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length))t.push(`â ${r.message}`),r.path?.length&&t.push(` â at ${tZ(r.path)}`);return t.join("\n")}e.s(["$ZodError",0,tz,"$ZodRealError",0,tL,"flattenError",0,tF,"formatError",0,tU,"prettifyError",0,tq,"toDotPath",0,tZ,"treeifyError",0,tB],374969);let tV=e=>(t,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new e3;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>tN(e,a,e7())));throw th(t,i?.callee),t}return o.value},tH=tV(tL),tK=e=>async(t,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>tN(e,a,e7())));throw th(t,i?.callee),t}return o.value},tW=tK(tL),tJ=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new e3;return a.issues.length?{success:!1,error:new(e??tz)(a.issues.map(e=>tN(e,i,e7())))}:{success:!0,data:a.value}},tG=tJ(tL),tX=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>tN(e,i,e7())))}:{success:!0,data:a.value}},tY=tX(tL),tQ=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tV(e)(t,r,i)},t0=tQ(tL),t1=e=>(t,r,n)=>tV(e)(t,r,n),t2=t1(tL),t4=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tK(e)(t,r,i)},t5=t4(tL),t6=e=>async(t,r,n)=>tK(e)(t,r,n),t3=t6(tL),t9=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tJ(e)(t,r,i)},t8=t9(tL),t7=e=>(t,r,n)=>tJ(e)(t,r,n),re=t7(tL),rt=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tX(e)(t,r,i)},rr=rt(tL),rn=e=>async(t,r,n)=>tX(e)(t,r,n),ri=rn(tL);e.s(["_decode",0,t1,"_decodeAsync",0,t6,"_encode",0,tQ,"_encodeAsync",0,t4,"_parse",0,tV,"_parseAsync",0,tK,"_safeDecode",0,t7,"_safeDecodeAsync",0,rn,"_safeEncode",0,t9,"_safeEncodeAsync",0,rt,"_safeParse",0,tJ,"_safeParseAsync",0,tX,"decode",0,t2,"decodeAsync",0,t3,"encode",0,t0,"encodeAsync",0,t5,"parse",0,tH,"parseAsync",0,tW,"safeDecode",0,re,"safeDecodeAsync",0,ri,"safeEncode",0,t8,"safeEncodeAsync",0,rr,"safeParse",0,tG,"safeParseAsync",0,tY],803108);let ra=/^[cC][^\s-]{8,}$/,ro=/^[0-9a-z]+$/,rs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rl=/^[0-9a-vA-V]{20}$/,ru=/^[A-Za-z0-9]{27}$/,rc=/^[a-zA-Z0-9_-]{21}$/,rd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,rh=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rf=rh(4),rm=rh(6),rg=rh(7),ry=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rv=/^[^\s@"]{1,64}
3@[^\s@]{1,255}$/u;function rb(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let 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])$/,rk=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,rw=e=>{let t=tx(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},r_=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rC=/^[A-Za-z0-9_-]*$/,r$=/^\+[1-9]\d{6,14}$/,rT="(?:(?:\\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])))",rI=RegExp(`^${rT}$`);function rN(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function rA(e){return RegExp(`^${rN(e)}$`)}function rj(e){let t=rN({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${rT}T(?:${n})$`)}let rM=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},rO=/^-?\d+n?$/,rD=/^-?\d+$/,rR=/^-?\d+(?:\.\d+)?$/,rP=/^(?:true|false)$/i,rz=/^null$/i,rL=/^undefined$/i,rF=/^[^A-Z]*$/,rU=/^[^a-z]*$/;function rB(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function rZ(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let rq=rB(22,"=="),rV=rZ(22),rH=rB(27,"="),rK=rZ(27),rW=rB(43,"="),rJ=rZ(43),rG=rB(64,""),rX=rZ(64),rY=rB(86,"=="),rQ=rZ(86);e.s(["base64",0,rE,"base64url",0,rC,"bigint",0,rO,"boolean",0,rP,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,r_,"cidrv6",0,rS,"cuid",0,ra,"cuid2",0,ro,"date",0,rI,"datetime",0,rj,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,rd,"e164",0,r$,"email",0,ry,"emoji",0,rb,"extendedDuration",0,/^[-+]?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)?)??$/,"guid",0,rp,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"idnEmail",0,rv,"integer",0,rD,"ipv4",0,rx,"ipv6",0,rk,"ksuid",0,ru,"lowercase",0,rF,"mac",0,rw,"md5_base64",0,rq,"md5_base64url",0,rV,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,rc,"null",0,rz,"number",0,rR,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,rH,"sha1_base64url",0,rK,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,rW,"sha256_base64url",0,rJ,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,rG,"sha384_base64url",0,rX,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,rY,"sha512_base64url",0,rQ,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,rM,"time",0,rA,"ulid",0,rs,"undefined",0,rL,"unicodeEmail",0,rv,"uppercase",0,rU,"uuid",0,rh,"uuid4",0,rf,"uuid6",0,rm,"uuid7",0,rg,"xid",0,rl],682358);let r0=e5("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),r1={number:"number",bigint:"bigint",object:"date"},r2=e5("$ZodCheckLessThan",(e,t)=>{r0.init(e,t);let r=r1[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),r4=e5("$ZodCheckGreaterThan",(e,t)=>{r0.init(e,t);let r=r1[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),r5=e5("$ZodCheckMultipleOf",(e,t)=>{r0.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===to(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),r6=e5("$ZodCheckNumberFormat",(e,t)=>{r0.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=tE[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=rD)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>
vendor: 4,852 bytes, line 3
30?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),r3=e5("$ZodCheckBigIntFormat",(e,t)=>{r0.init(e,t);let[r,n]=tC[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),r9=e5("$ZodCheckMaxSize",(e,t)=>{var r;r0.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!ti(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:tA(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),r8=e5("$ZodCheckMinSize",(e,t)=>{var r;r0.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!ti(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:tA(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),r7=e5("$ZodCheckSizeEquals",(e,t)=>{var r;r0.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!ti(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:tA(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ne=e5("$ZodCheckMaxLength",(e,t)=>{var r;r0.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!ti(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=tj(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nt=e5("$ZodCheckMinLength",(e,t)=>{var r;r0.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!ti(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=tj(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nr=e5("$ZodCheckLengthEquals",(e,t)=>{var r;r0.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!ti(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=tj(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),nn=e5("$ZodCheckStringFormat",(e,t)=>{var r,n;r0.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ni=e5("$ZodCheckRegex",(e,t)=>{nn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),na=e5("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rF),nn.init(e,t)}),no=e5("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rU),nn.init(e,t)}),ns=e5("$ZodCheckIncludes",(e,t)=>{r0.init(e,t);let r=tx(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input
3:r.value,inst:e,continue:!t.abort})}}),nl=e5("$ZodCheckStartsWith",(e,t)=>{r0.init(e,t);let r=RegExp(`^${tx(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),nu=e5("$ZodCheckEndsWith",(e,t)=>{r0.init(e,t);let r=RegExp(`.*${tx(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function nc(e,t,r){e.issues.length&&t.issues.push(...tT(r,e.issues))}let nd=e5("$ZodCheckProperty",(e,t)=>{r0.init(e,t),e._zod.check=e=>{let r=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(r=>nc(r,e,t.property));nc(r,e,t.property)}}),np=e5("$ZodCheckMimeType",(e,t)=>{r0.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),nh=e5("$ZodCheckOverwrite",(e,t)=>{r0.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});e.s(["$ZodCheck",0,r0,"$ZodCheckBigIntFormat",0,r3,"$ZodCheckEndsWith",0,nu,"$ZodCheckGreaterThan",0,r4,"$ZodCheckIncludes",0,ns,"$ZodCheckLengthEquals",0,nr,"$ZodCheckLessThan",0,r2,"$ZodCheckLowerCase",0,na,"$ZodCheckMaxLength",0,ne,"$ZodCheckMaxSize",0,r9,"$ZodCheckMimeType",0,np,"$ZodCheckMinLength",0,nt,"$ZodCheckMinSize",0,r8,"$ZodCheckMultipleOf",0,r5,"$ZodCheckNumberFormat",0,r6,"$ZodCheckOverwrite",0,nh,"$ZodCheckProperty",0,nd,"$ZodCheckRegex",0,ni,"$ZodCheckSizeEquals",0,r7,"$ZodCheckStartsWith",0,nl,"$ZodCheckStringFormat",0,nn,"$ZodCheckUpperCase",0,no],355605);class nf{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}e.s(["Doc",0,nf],698530);let nm={major:4,minor:3,patch:6};e.s(["version",0,nm],398477);let ng=e5("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=nm;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=t$(e);for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new e3;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=t$(e,t)))});else{if(e.issues.length===t)continue;i||(i=t$(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(t$(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new e3;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>
3{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new e3;return o.then(e=>t(e,n,a))}return t(o,n,a)}}tl(e,"~standard",()=>({validate:t=>{try{let r=tG(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return tY(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),ny=e5("$ZodString",(e,t)=>{ng.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rM(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),nv=e5("$ZodStringFormat",(e,t)=>{nn.init(e,t),ny.init(e,t)}),nb=e5("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rp),nv.init(e,t)}),nx=e5("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=rh(e))}else t.pattern??(t.pattern=rh());nv.init(e,t)}),nk=e5("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ry),nv.init(e,t)}),nw=e5("$ZodURL",(e,t)=>{nv.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),n_=e5("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=rb()),nv.init(e,t)}),nS=e5("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=rc),nv.init(e,t)}),nE=e5("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ra),nv.init(e,t)}),nC=e5("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ro),nv.init(e,t)}),n$=e5("$ZodULID",(e,t)=>{t.pattern??(t.pattern=rs),nv.init(e,t)}),nT=e5("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rl),nv.init(e,t)}),nI=e5("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ru),nv.init(e,t)}),nN=e5("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=rj(t)),nv.init(e,t)}),nA=e5("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rI),nv.init(e,t)}),nj=e5("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rA(t)),nv.init(e,t)}),nM=e5("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=rd),nv.init(e,t)}),nO=e5("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rx),nv.init(e,t),e._zod.bag.format="ipv4"}),nD=e5("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rk),nv.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),nR=e5("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=rw(t.delimiter)),nv.init(e,t),e._zod.bag.format="mac"}),nP=e5("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=r_),nv.init(e,t)}),nz=e5("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=rS),nv.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function nL(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let nF=e5("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rE),nv.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{nL(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function nU(e){if(!rC.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return nL(t.padEnd(4*Math.ceil(t.length/4),"="))}let nB=e5("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rC),nv.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{nU(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),nZ=e5("$ZodE164",(e,t)=>{t.pattern??(t.pattern=r$),nv.init(e,t)});function nq(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));
3if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}let nV=e5("$ZodJWT",(e,t)=>{nv.init(e,t),e._zod.check=r=>{nq(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),nH=e5("$ZodCustomStringFormat",(e,t)=>{nv.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),nK=e5("$ZodNumber",(e,t)=>{ng.init(e,t),e._zod.pattern=e._zod.bag.pattern??rR,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),nW=e5("$ZodNumberFormat",(e,t)=>{r6.init(e,t),nK.init(e,t)}),nJ=e5("$ZodBoolean",(e,t)=>{ng.init(e,t),e._zod.pattern=rP,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),nG=e5("$ZodBigInt",(e,t)=>{ng.init(e,t),e._zod.pattern=rO,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),nX=e5("$ZodBigIntFormat",(e,t)=>{r3.init(e,t),nG.init(e,t)}),nY=e5("$ZodSymbol",(e,t)=>{ng.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return"symbol"==typeof n||t.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),t}}),nQ=e5("$ZodUndefined",(e,t)=>{ng.init(e,t),e._zod.pattern=rL,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),t}}),n0=e5("$ZodNull",(e,t)=>{ng.init(e,t),e._zod.pattern=rz,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),n1=e5("$ZodAny",(e,t)=>{ng.init(e,t),e._zod.parse=e=>e}),n2=e5("$ZodUnknown",(e,t)=>{ng.init(e,t),e._zod.parse=e=>e}),n4=e5("$ZodNever",(e,t)=>{ng.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),n5=e5("$ZodVoid",(e,t)=>{ng.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}}),n6=e5("$ZodDate",(e,t)=>{ng.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function n3(e,t,r){e.issues.length&&t.issues.push(...tT(r,e.issues)),t.value[r]=e.value}let n9=e5("$ZodArray",(e,t)=>{ng.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>n3(t,r,e))):n3(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function n8(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...tT(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function n7(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=tS(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ie(e,t,r,n,i,a){let o=[],s=i.keySet,l=i.catchall._zod,u=l.def.type,c="optional"===l.optout;for(let i in t){if(s.has(i))continue;if("never"===u){o.push(i);continue}let a=l.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>n8(e,r,i,t,c))):n8(a,r,i,t,c)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let it=e5("$ZodObject",(e,t)=>{let r;ng.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=tn(()=>n7(t));tl(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!tf(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optout,a=r._zod.run({value:o[e],issues:[]},n);a instanceof Promise?s.push(a.then(r=>n8(r,t,e,o,i))):n8(a,t,e,o,i)}return a?ie(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),ir=e5("$ZodObjectJIT",(e,t)=>{let r,n;it.init(e,t);let i=e._zod.parse,a=tn(()=>n7(t)),o=!e8.jitless,s=o&&tm.value,l=t.catchall;e._zod.parse=(u,c)=>{n??(n=a.value);let d=u.value;return tf(d)?o&&s&&c?.async===!1&&!0!==c.jitless?(r||(r=(e=>{let t=new nf(["shape","payload","ctx"]),r=a.value,n=e=>{let t=td(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=td(a),s=e[a],l=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),l?t.write(` 4 if (${r}.issues.length) { 5 if (${o} in input) { 6 payload.issues = payload.issues.concat(${r}.issues.map(iss => ({ 7 ...iss, 8 path: iss.path ? [${o}, ...iss.path] : [${o}] 9 }))); 10 } 11 } 12 13 if (${r}.value === undefined) { 14 if (${o} in input) { 15 newResult[${o}] = undefined; 16 } 17 } else { 18 newResult[${o}] = ${r}.value; 19 } 20 21 `):t.write(` 22 if (${r}.issues.length) { 23 payload.issues = payload.issues.concat(${r}.issues.map(iss => ({ 24 ...iss, 25 path: iss.path ? [${o}, ...iss.path] : [${o}] 26 }))); 27 } 28 29 if (${r}.value === undefined) { 30 if (${o} in input) { 31 newResult[${o}] = undefined; 32 } 33 } else { 34 newResult[${o}] = ${r}.value; 35 } 36 37 `)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),u=r(u,c),l)?ie([],d,u,c,n,e):u:i(u,c):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function ii(e,t,r,n){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!t$(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>tN(e,n,e7())))}),t)}let ia=e5("$ZodUnion",(e,t)=>{ng.init(e,t),tl(e._zod,"optin",()=>t.options.some(e=>
37"optional"===e._zod.optin)?"optional":void 0),tl(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),tl(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),tl(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ta(e.source)).join("|")})$`)}});let r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return n(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>ii(t,i,e,a)):ii(s,i,e,a)}});function io(e,t,r,n){let i=e.filter(e=>0===e.issues.length);return 1===i.length?t.value=i[0].value:0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>tN(e,n,e7())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t}let is=e5("$ZodXor",(e,t)=>{ia.init(e,t),t.inclusive=!1;let r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return n(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);t instanceof Promise?(s.push(t),o=!0):s.push(t)}return o?Promise.all(s).then(t=>io(t,i,e,a)):io(s,i,e,a)}}),il=e5("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ia.init(e,t);let r=e._zod.parse;tl(e._zod,"propValues",()=>{let e={};for(let r of t.options){let n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(n))for(let n of(e[t]||(e[t]=new Set),r))e[t].add(n)}return e});let n=tn(()=>{let e=t.options,r=new Map;for(let n of e){let e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,a)=>{let o=i.value;if(!tf(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),iu=e5("$ZodIntersection",(e,t)=>{ng.init(e,t),e._zod.parse=(e,r)=>{let n=e.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>ic(e,t,r)):ic(e,i,a)}});function ic(e,t,r){let n,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(n??(n=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let a=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&n&&e.issues.push({...n,keys:a}),t$(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(tg(t)&&tg(r)){let n=Object.keys(r),i=Object.keys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};a[n]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let id=e5("$ZodTuple",(e,t)=>{ng.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],s=[...r].reverse().findIndex(e=>"optional"!==e._zod.optin),l=-1===s?0:r.length-s;if(!t.rest){let t=a.length>r.length,i=a.length<l-1;if(t||i)return n.issues.push({...t?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length}
37,input:a,inst:e,origin:"array"}),n}let u=-1;for(let e of r){if(++u>=a.length&&u>=l)continue;let t=e._zod.run({value:a[u],issues:[]},i);t instanceof Promise?o.push(t.then(e=>ip(e,n,u))):ip(t,n,u)}if(t.rest)for(let e of a.slice(r.length)){u++;let r=t.rest._zod.run({value:e,issues:[]},i);r instanceof Promise?o.push(r.then(e=>ip(e,n,u))):ip(r,n,u)}return o.length?Promise.all(o).then(()=>n):n}});function ip(e,t,r){e.issues.length&&t.issues.push(...tT(r,e.issues)),t.value[r]=e.value}let ih=e5("$ZodRecord",(e,t)=>{ng.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!tg(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],o=t.keyType._zod.values;if(o){let s;r.value={};let l=new Set;for(let e of o)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){l.add("number"==typeof e?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},n);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&r.issues.push(...tT(e,t.issues)),r.value[e]=t.value})):(o.issues.length&&r.issues.push(...tT(e,o.issues)),r.value[e]=o.value)}for(let e in i)l.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o)continue;let s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&rR.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},n);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>tN(e,n,e7())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},n);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&r.issues.push(...tT(o,e.issues)),r.value[s.value]=e.value})):(l.issues.length&&r.issues.push(...tT(o,l.issues)),r.value[s.value]=l.value)}return a.length?Promise.all(a).then(()=>r):r}}),im=e5("$ZodMap",(e,t)=>{ng.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let a=[];for(let[o,s]of(r.value=new Map,i)){let l=t.keyType._zod.run({value:o,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);l instanceof Promise||u instanceof Promise?a.push(Promise.all([l,u]).then(([t,a])=>{ig(t,a,r,o,i,e,n)})):ig(l,u,r,o,i,e,n)}return a.length?Promise.all(a).then(()=>r):r}});function ig(e,t,r,n,i,a,o){e.issues.length&&(tv.has(typeof n)?r.issues.push(...tT(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:e.issues.map(e=>tN(e,o,e7()))})),t.issues.length&&(tv.has(typeof n)?r.issues.push(...tT(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:t.issues.map(e=>tN(e,o,e7()))})),r.value.set(e.value,t.value)}let iy=e5("$ZodSet",(e,t)=>{ng.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let a=[];for(let e of(r.value=new Set,i)){let i=t.valueType._zod.run({value:e,issues:[]},n);i instanceof Promise?a.push(i.then(e=>iv(e,r))):iv(i,r)}return a.length?Promise.all(a).then(()=>r):r}});function iv(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}let ib=e5("$ZodEnum",(e,t)=>{ng.init(e,t);let r=te(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=RegExp(`^(${r.filter(e=>tv.has(typeof e)).map(e=>"string"==typeof e?tx(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let a=t.value;return n.has(a)||t.issues.push({code:"invalid_value",values:r,input:a,inst:e}),t}}),ix=e5("$ZodLiteral",(e,t)=>{if(ng.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?tx(e):e?tx(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}}),ik=e5("$ZodFile",(e,t)=>{ng.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return n instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),t}}),iw=e5("$ZodTransform",(e,t)=>{ng.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new e9(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r));if(i instanceof Promise)throw new e3;return r.value=i,r}});function i_(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let iS=e5("$ZodOptional",(e,t)=>{ng.init(e,t),e._zod.optin="optional",e._zod.optout="optional",tl(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),tl(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ta(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>i_(t,e.value)):i_(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),iE=e5("$ZodExactOptional",(e,t)=>{iS.init(e,t),tl(e._zod,"values",()=>t.innerType._zod.values),tl(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),iC=e5("$ZodNullable",(e,t)=>{ng.init(e,t),tl(e._zod,"optin",()=>t.innerType._zod.optin),tl(e._zod,"optout",()=>t.innerType._zod.optout),tl(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ta(e.source)}|null)$`):void 0}),tl(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),i$=e5("$ZodDefault",(e,t)=>{ng.init(e,t),e._zod.optin="optional",tl(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>iT(e,t)):iT(n,t)}});function iT(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let iI=e5("$ZodPrefault",(e,t)=>{ng.init(e,t),e._zod.optin="optional",tl(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),iN=e5("$ZodNonOptional",(e,t)=>{ng.init(e,t),tl(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>iA(t,e)):iA(i,e)}});function iA(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let ij=e5("$ZodSuccess",(e,t)=>{ng.init(e,t),e._zod.parse=(e,r)=>{if("backward"===r.direction)throw new e9("ZodSuccess");let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===n.issues.length,e)}}),iM=e5("$ZodCatch",(e,t)=>{ng.init(e,t),tl(e._zod,"optin",()=>t.innerType._zod.optin),tl(e._zod,"optout",()=>t.innerType._zod.optout),tl(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>
37(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>tN(e,r,e7()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>tN(e,r,e7()))},input:e.value}),e.issues=[]),e)}}),iO=e5("$ZodNaN",(e,t)=>{ng.init(e,t),e._zod.parse=(t,r)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)}),iD=e5("$ZodPipe",(e,t)=>{ng.init(e,t),tl(e._zod,"values",()=>t.in._zod.values),tl(e._zod,"optin",()=>t.in._zod.optin),tl(e._zod,"optout",()=>t.out._zod.optout),tl(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>iR(e,t.in,r)):iR(n,t.in,r)}let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>iR(e,t.out,r)):iR(n,t.out,r)}});function iR(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}let iP=e5("$ZodCodec",(e,t)=>{ng.init(e,t),tl(e._zod,"values",()=>t.in._zod.values),tl(e._zod,"optin",()=>t.in._zod.optin),tl(e._zod,"optout",()=>t.out._zod.optout),tl(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("forward"===(r.direction||"forward")){let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>iz(e,t,r)):iz(n,t,r)}{let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>iz(e,t,r)):iz(n,t,r)}}});function iz(e,t,r){if(e.issues.length)return e.aborted=!0,e;if("forward"===(r.direction||"forward")){let n=t.transform(e.value,e);return n instanceof Promise?n.then(n=>iL(e,n,t.out,r)):iL(e,n,t.out,r)}{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(n=>iL(e,n,t.in,r)):iL(e,n,t.in,r)}}function iL(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}let iF=e5("$ZodReadonly",(e,t)=>{ng.init(e,t),tl(e._zod,"propValues",()=>t.innerType._zod.propValues),tl(e._zod,"values",()=>t.innerType._zod.values),tl(e._zod,"optin",()=>t.innerType?._zod?.optin),tl(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(iU):iU(n)}});function iU(e){return e.value=Object.freeze(e.value),e}let iB=e5("$ZodTemplateLiteral",(e,t)=>{ng.init(e,t);let r=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let n=+!!t.startsWith("^"),i=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(n,i))}else if(null===e||tb.has(typeof e))r.push(tx(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${r.join("")}$`),e._zod.parse=(r,n)=>("string"!=typeof r.value?r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source})),r)}),iZ=e5("$ZodFunction",(e,t)=>(ng.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw Error("implement() must be called with a function");return function(...r){let n=Reflect.apply(t,this,e._def.input?tH(e._def.input,r):r);return e._def.output?tH(e._def.output,n):n}},e.implementAsync=t=>{if("function"!=typeof t)throw Error("implementAsync() must be called with a function");return async function(...r){let n=e._def.input?await tW(e._def.input,r):r,i=await Reflect.apply(t,this,n);return e._def.output?await tW(e._def.output,i):i}},e._zod.parse=(t,r)=>("function"!=typeof t.value?t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}):e._def.output&&"promise"===e._def.output._zod.def.type?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t),e.input=(...t)=>{let r=e.constructor;return new r(Array.isArray(t[0])?{type:"function",input:new id({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}:{type:"function",input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),iq=e5("$ZodPromise",(e,t)=>{ng.init(e,t),e._zod.parse=(e,r)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},r))}),iV=e5("$ZodLazy",(e,t)=>{ng.init(e,t),tl(e._zod,"innerType",()=>t.getter()),tl(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),tl(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),tl(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),tl(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),iH=e5("$ZodCustom",(e,t)=>{r0.init(e,t),ng.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>iK(t,r,n,e));iK(i,r,n,e)}});function iK(e,t,r,n){if(!e){let e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(tO(e))}}function iW(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>
37=11&&o<=19?n:1===a?t:a>=2&&a<=4?r:n}function iJ(){let e,t,r;return{localeError:(e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;return`Invalid input: expected ${e}, received ${i}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${t_(n.values[0])}`;return`Invalid option: expected one of ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Too big: expected ${n.origin??"value"} to have ${t}${n.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Too small: expected ${n.origin} to have ${t}${n.minimum.toString()} ${r.unit}`;return`Too small: expected ${n.origin} to be ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Invalid string: must start with "${n.prefix}"`;if("ends_with"===n.format)return`Invalid string: must end with "${n.suffix}"`;if("includes"===n.format)return`Invalid string: must include "${n.includes}"`;if("regex"===n.format)return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`}})}}function iG(e,t,r){return 1===Math.abs(e)?t:r}function iX(e){if(!e)return"";let t=e[e.length-1];return e+(["Õ¡","Õ¥","Õ¨","Õ«","Õ¸","Õ¸Ö","Ö
"].includes(t)?"Õ¶":"Õ¨")}function iY(){let e,t,r;return{localeError:(e={string:{unit:"áá½á¢áááá",verb:"áá½ááá¶á"},file:{unit:"áá",verb:"áá½ááá¶á"},array:{unit:"áá¶áá»",verb:"áá½ááá¶á"},set:{unit:"áá¶áá»",verb:"áá½ááá¶á"}},t={regex:"áá·áááááááááá
á¼á",email:"á¢á¶áááááá¶áá¢áá¸ááá",url:"URL",emoji:"ááááá¶á¢á¶áááááá",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"áá¶áááá·á
áááá áá·ááááá ISO",date:"áá¶áááá·á
áááá ISO",time:"áááá ISO",duration:"áááááá ISO",ipv4:"á¢á¶áááááá¶á IPv4",ipv6:"á¢á¶áááááá¶á IPv6",cidrv4:"áááá¢á¶áááááá¶á IPv4",cidrv6:"áááá¢á¶áááááá¶á IPv6",base64:"ááááá¢ááááá¢áá·áá¼á base64",base64url:"ááááá¢ááááá¢áá·áá¼á base64url",json_string:"ááááá¢áááá JSON",e164:"ááá E.164",jwt:"JWT",template_literal:"áá·áááááááááá
á¼á"},r={nan:"NaN",number:"ááá",array:"á¢á¶áá (Array)",null:"áááá¶áááááá (null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`áá·áááááááááá
á¼ááá·ááááá¹ááááá¼áá áááá¼ááá¶á instanceof ${n.expected} ááá»ááááááá½ááá¶á ${i}`;return`áá·áááááááááá
á¼ááá·ááááá¹ááááá¼áá áááá¼ááá¶á ${e} ááá»ááááááá½ááá¶á ${i}`}
37case"invalid_value":if(1===n.values.length)return`áá·áááááááááá
á¼ááá·ááááá¹ááááá¼áá áááá¼ááá¶á ${t_(n.values[0])}`;return`ááááá¾ááá·ááááá¹ááááá¼áá áááá¼ááá¶áá½ááááá»áá
áááá ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`áááááá áááá¼ááá¶á ${n.origin??"ááááá"} ${t} ${n.maximum.toString()} ${r.unit??"áá¶áá»"}`;return`áááááá áááá¼ááá¶á ${n.origin??"ááááá"} ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`áá¼á
áááá áááá¼ááá¶á ${n.origin} ${t} ${n.minimum.toString()} ${r.unit}`;return`áá¼á
áááá áááá¼ááá¶á ${n.origin} ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ááááá¢áááááá·ááááá¹ááááá¼áá áááá¼áá
á¶áááááá¾áááá "${n.prefix}"`;if("ends_with"===n.format)return`ááááá¢áááááá·ááááá¹ááááá¼áá áááá¼ááááá
ááááá "${n.suffix}"`;if("includes"===n.format)return`ááááá¢áááááá·ááááá¹ááááá¼áá áááá¼ááá¶á "${n.includes}"`;if("regex"===n.format)return`ááááá¢áááááá·ááááá¹ááááá¼áá áááá¼ááááááá¼áááááá¹áááááááááááá¶áááááá ${n.pattern}`;return`áá·ááááá¹ááááá¼áá ${t[n.format]??n.format}`;case"not_multiple_of":return`ááááá·ááááá¹ááááá¼áá áááá¼ááááá¶áá á»áá»ááá ${n.divisor}`;case"unrecognized_keys":return`áááá¾ááááá·ááááá¶ááá ${tt(n.keys,", ")}`;case"invalid_key":return`áááá·ááááá¹ááááá¼ááá
áááá»á ${n.origin}`;case"invalid_union":default:return"áá·áááááááá·ááááá¹ááááá¼á";case"invalid_element":return`áá·áááááááá·ááááá¹ááááá¼ááá
áááá»á ${n.origin}`}})}}e.s(["$ZodAny",0,n1,"$ZodArray",0,n9,"$ZodBase64",0,nF,"$ZodBase64URL",0,nB,"$ZodBigInt",0,nG,"$ZodBigIntFormat",0,nX,"$ZodBoolean",0,nJ,"$ZodCIDRv4",0,nP,"$ZodCIDRv6",0,nz,"$ZodCUID",0,nE,"$ZodCUID2",0,nC,"$ZodCatch",0,iM,"$ZodCodec",0,iP,"$ZodCustom",0,iH,"$ZodCustomStringFormat",0,nH,"$ZodDate",0,n6,"$ZodDefault",0,i$,"$ZodDiscriminatedUnion",0,il,"$ZodE164",0,nZ,"$ZodEmail",0,nk,"$ZodEmoji",0,n_,"$ZodEnum",0,ib,"$ZodExactOptional",0,iE,"$ZodFile",0,ik,"$ZodFunction",0,iZ,"$ZodGUID",0,nb,"$ZodIPv4",0,nO,"$ZodIPv6",0,nD,"$ZodISODate",0,nA,"$ZodISODateTime",0,nN,"$ZodISODuration",0,nM,"$ZodISOTime",0,nj,"$ZodIntersection",0,iu,"$ZodJWT",0,nV,"$ZodKSUID",0,nI,"$ZodLazy",0,iV,"$ZodLiteral",0,ix,"$ZodMAC",0,nR,"$ZodMap",0,im,"$ZodNaN",0,iO,"$ZodNanoID",0,nS,"$ZodNever",0,n4,"$ZodNonOptional",0,iN,"$ZodNull",0,n0,"$ZodNullable",0,iC,"$ZodNumber",0,nK,"$ZodNumberFormat",0,nW,"$ZodObject",0,it,"$ZodObjectJIT",0,ir,"$ZodOptional",0,iS,"$ZodPipe",0,iD,"$ZodPrefault",0,iI,"$ZodPromise",0,iq,"$ZodReadonly",0,iF,"$ZodRecord",0,ih,"$ZodSet",0,iy,"$ZodString",0,ny,"$ZodStringFormat",0,nv,"$ZodSuccess",0,ij,"$ZodSymbol",0,nY,"$ZodTemplateLiteral",0,iB,"$ZodTransform",0,iw,"$ZodTuple",0,id,"$ZodType",0,ng,"$ZodULID",0,n$,"$ZodURL",0,nw,"$ZodUUID",0,nx,"$ZodUndefined",0,nQ,"$ZodUnion",0,ia,"$ZodUnknown",0,n2,"$ZodVoid",0,n5,"$ZodXID",0,nT,"$ZodXor",0,is,"isValidBase64",0,nL,"isValidBase64URL",0,nU,"isValidJWT",0,nq],342311);let iQ=e=>e.charAt(0).toUpperCase()+e.slice(1);function i0(e){let t=Math.abs(e),r=t%10,n=t%100;return n>=11&&n<=19||0===r?"many":1===r?"one":"few"}function i1(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:1===a?t:a>=2&&a<=4?r:n}function i2(){let e,t,r;return{localeError:(e={string:{unit:"ÑимволÑв",verb:"маÑиме"},file:{unit:"байÑÑв",verb:"маÑиме"},array:{unit:"елеменÑÑв",verb:"маÑиме"},set:{unit:"елеменÑÑв",verb:"маÑиме"}},t={regex:"вÑ
ÑÐ´Ð½Ñ Ð´Ð°Ð½Ñ",email:"адÑеÑа елекÑÑÐ¾Ð½Ð½Ð¾Ñ Ð¿Ð¾ÑÑи",url:"URL",emoji:"емодзÑ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"даÑа Ñа ÑÐ°Ñ ISO",date:"даÑа ISO",time:"ÑÐ°Ñ ISO",duration:"ÑÑивалÑÑÑÑ ISO",ipv4:"адÑеÑа IPv4",ipv6:"адÑеÑа IPv6",cidrv4:"дÑапазон IPv4",cidrv6:"дÑапазон IPv6",base64:"ÑÑдок Ñ ÐºÐ¾Ð´ÑÐ²Ð°Ð½Ð½Ñ base64",base64url:"ÑÑдок Ñ ÐºÐ¾Ð´ÑÐ²Ð°Ð½Ð½Ñ base64url",json_string:"ÑÑдок JSON",e164:"Ð½Ð¾Ð¼ÐµÑ E.164",jwt:"JWT",template_literal:"вÑ
ÑÐ´Ð½Ñ Ð´Ð°Ð½Ñ"},r={nan:"NaN",number:"ÑиÑло",array:"маÑив"},n=>
37{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÐепÑавилÑÐ½Ñ Ð²Ñ
ÑÐ´Ð½Ñ Ð´Ð°Ð½Ñ: оÑÑкÑÑÑÑÑÑ instanceof ${n.expected}, оÑÑимано ${i}`;return`ÐепÑавилÑÐ½Ñ Ð²Ñ
ÑÐ´Ð½Ñ Ð´Ð°Ð½Ñ: оÑÑкÑÑÑÑÑÑ ${e}, оÑÑимано ${i}`}case"invalid_value":if(1===n.values.length)return`ÐепÑавилÑÐ½Ñ Ð²Ñ
ÑÐ´Ð½Ñ Ð´Ð°Ð½Ñ: оÑÑкÑÑÑÑÑÑ ${t_(n.values[0])}`;return`ÐепÑавилÑна опÑÑÑ: оÑÑкÑÑÑÑÑÑ Ð¾Ð´Ð½Ðµ з ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ÐанадÑо велике: оÑÑкÑÑÑÑÑÑ, Ñо ${n.origin??"знаÑеннÑ"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"елеменÑÑв"}`;return`ÐанадÑо велике: оÑÑкÑÑÑÑÑÑ, Ñо ${n.origin??"знаÑеннÑ"} бÑде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ÐанадÑо мале: оÑÑкÑÑÑÑÑÑ, Ñо ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`ÐанадÑо мале: оÑÑкÑÑÑÑÑÑ, Ñо ${n.origin} бÑде ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ÐепÑавилÑний ÑÑдок: повинен поÑинаÑиÑÑ Ð· "${n.prefix}"`;if("ends_with"===n.format)return`ÐепÑавилÑний ÑÑдок: повинен закÑнÑÑваÑиÑÑ Ð½Ð° "${n.suffix}"`;if("includes"===n.format)return`ÐепÑавилÑний ÑÑдок: повинен мÑÑÑиÑи "${n.includes}"`;if("regex"===n.format)return`ÐепÑавилÑний ÑÑдок: повинен вÑдповÑдаÑи ÑÐ°Ð±Ð»Ð¾Ð½Ñ ${n.pattern}`;return`ÐепÑавилÑний ${t[n.format]??n.format}`;case"not_multiple_of":return`ÐепÑавилÑне ÑиÑло: повинно бÑÑи кÑаÑним ${n.divisor}`;case"unrecognized_keys":return`ÐеÑозпÑзнаний клÑÑ${n.keys.length>1?"Ñ":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`ÐепÑавилÑний клÑÑ Ñ ${n.origin}`;case"invalid_union":default:return"ÐепÑавилÑÐ½Ñ Ð²Ñ
ÑÐ´Ð½Ñ Ð´Ð°Ð½Ñ";case"invalid_element":return`ÐепÑавилÑне знаÑÐµÐ½Ð½Ñ Ñ ${n.origin}`}})}}e.s([],543365);let i4=Symbol("ZodOutput"),i5=Symbol("ZodInput");class i6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function i3(){return new i6}(C=globalThis).__zod_globalRegistry??(C.__zod_globalRegistry=i3());let i9=globalThis.__zod_globalRegistry;function i8(e,t){return new e({type:"string",...tw(t)})}function i7(e,t){return new e({type:"string",coerce:!0,...tw(t)})}function ae(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...tw(t)})}function at(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...tw(t)})}function ar(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...tw(t)})}function an(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...tw(t)})}function ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...tw(t)})}function aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...tw(t)})}function ao(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...tw(t)})}function as(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...tw(t)})}function al(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...tw(t)})}function au(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...tw(t)})}function ac(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...tw(t)})}function ad(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...tw(t)})}function ap(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...tw(t)})}function ah(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...tw(t)})}function af(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...tw(t)})}function am(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...tw(t)})}function ag(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...tw(t)})}function ay(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...tw(t)})}function av(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...tw(t)})}function ab(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...tw(t)})}function ax(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...tw(t)})}function ak(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...tw(t)})}function aw(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...tw(t)})}e.s(["$ZodRegistry",0,i6,"$input",0,i5,"$output",0,i4,"globalRegistry",0,i9,"registry",0,i3],525527);let a_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function aS(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...tw(t)})}function aE(e,t){return new e({type:"string",format:"date",check:"string_format",...tw(t)})}function aC(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...tw(t)})}function a$(e,t){return new e({type:"string",format:"duration",check:"string_format",...tw(t)})}function aT(e,t){return new e({type:"number",checks:[],...tw(t)})}function aI(e,t){return new e({type:"number",coerce:!0,checks:[],...tw(t)})}function aN(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...tw(t)})}function aA(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...tw(t)})}function aj(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...tw(t)})}function aM(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...tw(t)})}function aO(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...tw(t)})}function aD(e,t){return new e({type:"boolean",...tw(t)})}function aR(e,t){return new e({type:"boolean",coerce:!0,...tw(t)})}function aP(e,t){return new e({type:"bigint",...tw(t)})}function az(e,t){return new e({type:"bigint",coerce:!0,...tw(t)})}function aL(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...tw(t)})}function aF(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...tw(t)})}function aU(e,t){return new e({type:"symbol",...tw(t)})}function aB(e,t){return new e({type:"undefined",...tw(t)})}function aZ(e,t){return new e({type:"null",...tw(t)})}function aq(e){return new e({type:"any"})}function aV(e){return new e({type:"unknown"})}function aH(e,t){return new e({type:"never",...tw(t)})}function aK(e,t){return new e({type:"void",...tw(t)})}function aW(e,t){return new e({type:"date",...tw(t)})}function aJ(e,t){return new e({type:"date",coerce:!0,...tw(t)})}function aG(e,t){return new e({type:"nan",...tw(t)})}function aX(e,t){return new r2({check:"less_than",...tw(t),value:e,inclusive:!1})}function aY(e,t){return new r2({check:"less_than",...tw(t),value:e,inclusive:!0})}function aQ(e,t){return new r4({check:"greater_than",...tw(t),value:e,inclusive:!1})}function a0(e,t){return new r4({check:"greater_than",...tw(t),value:e,inclusive:!0})}function a1(e){return aQ(0,e)}function a2(e){return aX(0,e)}function a4(e){return aY(0,e)}function a5(e){return a0(0,e)}function a6(e,t){return new r5({check:"multiple_of",...tw(t),value:e})}function a3(e,t){return new r9({check:"max_size",...tw(t),maximum:e})}function a9(e,t){return new r8({check:"min_size",...tw(t),minimum:e})}function a8(e,t){return new r7({check:"size_equals",...tw(t),size:e})}function a7(e,t){return new ne({check:"max_length",...tw(t),maximum:e})}function oe(e,t){return new nt({check:"min_length",...tw(t),minimum:e})}function ot(e,t){return new nr({check:"length_equals",...tw(t),length:e})}function or(e,t){return new ni({check:"string_format",format:"regex",...tw(t),pattern:e})}function on(e){return new na({check:"string_format",format:"lowercase",...tw(e)})}
37function oi(e){return new no({check:"string_format",format:"uppercase",...tw(e)})}function oa(e,t){return new ns({check:"string_format",format:"includes",...tw(t),includes:e})}function oo(e,t){return new nl({check:"string_format",format:"starts_with",...tw(t),prefix:e})}function ol(e,t){return new nu({check:"string_format",format:"ends_with",...tw(t),suffix:e})}function ou(e,t,r){return new nd({check:"property",property:e,schema:t,...tw(r)})}function oc(e,t){return new np({check:"mime_type",mime:e,...tw(t)})}function od(e){return new nh({check:"overwrite",tx:e})}function op(e){return od(t=>t.normalize(e))}function oh(){return od(e=>e.trim())}function of(){return od(e=>e.toLowerCase())}function om(){return od(e=>e.toUpperCase())}function og(){return od(e=>tp(e))}function oy(e,t,r){return new e({type:"array",element:t,...tw(r)})}function ov(e,t,r){return new e({type:"union",options:t,...tw(r)})}function ob(e,t,r){return new e({type:"union",options:t,inclusive:!1,...tw(r)})}function ox(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...tw(n)})}function ok(e,t,r){return new e({type:"intersection",left:t,right:r})}function ow(e,t,r,n){let i=r instanceof ng,a=i?n:r;return new e({type:"tuple",items:t,rest:i?r:null,...tw(a)})}function o_(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...tw(n)})}function oS(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...tw(n)})}function oE(e,t,r){return new e({type:"set",valueType:t,...tw(r)})}function oC(e,t,r){return new e({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...tw(r)})}function o$(e,t,r){return new e({type:"enum",entries:t,...tw(r)})}function oT(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...tw(r)})}function oI(e,t){return new e({type:"file",...tw(t)})}function oN(e,t){return new e({type:"transform",transform:t})}function oA(e,t){return new e({type:"optional",innerType:t})}function oj(e,t){return new e({type:"nullable",innerType:t})}function oM(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():ty(r)}})}function oO(e,t,r){return new e({type:"nonoptional",innerType:t,...tw(r)})}function oD(e,t){return new e({type:"success",innerType:t})}function oR(e,t,r){return new e({type:"catch",innerType:t,catchValue:"function"==typeof r?r:()=>r})}function oP(e,t,r){return new e({type:"pipe",in:t,out:r})}function oz(e,t){return new e({type:"readonly",innerType:t})}function oL(e,t,r){return new e({type:"template_literal",parts:t,...tw(r)})}function oF(e,t){return new e({type:"lazy",getter:t})}function oU(e,t){return new e({type:"promise",innerType:t})}function oB(e,t,r){let n=tw(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function oZ(e,t,r){return new e({type:"custom",check:"custom",fn:t,...tw(r)})}function oq(e){let t=oV(r=>(r.addIssue=e=>{"string"==typeof e?r.issues.push(tO(e,r.value,t._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=r.value),e.inst??(e.inst=t),e.continue??(e.continue=!t._zod.def.abort),r.issues.push(tO(e)))},e(r.value,r)));return t}function oV(e,t){let r=new r0({check:"custom",...tw(t)});return r._zod.check=e,r}function oH(e){let t=new r0({check:"describe"});return t._zod.onattach=[t=>{let r=i9.get(t)??{};i9.add(t,{...r,description:e})}],t._zod.check=()=>{},t}function oK(e){let t=new r0({check:"meta"});return t._zod.onattach=[t=>{let r=i9.get(t)??{};i9.add(t,{...r,...e})}],t._zod.check=()=>{},t}function oW(e,t){let r=tw(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];"sensitive"!==r.case&&(n=n.map(e=>"string"==typeof e?e.toLowerCase():e),i=i.map(e=>"string"==typeof e?e.toLowerCase():e));let a=new Set(n),o=new Set(i),s=e.Codec??iP,l=e.Boolean??nJ,u=new s({type:"pipe",in:new(e.String??ny)({type:"string",error:r.error}),out:new l({type:"boolean",error:r.error}),transform:(e,t)=>{let n=e;return"sensitive"!==r.case&&(n=n.toLowerCase()),!!a.has(n)||!o.has(n)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...o],input
37:t.value,inst:u,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?n[0]||"true":i[0]||"false",error:r.error});return u}function oJ(e,t,r,n={}){let i=tw(n),a={...tw(n),check:"string_format",type:"string",format:t,fn:"function"==typeof r?r:e=>r.test(e),...i};return r instanceof RegExp&&(a.pattern=r),new e(a)}function oG(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??i9,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function oX(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{let r=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,r,n)}let a=e._zod.parent;a&&(o.ref||(o.ref=a),oX(a,t,n),t.seen.get(a).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&function e(t,r){let n=r??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,n);if("set"===i.type)return e(i.valueType,n);if("lazy"===i.type)return e(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,n);if("intersection"===i.type)return e(i.left,n)||e(i.right,n);if("record"===i.type||"map"===i.type)return e(i.keyType,n)||e(i.valueType,n);if("pipe"===i.type)return e(i.in,n)||e(i.out,n);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],n))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,n))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,n))return!0;if(i.rest&&e(i.rest,n))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function oY(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=n.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let n=t[1],{ref:i,defId:a}=(t=>{let n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${n}/${a}`}}if(t[1]===r)return{ref:"#"};let i=`#/${n}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}})(t);n.def={...n.schema},a&&(n.defId=a);let o=n.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root> 38 39Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function oQ(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};
39if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?i.$defs=a:i.definitions=a);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:o1(t,"input",e.processors),output:o1(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}e.s(["TimePrecision",0,a_,"_any",0,aq,"_array",0,oy,"_base64",0,ab,"_base64url",0,ax,"_bigint",0,aP,"_boolean",0,aD,"_catch",0,oR,"_check",0,oV,"_cidrv4",0,ay,"_cidrv6",0,av,"_coercedBigint",0,az,"_coercedBoolean",0,aR,"_coercedDate",0,aJ,"_coercedNumber",0,aI,"_coercedString",0,i7,"_cuid",0,au,"_cuid2",0,ac,"_
39custom",0,oB,"_date",0,aW,"_default",0,oM,"_discriminatedUnion",0,ox,"_e164",0,ak,"_email",0,ae,"_emoji",0,as,"_endsWith",0,ol,"_enum",0,oC,"_file",0,oI,"_float32",0,aA,"_float64",0,aj,"_gt",0,aQ,"_gte",0,a0,"_guid",0,at,"_includes",0,oa,"_int",0,aN,"_int32",0,aM,"_int64",0,aL,"_intersection",0,ok,"_ipv4",0,af,"_ipv6",0,am,"_isoDate",0,aE,"_isoDateTime",0,aS,"_isoDuration",0,a$,"_isoTime",0,aC,"_jwt",0,aw,"_ksuid",0,ah,"_lazy",0,oF,"_length",0,ot,"_literal",0,oT,"_lowercase",0,on,"_lt",0,aX,"_lte",0,aY,"_mac",0,ag,"_map",0,oS,"_max",0,aY,"_maxLength",0,a7,"_maxSize",0,a3,"_mime",0,oc,"_min",0,a0,"_minLength",0,oe,"_minSize",0,a9,"_multipleOf",0,a6,"_nan",0,aG,"_nanoid",0,al,"_nativeEnum",0,o$,"_negative",0,a2,"_never",0,aH,"_nonnegative",0,a5,"_nonoptional",0,oO,"_nonpositive",0,a4,"_normalize",0,op,"_null",0,aZ,"_nullable",0,oj,"_number",0,aT,"_optional",0,oA,"_overwrite",0,od,"_pipe",0,oP,"_positive",0,a1,"_promise",0,oU,"_property",0,ou,"_readonly",0,oz,"_record",0,o_,"_refine",0,oZ,"_regex",0,or,"_set",0,oE,"_size",0,a8,"_slugify",0,og,"_startsWith",0,oo,"_string",0,i8,"_stringFormat",0,oJ,"_stringbool",0,oW,"_success",0,oD,"_superRefine",0,oq,"_symbol",0,aU,"_templateLiteral",0,oL,"_toLowerCase",0,of,"_toUpperCase",0,om,"_transform",0,oN,"_trim",0,oh,"_tuple",0,ow,"_uint32",0,aO,"_uint64",0,aF,"_ulid",0,ad,"_undefined",0,aB,"_union",0,ov,"_unknown",0,aV,"_uppercase",0,oi,"_url",0,ao,"_uuid",0,ar,"_uuidv4",0,an,"_uuidv6",0,ai,"_uuidv7",0,aa,"_void",0,aK,"_xid",0,ap,"_xor",0,ob,"describe",0,oH,"meta",0,oK],650215);let o0=(e,t={})=>r=>{let n=oG({...r,processors:t});return oX(e,n),oY(n,e),oQ(n,e)},o1=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=oG({...i??{},target:a,io:t,processors:r});return oX(e,o),oY(o,e),oQ(o,e)};e.s(["createStandardJSONSchemaMethod",0,o1,"createToJSONSchemaMethod",0,o0,"extractDefs",0,oY,"finalize",0,oQ,"initializeContext",0,oG,"process",0,oX],34966);let o2={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o4=(e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=o2[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},o5=(e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number","number"==typeof u&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u),"number"==typeof i&&(r.minimum=i,"number"==typeof u&&"draft-04"!==t.target&&(u>=i?delete r.minimum:delete r.exclusiveMinimum)),"number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l),"number"==typeof a&&(r.maximum=a,"number"==typeof l&&"draft-04"!==t.target&&(l<=a?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof s&&(r.multipleOf=s)},o6=(e,t,r,n)=>{r.type="boolean"},o3=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},o9=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},o8=(e,t,r,n)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},o7=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},se=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},st=(e,t,r,n)=>{r.not={}},sr=(e,t,r,n)=>{},sn=(e,t,r,n)=>{},si=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},sa=(e,t,r,n)=>{let i=te(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},so=(e,t,r,n)=>{let i=e._zod.def,a=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else a.push(Number(e));else a.push(e);if(0===a.length);else if(1===a.length){let e=a[0];
39r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else a.every(e=>"number"==typeof e)&&(r.type="number"),a.every(e=>"string"==typeof e)&&(r.type="string"),a.every(e=>"boolean"==typeof e)&&(r.type="boolean"),a.every(e=>null===e)&&(r.type="null"),r.enum=a},ss=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},sl=(e,t,r,n)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},su=(e,t,r,n)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:o,mime:s}=e._zod.bag;void 0!==a&&(i.minLength=a),void 0!==o&&(i.maxLength=o),s?1===s.length?(i.contentMediaType=s[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=s.map(e=>({contentMediaType:e}))):Object.assign(r,i)},sc=(e,t,r,n)=>{r.type="boolean"},sd=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},sp=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},sh=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},sf=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},sm=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},sg=(e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=oX(i.element,t,{...n,path:[...n.path,"items"]})},sy=(e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=oX(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=oX(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},sv=(e,t,r,n)=>{let i=e._zod.def,a=!1===i.inclusive,o=i.options.map((e,r)=>oX(e,t,{...n,path:[...n.path,a?"oneOf":"anyOf",r]}));a?r.oneOf=o:r.anyOf=o},sb=(e,t,r,n)=>{let i=e._zod.def,a=oX(i.left,t,{...n,path:[...n.path,"allOf",0]}),o=oX(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},sx=(e,t,r,n)=>{let i=e._zod.def;r.type="array";let a="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>oX(e,t,{...n,path:[...n.path,a,r]})),l=i.rest?oX(i.rest,t,{...n,path:[...n.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=s,l&&(r.items=l)):"open
39api-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l),r.minItems=s.length,l||(r.maxItems=s.length)):(r.items=s,l&&(r.additionalItems=l));let{minimum:u,maximum:c}=e._zod.bag;"number"==typeof u&&(r.minItems=u),"number"==typeof c&&(r.maxItems=c)},sk=(e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=oX(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=oX(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=oX(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let l=a._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},sw=(e,t,r,n)=>{let i=e._zod.def,a=oX(i.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},s_=(e,t,r,n)=>{let i=e._zod.def;oX(i.innerType,t,n),t.seen.get(e).ref=i.innerType},sS=(e,t,r,n)=>{let i=e._zod.def;oX(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},sE=(e,t,r,n)=>{let i=e._zod.def;oX(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},sC=(e,t,r,n)=>{let i,a=e._zod.def;oX(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},s$=(e,t,r,n)=>{let i=e._zod.def,a="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;oX(a,t,n),t.seen.get(e).ref=a},sT=(e,t,r,n)=>{let i=e._zod.def;oX(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},sI=(e,t,r,n)=>{let i=e._zod.def;oX(i.innerType,t,n),t.seen.get(e).ref=i.innerType},sN=(e,t,r,n)=>{let i=e._zod.def;oX(i.innerType,t,n),t.seen.get(e).ref=i.innerType},sA=(e,t,r,n)=>{let i=e._zod.innerType;oX(i,t,n),t.seen.get(e).ref=i},sj={string:o4,number:o5,boolean:o6,bigint:o3,symbol:o9,null:o8,undefined:o7,void:se,never:st,any:sr,unknown:sn,date:si,enum:sa,literal:so,nan:ss,template_literal:sl,file:su,success:sc,custom:sd,function:sp,transform:sh,map:sf,set:sm,array:sg,object:sy,union:sv,intersection:sb,tuple:sx,record:sk,nullable:sw,nonoptional:s_,default:sS,prefault:sE,catch:sC,pipe:s$,readonly:sT,promise:sI,optional:sN,lazy:sA};function sM(e,t){if("_idmap"in e){let r=oG({...t,processors:sj}),n={};
39for(let t of e._idmap.entries()){let[e,n]=t;oX(n,r)}let i={};for(let a of(r.external={registry:e,uri:t?.uri,defs:n},e._idmap.entries())){let[e,t]=a;oY(r,t),i[e]=oQ(r,t)}return Object.keys(n).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:n}),{schemas:i}}let r=oG({...t,processors:sj});return oX(e,r),oY(r,e),oQ(r,e)}e.s([],292135),e.s(["ZodAny",()=>uo,"ZodArray",()=>ug,"ZodBase64",()=>lR,"ZodBase64URL",()=>lz,"ZodBigInt",()=>l6,"ZodBigIntFormat",()=>l9,"ZodBoolean",()=>l4,"ZodCIDRv4",()=>lj,"ZodCIDRv6",()=>lO,"ZodCUID",()=>lg,"ZodCUID2",()=>lv,"ZodCatch",()=>ct,"ZodCodec",()=>cs,"ZodCustom",()=>cb,"ZodCustomStringFormat",()=>lq,"ZodDate",()=>uf,"ZodDefault",()=>u4,"ZodDiscriminatedUnion",()=>u$,"ZodE164",()=>lF,"ZodEmail",()=>le,"ZodEmoji",()=>lp,"ZodEnum",()=>uU,"ZodExactOptional",()=>uY,"ZodFile",()=>uH,"ZodFunction",()=>cy,"ZodGUID",()=>lr,"ZodIPv4",()=>lC,"ZodIPv6",()=>lN,"ZodIntersection",()=>uI,"ZodJWT",()=>lB,"ZodKSUID",()=>lS,"ZodLazy",()=>ch,"ZodLiteral",()=>uq,"ZodMAC",()=>lT,"ZodMap",()=>uP,"ZodNaN",()=>cn,"ZodNanoID",()=>lf,"ZodNever",()=>uc,"ZodNonOptional",()=>u9,"ZodNull",()=>ui,"ZodNullable",()=>u0,"ZodNumber",()=>lJ,"ZodNumberFormat",()=>lX,"ZodObject",()=>ub,"ZodOptional",()=>uG,"ZodPipe",()=>ca,"ZodPrefault",()=>u6,"ZodPromise",()=>cm,"ZodReadonly",()=>cu,"ZodRecord",()=>uM,"ZodSet",()=>uL,"ZodString",()=>s9,"ZodStringFormat",()=>s7,"ZodSuccess",()=>u7,"ZodSymbol",()=>ue,"ZodTemplateLiteral",()=>cd,"ZodTransform",()=>uW,"ZodTuple",()=>uA,"ZodType",()=>s6,"ZodULID",()=>lx,"ZodURL",()=>lu,"ZodUUID",()=>li,"ZodUndefined",()=>ur,"ZodUnion",()=>u_,"ZodUnknown",()=>ul,"ZodVoid",()=>up,"ZodXID",()=>lw,"ZodXor",()=>uE,"_ZodString",()=>s3,"_default",()=>u5,"_function",()=>cv,"any",()=>us,"array",()=>uy,"base64",()=>lP,"base64url",()=>lL,"bigint",()=>l3,"boolean",()=>l5,"catch",()=>cr,"check",()=>cx,"cidrv4",()=>lM,"cidrv6",()=>lD,"codec",()=>cl,"cuid",()=>ly,"cuid2",()=>lb,"custom",()=>ck,"date",()=>um,"describe",()=>cS,"discriminatedUnion",()=>uT,"e164",()=>lU,"email",()=>lt,"emoji",()=>lh,"enum",()=>uB,"exactOptional",()=>uQ,"file",()=>uK,"float32",()=>lQ,"float64",()=>l0,"function",()=>cv,"guid",()=>ln,"hash",()=>lW,"hex",()=>lK,"hostname",()=>lH,"httpUrl",()=>ld,"instanceof",()=>cC,"int",()=>lY,"int32",()=>l1,"int64",()=>l8,"intersection",()=>uN,"ipv4",()=>l$,"ipv6",()=>lA,"json",()=>cT,"jwt",()=>lZ,"keyof",()=>uv,"ksuid",()=>lE,"lazy",()=>cf,"literal",()=>uV,"looseObject",()=>uw,"looseRecord",()=>uR,"mac",()=>lI,"map",()=>uz,"meta",()=>cE,"nan",()=>ci,"nanoid",()=>lm,"nativeEnum",()=>uZ,"never",()=>ud,"nonoptional",()=>u8,"null",()=>ua,"nullable",()=>u1,"nullish",()=>u2,"number",()=>lG,"object",()=>ux,"optional",()=>uX,"partialRecord",()=>uD,"pipe",()=>co,"prefault",()=>u3,"preprocess",()=>cI,"promise",()=>cg,"readonly",()=>cc,"record",()=>uO,"refine",()=>cw,"set",()=>uF,"strictObject",()=>uk,"string",()=>s8,"stringFormat",()=>lV,"stringbool",()=>c$,"success",()=>ce,"superRefine",()=>c_,"symbol",()=>ut,"templateLiteral",()=>cp,"transform",()=>uJ,"tuple",()=>uj,"uint32",()=>l2,"uint64",()=>l7,"ulid",()=>lk,"undefined",()=>un,"union",()=>uS,"unknown",()=>uu,"url",()=>lc,"uuid",()=>la,"uuidv4",()=>lo,"uuidv6",()=>ls,"uuidv7",()=>ll,"void",()=>uh,"xid",()=>l_,"xor",()=>uC],362201);var sO=e.i(682358),sO=sO,sD=e.i(922143),sD=sD;e.s([],342332),e.s(["ZodISODate",()=>sz,"ZodISODateTime",()=>sR,"ZodISODuration",()=>sB,"ZodISOTime",()=>sF,"date",()=>sL,"datetime",()=>sP,"duration",()=>sZ,"time",()=>sU],49732);let sR=e5("ZodISODateTime",(e,t)=>{nN.init(e,t),s7.init(e,t)});function sP(e){return aS(sR,e)}let sz=e5("ZodISODate",(e,t)=>{nA.init(e,t),s7.init(e,t)});function sL(e){return aE(sz,e)}let sF=e5("ZodISOTime",(e,t)=>{nj.init(e,t),s7.init(e,t)});function sU(e){return aC(sF,e)}let sB=e5("ZodISODuration",(e,t)=>{nM.init(e,t),s7.init(e,t)});function sZ(e){return a$(sB,e)}let sq=(e,t)=>{tz.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>tU(e,t)},flatten:{value:t=>tF(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,tr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,tr,2)}},isEmpty:{get:()=>0===e.issues.length}})},sV=e5("ZodError",sq),sH=e5("ZodError",sq,{Parent:Error});e.s(["ZodError",0,sV,"ZodRealError",0,sH],789282);let sK=tV(sH),sW=tK(sH),sJ=tJ(sH),sG=tX(sH),sX=tQ(sH),sY=t1(sH),sQ=t4(sH),s0=t6(sH),s1=t9(sH),s2=t7(sH),s4=rt(sH),s5=rn(sH);e.s(["decode",0,sY,"decodeAsync",0,s0,"encode",0,sX,"encodeAsync",0,sQ,"parse",0,sK,"parseAsync",0,sW,"safeDecode",0,s2,"safeDecodeAsync",0,s5,"safeEncode",0,s1,"safeEncodeAsync",0,s4,"safeParse",0,sJ,"safeParseAsync",0,sG],100364);let s6=e5("ZodType",(e,t)=>(ng.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:o1(e,"input"),output:o1(e,"output")}}),e.toJSONSchema=o0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(sD.mergeDefs(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>tk(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>sK(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>sJ(e,t,r),e.parseAsync=async(t,r)=>sW(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>sG(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>sX(e,t,r),e.decode=(t,r)=>sY(e,t,r),e.encodeAsync=async(t,r)=>sQ(e,t,r),e.decodeAsync=async(t,r)=>s0(e,t,r),e.safeEncode=(t,r)=>s1(e,t,r),e.safeDecode=(t,r)=>s2(e,t,r),e.safeEncodeAsync=async(t,r)=>s4(e,t,r),e.safeDecodeAsync=async(t,r)=>s5(e,t,r),e.refine=(t,r)=>e.check(cw(t,r)),e.superRefine=t=>e.check(c_(t)),e.overwrite=t=>
vendor: 12,252 bytes, line 39
39e.check(od(t)),e.optional=()=>uX(e),e.exactOptional=()=>uQ(e),e.nullable=()=>u1(e),e.nullish=()=>uX(u1(e)),e.nonoptional=t=>u8(e,t),e.array=()=>uy(e),e.or=t=>uS([e,t]),e.and=t=>uN(e,t),e.transform=t=>co(e,uJ(t)),e.default=t=>u5(e,t),e.prefault=t=>u3(e,t),e.catch=t=>cr(e,t),e.pipe=t=>co(e,t),e.readonly=()=>cc(e),e.describe=t=>{let r=e.clone();return i9.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>i9.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return i9.get(e);let r=e.clone();return i9.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),s3=e5("_ZodString",(e,t)=>{ny.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o4(e,t,r,n);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(or(...t)),e.includes=(...t)=>e.check(oa(...t)),e.startsWith=(...t)=>e.check(oo(...t)),e.endsWith=(...t)=>e.check(ol(...t)),e.min=(...t)=>e.check(oe(...t)),e.max=(...t)=>e.check(a7(...t)),e.length=(...t)=>e.check(ot(...t)),e.nonempty=(...t)=>e.check(oe(1,...t)),e.lowercase=t=>e.check(on(t)),e.uppercase=t=>e.check(oi(t)),e.trim=()=>e.check(oh()),e.normalize=(...t)=>e.check(op(...t)),e.toLowerCase=()=>e.check(of()),e.toUpperCase=()=>e.check(om()),e.slugify=()=>e.check(og())}),s9=e5("ZodString",(e,t)=>{ny.init(e,t),s3.init(e,t),e.email=t=>e.check(ae(le,t)),e.url=t=>e.check(ao(lu,t)),e.jwt=t=>e.check(aw(lB,t)),e.emoji=t=>e.check(as(lp,t)),e.guid=t=>e.check(at(lr,t)),e.uuid=t=>e.check(ar(li,t)),e.uuidv4=t=>e.check(an(li,t)),e.uuidv6=t=>e.check(ai(li,t)),e.uuidv7=t=>e.check(aa(li,t)),e.nanoid=t=>e.check(al(lf,t)),e.guid=t=>e.check(at(lr,t)),e.cuid=t=>e.check(au(lg,t)),e.cuid2=t=>e.check(ac(lv,t)),e.ulid=t=>e.check(ad(lx,t)),e.base64=t=>e.check(ab(lR,t)),e.base64url=t=>e.check(ax(lz,t)),e.xid=t=>e.check(ap(lw,t)),e.ksuid=t=>e.check(ah(lS,t)),e.ipv4=t=>e.check(af(lC,t)),e.ipv6=t=>e.check(am(lN,t)),e.cidrv4=t=>e.check(ay(lj,t)),e.cidrv6=t=>e.check(av(lO,t)),e.e164=t=>e.check(ak(lF,t)),e.datetime=t=>e.check(sP(t)),e.date=t=>e.check(sL(t)),e.time=t=>e.check(sU(t)),e.duration=t=>e.check(sZ(t))});function s8(e){return i8(s9,e)}let s7=e5("ZodStringFormat",(e,t)=>{nv.init(e,t),s3.init(e,t)}),le=e5("ZodEmail",(e,t)=>{nk.init(e,t),s7.init(e,t)});function lt(e){return ae(le,e)}let lr=e5("ZodGUID",(e,t)=>{nb.init(e,t),s7.init(e,t)});function ln(e){return at(lr,e)}let li=e5("ZodUUID",(e,t)=>{nx.init(e,t),s7.init(e,t)});function la(e){return ar(li,e)}function lo(e){return an(li,e)}function ls(e){return ai(li,e)}function ll(e){return aa(li,e)}let lu=e5("ZodURL",(e,t)=>{nw.init(e,t),s7.init(e,t)});function lc(e){return ao(lu,e)}function ld(e){return ao(lu,{protocol:/^https?$/,hostname:sO.domain,...sD.normalizeParams(e)})}let lp=e5("ZodEmoji",(e,t)=>{n_.init(e,t),s7.init(e,t)});function lh(e){return as(lp,e)}let lf=e5("ZodNanoID",(e,t)=>{nS.init(e,t),s7.init(e,t)});function lm(e){return al(lf,e)}let lg=e5("ZodCUID",(e,t)=>{nE.init(e,t),s7.init(e,t)});function ly(e){return au(lg,e)}let lv=e5("ZodCUID2",(e,t)=>{nC.init(e,t),s7.init(e,t)});function lb(e){return ac(lv,e)}let lx=e5("ZodULID",(e,t)=>{n$.init(e,t),s7.init(e,t)});function lk(e){return ad(lx,e)}let lw=e5("ZodXID",(e,t)=>{nT.init(e,t),s7.init(e,t)});function l_(e){return ap(lw,e)}let lS=e5("ZodKSUID",(e,t)=>{nI.init(e,t),s7.init(e,t)});function lE(e){return ah(lS,e)}let lC=e5("ZodIPv4",(e,t)=>{nO.init(e,t),s7.init(e,t)});function l$(e){return af(lC,e)}let lT=e5("ZodMAC",(e,t)=>{nR.init(e,t),s7.init(e,t)});function lI(e){return ag(lT,e)}let lN=e5("ZodIPv6",(e,t)=>{nD.init(e,t),s7.init(e,t)});function lA(e){return am(lN,e)}let lj=e5("ZodCIDRv4",(e,t)=>{nP.init(e,t),s7.init(e,t)});function lM(e){return ay(lj,e)}let lO=e5("ZodCIDRv6",(e,t)=>{nz.init(e,t),s7.init(e,t)});function lD(e){return av(lO,e)}let lR=e5("ZodBase64",(e,t)=>{nF.init(e,t),s7.init(e,t)});function lP(e){return ab(lR,e)}let lz=e5("ZodBase64URL",(e,t)=>{nB.init(e,t),s7.init(e,t)});function lL(e){return ax(lz,e)}let lF=e5("ZodE164",(e,t)=>{nZ.init(e,t),s7.init(e,t)});function lU(e){return ak(lF,e)}let lB=e5("ZodJWT",(e,t)=>{nV.init(e,t),s7.init(e,t)});function lZ(e){return aw(lB,e)}let lq=e5("ZodCustomStringFormat",(e,t)=>{nH.init(e,t),s7.init(e,t)});function lV(e,t,r={}){return oJ(lq,e,t,r)}function lH(e){return oJ(lq,"hostname",sO.hostname,e)}function lK(e){return oJ(lq,"hex",sO.hex,e)}function lW(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=sO[n];if(!i)throw Error(`Unrecognized hash format: ${n}`);return oJ(lq,n,i,t)}let lJ=e5("ZodNumber",(e,t)=>{nK.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o5(e,t,r,n),e.gt=(t,r)=>e.check(aQ(t,r)),e.gte=(t,r)=>e.check(a0(t,r)),e.min=(t,r)=>e.check(a0(t,r)),e.lt=(t,r)=>e.check(aX(t,r)),e.lte=(t,r)=>e.check(aY(t,r)),e.max=(t,r)=>e.check(aY(t,r)),e.int=t=>e.check(lY(t)),e.safe=t=>e.check(lY(t)),e.positive=t=>e.check(aQ(0,t)),e.nonnegative=t=>e.check(a0(0,t)),e.negative=t=>e.check(aX(0,t)),e.nonpositive=t=>e.check(aY(0,t)),e.multipleOf=(t,r)=>e.check(a6(t,r)),e.step=(t,r)=>e.check(a6(t,r)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function lG(e){return aT(lJ,e)}let lX=e5("ZodNumberFormat",(e,t)=>{nW.init(e,t),lJ.init(e,t)});function lY(e){return aN(lX,e)}function lQ(e){return aA(lX,e)}function l0(e){return aj(lX,e)}function l1(e){return aM(lX,e)}function l2(e){return aO(lX,e)}let l4=e5("ZodBoolean",(e,t)=>{nJ.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o6(e,t,r,n)});function l5(e){return aD(l4,e)}let l6=e5("ZodBigInt",(e,t)=>{nG.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o3(e,t,r,n),e.gte=(t,r)=>e.check(a0(t,r)),e.min=(t,r)=>e.check(a0(t,r)),e.gt=(t,r)=>e.check(aQ(t,r)),e.gte=(t,r)=>e.check(a0(t,r)),e.min=(t,r)=>e.check(a0(t,r)),e.lt=(t,r)=>e.check(aX(t,r)),e.lte=(t,r)=>e.check(aY(t,r)),e.max=(t,r)=>e.check(aY(t,r)),e.positive=t=>e.check(aQ(BigInt(0),t)),e.negative=t=>e.check(aX(BigInt(0),t)),e.nonpositive=t=>e.check(aY(BigInt(0),t)),e.nonnegative=t=>e.check(a0(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(a6(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function l3(e){return aP(l6,e)}let l9=e5("ZodBigIntFormat",(e,t)=>{nX.init(e,t),l6.init(e,t)});function l8(e){return aL(l9,e)}function l7(e){return aF(l9,e)}let ue=e5("ZodSymbol",(e,t)=>{nY.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o9(e,t,r,n)});function ut(e){return aU(ue,e)}let ur=e5("ZodUndefined",(e,t)=>{nQ.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o7(e,t,r,n)});function un(e){return aB(ur,e)}let ui=e5("ZodNull",(e,t)=>{n0.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>o8(e,t,r,n)});function ua(e){return aZ(ui,e)}let uo=e5("ZodAny",(e,t)=>{n1.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sr(e,t,r,n)});function us(){return aq(uo)}let ul=e5("ZodUnknown",(e,t)=>{n2.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sn(e,t,r,n)});function uu(){return aV(ul)}let uc=e5("ZodNever",(e,t)=>{n4.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>st(e,t,r,n)});function ud(e){return aH(uc,e)}let up=e5("ZodVoid",(e,t)=>{n5.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>se(e,t,r,n)});function uh(e){return aK(up,e)}let uf=e5("ZodDate",(e,t)=>{n6.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>si(e,t,r,n),e.min=(t,r)=>e.check(a0(t,r)),e.max=(t,r)=>e.check(aY(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function um(e){return aW(uf,e)}let ug=e5("ZodArray",(e,t)=>{n9.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sg(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(oe(t,r)),e.nonempty=t=>e.check(oe(1,t)),e.max=(t,r)=>e.check(a7(t,r)),e.length=(t,r)=>e.check(ot(t,r)),e.unwrap=()=>e.element});function uy(e,t){return oy(ug,e,t)}function uv(e){return uB(Object.keys(e._zod.def.shape))}let ub=e5("ZodObject",(e,t)=>{ir.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sy(e,t,r,n),sD.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>uB(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:uu()}),e.loose=()=>e.clone({...e._zod.def,catchall:uu()}),e.strict=()=>e.clone({...e._zod.def,catchall:ud()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>sD.extend(e,t),e.safeExtend=t=>sD.safeExtend(e,t),e.merge=t=>sD.merge(e,t),e.pick=t=>sD.pick(e,t),e.omit=t=>sD.omit(e,t),e.partial=(...t)=>sD.partial(uG,e,t[0]),e.required=(...t)=>sD.required(u9,e,t[0])});function ux(e,t){return new ub({type:"object",shape:e??{},...sD.normalizeParams(t)})}function uk(e,t){return new ub({type:"object",shape:e,catchall:ud(),...sD.normalizeParams(t)})}function uw(e,t){return new ub({type:"object",shape:e,catchall:uu(),...sD.normalizeParams(t)})}let u_=e5("ZodUnion",(e,t)=>{ia.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sv(e,t,r,n),e.options=t.options});function uS(e,t){return new u_({type:"union",options:e,...sD.normalizeParams(t)})}let uE=e5("ZodXor",(e,t)=>{u_.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sv(e,t,r,n),e.options=t.options});function uC(e,t){return new uE({type:"union",options:e,inclusive:!1,...sD.normalizeParams(t)})}let u$=e5("ZodDiscriminatedUnion",(e,t)=>{u_.init(e,t),il.init(e,t)});function uT(e,t,r){return new u$({type:"union",options:t,discriminator:e,...sD.normalizeParams(r)})}let uI=e5("ZodIntersection",(e,t)=>{iu.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sb(e,t,r,n)});function uN(e,t){return new uI({type:"intersection",left:e,right:t})}let uA=e5("ZodTuple",(e,t)=>{id.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sx(e,t,r,n),e.rest=t=>e.clone({...e._zod.def,rest:t})});function uj(e,t,r){let n=t instanceof ng,i=n?r:t;return new uA({type:"tuple",items:e,rest:n?t:null,...sD.normalizeParams(i)})}let uM=e5("ZodRecord",(e,t)=>{ih.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sk(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function uO(e,t,r){return new uM({type:"record",keyType:e,valueType:t,...sD.normalizeParams(r)})}function uD(e,t,r){let n=tk(e);return n._zod.values=void 0,new uM({type:"record",keyType:n,valueType:t,...sD.normalizeParams(r)})}function uR(e,t,r){return new uM({type:"record",keyType:e,valueType:t,mode:"loose",...sD.normalizeParams(r)})}let uP=e5("ZodMap",(e,t)=>{im.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sf(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(a9(...t)),e.nonempty=t=>e.check(a9(1,t)),e.max=(...t)=>e.check(a3(...t)),e.size=(...t)=>e.check(a8(...t))});function uz(e,t,r){return new uP({type:"map",keyType:e,valueType:t,...sD.normalizeParams(r)})}let uL=e5("ZodSet",(e,t)=>{iy.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sm(e,t,r,n),e.min=(...t)=>e.check(a9(...t)),e.nonempty=t=>e.check(a9(1,t)),e.max=(...t)=>e.check(a3(...t)),e.size=(...t)=>e.check(a8(...t))});function uF(e,t){return new uL({type:"set",valueType:e,...sD.normalizeParams(t)})}let uU=e5("ZodEnum",(e,t)=>{ib.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sa(e,t,r,n),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new uU({...t,checks:[],...sD.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new uU({...t,checks:[],...sD.normalizeParams(n),entries:i})}});function uB(e,t){return new uU({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...sD.normalizeParams(t)})}function uZ(e,t){return new uU({type:"enum",entries:e,...sD.normalizeParams(t)})}let uq=e5("ZodLiteral",(e,t)=>{ix.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>so(e,t,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if
39(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function uV(e,t){return new uq({type:"literal",values:Array.isArray(e)?e:[e],...sD.normalizeParams(t)})}let uH=e5("ZodFile",(e,t)=>{ik.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>su(e,t,r,n),e.min=(t,r)=>e.check(a9(t,r)),e.max=(t,r)=>e.check(a3(t,r)),e.mime=(t,r)=>e.check(oc(Array.isArray(t)?t:[t],r))});function uK(e){return oI(uH,e)}let uW=e5("ZodTransform",(e,t)=>{iw.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sh(e,t,r,n),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new e9(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(sD.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(sD.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function uJ(e){return new uW({type:"transform",transform:e})}let uG=e5("ZodOptional",(e,t)=>{iS.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sN(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function uX(e){return new uG({type:"optional",innerType:e})}let uY=e5("ZodExactOptional",(e,t)=>{iE.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sN(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function uQ(e){return new uY({type:"optional",innerType:e})}let u0=e5("ZodNullable",(e,t)=>{iC.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sw(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function u1(e){return new u0({type:"nullable",innerType:e})}function u2(e){return uX(u1(e))}let u4=e5("ZodDefault",(e,t)=>{i$.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sS(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function u5(e,t){return new u4({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():sD.shallowClone(t)}})}let u6=e5("ZodPrefault",(e,t)=>{iI.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sE(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function u3(e,t){return new u6({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():sD.shallowClone(t)}})}let u9=e5("ZodNonOptional",(e,t)=>{iN.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>s_(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function u8(e,t){return new u9({type:"nonoptional",innerType:e,...sD.normalizeParams(t)})}let u7=e5("ZodSuccess",(e,t)=>{ij.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sc(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function ce(e){return new u7({type:"success",innerType:e})}let ct=e5("ZodCatch",(e,t)=>{iM.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sC(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cr(e,t){return new ct({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}let cn=e5("ZodNaN",(e,t)=>{iO.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ss(e,t,r,n)});function ci(e){return aG(cn,e)}let ca=e5("ZodPipe",(e,t)=>{iD.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>s$(e,t,r,n),e.in=t.in,e.out=t.out});function co(e,t){return new ca({type:"pipe",in:e,out:t})}let cs=e5("ZodCodec",(e,t)=>{ca.init(e,t),iP.init(e,t)});function cl(e,t,r){return new cs({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}let cu=e5("ZodReadonly",(e,t)=>{iF.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sT(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new cu({type:"readonly",innerType:e})}let cd=e5("ZodTemplateLiteral",(e,t)=>{iB.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sl(e,t,r,n)});function cp(e,t){return new cd({type:"template_literal",parts:e,...sD.normalizeParams(t)})}let ch=e5("ZodLazy",(e,t)=>{iV.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sA(e,t,r,n),e.unwrap=()=>e._zod.def.getter()});function cf(e){return new ch({type:"lazy",getter:e})}let cm=e5("ZodPromise",(e,t)=>{iq.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sI(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function cg(e){return new cm({type:"promise",innerType:e})}let cy=e5("ZodFunction",(e,t)=>{iZ.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sp(e,t,r,n)});function cv(e){return new cy({type:"function",input:Array.isArray(e?.input)?uj(e?.input):e?.input??uy(uu()),output:e?.output??uu()})}let cb=e5("ZodCustom",(e,t)=>{iH.init(e,t),s6.init(e,t),e._zod.processJSONSchema=(t,r,n)=>sd(e,t,r,n)});function cx(e){let t=new r0({check:"custom"});return t._zod.check=e,t}function ck(e,t){return oB(cb,e??(()=>!0),t)}function cw(e,t={}){return oZ(cb,e,t)}function c_(e){return oq(e)}let cS=oH,cE=oK;function cC(e,t={}){let r=new cb({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...sD.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}let c$=(...e)=>oW({Codec:cs,Boolean:l4,String:s9},...e);function cT(e){let t=cf(()=>uS([s8(e),lG(),l5(),ua(),uy(t),uO(s8(),t)]));return t}function cI(e,t){return co(uJ(e),t)}let cN={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",invali
39d_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cA(e){e7({customError:e})}function cj(){return e7().customError}$||($={}),e.s(["ZodFirstPartyTypeKind",0,$,"ZodIssueCode",0,cN,"getErrorMap",0,cj,"setErrorMap",0,cA],306034),e.i(342332),e.s(["endsWith",0,ol,"gt",0,aQ,"gte",0,a0,"includes",0,oa,"length",0,ot,"lowercase",0,on,"lt",0,aX,"lte",0,aY,"maxLength",0,a7,"maxSize",0,a3,"mime",0,oc,"minLength",0,oe,"minSize",0,a9,"multipleOf",0,a6,"negative",0,a2,"nonnegative",0,a5,"nonpositive",0,a4,"normalize",0,op,"overwrite",0,od,"positive",0,a1,"property",0,ou,"regex",0,or,"size",0,a8,"slugify",0,og,"startsWith",0,oo,"toLowerCase",0,of,"toUpperCase",0,om,"trim",0,oh,"uppercase",0,oi],430421);var cM=e.i(430421),cO=e.i(49732);let cD={...e.i(362201),...cM,iso:cO},cR=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"]);e.s(["bigint",0,function(e){return az(l6,e)},"boolean",0,function(e){return aR(l4,e)},"date",0,function(e){return aJ(uf,e)},"number",0,function(e){return aI(lJ,e)},"string",0,function(e){return i7(s9,e)}],313657),e7(iJ()),e.s([],298821),e.i(298821),e.i(292135),e.i(197753),e.i(803108),e.i(374969),e.i(342311),e.s(["$ZodAny",0,n1,"$ZodArray",0,n9,"$ZodBase64",0,nF,"$ZodBase64URL",0,nB,"$ZodBigInt",0,nG,"$ZodBigIntFormat",0,nX,"$ZodBoolean",0,nJ,"$ZodCIDRv4",0,nP,"$ZodCIDRv6",0,nz,"$ZodCUID",0,nE,"$ZodCUID2",0,nC,"$ZodCatch",0,iM,"$ZodCodec",0,iP,"$ZodCustom",0,iH,"$ZodCustomStringFormat",0,nH,"$ZodDate",0,n6,"$ZodDefault",0,i$,"$ZodDiscriminatedUnion",0,il,"$ZodE164",0,nZ,"$ZodEmail",0,nk,"$ZodEmoji",0,n_,"$ZodEnum",0,ib,"$ZodExactOptional",0,iE,"$ZodFile",0,ik,"$ZodFunction",0,iZ,"$ZodGUID",0,nb,"$ZodIPv4",0,nO,"$ZodIPv6",0,nD,"$ZodISODate",0,nA,"$ZodISODateTime",0,nN,"$ZodISODuration",0,nM,"$ZodISOTime",0,nj,"$ZodIntersection",0,iu,"$ZodJWT",0,nV,"$ZodKSUID",0,nI,"$ZodLazy",0,iV,"$ZodLiteral",0,ix,"$ZodMAC",0,nR,"$ZodMap",0,im,"$ZodNaN",0,iO,"$ZodNanoID",0,nS,"$ZodNever",0,n4,"$ZodNonOptional",0,iN,"$ZodNull",0,n0,"$ZodNullable",0,iC,"$ZodNumber",0,nK,"$ZodNumberFormat",0,nW,"$ZodObject",0,it,"$ZodObjectJIT",0,ir,"$ZodOptional",0,iS,"$ZodPipe",0,iD,"$ZodPrefault",0,iI,"$ZodPromise",0,iq,"$ZodReadonly",0,iF,"$ZodRecord",0,ih,"$ZodSet",0,iy,"$ZodString",0,ny,"$ZodStringFormat",0,nv,"$ZodSuccess",0,ij,"$ZodSymbol",0,nY,"$ZodTemplateLiteral",0,iB,"$ZodTransform",0,iw,"$ZodTuple",0,id,"$ZodType",0,ng,"$ZodULID",0,n$,"$ZodURL",0,nw,"$ZodUUID",0,nx,"$ZodUndefined",0,nQ,"$ZodUnion",0,ia,"$ZodUnknown",0,n2,"$ZodVoid",0,n5,"$ZodXID",0,nT,"$ZodXor",0,is,"clone",0,tk,"isValidBase64",0,nL,"isValidBase64URL",0,nU,"isValidJWT",0,nq],532952),e.i(532952),e.i(355605),e.i(398477);var cP=sD,cz=sO;e.i(543365),e.s(["ar",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ØØ±Ù",verb:"Ø£Ù ÙØÙÙ"},file:{unit:"Ø¨Ø§ÙØª",verb:"Ø£Ù ÙØÙÙ"},array:{unit:"Ø¹ÙØµØ±",verb:"Ø£Ù ÙØÙÙ"},set:{unit:"Ø¹ÙØµØ±",verb:"Ø£Ù ÙØÙÙ"}},t={regex:"Ù
دخÙ",email:"Ø¨Ø±ÙØ¯ Ø¥ÙÙØªØ±ÙÙÙ",url:"رابط",emoji:"Ø¥ÙÙ
ÙØ¬Ù",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ØªØ§Ø±ÙØ® ÙÙÙØª بÙ
Ø¹ÙØ§Ø± ISO",date:"ØªØ§Ø±ÙØ® بÙ
Ø¹ÙØ§Ø± ISO",time:"ÙÙØª بÙ
Ø¹ÙØ§Ø± ISO",duration:"Ù
دة بÙ
Ø¹ÙØ§Ø± ISO",ipv4:"عÙÙØ§Ù IPv4",ipv6:"عÙÙØ§Ù IPv6",cidrv4:"Ù
Ø¯Ù Ø¹ÙØ§ÙÙÙ Ø¨ØµÙØºØ© IPv4",cidrv6:"Ù
Ø¯Ù Ø¹ÙØ§ÙÙÙ Ø¨ØµÙØºØ© IPv6",base64:"ÙÙØµ بترÙ
ÙØ² base64-encoded",base64url:"ÙÙØµ بترÙ
ÙØ² base64url-encoded",json_string:"ÙÙØµ عÙÙ ÙÙØ¦Ø© JSON",e164:"رÙÙ
ÙØ§ØªÙ بÙ
Ø¹ÙØ§Ø± E.164",jwt:"JWT",template_literal:"Ù
دخÙ"},r={nan:"NaN"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ù
Ø¯Ø®ÙØ§Øª ØºÙØ± Ù
ÙØ¨ÙÙØ©: ÙÙØªØ±Ø¶ إدخا٠instanceof ${n.expected}Ø ÙÙÙ٠تÙ
إدخا٠${i}`;return`Ù
Ø¯Ø®ÙØ§Øª ØºÙØ± Ù
ÙØ¨ÙÙØ©: ÙÙØªØ±Ø¶ إدخا٠${e}Ø ÙÙÙ٠تÙ
إدخا٠${i}`}case"invalid_value":if(1===n.values.length)return`Ù
Ø¯Ø®ÙØ§Øª ØºÙØ± Ù
ÙØ¨ÙÙØ©: ÙÙØªØ±Ø¶ إدخا٠${t_(n.values[0])}`;return`Ø§Ø®ØªÙØ§Ø± ØºÙØ± Ù
ÙØ¨ÙÙ: ÙØªÙÙØ¹ Ø§ÙØªÙاء Ø£ØØ¯ ÙØ°Ù Ø§ÙØ®Ùارات: ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return` Ø£ÙØ¨Ø± Ù
٠اÙÙØ§Ø²Ù
: ÙÙØªØ±Ø¶ أ٠تÙÙÙ ${n.origin??"اÙÙÙÙ
Ø©"} ${t} ${n.maximum.toString()} ${r.unit??"Ø¹ÙØµØ±"}`;return`Ø£ÙØ¨Ø± Ù
٠اÙÙØ§Ø²Ù
: ÙÙØªØ±Ø¶ أ٠تÙÙÙ ${n.origin??"اÙÙÙÙ
Ø©"} ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`أصغر Ù
٠اÙÙØ§Ø²Ù
: ÙÙØªØ±Ø¶ ÙÙ ${n.origin} Ø£Ù ÙÙÙÙ ${t} ${n.minimum.toString()} ${r.unit}`;return`أصغر Ù
٠اÙÙØ§Ø²Ù
: ÙÙØªØ±Ø¶ ÙÙ ${n.origin} Ø£Ù ÙÙÙÙ ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ÙÙØµ ØºÙØ± Ù
ÙØ¨ÙÙ: ÙØ¬Ø¨ Ø£Ù ÙØ¨Ø¯Ø£ ب٠"${n.prefix}"`;if("ends_with"===n.format)return`ÙÙØµ ØºÙØ± Ù
ÙØ¨ÙÙ: ÙØ¬Ø¨ Ø£Ù ÙÙØªÙ٠ب٠"${n.suffix}"`;if("includes"===n.format)return`ÙÙØµ ØºÙØ± Ù
ÙØ¨ÙÙ: ÙØ¬Ø¨ Ø£Ù ÙØªØ¶Ù
ÙÙÙ "${n.includes}"`;if("regex"===n.format)return`ÙÙØµ ØºÙØ± Ù
ÙØ¨ÙÙ: ÙØ¬Ø¨ Ø£Ù ÙØ·Ø§Ø¨Ù اÙÙÙ
Ø· ${n.pattern}`;return`${t[n.format]??n.format} ØºÙØ± Ù
ÙØ¨ÙÙ`;case"not_multiple_of":return`رÙÙ
ØºÙØ± Ù
ÙØ¨ÙÙ: ÙØ¬Ø¨ Ø£Ù ÙÙÙÙ Ù
Ù Ù
Ø¶Ø§Ø¹ÙØ§Øª ${n.divisor}`;case"unrecognized_keys":return`Ù
عرÙ${n.keys.length>1?"ات":""} ØºØ±ÙØ¨${n.keys.length>1?"Ø©":""}: ${tt(n.keys,"Ø ")}`;case"invalid_key":return`Ù
Ø¹Ø±Ù ØºÙØ± Ù
ÙØ¨ÙÙ ÙÙ ${n.origin}`;case"invalid_union":default:return"Ù
Ø¯Ø®Ù ØºÙØ± Ù
ÙØ¨ÙÙ";case"invalid_element":return`Ù
Ø¯Ø®Ù ØºÙØ± Ù
ÙØ¨ÙÙ ÙÙ ${n.origin}`}})}},"az",0,function(){let e,t,r;return{localeError:(e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`YanlıŠdÉyÉr: g\xf6zlÉnilÉn instanceof ${n.expected}, daxil olan ${i}`;return`YanlıŠdÉyÉr: g\xf6zlÉnilÉn ${e}, daxil olan ${i}`}case"invalid_value":if(1===n.values.length)return`YanlıŠdÉyÉr: g\xf6zlÉnilÉn ${t_(n.values[0])}`;return`YanlıŠse\xe7im: aÅaÄıdakılardan biri olmalıdır: ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`\xc7ox b\xf6y\xfck: g\xf6zlÉnilÉn ${n.origin??"dÉyÉr"} ${t}${n.maximum.toString()} ${r.unit??"element"}`;return`\xc7ox b\xf6y\xfck: g\xf6zlÉnilÉn ${n.origin??"dÉyÉr"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`\xc7ox ki\xe7ik: g\xf6zlÉnilÉn ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`\xc7ox ki\xe7ik: g\xf6zlÉnilÉn ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`YanlıŠmÉtn: "${n.prefix}" ilÉ baÅlamalıdır`;if("ends_with"===n.format)return`YanlıŠmÉtn: "${n.suffix}" ilÉ bitmÉlidir`;if("includes"===n.format)return`YanlıŠmÉtn: "${n.includes}" daxil olmalıdır`;if("regex"===n.format)return`YanlıŠmÉtn: ${n.pattern} Åablonuna uyÄun olmalıdır`;return`YanlıŠ${t[n.format]??n.format}`;case"not_multiple_of":return`YanlıŠÉdÉd: ${n.divisor} ilÉ b\xf6l\xfcnÉ bilÉn olmalıdır`;case"unrecognized_keys":return`Tanınmayan a\xe7ar${n.keys.length>1?"lar":""}: ${tt(n.keys,", ")}`;
39case"invalid_key":return`${n.origin} daxilindÉ yanlıŠa\xe7ar`;case"invalid_union":default:return"YanlıŠdÉyÉr";case"invalid_element":return`${n.origin} daxilindÉ yanlıŠdÉyÉr`}})}},"be",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"ÑÑмвал",few:"ÑÑмвалÑ",many:"ÑÑмвалаÑ"},verb:"меÑÑ"},array:{unit:{one:"ÑлеменÑ",few:"ÑлеменÑÑ",many:"ÑлеменÑаÑ"},verb:"меÑÑ"},set:{unit:{one:"ÑлеменÑ",few:"ÑлеменÑÑ",many:"ÑлеменÑаÑ"},verb:"меÑÑ"},file:{unit:{one:"байÑ",few:"байÑÑ",many:"байÑаÑ"},verb:"меÑÑ"}},t={regex:"Ñвод",email:"email адÑаÑ",url:"URL",emoji:"ÑмодзÑ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO даÑа Ñ ÑаÑ",date:"ISO даÑа",time:"ISO ÑаÑ",duration:"ISO пÑаÑÑглаÑÑÑ",ipv4:"IPv4 адÑаÑ",ipv6:"IPv6 адÑаÑ",cidrv4:"IPv4 дÑÑпазон",cidrv6:"IPv6 дÑÑпазон",base64:"Ñадок Ñ ÑаÑмаÑе base64",base64url:"Ñадок Ñ ÑаÑмаÑе base64url",json_string:"JSON Ñадок",e164:"нÑÐ¼Ð°Ñ E.164",jwt:"JWT",template_literal:"Ñвод"},r={nan:"NaN",number:"лÑк",array:"маÑÑÑ"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÐÑпÑавÑлÑÐ½Ñ Ñвод: ÑакаÑÑÑ instanceof ${n.expected}, аÑÑÑмана ${i}`;return`ÐÑпÑавÑлÑÐ½Ñ Ñвод: ÑакаÑÑÑ ${e}, аÑÑÑмана ${i}`}case"invalid_value":if(1===n.values.length)return`ÐÑпÑавÑлÑÐ½Ñ Ñвод: ÑакалаÑÑ ${t_(n.values[0])}`;return`ÐÑпÑавÑлÑÐ½Ñ Ð²Ð°ÑÑÑнÑ: ÑакаÑÑÑ Ð°Ð´Ð·Ñн з ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=iW(Number(n.maximum),r.unit.one,r.unit.few,r.unit.many);return`ÐанадÑа вÑлÑкÑ: ÑакалаÑÑ, ÑÑо ${n.origin??"знаÑÑнне"} павÑнна ${r.verb} ${t}${n.maximum.toString()} ${e}`}return`ÐанадÑа вÑлÑкÑ: ÑакалаÑÑ, ÑÑо ${n.origin??"знаÑÑнне"} павÑнна бÑÑÑ ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=iW(Number(n.minimum),r.unit.one,r.unit.few,r.unit.many);return`ÐанадÑа малÑ: ÑакалаÑÑ, ÑÑо ${n.origin} павÑнна ${r.verb} ${t}${n.minimum.toString()} ${e}`}return`ÐанадÑа малÑ: ÑакалаÑÑ, ÑÑо ${n.origin} павÑнна бÑÑÑ ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ÐÑпÑавÑлÑÐ½Ñ Ñадок: павÑнен паÑÑнаÑÑа з "${n.prefix}"`;if("ends_with"===n.format)return`ÐÑпÑавÑлÑÐ½Ñ Ñадок: павÑнен заканÑваÑÑа на "${n.suffix}"`;if("includes"===n.format)return`ÐÑпÑавÑлÑÐ½Ñ Ñадок: павÑнен змÑÑÑаÑÑ "${n.includes}"`;if("regex"===n.format)return`ÐÑпÑавÑлÑÐ½Ñ Ñадок: павÑнен адпавÑдаÑÑ ÑÐ°Ð±Ð»Ð¾Ð½Ñ ${n.pattern}`;return`ÐÑпÑавÑлÑÐ½Ñ ${t[n.format]??n.format}`;case"not_multiple_of":return`ÐÑпÑавÑлÑÐ½Ñ Ð»Ñк: павÑнен бÑÑÑ ÐºÑаÑнÑм ${n.divisor}`;case"unrecognized_keys":return`ÐеÑаÑÐ¿Ð°Ð·Ð½Ð°Ð½Ñ ${n.keys.length>1?"клÑÑÑ":"клÑÑ"}: ${tt(n.keys,", ")}`;case"invalid_key":return`ÐÑпÑавÑлÑÐ½Ñ ÐºÐ»ÑÑ Ñ ${n.origin}`;case"invalid_union":default:return"ÐÑпÑавÑлÑÐ½Ñ Ñвод";case"invalid_element":return`ÐÑпÑавÑлÑнае знаÑÑнне Ñ ${n.origin}`}})}},"bg",0,function(){let e,t,r;return{localeError:(e={string:{unit:"Ñимвола",verb:"да ÑÑдÑÑжа"},file:{unit:"байÑа",verb:"да ÑÑдÑÑжа"},array:{unit:"елеменÑа",verb:"да ÑÑдÑÑжа"},set:{unit:"елеменÑа",verb:"да ÑÑдÑÑжа"}},t={regex:"вÑ
од",email:"имейл адÑеÑ",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO вÑеме",date:"ISO даÑа",time:"ISO вÑеме",duration:"ISO пÑодÑлжиÑелноÑÑ",ipv4:"IPv4 адÑеÑ",ipv6:"IPv6 адÑеÑ",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиÑан низ",base64url:"base64url-кодиÑан низ",json_string:"JSON низ",e164:"E.164 номеÑ",jwt:"JWT",template_literal:"вÑ
од"},r={nan:"NaN",number:"ÑиÑло",array:"маÑив"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ðевалиден вÑ
од: оÑакван instanceof ${n.expected}, полÑÑен ${i}`;return`Ðевалиден вÑ
од: оÑакван ${e}, полÑÑен ${i}`}case"invalid_value":if(1===n.values.length)return`Ðевалиден вÑ
од: оÑакван ${t_(n.values[0])}`;return`Ðевалидна опÑиÑ: оÑаквано едно Ð¾Ñ ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ТвÑÑде голÑмо: оÑаква Ñе ${n.origin??"ÑÑойноÑÑ"} да ÑÑдÑÑжа ${t}${n.maximum.toString()} ${r.unit??"елеменÑа"}`;return`ТвÑÑде голÑмо: оÑаква Ñе ${n.origin??"ÑÑойноÑÑ"} да бÑде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ТвÑÑде малко: оÑаква Ñе ${n.origin} да ÑÑдÑÑжа ${t}${n.minimum.toString()} ${r.unit}`;return`ТвÑÑде малко: оÑаква Ñе ${n.origin} да бÑде ${t}${n.minimum.toString()}`}case"invalid_format":{if("starts_with"===n.format)return`Ðевалиден низ: ÑÑÑбва да запоÑва Ñ "${n.prefix}"`;if("ends_with"===n.format)return`Ðевалиден низ: ÑÑÑбва да завÑÑÑва Ñ "${n.suffix}"`;if("includes"===n.format)return`Ðевалиден низ: ÑÑÑбва да вклÑÑва "${n.includes}"`;if("regex"===n.format)return`Ðевалиден низ: ÑÑÑбва да ÑÑвпада Ñ ${n.pattern}`;let e="Ðевалиден";return"emoji"===n.format&&(e="Ðевалидно"),"datetime"===n.format&&(e="Ðевалидно"),"date"===n.format&&(e="Ðевалидна"),"time"===n.format&&(e="Ðевалидно"),"duration"===n.format&&(e="Ðевалидна"),`${e} ${t[n.format]??n.format}`}case"not_multiple_of":return`Ðевалидно ÑиÑло: ÑÑÑбва да бÑде кÑаÑно на ${n.divisor}`;case"unrecognized_keys":return`ÐеÑазпознаÑ${n.keys.length>1?"и":""} клÑÑ${n.keys.length>1?"ове":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Ðевалиден клÑÑ Ð² ${n.origin}`;case"invalid_union":default:return"Ðевалиден вÑ
од";case"invalid_element":return`Ðевалидна ÑÑойноÑÑ Ð² ${n.origin}`}})}},"ca",0,function(){let e,t,r;return{localeError:(e={string:{unit:"carà cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}},t={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Tipus inv\xe0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${i}`;return`Tipus inv\xe0lid: s'esperava ${e}, s'ha rebut ${i}`}case"invalid_value":if(1===n.values.length)return`Valor inv\xe0lid: s'esperava ${t_(n.values[0])}`;return`Opci\xf3 inv\xe0lida: s'esperava una de ${tt(n.values," o ")}`;case"too_big":{let t=n.inclusive?"com a mà xim":"menys de",r=e[n.origin]??null;if(r)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xe9s ${t} ${n.maximum.toString()} ${r.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"com a mÃnim":"més de",r=e[n.origin]??null;if(r)return`Massa petit: s'esperava que ${n.origin} contingu\xe9s ${t} ${n.minimum.toString()} ${r.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${t} ${n.minimum.toString()}`}
39case"invalid_format":if("starts_with"===n.format)return`Format inv\xe0lid: ha de comen\xe7ar amb "${n.prefix}"`;if("ends_with"===n.format)return`Format inv\xe0lid: ha d'acabar amb "${n.suffix}"`;if("includes"===n.format)return`Format inv\xe0lid: ha d'incloure "${n.includes}"`;if("regex"===n.format)return`Format inv\xe0lid: ha de coincidir amb el patr\xf3 ${n.pattern}`;return`Format inv\xe0lid per a ${t[n.format]??n.format}`;case"not_multiple_of":return`N\xfamero inv\xe0lid: ha de ser m\xfaltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Clau inv\xe0lida a ${n.origin}`;case"invalid_union":default:return"Entrada invà lida";case"invalid_element":return`Element inv\xe0lid a ${n.origin}`}})}},"cs",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znaků",verb:"mÃt"},file:{unit:"bajtů",verb:"mÃt"},array:{unit:"prvků",verb:"mÃt"},set:{unit:"prvků",verb:"mÃt"}},t={regex:"regulárnà výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a Äas ve formátu ISO",date:"datum ve formátu ISO",time:"Äas ve formátu ISO",duration:"doba trvánà ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"ÅetÄzec zakódovaný ve formátu base64",base64url:"ÅetÄzec zakódovaný ve formátu base64url",json_string:"ÅetÄzec ve formátu JSON",e164:"ÄÃslo E.164",jwt:"JWT",template_literal:"vstup"},r={nan:"NaN",number:"ÄÃslo",string:"ÅetÄzec",function:"funkce",array:"pole"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neplatn\xfd vstup: oÄek\xe1v\xe1no instanceof ${n.expected}, obdrženo ${i}`;return`Neplatn\xfd vstup: oÄek\xe1v\xe1no ${e}, obdrženo ${i}`}case"invalid_value":if(1===n.values.length)return`Neplatn\xfd vstup: oÄek\xe1v\xe1no ${t_(n.values[0])}`;return`Neplatn\xe1 možnost: oÄek\xe1v\xe1na jedna z hodnot ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Hodnota je pÅ\xedliÅ¡ velk\xe1: ${n.origin??"hodnota"} mus\xed m\xedt ${t}${n.maximum.toString()} ${r.unit??"prvků"}`;return`Hodnota je pÅ\xedliÅ¡ velk\xe1: ${n.origin??"hodnota"} mus\xed b\xfdt ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Hodnota je pÅ\xedliÅ¡ mal\xe1: ${n.origin??"hodnota"} mus\xed m\xedt ${t}${n.minimum.toString()} ${r.unit??"prvků"}`;return`Hodnota je pÅ\xedliÅ¡ mal\xe1: ${n.origin??"hodnota"} mus\xed b\xfdt ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neplatn\xfd ÅetÄzec: mus\xed zaÄ\xednat na "${n.prefix}"`;if("ends_with"===n.format)return`Neplatn\xfd ÅetÄzec: mus\xed konÄit na "${n.suffix}"`;if("includes"===n.format)return`Neplatn\xfd ÅetÄzec: mus\xed obsahovat "${n.includes}"`;if("regex"===n.format)return`Neplatn\xfd ÅetÄzec: mus\xed odpov\xeddat vzoru ${n.pattern}`;return`Neplatn\xfd form\xe1t ${t[n.format]??n.format}`;case"not_multiple_of":return`Neplatn\xe9 Ä\xedslo: mus\xed b\xfdt n\xe1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xe1m\xe9 kl\xedÄe: ${tt(n.keys,", ")}`;case"invalid_key":return`Neplatn\xfd kl\xedÄ v ${n.origin}`;case"invalid_union":default:return"Neplatný vstup";case"invalid_element":return`Neplatn\xe1 hodnota v ${n.origin}`}})}},"da",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-omrÃ¥de",ipv6:"IPv6-omrÃ¥de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ugyldigt input: forventede instanceof ${n.expected}, fik ${i}`;return`Ugyldigt input: forventede ${e}, fik ${i}`}case"invalid_value":if(1===n.values.length)return`Ugyldig v\xe6rdi: forventede ${t_(n.values[0])}`;return`Ugyldigt valg: forventede en af f\xf8lgende ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`For stor: forventede ${a??"value"} ${i.verb} ${t} ${n.maximum.toString()} ${i.unit??"elementer"}`;return`For stor: forventede ${a??"value"} havde ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`For lille: forventede ${a} ${i.verb} ${t} ${n.minimum.toString()} ${i.unit}`;return`For lille: forventede ${a} havde ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ugyldig streng: skal starte med "${n.prefix}"`;if("ends_with"===n.format)return`Ugyldig streng: skal ende med "${n.suffix}"`;if("includes"===n.format)return`Ugyldig streng: skal indeholde "${n.includes}"`;if("regex"===n.format)return`Ugyldig streng: skal matche m\xf8nsteret ${n.pattern}`;return`Ugyldig ${t[n.format]??n.format}`;case"not_multiple_of":return`Ugyldigt tal: skal v\xe6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${tt(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xf8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xe6rdi i ${n.origin}`;default:return"Ugyldigt input"}})}},"de",0,function(){let e,t,r;return{localeError:(e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}},t={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},r={nan:"NaN",number:"Zahl",array:"Array"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ung\xfcltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${i}`;return`Ung\xfcltige Eingabe: erwartet ${e}, erhalten ${i}`}case"invalid_value":if(1===n.values.length)return`Ung\xfcltige Eingabe: erwartet ${t_(n.values[0])}`;return`Ung\xfcltige Option: erwartet eine von ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Zu gro\xdf: erwartet, dass ${n.origin??"Wert"} ${t}${n.maximum.toString()} ${r.unit??"Elemente"} hat`;return`Zu gro\xdf: erwartet, dass ${n.origin??"Wert"} ${t}${n.maximum.toString()} ist`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Zu klein: erwartet, dass ${n.origin} ${t}${n.minimum.toString()} ${r.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${t}${n.minimum.toString()} ist`}case"invalid_format":if("starts_with"===n.format)return`Ung\xfcltiger String: muss mit "${n.prefix}" beginnen`;if("ends_with"===n.format)return`Ung\xfcltiger String: muss mit "${n.suffix}" enden`;if("includes"===n.format)return`Ung\xfcltiger String: muss "${n.includes}" enthalten`;if("regex"===n.format)return`Ung\xfcltiger String: muss dem Muster ${n.pattern} entsprechen`;return`Ung\xfcltig: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ung\xfcltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${tt(n.keys,", ")}`;case"invalid_key":return`Ung\xfcltiger Schl\xfcssel in ${n.origin}`;
39case"invalid_union":default:return"Ungültige Eingabe";case"invalid_element":return`Ung\xfcltiger Wert in ${n.origin}`}})}},"en",0,iJ,"eo",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}},t={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoÄio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daÅro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},r={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Nevalida enigo: atendiÄis instanceof ${n.expected}, riceviÄis ${i}`;return`Nevalida enigo: atendiÄis ${e}, riceviÄis ${i}`}case"invalid_value":if(1===n.values.length)return`Nevalida enigo: atendiÄis ${t_(n.values[0])}`;return`Nevalida opcio: atendiÄis unu el ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Tro granda: atendiÄis ke ${n.origin??"valoro"} havu ${t}${n.maximum.toString()} ${r.unit??"elementojn"}`;return`Tro granda: atendiÄis ke ${n.origin??"valoro"} havu ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Tro malgranda: atendiÄis ke ${n.origin} havu ${t}${n.minimum.toString()} ${r.unit}`;return`Tro malgranda: atendiÄis ke ${n.origin} estu ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Nevalida karaktraro: devas komenciÄi per "${n.prefix}"`;if("ends_with"===n.format)return`Nevalida karaktraro: devas finiÄi per "${n.suffix}"`;if("includes"===n.format)return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if("regex"===n.format)return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${t[n.format]??n.format}`;case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} Ålosilo${n.keys.length>1?"j":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Nevalida Ålosilo en ${n.origin}`;case"invalid_union":default:return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`}})}},"es",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol
39:"sÃmbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacÃo",never:"nunca",unknown:"desconocido",any:"cualquiera"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entrada inv\xe1lida: se esperaba instanceof ${n.expected}, recibido ${i}`;return`Entrada inv\xe1lida: se esperaba ${e}, recibido ${i}`}case"invalid_value":if(1===n.values.length)return`Entrada inv\xe1lida: se esperaba ${t_(n.values[0])}`;return`Opci\xf3n inv\xe1lida: se esperaba una de ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${t}${n.maximum.toString()} ${i.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${a??"valor"} fuera ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Demasiado peque\xf1o: se esperaba que ${a} tuviera ${t}${n.minimum.toString()} ${i.unit}`;return`Demasiado peque\xf1o: se esperaba que ${a} fuera ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cadena inv\xe1lida: debe comenzar con "${n.prefix}"`;if("ends_with"===n.format)return`Cadena inv\xe1lida: debe terminar en "${n.suffix}"`;if("includes"===n.format)return`Cadena inv\xe1lida: debe incluir "${n.includes}"`;if("regex"===n.format)return`Cadena inv\xe1lida: debe coincidir con el patr\xf3n ${n.pattern}`;return`Inv\xe1lido ${t[n.format]??n.format}`;case"not_multiple_of":return`N\xfamero inv\xe1lido: debe ser m\xfaltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Llave inv\xe1lida en ${r[n.origin]??n.origin}`;case"invalid_union":default:return"Entrada inválida";case"invalid_element":return`Valor inv\xe1lido en ${r[n.origin]??n.origin}`}})}},"fa",0,function(){let e,t,r;return{localeError:(e={string:{unit:"کاراکتر",verb:"داشت٠باشد"},file:{unit:"Ø¨Ø§ÛØª",verb:"داشت٠باشد"},array:{unit:"Ø¢ÛØªÙ
",verb:"داشت٠باشد"},set:{unit:"Ø¢ÛØªÙ
",verb:"داشت٠باشد"}},t={regex:"ÙØ±ÙدÛ",email:"آدرس اÛÙ
ÛÙ",url:"URL",emoji:"اÛÙ
ÙØ¬Û",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ØªØ§Ø±ÛØ® ٠زÙ
Ø§Ù Ø§ÛØ²Ù",date:"ØªØ§Ø±ÛØ® Ø§ÛØ²Ù",time:"زÙ
Ø§Ù Ø§ÛØ²Ù",duration:"Ù
دت زÙ
Ø§Ù Ø§ÛØ²Ù",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 داÙ
ÙÙ",cidrv6:"IPv6 داÙ
ÙÙ",base64:"base64-encoded رشتÙ",base64url:"base64url-encoded رشتÙ",json_string:"JSON رشتÙ",e164:"E.164 عدد",jwt:"JWT",template_literal:"ÙØ±ÙدÛ"},r={nan:"NaN",number:"عدد",array:"آراÛÙ"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÙØ±ÙØ¯Û ÙØ§Ù
عتبر: Ù
ÛâØ¨Ø§ÛØ³Øª instanceof ${n.expected} Ù
ÛâØ¨ÙØ¯Ø ${i} Ø¯Ø±ÛØ§Ùت شد`;return`ÙØ±ÙØ¯Û ÙØ§Ù
عتبر: Ù
ÛâØ¨Ø§ÛØ³Øª ${e} Ù
ÛâØ¨ÙØ¯Ø ${i} Ø¯Ø±ÛØ§Ùت شد`}case"invalid_value":if(1===n.values.length)return`ÙØ±ÙØ¯Û ÙØ§Ù
عتبر: Ù
ÛâØ¨Ø§ÛØ³Øª ${t_(n.values[0])} Ù
ÛâØ¨ÙØ¯`;return`گزÛÙÙ ÙØ§Ù
عتبر: Ù
ÛâØ¨Ø§ÛØ³Øª ÛÚ©Û Ø§Ø² ${tt(n.values,"|")} Ù
ÛâØ¨ÙØ¯`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Ø®ÛÙÛ Ø¨Ø²Ø±Ú¯: ${n.origin??"Ù
ÙØ¯Ø§Ø±"} Ø¨Ø§ÛØ¯ ${t}${n.maximum.toString()} ${r.unit??"Ø¹ÙØµØ±"} باشد`;return`Ø®ÛÙÛ Ø¨Ø²Ø±Ú¯: ${n.origin??"Ù
ÙØ¯Ø§Ø±"} Ø¨Ø§ÛØ¯ ${t}${n.maximum.toString()} باشد`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Ø®ÛÙÛ Ú©ÙÚÚ©: ${n.origin} Ø¨Ø§ÛØ¯ ${t}${n.minimum.toString()} ${r.unit} باشد`;return`Ø®ÛÙÛ Ú©ÙÚÚ©: ${n.origin} Ø¨Ø§ÛØ¯ ${t}${n.minimum.toString()} باشد`}
39case"invalid_format":if("starts_with"===n.format)return`Ø±Ø´ØªÙ ÙØ§Ù
عتبر: Ø¨Ø§ÛØ¯ با "${n.prefix}" Ø´Ø±ÙØ¹ Ø´ÙØ¯`;if("ends_with"===n.format)return`Ø±Ø´ØªÙ ÙØ§Ù
عتبر: Ø¨Ø§ÛØ¯ با "${n.suffix}" تÙ
اÙ
Ø´ÙØ¯`;if("includes"===n.format)return`Ø±Ø´ØªÙ ÙØ§Ù
عتبر: Ø¨Ø§ÛØ¯ شاÙ
Ù "${n.includes}" باشد`;if("regex"===n.format)return`Ø±Ø´ØªÙ ÙØ§Ù
عتبر: Ø¨Ø§ÛØ¯ با اÙÚ¯ÙÛ ${n.pattern} Ù
Ø·Ø§Ø¨ÙØª داشت٠باشد`;return`${t[n.format]??n.format} ÙØ§Ù
عتبر`;case"not_multiple_of":return`عدد ÙØ§Ù
عتبر: Ø¨Ø§ÛØ¯ Ù
ضرب ${n.divisor} باشد`;case"unrecognized_keys":return`Ú©ÙÛØ¯${n.keys.length>1?"ÙØ§Û":""} ÙØ§Ø´Ùاس: ${tt(n.keys,", ")}`;case"invalid_key":return`Ú©ÙÛØ¯ ÙØ§Ø´Ùاس در ${n.origin}`;case"invalid_union":default:return"ÙØ±ÙØ¯Û ÙØ§Ù
عتبر";case"invalid_element":return`Ù
ÙØ¯Ø§Ø± ÙØ§Ù
عتبر در ${n.origin}`}})}},"fi",0,function(){let e,t,r;return{localeError:(e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}},t={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${i}`;return`Virheellinen tyyppi: odotettiin ${e}, oli ${i}`}case"invalid_value":if(1===n.values.length)return`Virheellinen sy\xf6te: t\xe4ytyy olla ${t_(n.values[0])}`;return`Virheellinen valinta: t\xe4ytyy olla yksi seuraavista: ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Liian suuri: ${r.subject} t\xe4ytyy olla ${t}${n.maximum.toString()} ${r.unit}`.trim();return`Liian suuri: arvon t\xe4ytyy olla ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Liian pieni: ${r.subject} t\xe4ytyy olla ${t}${n.minimum.toString()} ${r.unit}`.trim();return`Liian pieni: arvon t\xe4ytyy olla ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy alkaa "${n.prefix}"`;if("ends_with"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy loppua "${n.suffix}"`;if("includes"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy sis\xe4lt\xe4\xe4 "${n.includes}"`;if("regex"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy vastata s\xe4\xe4nn\xf6llist\xe4 lauseketta ${n.pattern}`;return`Virheellinen ${t[n.format]??n.format}`;case"not_multiple_of":return`Virheellinen luku: t\xe4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${tt(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}})}},"fr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}},t={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},r={nan:"NaN",number:"nombre",array:"tableau"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entr\xe9e invalide : instanceof ${n.expected} attendu, ${i} re\xe7u`;return`Entr\xe9e invalide : ${e} attendu, ${i} re\xe7u`}case"invalid_value":if(1===n.values.length)return`Entr\xe9e invalide : ${t_(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${tt(n.values,"|")} attendue`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Trop grand : ${n.origin??"valeur"} doit ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"élément(s)"}`;return`Trop grand : ${n.origin??"valeur"} doit \xeatre ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Trop petit : ${n.origin} doit ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Trop petit : ${n.origin} doit \xeatre ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cha\xeene invalide : doit commencer par "${n.prefix}"`;if("ends_with"===n.format)return`Cha\xeene invalide : doit se terminer par "${n.suffix}"`;if("includes"===n.format)return`Cha\xeene invalide : doit inclure "${n.includes}"`;if("regex"===n.format)return`Cha\xeene invalide : doit correspondre au mod\xe8le ${n.pattern}`;return`${t[n.format]??n.format} invalide`;case"not_multiple_of":return`Nombre invalide : doit \xeatre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xe9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${tt(n.keys,", ")}`;case"invalid_key":return`Cl\xe9 invalide dans ${n.origin}`;case"invalid_union":default:return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`}})}},"frCA",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}},t={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entr\xe9e invalide : attendu instanceof ${n.expected}, re\xe7u ${i}`;return`Entr\xe9e invalide : attendu ${e}, re\xe7u ${i}`}case"invalid_value":if(1===n.values.length)return`Entr\xe9e invalide : attendu ${t_(n.values[0])}`;
39return`Option invalide : attendu l'une des valeurs suivantes ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"â¤":"<",r=e[n.origin]??null;if(r)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${t}${n.maximum.toString()} ${r.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"â¥":">",r=e[n.origin]??null;if(r)return`Trop petit : attendu que ${n.origin} ait ${t}${n.minimum.toString()} ${r.unit}`;return`Trop petit : attendu que ${n.origin} soit ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cha\xeene invalide : doit commencer par "${n.prefix}"`;if("ends_with"===n.format)return`Cha\xeene invalide : doit se terminer par "${n.suffix}"`;if("includes"===n.format)return`Cha\xeene invalide : doit inclure "${n.includes}"`;if("regex"===n.format)return`Cha\xeene invalide : doit correspondre au motif ${n.pattern}`;return`${t[n.format]??n.format} invalide`;case"not_multiple_of":return`Nombre invalide : doit \xeatre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xe9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${tt(n.keys,", ")}`;case"invalid_key":return`Cl\xe9 invalide dans ${n.origin}`;case"invalid_union":default:return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`}})}},"he",0,function(){let e,t,r,n,i,a,o,s,l;return{localeError:(e={string:{label:"××ר××ת",gender:"f"},number:{label:"×ספר",gender:"m"},boolean:{label:"×¢×¨× ×××××× ×",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"ת×ר××",gender:"m"},array:{label:"×ער×",gender:"m"},object:{label:"××××××§×",gender:"m"},null:{label:"×¢×¨× ×¨××§ (null)",gender:"m"},undefined:{label:"×¢×¨× ×× ××××ר (undefined)",gender:"m"},symbol:{label:"ס××××× (Symbol)",gender:"m"},function:{label:"פ×× ×§×¦××",gender:"f"},map:{label:"××¤× (Map)",gender:"f"},set:{label:"×§×××¦× (Set)",gender:"f"},file:{label:"×§×××¥",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"×¢×¨× ×× ××××¢",gender:"m"},value:{label:"ער×",gender:"m"}},t={string:{unit:"ת××××",shortLabel:"קצר",longLabel:"×ר××"},file:{unit:"××××××",shortLabel:"×§××",longLabel:"××××"},array:{unit:"פר××××",shortLabel:"×§××",longLabel:"××××"},set:{unit:"פר××××",shortLabel:"×§××",longLabel:"××××"},number:{unit:"",shortLabel:"×§××",longLabel:"××××"}},r=t=>t?e[t]:void 0,n=t=>{let n=r(t);return n?n.label:t??e.unknown.label},i=e=>`×${n(e)}`,a=e=>{let t=r(e);return"f"===(t?.gender??"m")?"צר××× ××××ת":"צר×× ××××ת"},o=e=>e?t[e]??null:null,s={regex:{label:"×§××",gender:"m"},email:{label:"×ת××ת ××××××",gender:"f"},url:{label:"×ת××ת רשת",gender:"f"},emoji:{label:"×××××'×",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"ת×ר×× ×××× ISO",gender:"m"},date:{label:"ת×ר×× ISO",gender:"m"},time:{label:"××× ISO",gender:"m"},duration:{label:"××©× ××× ISO",gender:"m"},ipv4:{label:"×ת××ת IPv4",gender:"f"},ipv6:{label:"×ת××ת IPv6",gender:"f"},cidrv4:{label:"×××× IPv4",gender:"m"},cidrv6:{label:"×××× IPv6",gender:"m"},base64:{label:"××ר××ת ××ס×ס 64",gender:"f"},base64url:{label:"××ר××ת ××ס×ס 64 ××ת×××ת רשת",gender:"f"},json_string:{label:"××ר××ת JSON",gender:"f"},e164:{label:"×ספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"×§××",gender:"m"},includes:{label:"×§××",gender:"m"},lowercase:{label:"×§××",gender:"m"},starts_with:{label:"×§××",gender:"m"},uppercase:{label:"×§××",gender:"m"}},l={nan:"NaN"},t=>{switch(t.code){case"invalid_type":{let r=t.expected,i=l[r??""]??n(r),a=tM(t.input),o=l[a]??e[a]?.label??a;
39if(/^[A-Z]/.test(t.expected))return`×§×× ×× ×ª×§××: צר×× ××××ת instanceof ${t.expected}, ×תק×× ${o}`;return`×§×× ×× ×ª×§××: צר×× ××××ת ${i}, ×תק×× ${o}`}case"invalid_value":{if(1===t.values.length)return`×¢×¨× ×× ×ª×§××: ××¢×¨× ×××× ××××ת ${t_(t.values[0])}`;let e=t.values.map(e=>t_(e));if(2===t.values.length)return`×¢×¨× ×× ×ª×§××: ××פשר×××ת ××ת××××ת ×× ${e[0]} ×× ${e[1]}`;let r=e[e.length-1],n=e.slice(0,-1).join(", ");return`×¢×¨× ×× ×ª×§××: ××פשר×××ת ××ת××××ת ×× ${n} ×× ${r}`}case"too_big":{let e=o(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.longLabel??"×ר××"} ×××: ${r} צר××× ××××× ${t.maximum.toString()} ${e?.unit??""} ${t.inclusive?"×× ×¤××ת":"××× ×××תר"}`.trim();if("number"===t.origin){let e=t.inclusive?`×§×× ×× ×©××× ×-${t.maximum}`:`×§×× ×-${t.maximum}`;return`×××× ×××: ${r} צר×× ××××ת ${e}`}if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צר×××":"צר××",i=t.inclusive?`${t.maximum} ${e?.unit??""} ×× ×¤××ת`:`פ××ת ×-${t.maximum} ${e?.unit??""}`;return`×××× ×××: ${r} ${n} ××××× ${i}`.trim()}let n=t.inclusive?"<=":"<",s=a(t.origin??"value");if(e?.unit)return`${e.longLabel} ×××: ${r} ${s} ${n}${t.maximum.toString()} ${e.unit}`;return`${e?.longLabel??"××××"} ×××: ${r} ${s} ${n}${t.maximum.toString()}`}case"too_small":{let e=o(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.shortLabel??"קצר"} ×××: ${r} צר××× ××××× ${t.minimum.toString()} ${e?.unit??""} ${t.inclusive?"×× ××תר":"×פ××ת"}`.trim();if("number"===t.origin){let e=t.inclusive?`×××× ×× ×©××× ×-${t.minimum}`:`×××× ×-${t.minimum}`;return`×§×× ×××: ${r} צר×× ××××ת ${e}`}if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צר×××":"צר××";if(1===t.minimum&&t.inclusive){let e=(t.origin,"×פ××ת פר×× ×××");return`×§×× ×××: ${r} ${n} ××××× ${e}`}let i=t.inclusive?`${t.minimum} ${e?.unit??""} ×× ××תר`:`××תר ×-${t.minimum} ${e?.unit??""}`;return`×§×× ×××: ${r} ${n} ××××× ${i}`.trim()}let n=t.inclusive?">=":">",s=a(t.origin??"value");if(e?.unit)return`${e.shortLabel} ×××: ${r} ${s} ${n}${t.minimum.toString()} ${e.unit}`;return`${e?.shortLabel??"×§××"} ×××: ${r} ${s} ${n}${t.minimum.toString()}`}case"invalid_format":{if("starts_with"===t.format)return`×××ר××ת ××××ת ××ת××× × "${t.prefix}"`;if("ends_with"===t.format)return`×××ר××ת ××××ת ××סת××× × "${t.suffix}"`;if("includes"===t.format)return`×××ר××ת ××××ת ××××× "${t.includes}"`;if("regex"===t.format)return`×××ר××ת ××××ת ××ת××× ×ת×× ×ת ${t.pattern}`;let e=s[t.format],r=e?.label??t.format,n=e?.gender??"m";return`${r} ×× ${"f"===n?"תק×× ×":"תק××"}`}case"not_multiple_of":return`×ספר ×× ×ª×§××: ×××× ××××ת ××פ×× ×©× ${t.divisor}`;case"unrecognized_keys":return`×פת×${t.keys.length>1?"×ת":""} ×× ××××${t.keys.length>1?"××":"×"}: ${tt(t.keys,", ")}`;case"invalid_key":return"ש×× ×× ×ª×§×× ×××××××§×";case"invalid_union":default:return"×§×× ×× ×ª×§××";case"invalid_element":{let e=i(t.origin??"array");return`×¢×¨× ×× ×ª×§×× ×${e}`}}})}},"hu",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}},t={regex:"bemenet",email:"email cÃm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO idÅbélyeg",date:"ISO dátum",time:"ISO idÅ",duration:"ISO idÅintervallum",ipv4:"IPv4 cÃm",ipv6:"IPv6 cÃm",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},r={nan:"NaN",number:"szám",array:"tömb"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k instanceof ${n.expected}, a kapott \xe9rt\xe9k ${i}`;return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k ${e}, a kapott \xe9rt\xe9k ${i}`}case"invalid_value":if(1===n.values.length)return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k ${t_(n.values[0])}`;return`\xc9rv\xe9nytelen opci\xf3: valamelyik \xe9rt\xe9k v\xe1rt ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`T\xfal nagy: ${n.origin??"érték"} m\xe9rete t\xfal nagy ${t}${n.maximum.toString()} ${r.unit??"elem"}`;return`T\xfal nagy: a bemeneti \xe9rt\xe9k ${n.origin??"érték"} t\xfal nagy: ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`T\xfal kicsi: a bemeneti \xe9rt\xe9k ${n.origin} m\xe9rete t\xfal kicsi ${t}${n.minimum.toString()} ${r.unit}`;return`T\xfal kicsi: a bemeneti \xe9rt\xe9k ${n.origin} t\xfal kicsi ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`\xc9rv\xe9nytelen string: "${n.prefix}" \xe9rt\xe9kkel kell kezdÅdnie`;if("ends_with"===n.format)return`\xc9rv\xe9nytelen string: "${n.suffix}" \xe9rt\xe9kkel kell v\xe9gzÅdnie`;if("includes"===n.format)return`\xc9rv\xe9nytelen string: "${n.includes}" \xe9rt\xe9ket kell tartalmaznia`;if("regex"===n.format)return`\xc9rv\xe9nytelen string: ${n.pattern} mint\xe1nak kell megfelelnie`;return`\xc9rv\xe9nytelen ${t[n.format]??n.format}`;case"not_multiple_of":return`\xc9rv\xe9nytelen sz\xe1m: ${n.divisor} t\xf6bbsz\xf6r\xf6s\xe9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`\xc9rv\xe9nytelen kulcs ${n.origin}`;case"invalid_union":default:return"Ãrvénytelen bemenet";case"invalid_element":return`\xc9rv\xe9nytelen \xe9rt\xe9k: ${n.origin}`}})}},"hy",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"Õ¶Õ·Õ¡Õ¶",many:"Õ¶Õ·Õ¡Õ¶Õ¶Õ¥Ö"},verb:"Õ¸ÖÕ¶Õ¥Õ¶Õ¡Õ¬"},file:{unit:{one:"Õ¢Õ¡ÕµÕ©",many:"Õ¢Õ¡ÕµÕ©Õ¥Ö"},verb:"Õ¸ÖÕ¶Õ¥Õ¶Õ¡Õ¬"},array:{unit:{one:"Õ¿Õ¡ÖÖ",many:"Õ¿Õ¡ÖÖÕ¥Ö"},verb:"Õ¸ÖÕ¶Õ¥Õ¶Õ¡Õ¬"},set:{unit:{one:"Õ¿Õ¡ÖÖ",many:"Õ¿Õ¡ÖÖÕ¥Ö"},verb:"Õ¸ÖÕ¶Õ¥Õ¶Õ¡Õ¬"}},t={regex:"Õ´Õ¸ÖÕ¿Ö",email:"Õ§Õ¬. Õ°Õ¡Õ½ÖÕ¥",url:"URL",emoji:"Õ§Õ´Õ¸Õ»Õ«",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO Õ¡Õ´Õ½Õ¡Õ©Õ«Õ¾ Ö ÕªÕ¡Õ´",date:"ISO Õ¡Õ´Õ½Õ¡Õ©Õ«Õ¾",time:"ISO ÕªÕ¡Õ´",duration:"ISO Õ¿ÖÕ¸Õ²Õ¸ÖÕ©ÕµÕ¸ÖÕ¶",ipv4:"IPv4 Õ°Õ¡Õ½ÖÕ¥",ipv6:"IPv6 Õ°Õ¡Õ½ÖÕ¥",cidrv4:"IPv4 Õ´Õ«Õ»Õ¡Õ¯Õ¡ÕµÖ",cidrv6:"IPv6 Õ´Õ«Õ»Õ¡Õ¯Õ¡ÕµÖ",base64:"base64 Õ±ÖÕ¡Õ¹Õ¡ÖÕ¸Õ¾ Õ¿Õ¸Õ²",base64url:"base64url Õ±ÖÕ¡Õ¹Õ¡ÖÕ¸Õ¾ Õ¿Õ¸Õ²",json_string:"JSON Õ¿Õ¸Õ²",e164:"E.164 Õ°Õ¡Õ´Õ¡Ö",jwt:"JWT",template_literal:"Õ´Õ¸ÖÕ¿Ö"},r={nan:"NaN",number:"Õ©Õ«Õ¾",array:"Õ¦Õ¡Õ¶Õ£Õ¾Õ¡Õ®"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÕÕÕ¡Õ¬ Õ´Õ¸ÖÕ¿ÖÕ¡Õ£ÖÕ¸Öմ⤠սպասվոÖÕ´ Õ§Ö instanceof ${n.expected}, Õ½Õ¿Õ¡ÖÕ¾Õ¥Õ¬ Õ§ ${i}`;return`ÕÕÕ¡Õ¬ Õ´Õ¸ÖÕ¿ÖÕ¡Õ£ÖÕ¸Öմ⤠սպասվոÖÕ´ Õ§Ö ${e}, Õ½Õ¿Õ¡ÖÕ¾Õ¥Õ¬ Õ§ ${i}`}case"invalid_value":if(1===n.values.length)return`ÕÕÕ¡Õ¬ Õ´Õ¸ÖÕ¿ÖÕ¡Õ£ÖÕ¸Öմ⤠սպասվոÖÕ´ Õ§Ö ${t_(n.values[1])}`;return`ÕÕÕ¡Õ¬ Õ¿Õ¡ÖÕ¢Õ¥Öակ⤠սպասվոÖÕ´ Õ§Ö Õ°Õ¥Õ¿ÖÕµÕ¡Õ¬Õ¶Õ¥ÖÕ«Ö Õ´Õ¥Õ¯Õ¨Õ ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=iG(Number(n.maximum),r.unit.one,r.unit.many);return`ÕÕ¡ÖÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ¡ÖÕªÕ¥Ö⤠սպասվոÖÕ´ Õ§, Õ¸Ö ${iX(n.origin??"Õ¡ÖÕªÕ¥Ö")} Õ¯Õ¸ÖÕ¶Õ¥Õ¶Õ¡ ${t}${n.maximum.toString()} ${e}`}return`ÕÕ¡ÖÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ¡ÖÕªÕ¥Ö⤠սպասվոÖÕ´ Õ§, Õ¸Ö ${iX(n.origin??"Õ¡ÖÕªÕ¥Ö")} Õ¬Õ«Õ¶Õ« ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=iG(Number(n.minimum),r.unit.one,r.unit.many);return`ÕÕ¡ÖÕ¡Õ¦Õ¡Õ¶Ö ÖÕ¸ÖÖ Õ¡ÖÕªÕ¥Ö⤠սպասվոÖÕ´ Õ§, Õ¸Ö ${iX(n.origin)} Õ¯Õ¸ÖÕ¶Õ¥Õ¶Õ¡ ${t}${n.minimum.toString()} ${e}`}return`ÕÕ¡ÖÕ¡Õ¦Õ¡Õ¶Ö ÖÕ¸ÖÖ Õ¡ÖÕªÕ¥Ö⤠սպասվոÖÕ´ Õ§, Õ¸Ö ${iX(n.origin)} Õ¬Õ«Õ¶Õ« ${t}${n.minimum.toString()}`}
39case"invalid_format":if("starts_with"===n.format)return`ÕÕÕ¡Õ¬ Õ¿Õ¸Õ²â¤ ÕºÕ¥Õ¿Ö Õ§ Õ½Õ¯Õ½Õ¾Õ« "${n.prefix}"-Õ¸Õ¾`;if("ends_with"===n.format)return`ÕÕÕ¡Õ¬ Õ¿Õ¸Õ²â¤ ÕºÕ¥Õ¿Ö Õ§ Õ¡Õ¾Õ¡ÖÕ¿Õ¾Õ« "${n.suffix}"-Õ¸Õ¾`;if("includes"===n.format)return`ÕÕÕ¡Õ¬ Õ¿Õ¸Õ²â¤ ÕºÕ¥Õ¿Ö Õ§ ÕºÕ¡ÖÕ¸ÖÕ¶Õ¡Õ¯Õ« "${n.includes}"`;if("regex"===n.format)return`ÕÕÕ¡Õ¬ Õ¿Õ¸Õ²â¤ ÕºÕ¥Õ¿Ö Õ§ Õ°Õ¡Õ´Õ¡ÕºÕ¡Õ¿Õ¡Õ½ÕÕ¡Õ¶Õ« ${n.pattern} Õ±ÖÕ¡Õ¹Õ¡ÖÕ«Õ¶`;return`ÕÕÕ¡Õ¬ ${t[n.format]??n.format}`;case"not_multiple_of":return`ÕÕÕ¡Õ¬ Õ©Õ«Õ¾â¤ ÕºÕ¥Õ¿Ö Õ§ Õ¢Õ¡Õ¦Õ´Õ¡ÕºÕ¡Õ¿Õ«Õ¯ Õ¬Õ«Õ¶Õ« ${n.divisor}-Õ«`;case"unrecognized_keys":return`ÕÕ³Õ¡Õ¶Õ¡Õ¹Õ¾Õ¡Õ® Õ¢Õ¡Õ¶Õ¡Õ¬Õ«${n.keys.length>1?"Õ¶Õ¥Ö":""}. ${tt(n.keys,", ")}`;case"invalid_key":return`ÕÕÕ¡Õ¬ Õ¢Õ¡Õ¶Õ¡Õ¬Õ« ${iX(n.origin)}-Õ¸ÖÕ´`;case"invalid_union":default:return"ÕÕÕ¡Õ¬ Õ´Õ¸ÖÕ¿ÖÕ¡Õ£ÖÕ¸ÖÕ´";case"invalid_element":return`ÕÕÕ¡Õ¬ Õ¡ÖÕªÕ¥Ö ${iX(n.origin)}-Õ¸ÖÕ´`}})}},"id",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}},t={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${i}`;return`Input tidak valid: diharapkan ${e}, diterima ${i}`}case"invalid_value":if(1===n.values.length)return`Input tidak valid: diharapkan ${t_(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${t}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${t}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`String tidak valid: harus dimulai dengan "${n.prefix}"`;if("ends_with"===n.format)return`String tidak valid: harus berakhir dengan "${n.suffix}"`;if("includes"===n.format)return`String tidak valid: harus menyertakan "${n.includes}"`;if("regex"===n.format)return`String tidak valid: harus sesuai pola ${n.pattern}`;return`${t[n.format]??n.format} tidak valid`;case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":default:return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`}})}},"is",0,function(){let e,t,r;return{localeError:(e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}},t={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tÃmi",date:"ISO dagsetning",time:"ISO tÃmi",duration:"ISO tÃmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},r={nan:"NaN",number:"númer",array:"fylki"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Rangt gildi: \xde\xfa sl\xf3st inn ${i} \xfear sem \xe1 a\xf0 vera instanceof ${n.expected}`;return`Rangt gildi: \xde\xfa sl\xf3st inn ${i} \xfear sem \xe1 a\xf0 vera ${e}`}case"invalid_value":if(1===n.values.length)return`Rangt gildi: gert r\xe1\xf0 fyrir ${t_(n.values[0])}`;return`\xd3gilt val: m\xe1 vera eitt af eftirfarandi ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Of st\xf3rt: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin??"gildi"} hafi ${t}${n.maximum.toString()} ${r.unit??"hluti"}`;return`Of st\xf3rt: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin??"gildi"} s\xe9 ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Of l\xedti\xf0: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin} hafi ${t}${n.minimum.toString()} ${r.unit}`;return`Of l\xedti\xf0: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin} s\xe9 ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 byrja \xe1 "${n.prefix}"`;if("ends_with"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 enda \xe1 "${n.suffix}"`;if("includes"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 innihalda "${n.includes}"`;if("regex"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 fylgja mynstri ${n.pattern}`;return`Rangt ${t[n.format]??n.format}`;case"not_multiple_of":return`R\xf6ng tala: ver\xf0ur a\xf0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xd3\xfeekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${tt(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xed ${n.origin}`;case"invalid_union":default:return"Rangt gildi";case"invalid_element":return`Rangt gildi \xed ${n.origin}`}})}},"it",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}},t={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"numero",array:"vettore"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input non valido: atteso instanceof ${n.expected}, ricevuto ${i}`;return`Input non valido: atteso ${e}, ricevuto ${i}`}case"invalid_value":if(1===n.values.length)return`Input non valido: atteso ${t_(n.values[0])}`;return`Opzione non valida: atteso uno tra ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Troppo grande: ${n.origin??"valore"} deve avere ${t}${n.maximum.toString()} ${r.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Troppo piccolo: ${n.origin} deve avere ${t}${n.minimum.toString()} ${r.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Stringa non valida: deve iniziare con "${n.prefix}"`;if("ends_with"===n.format)return`Stringa non valida: deve terminare con "${n.suffix}"`;if("includes"===n.format)return`Stringa non valida: deve includere "${n.includes}"`;if("regex"===n.format)return`Stringa non valida: deve corrispondere al pattern ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${tt(n.keys,", ")}`;
39case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":default:return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`}})}},"ja",0,function(){let e,t,r;return{localeError:(e={string:{unit:"æå",verb:"ã§ãã"},file:{unit:"ãã¤ã",verb:"ã§ãã"},array:{unit:"è¦ç´ ",verb:"ã§ãã"},set:{unit:"è¦ç´ ",verb:"ã§ãã"}},t={regex:"å
¥åå¤",email:"ã¡ã¼ã«ã¢ãã¬ã¹",url:"URL",emoji:"çµµæå",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISOæ¥æ",date:"ISOæ¥ä»",time:"ISOæå»",duration:"ISOæé",ipv4:"IPv4ã¢ãã¬ã¹",ipv6:"IPv6ã¢ãã¬ã¹",cidrv4:"IPv4ç¯å²",cidrv6:"IPv6ç¯å²",base64:"base64ã¨ã³ã³ã¼ãæåå",base64url:"base64urlã¨ã³ã³ã¼ãæåå",json_string:"JSONæåå",e164:"E.164çªå·",jwt:"JWT",template_literal:"å
¥åå¤"},r={nan:"NaN",number:"æ°å¤",array:"é
å"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ç¡å¹ãªå
¥å: instanceof ${n.expected}ãæå¾
ããã¾ãããã${i}ãå
¥åããã¾ãã`;return`ç¡å¹ãªå
¥å: ${e}ãæå¾
ããã¾ãããã${i}ãå
¥åããã¾ãã`}case"invalid_value":if(1===n.values.length)return`ç¡å¹ãªå
¥å: ${t_(n.values[0])}ãæå¾
ããã¾ãã`;return`ç¡å¹ãªé¸æ: ${tt(n.values,"ã")}ã®ããããã§ããå¿
è¦ãããã¾ã`;case"too_big":{let t=n.inclusive?"以ä¸ã§ãã":"ããå°ãã",r=e[n.origin]??null;if(r)return`大ããããå¤: ${n.origin??"å¤"}ã¯${n.maximum.toString()}${r.unit??"è¦ç´ "}${t}å¿
è¦ãããã¾ã`;return`大ããããå¤: ${n.origin??"å¤"}ã¯${n.maximum.toString()}${t}å¿
è¦ãããã¾ã`}case"too_small":{let t=n.inclusive?"以ä¸ã§ãã":"ãã大ãã",r=e[n.origin]??null;if(r)return`å°ããããå¤: ${n.origin}ã¯${n.minimum.toString()}${r.unit}${t}å¿
è¦ãããã¾ã`;return`å°ããããå¤: ${n.origin}ã¯${n.minimum.toString()}${t}å¿
è¦ãããã¾ã`}case"invalid_format":if("starts_with"===n.format)return`ç¡å¹ãªæåå: "${n.prefix}"ã§å§ã¾ãå¿
è¦ãããã¾ã`;if("ends_with"===n.format)return`ç¡å¹ãªæåå: "${n.suffix}"ã§çµããå¿
è¦ãããã¾ã`;if("includes"===n.format)return`ç¡å¹ãªæåå: "${n.includes}"ãå«ãå¿
è¦ãããã¾ã`;if("regex"===n.format)return`ç¡å¹ãªæåå: ãã¿ã¼ã³${n.pattern}ã«ä¸è´ããå¿
è¦ãããã¾ã`;return`ç¡å¹ãª${t[n.format]??n.format}`;case"not_multiple_of":return`ç¡å¹ãªæ°å¤: ${n.divisor}ã®åæ°ã§ããå¿
è¦ãããã¾ã`;case"unrecognized_keys":return`èªèããã¦ããªããã¼${n.keys.length>1?"群":""}: ${tt(n.keys,"ã")}`;case"invalid_key":return`${n.origin}å
ã®ç¡å¹ãªãã¼`;case"invalid_union":default:return"ç¡å¹ãªå
¥å";case"invalid_element":return`${n.origin}å
ã®ç¡å¹ãªå¤`}})}},"ka",0,function(){let e,t,r;return{localeError:(e={string:{unit:"á¡áááááá",verb:"á£ááá á¨áááªááááá¡"},file:{unit:"áááá¢á",verb:"á£ááá á¨áááªááááá¡"},array:{unit:"ááááááá¢á",verb:"á£ááá á¨áááªááááá¡"},set:{unit:"ááááááá¢á",verb:"á£ááá á¨áááªááááá¡"}},t={regex:"á¨áá§áááá",email:"áá-á¤áá¡á¢áá¡ ááá¡áááá áá",url:"URL",emoji:"áááá¯á",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ááá áá¦á-áá á",date:"ááá áá¦á",time:"áá á",duration:"á®áááá á«áááááá",ipv4:"IPv4 ááá¡áááá áá",ipv6:"IPv6 ááá¡áááá áá",cidrv4:"IPv4 ááááááááá",cidrv6:"IPv6 ááááááááá",base64:"base64-ááááá ááá£áá á¡á¢á áááá",base64url:"base64url-ááááá ááá£áá á¡á¢á áááá",json_string:"JSON á¡á¢á áááá",e164:"E.164 ááááá á",jwt:"JWT",template_literal:"á¨áá§áááá"},r={nan:"NaN",number:"á ááªá®áá",string:"á¡á¢á áááá",boolean:"áá£ááááá",function:"á¤á£áá¥áªáá",array:"ááá¡ááá"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`áá áá¡á¬áá á á¨áá§áááá: ááá¡áááááááá instanceof ${n.expected}, ááá¦ááá£áá ${i}`;return`áá áá¡á¬áá á á¨áá§áááá: ááá¡áááááááá ${e}, ááá¦ááá£áá ${i}`}case"invalid_value":if(1===n.values.length)return`áá áá¡á¬áá á á¨áá§áááá: ááá¡áááááááá ${t_(n.values[0])}`;return`áá áá¡á¬áá á ááá áááá¢á: ááá¡ááááááááá áá á-áá áá ${tt(n.values,"|")}-ááá`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`áááááá¢áá áááá: ááá¡áááááááá ${n.origin??"áááá¨ááááááá"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit}`;return`áááááá¢áá áááá: ááá¡áááááááá ${n.origin??"áááá¨ááááááá"} áá§áá¡ ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`áááááá¢áá ááá¢áá á: ááá¡áááááááá ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`áááááá¢áá ááá¢áá á: ááá¡áááááááá ${n.origin} áá§áá¡ ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`áá áá¡á¬áá á á¡á¢á áááá: á£ááá áá¬á§áááááá¡ "${n.prefix}"-áá`;if("ends_with"===n.format)return`áá áá¡á¬áá á á¡á¢á áááá: á£ááá ááááá ááááááá¡ "${n.suffix}"-áá`;if("includes"===n.format)return`áá áá¡á¬áá á á¡á¢á áááá: á£ááá á¨áááªááááá¡ "${n.includes}"-á¡`;if("regex"===n.format)return`áá áá¡á¬áá á á¡á¢á áááá: á£ááá á¨ááá¡áááááááááá¡ á¨áááááá¡ ${n.pattern}`;return`áá áá¡á¬áá á ${t[n.format]??n.format}`;case"not_multiple_of":return`áá áá¡á¬áá á á ááªá®áá: á£ááá áá§áá¡ ${n.divisor}-áá¡ á¯áá ááá`;case"unrecognized_keys":return`á£áªáááá ááá¡áá¦áá${n.keys.length>1?"ááá":"á"}: ${tt(n.keys,", ")}`;case"invalid_key":return`áá áá¡á¬áá á ááá¡áá¦ááá ${n.origin}-á¨á`;case"invalid_union":default:return"áá áá¡á¬áá á á¨áá§áááá";case"invalid_element":return`áá áá¡á¬áá á áááá¨ááááááá ${n.origin}-á¨á`}})}},"kh",0,function(){return iY()},"km",0,iY,"ko",0,function(){let e,t,r;return{localeError:(e={string:{unit:"문ì",verb:"to have"},file:{unit:"ë°ì´í¸",verb:"to have"},array:{unit:"ê°",verb:"to have"},set:{unit:"ê°",verb:"to have"}},t={regex:"ì
ë ¥",email:"ì´ë©ì¼ 주ì",url:"URL",emoji:"ì´ëª¨ì§",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ë ì§ìê°",date:"ISO ë ì§",time:"ISO ìê°",duration:"ISO 기ê°",ipv4:"IPv4 주ì",ipv6:"IPv6 주ì",cidrv4:"IPv4 ë²ì",cidrv6:"IPv6 ë²ì",base64:"base64 ì¸ì½ë© 문ìì´",base64url:"base64url ì¸ì½ë© 문ìì´",json_string:"JSON 문ìì´",e164:"E.164 ë²í¸",jwt:"JWT",template_literal:"ì
ë ¥"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ì못ë ì
ë ¥: ìì íì
ì instanceof ${n.expected}, ë°ì íì
ì ${i}ì
ëë¤`;return`ì못ë ì
ë ¥: ìì íì
ì ${e}, ë°ì íì
ì ${i}ì
ëë¤`}case"invalid_value":if(1===n.values.length)return`ì못ë ì
ë ¥: ê°ì ${t_(n.values[0])} ì´ì´ì¼ í©ëë¤`;return`ì못ë ìµì
: ${tt(n.values,"ëë ")} ì¤ íëì¬ì¼ í©ëë¤`;case"too_big":{let t=n.inclusive?"ì´í":"미ë§",r="미ë§"===t?"ì´ì´ì¼ í©ëë¤":"ì¬ì¼ í©ëë¤",i=e[n.origin]??null,a=i?.unit??"ìì";if(i)return`${n.origin??"ê°"}ì´ ë무 í½ëë¤: ${n.maximum.toString()}${a} ${t}${r}`;return`${n.origin??"ê°"}ì´ ë무 í½ëë¤: ${n.maximum.toString()} ${t}${r}`}case"too_small":{let t=n.inclusive?"ì´ì":"ì´ê³¼",r="ì´ì"===t?"ì´ì´ì¼ í©ëë¤":"ì¬ì¼ í©ëë¤",i=e[n.origin]??null,a=i?.unit??"ìì";if(i)return`${n.origin??"ê°"}ì´ ë무 ììµëë¤: ${n.minimum.toString()}${a} ${t}${r}`;return`${n.origin??"ê°"}ì´ ë무 ììµëë¤: ${n.minimum.toString()} ${t}${r}`}
39case"invalid_format":if("starts_with"===n.format)return`ì못ë 문ìì´: "${n.prefix}"(ì¼)ë¡ ììí´ì¼ í©ëë¤`;if("ends_with"===n.format)return`ì못ë 문ìì´: "${n.suffix}"(ì¼)ë¡ ëëì¼ í©ëë¤`;if("includes"===n.format)return`ì못ë 문ìì´: "${n.includes}"ì(를) í¬í¨í´ì¼ í©ëë¤`;if("regex"===n.format)return`ì못ë 문ìì´: ì ê·ì ${n.pattern} í¨í´ê³¼ ì¼ì¹í´ì¼ í©ëë¤`;return`ì못ë ${t[n.format]??n.format}`;case"not_multiple_of":return`ì못ë ì«ì: ${n.divisor}ì ë°°ìì¬ì¼ í©ëë¤`;case"unrecognized_keys":return`ì¸ìí ì ìë í¤: ${tt(n.keys,", ")}`;case"invalid_key":return`ì못ë í¤: ${n.origin}`;case"invalid_union":default:return"ì못ë ì
ë ¥";case"invalid_element":return`ì못ë ê°: ${n.origin}`}})}},"lt",0,function(){return{localeError:(()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi bÅ«ti ne ilgesnÄ kaip",notInclusive:"turi bÅ«ti trumpesnÄ kaip"},bigger:{inclusive:"turi bÅ«ti ne trumpesnÄ kaip",notInclusive:"turi bÅ«ti ilgesnÄ kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi bÅ«ti ne didesnis kaip",notInclusive:"turi bÅ«ti mažesnis kaip"},bigger:{inclusive:"turi bÅ«ti ne mažesnis kaip",notInclusive:"turi bÅ«ti didesnis kaip"}}},array:{unit:{one:"elementÄ
",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turÄti ne daugiau kaip",notInclusive:"turi turÄti mažiau kaip"},bigger:{inclusive:"turi turÄti ne mažiau kaip",notInclusive:"turi turÄti daugiau kaip"}}},set:{unit:{one:"elementÄ
",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turÄti ne daugiau kaip",notInclusive:"turi turÄti mažiau kaip"},bigger:{inclusive:"turi turÄti ne mažiau kaip",notInclusive:"turi turÄti daugiau kaip"}}}};function t(t,r,n,i){let a=e[t]??null;return null===a?a:{unit:a.unit[r],verb:a.verb[i][n?"inclusive":"notInclusive"]}}let r={regex:"įvestis",email:"el. paÅ¡to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmÄ",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutÄ",base64url:"base64url užkoduota eilutÄ",json_string:"JSON eilutÄ",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},n={nan:"NaN",number:"skaiÄius",bigint:"sveikasis skaiÄius",string:"eilutÄ",boolean:"loginÄ reikÅ¡mÄ",undefined:"neapibrÄžta reikÅ¡mÄ",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinÄ reikÅ¡mÄ"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=tM(e.input),i=n[r]??r;if(/^[A-Z]/.test(e.expected))return`Gautas tipas ${i}, o tikÄtasi - instanceof ${e.expected}`;return`Gautas tipas ${i}, o tikÄtasi - ${t}`}case"invalid_value":if(1===e.values.length)return`Privalo bÅ«ti ${t_(e.values[0])}`;return`Privalo bÅ«ti vienas iÅ¡ ${tt(e.values,"|")} pasirinkimų`;case"too_big":{let r=n[e.origin]??e.origin,i=t(e.origin,i0(Number(e.maximum)),e.inclusive??!1,"smaller");if(i?.verb)return`${iQ(r??e.origin??"reikÅ¡mÄ")} ${i.verb} ${e.maximum.toString()} ${i.unit??"elementų"}`;let a=e.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${iQ(r??e.origin??"reikÅ¡mÄ")} turi bÅ«ti ${a} ${e.maximum.toString()} ${i?.unit}`}case"too_small":{let r=n[e.origin]??e.origin,i=t(e.origin,i0(Number(e.minimum)),e.inclusive??!1,"bigger");if(i?.verb)return`${iQ(r??e.origin??"reikÅ¡mÄ")} ${i.verb} ${e.minimum.toString()} ${i.unit??"elementų"}`;let a=e.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${iQ(r??e.origin??"reikÅ¡mÄ")} turi bÅ«ti ${a} ${e.minimum.toString()} ${i?.unit}`}case"invalid_format":if("starts_with"===e.format)return`EilutÄ privalo prasidÄti "${e.prefix}"`;if("ends_with"===e.format)return`EilutÄ privalo pasibaigti "${e.suffix}"`;if("includes"===e.format)return`EilutÄ privalo įtraukti "${e.includes}"`;if("regex"===e.format)return`EilutÄ privalo atitikti ${e.pattern}`;return`Neteisingas ${r[e.format]??e.format}`;case"not_multiple_of":return`SkaiÄius privalo bÅ«ti ${e.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${e.keys.length>1?"i":"as"} rakt${e.keys.length>1?"ai":"as"}: ${tt(e.keys,", ")}`;
39case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":default:return"Klaidinga įvestis";case"invalid_element":{let t=n[e.origin]??e.origin;return`${iQ(t??e.origin??"reikÅ¡mÄ")} turi klaidingÄ
įvestį`}}}})()}},"mk",0,function(){let e,t,r;return{localeError:(e={string:{unit:"знаÑи",verb:"да имааÑ"},file:{unit:"баÑÑи",verb:"да имааÑ"},array:{unit:"ÑÑавки",verb:"да имааÑ"},set:{unit:"ÑÑавки",verb:"да имааÑ"}},t={regex:"внеÑ",email:"адÑеÑа на е-поÑÑа",url:"URL",emoji:"емоÑи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO даÑÑм и вÑеме",date:"ISO даÑÑм",time:"ISO вÑеме",duration:"ISO вÑемеÑÑаеÑе",ipv4:"IPv4 адÑеÑа",ipv6:"IPv6 адÑеÑа",cidrv4:"IPv4 опÑег",cidrv6:"IPv6 опÑег",base64:"base64-енкодиÑана низа",base64url:"base64url-енкодиÑана низа",json_string:"JSON низа",e164:"E.164 бÑоÑ",jwt:"JWT",template_literal:"внеÑ"},r={nan:"NaN",number:"бÑоÑ",array:"низа"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÐÑеÑен внеÑ: Ñе оÑекÑва instanceof ${n.expected}, пÑимено ${i}`;return`ÐÑеÑен внеÑ: Ñе оÑекÑва ${e}, пÑимено ${i}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${t_(n.values[0])}`;return`ÐÑеÑана опÑиÑа: Ñе оÑекÑва една ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ÐÑÐµÐ¼Ð½Ð¾Ð³Ñ Ð³Ð¾Ð»ÐµÐ¼: Ñе оÑекÑва ${n.origin??"вÑедноÑÑа"} да има ${t}${n.maximum.toString()} ${r.unit??"елеменÑи"}`;return`ÐÑÐµÐ¼Ð½Ð¾Ð³Ñ Ð³Ð¾Ð»ÐµÐ¼: Ñе оÑекÑва ${n.origin??"вÑедноÑÑа"} да биде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ÐÑÐµÐ¼Ð½Ð¾Ð³Ñ Ð¼Ð°Ð»: Ñе оÑекÑва ${n.origin} да има ${t}${n.minimum.toString()} ${r.unit}`;return`ÐÑÐµÐ¼Ð½Ð¾Ð³Ñ Ð¼Ð°Ð»: Ñе оÑекÑва ${n.origin} да биде ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ÐеважеÑка низа: моÑа да запоÑнÑва Ñо "${n.prefix}"`;if("ends_with"===n.format)return`ÐеважеÑка низа: моÑа да завÑÑÑва Ñо "${n.suffix}"`;if("includes"===n.format)return`ÐеважеÑка низа: моÑа да вклÑÑÑва "${n.includes}"`;if("regex"===n.format)return`ÐеважеÑка низа: моÑа да одгоаÑа на паÑеÑÐ½Ð¾Ñ ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`ÐÑеÑен бÑоÑ: моÑа да биде делив Ñо ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"ÐепÑепознаени клÑÑеви":"ÐепÑепознаен клÑÑ"}: ${tt(n.keys,", ")}`;case"invalid_key":return`ÐÑеÑен клÑÑ Ð²Ð¾ ${n.origin}`;case"invalid_union":default:return"ÐÑеÑен внеÑ";case"invalid_element":return`ÐÑеÑна вÑедноÑÑ Ð²Ð¾ ${n.origin}`}})}},"ms",0,function(){let e,t,r;return{localeError:(e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}},t={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"nombor"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${i}`;return`Input tidak sah: dijangka ${e}, diterima ${i}`}
39case"invalid_value":if(1===n.values.length)return`Input tidak sah: dijangka ${t_(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Terlalu kecil: dijangka ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`String tidak sah: mesti bermula dengan "${n.prefix}"`;if("ends_with"===n.format)return`String tidak sah: mesti berakhir dengan "${n.suffix}"`;if("includes"===n.format)return`String tidak sah: mesti mengandungi "${n.includes}"`;if("regex"===n.format)return`String tidak sah: mesti sepadan dengan corak ${n.pattern}`;return`${t[n.format]??n.format} tidak sah`;case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${tt(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":default:return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`}})}},"nl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}},t={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},r={nan:"NaN",number:"getal"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${i}`;return`Ongeldige invoer: verwacht ${e}, ontving ${i}`}case"invalid_value":if(1===n.values.length)return`Ongeldige invoer: verwacht ${t_(n.values[0])}`;return`Ongeldige optie: verwacht \xe9\xe9n van ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null,i="date"===n.origin?"laat":"string"===n.origin?"lang":"groot";if(r)return`Te ${i}: verwacht dat ${n.origin??"waarde"} ${t}${n.maximum.toString()} ${r.unit??"elementen"} ${r.verb}`;return`Te ${i}: verwacht dat ${n.origin??"waarde"} ${t}${n.maximum.toString()} is`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null,i="date"===n.origin?"vroeg":"string"===n.origin?"kort":"klein";if(r)return`Te ${i}: verwacht dat ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ${r.verb}`;return`Te ${i}: verwacht dat ${n.origin} ${t}${n.minimum.toString()} is`}case"invalid_format":if("starts_with"===n.format)return`Ongeldige tekst: moet met "${n.prefix}" beginnen`;if("ends_with"===n.format)return`Ongeldige tekst: moet op "${n.suffix}" eindigen`;if("includes"===n.format)return`Ongeldige tekst: moet "${n.includes}" bevatten`;if("regex"===n.format)return`Ongeldige tekst: moet overeenkomen met patroon ${n.pattern}`;return`Ongeldig: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":default:return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`}})}},"no",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}},t={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"tall",array:"liste"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ugyldig input: forventet instanceof ${n.expected}, fikk ${i}`;return`Ugyldig input: forventet ${e}, fikk ${i}`}case"invalid_value":if(1===n.values.length)return`Ugyldig verdi: forventet ${t_(n.values[0])}`;return`Ugyldig valg: forventet en av ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`For stor(t): forventet ${n.origin??"value"} til \xe5 ha ${t}${n.maximum.toString()} ${r.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til \xe5 ha ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`For lite(n): forventet ${n.origin} til \xe5 ha ${t}${n.minimum.toString()} ${r.unit}`;return`For lite(n): forventet ${n.origin} til \xe5 ha ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ugyldig streng: m\xe5 starte med "${n.prefix}"`;if("ends_with"===n.format)return`Ugyldig streng: m\xe5 ende med "${n.suffix}"`;if("includes"===n.format)return`Ugyldig streng: m\xe5 inneholde "${n.includes}"`;if("regex"===n.format)return`Ugyldig streng: m\xe5 matche m\xf8nsteret ${n.pattern}`;return`Ugyldig ${t[n.format]??n.format}`;case"not_multiple_of":return`Ugyldig tall: m\xe5 v\xe6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${tt(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xf8kkel i ${n.origin}`;case"invalid_union":default:return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`}})}},"ota",0,function(){let e,t,r;return{localeError:(e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}},t={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 niÅânı",ipv6:"IPv6 niÅânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-Åifreli metin",base64url:"base64url-Åifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},r={nan:"NaN",number:"numara",array:"saf",null:"gayb"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`F\xe2sit giren: umulan instanceof ${n.expected}, alınan ${i}`;return`F\xe2sit giren: umulan ${e}, alınan ${i}`}case"invalid_value":if(1===n.values.length)return`F\xe2sit giren: umulan ${t_(n.values[0])}`;return`F\xe2sit tercih: m\xfbteberler ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Fazla b\xfcy\xfck: ${n.origin??"value"}, ${t}${n.maximum.toString()} ${r.unit??"elements"} sahip olmalıydı.`;return`Fazla b\xfcy\xfck: ${n.origin??"value"}, ${t}${n.maximum.toString()} olmalıydı.`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Fazla k\xfc\xe7\xfck: ${n.origin}, ${t}${n.minimum.toString()} ${r.unit} sahip olmalıydı.`;return`Fazla k\xfc\xe7\xfck: ${n.origin}, ${t}${n.minimum.toString()} olmalıydı.`}case"invalid_format":if("starts_with"===n.format)return`F\xe2sit metin: "${n.prefix}" ile baÅlamalı.`;if("ends_with"===n.format)return`F\xe2sit metin: "${n.suffix}" ile bitmeli.`;if("includes"===n.format)return`F\xe2sit metin: "${n.includes}" ihtiv\xe2 etmeli.`;if("regex"===n.format)return`F\xe2sit metin: ${n.pattern} nakÅına uymalı.`;return`F\xe2sit ${t[n.format]??n.format}`;case"not_multiple_of":return`F\xe2sit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xe7in tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} i\xe7in tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}})}},"pl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znaków",verb:"mieÄ"},file:{unit:"bajtów",verb:"mieÄ"},array:{unit:"elementów",verb:"mieÄ"},set:{unit:"elementów",verb:"mieÄ"}},t={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciÄ
g znaków zakodowany w formacie base64",base64url:"ciÄ
g znaków zakodowany w formacie base64url",json_string:"ciÄ
g znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejÅcie"},r={nan:"NaN",number:"liczba",array:"tablica"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`NieprawidÅowe dane wejÅciowe: oczekiwano instanceof ${n.expected}, otrzymano ${i}`;return`NieprawidÅowe dane wejÅciowe: oczekiwano ${e}, otrzymano ${i}`}case"invalid_value":if(1===n.values.length)return`NieprawidÅowe dane wejÅciowe: oczekiwano ${t_(n.values[0])}`;return`NieprawidÅowa opcja: oczekiwano jednej z wartoÅci ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Za duża wartoÅÄ: oczekiwano, że ${n.origin??"wartoÅÄ"} bÄdzie mieÄ ${t}${n.maximum.toString()} ${r.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartoÅÄ"} bÄdzie wynosiÄ ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Za maÅa wartoÅÄ: oczekiwano, że ${n.origin??"wartoÅÄ"} bÄdzie mieÄ ${t}${n.minimum.toString()} ${r.unit??"elementów"}`;return`Zbyt maÅ(y/a/e): oczekiwano, że ${n.origin??"wartoÅÄ"} bÄdzie wynosiÄ ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`NieprawidÅowy ciÄ
g znak\xf3w: musi zaczynaÄ siÄ od "${n.prefix}"`;if("ends_with"===n.format)return`NieprawidÅowy ciÄ
g znak\xf3w: musi koÅczyÄ siÄ na "${n.suffix}"`;if("includes"===n.format)return`NieprawidÅowy ciÄ
g znak\xf3w: musi zawieraÄ "${n.includes}"`;if("regex"===n.format)return`NieprawidÅowy ciÄ
g znak\xf3w: musi odpowiadaÄ wzorcowi ${n.pattern}`;return`NieprawidÅow(y/a/e) ${t[n.format]??n.format}`;case"not_multiple_of":return`NieprawidÅowa liczba: musi byÄ wielokrotnoÅciÄ
${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`NieprawidÅowy klucz w ${n.origin}`;case"invalid_union":default:return"NieprawidÅowe dane wejÅciowe";case"invalid_element":return`NieprawidÅowa wartoÅÄ w ${n.origin}`}})}},"ps",0,function(){let e,t,r;return{localeError:(e={string:{unit:"تÙÚ©Ù",verb:"ÙÙØ±Ù"},file:{unit:"باÛټس",verb:"ÙÙØ±Ù"},array:{unit:"تÙÚ©Ù",verb:"ÙÙØ±Ù"},set:{unit:"تÙÚ©Ù",verb:"ÙÙØ±Ù"}},t={regex:"ÙØ±ÙدÙ",email:"برÛÚÙØ§ÙÛÚ©",url:"Û٠آر اÙ",emoji:"اÛÙ
ÙØ¬Ù",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ÙÛÙ¼Ù Ø§Ù ÙØ®Øª",date:"ÙÛÙ¼Ù",time:"ÙØ®Øª",duration:"Ù
ÙØ¯Ù",ipv4:"د IPv4 پتÙ",ipv6:"د IPv6 پتÙ",cidrv4:"د IPv4 ساØÙ",cidrv6:"د IPv6 ساØÙ",base64:"base64-encoded Ù
تÙ",base64url:"base64url-encoded Ù
تÙ",json_string:"JSON Ù
تÙ",e164:"د E.164 Ø´Ù
ÛØ±Ù",jwt:"JWT",template_literal:"ÙØ±ÙدÙ"},r={nan:"NaN",number:"عدد",array:"ارÛ"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÙØ§Ø³Ù
ÙØ±ÙدÙ: Ø¨Ø§ÛØ¯ instanceof ${n.expected} ÙØ§Û, Ù
ګر ${i} ØªØ±ÙØ§Ø³Ù Ø´Ù`;return`ÙØ§Ø³Ù
ÙØ±ÙدÙ: Ø¨Ø§ÛØ¯ ${e} ÙØ§Û, Ù
ګر ${i} ØªØ±ÙØ§Ø³Ù Ø´Ù`}case"invalid_value":if(1===n.values.length)return`ÙØ§Ø³Ù
ÙØ±ÙدÙ: Ø¨Ø§ÛØ¯ ${t_(n.values[0])} ÙØ§Û`;return`ÙØ§Ø³Ù
Ø§ÙØªØ®Ø§Ø¨: Ø¨Ø§ÛØ¯ ÛÙ ÙÙ ${tt(n.values,"|")} Ú
Ø®Ù ÙØ§Û`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ÚÛØ± ÙÙÛ: ${n.origin??"Ø§Ø±Ø²ÚØª"} Ø¨Ø§ÛØ¯ ${t}${n.maximum.toString()} ${r.unit??"Ø¹ÙØµØ±ÙÙÙ"} ÙÙØ±Ù`;return`ÚÛØ± ÙÙÛ: ${n.origin??"Ø§Ø±Ø²ÚØª"} Ø¨Ø§ÛØ¯ ${t}${n.maximum.toString()} ÙÙ`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ÚÛØ± Ú©ÙÚÙÛ: ${n.origin} Ø¨Ø§ÛØ¯ ${t}${n.minimum.toString()} ${r.unit} ÙÙØ±Ù`;return`ÚÛØ± Ú©ÙÚÙÛ: ${n.origin} Ø¨Ø§ÛØ¯ ${t}${n.minimum.toString()} ÙÙ`}case"invalid_format":if("starts_with"===n.format)return`ÙØ§Ø³Ù
Ù
تÙ: Ø¨Ø§ÛØ¯ د "${n.prefix}" سر٠پÛÙ Ø´Ù`;if("ends_with"===n.format)return`ÙØ§Ø³Ù
Ù
تÙ: Ø¨Ø§ÛØ¯ د "${n.suffix}" Ø³Ø±Ù Ù¾Ø§Û ØªÙ ÙØ±Ø³ÙÚÙ`;if("includes"===n.format)return`ÙØ§Ø³Ù
Ù
تÙ: Ø¨Ø§ÛØ¯ "${n.includes}" ÙÙØ±Ù`;if("regex"===n.format)return`ÙØ§Ø³Ù
Ù
تÙ: Ø¨Ø§ÛØ¯ د ${n.pattern} سر٠Ù
Ø·Ø§Ø¨ÙØª ÙÙØ±Ù`;return`${t[n.format]??n.format} ÙØ§Ø³Ù
دÛ`;case"not_multiple_of":return`ÙØ§Ø³Ù
عدد: Ø¨Ø§ÛØ¯ د ${n.divisor} Ù
ضرب ÙÙ`;case"unrecognized_keys":return`ÙØ§Ø³Ù
${n.keys.length>1?"Ú©ÙÛÚÙÙÙ":"Ú©ÙÛÚ"}: ${tt(n.keys,", ")}`;
39case"invalid_key":return`ÙØ§Ø³Ù
Ú©ÙÛÚ Ù¾Ù ${n.origin} Ú©Û`;case"invalid_union":default:return"ÙØ§Ø³Ù
Ù ÙØ±ÙدÙ";case"invalid_element":return`ÙØ§Ø³Ù
Ø¹ÙØµØ± Ù¾Ù ${n.origin} Ú©Û`}})}},"pt",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}},t={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",number:"número",null:"nulo"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Tipo inv\xe1lido: esperado instanceof ${n.expected}, recebido ${i}`;return`Tipo inv\xe1lido: esperado ${e}, recebido ${i}`}case"invalid_value":if(1===n.values.length)return`Entrada inv\xe1lida: esperado ${t_(n.values[0])}`;return`Op\xe7\xe3o inv\xe1lida: esperada uma das ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${t}${n.maximum.toString()} ${r.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Muito pequeno: esperado que ${n.origin} tivesse ${t}${n.minimum.toString()} ${r.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Texto inv\xe1lido: deve come\xe7ar com "${n.prefix}"`;if("ends_with"===n.format)return`Texto inv\xe1lido: deve terminar com "${n.suffix}"`;if("includes"===n.format)return`Texto inv\xe1lido: deve incluir "${n.includes}"`;if("regex"===n.format)return`Texto inv\xe1lido: deve corresponder ao padr\xe3o ${n.pattern}`;return`${t[n.format]??n.format} inv\xe1lido`;case"not_multiple_of":return`N\xfamero inv\xe1lido: deve ser m\xfaltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`Chave inv\xe1lida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inv\xe1lido em ${n.origin}`;default:return"Campo inválido"}})}},"ru",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"Ñимвол",few:"Ñимвола",many:"Ñимволов"},verb:"имеÑÑ"},file:{unit:{one:"байÑ",few:"байÑа",many:"байÑ"},verb:"имеÑÑ"},array:{unit:{one:"ÑлеменÑ",few:"ÑлеменÑа",many:"ÑлеменÑов"},verb:"имеÑÑ"},set:{unit:{one:"ÑлеменÑ",few:"ÑлеменÑа",many:"ÑлеменÑов"},verb:"имеÑÑ"}},t={regex:"ввод",email:"email адÑеÑ",url:"URL",emoji:"Ñмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO даÑа и вÑемÑ",date:"ISO даÑа",time:"ISO вÑемÑ",duration:"ISO длиÑелÑноÑÑÑ",ipv4:"IPv4 адÑеÑ",ipv6:"IPv6 адÑеÑ",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"ÑÑÑока в ÑоÑмаÑе base64",base64url:"ÑÑÑока в ÑоÑмаÑе base64url",json_string:"JSON ÑÑÑока",e164:"Ð½Ð¾Ð¼ÐµÑ E.164",jwt:"JWT",template_literal:"ввод"},r={nan:"NaN",number:"ÑиÑло",array:"маÑÑив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ÐевеÑнÑй ввод: ожидалоÑÑ instanceof ${n.expected}, полÑÑено ${i}`;return`ÐевеÑнÑй ввод: ожидалоÑÑ ${e}, полÑÑено ${i}`}
39case"invalid_value":if(1===n.values.length)return`ÐевеÑнÑй ввод: ожидалоÑÑ ${t_(n.values[0])}`;return`ÐевеÑнÑй ваÑианÑ: ожидалоÑÑ Ð¾Ð´Ð½Ð¾ из ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=i1(Number(n.maximum),r.unit.one,r.unit.few,r.unit.many);return`СлиÑком болÑÑое знаÑение: ожидалоÑÑ, ÑÑо ${n.origin??"знаÑение"} бÑÐ´ÐµÑ Ð¸Ð¼ÐµÑÑ ${t}${n.maximum.toString()} ${e}`}return`СлиÑком болÑÑое знаÑение: ожидалоÑÑ, ÑÑо ${n.origin??"знаÑение"} бÑÐ´ÐµÑ ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=i1(Number(n.minimum),r.unit.one,r.unit.few,r.unit.many);return`СлиÑком маленÑкое знаÑение: ожидалоÑÑ, ÑÑо ${n.origin} бÑÐ´ÐµÑ Ð¸Ð¼ÐµÑÑ ${t}${n.minimum.toString()} ${e}`}return`СлиÑком маленÑкое знаÑение: ожидалоÑÑ, ÑÑо ${n.origin} бÑÐ´ÐµÑ ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ÐевеÑÐ½Ð°Ñ ÑÑÑока: должна наÑинаÑÑÑÑ Ñ "${n.prefix}"`;if("ends_with"===n.format)return`ÐевеÑÐ½Ð°Ñ ÑÑÑока: должна заканÑиваÑÑÑÑ Ð½Ð° "${n.suffix}"`;if("includes"===n.format)return`ÐевеÑÐ½Ð°Ñ ÑÑÑока: должна ÑодеÑжаÑÑ "${n.includes}"`;if("regex"===n.format)return`ÐевеÑÐ½Ð°Ñ ÑÑÑока: должна ÑооÑвеÑÑÑвоваÑÑ ÑÐ°Ð±Ð»Ð¾Ð½Ñ ${n.pattern}`;return`ÐевеÑнÑй ${t[n.format]??n.format}`;case"not_multiple_of":return`ÐевеÑное ÑиÑло: должно бÑÑÑ ÐºÑаÑнÑм ${n.divisor}`;case"unrecognized_keys":return`ÐеÑаÑпознанн${n.keys.length>1?"Ñе":"Ñй"} клÑÑ${n.keys.length>1?"и":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`ÐевеÑнÑй клÑÑ Ð² ${n.origin}`;case"invalid_union":default:return"ÐевеÑнÑе вÑ
однÑе даннÑе";case"invalid_element":return`ÐевеÑное знаÑение в ${n.origin}`}})}},"sl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}},t={regex:"vnos",email:"e-poÅ¡tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in Äas",date:"ISO datum",time:"ISO Äas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 Å¡tevilka",jwt:"JWT",template_literal:"vnos"},r={nan:"NaN",number:"Å¡tevilo",array:"tabela"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neveljaven vnos: priÄakovano instanceof ${n.expected}, prejeto ${i}`;return`Neveljaven vnos: priÄakovano ${e}, prejeto ${i}`}case"invalid_value":if(1===n.values.length)return`Neveljaven vnos: priÄakovano ${t_(n.values[0])}`;return`Neveljavna možnost: priÄakovano eno izmed ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Preveliko: priÄakovano, da bo ${n.origin??"vrednost"} imelo ${t}${n.maximum.toString()} ${r.unit??"elementov"}`;return`Preveliko: priÄakovano, da bo ${n.origin??"vrednost"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Premajhno: priÄakovano, da bo ${n.origin} imelo ${t}${n.minimum.toString()} ${r.unit}`;return`Premajhno: priÄakovano, da bo ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neveljaven niz: mora se zaÄeti z "${n.prefix}"`;if("ends_with"===n.format)return`Neveljaven niz: mora se konÄati z "${n.suffix}"`;if("includes"===n.format)return`Neveljaven niz: mora vsebovati "${n.includes}"`;if("regex"===n.format)return`Neveljaven niz: mora ustrezati vzorcu ${n.pattern}`;return`Neveljaven ${t[n.format]??n.format}`;case"not_multiple_of":return`Neveljavno Å¡tevilo: mora biti veÄkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i kljuÄi":" kljuÄ"}: ${tt(n.keys,", ")}`;
39case"invalid_key":return`Neveljaven kljuÄ v ${n.origin}`;case"invalid_union":default:return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`}})}},"sv",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehÃ¥lla"},set:{unit:"objekt",verb:"att innehÃ¥lla"}},t={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},r={nan:"NaN",number:"antal",array:"lista"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ogiltig inmatning: f\xf6rv\xe4ntat instanceof ${n.expected}, fick ${i}`;return`Ogiltig inmatning: f\xf6rv\xe4ntat ${e}, fick ${i}`}case"invalid_value":if(1===n.values.length)return`Ogiltig inmatning: f\xf6rv\xe4ntat ${t_(n.values[0])}`;return`Ogiltigt val: f\xf6rv\xe4ntade en av ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`F\xf6r stor(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.maximum.toString()} ${r.unit??"element"}`;return`F\xf6r stor(t): f\xf6rv\xe4ntat ${n.origin??"värdet"} att ha ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`F\xf6r lite(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.minimum.toString()} ${r.unit}`;return`F\xf6r lite(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ogiltig str\xe4ng: m\xe5ste b\xf6rja med "${n.prefix}"`;if("ends_with"===n.format)return`Ogiltig str\xe4ng: m\xe5ste sluta med "${n.suffix}"`;if("includes"===n.format)return`Ogiltig str\xe4ng: m\xe5ste inneh\xe5lla "${n.includes}"`;if("regex"===n.format)return`Ogiltig str\xe4ng: m\xe5ste matcha m\xf6nstret "${n.pattern}"`;return`Ogiltig(t) ${t[n.format]??n.format}`;case"not_multiple_of":return`Ogiltigt tal: m\xe5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${tt(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":default:return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xe4rde i ${n.origin??"värdet"}`}})}},"ta",0,function(){let e,t,r;return{localeError:(e={string:{unit:"à®à®´à¯à®¤à¯à®¤à¯à®à¯à®à®³à¯",verb:"à®à¯à®£à¯à®à®¿à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯"},file:{unit:"பà¯à®à¯à®à¯à®à®³à¯",verb:"à®à¯à®£à¯à®à®¿à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯"},array:{unit:"à®à®±à¯à®ªà¯à®ªà¯à®à®³à¯",verb:"à®à¯à®£à¯à®à®¿à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯"},set:{unit:"à®à®±à¯à®ªà¯à®ªà¯à®à®³à¯",verb:"à®à¯à®£à¯à®à®¿à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯"}},t={regex:"à®à®³à¯à®³à¯à®à¯",email:"மினà¯à®©à®à¯à®à®²à¯ à®®à¯à®à®µà®°à®¿",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தà¯à®¤à®¿ நà¯à®°à®®à¯",date:"ISO தà¯à®¤à®¿",time:"ISO நà¯à®°à®®à¯",duration:"ISO à®à®¾à®² à®
ளவà¯",ipv4:"IPv4 à®®à¯à®à®µà®°à®¿",ipv6:"IPv6 à®®à¯à®à®µà®°à®¿",cidrv4:"IPv4 வரமà¯à®ªà¯",cidrv6:"IPv6 வரமà¯à®ªà¯",base64:"base64-encoded à®à®°à®®à¯",base64url:"base64url-encoded à®à®°à®®à¯",json_string:"JSON à®à®°à®®à¯",e164:"E.164 à®à®£à¯",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"à®à®£à¯",array:"à®
ணி",null:"வà¯à®±à¯à®®à¯"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;
39if(/^[A-Z]/.test(n.expected))return`தவறான à®à®³à¯à®³à¯à®à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ instanceof ${n.expected}, பà¯à®±à®ªà¯à®ªà®à¯à®à®¤à¯ ${i}`;return`தவறான à®à®³à¯à®³à¯à®à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${e}, பà¯à®±à®ªà¯à®ªà®à¯à®à®¤à¯ ${i}`}case"invalid_value":if(1===n.values.length)return`தவறான à®à®³à¯à®³à¯à®à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${t_(n.values[0])}`;return`தவறான விரà¯à®ªà¯à®ªà®®à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${tt(n.values,"|")} à®à®²à¯ à®à®©à¯à®±à¯`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`மி஠பà¯à®°à®¿à®¯à®¤à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${n.origin??"மதிபà¯à®ªà¯"} ${t}${n.maximum.toString()} ${r.unit??"à®à®±à¯à®ªà¯à®ªà¯à®à®³à¯"} à®à® à®à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯`;return`மி஠பà¯à®°à®¿à®¯à®¤à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${n.origin??"மதிபà¯à®ªà¯"} ${t}${n.maximum.toString()} à®à® à®à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`மிà®à®à¯ à®à®¿à®±à®¿à®¯à®¤à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${n.origin} ${t}${n.minimum.toString()} ${r.unit} à®à® à®à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯`;return`மிà®à®à¯ à®à®¿à®±à®¿à®¯à®¤à¯: à®à®¤à®¿à®°à¯à®ªà®¾à®°à¯à®à¯à®à®ªà¯à®ªà®à¯à®à®¤à¯ ${n.origin} ${t}${n.minimum.toString()} à®à® à®à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯`}case"invalid_format":if("starts_with"===n.format)return`தவறான à®à®°à®®à¯: "${n.prefix}" à®à®²à¯ தà¯à®à®à¯à® வà¯à®£à¯à®à¯à®®à¯`;if("ends_with"===n.format)return`தவறான à®à®°à®®à¯: "${n.suffix}" à®à®²à¯ à®®à¯à®à®¿à®µà®à¯à®¯ வà¯à®£à¯à®à¯à®®à¯`;if("includes"===n.format)return`தவறான à®à®°à®®à¯: "${n.includes}" à® à®à®³à¯à®³à®à®à¯à® வà¯à®£à¯à®à¯à®®à¯`;if("regex"===n.format)return`தவறான à®à®°à®®à¯: ${n.pattern} à®®à¯à®±à¯à®ªà®¾à®à¯à®à¯à®à®©à¯ பà¯à®°à¯à®¨à¯à®¤ வà¯à®£à¯à®à¯à®®à¯`;return`தவறான ${t[n.format]??n.format}`;case"not_multiple_of":return`தவறான à®à®£à¯: ${n.divisor} à®à®©à¯ பலமா஠à®à®°à¯à®à¯à® வà¯à®£à¯à®à¯à®®à¯`;case"unrecognized_keys":return`à®
à®à¯à®¯à®¾à®³à®®à¯ தà¯à®°à®¿à®¯à®¾à®¤ விà®à¯${n.keys.length>1?"à®à®³à¯":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`${n.origin} à®à®²à¯ தவறான விà®à¯`;case"invalid_union":default:return"தவறான à®à®³à¯à®³à¯à®à¯";case"invalid_element":return`${n.origin} à®à®²à¯ தவறான மதிபà¯à®ªà¯`}})}},"th",0,function(){let e,t,r;return{localeError:(e={string:{unit:"à¸à¸±à¸§à¸à¸±à¸à¸©à¸£",verb:"à¸à¸§à¸£à¸¡à¸µ"},file:{unit:"à¹à¸à¸à¹",verb:"à¸à¸§à¸£à¸¡à¸µ"},array:{unit:"รายà¸à¸²à¸£",verb:"à¸à¸§à¸£à¸¡à¸µ"},set:{unit:"รายà¸à¸²à¸£",verb:"à¸à¸§à¸£à¸¡à¸µ"}},t={regex:"à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸à¹à¸à¸",email:"à¸à¸µà¹à¸à¸¢à¸¹à¹à¸à¸µà¹à¸¡à¸¥",url:"URL",emoji:"à¸à¸´à¹à¸¡à¸à¸´",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วัà¸à¸à¸µà¹à¹à¸§à¸¥à¸²à¹à¸à¸ ISO",date:"วัà¸à¸à¸µà¹à¹à¸à¸ ISO",time:"à¹à¸§à¸¥à¸²à¹à¸à¸ ISO",duration:"à¸à¹à¸§à¸à¹à¸§à¸¥à¸²à¹à¸à¸ ISO",ipv4:"à¸à¸µà¹à¸à¸¢à¸¹à¹ IPv4",ipv6:"à¸à¸µà¹à¸à¸¢à¸¹à¹ IPv6",cidrv4:"à¸à¹à¸§à¸ IP à¹à¸à¸ IPv4",cidrv6:"à¸à¹à¸§à¸ IP à¹à¸à¸ IPv6",base64:"à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸à¸ Base64",base64url:"à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸à¸ Base64 สำหรัภURL",json_string:"à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸à¸ JSON",e164:"à¹à¸à¸à¸£à¹à¹à¸à¸£à¸¨à¸±à¸à¸à¹à¸£à¸°à¸«à¸§à¹à¸²à¸à¸à¸£à¸°à¹à¸à¸¨ (E.164)",jwt:"à¹à¸à¹à¸à¸ JWT",template_literal:"à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸à¹à¸à¸"},r={nan:"NaN",number:"à¸à¸±à¸§à¹à¸¥à¸",array:"à¸à¸²à¸£à¹à¹à¸£à¸¢à¹ (Array)",null:"à¹à¸¡à¹à¸¡à¸µà¸à¹à¸² (null)"},n=>
39{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`à¸à¸£à¸°à¹à¸ à¸à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¸§à¸£à¹à¸à¹à¸ instanceof ${n.expected} à¹à¸à¹à¹à¸à¹à¸£à¸±à¸ ${i}`;return`à¸à¸£à¸°à¹à¸ à¸à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¸§à¸£à¹à¸à¹à¸ ${e} à¹à¸à¹à¹à¸à¹à¸£à¸±à¸ ${i}`}case"invalid_value":if(1===n.values.length)return`à¸à¹à¸²à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¸§à¸£à¹à¸à¹à¸ ${t_(n.values[0])}`;return`à¸à¸±à¸§à¹à¸¥à¸·à¸à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¸§à¸£à¹à¸à¹à¸à¸«à¸à¸¶à¹à¸à¹à¸ ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"à¹à¸¡à¹à¹à¸à¸´à¸":"à¸à¹à¸à¸¢à¸à¸§à¹à¸²",r=e[n.origin]??null;if(r)return`à¹à¸à¸´à¸à¸à¸³à¸«à¸à¸: ${n.origin??"à¸à¹à¸²"} à¸à¸§à¸£à¸¡à¸µ${t} ${n.maximum.toString()} ${r.unit??"รายà¸à¸²à¸£"}`;return`à¹à¸à¸´à¸à¸à¸³à¸«à¸à¸: ${n.origin??"à¸à¹à¸²"} à¸à¸§à¸£à¸¡à¸µ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"à¸à¸¢à¹à¸²à¸à¸à¹à¸à¸¢":"มาà¸à¸à¸§à¹à¸²",r=e[n.origin]??null;if(r)return`à¸à¹à¸à¸¢à¸à¸§à¹à¸²à¸à¸³à¸«à¸à¸: ${n.origin} à¸à¸§à¸£à¸¡à¸µ${t} ${n.minimum.toString()} ${r.unit}`;return`à¸à¹à¸à¸¢à¸à¸§à¹à¸²à¸à¸³à¸«à¸à¸: ${n.origin} à¸à¸§à¸£à¸¡à¸µ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`รูà¸à¹à¸à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¹à¸à¸à¸à¸¶à¹à¸à¸à¹à¸à¸à¹à¸§à¸¢ "${n.prefix}"`;if("ends_with"===n.format)return`รูà¸à¹à¸à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¹à¸à¸à¸¥à¸à¸à¹à¸²à¸¢à¸à¹à¸§à¸¢ "${n.suffix}"`;if("includes"===n.format)return`รูà¸à¹à¸à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¹à¸à¸à¸¡à¸µ "${n.includes}" à¸à¸¢à¸¹à¹à¹à¸à¸à¹à¸à¸à¸§à¸²à¸¡`;if("regex"===n.format)return`รูà¸à¹à¸à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¹à¸à¸à¸à¸£à¸à¸à¸±à¸à¸£à¸¹à¸à¹à¸à¸à¸à¸µà¹à¸à¸³à¸«à¸à¸ ${n.pattern}`;return`รูà¸à¹à¸à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: ${t[n.format]??n.format}`;case"not_multiple_of":return`à¸à¸±à¸§à¹à¸¥à¸à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¸à¹à¸à¸à¹à¸à¹à¸à¸à¸³à¸à¸§à¸à¸à¸µà¹à¸«à¸²à¸£à¸à¹à¸§à¸¢ ${n.divisor} à¹à¸à¹à¸¥à¸à¸à¸±à¸§`;case"unrecognized_keys":return`à¸à¸à¸à¸µà¸¢à¹à¸à¸µà¹à¹à¸¡à¹à¸£à¸¹à¹à¸à¸±à¸: ${tt(n.keys,", ")}`;case"invalid_key":return`à¸à¸µà¸¢à¹à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸à¹à¸ ${n.origin}`;case"invalid_union":return"à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸: à¹à¸¡à¹à¸à¸£à¸à¸à¸±à¸à¸£à¸¹à¸à¹à¸à¸à¸¢à¸¹à¹à¸à¸µà¸¢à¸à¸à¸µà¹à¸à¸³à¸«à¸à¸à¹à¸§à¹";case"invalid_element":return`à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸à¹à¸ ${n.origin}`;default:return"à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸"}})}},"tr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öÄe",verb:"olmalı"},set:{unit:"öÄe",verb:"olmalı"}},t={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralıÄı",cidrv6:"IPv6 aralıÄı",base64:"base64 ile ÅifrelenmiÅ metin",base64url:"base64url ile ÅifrelenmiÅ metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Åablon dizesi"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ge\xe7ersiz deÄer: beklenen instanceof ${n.expected}, alınan ${i}`;return`Ge\xe7ersiz deÄer: beklenen ${e}, alınan ${i}`}case"invalid_value":if(1===n.values.length)return`Ge\xe7ersiz deÄer: beklenen ${t_(n.values[0])}`;return`Ge\xe7ersiz se\xe7enek: aÅaÄıdakilerden biri olmalı: ${tt(n.values,"|")}`;
39case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`\xc7ok b\xfcy\xfck: beklenen ${n.origin??"deÄer"} ${t}${n.maximum.toString()} ${r.unit??"öÄe"}`;return`\xc7ok b\xfcy\xfck: beklenen ${n.origin??"deÄer"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`\xc7ok k\xfc\xe7\xfck: beklenen ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`\xc7ok k\xfc\xe7\xfck: beklenen ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ge\xe7ersiz metin: "${n.prefix}" ile baÅlamalı`;if("ends_with"===n.format)return`Ge\xe7ersiz metin: "${n.suffix}" ile bitmeli`;if("includes"===n.format)return`Ge\xe7ersiz metin: "${n.includes}" i\xe7ermeli`;if("regex"===n.format)return`Ge\xe7ersiz metin: ${n.pattern} desenine uymalı`;return`Ge\xe7ersiz ${t[n.format]??n.format}`;case"not_multiple_of":return`Ge\xe7ersiz sayı: ${n.divisor} ile tam b\xf6l\xfcnebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${n.keys.length>1?"lar":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xe7inde ge\xe7ersiz anahtar`;case"invalid_union":default:return"Geçersiz deÄer";case"invalid_element":return`${n.origin} i\xe7inde ge\xe7ersiz deÄer`}})}},"ua",0,function(){return i2()},"uk",0,i2,"ur",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ØØ±ÙÙ",verb:"ÛÙÙØ§"},file:{unit:"بائٹس",verb:"ÛÙÙØ§"},array:{unit:"آئٹÙ
ز",verb:"ÛÙÙØ§"},set:{unit:"آئٹÙ
ز",verb:"ÛÙÙØ§"}},t={regex:"ا٠پٹ",email:"Ø§Û Ù
Û٠اÛÚØ±Ûس",url:"Û٠آر اÛÙ",emoji:"اÛÙ
ÙØ¬Û",uuid:"ÛÙ ÛÙ Ø¢Ø¦Û ÚÛ",uuidv4:"ÛÙ ÛÙ Ø¢Ø¦Û ÚÛ ÙÛ 4",uuidv6:"ÛÙ ÛÙ Ø¢Ø¦Û ÚÛ ÙÛ 6",nanoid:"ÙÛÙÙ Ø¢Ø¦Û ÚÛ",guid:"Ø¬Û ÛÙ Ø¢Ø¦Û ÚÛ",cuid:"Ø³Û ÛÙ Ø¢Ø¦Û ÚÛ",cuid2:"Ø³Û ÛÙ Ø¢Ø¦Û ÚÛ 2",ulid:"Û٠اÛÙ Ø¢Ø¦Û ÚÛ",xid:"اÛکس Ø¢Ø¦Û ÚÛ",ksuid:"Ú©Û Ø§ÛØ³ ÛÙ Ø¢Ø¦Û ÚÛ",datetime:"Ø¢Ø¦Û Ø§ÛØ³ ا٠ÚÛÙ¹ ٹائÙ
",date:"Ø¢Ø¦Û Ø§ÛØ³ Ø§Ù ØªØ§Ø±ÛØ®",time:"Ø¢Ø¦Û Ø§ÛØ³ ا٠ÙÙØª",duration:"Ø¢Ø¦Û Ø§ÛØ³ ا٠Ù
دت",ipv4:"Ø¢Ø¦Û Ù¾Û ÙÛ 4 اÛÚØ±Ûس",ipv6:"Ø¢Ø¦Û Ù¾Û ÙÛ 6 اÛÚØ±Ûس",cidrv4:"Ø¢Ø¦Û Ù¾Û ÙÛ 4 رÛÙØ¬",cidrv6:"Ø¢Ø¦Û Ù¾Û ÙÛ 6 رÛÙØ¬",base64:"Ø¨ÛØ³ 64 ا٠کÙÚÚ Ø³Ù¹Ø±ÙÚ¯",base64url:"Ø¨ÛØ³ 64 Û٠آر اÛ٠ا٠کÙÚÚ Ø³Ù¹Ø±ÙÚ¯",json_string:"Ø¬Û Ø§ÛØ³ ا٠اÛ٠سٹرÙÚ¯",e164:"Ø§Û 164 ÙÙ
بر",jwt:"Ø¬Û ÚØ¨ÙÛÙ Ù¹Û",template_literal:"ا٠پٹ"},r={nan:"NaN",number:"ÙÙ
بر",array:"آرÛ",null:"ÙÙ"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ØºÙØ· ا٠پٹ: instanceof ${n.expected} Ù
تÙÙØ¹ ØªÚ¾Ø§Ø ${i} Ù
ÙØµÙÙ ÛÙØ§`;return`ØºÙØ· ا٠پٹ: ${e} Ù
تÙÙØ¹ ØªÚ¾Ø§Ø ${i} Ù
ÙØµÙÙ ÛÙØ§`}case"invalid_value":if(1===n.values.length)return`ØºÙØ· ا٠پٹ: ${t_(n.values[0])} Ù
تÙÙØ¹ تھا`;return`ØºÙØ· آپشÙ: ${tt(n.values,"|")} Ù
ÛÚº Ø³Û Ø§ÛÚ© Ù
تÙÙØ¹ تھا`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Ø¨ÛØª Ø¨ÚØ§: ${n.origin??"ÙÛÙÛÙ"} Ú©Û ${t}${n.maximum.toString()} ${r.unit??"Ø¹ÙØ§ØµØ±"} ÛÙÙÛ Ù
تÙÙØ¹ تھÛ`;return`Ø¨ÛØª Ø¨ÚØ§: ${n.origin??"ÙÛÙÛÙ"} کا ${t}${n.maximum.toString()} ÛÙÙØ§ Ù
تÙÙØ¹ تھا`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Ø¨ÛØª ÚÚ¾Ùٹا: ${n.origin} Ú©Û ${t}${n.minimum.toString()} ${r.unit} ÛÙÙÛ Ù
تÙÙØ¹ تھÛ`;return`Ø¨ÛØª ÚÚ¾Ùٹا: ${n.origin} کا ${t}${n.minimum.toString()} ÛÙÙØ§ Ù
تÙÙØ¹ تھا`}case"invalid_format":if("starts_with"===n.format)return`ØºÙØ· سٹرÙÚ¯: "${n.prefix}" Ø³Û Ø´Ø±ÙØ¹ ÛÙÙØ§ ÚØ§ÛÛÛ`;if("ends_with"===n.format)return`ØºÙØ· سٹرÙÚ¯: "${n.suffix}" پر ختÙ
ÛÙÙØ§ ÚØ§ÛÛÛ`;if("includes"===n.format)return`ØºÙØ· سٹرÙÚ¯: "${n.includes}" شاÙ
Ù ÛÙÙØ§ ÚØ§ÛÛÛ`;if("regex"===n.format)return`ØºÙØ· سٹرÙÚ¯: Ù¾Ûٹر٠${n.pattern} Ø³Û Ù
ÛÚ ÛÙÙØ§ ÚØ§ÛÛÛ`;return`ØºÙØ· ${t[n.format]??n.format}`;case"not_multiple_of":return`ØºÙØ· ÙÙ
بر: ${n.divisor} کا Ù
ضاع٠ÛÙÙØ§ ÚØ§ÛÛÛ`;case"unrecognized_keys":return`ØºÛØ± تسÙÛÙ
Ø´Ø¯Û Ú©Û${n.keys.length>1?"ز":""}: ${tt(n.keys,"Ø ")}`;
39case"invalid_key":return`${n.origin} Ù
ÛÚº ØºÙØ· Ú©Û`;case"invalid_union":default:return"ØºÙØ· ا٠پٹ";case"invalid_element":return`${n.origin} Ù
ÛÚº ØºÙØ· ÙÛÙÛÙ`}})}},"uz",0,function(){let e,t,r;return{localeError:(e={string:{unit:"belgi",verb:"boâlishi kerak"},file:{unit:"bayt",verb:"boâlishi kerak"},array:{unit:"element",verb:"boâlishi kerak"},set:{unit:"element",verb:"boâlishi kerak"}},t={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},r={nan:"NaN",number:"raqam",array:"massiv"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Notoâgâri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${i}`;return`Notoâgâri kirish: kutilgan ${e}, qabul qilingan ${i}`}case"invalid_value":if(1===n.values.length)return`Notoâgâri kirish: kutilgan ${t_(n.values[0])}`;return`Notoâgâri variant: quyidagilardan biri kutilgan ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Juda katta: kutilgan ${n.origin??"qiymat"} ${t}${n.maximum.toString()} ${r.unit} ${r.verb}`;return`Juda katta: kutilgan ${n.origin??"qiymat"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Juda kichik: kutilgan ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ${r.verb}`;return`Juda kichik: kutilgan ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Notoâgâri satr: "${n.prefix}" bilan boshlanishi kerak`;if("ends_with"===n.format)return`Notoâgâri satr: "${n.suffix}" bilan tugashi kerak`;if("includes"===n.format)return`Notoâgâri satr: "${n.includes}" ni oâz ichiga olishi kerak`;if("regex"===n.format)return`Notoâgâri satr: ${n.pattern} shabloniga mos kelishi kerak`;return`Notoâgâri ${t[n.format]??n.format}`;case"not_multiple_of":return`Notoâgâri raqam: ${n.divisor} ning karralisi boâlishi kerak`;case"unrecognized_keys":return`Nomaâlum kalit${n.keys.length>1?"lar":""}: ${tt(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit notoâgâri`;case"invalid_union":default:return"Notoâgâri kirish";case"invalid_element":return`${n.origin} da notoâgâri qiymat`}})}},"vi",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ký tá»±",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tá»",verb:"có"},set:{unit:"phần tá»",verb:"có"}},t={regex:"Äầu và o",email:"Äá»a chá» email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngà y giá» ISO",date:"ngà y ISO",time:"giá» ISO",duration:"khoảng thá»i gian ISO",ipv4:"Äá»a chá» IPv4",ipv6:"Äá»a chá» IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuá»i mã hóa base64",base64url:"chuá»i mã hóa base64url",json_string:"chuá»i JSON",e164:"sá» E.164",jwt:"JWT",template_literal:"Äầu và o"},r={nan:"NaN",number:"sá»",array:"mảng"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Äầu v\xe0o kh\xf4ng hợp lá»: mong Äợi instanceof ${n.expected}, nháºn ÄÆ°á»£c ${i}`;return`Äầu v\xe0o kh\xf4ng hợp lá»: mong Äợi ${e}, nháºn ÄÆ°á»£c ${i}`}case"invalid_value":if(1===n.values.length)return`Äầu v\xe0o kh\xf4ng hợp lá»: mong Äợi ${t_(n.values[0])}`;return`T\xf9y chá»n kh\xf4ng hợp lá»: mong Äợi má»t trong c\xe1c gi\xe1 trá» ${tt(n.values,"|")}`;
39case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Qu\xe1 lá»n: mong Äợi ${n.origin??"giá trá»"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"phần tá»"}`;return`Qu\xe1 lá»n: mong Äợi ${n.origin??"giá trá»"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Qu\xe1 nhá»: mong Äợi ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Qu\xe1 nhá»: mong Äợi ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Chuá»i kh\xf4ng hợp lá»: phải bắt Äầu bằng "${n.prefix}"`;if("ends_with"===n.format)return`Chuá»i kh\xf4ng hợp lá»: phải kết th\xfac bằng "${n.suffix}"`;if("includes"===n.format)return`Chuá»i kh\xf4ng hợp lá»: phải bao gá»m "${n.includes}"`;if("regex"===n.format)return`Chuá»i kh\xf4ng hợp lá»: phải khá»p vá»i mẫu ${n.pattern}`;return`${t[n.format]??n.format} kh\xf4ng hợp lá»`;case"not_multiple_of":return`Sá» kh\xf4ng hợp lá»: phải l\xe0 bá»i sá» cá»§a ${n.divisor}`;case"unrecognized_keys":return`Kh\xf3a kh\xf4ng ÄÆ°á»£c nháºn dạng: ${tt(n.keys,", ")}`;case"invalid_key":return`Kh\xf3a kh\xf4ng hợp lá» trong ${n.origin}`;case"invalid_union":default:return"Äầu và o không hợp lá»";case"invalid_element":return`Gi\xe1 trá» kh\xf4ng hợp lá» trong ${n.origin}`}})}},"yo",0,function(){let e,t,r;return{localeError:(e={string:{unit:"à mi",verb:"nÃ"},file:{unit:"bytes",verb:"nÃ"},array:{unit:"nkan",verb:"nÃ"},set:{unit:"nkan",verb:"nÃ"}},t={regex:"ẹÌrỠìbáwá»lé",email:"à dÃrẹÌsì ìmẹÌlì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"à kókò ISO",date:"á»já»Ì ISO",time:"à kókò ISO",duration:"à kókò tó pé ISO",ipv4:"à dÃrẹÌsì IPv4",ipv6:"à dÃrẹÌsì IPv6",cidrv4:"à gbègbè IPv4",cidrv6:"à gbègbè IPv6",base64:"á»Ìrá»Ì tà a ká»Ì nà base64",base64url:"á»Ìrá»Ì base64url",json_string:"á»Ìrá»Ì JSON",e164:"ná»Ìmbà E.164",jwt:"JWT",template_literal:"ẹÌrỠìbáwá»lé"},r={nan:"NaN",number:"ná»Ìmbà ",array:"akopá»"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`\xccb\xe1wá»l\xe9 aá¹£\xecá¹£e: a n\xed l\xe1ti fi instanceof ${n.expected}, \xe0má»Ì a r\xed ${i}`;return`\xccb\xe1wá»l\xe9 aá¹£\xecá¹£e: a n\xed l\xe1ti fi ${e}, \xe0má»Ì a r\xed ${i}`}case"invalid_value":if(1===n.values.length)return`\xccb\xe1wá»l\xe9 aá¹£\xecá¹£e: a n\xed l\xe1ti fi ${t_(n.values[0])}`;return`\xc0á¹£\xe0y\xe0n aá¹£\xecá¹£e: yan á»Ìkan l\xe1ra ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`T\xf3 pá»Ì j\xf9: a n\xed l\xe1ti jáº¹Ì p\xe9 ${n.origin??"iye"} ${r.verb} ${t}${n.maximum} ${r.unit}`;return`T\xf3 pá»Ì j\xf9: a n\xed l\xe1ti jáº¹Ì ${t}${n.maximum}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`K\xe9r\xe9 ju: a n\xed l\xe1ti jáº¹Ì p\xe9 ${n.origin} ${r.verb} ${t}${n.minimum} ${r.unit}`;return`K\xe9r\xe9 ju: a n\xed l\xe1ti jáº¹Ì ${t}${n.minimum}`}case"invalid_format":if("starts_with"===n.format)return`á»Ìrá»Ì aá¹£\xecá¹£e: gbá»Ìdá»Ì bẹÌráº¹Ì pẹÌl\xfa "${n.prefix}"`;if("ends_with"===n.format)return`á»Ìrá»Ì aá¹£\xecá¹£e: gbá»Ìdá»Ì par\xed pẹÌl\xfa "${n.suffix}"`;if("includes"===n.format)return`á»Ìrá»Ì aá¹£\xecá¹£e: gbá»Ìdá»Ì n\xed "${n.includes}"`;if("regex"===n.format)return`á»Ìrá»Ì aá¹£\xecá¹£e: gbá»Ìdá»Ì b\xe1 \xe0pẹẹrẹ mu ${n.pattern}`;return`Aá¹£\xecá¹£e: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ná»Ìmb\xe0 aá¹£\xecá¹£e: gbá»Ìdá»Ì jáº¹Ì \xe8y\xe0 p\xedp\xedn ti ${n.divisor}`;case"unrecognized_keys":return`Bá»t\xecn\xec \xe0\xecmá»Ì: ${tt(n.keys,", ")}`;case"invalid_key":return`Bá»t\xecn\xec aá¹£\xecá¹£e n\xedn\xfa ${n.origin}`;case"invalid_union":default:return"Ãbáwá»lé aṣìṣe";
39case"invalid_element":return`Iye aá¹£\xecá¹£e n\xedn\xfa ${n.origin}`}})}},"zhCN",0,function(){let e,t,r;return{localeError:(e={string:{unit:"å符",verb:"å
å«"},file:{unit:"åè",verb:"å
å«"},array:{unit:"项",verb:"å
å«"},set:{unit:"项",verb:"å
å«"}},t={regex:"è¾å
¥",email:"çµåé®ä»¶",url:"URL",emoji:"表æ
符å·",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISOæ¥ææ¶é´",date:"ISOæ¥æ",time:"ISOæ¶é´",duration:"ISOæ¶é¿",ipv4:"IPv4å°å",ipv6:"IPv6å°å",cidrv4:"IPv4ç½æ®µ",cidrv6:"IPv6ç½æ®µ",base64:"base64ç¼ç å符串",base64url:"base64urlç¼ç å符串",json_string:"JSONå符串",e164:"E.164å·ç ",jwt:"JWT",template_literal:"è¾å
¥"},r={nan:"NaN",number:"æ°å",array:"æ°ç»",null:"空å¼(null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`æ æè¾å
¥ï¼ææ instanceof ${n.expected}ï¼å®é
æ¥æ¶ ${i}`;return`æ æè¾å
¥ï¼ææ ${e}ï¼å®é
æ¥æ¶ ${i}`}case"invalid_value":if(1===n.values.length)return`æ æè¾å
¥ï¼ææ ${t_(n.values[0])}`;return`æ æéé¡¹ï¼ææä»¥ä¸ä¹ä¸ ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`æ°å¼è¿å¤§ï¼ææ ${n.origin??"å¼"} ${t}${n.maximum.toString()} ${r.unit??"个å
ç´ "}`;return`æ°å¼è¿å¤§ï¼ææ ${n.origin??"å¼"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`æ°å¼è¿å°ï¼ææ ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`æ°å¼è¿å°ï¼ææ ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`æ æå符串ï¼å¿
须以 "${n.prefix}" å¼å¤´`;if("ends_with"===n.format)return`æ æå符串ï¼å¿
须以 "${n.suffix}" ç»å°¾`;if("includes"===n.format)return`æ æå符串ï¼å¿
é¡»å
å« "${n.includes}"`;if("regex"===n.format)return`æ æå符串ï¼å¿
须满足æ£åè¡¨è¾¾å¼ ${n.pattern}`;return`æ æ${t[n.format]??n.format}`;case"not_multiple_of":return`æ ææ°åï¼å¿
é¡»æ¯ ${n.divisor} çåæ°`;case"unrecognized_keys":return`åºç°æªç¥çé®(key): ${tt(n.keys,", ")}`;case"invalid_key":return`${n.origin} ä¸çé®(key)æ æ`;case"invalid_union":default:return"æ æè¾å
¥";case"invalid_element":return`${n.origin} ä¸å
嫿 æå¼(value)`}})}},"zhTW",0,function(){let e,t,r;return{localeError:(e={string:{unit:"åå
",verb:"ææ"},file:{unit:"ä½å
çµ",verb:"ææ"},array:{unit:"é
ç®",verb:"ææ"},set:{unit:"é
ç®",verb:"ææ"}},t={regex:"輸å
¥",email:"éµä»¶å°å",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO æ¥ææé",date:"ISO æ¥æ",time:"ISO æé",duration:"ISO æé",ipv4:"IPv4 ä½å",ipv6:"IPv6 ä½å",cidrv4:"IPv4 ç¯å",cidrv6:"IPv6 ç¯å",base64:"base64 編碼å串",base64url:"base64url 編碼å串",json_string:"JSON å串",e164:"E.164 æ¸å¼",jwt:"JWT",template_literal:"輸å
¥"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=tM(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ç¡æç輸å
¥å¼ï¼é æçº instanceof ${n.expected}ï¼ä½æ¶å° ${i}`;return`ç¡æç輸å
¥å¼ï¼é æçº ${e}ï¼ä½æ¶å° ${i}`}case"invalid_value":if(1===n.values.length)return`ç¡æç輸å
¥å¼ï¼é æçº ${t_(n.values[0])}`;return`ç¡æçé¸é
ï¼é æçºä»¥ä¸å
¶ä¸ä¹ä¸ ${tt(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`æ¸å¼é大ï¼é æ ${n.origin??"å¼"} æçº ${t}${n.maximum.toString()} ${r.unit??"åå
ç´ "}`;return`æ¸å¼é大ï¼é æ ${n.origin??"å¼"} æçº ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`æ¸å¼éå°ï¼é æ ${n.origin} æçº ${t}${n.minimum.toString()} ${r.unit}`;return`æ¸å¼éå°ï¼é æ ${n.origin} æçº ${t}${n.minimum.toString()}`}
39case"invalid_format":if("starts_with"===n.format)return`ç¡æçå串ï¼å¿
é 以 "${n.prefix}" éé `;if("ends_with"===n.format)return`ç¡æçå串ï¼å¿
é 以 "${n.suffix}" çµå°¾`;if("includes"===n.format)return`ç¡æçå串ï¼å¿
é å
å« "${n.includes}"`;if("regex"===n.format)return`ç¡æçå串ï¼å¿
é ç¬¦åæ ¼å¼ ${n.pattern}`;return`ç¡æç ${t[n.format]??n.format}`;case"not_multiple_of":return`ç¡æçæ¸åï¼å¿
é çº ${n.divisor} ç忏`;case"unrecognized_keys":return`ç¡æ³èå¥çéµå¼${n.keys.length>1?"å":""}ï¼${tt(n.keys,"ã")}`;case"invalid_key":return`${n.origin} ä¸æç¡æçéµå¼`;case"invalid_union":default:return"ç¡æç輸å
¥å¼";case"invalid_element":return`${n.origin} ä¸æç¡æçå¼`}})}}],554580);var cL=e.i(554580);e.i(525527),e.i(698530),e.i(650215),e.i(34966),e.s([],818249);var cF=e.i(818249);e.s(["$ZodAny",0,n1,"$ZodArray",0,n9,"$ZodAsyncError",0,e3,"$ZodBase64",0,nF,"$ZodBase64URL",0,nB,"$ZodBigInt",0,nG,"$ZodBigIntFormat",0,nX,"$ZodBoolean",0,nJ,"$ZodCIDRv4",0,nP,"$ZodCIDRv6",0,nz,"$ZodCUID",0,nE,"$ZodCUID2",0,nC,"$ZodCatch",0,iM,"$ZodCheck",0,r0,"$ZodCheckBigIntFormat",0,r3,"$ZodCheckEndsWith",0,nu,"$ZodCheckGreaterThan",0,r4,"$ZodCheckIncludes",0,ns,"$ZodCheckLengthEquals",0,nr,"$ZodCheckLessThan",0,r2,"$ZodCheckLowerCase",0,na,"$ZodCheckMaxLength",0,ne,"$ZodCheckMaxSize",0,r9,"$ZodCheckMimeType",0,np,"$ZodCheckMinLength",0,nt,"$ZodCheckMinSize",0,r8,"$ZodCheckMultipleOf",0,r5,"$ZodCheckNumberFormat",0,r6,"$ZodCheckOverwrite",0,nh,"$ZodCheckProperty",0,nd,"$ZodCheckRegex",0,ni,"$ZodCheckSizeEquals",0,r7,"$ZodCheckStartsWith",0,nl,"$ZodCheckStringFormat",0,nn,"$ZodCheckUpperCase",0,no,"$ZodCodec",0,iP,"$ZodCustom",0,iH,"$ZodCustomStringFormat",0,nH,"$ZodDate",0,n6,"$ZodDefault",0,i$,"$ZodDiscriminatedUnion",0,il,"$ZodE164",0,nZ,"$ZodEmail",0,nk,"$ZodEmoji",0,n_,"$ZodEncodeError",0,e9,"$ZodEnum",0,ib,"$ZodError",0,tz,"$ZodExactOptional",0,iE,"$ZodFile",0,ik,"$ZodFunction",0,iZ,"$ZodGUID",0,nb,"$ZodIPv4",0,nO,"$ZodIPv6",0,nD,"$ZodISODate",0,nA,"$ZodISODateTime",0,nN,"$ZodISODuration",0,nM,"$ZodISOTime",0,nj,"$ZodIntersection",0,iu,"$ZodJWT",0,nV,"$ZodKSUID",0,nI,"$ZodLazy",0,iV,"$ZodLiteral",0,ix,"$ZodMAC",0,nR,"$ZodMap",0,im,"$ZodNaN",0,iO,"$ZodNanoID",0,nS,"$ZodNever",0,n4,"$ZodNonOptional",0,iN,"$ZodNull",0,n0,"$ZodNullable",0,iC,"$ZodNumber",0,nK,"$ZodNumberFormat",0,nW,"$ZodObject",0,it,"$ZodObjectJIT",0,ir,"$ZodOptional",0,iS,"$ZodPipe",0,iD,"$ZodPrefault",0,iI,"$ZodPromise",0,iq,"$ZodReadonly",0,iF,"$ZodRealError",0,tL,"$ZodRecord",0,ih,"$ZodRegistry",0,i6,"$ZodSet",0,iy,"$ZodString",0,ny,"$ZodStringFormat",0,nv,"$ZodSuccess",0,ij,"$ZodSymbol",0,nY,"$ZodTemplateLiteral",0,iB,"$ZodTransform",0,iw,"$ZodTuple",0,id,"$ZodType",0,ng,"$ZodULID",0,n$,"$ZodURL",0,nw,"$ZodUUID",0,nx,"$ZodUndefined",0,nQ,"$ZodUnion",0,ia,"$ZodUnknown",0,n2,"$ZodVoid",0,n5,"$ZodXID",0,nT,"$ZodXor",0,is,"$brand",0,e6,"$constructor",0,e5,"$input",0,i5,"$output",0,i4,"Doc",0,nf,"JSONSchema",0,cF,"JSONSchemaGenerator",0,class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),this.ctx=oG({processors:sj,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return oX(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),oY(this.ctx,e);let{"~standard":r,...n}=oQ(this.ctx,e);return n}},"NEVER",0,e4,"TimePrecision",0,a_,"_any",0,aq,"_array",0,oy,"_base64",0,ab,"_base64url",0,ax,"_bigint",0,aP,"_boolean",0,aD,"_catch",0,oR,"_check",0,oV,"_cidrv4",0,ay,"_cidrv6",0,av,"_coercedBigint",0,az,"_coercedBoolean",0,aR,"_coercedDate",0,aJ,"_coercedNumber",0,aI,"_coercedString",0,i7,"_cuid",0,au,"_cuid2",0,ac,"_
39custom",0,oB,"_date",0,aW,"_decode",0,t1,"_decodeAsync",0,t6,"_default",0,oM,"_discriminatedUnion",0,ox,"_e164",0,ak,"_email",0,ae,"_emoji",0,as,"_encode",0,tQ,"_encodeAsync",0,t4,"_endsWith",0,ol,"_enum",0,oC,"_file",0,oI,"_float32",0,aA,"_float64",0,aj,"_gt",0,aQ,"_gte",0,a0,"_guid",0,at,"_includes",0,oa,"_int",0,aN,"_int32",0,aM,"_int64",0,aL,"_intersection",0,ok,"_ipv4",0,af,"_ipv6",0,am,"_isoDate",0,aE,"_isoDateTime",0,aS,"_isoDuration",0,a$,"_isoTime",0,aC,"_jwt",0,aw,"_ksuid",0,ah,"_lazy",0,oF,"_length",0,ot,"_literal",0,oT,"_lowercase",0,on,"_lt",0,aX,"_lte",0,aY,"_mac",0,ag,"_map",0,oS,"_max",0,aY,"_maxLength",0,a7,"_maxSize",0,a3,"_mime",0,oc,"_min",0,a0,"_minLength",0,oe,"_minSize",0,a9,"_multipleOf",0,a6,"_nan",0,aG,"_nanoid",0,al,"_nativeEnum",0,o$,"_negative",0,a2,"_never",0,aH,"_nonnegative",0,a5,"_nonoptional",0,oO,"_nonpositive",0,a4,"_normalize",0,op,"_null",0,aZ,"_nullable",0,oj,"_number",0,aT,"_optional",0,oA,"_overwrite",0,od,"_parse",0,tV,"_parseAsync",0,tK,"_pipe",0,oP,"_positive",0,a1,"_promise",0,oU,"_property",0,ou,"_readonly",0,oz,"_record",0,o_,"_refine",0,oZ,"_regex",0,or,"_safeDecode",0,t7,"_safeDecodeAsync",0,rn,"_safeEncode",0,t9,"_safeEncodeAsync",0,rt,"_safeParse",0,tJ,"_safeParseAsync",0,tX,"_set",0,oE,"_size",0,a8,"_slugify",0,og,"_startsWith",0,oo,"_string",0,i8,"_stringFormat",0,oJ,"_stringbool",0,oW,"_success",0,oD,"_superRefine",0,oq,"_symbol",0,aU,"_templateLiteral",0,oL,"_toLowerCase",0,of,"_toUpperCase",0,om,"_transform",0,oN,"_trim",0,oh,"_tuple",0,ow,"_uint32",0,aO,"_uint64",0,aF,"_ulid",0,ad,"_undefined",0,aB,"_union",0,ov,"_unknown",0,aV,"_uppercase",0,oi,"_url",0,ao,"_uuid",0,ar,"_uuidv4",0,an,"_uuidv6",0,ai,"_uuidv7",0,aa,"_void",0,aK,"_xid",0,ap,"_xor",0,ob,"clone",0,tk,"config",0,e7,"createStandardJSONSchemaMethod",0,o1,"createToJSONSchemaMethod",0,o0,"decode",0,t2,"decodeAsync",0,t3,"describe",0,oH,"encode",0,t0,"encodeAsync",0,t5,"extractDefs",0,oY,"finalize",0,oQ,"flattenError",0,tF,"formatError",0,tU,"globalConfig",0,e8,"globalRegistry",0,i9,"initializeContext",0,oG,"isValidBase64",0,nL,"isValidBase64URL",0,nU,"isValidJWT",0,nq,"locales",0,cL,"meta",0,oK,"parse",0,tH,"parseAsync",0,tW,"prettifyError",0,tq,"process",0,oX,"regexes",0,cz,"registry",0,i3,"safeDecode",0,re,"safeDecodeAsync",0,ri,"safeEncode",0,t8,"safeEncodeAsync",0,rr,"safeParse",0,tG,"safeParseAsync",0,tY,"toDotPath",0,tZ,"toJSONSchema",0,sM,"treeifyError",0,tB,"util",0,cP,"version",0,nm],712717);var cU=e.i(712717);e.i(789282),e.i(100364),e.i(306034),e.s(["$brand",0,e6,"ZodFirstPartyTypeKind",0,$,"ZodIssueCode",0,cN,"config",0,e7,"getErrorMap",0,cj,"setErrorMap",0,cA],458829),e.i(458829);var sO=sO,sD=sD,cB=e.i(313657);e.s(["$brand",0,e6,"$input",0,i5,"$output",0,i4,"NEVER",0,e4,"TimePrecision",0,a_,"ZodAny",0,uo,"ZodArray",0,ug,"ZodBase64",0,lR,"ZodBase64URL",0,lz,"ZodBigInt",0,l6,"ZodBigIntFormat",0,l9,"ZodBoolean",0,l4,"ZodCIDRv4",0,lj,"ZodCIDRv6",0,lO,"ZodCUID",0,lg,"ZodCUID2",0,lv,"ZodCatch",0,ct,"ZodCodec",0,cs,"ZodCustom",0,cb,"ZodCustomStringFormat",0,lq,"ZodDate",0,uf,"ZodDefault",0,u4,"ZodDiscriminatedUnion",0,u$,"ZodE164",0,lF,"ZodEmail",0,le,"ZodEmoji",0,lp,"ZodEnum",0,uU,"ZodError",0,sV,"ZodExactOptional",0,uY,"ZodFile",0,uH,"ZodFirstPartyTypeKind",0,$,"ZodFunction",0,cy,"ZodGUID",0,lr,"ZodIPv4",0,lC,"ZodIPv6",0,lN,"ZodISODate",0,sz,"ZodISODateTime",0,sR,"ZodISODuration",0,sB,"ZodISOTime",0,sF,"ZodIntersection",0,uI,"ZodIssueCode",0,cN,"ZodJWT",0,lB,"ZodKSUID",0,lS,"ZodLazy",0,ch,"ZodLiteral",0,uq,"ZodMAC",0,lT,"ZodMap",0,uP,"ZodNaN",0,cn,"ZodNanoID",0,lf,"ZodNever",0,uc,"ZodNonOptional",0,u9,"ZodNull",0,ui,"ZodNullable",0,u0,"ZodNumber",0,lJ,"ZodNumberFormat",0,lX,"ZodObject",0,ub,"ZodOptional",0,uG,"ZodPipe",0,ca,"ZodPrefault",0,u6,"ZodPromise",0,cm,"ZodReadonly",0,cu,"ZodRealError",0,sH,"ZodRecord",0,uM,"ZodSet",0,uL,"ZodString",0,s9,"ZodStringFormat",0,s7,"ZodSuccess",0,u7,"ZodSymbol",0,ue,"ZodTemplateLiteral",0,cd,"ZodTransform",0,uW,"ZodTuple",0,uA,"ZodType",0,s6,"ZodULID",0,lx,"ZodURL",0,lu,"ZodUUID",0,li,"ZodUndefined",0,ur,"ZodUnion",0,u_,"ZodUnknown",0,ul,"ZodVoid",0,up,"ZodXID",0,lw,"ZodXor",0,uE,"_ZodString",0,s3,"_default",0,u5,"_function",0,cv,"any",0,us,"array",0,uy,"base64",0,lP,"base64url",0,lL,"bigint",0,l3,"boolean",0,l5,"catch",0,cr,"check",0,cx,"cidrv4",0,lM,"cidrv6",0,lD,"clone",0,tk,"codec",0,cl,"coerce",0,cB,"config",0,e7,"core",0,cU,"cuid",0,ly,"cuid2",0,lb,"custom",0,ck,"date",0,um,"decode",0,sY,"decodeAsync",0,s0,"describe",0,cS,"discriminatedUnion",0,uT,"e164",0,lU,"email",0,lt,"emoji",0,lh,"encode",0,sX,"encodeAsync",0,sQ,"endsWith",0,ol,"enum",0,uB,"exactOptional",0,uQ,"file",0,uK,"flattenError",0,tF,"float32",0,lQ,"float64",0,l0,"formatError",0,tU,"fromJSONSchema",0,function(e,t){var r;let n;if("boolean"==typeof e)return e?cD.any():cD.never();let i={version:(r=t?.defaultTarget,"https://json-schema.org/draft/2020-12/schema"===(n=e.$schema)?"draft-2
39020-12":"http://json-schema.org/draft-07/schema#"===n?"draft-7":"http://json-schema.org/draft-04/schema#"===n?"draft-4":r??"draft-2020-12"),defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??i9};return function e(t,r){if("boolean"==typeof t)return t?cD.any():cD.never();let n=function t(r,n){let i;if(void 0!==r.not){if("object"==typeof r.not&&0===Object.keys(r.not).length)return cD.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(n.refs.has(t))return n.refs.get(t);if(n.processing.has(t))return cD.lazy(()=>{if(!n.refs.has(t))throw Error(`Circular reference not resolved: ${t}`);return n.refs.get(t)});n.processing.add(t);let i=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 n="draft-2020-12"===t.version?"$defs":"definitions";if(r[0]===n){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}(t,n),n);return n.refs.set(t,i),n.processing.delete(t),i}if(void 0!==r.enum){let e=r.enum;if("openapi-3.0"===n.version&&!0===r.nullable&&1===e.length&&null===e[0])return cD.null();if(0===e.length)return cD.never();if(1===e.length)return cD.literal(e[0]);if(e.every(e=>"string"==typeof e))return cD.enum(e);let t=e.map(e=>cD.literal(e));return t.length<2?t[0]:cD.union([t[0],t[1],...t.slice(2)])}if(void 0!==r.const)return cD.literal(r.const);let a=r.type;if(Array.isArray(a)){let e=a.map(e=>t({...r,type:e},n));return 0===e.length?cD.never():1===e.length?e[0]:cD.union(e)}if(!a)return cD.any();switch(a){case"string":{let e=cD.string();if(r.format){let t=r.format;"email"===t?e=e.check(cD.email()):"uri"===t||"uri-reference"===t?e=e.check(cD.url()):"uuid"===t||"guid"===t?e=e.check(cD.uuid()):"date-time"===t?e=e.check(cD.iso.datetime()):"date"===t?e=e.check(cD.iso.date()):"time"===t?e=e.check(cD.iso.time()):"duration"===t?e=e.check(cD.iso.duration()):"ipv4"===t?e=e.check(cD.ipv4()):"ipv6"===t?e=e.check(cD.ipv6()):"mac"===t?e=e.check(cD.mac()):"cidr"===t?e=e.check(cD.cidrv4()):"cidr-v6"===t?e=e.check(cD.cidrv6()):"base64"===t?e=e.check(cD.base64()):"base64url"===t?e=e.check(cD.base64url()):"e164"===t?e=e.check(cD.e164()):"jwt"===t?e=e.check(cD.jwt()):"emoji"===t?e=e.check(cD.emoji()):"nanoid"===t?e=e.check(cD.nanoid()):"cuid"===t?e=e.check(cD.cuid()):"cuid2"===t?e=e.check(cD.cuid2()):"ulid"===t?e=e.check(cD.ulid()):"xid"===t?e=e.check(cD.xid()):"ksuid"===t&&(e=e.check(cD.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))),i=e;break}case"number":case"integer":{let e="integer"===a?cD.number().int():cD.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)),i=e;break}case"boolean":i=cD.boolean();break;case"null":i=cD.null();break;case"object":{let t={},a=r.properties||{},o=new Set(r.required||[]);for(let[r,i]of Object.entries(a)){let a=e(i,n);t[r]=o.has(r)?a:a.optional()}if(r.propertyNames){let a=e(r.propertyNames,n),o=r.additionalProperties&&"object"==typeof r.additionalProperties?e(r.additionalProperties,n):cD.any();if(0===Object.keys(t).length){i=cD.record(a,o);break}let s=cD.object(t).passthrough(),l=cD.looseRecord(a,o);i=cD.intersection(s,l);break}if(r.patternProperties){let a=r.patternProperties,o=Object.keys(a),s=[];for(let t of o){let r=e(a[t],n),i=cD.string().regex(new RegExp(t));s.push(cD.looseRecord(i,r))}let l=[];
39if(Object.keys(t).length>0&&l.push(cD.object(t).passthrough()),l.push(...s),0===l.length)i=cD.object({}).passthrough();else if(1===l.length)i=l[0];else{let e=cD.intersection(l[0],l[1]);for(let t=2;t<l.length;t++)e=cD.intersection(e,l[t]);i=e}break}let s=cD.object(t);i=!1===r.additionalProperties?s.strict():"object"==typeof r.additionalProperties?s.catchall(e(r.additionalProperties,n)):s.passthrough();break}case"array":{let t=r.prefixItems,a=r.items;if(t&&Array.isArray(t)){let o=t.map(t=>e(t,n)),s=a&&"object"==typeof a&&!Array.isArray(a)?e(a,n):void 0;i=s?cD.tuple(o).rest(s):cD.tuple(o),"number"==typeof r.minItems&&(i=i.check(cD.minLength(r.minItems))),"number"==typeof r.maxItems&&(i=i.check(cD.maxLength(r.maxItems)))}else if(Array.isArray(a)){let t=a.map(t=>e(t,n)),o=r.additionalItems&&"object"==typeof r.additionalItems?e(r.additionalItems,n):void 0;i=o?cD.tuple(t).rest(o):cD.tuple(t),"number"==typeof r.minItems&&(i=i.check(cD.minLength(r.minItems))),"number"==typeof r.maxItems&&(i=i.check(cD.maxLength(r.maxItems)))}else if(void 0!==a){let t=e(a,n),o=cD.array(t);"number"==typeof r.minItems&&(o=o.min(r.minItems)),"number"==typeof r.maxItems&&(o=o.max(r.maxItems)),i=o}else i=cD.array(cD.any());break}default:throw Error(`Unsupported type: ${a}`)}return r.description&&(i=i.describe(r.description)),void 0!==r.default&&(i=i.default(r.default)),i}(t,r),i=t.type||void 0!==t.enum||void 0!==t.const;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(t=>e(t,r)),o=cD.union(a);n=i?cD.intersection(n,o):o}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(t=>e(t,r)),o=cD.xor(a);n=i?cD.intersection(n,o):o}if(t.allOf&&Array.isArray(t.allOf))if(0===t.allOf.length)n=i?n:cD.any();else{let a=i?n:e(t.allOf[0],r),o=+!i;for(let n=o;n<t.allOf.length;n++)a=cD.intersection(a,e(t.allOf[n],r));n=a}!0===t.nullable&&"openapi-3.0"===r.version&&(n=cD.nullable(n)),!0===t.readOnly&&(n=cD.readonly(n));let a={};for(let e of["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"])e in t&&(a[e]=t[e]);for(let e of["contentEncoding","contentMediaType","contentSchema"])e in t&&(a[e]=t[e]);for(let e of Object.keys(t))cR.has(e)||(a[e]=t[e]);return Object.keys(a).length>0&&r.registry.add(n,a),n}(e,i)},"function",0,cv,"getErrorMap",0,cj,"globalRegistry",0,i9,"gt",0,aQ,"gte",0,a0,"guid",0,ln,"hash",0,lW,"hex",0,lK,"hostname",0,lH,"httpUrl",0,ld,"includes",0,oa,"instanceof",0,cC,"int",0,lY,"int32",0,l1,"int64",0,l8,"intersection",0,uN,"ipv4",0,l$,"ipv6",0,lA,"iso",0,cO,"json",0,cT,"jwt",0,lZ,"keyof",0,uv,"ksuid",0,lE,"lazy",0,cf,"length",0,ot,"literal",0,uV,"locales",0,cL,"looseObject",0,uw,"looseRecord",0,uR,"lowercase",0,on,"lt",0,aX,"lte",0,aY,"mac",0,lI,"map",0,uz,"maxLength",0,a7,"maxSize",0,a3,"meta",0,cE,"mime",0,oc,"minLength",0,oe,"minSize",0,a9,"multipleOf",0,a6,"nan",0,ci,"nanoid",0,lm,"nativeEnum",0,uZ,"negative",0,a2,"never",0,ud,"nonnegative",0,a5,"nonoptional",0,u8,"nonpositive",0,a4,"normalize",0,op,"null",0,ua,"nullable",0,u1,"nullish",0,u2,"number",0,lG,"object",0,ux,"optional",0,uX,"overwrite",0,od,"parse",0,sK,"parseAsync",0,sW,"partialRecord",0,uD,"pipe",0,co,"positive",0,a1,"prefault",0,u3,"preprocess",0,cI,"prettifyError",0,tq,"promise",0,cg,"property",0,ou,"readonly",0,cc,"record",0,uO,"refine",0,cw,"regex",0,or,"regexes",()=>sO,"registry",0,i3,"safeDecode",0,s2,"safeDecodeAsync",0,s5,"safeEncode",0,s1,"safeEncodeAsync",0,s4,"safeParse",0,sJ,"safeParseAsync",0,sG,"set",0,uF,"setErrorMap",0,cA,"size",0,a8,"slugify",0,og,"startsWith",0,oo,"strictObject",0,uk,"string",0,s8,"stringFormat",0,lV,"stringbool",0,c$,"success",0,ce,"superRefine",0,c_,"symbol",0,ut,"templateLiteral",0,cp,"toJSONSchema",0,sM,"toLowerCase",0,of,"toUpperCase",0,om,"transform",0,uJ,"treeifyError",0,tB,"trim",0,oh,"tuple",0,uj,"uint32",0,l2,"uint64",0,l7,"ulid",0,lk,"undefined",0,un,"union",0,uS,"unknown",0,uu,"uppercase",0,oi,"url",0,lc,"util",()=>sD,"uuid",0,la,"uuidv4",0,lo,"uuidv6",0,ls,"uuidv7",0,ll,"void",0,uh,"xid",0,l_,"xor",0,uC],722219);var cZ=e.i(722219);(r=T||(T={})).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]]),n={};for(let r of t)n[r]=e[r];return r.objectValues(n)},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,(I||(I={})).mergeShapes=(e,t)=>({...e,...t});let cq=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),cV=e=>{switch(typeof e){case"undefined":return cq.undefined;case"string":return cq.string;case"number":return Number.isNaN(e)?cq.nan:cq.number;case"boolean":return cq.boolean;case"function":return cq.function;case"bigint":return cq.bigint;case"symbol":return cq.symbol;case"object":if(Array.isArray(e))return cq.array;if(null===e)return cq.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return cq.promise;if("u">typeof Map&&e instanceof Map)return cq.map;if("u">typeof Set&&e instanceof Set)return cq.set;if("u">typeof Date&&e instanceof Date)return cq.date;return cq.object;default:return cq.unknown}};e.s(["ZodParsedType",0,cq,"getParsedType",0,cV,"objectUtil",0,I,"util",0,T],904783);
39let cH=T.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"]),cK=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class cW 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:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof cW))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}cW.create=e=>new cW(e),e.s(["ZodError",0,cW,"ZodIssueCode",0,cH,"quotelessJson",0,cK],169790);let cJ=(e,t)=>{let r;switch(e.code){case cH.invalid_type:r=e.received===cq.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case cH.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,T.jsonStringifyReplacer)}`;break;case cH.unrecognized_keys:r=`Unrecognized key(s) in object: ${T.joinValues(e.keys,", ")}`;break;case cH.invalid_union:r="Invalid input";break;case cH.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${T.joinValues(e.options)}`;break;case cH.invalid_enum_value:r=`Invalid enum value. Expected ${T.joinValues(e.options)}, received '${e.received}'`;break;case cH.invalid_arguments:r="Invalid function arguments";break;case cH.invalid_return_type:r="Invalid function return type";break;case cH.invalid_date:r="Invalid date";break;case cH.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}"`:T.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case cH.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 cH.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 cH.custom:r="Invalid input";break;case cH.invalid_intersection_types:r="Intersection results could not be merged";break;case cH.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case cH.not_finite:r="Number must be finite";break;default:r=t.defaultError,T.assertNever(e)}return{message:r}},cG=cJ;function cX(e){cG=e}function cY(){return cG}e.s(["getErrorMap",0,cY,"setErrorMap",0,cX],937904);let cQ=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],o={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let s="";for(let e of n.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},c0=[];function c1(e,t){let r=cY(),n=cQ({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===cJ?void 0:cJ].filter(e=>!!e)});e.common.issues.push(n)}class c2{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 n of t){if("aborted"===n.status)return c4;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return c2.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return c4;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let c4=Object.freeze({status:"aborted"}),c5=e=>({status:"dirty",value:e}),c6=e=>
39({status:"valid",value:e}),c3=e=>"aborted"===e.status,c9=e=>"dirty"===e.status,c8=e=>"valid"===e.status,c7=e=>"u">typeof Promise&&e instanceof Promise;e.s(["DIRTY",0,c5,"EMPTY_PATH",0,c0,"INVALID",0,c4,"OK",0,c6,"ParseStatus",0,c2,"addIssueToContext",0,c1,"isAborted",0,c3,"isAsync",0,c7,"isDirty",0,c9,"isValid",0,c8,"makeIssue",0,cQ],665354),(n=N||(N={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},n.toString=e=>"string"==typeof e?e:e?.message;class de{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 dt=(e,t)=>{if(c8(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 cW(e.common.issues);return this._error=t,this._error}}};function dr(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??n??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??r??i.defaultError}},description:i}}class dn{get description(){return this._def.description}_getType(e){return cV(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:cV(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new c2,ctx:{common:e.parent.common,data:e.data,parsedType:cV(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(c7(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:cV(e)},n=this._parseSync({data:e,path:r.path,parent:r});return dt(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cV(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return c8(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=>c8(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:cV(e)},n=this._parse({data:e,path:r.path,parent:r});return dt(r,await (c7(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),a=()=>n.addIssue({code:cH.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new dY({schema:this,typeName:A.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 dQ.create(this,this._def)}nullable(){return d0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dD.create(this)}promise(){return dX.create(this,this._def)}or(e){return dP.create([this,e],this._def)}and(e){return dF.create(this,e,this._def)}transform(e){return new dY({...dr(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new d1({...dr(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:A.ZodDefault})}brand(){return new d6({typeName:A.ZodBranded,type:this,...dr(this._def)})}catch(e){return new d2({...dr(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:A.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return d3.create(this,e)}readonly(){return d9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let di=/^c[^\s-]{8,}
39$/i,da=/^[0-9a-z]+$/,ds=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dl=/^[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,du=/^[a-z0-9_-]{21}$/i,dc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dd=/^[-+]?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)?)??$/,dp=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dh=/^(?:(?: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])$/,df=/^(?:(?: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])$/,dm=/^(([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]))$/,dg=/^(([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])$/,dy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,db="((\\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])))",dx=RegExp(`^${db}$`);function dk(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 dw(e){let t=`${db}T${dk(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class d_ extends dn{_parse(e){var r,n,i,a;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==cq.string){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.string,received:t.parsedType}),c4}let s=new c2;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(c1(o=this._getOrReturnCtx(e,o),{code:cH.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)e.data.length>l.value&&(c1(o=this._getOrReturnCtx(e,o),{code:cH.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let t=e.data.length>l.value,r=e.data.length<l.value;(t||r)&&(o=this._getOrReturnCtx(e,o),t?c1(o,{code:cH.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&c1(o,{code:cH.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)dp.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"email",code:cH.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)t||(t=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),t.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:cH.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)dl.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:cH.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)du.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"nanoid",code:cH.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)di.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:cH.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)da.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:cH.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)ds.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:cH.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{c1(o=this._getOrReturnCtx(e,o),{validation:"url",code:cH.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"regex",code:cH.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(c1(o=this._getOrReturnCtx(e,o),{code:cH.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.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)||(c1(o=this._getOrReturnCtx(e,o),{code:cH.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(c1(o=this._getOrReturnCtx(e,o),{code:cH.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?dw(l).test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{code:cH.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?dx.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{code:cH.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${dk(l)}$`).test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{code:cH.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?dd.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"duration",code:cH.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=e.data,!(("v4"===(n=l.version)||!n)&&dh.test(r)||("v6"===n||!n)&&dm.test(r))&&1&&(c1(o=this._getOrReturnCtx(e,o),{validation:"ip",code:cH.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(e,t){if(!dc.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(c1(o=this._getOrReturnCtx(e,o),{validation:"jwt",code:cH.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(i=e.data,!(("v4"===(a=l.version)||!a)&&df.test(i)||("v6"===a||
39!a)&&dg.test(i))&&1&&(c1(o=this._getOrReturnCtx(e,o),{validation:"cidr",code:cH.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?dy.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"base64",code:cH.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?dv.test(e.data)||(c1(o=this._getOrReturnCtx(e,o),{validation:"base64url",code:cH.invalid_string,message:l.message}),s.dirty()):T.assertNever(l);return{status:s.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:cH.invalid_string,...N.errToObj(r)})}_addCheck(e){return new d_({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.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,...N.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,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new d_({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new d_({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new d_({...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}}d_.create=e=>new d_({checks:[],typeName:A.ZodString,coerce:e?.coerce??!1,...dr(e)});class dS extends dn{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)!==cq.number){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.number,received:t.parsedType}),c4}let r=new c2;for(let n of this._def.checks)"int"===n.kind?T.isInteger(e.data)||(c1(t=this._getOrReturnCtx(e,t),{code:cH.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,n.value)&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(c1(t=this._getOrReturnCtx(e,t),{code:cH.not_finite,message:n.message}),r.dirty()):T.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,n){return new dS({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(n)}]})}_addCheck(e){return new dS({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.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&&T.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)}}dS.create=e=>new dS({checks:[],typeName:A.ZodNumber,coerce:e?.coerce||!1,...dr(e)});class dE extends dn{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)!==cq.bigint)return this._getInvalidInput(e);let r=new c2;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):T.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.bigint,received:t.parsedType}),c4}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,n){return new dE({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(n)}]})}_addCheck(e){return new dE({...this._def,checks:[...this._def.checks,e]})}
39positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.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}}dE.create=e=>new dE({checks:[],typeName:A.ZodBigInt,coerce:e?.coerce??!1,...dr(e)});class dC extends dn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==cq.boolean){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.boolean,received:t.parsedType}),c4}return c6(e.data)}}dC.create=e=>new dC({typeName:A.ZodBoolean,coerce:e?.coerce||!1,...dr(e)});class d$ extends dn{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==cq.date){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.date,received:t.parsedType}),c4}if(Number.isNaN(e.data.getTime()))return c1(this._getOrReturnCtx(e),{code:cH.invalid_date}),c4;let r=new c2;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(c1(t=this._getOrReturnCtx(e,t),{code:cH.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):T.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new d$({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.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}}d$.create=e=>new d$({checks:[],coerce:e?.coerce||!1,typeName:A.ZodDate,...dr(e)});class dT extends dn{_parse(e){if(this._getType(e)!==cq.symbol){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.symbol,received:t.parsedType}),c4}return c6(e.data)}}dT.create=e=>new dT({typeName:A.ZodSymbol,...dr(e)});class dI extends dn{_parse(e){if(this._getType(e)!==cq.undefined){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.undefined,received:t.parsedType}),c4}return c6(e.data)}}dI.create=e=>new dI({typeName:A.ZodUndefined,...dr(e)});class dN extends dn{_parse(e){if(this._getType(e)!==cq.null){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.null,received:t.parsedType}),c4}return c6(e.data)}}dN.create=e=>new dN({typeName:A.ZodNull,...dr(e)});class dA extends dn{constructor(){super(...arguments),this._any=!0}_parse(e){return c6(e.data)}}dA.create=e=>new dA({typeName:A.ZodAny,...dr(e)});class dj extends dn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return c6(e.data)}}dj.create=e=>new dj({typeName:A.ZodUnknown,...dr(e)});class dM extends dn{_parse(e){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.never,received:t.parsedType}),c4}}dM.create=e=>new dM({typeName:A.ZodNever,...dr(e)});class dO extends dn{_parse(e){if(this._getType(e)!==cq.undefined){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.void,received:t.parsedType}),c4}return c6(e.data)}}dO.create=e=>new dO({typeName:A.ZodVoid,...dr(e)});class dD extends dn{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==cq.array)return c1(t,{code:cH.invalid_type,expected:cq.array,received:t.parsedType}),c4;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(c1(t,{code:e?cH.too_big:cH.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(c1(t,{code:cH.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(c1(t,{code:cH.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new de(t,e,t.path,r)))).then(e=>c2.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new de(t,e,t.path,r)));return c2.mergeArray(r,i)}
39get element(){return this._def.type}min(e,t){return new dD({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new dD({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new dD({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}}dD.create=(e,t)=>new dD({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...dr(t)});class dR extends dn{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=T.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==cq.object){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.object,received:t.parsedType}),c4}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof dM&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=n[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new de(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof dM){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(c1(r,{code:cH.unrecognized_keys,keys:a}),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 a){let n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new de(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>c2.mergeObjectSync(t,e)):c2.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new dR({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:N.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new dR({...this._def,unknownKeys:"strip"})}passthrough(){return new dR({...this._def,unknownKeys:"passthrough"})}extend(e){return new dR({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new dR({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new dR({...this._def,catchall:e})}pick(e){let t={};for(let r of T.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new dR({...this._def,shape:()=>t})}omit(e){let t={};for(let r of T.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new dR({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof dR){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=dQ.create(e(i))}return new dR({...t._def,shape:()=>r})}if(t instanceof dD)return new dD({...t._def,type:e(t.element)});if(t instanceof dQ)return dQ.create(e(t.unwrap()));if(t instanceof d0)return d0.create(e(t.unwrap()));if(t instanceof dU)return dU.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of T.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new dR({...this._def,shape:()=>t})}required(e){let t={};for(let r of T.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof dQ;)e=e._def.innerType;t[r]=e}return new dR({...this._def,shape:()=>t})}keyof(){return dW(T.objectKeys(this.shape))}}dR.create=(e,t)=>new dR({shape:()=>e,unknownKeys:"strip",catchall:dM.create(),typeName:A.ZodObject,...dr(t)}),dR.strictCreate=(e,t)=>new dR({shape:()=>e,unknownKeys:"strict",catchall:dM.create(),typeName:A.ZodObject,...dr(t)}),dR.lazycreate=(e,t)=>new dR({shape:e,unknownKeys:"strip",catchall:dM.create(),typeName:A.ZodObject,...dr(t)});class dP extends dn{_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 cW(e.ctx.common.issues));return c1(t,{code:cH.invalid_union,unionErrors:r}),c4});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new cW(e));return c1(t,{code:cH.invalid_union,unionErrors:i}),c4}}get options(){return this._def.options}}dP.create=(e,t)=>
39new dP({options:e,typeName:A.ZodUnion,...dr(t)});let dz=e=>{if(e instanceof dH)return dz(e.schema);if(e instanceof dY)return dz(e.innerType());if(e instanceof dK)return[e.value];if(e instanceof dJ)return e.options;if(e instanceof dG)return T.objectValues(e.enum);else if(e instanceof d1)return dz(e._def.innerType);else if(e instanceof dI)return[void 0];else if(e instanceof dN)return[null];else if(e instanceof dQ)return[void 0,...dz(e.unwrap())];else if(e instanceof d0)return[null,...dz(e.unwrap())];else if(e instanceof d6)return dz(e.unwrap());else if(e instanceof d9)return dz(e.unwrap());else if(e instanceof d2)return dz(e._def.innerType);else return[]};class dL extends dn{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==cq.object)return c1(t,{code:cH.invalid_type,expected:cq.object,received:t.parsedType}),c4;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(c1(t,{code:cH.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),c4)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=dz(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new dL({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...dr(r)})}}class dF extends dn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(c3(e)||c3(n))return c4;let i=function e(t,r){let n=cV(t),i=cV(r);if(t===r)return{valid:!0,data:t};if(n===cq.object&&i===cq.object){let n=T.objectKeys(r),i=T.objectKeys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===cq.array&&i===cq.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}if(n===cq.date&&i===cq.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?((c9(e)||c9(n))&&t.dirty(),{status:t.value,value:i.data}):(c1(r,{code:cH.invalid_intersection_types}),c4)};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])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dF.create=(e,t,r)=>new dF({left:e,right:t,typeName:A.ZodIntersection,...dr(r)});class dU extends dn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==cq.array)return c1(r,{code:cH.invalid_type,expected:cq.array,received:r.parsedType}),c4;if(r.data.length<this._def.items.length)return c1(r,{code:cH.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c4;!this._def.rest&&r.data.length>this._def.items.length&&(c1(r,{code:cH.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new de(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>c2.mergeArray(t,e)):c2.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new dU({...this._def,rest:e})}}dU.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new dU({items:e,typeName:A.ZodTuple,rest:null,...dr(t)})};class dB extends dn{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!==cq.object)return c1(r,{code:cH.invalid_type,expected:cq.object,received:r.parsedType}),c4;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new de(r,e,r.path,e)),value:a._parse(new de(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?c2.mergeObjectAsync(t,n):c2.mergeObjectSync(t,n)}
39get element(){return this._def.valueType}static create(e,t,r){return new dB(t instanceof dn?{keyType:e,valueType:t,typeName:A.ZodRecord,...dr(r)}:{keyType:d_.create(),valueType:e,typeName:A.ZodRecord,...dr(t)})}}class dZ extends dn{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!==cq.map)return c1(r,{code:cH.invalid_type,expected:cq.map,received:r.parsedType}),c4;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new de(r,e,r.path,[a,"key"])),value:i._parse(new de(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return c4;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return c4;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}dZ.create=(e,t,r)=>new dZ({valueType:t,keyType:e,typeName:A.ZodMap,...dr(r)});class dq extends dn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==cq.set)return c1(r,{code:cH.invalid_type,expected:cq.set,received:r.parsedType}),c4;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(c1(r,{code:cH.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(c1(r,{code:cH.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return c4;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new de(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(e,t){return new dq({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new dq({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}dq.create=(e,t)=>new dq({valueType:e,minSize:null,maxSize:null,typeName:A.ZodSet,...dr(t)});class dV extends dn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==cq.function)return c1(t,{code:cH.invalid_type,expected:cq.function,received:t.parsedType}),c4;function r(e,r){return cQ({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,cY(),cJ].filter(e=>!!e),issueData:{code:cH.invalid_arguments,argumentsError:r}})}function n(e,r){return cQ({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,cY(),cJ].filter(e=>!!e),issueData:{code:cH.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof dX){let e=this;return c6(async function(...t){let o=new cW([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),l=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw o.addIssue(n(l,e)),o})})}{let e=this;return c6(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new cW([r(t,o.error)]);let s=Reflect.apply(a,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new cW([n(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new dV({...this._def,args:dU.create(e).rest(dj.create())})}returns(e){return new dV({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new dV({args:e||dU.create([]).rest(dj.create()),returns:t||dj.create(),typeName:A.ZodFunction,...dr(r)})}}class dH extends dn{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})}}dH.create=(e,t)=>
39new dH({getter:e,typeName:A.ZodLazy,...dr(t)});class dK extends dn{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return c1(t,{received:t.data,code:cH.invalid_literal,expected:this._def.value}),c4}return{status:"valid",value:e.data}}get value(){return this._def.value}}function dW(e,t){return new dJ({values:e,typeName:A.ZodEnum,...dr(t)})}dK.create=(e,t)=>new dK({value:e,typeName:A.ZodLiteral,...dr(t)});class dJ extends dn{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return c1(t,{expected:T.joinValues(r),received:t.parsedType,code:cH.invalid_type}),c4}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 c1(t,{received:t.data,code:cH.invalid_enum_value,options:r}),c4}return c6(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 dJ.create(e,{...this._def,...t})}exclude(e,t=this._def){return dJ.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}dJ.create=dW;class dG extends dn{_parse(e){let t=T.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==cq.string&&r.parsedType!==cq.number){let e=T.objectValues(t);return c1(r,{expected:T.joinValues(e),received:r.parsedType,code:cH.invalid_type}),c4}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=T.objectValues(t);return c1(r,{received:r.data,code:cH.invalid_enum_value,options:e}),c4}return c6(e.data)}get enum(){return this._def.values}}dG.create=(e,t)=>new dG({values:e,typeName:A.ZodNativeEnum,...dr(t)});class dX extends dn{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==cq.promise&&!1===t.common.async?(c1(t,{code:cH.invalid_type,expected:cq.promise,received:t.parsedType}),c4):c6((t.parsedType===cq.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}dX.create=(e,t)=>new dX({type:e,typeName:A.ZodPromise,...dr(t)});class dY extends dn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{c1(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return c4;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?c4:"dirty"===n.status||"dirty"===t.value?c5(n.value):n});{if("aborted"===t.value)return c4;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?c4:"dirty"===n.status||"dirty"===t.value?c5(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);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?c4:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?c4:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>c8(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):c4);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!c8(e))return c4;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}T.assertNever(n)}}dY.create=(e,t,r)=>new dY({schema:e,typeName:A.ZodEffects,effect:t,...dr(r)}),dY.createWithPreprocess=(e,t,r)=>new dY({schema:t,effect:{type:"preprocess",transform:e},typeName:A.ZodEffects,...dr(r)});class dQ extends dn{_parse(e){return this._getType(e)===cq.undefined?c6(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}dQ.create=(e,t)=>
39new dQ({innerType:e,typeName:A.ZodOptional,...dr(t)});class d0 extends dn{_parse(e){return this._getType(e)===cq.null?c6(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}d0.create=(e,t)=>new d0({innerType:e,typeName:A.ZodNullable,...dr(t)});class d1 extends dn{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===cq.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}d1.create=(e,t)=>new d1({innerType:e,typeName:A.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...dr(t)});class d2 extends dn{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return c7(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new cW(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new cW(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}d2.create=(e,t)=>new d2({innerType:e,typeName:A.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...dr(t)});class d4 extends dn{_parse(e){if(this._getType(e)!==cq.nan){let t=this._getOrReturnCtx(e);return c1(t,{code:cH.invalid_type,expected:cq.nan,received:t.parsedType}),c4}return{status:"valid",value:e.data}}}d4.create=e=>new d4({typeName:A.ZodNaN,...dr(e)});let d5=Symbol("zod_brand");class d6 extends dn{_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 d3 extends dn{_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?c4:"dirty"===e.status?(t.dirty(),c5(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?c4:"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 d3({in:e,out:t,typeName:A.ZodPipeline})}}class d9 extends dn{_parse(e){let t=this._def.innerType._parse(e),r=e=>(c8(e)&&(e.value=Object.freeze(e.value)),e);return c7(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function d8(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function d7(e,t={},r){return e?dA.create().superRefine((n,i)=>{let a=e(n);if(a instanceof Promise)return a.then(e=>{if(!e){let e=d8(t,n),a=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:a})}});if(!a){let e=d8(t,n),a=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:a})}}):dA.create()}d9.create=(e,t)=>new d9({innerType:e,typeName:A.ZodReadonly,...dr(t)});let pe={object:dR.lazycreate};(i=A||(A={})).ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly";let pt=(e,t={message:`Input not instance of ${e.name}`})=>d7(t=>t instanceof e,t),pr=d_.create,pn=dS.create,pi=d4.create,pa=dE.create,po=dC.create,ps=d$.create,pl=dT.create,pu=dI.create,pc=dN.create,pd=dA.create,pp=dj.create,ph=dM.create,pf=dO.create,pm=dD.create,pg=dR.create,py=dR.strictCreate,pv=
39dP.create,pb=dL.create,px=dF.create,pk=dU.create,pw=dB.create,p_=dZ.create,pS=dq.create,pE=dV.create,pC=dH.create,p$=dK.create,pT=dJ.create,pI=dG.create,pN=dX.create,pA=dY.create,pj=dQ.create,pM=d0.create,pO=dY.createWithPreprocess,pD=d3.create,pR=()=>pr().optional(),pP=()=>pn().optional(),pz=()=>po().optional(),pL={string:e=>d_.create({...e,coerce:!0}),number:e=>dS.create({...e,coerce:!0}),boolean:e=>dC.create({...e,coerce:!0}),bigint:e=>dE.create({...e,coerce:!0}),date:e=>d$.create({...e,coerce:!0})};e.s(["BRAND",0,d5,"NEVER",0,c4,"Schema",0,dn,"ZodAny",0,dA,"ZodArray",0,dD,"ZodBigInt",0,dE,"ZodBoolean",0,dC,"ZodBranded",0,d6,"ZodCatch",0,d2,"ZodDate",0,d$,"ZodDefault",0,d1,"ZodDiscriminatedUnion",0,dL,"ZodEffects",0,dY,"ZodEnum",0,dJ,"ZodFirstPartyTypeKind",0,A,"ZodFunction",0,dV,"ZodIntersection",0,dF,"ZodLazy",0,dH,"ZodLiteral",0,dK,"ZodMap",0,dZ,"ZodNaN",0,d4,"ZodNativeEnum",0,dG,"ZodNever",0,dM,"ZodNull",0,dN,"ZodNullable",0,d0,"ZodNumber",0,dS,"ZodObject",0,dR,"ZodOptional",0,dQ,"ZodPipeline",0,d3,"ZodPromise",0,dX,"ZodReadonly",0,d9,"ZodRecord",0,dB,"ZodSchema",0,dn,"ZodSet",0,dq,"ZodString",0,d_,"ZodSymbol",0,dT,"ZodTransformer",0,dY,"ZodTuple",0,dU,"ZodType",0,dn,"ZodUndefined",0,dI,"ZodUnion",0,dP,"ZodUnknown",0,dj,"ZodVoid",0,dO,"any",0,pd,"array",0,pm,"bigint",0,pa,"boolean",0,po,"coerce",0,pL,"custom",0,d7,"date",0,ps,"datetimeRegex",0,dw,"discriminatedUnion",0,pb,"effect",0,pA,"enum",0,pT,"function",0,pE,"instanceof",0,pt,"intersection",0,px,"late",0,pe,"lazy",0,pC,"literal",0,p$,"map",0,p_,"nan",0,pi,"nativeEnum",0,pI,"never",0,ph,"null",0,pc,"nullable",0,pM,"number",0,pn,"object",0,pg,"oboolean",0,pz,"onumber",0,pP,"optional",0,pj,"ostring",0,pR,"pipeline",0,pD,"preprocess",0,pO,"promise",0,pN,"record",0,pw,"set",0,pS,"strictObject",0,py,"string",0,pr,"symbol",0,pl,"transformer",0,pA,"tuple",0,pk,"undefined",0,pu,"union",0,pv,"unknown",0,pp,"void",0,pf],965638),e.s([],38570),e.i(38570),e.i(937904),e.s(["defaultErrorMap",0,cJ,"getErrorMap",0,cY,"setErrorMap",0,cX],277290),e.i(277290),e.i(665354),e.s([],527404),e.i(527404),e.i(904783),e.i(965638),e.i(169790),e.s(["BRAND",0,d5,"DIRTY",0,c5,"EMPTY_PATH",0,c0,"INVALID",0,c4,"NEVER",0,c4,"OK",0,c6,"ParseStatus",0,c2,"Schema",0,dn,"ZodAny",0,dA,"ZodArray",0,dD,"ZodBigInt",0,dE,"ZodBoolean",0,dC,"ZodBranded",0,d6,"ZodCatch",0,d2,"ZodDate",0,d$,"ZodDefault",0,d1,"ZodDiscriminatedUnion",0,dL,"ZodEffects",0,dY,"ZodEnum",0,dJ,"ZodError",0,cW,"ZodFirstPartyTypeKind",0,A,"ZodFunction",0,dV,"ZodIntersection",0,dF,"ZodIssueCode",0,cH,"ZodLazy",0,dH,"ZodLiteral",0,dK,"ZodMap",0,dZ,"ZodNaN",0,d4,"ZodNativeEnum",0,dG,"ZodNever",0,dM,"ZodNull",0,dN,"ZodNullable",0,d0,"ZodNumber",0,dS,"ZodObject",0,dR,"ZodOptional",0,dQ,"ZodParsedType",0,cq,"ZodPipeline",0,d3,"ZodPromise",0,dX,"ZodReadonly",0,d9,"ZodRecord",0,dB,"ZodSchema",0,dn,"ZodSet",0,dq,"ZodString",0,d_,"ZodSymbol",0,dT,"ZodTransformer",0,dY,"ZodTuple",0,dU,"ZodType",0,dn,"ZodUndefined",0,dI,"ZodUnion",0,dP,"ZodUnknown",0,dj,"ZodVoid",0,dO,"addIssueToContext",0,c1,"any",0,pd,"array",0,pm,"bigint",0,pa,"boolean",0,po,"coerce",0,pL,"custom",0,d7,"date",0,ps,"datetimeRegex",0,dw,"defaultErrorMap",0,cJ,"discriminatedUnion",0,pb,"effect",0,pA,"enum",0,pT,"function",0,pE,"getErrorMap",0,cY,"getParsedType",0,cV,"instanceof",0,pt,"intersection",0,px,"isAborted",0,c3,"isAsync",0,c7,"isDirty",0,c9,"isValid",0,c8,"late",0,pe,"lazy",0,pC,"literal",0,p$,"makeIssue",0,cQ,"map",0,p_,"nan",0,pi,"nativeEnum",0,pI,"never",0,ph,"null",0,pc,"nullable",0,pM,"number",0,pn,"object",0,pg,"objectUtil",0,I,"oboolean",0,pz,"onumber",0,pP,"optional",0,pj,"ostring",0,pR,"pipeline",0,pD,"preprocess",0,pO,"promise",0,pN,"quotelessJson",0,cK,"record",0,pw,"set",0,pS,"setErrorMap",0,cX,"strictObject",0,py,"string",0,pr,"symbol",0,pl,"transformer",0,pA,"tuple",0,pk,"undefined",0,pu,"union",0,pv,"unknown",0,pp,"util",0,T,"void",0,pf],788685),e.i(788685);class pF 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 pU(e){}function pB(e,t,r){return 100===r&&97===e.charCodeAt(t+1)&&116===e.charCodeAt(t+2)&&97===e.charCodeAt(t+3)&&58===e.charCodeAt(t+4)}function pZ(e,t,r){return 101===r&&118===e.charCodeAt(t+1)&&101===e.charCodeAt(t+2)&&110===e.charCodeAt(t+3)&&116===e.charCodeAt(t+4)&&58===e.charCodeAt(t+5)}class pq extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:n}={}){let i;super({start(a){i=function(e){if("function"==typeof e)throw TypeError("`config` must be an object, got a function instead. Did
39you mean `createParser({onEvent: fn})`?");let{onEvent:t=pU,onError:r=pU,onRetry:n=pU,onComment:i,maxBufferSize:a}=e,o=[],s=0,l=!0,u,c="",d=0,p,h=!1;function f(){void 0!==a&&(s+c.length<=a||(h=!0,o.length=0,s=0,u=void 0,c="",d=0,p=void 0,r(new pF(`Buffered data exceeded max buffer size of ${a} characters`,{type:"max-buffer-size-exceeded"}))))}function m(e){let r=0;if(-1===e.indexOf("\r")){let n=e.indexOf(` 40`,r);for(;-1!==n;){if(r===n){d>0&&t({id:u,event:p,data:c}),u=void 0,c="",d=0,p=void 0,r=n+1,n=e.indexOf(` 41`,r);continue}let i=e.charCodeAt(r);if(pB(e,r,i)){let i=32===e.charCodeAt(r+5)?r+6:r+5,a=e.slice(i,n);if(0===d&&10===e.charCodeAt(n+1)){t({id:u,event:p,data:a}),u=void 0,c="",p=void 0,r=n+2,n=e.indexOf(` 42`,r);continue}c=0===d?a:`${c} 43${a}`,d++}else pZ(e,r,i)?p=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,n)||void 0:g(e,r,n);r=n+1,n=e.indexOf(` 44`,r)}return e.slice(r)}for(;r<e.length;){let t=e.indexOf("\r",r),n=e.indexOf(` 45`,r),i=-1;if(-1!==t&&-1!==n?i=t<n?t:n:-1!==t?i=t===e.length-1?-1:t:-1!==n&&(i=n),-1===i)break;g(e,r,i),r=i+1,13===e.charCodeAt(r-1)&&10===e.charCodeAt(r)&&r++}return e.slice(r)}function g(e,r,n){if(r===n)return void(d>0&&t({id:u,event:p,data:c}),u=void 0,c="",d=0,p=void 0);let a=e.charCodeAt(r);if(pB(e,r,a)){let t=32===e.charCodeAt(r+5)?r+6:r+5,i=e.slice(t,n);c=0===d?i:`${c} 46${i}`,d++;return}if(pZ(e,r,a)){p=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,n)||void 0;return}if(105===a&&100===e.charCodeAt(r+1)&&58===e.charCodeAt(r+2)){let t=e.slice(32===e.charCodeAt(r+3)?r+4:r+3,n);u=t.includes("\0")?void 0:t;return}if(58===a){i&&i(e.slice(r,n).slice(32===e.charCodeAt(r+1)?2:1));return}let o=e.slice(r,n),s=o.indexOf(":");if(-1===s)return void y(o,"",o);let l=o.slice(0,s),h=32===o.charCodeAt(s+1)?2:1;y(l,o.slice(s+h),o)}function y(e,t,i){switch(e){case"event":p=t||void 0;break;case"data":c=0===d?t:`${c} 47${t}`,d++;break;case"id":u=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?n(parseInt(t,10)):r(new pF(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:i}));break;default:r(new pF(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:i}))}}return{feed:function(e){if(h)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)&&(e=e.slice(3))),0===o.length){let t=m(e);""!==t&&(o.push(t),s=t.length),f();return}if(-1===e.indexOf(` 48`)&&-1===e.indexOf("\r")){o.push(e),s+=e.length,f();return}o.push(e);let t=o.join("");o.length=0,s=0;let r=m(t);""!==r&&(o.push(r),s=r.length),f()},reset:function(e={}){if(e.consume&&o.length>0){let e=o.join("");g(e,0,e.length)}l=!0,u=void 0,c="",d=0,p=void 0,o.length=0,s=0,h=!1}}}({onEvent:e=>{a.enqueue(e)},onError(t){"function"==typeof e&&e(t),("terminate"===e||"max-buffer-size-exceeded"===t.type)&&a.error(t)},onRetry:t,onComment:r,maxBufferSize:n})},transform(e){i.feed(e)}})}}function pV(...e){return e.reduce((e,t)=>({...e,...null!=t?t:{}}),{})}function pH(e){return Object.fromEntries([...e.headers])}var{btoa:pK,atob:pW}=globalThis;function pJ(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return pK(t)}async function pG(e){var t;try{await (null==(t=e.body)?void 0:t.cancel())}catch(e){}}var pX="AI_DownloadError",pY=`vercel.ai.error.${pX}`,pQ=Symbol.for(pY),p0=class extends(M=ej,j=pQ,M){constructor({url:e,statusCode:t,statusText:r,cause:n,message:i=null==n?`Failed to download ${e}: ${t} ${r}`:`Failed to download ${e}: ${n}`}){super({name:pX,message:i,cause:n}),this[j]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return ej.hasMarker(e,pY)}};function p1(e){let t=e.split(".");return 4===t.length&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function p2(e){let[t,r,n]=e.split(".").map(Number);return 0===t||10===t||100===t&&r>=64&&r<=127||127===t||169===t&&254===r||172===t&&r>=16&&r<=31||192===t&&0===r&&0===n||192===t&&168===r||198===t&&(18===r||19===r)||t>=240||!1}async function p4({url:e,headers:t,abortSignal:r,maxRedirects:n=10}){let i={signal:r};void 0!==t&&(i.headers=t);let a=e;for(let t=0;t<=n;t++){!function(e){let t;try{t=new URL(e)}catch(t){throw new p0({url:e,message:`Invalid URL: ${e}`})}if("data:"===t.protocol)return;if("http:"!==t.protocol&&"https:"!==t.protocol)throw new p0({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let r=t.hostname.toLowerCase().replace(/\.+$/,"");if(!r)throw new p0({url:e,message:"URL must have a hostname"});if("localhost"===r||r.endsWith(".local")||r.endsWith(".localhost"))throw new p0({url:e,message:`URL with hostname ${r} is not allowed`});if(r.startsWith("[")&&r.endsWith("]")){if(function(e){let t=function(e){let t=e.toLowerCase(),r=t.indexOf("%");-1!==r&&(t=t.slice(0,r));let n=t.split("::");if(n.length>2)return null;let i=e=>{if(""===e)return[];let t=[],r=e.split(":");for(let e=0;e<r.length;e++){let n=r[e];if(n.includes(".")){if(e!==r.length-1||!p1(n))return null;let[i,a,o,s]=n.split(".").map(Number);t.push(i<<8|a,o<<8|s);continue}if(!/^[0-9a-f]{1,4}$/.test(n))return null;t.push(parseInt(n,16))}return t},a=i(n[0]);if(null===a)return null;if(2===n.length){let e=i(n[1]);if(null===e)return null;let t=8-a.length-e.length;return t<0?null:[...a,...Array(t).fill(0),...e]}return 8===a.length?a:null}(e);if(null===t)return!0;let r=e=>
48t.slice(0,e).every(e=>0===e);if(r(7)&&(0===t[7]||1===t[7])||(65024&t[0])==64512||(65472&t[0])==65152||(65472&t[0])==65216||(65280&t[0])==65280)return!0;if(r(6)||r(5)&&65535===t[5]||r(4)&&65535===t[4]&&0===t[5]||100===t[0]&&65435===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&0===t[5]||100===t[0]&&65435===t[1]&&1===t[2]){let e=t[6]>>8&255,r=255&t[6],n=t[7]>>8&255,i=255&t[7];return p2(`${e}.${r}.${n}.${i}`)}return!1}(r.slice(1,-1)))throw new p0({url:e,message:`URL with IPv6 address ${r} is not allowed`});return}if(p1(r)&&p2(r))throw new p0({url:e,message:`URL with IP address ${r} is not allowed`})}(a);let t=await fetch(a,{...i,redirect:"manual"});if("opaqueredirect"===t.type){if(!function(e=globalThis){return null!=e.window}())throw new p0({url:e,message:`Redirect from ${a} could not be validated and was blocked`});return await fetch(a,{...i,redirect:"follow"})}let r=t.headers.get("location");if(t.status>=300&&t.status<400&&r){await pG(t),a=new URL(r,a).toString();continue}return t}throw new p0({url:e,message:`Too many redirects (max ${n})`})}async function p5({response:e,url:t,maxBytes:r=0x80000000}){let n=e.headers.get("content-length");if(null!=n){let i=parseInt(n,10);if(!isNaN(i)&&i>r)throw await pG(e),new p0({url:t,message:`Download of ${t} exceeded maximum size of ${r} bytes (Content-Length: ${i}).`})}let i=e.body;if(null==i)return new Uint8Array(0);let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:n}=await a.read();if(e)break;if((s+=n.length)>r)throw new p0({url:t,message:`Download of ${t} exceeded maximum size of ${r} bytes.`});o.push(n)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let l=new Uint8Array(s),u=0;
48for(let e of o)l.set(e,u),u+=e.length;return l}var p6=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{let i=()=>{let e=r.length,n=Array(t);for(let i=0;i<t;i++)n[i]=r[Math.random()*e|0];return n.join("")};if(null==e)return i;if(r.includes(n))throw new eV({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${i()}`},p3=p6();function p9(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}var p8=["fetch failed","failed to fetch"],p7=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];function he({error:e,url:t,requestBodyValues:r}){if(p9(e))return e;if(e instanceof TypeError&&p8.includes(e.message.toLowerCase())){let n=e.cause;if(null!=n)return new eR({message:`Cannot connect to API: ${n.message}`,cause:n,url:t,requestBodyValues:r,isRetryable:!0})}return!function(e){if(!(e instanceof Error))return!1;let t=e.code;return!!("string"==typeof t&&p7.includes(t))}(e)?e:new eR({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:r,isRetryable:!0})}function ht(e=globalThis){var t,r,n;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(n=null==(r=e.process)?void 0:r.versions)?void 0:n.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function hr(e){if(null==e)return{};let t={};if(e instanceof Headers)e.forEach((e,r)=>{t[r.toLowerCase()]=e});else for(let[r,n]of(Array.isArray(e)||(e=Object.entries(e)),e))null!=n&&(t[r.toLowerCase()]=n);return t}function hn(e,...t){let r=new Headers(hr(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var hi="4.0.30",ha=()=>globalThis.fetch,ho=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:n,abortSignal:i,fetch:a=ha()})=>{try{let o=await a(e,{method:"GET",headers:hn(t,`ai-sdk/provider-utils/${hi}`,ht()),signal:i}),s=pH(o);if(!o.ok){let t;try{t=await n({response:o,url:e,requestBodyValues:{}})}catch(t){if(p9(t)||eR.isInstance(t))throw t;throw new eR({message:"Failed to process error response",cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw t.value}try{return await r({response:o,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(p9(t)||eR.isInstance(t)))throw t;throw new eR({message:"Failed to process successful response",cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(t){throw he({error:t,url:e,requestBodyValues:{}})}};function hs({settingValue:e,environmentVariableName:t}){return"string"==typeof e?e:null!=e||void 0===eT.default?void 0:null!=(e=eT.default.env[t])&&"string"==typeof e?e:void 0}var hl=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,hu=/"(?: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 hc(e){let t=JSON.parse(e);return null===t||"object"!=typeof t||!1===hl.test(e)&&!1===hu.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")&&null!==r.constructor&&"object"==typeof r.constructor&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let e in r){let n=r[e];n&&"object"==typeof n&&t.push(n)}}}return e}(t)}function hd(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return hc(e)}try{return hc(e)}finally{Error.stackTraceLimit=t}}function hp(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;let{properties:t}=e;if(null!=t)for(let e of Object.keys(t))t[e]=hh(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(hh):hh(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(hh)),null!=e.allOf&&(e.allOf=e.allOf.map(hh)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(hh));let{definitions:t}=e;if(null!=t)for(let e of Object.keys(t))t[e]=hh(t[e]);return e}function hh(e){return"boolean"==typeof e?e:hp(e)}var hf=Symbol("Let zodToJsonSchema decide on which parser to use"),hm={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"};function hg(e,t){return hP(e.type._def,t)}var hy=void 0,hv=/^[cC][^\s-]{8,}
48$/,hb=/^[0-9a-z]+$/,hx=/^[0-9A-HJKMNP-TV-Z]{26}$/,hk=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,hw=()=>(void 0===hy&&(hy=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),hy),h_=/^(?:(?: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])$/,hS=/^(([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])$/,hE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,h$=/^[a-zA-Z0-9_-]{21}$/,hT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function hI(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":hj(r,"email",n.message,t);break;case"format:idn-email":hj(r,"idn-email",n.message,t);break;case"pattern:zod":hM(r,hk,n.message,t)}break;case"url":hj(r,"uri",n.message,t);break;case"uuid":hj(r,"uuid",n.message,t);break;case"regex":hM(r,n.regex,n.message,t);break;case"cuid":hM(r,hv,n.message,t);break;case"cuid2":hM(r,hb,n.message,t);break;case"startsWith":hM(r,RegExp(`^${hN(n.value,t)}`),n.message,t);break;case"endsWith":hM(r,RegExp(`${hN(n.value,t)}$`),n.message,t);break;case"datetime":hj(r,"date-time",n.message,t);break;case"date":hj(r,"date",n.message,t);break;case"time":hj(r,"time",n.message,t);break;case"duration":hj(r,"duration",n.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"includes":hM(r,RegExp(hN(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&hj(r,"ipv4",n.message,t),"v4"!==n.version&&hj(r,"ipv6",n.message,t);break;case"base64url":hM(r,hC,n.message,t);break;case"jwt":hM(r,hT,n.message,t);break;case"cidr":"v6"!==n.version&&hM(r,h_,n.message,t),"v4"!==n.version&&hM(r,hS,n.message,t);break;case"emoji":hM(r,hw(),n.message,t);break;case"ulid":hM(r,hx,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":hj(r,"binary",n.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":hM(r,hE,n.message,t)}break;case"nanoid":hM(r,h$,n.message,t)}return r}function hN(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)hA.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var hA=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function hj(e,t,r,n){var i;e.format||(null==(i=e.anyOf)?void 0:i.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&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function hM(e,t,r,n){var i;e.pattern||(null==(i=e.allOf)?void 0:i.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:hO(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=hO(t,n)}function hO(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=n.i?e.source.toLowerCase():e.source,a="",o=!1,s=!1,l=!1;for(let e=0;e<i.length;e++){if(o){a+=i[e],o=!1;continue}
48if(n.i){if(s){if(i[e].match(/[a-z]/)){l?(a+=i[e],a+=`${i[e-2]}-${i[e]}`.toUpperCase(),l=!1):"-"===i[e+1]&&(null==(r=i[e+2])?void 0:r.match(/[a-z]/))?(a+=i[e],l=!0):a+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){a+=`[${i[e]}${i[e].toUpperCase()}]`;continue}}if(n.m){if("^"===i[e]){a+=`(^|(?<=[\r 49]))`;continue}else if("$"===i[e]){a+=`($|(?=[\r 50]))`;continue}}if(n.s&&"."===i[e]){a+=s?`${i[e]}\r 51`:`[${i[e]}\r 52]`;continue}a+=i[e],"\\"===i[e]?o=!0:s&&"]"===i[e]?s=!1:s||"["!==i[e]||(s=!0)}try{new RegExp(a)}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 a}function hD(e,t){var r,n,i,a,o,s;let l={type:"object",additionalProperties:null!=(r=hP(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(n=e.keyType)?void 0:n._def.typeName)===A.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){let{type:r,...n}=hI(e.keyType._def,t);return{...l,propertyNames:n}}if((null==(a=e.keyType)?void 0:a._def.typeName)===A.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===A.ZodBranded&&e.keyType._def.type._def.typeName===A.ZodString&&(null==(s=e.keyType._def.type._def.checks)?void 0:s.length)){let{type:r,...n}=hg(e.keyType._def,t);return{...l,propertyNames:n}}return l}var hR={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function hP(e,t,r=!1){var n;let i=t.seen.get(e);if(t.override){let a=null==(n=t.override)?void 0:n.call(t,e,t,i,r);if(a!==hf)return a}if(i&&!r){let e=hz(i,t);if(void 0!==e)return e}let a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);let o=((e,t,r)=>{var n,i,a,o,s,l;switch(t){case A.ZodString:return hI(e,r);case A.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 A.ZodObject:return function(e,t){let r={type:"object",properties:{}},n=[],i=e.shape();for(let e in i){let a=i[e];if(void 0===a||void 0===a._def)continue;let o=function(e){try{return e.isOptional()}catch(e){return!0}}(a),s=hP(a._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==s&&(r.properties[e]=s,o||n.push(e))}n.length&&(r.required=n);let a=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return hP(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!==a&&(r.additionalProperties=a),r}(e,r);case A.ZodBigInt:let c={type:"integer",format:"int64"};if(!e.checks)return c;for(let t of e.checks)switch(t.kind){case"min":t.inclusive?c.minimum=t.value:c.exclusiveMinimum=t.value;break;case"max":t.inclusive?c.maximum=t.value:c.exclusiveMaximum=t.value;break;case"multipleOf":c.multipleOf=t.value}return c;case A.ZodBoolean:return{type:"boolean"};case A.ZodDate:return function e(t,r,n){let i=null!=n?n:r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,i)=>e(t,r,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var a=t;let o={type:"integer",format:"unix-time"};for(let e of a.checks)switch(e.kind){case"min":o.minimum=e.value;break;case"max":o.maximum=e.value}return o}}(e,r);case A.ZodUndefined:return{not:{}};case A.ZodNull:return{type:"null"};case A.ZodArray:let d;return d={type:"array"},(null==(a=e.type)?void 0:a._def)&&(null==(s=null==(o=e.type)?void 0:o._def)?void 0:s.typeName)!==A.ZodAny&&(d.items=hP(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&(d.minItems=e.minLength.value),e.maxLength&&(d.maxItems=e.maxLength.value),e.exactLength&&(d.minItems=e.exactLength.value,d.maxItems=e.exactLength.value),d;case A.ZodUnion:case A.ZodDiscriminatedUnion:let p,h=e.options instanceof Map?Array.from(e.options.values()):e.options;if(h.every(e=>e._def.typeName in hR&&(!e._def.checks||!e._def.checks.length))){let e=h.reduce((e,t)=>
52{let r=hR[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(h.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=h.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===h.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:h.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(h.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:h.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return n=e,i=r,(p=(n.options instanceof Map?Array.from(n.options.values()):n.options).map((e,t)=>hP(e._def,{...i,currentPath:[...i.currentPath,"anyOf",`${t}`]})).filter(e=>!!e&&(!i.strictUnions||"object"==typeof e&&Object.keys(e).length>0))).length?{anyOf:p}:void 0;case A.ZodIntersection:let f,m;return f=[hP(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),hP(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),m=[],f.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,...n}=e;t=n}m.push(t)}}),m.length?{allOf:m}:void 0;case A.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>hP(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:hP(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>hP(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case A.ZodRecord:return hD(e,r);case A.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 A.ZodEnum:return{type:"string",enum:Array.from(e.values)};case A.ZodNativeEnum:let y,v,b;return y=e.values,{type:1===(b=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"===b[0]?"string":"number":["string","number"],enum:v};case A.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[hR[e.innerType._def.typeName],"null"]};let x=hP(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return x&&{anyOf:[x,{type:"null"}]};case A.ZodOptional:if(r.currentPath.toString()===(null==(l=r.propertyPath)?void 0:l.toString()))return hP(e.innerType._def,r);let k=hP(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return k?{anyOf:[{not:{}},k]}:{};case A.ZodMap:if("record"===r.mapStrategy)return hD(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[hP(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||{},hP(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}};case A.ZodSet:let w;return w={type:"array",uniqueItems:!0,items:hP(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&(w.minItems=e.minSize.value),e.maxSize&&(w.maxItems=e.maxSize.value),w;case A.ZodLazy:return()=>e.getter()._def;case A.ZodPromise:return hP(e.type._def,r);case A.ZodNaN:case A.ZodNever:return{not:{}};case A.ZodEffects:return"input"===r.effectStrategy?hP(e.schema._def,r):{};case A.ZodAny:case A.ZodUnknown:return{};case A.ZodDefault:return{...hP(e.innerType._def,r),default:e.defaultValue()};case A.ZodBranded:return hg(e,r);case A.ZodReadonly:case A.ZodCatch:return hP(e.innerType._def,r);case A.ZodPipeline:if("input"===r.pipeStrategy)return hP(e.in._def,r);if("output"===r.pipeStrategy)return hP(e.out._def,r);let _=hP(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),S=hP(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",_?"1":"0"]});return{allOf:[_,S].filter(e=>void 0!==e)};case A.ZodFunction:case A.ZodVoid:case A.ZodSymbol:default:return}})(e,e.typeName,t),s="function"==typeof o?hP(o(),t):o;if(s&&hL(e,t,s),t.postProcess){let r=t.postProcess(s,e,t);return a.jsonSchema=s,r}return a.jsonSchema=s,s}var hz=(e,t)=>
52{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}},hL=(e,t,r)=>(e.description&&(r.description=e.description),r),hF=Symbol.for("vercel.ai.schema");function hU(e){let t;return()=>(null==t&&(t=e()),t)}function hB(e,{validate:t}={}){return{[hF]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function hZ(e){var t;return null==e?hB({properties:{},additionalProperties:!1}):"object"==typeof e&&null!==e&&hF in e&&!0===e[hF]&&"jsonSchema"in e&&"validate"in e?e:"~standard"in e?"zod"===e["~standard"].vendor?hq(e):(t=e,hB(()=>hp(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 e1({value:e,cause:r.issues})}}})):e()}function hq(e,t){var r,n;let i;if("_zod"in e){let n;return n=null!=(r=null==t?void 0:t.useReferences)&&r,hB(()=>hp(sM(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async t=>{let r=await sG(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}return i=null!=(n=null==t?void 0:t.useReferences)&&n,hB(()=>((e,t)=>{var r;let n,i,a=(i=void 0!==(n="string"==typeof t?{...hm,name:t}:{...hm,...t}).name?[...n.basePath,n.definitionPath,n.name]:n.basePath,{...n,currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(n.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...n.basePath,n.definitionPath,e],jsonSchema:void 0}]))}),o="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>{var n;return{...e,[t]:null!=(n=hP(r._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?n:{}}},{}):void 0,s="string"==typeof t?t:(null==t?void 0:t.nameStrategy)==="title"||null==t?void 0:t.name,l=null!=(r=hP(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?r:{},u="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==u&&(l.title=u);let c=void 0===s?o?{...l,[a.definitionPath]:o}:l:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...o,[s]:l}};return c.$schema="http://json-schema.org/draft-07/schema#",c})(e,{$refStrategy:i?"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 hV({value:e,schema:t,context:r}){let n=await hH({value:e,schema:t,context:r});if(!n.success)throw e1.wrap({value:e,cause:n.error,context:r});return n.value}async function hH({value:e,schema:t,context:r}){let n=hZ(t);try{if(null==n.validate)return{success:!0,value:e,rawValue:e};let t=await n.validate(e);if(t.success)return{success:!0,value:t.value,rawValue:e};return{success:!1,error:e1.wrap({value:e,cause:t.error,context:r}),rawValue:e}}catch(t){return{success:!1,error:e1.wrap({value:e,cause:t,context:r}),rawValue:e}}}async function hK({text:e,schema:t}){try{let r=hd(e);if(null==t)return r;return hV({value:r,schema:t})}catch(t){if(eG.isInstance(t)||e1.isInstance(t))throw t;throw new eG({text:e,cause:t})}}async function hW({text:e,schema:t}){try{let r=hd(e);if(null==t)return{success:!0,value:r,rawValue:r};return await hH({value:r,schema:t})}catch(t){return{success:!1,error:eG.isInstance(t)?t:new eG({text:e,cause:t}),rawValue:void 0}}}function hJ({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new pq).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await hW({text:e,schema:t}))}}))}var hG=()=>globalThis.fetch,hX=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:i,abortSignal:a,fetch:o})=>hY({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r}
52,failedResponseHandler:n,successfulResponseHandler:i,abortSignal:a,fetch:o}),hY=async({url:e,headers:t={},body:r,successfulResponseHandler:n,failedResponseHandler:i,abortSignal:a,fetch:o=hG()})=>{try{let s=await o(e,{method:"POST",headers:hn(t,`ai-sdk/provider-utils/${hi}`,ht()),body:r.content,signal:a}),l=pH(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:r.values})}catch(t){if(p9(t)||eR.isInstance(t))throw t;throw new eR({message:"Failed to process error response",cause:t,statusCode:s.status,url:e,responseHeaders:l,requestBodyValues:r.values})}throw t.value}try{return await n({response:s,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(p9(t)||eR.isInstance(t)))throw t;throw new eR({message:"Failed to process successful response",cause:t,statusCode:s.status,url:e,responseHeaders:l,requestBodyValues:r.values})}}catch(t){throw he({error:t,url:e,requestBodyValues:r.values})}};function hQ({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:n}){return({execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:l,onInputAvailable:u,...c})=>({type:"provider",id:e,args:c,inputSchema:t,outputSchema:r,execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:l,onInputAvailable:u,supportsDeferredResults:n})}async function h0(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var h1=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:n,url:i,requestBodyValues:a})=>{let o=await n.text(),s=pH(n);if(""===o.trim())return{responseHeaders:s,value:new eR({message:n.statusText,url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,isRetryable:null==r?void 0:r(n)})};try{let l=await hK({text:o,schema:e});return{responseHeaders:s,value:new eR({message:t(l),url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,data:l,isRetryable:null==r?void 0:r(n,l)})}}catch(e){return{responseHeaders:s,value:new eR({message:n.statusText,url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,isRetryable:null==r?void 0:r(n)})}}},h2=e=>async({response:t,url:r,requestBodyValues:n})=>{let i=await t.text(),a=await hW({text:i,schema:e}),o=pH(t);if(!a.success)throw new eR({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:r,requestBodyValues:n});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}},h4=cZ,h5=e.i(725150),h6=Symbol.for("vercel.ai.gateway.error"),h3=class e extends(D=Error,O=h6,D){constructor({message:e,statusCode:t=500,cause:r,generationId:n,isRetryable:i=null!=t&&(408===t||409===t||429===t||t>=500)}){super(n?`${e} [${n}]`:e),this[O]=!0,this.statusCode=t,this.cause=r,this.generationId=n,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&h6 in e&&!0===e[h6]}},h9="GatewayAuthenticationError",h8=Symbol.for(`vercel.ai.gateway.error.${h9}`),h7=class e extends(P=h3,R=h8,P){constructor({message:e="Authentication failed",statusCode:t=401,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[R]=!0,this.name=h9,this.type="authentication_error"}static isInstance(e){return h3.hasMarker(e)&&h8 in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:n="Authentication failed",statusCode:i=401,cause:a,generationId:o}){return new e({message:t?`AI Gateway authentication failed: Invalid API key. 53 54Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys 55 56Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:r?`AI Gateway authentication failed: Invalid OIDC token. 57 58Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token. 59 60Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:`AI Gateway authentication failed: No authentication provided. 61 62Option 1 - API key: 63Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys 64Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable. 65 66Option 2 - OIDC token: 67Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,statusCode:i,cause:a,generationId:o})}},fe="GatewayInvalidRequestError",ft=Symbol.for(`vercel.ai.gateway.error.${fe}`),fr=class extends(L=h3,z=ft,L){constructor({message:e="Invalid request",statusCode:t=400,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[z]=!0,this.name=fe,this.type="invalid_request_error"}static isInstance(e){return h3.hasMarker(e)&&ft in e}},fn="GatewayRateLimitError",fi=Symbol.for(`vercel.ai.gateway.error.${fn}`),fa=class extends(U=h3,F=fi,U){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[F]=!0,this.name=fn,this.type="rate_limit_exceeded"}static isInstance(e){return h3.hasMarker(e)&&fi in e}},fo="GatewayModelNotFoundError",fs=Symbol.for(`vercel.ai.gateway.error.${fo}`),fl=hU(()=>hq(h4.object({modelId:h4.string()}))),fu=class extends(Z=h3,B=fs,Z){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:n,generationId:i}={}){super({message:e,statusCode:t,cause:n,generationId:i}),this[B]=!0,this.name=fo,this.type="model_not_found",this.modelId=r}static isInstance(e){return h3.hasMarker(e)&&fs in e}},fc="GatewayInternalServerError",fd=Symbol.for(`vercel.ai.gateway.error.${fc}`),fp=class extends(V=h3,q=fd,V){constructor({message:e="Internal server error",statusCode:t=500,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[q]=!0,this.name=fc,this.type="internal_server_error"}static isInstance(e){return h3.hasMarker(e)&&fd in e}},fh="GatewayFailedDependencyError",ff=Symbol.for(`vercel.ai.gateway.error.${fh}`),fm=class extends(K=h3,H=ff,K){constructor({message:e="Failed dependency",statusCode:t=424,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[H]=!0,this.name=fh,this.type="failed_dependency"}static isInstance(e){return h3.hasMarker(e)&&ff in e}},fg="GatewayForbiddenError",fy=Symbol.for(`vercel.ai.gateway.error.${fg}`),fv=class extends(J=h3,W=fy,J){constructor({message:e="Forbidden",statusCode:t=403,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[W]=!0,this.name=fg,this.type="forbidden"}static isInstance(e){return h3.hasMarker(e)&&fy in e}},fb="GatewayResponseError",fx=Symbol.for(`vercel.ai.gateway.error.${fb}`),fk=class extends(X=h3,G=fx,X){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:n,cause:i,generationId:a}={}){super({message:e,statusCode:t,cause:i,generationId:a}),this[G]=!0,this.name=fb,this.type="response_error",this.response=r,this.validationError=n}static isInstance(e){return h3.hasMarker(e)&&fx in e}};async function fw({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:n,authMethod:i}){var a;let o=await hH({value:e,schema:f_});if(!o.success){let i="object"==typeof e&&null!==e&&"generationId"in e?e.generationId:void 0;return new fk({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:o.error,cause:n,generationId:i})}let s=o.value,l=s.error.type,u=s.error.message,c=null!=(a=s.generationId)?a:void 0;switch(l){case"authentication_error":return h7.createContextualError({apiKeyProvided:"api-key"===i,oidcTokenProvided:"oidc"===i,statusCode:t,cause:n,generationId:c});
67case"invalid_request_error":return new fr({message:u,statusCode:t,cause:n,generationId:c});case"rate_limit_exceeded":return new fa({message:u,statusCode:t,cause:n,generationId:c});case"model_not_found":{let e=await hH({value:s.error.param,schema:fl});return new fu({message:u,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:n,generationId:c})}case"internal_server_error":default:return new fp({message:u,statusCode:t,cause:n,generationId:c});case"failed_dependency":return new fm({message:u,statusCode:t,cause:n,generationId:c});case"forbidden":return new fv({message:u,statusCode:t,cause:n,generationId:c})}}var f_=hU(()=>hq(h4.object({error:h4.object({message:h4.string(),type:h4.string().nullish(),param:h4.unknown().nullish(),code:h4.union([h4.string(),h4.number()]).nullish()}),generationId:h4.string().nullish()}))),fS="GatewayTimeoutError",fE=Symbol.for(`vercel.ai.gateway.error.${fS}`),fC=class e extends(Q=h3,Y=fE,Q){constructor({message:e="Request timed out",statusCode:t=408,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[Y]=!0,this.name=fS,this.type="timeout_error"}static isInstance(e){return h3.hasMarker(e)&&fE in e}static createTimeoutError({originalMessage:t,statusCode:r=408,cause:n,generationId:i}){return new e({message:`Gateway request timed out: ${t} 68 69 This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`,statusCode:r,cause:n,generationId:i})}};function f$(e){if(!(e instanceof Error))return!1;let t=e.code;return"string"==typeof t&&["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(t)}async function fT(e,t){var r;return h3.isInstance(e)?e:f$(e)?fC.createTimeoutError({originalMessage:e instanceof Error?e.message:"Unknown error",cause:e}):eR.isInstance(e)?e.cause&&f$(e.cause)?fC.createTimeoutError({originalMessage:e.message,cause:e}):await fw({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}):await fw({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}var fI="ai-gateway-auth-method";async function fN(e){let t=await hH({value:e[fI],schema:fA});return t.success?t.value:void 0}var fA=hU(()=>hq(h4.union([h4.literal("api-key"),h4.literal("oidc")]))),fj=["embedding","image","language","reranking","video"],fM=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await ho({url:`${this.config.baseURL}/config`,headers:await h0(this.config.headers()),successfulResponseHandler:h2(fO),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await fT(e)}}async getCredits(){try{let e=new URL(this.config.baseURL),{value:t}=await ho({url:`${e.origin}/v1/credits`,headers:await h0(this.config.headers()),successfulResponseHandler:h2(fD),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await fT(e)}}},fO=hU(()=>hq(h4.object({models:h4.array(h4.object({id:h4.string(),name:h4.string(),description:h4.string().nullish(),pricing:h4.object({input:h4.string(),output:h4.string(),input_cache_read:h4.string().nullish(),input_cache_write:h4.string().nullish()}).transform(({input:e,output:t,input_cache_read:r,input_cache_write:n})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...n?{cacheCreationInputTokens:n}:{}})).nullish(),specification:h4.object({specificationVersion:h4.literal("v3"),provider:h4.string(),modelId:h4.string()}),modelType:h4.string().nullish()})).transform(e=>e.filter(e=>null==e.modelType||fj.includes(e.modelType)))}))),fD=hU(()=>hq(h4.object({balance:h4.string(),total_used:h4.string()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),fR=class{constructor(e){this.config=e}
69async getSpendReport(e){try{let t=new URL(this.config.baseURL),r=new URLSearchParams;r.set("start_date",e.startDate),r.set("end_date",e.endDate),e.groupBy&&r.set("group_by",e.groupBy),e.datePart&&r.set("date_part",e.datePart),e.userId&&r.set("user_id",e.userId),e.model&&r.set("model",e.model),e.provider&&r.set("provider",e.provider),e.credentialType&&r.set("credential_type",e.credentialType),e.tags&&e.tags.length>0&&r.set("tags",e.tags.join(","));let{value:n}=await ho({url:`${t.origin}/v1/report?${r.toString()}`,headers:await h0(this.config.headers()),successfulResponseHandler:h2(fP),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return n}catch(e){throw await fT(e)}}},fP=hU(()=>hq(h4.object({results:h4.array(h4.object({day:h4.string().optional(),hour:h4.string().optional(),user:h4.string().optional(),model:h4.string().optional(),tag:h4.string().optional(),provider:h4.string().optional(),credential_type:h4.enum(["byok","system"]).optional(),total_cost:h4.number(),market_cost:h4.number().optional(),input_tokens:h4.number().optional(),output_tokens:h4.number().optional(),cached_input_tokens:h4.number().optional(),cache_creation_input_tokens:h4.number().optional(),reasoning_tokens:h4.number().optional(),request_count:h4.number().optional()}).transform(({credential_type:e,total_cost:t,market_cost:r,input_tokens:n,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:l,...u})=>({...u,...void 0!==e?{credentialType:e}:{},totalCost:t,...void 0!==r?{marketCost:r}:{},...void 0!==n?{inputTokens:n}:{},...void 0!==i?{outputTokens:i}:{},...void 0!==a?{cachedInputTokens:a}:{},...void 0!==o?{cacheCreationInputTokens:o}:{},...void 0!==s?{reasoningTokens:s}:{},...void 0!==l?{requestCount:l}:{}})))}))),fz=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let t=new URL(this.config.baseURL),{value:r}=await ho({url:`${t.origin}/v1/generation?id=${encodeURIComponent(e.id)}`,headers:await h0(this.config.headers()),successfulResponseHandler:h2(fL),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return r}catch(e){throw await fT(e)}}},fL=hU(()=>hq(h4.object({data:h4.object({id:h4.string(),total_cost:h4.number(),upstream_inference_cost:h4.number(),usage:h4.number(),created_at:h4.string(),model:h4.string(),is_byok:h4.boolean(),provider_name:h4.string(),streamed:h4.boolean(),finish_reason:h4.string(),latency:h4.number(),generation_time:h4.number(),native_tokens_prompt:h4.number(),native_tokens_completion:h4.number(),native_tokens_reasoning:h4.number(),native_tokens_cached:h4.number(),native_tokens_cache_creation:h4.number(),billable_web_search_calls:h4.number()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:r,is_byok:n,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:l,native_tokens_reasoning:u,native_tokens_cached:c,native_tokens_cache_creation:d,billable_web_search_calls:p,...h})=>({...h,totalCost:e,upstreamInferenceCost:t,createdAt:r,isByok:n,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:l,reasoningTokens:u,cachedTokens:c,cacheCreationTokens:d,billableWebSearchCalls:p}))}).transform(({data:e})=>e))),fF=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:n}=e,i=await h0(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await hX({url:this.getUrl(),headers:pV(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await h0(this.config.o11yHeaders)),body:t,successfulResponseHandler:h2(h4.any()),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:r}}catch(e){throw await fT(e,await fN(i))}}async doStream(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:n}=e,i=await h0(this.config.headers());try{let a,{value:o,responseHeaders:s}=await hX({url:this.getUrl(),headers:pV(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await h0(this.config.o11yHeaders)),body:t,successfulResponseHandler:(a=h4.any(),async({response:e})=>{let t=pH(e);if(null==e.body)throw new eF({});
69return{responseHeaders:t,value:hJ({stream:e.body,schema:a})}}),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{stream:o.pipeThrough(new TransformStream({start(e){r.length>0&&e.enqueue({type:"stream-start",warnings:r})},transform(t,r){if(t.success){let n=t.value;("raw"!==n.type||e.includeRawChunks)&&("response-metadata"===n.type&&n.timestamp&&"string"==typeof n.timestamp&&(n.timestamp=new Date(n.timestamp)),r.enqueue(n))}else r.error(t.error)}})),request:{body:t},response:{headers:s}}}catch(e){throw await fT(e,await fN(i))}}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=eI.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)}}},fU=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:n}){var i,a;let o=await h0(this.config.headers());try{let{responseHeaders:s,value:l,rawValue:u}=await hX({url:this.getUrl(),headers:pV(o,null!=t?t:{},this.getModelConfigHeaders(),await h0(this.config.o11yHeaders)),body:{values:e,...n?{providerOptions:n}:{}},successfulResponseHandler:h2(fZ),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:l.embeddings,usage:null!=(i=l.usage)?i:void 0,providerMetadata:l.providerMetadata,response:{headers:s,body:u},warnings:null!=(a=l.warnings)?a:[]}}catch(e){throw await fT(e,await fN(o))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},fB=h4.discriminatedUnion("type",[h4.object({type:h4.literal("unsupported"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("compatibility"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("other"),message:h4.string()})]),fZ=hU(()=>hq(h4.object({embeddings:h4.array(h4.array(h4.number())),usage:h4.object({tokens:h4.number()}).nullish(),warnings:h4.array(fB).optional(),providerMetadata:h4.record(h4.string(),h4.record(h4.string(),h4.unknown())).optional()}))),fq=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:n,seed:i,files:a,mask:o,providerOptions:s,headers:l,abortSignal:u}){var c,d,p,h;let f=await h0(this.config.headers());try{let{responseHeaders:m,value:g,rawValue:y}=await hX({url:this.getUrl(),headers:pV(f,null!=l?l:{},this.getModelConfigHeaders(),await h0(this.config.o11yHeaders)),body:{prompt:e,n:t,...r&&{size:r},...n&&{aspectRatio:n},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>fV(e))},...o&&{mask:fV(o)}},successfulResponseHandler:h2(fJ),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{images:g.images,warnings:null!=(c=g.warnings)?c:[],providerMetadata:g.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:m},...null!=g.usage&&{usage:{inputTokens:null!=(d=g.usage.inputTokens)?d:void 0,outputTokens:null!=(p=g.usage.outputTokens)?p:void 0,totalTokens:null!=(h=g.usage.totalTokens)?h:void 0}}}}catch(e){throw await fT(e,await fN(f))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function fV(e){return"file"===e.type&&e.data instanceof Uint8Array?{...e,data:pJ(e.data)}:e}var fH=h4.object({images:h4.array(h4.unknown()).optional()}).catchall(h4.unknown()),fK=h4.discriminatedUnion("type",[h4.object({type:h4.literal("unsupported"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("compatibility"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("other"),message:h4.string()})]),fW=h4.object({inputTokens:h4.number().nullish(),outputTokens:h4.number().nullish(),totalTokens:h4.number().nullish()}),fJ=h4.object({images:h4.array(h4.string()),warnings:h4.array(fK).optional(),providerMetadata:h4.record(h4.string(),fH).optional(),usage:fW.optional()}),fG=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxVideosPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,aspectRatio:r,resolution:n,duration:i,fps:a,seed:o,image:s,providerOptions:l,headers:u,abortSignal:c}){var d,p;let h=await h0(this.config.headers());try{let{responseHeaders:f,value:m}=await hX({url:this.getUrl(),headers:pV(h,null!=u?u:{},this.getModelConfigHeaders(),await h0(this.config.o11yHeaders),{accept:"text/event-stream"}),body:{prompt:e,n:t,...r&&{aspectRatio:r},...n&&{resolution:n},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...l&&{providerOptions:l},...s&&{image:(p=s,"file"===p.type&&p.data instanceof Uint8Array?{...p,data:pJ(p.data)}:p)}},successfulResponseHandler:async({response:e,url:t,requestBodyValues:r})=>{if(null==e.body)throw new eR({message:"SSE response body is empty",url:t,requestBodyValues:r,statusCode:e.status});
69let n=hJ({stream:e.body,schema:f0}).getReader(),{done:i,value:a}=await n.read();if(n.releaseLock(),i||!a)throw new eR({message:"SSE stream ended without a data event",url:t,requestBodyValues:r,statusCode:e.status});if(!a.success)throw new eR({message:"Failed to parse video SSE event",cause:a.error,url:t,requestBodyValues:r,statusCode:e.status});let o=a.value;if("error"===o.type)throw new eR({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:r,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),...c&&{abortSignal:c},fetch:this.config.fetch});return{videos:m.videos,warnings:null!=(d=m.warnings)?d:[],providerMetadata:m.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:f}}}catch(e){throw await fT(e,await fN(h))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":"3","ai-model-id":this.modelId}}},fX=h4.object({videos:h4.array(h4.unknown()).optional()}).catchall(h4.unknown()),fY=h4.union([h4.object({type:h4.literal("url"),url:h4.string(),mediaType:h4.string()}),h4.object({type:h4.literal("base64"),data:h4.string(),mediaType:h4.string()})]),fQ=h4.discriminatedUnion("type",[h4.object({type:h4.literal("unsupported"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("compatibility"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("other"),message:h4.string()})]),f0=h4.discriminatedUnion("type",[h4.object({type:h4.literal("result"),videos:h4.array(fY),warnings:h4.array(fQ).optional(),providerMetadata:h4.record(h4.string(),fX).optional()}),h4.object({type:h4.literal("error"),message:h4.string(),errorType:h4.string(),statusCode:h4.number(),param:h4.unknown().nullable()})]),f1=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3"}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:r,headers:n,abortSignal:i,providerOptions:a}){var o;let s=await h0(this.config.headers());try{let{responseHeaders:l,value:u,rawValue:c}=await hX({url:this.getUrl(),headers:pV(s,null!=n?n:{},this.getModelConfigHeaders(),await h0(this.config.o11yHeaders)),body:{documents:e,query:t,...null!=r?{topN:r}:{},...a?{providerOptions:a}:{}},successfulResponseHandler:h2(f4),failedResponseHandler:h1({errorSchema:h4.any(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:u.ranking,providerMetadata:u.providerMetadata,response:{headers:l,body:c},warnings:null!=(o=u.warnings)?o:[]}}catch(e){throw await fT(e,await fN(s))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":"3","ai-model-id":this.modelId}}},f2=h4.discriminatedUnion("type",[h4.object({type:h4.literal("unsupported"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("compatibility"),feature:h4.string(),details:h4.string().optional()}),h4.object({type:h4.literal("other"),message:h4.string()})]),f4=hU(()=>hq(h4.object({ranking:h4.array(h4.object({index:h4.number(),relevanceScore:h4.number()})),warnings:h4.array(f2).optional(),providerMetadata:h4.record(h4.string(),h4.record(h4.string(),h4.unknown())).optional()}))),f5=hQ({id:"gateway.parallel_search",inputSchema:hU(()=>hq(h4.object({objective:h4.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),search_queries:h4.array(h4.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),mode:h4.enum(["one-shot","agentic"]).optional().describe('Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'),max_results:h4.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),source_policy:h4.object({include_domains:h4.array(h4.string()).optional().describe("List of domains to include in search results."),exclude_domains:h4.array(h4.string()).optional().describe("List of domains to exclude from search results."),after_date:h4.string().optional().describe("Only include results published after this date (ISO 8601 format).")}
69).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),excerpts:h4.object({max_chars_per_result:h4.number().optional().describe("Maximum characters per result."),max_chars_total:h4.number().optional().describe("Maximum total characters across all results.")}).optional().describe("Excerpt configuration for controlling result length."),fetch_policy:h4.object({max_age_seconds:h4.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.")}).optional().describe("Fetch policy for controlling content freshness.")}))),outputSchema:hU(()=>hq(h4.union([h4.object({searchId:h4.string(),results:h4.array(h4.object({url:h4.string(),title:h4.string(),excerpt:h4.string(),publishDate:h4.string().nullable().optional(),relevanceScore:h4.number().optional()}))}),h4.object({error:h4.enum(["api_error","rate_limit","timeout","invalid_input","configuration_error","unknown"]),statusCode:h4.number().optional(),message:h4.string()})])))}),f6=hQ({id:"gateway.perplexity_search",inputSchema:hU(()=>hq(h4.object({query:h4.union([h4.string(),h4.array(h4.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:h4.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:h4.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:h4.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:h4.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:h4.array(h4.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:h4.array(h4.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:h4.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:h4.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:h4.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:h4.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:h4.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}
69))),outputSchema:hU(()=>hq(h4.union([h4.object({results:h4.array(h4.object({title:h4.string(),url:h4.string(),snippet:h4.string(),date:h4.string().optional(),lastUpdated:h4.string().optional()})),id:h4.string()}),h4.object({error:h4.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:h4.number().optional(),message:h4.string()})])))}),f3={parallelSearch:(e={})=>f5(e),perplexitySearch:(e={})=>f6(e)};async function f9(){var e;return null==(e=(0,h5.getContext)().headers)?void 0:e["x-vercel-id"]}async function f8(e){let t=hs({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await (0,h5.getVercelOidcToken)(),authMethod:"oidc"}}!function(e={}){var t,r,n;let i=null,a=null,o=null!=(t=e.metadataCacheRefreshMillis)?t:3e5,s=0,l=null!=(r=null==(n=e.baseURL)?void 0:n.replace(/\/$/,""))?r:"https://ai-gateway.vercel.sh/v3/ai",u=async()=>{try{let t=await f8(e);return hn({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[fI]:t.authMethod,...e.headers},"ai-sdk/gateway/3.0.133")}catch(e){throw h7.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=()=>{let e=hs({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=hs({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),r=hs({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),n=hs({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let i=await f9();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...r&&{"ai-o11y-region":r},...i&&{"ai-o11y-request-id":i},...n&&{"ai-o11y-project-id":n}}}},d=t=>new fF(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:c()}),p=async()=>{var t,r,n;let c=null!=(n=null==(r=null==(t=e._internal)?void 0:t.currentDate)?void 0:r.call(t).getTime())?n:Date.now();return(!i||c-s>o)&&(s=c,i=new fM({baseURL:l,headers:u,fetch:e.fetch}).getAvailableModels().then(e=>(a=e,e)).catch(async e=>{throw await fT(e,await fN(await u()))})),a?Promise.resolve(a):i},h=async()=>new fM({baseURL:l,headers:u,fetch:e.fetch}).getCredits().catch(async e=>{throw await fT(e,await fN(await u()))}),f=async t=>new fR({baseURL:l,headers:u,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await fT(e,await fN(await u()))}),m=async t=>new fz({baseURL:l,headers:u,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await fT(e,await fN(await u()))}),g=function(e){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return d(e)};g.specificationVersion="v3",g.getAvailableModels=p,g.getCredits=h,g.getSpendReport=f,g.getGenerationInfo=m,g.imageModel=t=>new fq(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:c()}),g.languageModel=d;let y=t=>new fU(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:c()});g.embeddingModel=y,g.textEmbeddingModel=y,g.videoModel=t=>new fG(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:c()});let v=t=>new f1(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:c()});g.rerankingModel=v,g.reranking=v,g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=f3}();var h4=cZ,f7="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:e.g,me="1.9.0",mt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,mr=function(e){var t=new Set([e]),r=new Set,n=e.match(mt);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=i.prerelease)return function(t){return t===e};function a(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;var n=e.match(mt);if(!n)return a(e);var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=o.prerelease||i.major!==o.major)return a(e);if(0===i.major)return i.minor===o.minor&&i.patch<=o.patch?(t.add(e),!0):a(e);return i.minor<=o.minor?(t.add(e),!0):a(e)}}(me),mn=Symbol.for("opentelemetry.js.api."+me.split(".")[0]);function mi(e,t,r,n){void 0===n&&(n=!1);var i,a=f7[mn]=null!=(i=f7[mn])?i:{version:me};if(!n&&a[e]){var o=Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(o.stack||o.message),!1}if(a.version!==me){var o=Error("@opentelemetry/api: Registration of version v"+a.version+" for "+e+" does not match previously registered API v"+me);return r.error(o.stack||o.message),!1}return a[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+me+"."),!0}
69function ma(e){var t,r,n=null==(t=f7[mn])?void 0:t.version;if(n&&mr(n))return null==(r=f7[mn])?void 0:r[e]}function mo(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+me+".");var r=f7[mn];r&&delete r[e]}var ms=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,n){var i=new e(r._currentContext);return i._currentContext.set(t,n),i},r.deleteValue=function(t){var n=new e(r._currentContext);return n._currentContext.delete(t),n}},ml=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},mu=function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},mc=function(){function e(){}return e.prototype.active=function(){return ms},e.prototype.with=function(e,t,r){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return t.call.apply(t,mu([r],ml(n),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),md=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},mp=function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},mh=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 mf("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mf("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mf("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mf("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mf("verbose",this._namespace,e)},e}();function mf(e,t,r){var n=ma("diag");if(n)return r.unshift(t),n[e].apply(n,mp([],md(r),!1))}(a=ee||(ee={}))[a.NONE=0]="NONE",a[a.ERROR=30]="ERROR",a[a.WARN=50]="WARN",a[a.INFO=60]="INFO",a[a.DEBUG=70]="DEBUG",a[a.VERBOSE=80]="VERBOSE",a[a.ALL=9999]="ALL";var mm=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},mg=function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},my=function(){function e(){function e(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=ma("diag");if(n)return n[e].apply(n,mg([],mm(t),!1))}}var t=this;t.setLogger=function(e,r){if(void 0===r&&(r={logLevel:ee.INFO}),e===t){var n,i,a,o=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!=(n=o.stack)?n:o.message),!1}"number"==typeof r&&(r={logLevel:r});var s=ma("diag"),l=function(e,t){function r(r,n){var i=t[r];return"function"==typeof i&&e>=n?i.bind(t):function(){}}return e<ee.NONE?e=ee.NONE:e>ee.ALL&&(e=ee.ALL),t=t||{},{error:r("error",ee.ERROR),warn:r("warn",ee.WARN),info:r("info",ee.INFO),debug:r("debug",ee.DEBUG),verbose:r("verbose",ee.VERBOSE)}}(null!=(i=r.logLevel)?i:ee.INFO,e);if(s&&!r.suppressOverrideMessage){var u=null!=(a=Error().stack)?a:"<failed to generate stacktrace>";s.warn("Current logger will be overwritten from "+u),l.warn("Current logger will over
69write one already registered from "+u)}return mi("diag",l,t,!0)},t.disable=function(){mo("diag",t)},t.createComponentLogger=function(e){return new mh(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}(),mv=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},mb=function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},mx="context",mk=new mc,mw=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return mi(mx,e,my.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var n,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(n=this._getContextManager()).with.apply(n,mb([e,t,r],mv(i),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return ma(mx)||mk},e.prototype.disable=function(){this._getContextManager().disable(),mo(mx,my.instance())},e}();(o=et||(et={}))[o.NONE=0]="NONE",o[o.SAMPLED=1]="SAMPLED";var m_="0000000000000000",mS="00000000000000000000000000000000",mE={traceId:mS,spanId:m_,traceFlags:et.NONE},mC=function(){function e(e){void 0===e&&(e=mE),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}(),m$=Symbol.for("OpenTelemetry Context Key SPAN");function mT(e){return e.getValue(m$)||void 0}function mI(){return mT(mw.getInstance().active())}function mN(e,t){return e.setValue(m$,t)}function mA(e){return e.deleteValue(m$)}function mj(e,t){return mN(e,new mC(t))}function mM(e){var t;return null==(t=mT(e))?void 0:t.spanContext()}var mO=/^([0-9a-f]{32})$/i,mD=/^[0-9a-f]{16}$/i;function mR(e){var t,r;return t=e.traceId,mO.test(t)&&t!==mS&&(r=e.spanId,mD.test(r)&&r!==m_)}function mP(e){return new mC(e)}var mz=mw.getInstance(),mL=function(){function e(){}return e.prototype.startSpan=function(e,t,r){if(void 0===r&&(r=mz.active()),null==t?void 0:t.root)return new mC;var n,i=r&&mM(r);return"object"==typeof(n=i)&&"string"==typeof n.spanId&&"string"==typeof n.traceId&&"number"==typeof n.traceFlags&&mR(i)?new mC(i):new mC},e.prototype.startActiveSpan=function(e,t,r,n){if(!(arguments.length<2)){2==arguments.length?o=t:3==arguments.length?(i=t,o=r):(i=t,a=r,o=n);var i,a,o,s=null!=a?a:mz.active(),l=this.startSpan(e,i,s),u=mN(s,l);return mz.with(u,o,void 0,l)}},e}(),mF=new mL,mU=function(){function e(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,n){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,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):mF},e}(),mB=new(function(){function e(){}return e.prototype.getTracer=function(e,t,r){return new mL},e}()),mZ=function(){function e(){}return e.prototype.getTracer=function(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new mU(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:mB},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)},e}(),mq="trace";(function(){function e(){this._proxyTracerProvider=new mZ,this.wrapSpanContext=mP,this.isSpanContextValid=mR,this.deleteSpan=mA,this.get
69Span=mT,this.getActiveSpan=mI,this.getSpanContext=mM,this.setSpan=mN,this.setSpanContext=mj}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=mi(mq,this._proxyTracerProvider,my.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return ma(mq)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){mo(mq,my.instance()),this._proxyTracerProvider=new mZ},e})().getInstance(),(s=er||(er={}))[s.UNSET=0]="UNSET",s[s.OK=1]="OK",s[s.ERROR=2]="ERROR",mw.getInstance();var mV=Object.defineProperty,mH=(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_InvalidToolApprovalSignatureError"),Symbol.for("vercel.ai.error.AI_InvalidToolInputError"),Symbol.for("vercel.ai.error.AI_ToolCallNotFoundForApprovalError"),Symbol.for("vercel.ai.error.AI_MissingToolResultsError"),Symbol.for("vercel.ai.error.AI_NoImageGeneratedError"),"AI_NoObjectGeneratedError"),mK=`vercel.ai.error.${mH}`,mW=Symbol.for(mK),mJ=class extends ej{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:i,finishReason:a}){super({name:mH,message:e,cause:t}),this[en]=!0,this.text=r,this.response=n,this.usage=i,this.finishReason=a}static isInstance(e){return ej.hasMarker(e,mK)}};en=mW,Symbol.for("vercel.ai.error.AI_NoOutputGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSpeechGeneratedError"),Symbol.for("vercel.ai.error.AI_NoTranscriptGeneratedError"),Symbol.for("vercel.ai.error.AI_NoVideoGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSuchToolError"),Symbol.for("vercel.ai.error.AI_ToolCallRepairError");var mG="AI_UIMessageStreamError",mX=`vercel.ai.error.${mG}`,mY=Symbol.for(mX),mQ=class extends ej{constructor({chunkType:e,chunkId:t,message:r}){super({name:mG,message:r}),this[ei]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return ej.hasMarker(e,mX)}};ei=mY,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 m0=async({url:e,maxBytes:t,abortSignal:r})=>{var n;let i=e.toString();try{let e=hn({},"ai-sdk/6.0.208",ht()),a=await p4({url:i,headers:e,abortSignal:r});if(!a.ok)throw await pG(a),new p0({url:i,statusCode:a.status,statusText:a.statusText});return{data:await p5({response:a,url:i,maxBytes:null!=t?t:0x80000000}),mediaType:null!=(n=a.headers.get("content-type"))?n:void 0}}catch(e){if(p0.isInstance(e))throw e;throw new p0({url:i,cause:e})}},m1=h4.union([h4.string(),h4.instanceof(Uint8Array),h4.instanceof(ArrayBuffer),h4.custom(e=>{var t,r;return null!=(r=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&r},{message:"Must be a Buffer"})]),m2=h4.lazy(()=>h4.union([h4.null(),h4.string(),h4.number(),h4.boolean(),h4.record(h4.string(),m2.optional()),h4.array(m2)])),m4=h4.record(h4.string(),h4.record(h4.string(),m2.optional())),m5=h4.object({type:h4.literal("text"),text:h4.string(),providerOptions:m4.optional()}),m6=h4.object({type:h4.literal("image"),image:h4.union([m1,h4.instanceof(URL)]),mediaType:h4.string().optional(),providerOptions:m4.optional()}),m3=h4.object({type:h4.literal("file"),data:h4.union([m1,h4.instanceof(URL)]),filename:h4.string().optional(),mediaType:h4.string(),providerOptions:m4.optional()}),m9=h4.object({type:h4.literal("reasoning"),text:h4.string(),providerOptions:m4.optional()}),m8=h4.object({type:h4.literal("tool-call"),toolCallId:h4.string(),toolName:h4.string(),input:h4.unknown(),providerOptions:m4.optional(),providerExecuted:h4.boolean().optional()}),m7=h4.discriminatedUnion("type",[h4.object({type:h4.literal("text"),value:h4.string(),providerOptions:m4.optional()}),h4.object({type:h4.literal("json"),value:m2,providerOptions:m4.optional()}),h4.object({type:h4.literal("execution-denied"),reason:h4.string().optional(),providerOptions:m4.optional()}),h4.object({type:h4.literal("error-text"),value:h4.string(),providerOptions:m4.optional()}),h4.object({type:h4.literal("error-json"),value:m2,providerOptions:m4.optional()}),h4.object({type:h4.literal("content"),value:h4.array(h4.union([h4.object({type:h4.literal("text"),text:h4.string(),providerOptions:m4.optional()}),h4.object({type:h4.literal("media"),data:h4.string(),mediaType:h4.string()}),h4.object({type:h4.literal("file-data"),data:h4.string(),mediaType:h4.string(),filename:h4.string().optional(),providerOptions:m4.optional()}),h4.object({type:h4.literal("file-url"),url:h4.string(),providerOptions:m4.optional()}),h4.object({type:h4.literal("file-id"),fileId:h4.union([h4.string(),h4.record(h4.string(),h4.string())]),providerOptions:m4.optional()}),h4.object({type:h4.literal("image-data"),data:h4.string(),mediaType:h4.string(),providerOptions:m4.optional()}),h4.object({type:h4.literal("image-url"),url:h4.string(),providerOptions:m4.optional()}),h4.object({type:h4.literal("image-file-id"),fileId:h4.union([h4.string(),h4.record(h4.string(),h4.string())]),providerOptions:m4.optional()}),h4.object({type:h4.literal("custom"),providerOptions:m4.optional()})]))})]),ge=h4.object({type:h4.literal("tool-result"),toolCallId:h4.string(),toolName:h4.string(),output:m7,providerOptions:m4.optional()}),gt=h4.object({type:h4.literal("tool-approval-request"),approvalId:h4.string(),toolCallId:h4.string()}),gr=h4.object({type:h4.literal("tool-approval-response"),approvalId:h4.string(),approved:h4.boolean(),reason:h4.string().optional()}),gn=h4.object({role:h4.literal("system"),content:h4.string(),providerOptions:m4.optional()}),gi=h4.object({role:h4.literal("user"),content:h4.union([h4.string(),h4.array(h4.union([m5,m6,m3]))]),providerOptions:m4.optional()}),ga=h4.object({role:h4.literal("assistant"),content:h4.union([h4.string(),h4.array(h4.union([m5,m3,m9,m8,ge,gt]))]),providerOptions:m4.optional()}),go=h4.object({role:h4.literal("tool"),content:h4.array(h4.union([ge,gr])),providerOptions:m4.optional()});h4.union([gn,gi,ga,go]),new TextEncoder;var gs={},gl={array:()=>gh,choice:()=>gf,json:()=>gm,object:()=>gp,text:()=>gd};for(var gu in gl)mV(gs,gu,{get:gl[gu],enumerable:!0});async function gc(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await hW({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await hW({text:function(e){let t=["ROOT"],r=-1,n=null,i=0;function a(e,i,a){switch(e){case'"':r=i,t.pop(),t.push(a),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=i,n=i,t.pop(),t.push(a),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(a),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=i,t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"{":r=i,t.pop(),t.push(a),t.push("INSIDE_OBJECT_START");break;case"[":r=i,t.pop(),t.push(a),t.push("INSIDE_ARRAY_START")}}function o(e,n){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=n,t.pop()}}function s(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 u=e[l];switch(t[t.length-1]){case"ROOT":a(u,l,"FINISH");break;case"INSIDE_OBJECT_START":switch(u){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=l,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===u&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===u&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===u&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":a(u,l,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":o(u,l);break;case"INSIDE_STRING":switch(u){case'"':t.pop(),r=l;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=l}break;case"INSIDE_ARRAY_START":"]"===u?(r=l,t.pop()):(r=l,a(u,l,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(u){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":a(u,l,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),"u"===u?(i=0,t.push("INSIDE_STRING_UNICODE_ESCAPE")):r=l;break;case"INSIDE_STRING_UNICODE_ESCAPE":(u>="0"&&u<="9"||u>="A"&&u<="F"||u>="a"&&u<="f")&&4==++i&&(t.pop(),r=l);break;case"INSIDE_NUMBER":switch(u){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]&&s(u,l),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&o(u,l);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&o(u,l);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(u,l);break;default:t.pop()}break;case"INSIDE_LITERAL":{let i=e.substring(n,l+1);"false".startsWith(i)||"true".startsWith(i)||"null".startsWith(i)?r=l:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?o(u,l):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(u,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)})).success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"}}var gd=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e}),createElementStreamTransform(){}}),gp=({schema:e,name:t,description:r})=>{let n=hZ(e);return{name:"object",responseFormat:h0(n.jsonSchema).then(e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=r&&{description:r}})),async parseCompleteOutput({text:e},t){let r=await hW({text:e});if(!r.success)throw new mJ({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await hH({value:r.value,schema:n});if(!i.success)throw new mJ({message:"No object generated: response did not match sc
69hema.",cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await gc(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}},createElementStreamTransform(){}}},gh=({element:e,name:t,description:r})=>{let n=hZ(e);return{name:"array",responseFormat:h0(n.jsonSchema).then(e=>{let{$schema:n,...i}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}}),async parseCompleteOutput({text:e},t){let r=await hW({text:e});if(!r.success)throw new mJ({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=r.value;if(null==i||"object"!=typeof i||!("elements"in i)||!Array.isArray(i.elements))throw new mJ({message:"No object generated: response did not match schema.",cause:new e1({value:i,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 i.elements){let i=await hH({value:r,schema:n});if(!i.success)throw new mJ({message:"No object generated: response did not match schema.",cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await gc(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,i=[];for(let e of r){let t=await hH({value:e,schema:n});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},r){if(null!=t)for(;e<t.length;e++)r.enqueue(t[e])}})}}},gf=({options:e,name:t,description:r})=>({name:"choice",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 n=await hW({text:t});if(!n.success)throw new mJ({message:"No object generated: could not parse the response.",cause:n.error,text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});let i=n.value;if(null==i||"object"!=typeof i||!("result"in i)||"string"!=typeof i.result||!e.includes(i.result))throw new mJ({message:"No object generated: response did not match schema.",cause:new e1({value:i,cause:"response must be an object that contains a choice value."}),text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:t}){let r=await gc(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 n=e.filter(e=>e.startsWith(t.result));if("successful-parse"===r.state)return n.includes(t.result)?{partial:t.result}:void 0;return 1===n.length?{partial:n[0]}:void 0}}},createElementStreamTransform(){}}),gm=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){let r=await hW({text:e});if(!r.success)throw new mJ({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 gc(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}}},createElementStreamTransform(){}});p6({prefix:"aitxt",size:24}),TransformStream;var gg=h4.record(h4.string(),m2.optional()),gy=hU(()=>hq(h4.union([h4.strictObject({type:h4.literal("text-start"),id:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("text-delta"),id:h4.string(),delta:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("text-end"),id:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("error"),errorText:h4.string()}),h4.strictObject({type:h4.literal("tool-input-start"),toolCallId:h4.string(),toolName:h4.string(),providerExecuted:h4.boolean().optional(),providerMetadata:m4.optional(),toolMetadata:gg.optional(),dynamic:h4.boolean().optional(),title:h4.string().optional()}),h4.strictObject({type:h4.literal("tool-input-delta"),toolCallId:h4.string(),inputTextDelta:h4.string()}),h4.strictObject({type:h4.literal("tool-input-available"),toolCallId:h4.string(),toolName:h4.string(),input
69:h4.unknown(),providerExecuted:h4.boolean().optional(),providerMetadata:m4.optional(),toolMetadata:gg.optional(),dynamic:h4.boolean().optional(),title:h4.string().optional()}),h4.strictObject({type:h4.literal("tool-input-error"),toolCallId:h4.string(),toolName:h4.string(),input:h4.unknown(),providerExecuted:h4.boolean().optional(),providerMetadata:m4.optional(),toolMetadata:gg.optional(),dynamic:h4.boolean().optional(),errorText:h4.string(),title:h4.string().optional()}),h4.strictObject({type:h4.literal("tool-approval-request"),approvalId:h4.string(),toolCallId:h4.string(),signature:h4.string().optional()}),h4.strictObject({type:h4.literal("tool-output-available"),toolCallId:h4.string(),output:h4.unknown(),providerExecuted:h4.boolean().optional(),providerMetadata:m4.optional(),toolMetadata:gg.optional(),dynamic:h4.boolean().optional(),preliminary:h4.boolean().optional()}),h4.strictObject({type:h4.literal("tool-output-error"),toolCallId:h4.string(),errorText:h4.string(),providerExecuted:h4.boolean().optional(),providerMetadata:m4.optional(),toolMetadata:gg.optional(),dynamic:h4.boolean().optional()}),h4.strictObject({type:h4.literal("tool-output-denied"),toolCallId:h4.string()}),h4.strictObject({type:h4.literal("reasoning-start"),id:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("reasoning-delta"),id:h4.string(),delta:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("reasoning-end"),id:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("source-url"),sourceId:h4.string(),url:h4.string(),title:h4.string().optional(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("source-document"),sourceId:h4.string(),mediaType:h4.string(),title:h4.string(),filename:h4.string().optional(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.literal("file"),url:h4.string(),mediaType:h4.string(),providerMetadata:m4.optional()}),h4.strictObject({type:h4.custom(e=>"string"==typeof e&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:h4.string().optional(),data:h4.unknown(),transient:h4.boolean().optional()}),h4.strictObject({type:h4.literal("start-step")}),h4.strictObject({type:h4.literal("finish-step")}),h4.strictObject({type:h4.literal("start"),messageId:h4.string().optional(),messageMetadata:h4.unknown().optional()}),h4.strictObject({type:h4.literal("finish"),finishReason:h4.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:h4.unknown().optional()}),h4.strictObject({type:h4.literal("abort"),reason:h4.string().optional()}),h4.strictObject({type:h4.literal("message-metadata"),messageMetadata:h4.unknown()})])));function gv(){return Object.create(null)}function gb(e){return e.type.startsWith("data-")}function gx(e){return"text"===e.type}function gk(e){return e.type.startsWith("tool-")}function gw(e){return"dynamic-tool"===e.type}function g_(e){return gk(e)||gw(e)}function gS(e){return e.type.split("-").slice(1).join("-")}function gE(e){return gw(e)?e.toolName:gS(e)}function gC({lastMessage:e,messageId:t}){return{message:(null==e?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:gv(),activeReasoningParts:gv(),partialToolCalls:gv()}}function g$({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await n(async({state:n,write:l})=>{var u,c,d,p;function h(e){let t=n.message.parts.filter(g_).find(t=>t.toolCallId===e);if(null==t)throw new mQ({chunkType:"tool-invocation",chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function f(e){var t;let r=n.message.parts.find(t=>gk(t)&&t.toolCallId===e.toolCallId);if(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),void 0!==e.toolMetadata&&(r.toolMetadata=e.toolMetadata),r.providerExecuted=null!=(t=e.providerExecuted)?t:r.providerExecuted;let n=e.providerMetadata;null!=n&&("output-available"===e.state||"output-error"===e.state?r.resultProviderMetadata=n:r.callProviderMetadata=n)}else n.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},input:e.input,output:e.output,rawInput:e.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,preliminary:e.preliminary,...null!=e.providerMetadata&&("output-available"===e.state||"output-error"===e.state)?{resultProviderMetadata:e.providerMetadata}:{}
69,...null!=e.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:e.providerMetadata}:{}})}function m(e){var t,r;let i=n.message.parts.find(t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId);if(null!=i){i.state=e.state,i.toolName=e.toolName,i.input=e.input,i.output=e.output,i.errorText=e.errorText,i.rawInput=null!=(t=e.rawInput)?t:i.rawInput,i.preliminary=e.preliminary,void 0!==e.title&&(i.title=e.title),void 0!==e.toolMetadata&&(i.toolMetadata=e.toolMetadata),i.providerExecuted=null!=(r=e.providerExecuted)?r:i.providerExecuted;let n=e.providerMetadata;null!=n&&("output-available"===e.state||"output-error"===e.state?i.resultProviderMetadata=n:i.callProviderMetadata=n)}else n.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,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},...null!=e.providerMetadata&&("output-available"===e.state||"output-error"===e.state)?{resultProviderMetadata:e.providerMetadata}:{},...null!=e.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:e.providerMetadata}:{}})}async function g(e){if(null!=e){let r=null!=n.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 n={...t};for(let i in r)if("__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&Object.prototype.hasOwnProperty.call(r,i)){let a=r[i];if(void 0===a)continue;let o=i in t?t[i]:void 0,s=null!==a&&"object"==typeof a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp),l=null!=o&&"object"==typeof o&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);s&&l?n[i]=e(o,a):n[i]=a}return n}(n.message.metadata,e):e;null!=t&&await hV({value:r,schema:t,context:{field:"message.metadata",entityId:n.message.id}}),n.message.metadata=r}}switch(e.type){case"text-start":{let t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};n.activeTextParts[e.id]=t,n.message.parts.push(t),l();break}case"text-delta":{let t=n.activeTextParts[e.id];if(null==t)throw new mQ({chunkType:"text-delta",chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(u=e.providerMetadata)?u:t.providerMetadata,l();break}case"text-end":{let t=n.activeTextParts[e.id];if(null==t)throw new mQ({chunkType:"text-end",chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state="done",t.providerMetadata=null!=(c=e.providerMetadata)?c:t.providerMetadata,delete n.activeTextParts[e.id],l();break}case"reasoning-start":{let t={type:"reasoning",text:"",providerMetadata:e.providerMetadata,state:"streaming"};n.activeReasoningParts[e.id]=t,n.message.parts.push(t),l();break}case"reasoning-delta":{let t=n.activeReasoningParts[e.id];if(null==t)throw new mQ({chunkType:"reasoning-delta",chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(d=e.providerMetadata)?d:t.providerMetadata,l();break}case"reasoning-end":{let t=n.activeReasoningParts[e.id];if(null==t)throw new mQ({chunkType:"reasoning-end",chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=null!=(p=e.providerMetadata)?p:t.providerMetadata,t.state="done",delete n.activeReasoningParts[e.id],l();break}case"file":n.message.parts.push({type:"file",mediaType:e.mediaType,url:e.url,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),l();break;case"source-url":n.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),l();break;case"source-document":n.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=n.message.parts.filter(gk);n.partialToolCalls[e.toolCallId]={text:"",toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),l();break}case"tool-input-delta":{let t=n.partialToolCalls[e.toolCallId];if(null==t)throw new mQ({chunkType:"tool-input-delta",chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:r}=await gc(t.text);t.dynamic?m({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title,toolMetadata:t.toolMetadata}),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,toolMetadata:e.toolMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),l(),a&&!e.providerExecuted&&await a({toolCall:e});break;case"tool-input-error":{let t=n.message.parts.filter(g_).find(t=>t.toolCallId===e.toolCallId);(null!=t?"dynamic-tool"===t.type:e.dynamic)?m({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),l();break}case"tool-approval-request":{let t=h(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId,...null!=e.signature?{signature:e.signature}:{}},l();break}case"tool-output-denied":h(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{let t=h(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,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:gS(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"tool-output-error":{let t=h(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,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:gS(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"start-step":n.message.parts.push({type:"step-start"});break;case"finish-step":n.activeTextParts=gv(),n.activeReasoningParts=gv();break;case"start":null!=e.messageId&&(n.message.id=e.messageId),await g(e.messageMetadata),(null!=e.messageId||null!=e.messageMetadata)&&l();break;
69case"finish":null!=e.finishReason&&(n.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==i||i(Error(e.errorText));break;default:if(e.type.startsWith("data-")){if((null==r?void 0:r[e.type])!=null){let t=n.message.parts.findIndex(t=>"id"in t&&"data"in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:n.message.parts.length;await hV({value:e.data,schema:r[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}if(e.transient){null==o||o(e);break}let t=null!=e.id?n.message.parts.find(t=>e.type===t.type&&e.id===t.id):void 0;null!=t?t.data=e.data:n.message.parts.push(e),null==o||o(e),l()}}s.enqueue(e)})}}))}async function gT({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()}}p6({prefix:"aitxt",size:24});var gI=h4.record(h4.string(),m2.optional());function gN(e){return({url:t,abortSignal:r})=>m0({url:t,maxBytes:null==e?void 0:e.maxBytes,abortSignal:r})}hU(()=>hq(h4.array(h4.object({id:h4.string(),role:h4.enum(["system","user","assistant"]),metadata:h4.unknown().optional(),parts:h4.array(h4.union([h4.object({type:h4.literal("text"),text:h4.string(),state:h4.enum(["streaming","done"]).optional(),providerMetadata:m4.optional()}),h4.object({type:h4.literal("reasoning"),text:h4.string(),state:h4.enum(["streaming","done"]).optional(),providerMetadata:m4.optional()}),h4.object({type:h4.literal("source-url"),sourceId:h4.string(),url:h4.string(),title:h4.string().optional(),providerMetadata:m4.optional()}),h4.object({type:h4.literal("source-document"),sourceId:h4.string(),mediaType:h4.string(),title:h4.string(),filename:h4.string().optional(),providerMetadata:m4.optional()}),h4.object({type:h4.literal("file"),mediaType:h4.string(),filename:h4.string().optional(),url:h4.string(),providerMetadata:m4.optional()}),h4.object({type:h4.literal("step-start")}),h4.object({type:h4.string().startsWith("data-"),id:h4.string().optional(),data:h4.unknown()}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("input-streaming"),input:h4.unknown().optional(),providerExecuted:h4.boolean().optional(),callProviderMetadata:m4.optional(),output:h4.never().optional(),errorText:h4.never().optional(),approval:h4.never().optional()}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("input-available"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.never().optional()}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("approval-requested"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.never().optional(),reason:h4.never().optional(),signature:h4.string().optional()})}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("approval-responded"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.boolean(),reason:h4.string().optional(),signature:h4.string().optional()})}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("output-available"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.unknown(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),resultProviderMetadata:m4.optional(),preliminary:h4.boolean().optional(),approval:h4.object({id:h4.string(),approved:h4.literal(!0),reason:h4.string().optional(),signature:h4.string().optional()}).optional()}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("output-error"),input:h4.unknown().optional(),rawInput:h4.unknown().optional(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.string(),callProviderMetadata:m4.optional(),resultProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.literal(!0),reason:h4.string().optional(),signature:h4.string().optional()}).optional()}),h4.object({type:h4.literal("dynamic-tool"),toolName:h4.string(),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("output-denied"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.literal(!1),reason:h4.string().optional(),signature:h4.string().optional()})}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("input-streaming"),providerExecuted:h4.boolean().optional(),callProviderMetadata:m4.optional(),input
69:h4.unknown().optional(),output:h4.never().optional(),errorText:h4.never().optional(),approval:h4.never().optional()}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("input-available"),providerExecuted:h4.boolean().optional(),input:h4.unknown(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.never().optional()}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("approval-requested"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.never().optional(),reason:h4.never().optional(),signature:h4.string().optional()})}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("approval-responded"),input:h4.unknown(),providerExecuted:h4.boolean().optional(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.boolean(),reason:h4.string().optional(),signature:h4.string().optional()})}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("output-available"),providerExecuted:h4.boolean().optional(),input:h4.unknown(),output:h4.unknown(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),resultProviderMetadata:m4.optional(),preliminary:h4.boolean().optional(),approval:h4.object({id:h4.string(),approved:h4.literal(!0),reason:h4.string().optional(),signature:h4.string().optional()}).optional()}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("output-error"),providerExecuted:h4.boolean().optional(),input:h4.unknown().optional(),rawInput:h4.unknown().optional(),output:h4.never().optional(),errorText:h4.string(),callProviderMetadata:m4.optional(),resultProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.literal(!0),reason:h4.string().optional(),signature:h4.string().optional()}).optional()}),h4.object({type:h4.string().startsWith("tool-"),toolCallId:h4.string(),toolMetadata:gI.optional(),state:h4.literal("output-denied"),providerExecuted:h4.boolean().optional(),input:h4.unknown(),output:h4.never().optional(),errorText:h4.never().optional(),callProviderMetadata:m4.optional(),approval:h4.object({id:h4.string(),approved:h4.literal(!1),reason:h4.string().optional(),signature:h4.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty"))),p6({prefix:"aiobj",size:24});var gA=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 gj(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 n=new FileReader;n.onload=e=>{var r;t(null==(r=e.target)?void 0:r.result)},n.onerror=e=>r(e),n.readAsDataURL(e)})}}))}p6({prefix:"aiobj",size:24}),gN(),Symbol.for("vercel.ai.error.AI_NoSuchProviderError"),gN();var gM=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){var r,n,i,a,o;let s=await h0(this.body),l=await h0(this.headers),u=await h0(this.credentials),c={...hr(l),...hr(t.headers)},d=await (null==(r=this.prepareSendMessagesRequest)?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...s,...t.body},headers:c,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=null!=(n=null==d?void 0:d.api)?n:this.api,h=(null==d?void 0:d.headers)!==void 0?hr(d.headers):c,f=(null==d?void 0:d.body)!==void 0?d.body:{...s,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},m=null!=(i=null==d?void 0:d.credentials)?i:u,g=null!=(a=this.fetch)?a:globalThis.fetch,y=await g(p,{method:"POST",headers:{"Content-Type":"application/json",...h},body:JSON.stringify(f),credentials:m,signal:e});if(!y.ok)throw Error(null!=(o=await y.text())?o:"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,n,i,a;let o=await h0(this.body),s=await h0(this.headers),l=await h0(this.credentials),u={...hr(s),...hr(e.headers)},c=await (null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...o,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),d=null!=(r=null==c?void 0:c.api)?r:`${this.api}/${e.chatId}/stream`,p=(null==c?void 0:c.headers)!==void 0?hr(c.headers):u,h=null!=(n=null==c?void 0:c.credentials)?n:l,f=null!=(i=this.fetch)?i:globalThis.fetch,m=await f(d,{method:"GET",headers:p,credentials:h});if(204===m.status)return null;if(!m.ok)throw Error(null!=(a=await m.text())?a:"Failed to fetch the chat response.");if(!m.body)throw Error("The response body is empty.");return this.processResponseStream(m.body)}},gO=class extends gM{constructor(e={}){super(e)}
69processResponseStream(e){return hJ({stream:e,schema:gy}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},gD=class{constructor({generateId:e=p3,id:t=e(),transport:r=new gO,messageMetadataSchema:n,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:l,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new gA,this.sendMessage=async(e,t)=>{var r,n,i,a;let o;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(r=this.lastMessage)?void 0:r.id,...t});if(o="text"in e||"files"in e?{parts:[...Array.isArray(e.files)?e.files:await gj(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,{...o,id:e.messageId,role:null!=(n=o.role)?n:"user",metadata:e.metadata})}else this.state.pushMessage({...o,id:null!=(i=o.id)?i:this.generateId(),role:null!=(a=o.role)?a:"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,options:n})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=n=>g_(n)&&"approval-requested"===n.state&&n.approval.id===e?{...n,state:"approval-responded",approval:{id:e,approved:t,reason:r}}:n;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id,...n})})}),this.addToolOutput=async({state:e="output-available",toolCallId:t,output:r,errorText:n,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>g_(i)&&i.toolCallId===t?{...i,state:e,output:r,errorText:n}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id,...i})})}),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=n,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=c}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 shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&"object"==typeof e&&"then"in e?await e:e}
69async makeRequest({trigger:e,metadata:t,headers:r,body:n,messageId:i}){var a,o,s;let l;if("resume-stream"===e)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(null==e)return;l=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,c=!1,d=!1,p=!1;try{let a,o={state:gC({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};o.abortController.signal.addEventListener("abort",()=>{c=!0}),this.activeResponse=o,a="resume-stream"===e?l:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:i});let s=e=>this.jobExecutor.run(()=>e({state:o.state,write:()=>{var e;this.setStatus({status:"streaming"}),o.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,o.state.message):this.state.pushMessage(o.state.message)}}));
69await gT({stream:g$({stream:a,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:s,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:"ready"})}catch(e){if(c||"AbortError"===e.name)return c=!0,this.setStatus({status:"ready"}),null;p=!0,e instanceof TypeError&&(e.message.toLowerCase().includes("fetch")||e.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{null==(o=this.onFinish)||o.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:p,finishReason:null==(a=this.activeResponse)?void 0:a.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:null==(s=this.lastMessage)?void 0:s.id,metadata:t,headers:r,body:n})}},gR=e.i(561866),gP=e.i(802239);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],211671);var gz=Object.prototype.hasOwnProperty;let gL=new WeakMap,gF=()=>{},gU=gF(),gB=Object,gZ=e=>e===gU,gq=(e,t)=>({...e,...t}),gV={},gH={},gK="undefined",gW=typeof window!=gK,gJ=typeof document!=gK,gG=gW&&"Deno"in window,gX=(e,t)=>{let r=gL.get(e);return[()=>!gZ(t)&&e.get(t)||gV,n=>{if(!gZ(t)){let i=e.get(t);t in gH||(gH[t]=i),r[5](t,gq(i,n),i||gV)}},r[6],()=>!gZ(t)&&t in gH?gH[t]:!gZ(t)&&e.get(t)||gV]},gY=!0,[gQ,g0]=gW&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[gF,gF],g1={initFocus:e=>(gJ&&document.addEventListener("visibilitychange",e),gQ("focus",e),()=>{gJ&&document.removeEventListener("visibilitychange",e),g0("focus",e)}),initReconnect:e=>{let t=()=>{gY=!0,e()},r=()=>{gY=!1};return gQ("online",t),gQ("offline",r),()=>{g0("online",t),g0("offline",r)}}},g2=!e_.default.useId,g4=!gW||gG,g5=g4?e_.useEffect:e_.useLayoutEffect,g6="u">typeof navigator&&navigator.connection,g3=!g4&&g6&&(["slow-2g","2g"].includes(g6.effectiveType)||g6.saveData),g9=new WeakMap,g8=(e,t)=>e===`[object ${t}]`,g7=0,ye=e=>{let t,r,n=typeof e,i=gB.prototype.toString.call(e),a=g8(i,"Date"),o=g8(i,"RegExp"),s=g8(i,"Object");if(gB(e)!==e||a||o)t=a?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=g9.get(e))return t;if(t=++g7+"~",g9.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=ye(e[r])+",";g9.set(e,t)}if(s){t="#";let n=gB.keys(e).sort();for(;!gZ(r=n.pop());)gZ(e[r])||(t+=r+":"+ye(e[r])+",");g9.set(e,t)}}return t},yt=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)?ye(e):"",t]},yr=0,yn=()=>++yr;async function yi(...e){let[t,r,n,i]=e,a=gq({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),o=a.populateCache,s=a.rollbackOnError,l=a.optimisticData,u=a.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(c))}return c(r);async function c(r){let i,[c]=yt(r);if(!c)return;let[d,p]=gX(t,c),[h,f,m,g]=gL.get(t),y=()=>{let e=h[c];return("function"==typeof a.revalidate?a.revalidate(d().data,r):!1!==a.revalidate)&&(delete m[c],delete g[c],e&&e[0])?e[0](2).then(()=>d().data):d().data};if(e.length<3)return y();let v=n,b=!1,x=yn();f[c]=[x,0];let k=!gZ(l),w=d(),_=w.data,S=w._c,E=gZ(S)?_:S;if(k&&p({data:l="function"==typeof l?l(E,_):l,_c:E}),"function"==typeof v)try{v=v(E)}catch(e){i=e,b=!0}if(v&&"function"==typeof v.then){let e;if(v=await v.catch(e=>{i=e,b=!0}),x!==f[c][0]){if(b)throw i;return v}b&&k&&(e=i,"function"==typeof s?s(e):!1!==s)&&(o=!0,p({data:E,_c:gU}))}if(o&&!b&&("function"==typeof o?p({data:o(v,E),error:gU,_c:gU}):p({data:v,error:gU,_c:gU})),f[c][1]=yn(),Promise.resolve(y()).then(()=>{p({_c:gU})}),b){if(u)throw i;return}return v}}let ya=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},yo=(e,t)=>{if(!gL.has(e)){let r=gq(g1,t),n=Object.create(null),i=yi.bind(gU,e),a=gF,o=Object.create(null),s=(e,t)=>{let r=o[e]||[];return o[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},l=(t,r,n)=>{e.set(t,r);let i=o[t];if(i)for(let e of i)e(r,n)},u=()=>{if(!gL.has(e)&&(gL.set(e,[n,Object.create(null),Object.create(null),Object.create(null),i,l,s]),!g4)){let t=r.initFocus(setTimeout.bind(gU,ya.bind(gU,n,0))),i=r.initReconnect(setTimeout.bind(gU,ya.bind(gU,n,1)));a=()=>{t&&t(),i&&i(),gL.delete(e)}}};return u(),[e,i,u,a]}
69return[e,gL.get(e)[4]]},[ys,yl]=yo(new Map),yu=gq({onLoadingSlow:gF,onSuccess:gF,onError:gF,onErrorRetry:(e,t,r,n,i)=>{let a=r.errorRetryCount,o=i.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*r.errorRetryInterval;(gZ(a)||!(o>a))&&setTimeout(n,s,i)},onDiscarded:gF,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:g3?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:g3?5e3:3e3,compare:function e(t,r){var n,i;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((i=t.length)===r.length)for(;i--&&e(t[i],r[i]););return -1===i}if(!n||"object"==typeof t){for(n in i=0,t)if(gz.call(t,n)&&++i&&!gz.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===i}}return t!=t&&r!=r},isPaused:()=>!1,cache:ys,mutate:yl,fallback:{}},{isOnline:()=>gY,isVisible:()=>{let e=gJ&&document.visibilityState;return gZ(e)||"hidden"
69!==e}}),yc=(0,e_.createContext)({});e.i(211671);let yd=gW&&window.__SWR_DEVTOOLS_USE__;(yd?window.__SWR_DEVTOOLS_USE__:[]).concat(e=>(t,r,n)=>{let i=r&&((...e)=>{let[n]=yt(t),[,,,i]=gL.get(ys);if(n.startsWith("$inf$"))return r(...e);let a=i[n];return gZ(a)?r(...e):(delete i[n],a)});return e(t,i,n)}),yd&&(window.__SWR_DEVTOOLS_REACT__=e_.default);let yp=()=>{},yh=yp(),yf=(new WeakMap,e_.default.use||(e=>{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}})),ym={dedupe:!0},yg=Promise.resolve(gU);gB.defineProperty(e=>{let{value:t}=e,r=(0,e_.useContext)(yc),n="function"==typeof t,i=(0,e_.useMemo)(()=>n?t(r):t,[n,r,t]),a=(0,e_.useMemo)(()=>n?i:((e,t)=>{let r=gq(e,t);if(t){let{use:n,fallback:i}=e,{use:a,fallback:o}=t;n&&a&&(r.use=n.concat(a)),i&&o&&(r.fallback=gq(i,o))}return r})(r,i),[n,r,i]),o=i&&i.provider,s=(0,e_.useRef)(gU);o&&!s.current&&(s.current=yo(o(a.cache||ys),i));let l=s.current;return l&&(a.cache=l[0],a.mutate=l[1]),g5(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,e_.createElement)(yc.Provider,gq(e,{value:a}))},"defaultValue",{value:yu});var yy=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},yv=(e,t,r)=>(yy(e,t,"read from private field"),r?r.call(e):t.get(e)),yb=(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)},yx=(e,t,r,n)=>(yy(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),yk=class{constructor(e=[]){yb(this,ea,void 0),yb(this,eo,"ready"),yb(this,es,void 0),yb(this,el,new Set),yb(this,eu,new Set),yb(this,ec,new Set),this.pushMessage=e=>{yx(this,ea,yv(this,ea).concat(e)),yv(this,ed).call(this)},this.popMessage=()=>{yx(this,ea,yv(this,ea).slice(0,-1)),yv(this,ed).call(this)},this.replaceMessage=(e,t)=>{yx(this,ea,[...yv(this,ea).slice(0,e),this.snapshot(t),...yv(this,ea).slice(e+1)]),yv(this,ed).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{let r=t?null!=t?(0,gR.default)(e,t):e:e;return yv(this,el).add(r),()=>{yv(this,el).delete(r)}},this["~registerStatusCallback"]=e=>(yv(this,eu).add(e),()=>{yv(this,eu).delete(e)}),this["~registerErrorCallback"]=e=>(yv(this,ec).add(e),()=>{yv(this,ec).delete(e)}),yb(this,ed,()=>{yv(this,el).forEach(e=>e())}),yb(this,ep,()=>{yv(this,eu).forEach(e=>e())}),yb(this,eh,()=>{yv(this,ec).forEach(e=>e())}),yx(this,ea,e)}get status(){return yv(this,eo)}set status(e){yx(this,eo,e),yv(this,ep).call(this)}get error(){return yv(this,es)}set error(e){yx(this,es,e),yv(this,eh).call(this)}get messages(){return yv(this,ea)}set messages(e){yx(this,ea,[...e]),yv(this,ed).call(this)}};ea=new WeakMap,eo=new WeakMap,es=new WeakMap,el=new WeakMap,eu=new WeakMap,ec=new WeakMap,ed=new WeakMap,ep=new WeakMap,eh=new WeakMap;var yw=class extends gD{constructor({messages:e,...t}){const r=new yk(e);super({...t,state:r}),yb(this,ef,void 0),this["~registerMessagesCallback"]=(e,t)=>yv(this,ef)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>yv(this,ef)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>yv(this,ef)["~registerErrorCallback"](e),yx(this,ef,r)}};ef=new WeakMap;var y_=e_,yS=e.i(526732),yE=e_,yC=e.i(618566);let y$=String.raw`\[[a-z0-9]+(?:_[a-z0-9]+)+\](?!\()`,yT=RegExp(`[ ]${y$}[ ]`,"g"),yI=RegExp(`(^| 70)[ ]*${y$}[ ]*(?= 71|$)`,"g");function yN(e){return e?e.replace(yT," ").replace(yI,(e,t)=>t):e}function yA(e,t="pin-top"){if(!e)return;let r=function(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}(e);if(!r)return;let n=()=>{let n=r.getBoundingClientRect(),i=e.getBoundingClientRect(),a=i.top-n.top+r.scrollTop,o=r.clientHeight,s=r.scrollHeight-o;return Math.max(0,Math.min("pin-top"===t?a-12:i.height<.7*o?a-Math.max(24,(o-i.height)/2):a-24,s))};r.scrollTo({top:n(),behavior:"auto"});let i=0,a=()=>{let e=n();Math.abs(e-r.scrollTop)>8&&r.scrollTo({top:e,behavior:"auto"}),++i<12&&window.requestAnimationFrame(a)};window.requestAnimationFrame(a)}var yj=e.i(174080),yM=e.i(991094),yO=e.i(918789),yD=e.i(821901);let yR=new Set(["bar","horizontal_bar","stacked_bar","line","area","stacked_area","pie","donut","radar","scatter","bubble","funnel","composed","treemap"]),yP=new Set(["","json","chart","datachart","chartjson"]),yz=/```([A-Za-z0-9_+-]*)[^\S\n]*\n([\s\S]*?)```/g;function yL(e){let t;if(!e||!e.includes("```")||!e.includes("chartType"))return null;for(yz.lastIndex=0;null!==(t=yz.exec(e));){let r;if(!yP.has(t[1].toLowerCase()))continue;try{r=JSON.parse(t[2].trim())}catch{continue}let n=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.chartType||!Array.isArray(e.data)||0===e.data.length)return null;let t=[];for(let r of e.data){if(!r||"object"!=typeof r||Array.isArray(r))return null;let e="string"==typeof r.name||"string"==typeof r.label,n=Object.values(r).some(e=>"number"==typeof e&&Number.isFinite(e));if(!e||!n)return null;t.push(void 0===r.name&&"string"==typeof r.label?{...r,name:r.label}:r)}let r=e=>"string"==typeof e&&e.trim()?e:void 0,n=e=>Array.isArray(e)&&e.every(e=>"string"==typeof e)?e:void 0;return{title:r(e.title)??"",chartType:yR.has(e.chartType)?e.chartType:"bar",data:t,seriesNames:n(e.seriesNames),xAxisLabel:r(e.xAxisLabel),yAxisLabel:r(e.yAxisLabel),valuePrefix:r(e.valuePrefix),valueSuffix:r(e.valueSuffix
71),colors:n(e.colors)}}(r);if(n)return{chart:n,rest:(e.slice(0,t.index)+e.slice(t.index+t[0].length)).replace(/\n{3,}/g,"\n\n").trim()}}return null}var yF=e.i(875011);function yU(e,t){return Array.from({length:t},(t,r)=>({atMs:7e3*r,key:`wait.${e}.${r}`}))}let yB={send:yU("send",2),routing:yU("routing",2),search:yU("search",3),answerFromWeb:yU("answerFromWeb",2),answer:yU("answer",2),code:yU("code",2),diagram:yU("diagram",2),chart:yU("chart",2),list:yU("list",2),document:yU("document",2),findImages:yU("findImages",2),drawImage:yU("drawImage",2),lookup:yU("lookup",2),shopping:yU("shopping",2)},yZ={send:0,routing:1,search:2,answerFromWeb:3,answer:3,code:4,diagram:4,chart:4,list:4,document:4,findImages:4,drawImage:4,lookup:4,shopping:4};function yq(e,t){return yZ[t]>=yZ[e]?t:e}let yV={webSearch:"search",webContext:"search",runPython:"code",generateArtifact:"code",mermaidDiagram:"diagram",dataChart:"chart",ganttChart:"chart",listGenerator:"list",readDocument:"document",createDocuments:"document",analyzeDocuments:"document",imageSearch:"findImages",generateImage:"drawImage",currency:"lookup",countryInfo:"lookup",location:"lookup",localSearch:"lookup",weather:"lookup",regulatoryCalculator:"lookup",knowledgeBase:"lookup",comparePrices:"shopping"};function yH(e,t,r,n=7e3){let i=t?.trim()||void 0;if(!i)return{shown:void 0,recheckInMs:null};if(!e)return{shown:{line:i,since:r},recheckInMs:null};if(e.line===i)return{shown:e,recheckInMs:null};let a=r-e.since;return a>=n?{shown:{line:i,since:r},recheckInMs:null}:{shown:e,recheckInMs:n-a}}var yK=e.i(845966),yW=e.i(83859),yJ=e.i(660142),yG=e.i(753536);function yX(){return(0,ew.jsx)("span",{"aria-hidden":"true",className:"inline-block h-3 w-[7px] translate-y-[1px] bg-gray-400 dark:bg-gray-500",style:{animation:"cursor-blink 0.4s step-end infinite"}})}function yY({realMessages:e,startComplete:t=!1}={}){let{displayed:r,isStalled:n}=function(e,t=!1){let r=t?e[e.length-1]??"":"",[n,i]=(0,e_.useState)(r),[a,o]=(0,e_.useState)(!!r),s=(0,e_.useRef)(r?{target:r,pos:r.length,lastList:[...e]}:{target:"",pos:0,lastList:[]}),l=(0,e_.useRef)(r),u=(0,e_.useRef)(r.length),c=(0,e_.useRef)(0),d=(0,e_.useCallback)(function e(){let t=l.current;if(u.current>=t.length){s.current={...s.current,pos:u.current},o(!0);return}u.current=Math.min(u.current+2,t.length),i(t.slice(0,u.current)),s.current={...s.current,pos:u.current},u.current<t.length?c.current=setTimeout(e,32):o(!0)},[]);return(0,e_.useEffect)(()=>()=>clearTimeout(c.current),[]),(0,e_.useEffect)(()=>{let t=function(e,t){if(0===t.length)return null;let r=0;for(;r<e.lastList.length&&r<t.length&&e.lastList[r]===t[r];)r++;let n=[],i=r>0?t[r-1]:e.lastList[e.lastList.length-1];for(let e of t.slice(r))e!==i&&n.push(e),i=e;if(0===n.length)return r===e.lastList.length&&r===t.length?null:{state:{...e,lastList:[...t]},wiped:!1,typed:!1};let{target:a,pos:o}=e,s=!1;for(let e of n)0===a.length?a=e:(a=e,o=0,s=!0);return{state:{target:a,pos:o,lastList:[...t]},wiped:s,typed:!0}}({...s.current,pos:u.current,target:l.current},e);!t||(s.current=t.state,t.typed&&(l.current=t.state.target,u.current=t.state.pos,t.wiped&&i(""),o(!1),clearTimeout(c.current),c.current=setTimeout(d,32)))},[e,d]),{displayed:n,isStalled:a}}(e??[],t),i=(0,eS.useTranslations)("chat");return r?(0,ew.jsxs)("div",{className:"overflow-hidden",role:"status","aria-label":i("a11y.thinking"),children:[(0,ew.jsx)("span",{"aria-hidden":"true",className:"thinking-text text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap inline-block max-w-[calc(100%-12px)] overflow-hidden text-ellipsis align-bottom","data-stalled":n?"true":void 0,children:r}),(0,ew.jsx)(yX,{})]}):null}function yQ({realMessages:e}={}){return(0,ew.jsx)("div",{className:"flex min-h-[40px] items-start px-2 sm:px-3 py-1",children:(0,ew.jsx)("div",{className:"min-w-0 flex-1 flex items-center py-2",children:(0,ew.jsx)(yY,{realMessages:e})})})}var y0=e.i(878894),y1=e.i(248256),y2=e.i(810980),y4=e.i(921557),y5=e.i(178583),y6=e.i(475254);let y3=(0,y6.default)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),y9=(0,y6.default)("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);var y8=e.i(758472),y7=e.i(14),ve=e.i(82735),vt=e.i(735501),vr=e.i(278716),vn=e.i(779334),vi=e.i(961888),va=e.i(529426),vo=e.i(915505),vs=e.i(346897),vl=e.i(805899),vu=e.i(961555),vc=e.i(923426),vd=e.i(190833),vp=e.i(341240),vh=e.i(640524),vf=e.i(217923);let vm=(0,y6.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);var vg=e.i(448876),vy=e.i(647780);let vv=(0,y6.default)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);var vb=e.i(778917),vx=e.i(788699),vk=e.i(174886);let vw=(0,y6.default)("text-select",[["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M9 3h1",key:"1yesri"}]]);var v_=e.i(662031),vS=e.i(365582);let vE=(0,y6.default)("bookmark",[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]]),vC=(0,y6.default)("locate-fixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}
71],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var v$=e.i(16715),vT=e.i(727612),vI=e.i(952571),vN=e.i(195116),vA=e.i(575822),vj=e.i(412222),vM=e.i(308392),vO=e.i(519455),vD=e.i(993344),vR=e.i(851847),vP=e.i(928517);let vz=/\[User uploaded file: "(.+?)" \(document ID: ([a-f0-9-]+)\)\]/g;function vL(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}let vF=e=>Array.isArray(e)?e.map(e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n="string"==typeof t.pageUrl?t.pageUrl:"",i="string"==typeof t.thumbnailSrc?t.thumbnailSrc:"";if(!n)return"";let a=i?` `:"";return`- ${a}[${r||n}](${n})`}).filter(Boolean).join("\n"):"",vU={listGenerator:e=>{var t;let r=vL(e);return r?(Array.isArray(t=r.items)?t.filter(e=>"string"==typeof e):[]).join("\n\n"):""},generateImage:e=>{let t=vL(e);if(!t||!0!==t.success||"string"!=typeof t.documentId)return"";let r="string"==typeof t.filename?t.filename:"generated-image";return``},imageSearch:vF,thumbnailSrc:vF,videoSearch:e=>Array.isArray(e)?e.map(e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n="string"==typeof t.url?t.url:"",i="string"==typeof t.sourceDomain?t.sourceDomain:"";if(!n)return"";let a=i?` â ${i}`:"";return`- [${r||n}](${n})${a}`}).filter(Boolean).join("\n"):"",newsSearch:e=>(Array.isArray(e)?e:Array.isArray(vL(e)?.articles)?vL(e).articles:[]).map(e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n="string"==typeof t.url?t.url:"",i="string"==typeof t.sourceDomain?t.sourceDomain:"";if(!n)return"";let a=i?` â ${i}`:"";return`- [${r||n}](${n})${a}`}).filter(Boolean).join("\n"),webSearch:e=>Array.isArray(e)?e.map(e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n="string"==typeof t.url?t.url:"",i="string"==typeof t.description?t.description:"";if(!n)return"";let a=i?` â ${i}`:"";return`- [${r||n}](${n})${a}`}).filter(Boolean).join("\n"):"",copyableText:e=>{let t=vL(e);return t?(0,vP.copyableMarkdown)(t):""},mermaidDiagram:e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.code?t.code:"";if(!r)return"";let n="string"==typeof t.title?t.title:"",i=n?`**${n}** 72 73`:"";return`${i}\`\`\`mermaid 74${r} 75\`\`\``},runPython:e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.code?t.code:"",n="string"==typeof t.stdout?t.stdout:"";return[r?`\`\`\`python 76${r} 77\`\`\``:"",n.trim()?`\`\`\` 78${n.trim()} 79\`\`\``:""].filter(Boolean).join("\n\n")},generateArtifact:e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n="string"==typeof t.code?t.code:"";if(!n)return"";let i=r?`**${r}** 80 81`:"";return`${i}\`\`\` 82${n} 83\`\`\``},ganttChart:e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n=Array.isArray(t.tasks)?t.tasks:[],i="string"==typeof t.unit?t.unit:"days";if(0===n.length)return r?`**${r}**`:"";let a=n.map(e=>vL(e)).filter(e=>null!==e).map(e=>{let t="string"==typeof e.name?e.name:"",r="number"==typeof e.start?e.start:"",n="number"==typeof e.duration?e.duration:"",i="string"==typeof e.section?e.section:"";return`| ${t} | ${i} | ${r} | ${n} |`}),o=r?`**${r}** 84 85`:"";return`${o}| Task | Section | Start (${i}) | Duration (${i}) | 86| --- | --- | --- | --- | 87${a.join("\n")}`},dataChart:e=>{let t=vL(e);if(!t)return"";let r="string"==typeof t.title?t.title:"",n=Array.isArray(t.data)?t.data:[];if(0===n.length)return r?`**${r}**`:"";let i=n.map(e=>vL(e)).filter(e=>null!==e).map(e=>{let t="string"==typeof e.name?e.name:"",r="number"==typeof e.value?e.value:"";return`| ${t} | ${r} |`}),a=r?`**${r}** 88 89`:"";return`${a}| Name | Value | 90| --- | --- | 91${i.join("\n")}`}};function vB(e,t){let r=[];for(let n of e){if(gx(n)){let e=t.isUser?n.text.replace(vz,"").trim():t.stripText?t.stripText(n.text):n.text;e&&r.push(e);continue}if(g_(n)){if("output-available"!==n.state)continue;let e=vU[gE(n)];if(!e)continue;let t=e(n.output).trim();t&&r.push(t)}}return r.join("\n\n")}var vZ=e.i(262794),vq=e.i(664659),vV=e.i(463059),vH=e.i(398361),vK=e.i(440160),vW=e.i(37727),vJ=e.i(885425),vG=e.i(495416);function vX({data:e}){let[t,r]=(0,e_.useState)(!0),[n,i]=(0,e_.useState)(!1),a=(0,e_.useRef)(null),o=(0,e_.useRef)(null),s="complete"===e.status,l=(0,e_.useRef)(s),u=(0,e_.useCallback)(()=>{let t=new Blob([e.content],{type:"text/markdown;charset=utf-8"}),r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=`analysis-${new Date().toISOString().slice(0,10)}.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)},[e.content]);(0,e_.useEffect)(()=>{s&&!l.current&&r(!1),l.current=s},[s]),(0,e_.useEffect)(()=>{t&&a.current&&!s&&(a.current.scrollTop=a.current.scrollHeight)},[e.content,t,s]),(0,e_.useEffect)(()=>{n&&o.current&&!s&&(o.current.scrollTop=o.current.scrollHeight)},[e.content,n,s]),(0,e_.useEffect)(()=>
91{if(!n)return;let e=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),(0,vG.useOverlayClose)(n,(0,e_.useCallback)(()=>i(!1),[]));let c="analyzing"===e.status?`Analyzing document ${e.currentDoc}/${e.totalDocs}...`:"synthesizing"===e.status?"Synthesizing findings...":`Analysis complete (${e.totalDocs} document${1!==e.totalDocs?"s":""})`;return n?(0,ew.jsxs)(vJ.FullscreenOverlay,{className:"flex flex-col bg-white dark:bg-gray-900",children:[(0,ew.jsxs)("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-gray-200 px-4 dark:border-gray-700",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ew.jsx)(y9,{className:"h-3.5 w-3.5 text-accent-text"}),(0,ew.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:c}),!s&&(0,ew.jsx)("span",{className:"h-2 w-2 shrink-0 animate-pulse rounded-full bg-accent-solid"})]}),(0,ew.jsxs)("div",{className:"flex items-center gap-1",children:[s&&(0,ew.jsxs)(vj.Button,{size:"xs",color:"gray",onClick:u,children:[(0,ew.jsx)(vK.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]}),(0,ew.jsxs)(vj.Button,{size:"xs",color:"gray",onClick:()=>i(!1),children:[(0,ew.jsx)(vW.X,{className:"mr-1.5 h-3.5 w-3.5"}),"Close"]})]})]}),(0,ew.jsx)("div",{ref:o,className:"flex-1 overflow-y-auto px-4 py-4",children:(0,ew.jsx)("div",{className:"prose prose-sm prose-gray mx-auto max-w-3xl dark:prose-invert",children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:e.content})})})]}):(0,ew.jsxs)("div",{className:`my-2 overflow-hidden rounded-lg border ${s?"border-accent-border":"border-accent-border-strong"}`,children:[(0,ew.jsxs)("div",{className:"flex items-center !bg-accent-surface",children:[(0,ew.jsxs)(vj.Button,{color:"gray",size:"sm",onClick:()=>r(!t),className:"flex-1 justify-start !rounded-none !border-0 !bg-accent-surface text-left",children:[(0,ew.jsx)(y9,{className:"mr-2 h-3.5 w-3.5 shrink-0 text-accent-text"}),(0,ew.jsx)("span",{className:"flex-1 font-medium text-accent-text-strong",children:c}),!s&&(0,ew.jsx)("span",{className:"ml-2 h-2 w-2 shrink-0 animate-pulse rounded-full bg-accent-solid"}),t?(0,ew.jsx)(vq.ChevronDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 text-accent-text"}):(0,ew.jsx)(vV.ChevronRight,{className:"ml-2 h-3.5 w-3.5 shrink-0 text-accent-text"})]}),(0,ew.jsxs)("div",{className:"flex items-center gap-1 pr-2",children:[s&&(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:u,className:"!bg-accent-surface !p-1",children:(0,ew.jsx)(vK.Download,{className:"h-3.5 w-3.5 text-accent-text"})}),(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:()=>i(!0),className:"!bg-accent-surface !p-1",children:(0,ew.jsx)(vH.Maximize2,{className:"h-3.5 w-3.5 text-accent-text"})})]})]}),(0,ew.jsx)("div",{className:"transition-[grid-template-rows] duration-200 ease-in-out",style:{display:"grid",gridTemplateRows:t?"1fr":"0fr"},children:(0,ew.jsx)("div",{className:"overflow-hidden",children:(0,ew.jsx)("div",{ref:a,className:`max-h-[400px] overflow-y-auto border-t px-4 py-3 ${s?"border-accent-border":"border-accent-border-strong"}`,children:(0,ew.jsx)("div",{className:"prose prose-sm prose-gray max-w-none dark:prose-invert",children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:e.content})})})})})]})}var vY=e.i(776639);function vQ({open:e,onOpenChange:t,text:r,editorLabel:n,onOpenEditor:i}){let a=(0,eS.useTranslations)("chat"),o=(0,eS.useTranslations)("editResponse");return(0,ew.jsx)(vY.Dialog,{open:e,onOpenChange:t,children:(0,ew.jsxs)(vY.DialogContent,{children:[(0,ew.jsx)(vY.DialogHeader,{children:(0,ew.jsx)(vY.DialogTitle,{children:a("tooltipSelectText")})}),(0,ew.jsx)("div",{className:"prose prose-sm prose-gray mt-3 max-h-[60vh] max-w-none overflow-y-auto text-sm text-gray-900 [overflow-wrap:anywhere] dark:prose-invert dark:text-gray-100",style:{userSelect:"text",WebkitUserSelect:"text"},children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:r})}),(0,ew.jsxs)("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-2",children:[n&&i?(0,ew.jsxs)(vj.Button,{size:"sm",color:"gray",onClick:()=>{t(!1),i()},children:[(0,ew.jsx)(vx.Pencil,{className:"mr-1.5 h-3.5 w-3.5"}),n]}):(0,ew.jsx)("span",{}),(0,ew.jsx)(vj.Button,{size:"sm",color:"default",onClick:()=>t(!1),children:o("done")})]})]})})}var v0=e.i(451638),v1=e.i(871363),v2=e.i(268877);function v4({data:e}){let[t,r]=(0,e_.useState)(!1),[n,i]=(0,e_.useState)(!1),a=e.content.length>500,o=(0,v2.useSaveBlob)(),s=(0,e_.useCallback)(()=>{let t=new Blob([e.content],{type:"text/markdown;charset=utf-8"}),r=e.title.replace(/[^a-zA-Z0-9\s-]/g,"").replace(/\s+/g,"-").toLowerCase();o({blob:t,filename:`${r||"document"}.md`,fallbackExtension:"md"})},[e.content,e.title,o]);(0,e_.useEffect)(()=>
91{if(!n)return;let e=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),(0,vG.useOverlayClose)(n,(0,e_.useCallback)(()=>i(!1),[]));let l=t?e.content:a?e.content.slice(0,500)+"...":e.content,u=void 0!==e.index&&void 0!==e.total&&e.total>1;return n?(0,ew.jsxs)(vJ.FullscreenOverlay,{className:"flex flex-col bg-white dark:bg-gray-900",children:[(0,ew.jsxs)("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-gray-200 px-4 dark:border-gray-700",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ew.jsx)(y5.FileText,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),(0,ew.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.title})]}),(0,ew.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ew.jsxs)(vj.Button,{size:"xs",color:"gray",onClick:s,children:[(0,ew.jsx)(vK.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]}),(0,ew.jsxs)(vj.Button,{size:"xs",color:"gray",onClick:()=>i(!1),children:[(0,ew.jsx)(vW.X,{className:"mr-1.5 h-3.5 w-3.5"}),"Close"]})]})]}),(0,ew.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:(0,ew.jsx)("div",{className:"prose prose-sm prose-gray mx-auto max-w-3xl dark:prose-invert",children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:e.content})})})]}):(0,ew.jsx)(eC.motion.div,{variants:yG.scaleInVariants,initial:"initial",animate:"animate",className:"my-2",children:(0,ew.jsxs)(v0.Card,{className:"!p-0 overflow-hidden",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2 border-b border-gray-200 bg-gray-50 px-3 py-2 dark:border-gray-700 dark:bg-gray-800",children:[(0,ew.jsx)(y5.FileText,{className:"h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400"}),(0,ew.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-800 dark:text-gray-100",children:e.title}),u&&(0,ew.jsxs)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[(e.index??0)+1," of ",e.total]}),(0,ew.jsxs)("div",{className:"flex items-center gap-1.5 sm:gap-1",children:[(0,ew.jsx)(v1.Tooltip,{content:"Download",placement:"bottom",style:"dark",className:"text-xs",children:(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:s,className:"!p-2.5 sm:!p-1.5",children:(0,ew.jsx)(vK.Download,{className:"h-5 w-5 sm:h-4 sm:w-4"})})}),(0,ew.jsx)(v1.Tooltip,{content:"Fullscreen",placement:"bottom",style:"dark",className:"text-xs",children:(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:()=>i(!0),className:"!p-2.5 sm:!p-1.5",children:(0,ew.jsx)(vH.Maximize2,{className:"h-5 w-5 sm:h-4 sm:w-4"})})})]})]}),(0,ew.jsxs)("div",{className:"px-4 py-3",children:[(0,ew.jsx)("div",{className:"prose prose-sm prose-gray max-w-none dark:prose-invert",children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:l})}),a&&(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:()=>r(!t),className:"mt-2",children:t?(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(vq.ChevronDown,{className:"mr-1 h-3.5 w-3.5"}),"Show less"]}):(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(vV.ChevronRight,{className:"mr-1 h-3.5 w-3.5"}),"Show full document"]})})]})]})})}let v5={runPython:"Python",generateArtifact:"HTML",mermaidDiagram:"Mermaid"};function v6({code:e,tool:t}){let r=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight)},[e]);let n=v5[t]??t;return(0,ew.jsxs)("div",{className:"my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2 border-b border-gray-200 bg-gray-50 px-3 py-1.5 dark:border-gray-700 dark:bg-gray-800",children:[(0,ew.jsx)(y8.Code,{className:"h-3 w-3 text-gray-400"}),(0,ew.jsx)("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:n})]}),(0,ew.jsxs)("pre",{ref:r,className:"h-48 overflow-auto bg-gray-950 px-3 py-2 text-xs leading-relaxed text-gray-300",children:[(0,ew.jsx)("code",{children:e}),(0,ew.jsx)("span",{className:"inline-block h-3.5 w-[7px] translate-y-[2px] bg-gray-400",style:{animation:"cursor-blink 0.4s step-end infinite"}})]})]})}function v3({title:e,children:t}){let[r,n]=(0,e_.useState)(!1);return(0,ew.jsxs)("div",{className:"my-1.5",children:[(0,ew.jsxs)(vj.Button,{size:"sm",color:"gray",onClick:()=>n(e=>!e),children:[(0,ew.jsx)(vV.ChevronRight,{className:`mr-1.5 h-3.5 w-3.5 shrink-0 transition-transform duration-200 ${r?"rotate-90":""}`}),e]}),(0,ew.jsx)("div",{className:"transition-[grid-template-rows] duration-200 ease-in-out",style:{display:"grid",gridTemplateRows:r?"1fr":"0fr"}
91,children:(0,ew.jsx)("div",{className:"overflow-hidden",children:r&&(0,ew.jsx)("div",{className:"mt-1.5 rounded-lg border border-gray-100 bg-gray-50/50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800/30",children:t})})})]})}var v9=e.i(643531),v8=e.i(531278),v7=e.i(549838),be=e.i(543489),bt=e.i(953760),br=e.i(258950);function bn({content:e,placement:t="bottom",className:r,children:n}){let[i,a]=(0,e_.useState)(!1),{refs:o,floatingStyles:s,context:l}=(0,be.useFloating)({open:i,onOpenChange:a,placement:t,strategy:"fixed",whileElementsMounted:bt.autoUpdate,middleware:[(0,br.offset)(6),(0,br.flip)({padding:8}),(0,br.shift)({padding:8})]}),u=(0,be.useHover)(l,{handleClose:(0,be.safePolygon)()}),c=(0,be.useFocus)(l),d=(0,be.useDismiss)(l),p=(0,be.useRole)(l,{role:"tooltip"}),{getReferenceProps:h,getFloatingProps:f}=(0,be.useInteractions)([u,c,d,p]);if(!(0,e_.isValidElement)(n))return(0,ew.jsx)(ew.Fragment,{children:n});let m=h({ref:o.setReference,...n.props});return(0,ew.jsxs)(ew.Fragment,{children:[(0,e_.cloneElement)(n,m),i&&(0,ew.jsx)(be.FloatingPortal,{children:(0,ew.jsx)("div",{ref:o.setFloating,style:{...s,zIndex:9999},className:`pointer-events-none rounded-lg bg-gray-900 px-2.5 py-1.5 text-xs font-medium text-white shadow-lg dark:bg-gray-100 dark:text-gray-900${r?` ${r}`:""}`,...f(),children:e})})]})}let bi="h-4 w-4",ba="!h-9 !w-9";function bo({isUser:e,onCopy:t,copyMode:r="text",onShareMessage:n,onDiscuss:i,reportedCase:a,onExplain:o,explanationOpen:s,onDeleteFromHere:l,onRetry:u,onKeepOnlyThis:c,isBookmarked:d,onToggleBookmark:p,onGenerateExpand:h,expandLoading:f,expandGenerated:m,isReady:g=!0,onRewrite:y}){let v=(0,eS.useTranslations)("chat"),b=(0,eS.useTranslations)("feedback"),x=(0,eS.useTranslations)("editResponse"),[k,w]=(0,e_.useState)(!1),[_,S]=(0,e_.useState)(!1);(0,e_.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>w(!1),2e3);return()=>clearTimeout(e)},[k]),(0,e_.useEffect)(()=>{if(!_)return;let e=setTimeout(()=>S(!1),3e3);return()=>clearTimeout(e)},[_]);let E=(0,e_.useCallback)(()=>{t?.(),w(!0)},[t]),C="image"===r,$=C?vt.ImageIcon:vk.Copy,T=k?v("tooltipCopied"):C?v("tooltipCopyImage"):v("tooltipCopy"),I=(0,e_.useMemo)(()=>e?[n&&"share","none"!==r&&"copy",y&&"rewrite",p&&"bookmark",u&&"retry",l&&"deleteFromHere"].filter(Boolean):["none"!==r&&"copy",n&&"share",y&&"rewrite",h&&"suggestions",o&&"howGenerated",(i||a)&&"discussThis",c&&"keepOnlyThis",p&&"bookmark"].filter(
91Boolean),[e,r,n,p,l,u,h,o,i,a,c,y]);return g||e?(0,ew.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:I.map(t=>(function(t){switch(t){case"copy":return(0,ew.jsx)(bn,{content:T,placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:E,"aria-label":T,children:k?(0,ew.jsx)(v9.Check,{className:(0,v7.cn)(bi,"text-success")}):(0,ew.jsx)($,{className:bi})})},"copy");case"share":return(0,ew.jsx)(bn,{content:v("tooltipShare"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:n,"aria-label":v("tooltipShare"),children:(0,ew.jsx)(v_.Share2,{className:bi})})},"share");case"bookmark":return(0,ew.jsx)(bn,{content:d?v("tooltipBookmarked"):v("tooltipBookmark"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:()=>{p?.()},"aria-label":d?v("tooltipBookmarked"):v("tooltipBookmark"),"aria-pressed":d,children:(0,ew.jsx)(vE,{className:(0,v7.cn)(bi,d&&"fill-[#39ff14] text-[#39ff14]")})})},"bookmark");case"suggestions":return(0,ew.jsx)(bn,{content:v("tooltipSuggestions"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:()=>{h?.()},disabled:f,"aria-label":v("tooltipSuggestions"),children:f?(0,ew.jsx)(v8.Loader2,{className:(0,v7.cn)(bi,"animate-spin")}):(0,ew.jsx)(vp.Lightbulb,{className:(0,v7.cn)(bi,m&&"fill-amber-400 text-amber-400")})})},"suggestions");case"howGenerated":return(0,ew.jsx)(bn,{content:v("tooltipGenerated"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:()=>{o?.()},"aria-label":v("tooltipGenerated"),"aria-expanded":s,children:(0,ew.jsx)(vI.Info,{className:bi})})},"howGenerated");case"discussThis":if(a){let e="fixReady"===a.state,t=e?b("fixReadyMarker"):b("reportedMarker");return(0,ew.jsxs)("button",{type:"button",onClick:a.onOpen,"aria-label":t,className:(0,v7.cn)("inline-flex h-9 items-center gap-1.5 whitespace-nowrap rounded-lg border px-2.5 text-xs font-medium transition-colors",e?"border-green-600/40 text-green-700 hover:bg-green-50 dark:border-green-500/40 dark:text-green-400 dark:hover:bg-green-900/20":"border-gray-200 text-gray-500 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"),children:[e?(0,ew.jsx)(vN.Wrench,{className:"h-3.5 w-3.5"}):(0,ew.jsx)(vS.ThumbsDown,{className:"h-3.5 w-3.5 fill-current"}),t]},"discussThis")}return(0,ew.jsx)(bn,{content:b("reportAnswer"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:()=>{i?.()},"aria-label":b("reportAnswer"),children:(0,ew.jsx)(vS.ThumbsDown,{className:bi})})},"discussThis");case"keepOnlyThis":return(0,ew.jsx)(bn,{content:v("tooltipKeepOnly"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:c,"aria-label":v("tooltipKeepOnly"),children:(0,ew.jsx)(vC,{className:bi})})},"keepOnlyThis");case"retry":return(0,ew.jsx)(bn,{content:v("tooltipRetry"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:()=>{u?.()},"aria-label":v("tooltipRetry"),children:(0,ew.jsx)(v$.RefreshCw,{className:bi})})},"retry");case"rewrite":return(0,ew.jsx)(bn,{content:e?x("titleUserEdit"):x("titleAssistantEdit"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",className:ba,onClick:()=>{y?.()},"aria-label":e?x("titleUserEdit"):x("titleAssistantEdit"),children:(0,ew.jsx)(vx.Pencil,{className:bi})})},"rewrite");case"deleteFromHere":return(0,ew.jsx)(bn,{content:_?v("tooltipDeleteConfirm"):v("tooltipDeleteFromHere"),placement:"bottom",children:(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",onClick:()=>{_?(l?.(),S(!1)):S(!0)},"aria-label":_?v("tooltipDeleteConfirm"):v("tooltipDeleteFromHere"),className:(0,v7.cn)(ba,_&&"bg-red-600 text-white hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-600"),children:(0,ew.jsx)(vT.Trash2,{className:bi})})},"deleteFromHere");default:return null}})(t))}):null}var bs=e.i(685471);function bl({open:e,folderName:t,instruction:r,existingInstructions:n,onClose:i,onSave:a}){let o=(0,eS.useTranslations)("tailoring"),s=(0,eS.useTranslations)("common"),[l,u]=(0,e_.useState)(()=>{let e=n.trim();return(e?`${e} 92 93${r}`:r).slice(0,2e3)}),c=[o("consequenceApplies",{folder:t}
93),o("consequenceEdit"),o("consequenceForget"),o("consequenceFolders",{folder:t}),o("consequenceOff")];return(0,ew.jsx)(vY.Dialog,{open:e,onOpenChange:e=>!e&&i(),size:"md",children:(0,ew.jsx)(vY.DialogContent,{children:(0,ew.jsxs)("form",{onSubmit:function(e){e.preventDefault(),a(l.trim())},className:"space-y-4",children:[(0,ew.jsx)(vY.DialogHeader,{children:(0,ew.jsx)(vY.DialogTitle,{children:o("confirmTitle")})}),(0,ew.jsxs)("div",{children:[(0,ew.jsx)("label",{htmlFor:"tailoring-instruction",className:"mb-1 block text-sm text-gray-600 dark:text-gray-300",children:o("confirmBoxLabel")}),(0,ew.jsx)("textarea",{id:"tailoring-instruction",autoFocus:!0,value:l,onChange:e=>u(e.target.value.slice(0,2e3)),onKeyDown:bs.submitFormOnSendShortcut,rows:5,maxLength:2e3,className:"w-full resize-none rounded-lg border border-gray-200 bg-gray-100 px-3 py-2 text-sm text-gray-900 placeholder-gray-400 focus:border-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 dark:border-gray-700 dark:bg-gray-700 dark:text-gray-100 dark:placeholder-gray-500 dark:focus:border-gray-600 dark:focus:ring-gray-600"}),(0,ew.jsxs)("div",{className:"mt-1 text-right text-xs text-gray-400 dark:text-gray-500",children:[l.length," / ",2e3]})]}),(0,ew.jsx)("ul",{className:"space-y-1.5 text-sm leading-relaxed text-gray-600 dark:text-gray-300",children:c.map(e=>(0,ew.jsx)("li",{children:e},e))}),(0,ew.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,ew.jsx)("button",{type:"button",onClick:i,className:"rounded-lg px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100",children:s("cancel")}),(0,ew.jsx)("button",{type:"submit",disabled:0===l.trim().length,className:"inline-flex items-center justify-center rounded-lg bg-accent-solid px-5 py-2 text-sm font-medium text-accent-foreground transition-colors hover:bg-accent-solid-hover disabled:opacity-50",children:s("save")})]})]})})})}let bu="gdprchat:folder-instructions-updated",bc=new Map,bd=new Set;function bp(e,t){bc.set(e,t),bd.forEach(e=>e())}function bh(e){return bd.add(e),()=>bd.delete(e)}let bf="prose prose-sm prose-gray max-w-none dark:prose-invert [overflow-wrap:anywhere]",bm="text-gray-800 dark:text-gray-100";function bg({messageId:e,conversationId:t,persisted:r}){let n=(0,eS.useTranslations)("tailoring"),i=(0,e_.useSyncExternalStore)(bh,()=>bc.get(e)??null,()=>null)??r??null,[a,o]=(0,e_.useState)(null),[s,l]=(0,e_.useState)(!1),u=(0,e_.useCallback)(r=>{t&&fetch(`/api/conversations/${t}/tailoring-offer`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageId:e,...r})}).catch(()=>{})},[t,e]),c=(0,e_.useCallback)(()=>{i&&(bp(e,{...i,dismissed:!0}),u({declined:!0}))},[i,e,u]),d=(0,e_.useCallback)(async()=>{if(!i||s)return;l(!0);let e="";try{let t=await fetch("/api/folders");if(t.ok){let r=await t.json();Array.isArray(r)&&(e=r.find(e=>e.id===i.folderId)?.customInstructions??"")}}catch{}o(e),l(!1)},[i,s]),p=(0,e_.useCallback)(async t=>{if(!i)return;let r=t.trim().length>0?t.trim():null;o(null),bp(e,{...i,accepted:!0}),u({accepted:!0});try{await fetch(`/api/folders/${i.folderId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({customInstructions:r})})}catch{}window.dispatchEvent(new CustomEvent(bu,{detail:{folderId:i.folderId,customInstructions:r}}))},[i,e,u]);return i?i.accepted?(0,ew.jsx)("div",{className:`px-4 pt-1.5 ${bm} ${bf}`,children:(0,ew.jsx)("p",{className:"!my-0",children:n("saved",{folder:i.folderName})})}):i.dismissed?null:(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsxs)("div",{className:`group/tailoring flex items-start gap-2 px-4 pt-0.5 ${bm}`,children:[(0,ew.jsx)("div",{className:`min-w-0 ${bf}`,children:(0,ew.jsxs)("p",{className:"!my-0",children:[i.sentence," ",(0,ew.jsx)("button",{type:"button",onClick:d,className:"font-semibold underline decoration-current/30 underline-offset-2 transition hover:decoration-current",children:i.action})]})}),(0,ew.jsx)("button",{type:"button",onClick:c,"aria-label":n("dismiss"),className:"mt-0.5 shrink-0 rounded p-0.5 text-gray-400 opacity-0 transition hover:text-gray-600 focus-visible:opacity-100 group-hover/tailoring:opacity-100 dark:text-gray-500 dark:hover:text-gray-300",children:(0,ew.jsx)(vW.X,{className:"h-3.5 w-3.5"})})]}),null!==a&&(0,ew.jsx)(bl,{open:!0,folderName:i.folderName,instruction:i.instruction,existingInstructions:a,onClose:()=>o(null),onSave:p})]}):null}var by=e.i(861745);function bv(e){let t=e.parts??[],r=[];for(let e of t){if(!g_(e))continue;let t=gE(e);if(!t)continue;let n={name:t},i=e.input;i&&"object"==typeof i&&("string"==typeof i.query&&(n.query=i.query),"string"==typeof i.category&&(n.category=i.category)),r.push(n)}return r}function bb(e){let t=e.parts??[],r=new Map,n=e=>{let t=r.get(e.url);if(t){let n={...t,title:(t.title?.length??0)>(e.title?.length??0)?t.title:e.title??t.title,thumbnailSrc:t.thumbnailSrc??e.thumbnailSrc,age:t.age??e.age,snippets:[...t.snippets,...e.snippets??[]].filter(
93Boolean)};r.set(e.url,n)}else r.set(e.url,{url:e.url,domain:function(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}(e.url),title:e.title,age:e.age,snippets:e.snippets??[],thumbnailSrc:e.thumbnailSrc,originTool:e.originTool})};for(let e of t){if(!g_(e))continue;let t=gE(e),r=e.output;if(r){if("webSearch"===t){for(let e of Array.isArray(r.articles)?r.articles:Array.isArray(r.results)?r.results:Array.isArray(r)?r:[]){let r="string"==typeof e.url?e.url:null;if(!r)continue;let i="string"==typeof e.description?e.description:"";n({url:r,title:"string"==typeof e.title?e.title:void 0,age:"string"==typeof e.age?e.age:void 0,snippets:i?[i]:[],thumbnailSrc:"string"==typeof e.thumbnailSrc?e.thumbnailSrc:void 0,originTool:t})}continue}if("webContext"===t){for(let e of Array.isArray(r.sources)?r.sources:[]){let r="string"==typeof e.url?e.url:null;if(!r)continue;let i=(Array.isArray(e.snippets)?e.snippets:[]).filter(e=>"string"==typeof e&&e.length>0);n({url:r,title:"string"==typeof e.title?e.title:void 0,snippets:i,originTool:t})}continue}if("newsSearch"===t){for(let e of Array.isArray(r)?r:[]){let r="string"==typeof e.url?e.url:null;if(!r)continue;let i="string"==typeof e.description?e.description:"";n({url:r,title:"string"==typeof e.title?e.title:void 0,age:"string"==typeof e.age?e.age:void 0,snippets:i?[i]:[],thumbnailSrc:"string"==typeof e.thumbnailSrc?e.thumbnailSrc:void 0,originTool:t})}continue}if("webBrowse"===t){let e="string"==typeof r.url?r.url:null;if(!e)continue;let i="string"==typeof r.content?r.content:"",a=i.slice(0,240).trim();n({url:e,title:"string"==typeof r.title?r.title:void 0,snippets:a?[a+(i.length>240?"â¦":"")]:[],originTool:t})}}}return[...r.values()]}let bx={"mistral-large-latest":{displayName:"Mistral Large",i18nKey:"flagshipGeneralist",goodFor:"Long-form answers, reasoning and tool use, with strong coverage across all 24 EU languages.",docsUrl:"https://docs.mistral.ai/getting-started/models/models_overview/"},"mistral-medium-latest":{displayName:"Mistral Medium",i18nKey:"visionReader",goodFor:"Balanced everyday answers, and it reads images (vision) reliably.",docsUrl:"https://docs.mistral.ai/getting-started/models/models_overview/"},"mistral-small-latest":{displayName:"Mistral Small",i18nKey:"fastUtility",goodFor:"Fast, low-cost utility work: short answers, titles, tagging and classification.",docsUrl:"https://docs.mistral.ai/getting-started/models/models_overview/"},"codestral-latest":{displayName:"Codestral",i18nKey:"codeDedicated",goodFor:"Code generation and completion across many programming languages.",docsUrl:"https://docs.mistral.ai/capabilities/code_generation/"},"mistral-medium-3.5-128b":{displayName:"Mistral Medium 3.5",i18nKey:"fastGeneralist",goodFor:"Fast general answers with excellent tool-calling.",docsUrl:"https://docs.mistral.ai/getting-started/models/models_overview/"},"qwen3.5-397b-a17b":{displayName:"Qwen 3.5",i18nKey:"codeMathPowerhouse",goodFor:"Very strong at code and mathematics; large context window.",warning:"A Chinese-origin model that censors or distorts certain political and historical topics. We keep an automatic safeguard on even when you select it directly: prompts about the subjects below are quietly served by a values-safe European model instead â so you never receive censored output.",warnTopics:["Tiananmen Square (1989)","Taiwan's sovereignty","Uyghurs / Xinjiang","Hong Kong (2019 protests)","Tibet","Falun Gong","Chinese internet censorship","criticism of authoritarian governments"],docsUrl:"https://qwen.readthedocs.io/"},"mistral-embed":{displayName:"Mistral Embed",i18nKey:"embedder",goodFor:"Turning text into vectors so meaning can be matched across languages.",docsUrl:"https://docs.mistral.ai/capabilities/embeddings/"},"voxtral-mini-2602":{displayName:"Voxtral Mini",i18nKey:"speechToText",goodFor:"Speech-to-text across the EU languages.",docsUrl:"https://docs.mistral.ai/capabilities/audio/"},"gpt-oss-120b":{displayName:"GPT-OSS 120B",i18nKey:"generalAnswers",goodFor:"Everyday answers and reasoning across the EU languages. Open-weight, run in France at Scaleway.",docsUrl:"https://openai.com/index/introducing-gpt-oss/"}
93,"gemma-4-26b-a4b-it":{displayName:"Gemma 4 26B",i18nKey:"generalAnswers",goodFor:"Everyday answers, reasoning and tool use across the EU languages, and it reads images.",docsUrl:"https://ai.google.dev/gemma/docs/core"},"qwen3-embedding-8b":{displayName:"Qwen3 Embedding",i18nKey:"embedder",goodFor:"Turning text into vectors so meaning can be matched across languages.",docsUrl:"https://huggingface.co/Qwen/Qwen3-Embedding-8B"},"whisper-large-v3":{displayName:"Whisper Large v3",i18nKey:"speechToText",goodFor:"Speech-to-text across the EU languages.",docsUrl:"https://huggingface.co/openai/whisper-large-v3"}};function bk(e){return e?(e.creditsCharged??0)+(e.stage2CreditsCharged??0)+(e.toolCreditsCharged??0):0}function bw(e){if(!e)return"AI model";let t=e.includes(":")?e.slice(e.indexOf(":")+1):e;return bx[t]?.displayName??"AI model"}function b_(e){let t=e?.curated;if(t&&"object"==typeof t&&"guided-tour"===t.kind)return"guided-tour"}function bS(e){let t=e?.generation;return t&&"object"==typeof t?t:null}function bE(e,t){let r=String(e??"");return r.length>t?r.slice(0,t).trimEnd()+"â¦":r}function bC(e){return String(e??"").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim()}function b$(e){try{return JSON.stringify(e)}catch{return""}}function bT(e){let t=e.slice(0,4).map(e=>"string"==typeof e?e:e&&"object"==typeof e&&(e.title||e.name||e.headline||e.url)||null).filter(Boolean).map(e=>bE(bC(e),80));return`${e.length} item(s)`+(t.length?`: ${t.join("; ")}`:"")}function bI(e,t){switch(e.name){case"webSearch":return e.query?t("toolWebSearchWithQuery",{query:e.query}):t("toolWebSearch");case"webContext":return e.query?t("toolWebContextWithQuery",{query:e.query}):t("toolWebContext");case"newsSearch":return e.query?t("toolNewsSearchWithQuery",{query:e.query}):t("toolNewsSearch");case"webBrowse":return t("toolWebBrowse");case"knowledgeBase":return t("toolKnowledgeBase");case"routeToSpecialist":return e.category?t("toolRoutedTo",{category:e.category}):t("toolRouted");default:return e.name}}var bN=e.i(581418),bA=e.i(115057),bj=e.i(966992);let bM={router:"modelJobRouter",answer:"modelJobAnswer",vision:"modelJobVision",code:"modelJobCode",documents:"modelJobDocuments",utility:"modelJobUtility",knowledge:"modelJobKnowledge",safety:"modelJobSafety",images:"modelJobImages",voice:"modelJobVoice"},bO={flagshipGeneralist:"modelWhyFlagshipGeneralist",visionReader:"modelWhyVisionReader",fastUtility:"modelWhyFastUtility",codeDedicated:"modelWhyCodeDedicated",fastGeneralist:"modelWhyFastGeneralist",codeMathPowerhouse:"modelWhyCodeMathPowerhouse",embedder:"modelWhyEmbedder",speechToText:"modelWhySpeechToText",imageMaker:"modelWhyImageMaker"};function bD({models:e,t,locale:r}){if(!e.length)return null;let n=function(e){let t=[],r=new Map;for(let n of e){let e=r.get(n.modelId);if(e){e.jobs.includes(n.job)||e.jobs.push(n.job);continue}let i={model:n,jobs:[n.job]};r.set(n.modelId,i),t.push(i)}return t}(e);return(0,ew.jsxs)("div",{className:"mt-4 rounded-lg border border-gray-200 bg-white/60 p-3 dark:border-gray-700 dark:bg-gray-900/30",children:[(0,ew.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:[(0,ew.jsx)(bj.Cpu,{className:"h-3.5 w-3.5","aria-hidden":!0}),t("modelsHeading")]}),(0,ew.jsx)("div",{className:"space-y-2",children:n.map(({model:e,jobs:n})=>{let i=e.whyKey?bO[e.whyKey]:void 0;return(0,ew.jsxs)("div",{className:"rounded-md border border-gray-100 p-2.5 dark:border-gray-800",children:[(0,ew.jsx)("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:n.map(e=>t(bM[e])).join(" · ")}),(0,ew.jsxs)("div",{className:"mt-0.5 flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[(0,ew.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.modelDisplay}),(0,ew.jsx)("code",{className:"rounded bg-gray-100 px-1.5 py-0.5 font-mono text-xs text-gray-600 [overflow-wrap:anywhere] dark:bg-gray-800 dark:text-gray-400",children:e.modelId})]}),(0,ew.jsxs)("p",{className:"mt-1 flex items-start gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[(0,ew.jsx)(vs.MapPin,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-gray-400","aria-hidden":!0}),(0,ew.jsxs)("span",{children:[e.providerDisplay," â ",e.location]})]}),i&&(0,ew.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:t(i)}),e.valuesRisk&&(0,ew.jsxs)("p",{className:"mt-1.5 flex items-start gap-1.5 rounded border border-amber-200 bg-amber-50 px-2 py-1.5 text-xs text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-300",children:[(0,ew.jsx)(bN.ShieldCheck,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,ew.jsx)("span",{children:t("modelValuesGuarded")})]}),(0,ew.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-400 dark:text-gray-500",children:[e.contextWindow?(0,ew.jsx)("span",{children:t("modelContextWindow",{tokens:e.contextWindow.toLocaleStr
93ing(r)})}):null,e.docsUrl&&(0,ew.jsxs)("a",{href:e.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-green-700 hover:underline dark:text-green-400",children:[t("modelDocs"),(0,ew.jsx)(bA.ArrowUpRight,{className:"h-3 w-3","aria-hidden":!0})]})]})]},e.modelId)})}),(0,ew.jsxs)("div",{className:"mt-3 border-t border-gray-100 pt-3 dark:border-gray-800",children:[(0,ew.jsx)("p",{className:"mb-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400",children:t("whyModelsHeading")}),(0,ew.jsxs)("div",{className:"space-y-1.5 text-xs leading-relaxed text-gray-500 dark:text-gray-400",children:[(0,ew.jsx)("p",{children:t("whyModelsBest")}),(0,ew.jsx)("p",{children:t("whyModelsWeekly")}),(0,ew.jsx)("p",{children:t("whyModelsBias")})]})]})]})}var bR=e.i(302833),bP=e.i(772676);let bz=null,bL=null,bF=new Set;function bU(e){bz=e,bF.forEach(t=>t(e))}async function bB(){try{let e=await fetch("/api/me/shortcut",{cache:"no-store"});if(!e.ok)return null;let t=await e.json(),r="number"==typeof t.editorOpens?t.editorOpens:0,n=Array.isArray(t.prompts)?t.prompts.filter(e=>"string"==typeof e):[];return{prompts:n,hasCustom:!!t.hasCustom&&n.length>0,editorOpens:r}}catch{return null}}function bZ(){let[e,t]=(0,e_.useState)(()=>bz);return(0,e_.useEffect)(()=>(bF.add(t),null!==bz||bL||(bL=bB().then(e=>(bL=null,bU(e),e))),()=>{bF.delete(t)}),[]),{data:e,mutate:(0,e_.useCallback)(async e=>{void 0!==e?bU(e):(bL=bB().then(e=>(bL=null,bU(e),e)),await bL)},[]),incrementEditorOpens:(0,e_.useCallback)(async()=>{try{let e=await fetch("/api/me/shortcut/editor-opens",{method:"POST"});if(!e.ok)return;let t=await e.json();if("number"!=typeof t.editorOpens)return;let r=bz;r&&bU({...r,editorOpens:t.editorOpens})}catch{}},[])}}async function bq(e,t,r=0){return bH(e,t,r,!1)}async function bV(e,t,r=0){return bH(e,t,r,!0)}async function bH(e,t,r,n){try{let i=new FormData;i.append("text",e);let a=await fetch("/api/ingress",{method:"POST",body:i,headers:{accept:"application/json"}});if(!a.ok)return;let o=await a.json();"conversation"===o.kind&&t.push(`/?conversationId=${encodeURIComponent(o.conversationId)}&ingress=1&shortcut=1&shortcutSlot=${r}${n?"&shortcutIntro=1":""}`)}catch{}}async function bK(e,t){try{let r=new FormData;r.append("text",e);let n=await fetch("/api/ingress",{method:"POST",body:r,headers:{accept:"application/json"}});if(!n.ok)return;let i=await n.json();"conversation"===i.kind?t.push(`/?conversationId=${encodeURIComponent(i.conversationId)}&ingress=1`):t.push(`/ingress/${encodeURIComponent(i.ingressId)}`)}catch{}}var bW=e.i(657688),bJ=e.i(458778);function bG({source:e,t,className:r}){var n;let[i,a]=(0,e_.useState)(!1),o=i?e.snippets:e.snippets.slice(0,2),s=e.snippets.length-o.length,[l,u]=(0,e_.useState)(!1);return(0,ew.jsxs)("div",{className:(0,v7.cn)("rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",r),children:[(0,ew.jsxs)("div",{className:"flex gap-3 p-3",children:[(0,ew.jsx)("div",{className:"shrink-0",children:e.thumbnailSrc&&!l?(0,ew.jsx)("div",{className:"relative h-16 w-16 overflow-hidden rounded bg-gray-100 dark:bg-gray-800",children:(0,ew.jsx)("img",{src:(0,bJ.viaImageProxy)(e.thumbnailSrc),alt:"",className:"h-full w-full object-cover",onError:()=>u(!0)})}):(0,ew.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded bg-gray-100 dark:bg-gray-800",children:(0,ew.jsx)(bW.default,{src:(n=e.url,(0,bJ.faviconViaProxy)(n)),alt:"",width:28,height:28,unoptimized:!0})})}),(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsxs)("div",{className:"flex items-baseline gap-2 text-xs text-gray-500 dark:text-gray-400",children:[(0,ew.jsx)("span",{className:"font-medium truncate",children:e.domain}),e.age&&(0,ew.jsxs)("span",{children:["· ",e.age]})]}),e.title&&(0,ew.jsx)("p",{className:"mt-0.5 text-sm font-medium text-gray-900 dark:text-gray-100 line-clamp-2",children:e.title}),o.length>0&&(0,ew.jsx)("ul",{className:"mt-2 space-y-1.5",children:o.map((e,t)=>(0,ew.jsx)("li",{className:"text-xs text-gray-600 dark:text-gray-300 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:e.replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()},t))}),s>0&&(0,ew.jsx)("button",{onClick:()=>a(!0),className:"mt-1 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",children:t("showMoreQuotes",{count:s})})]})]}),(0,ew.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900 px-3 py-2 text-xs font-medium text-gray-700 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100",children:[(0,ew.jsx)("span",{children:t("visitSite")}),(0,ew.jsx)(vb.ExternalLink,{className:"h-3 w-3"})]})]})}let bX=new Map,bY='{"modelsUsed"',bQ=/\{\{\s*(?:ask:)?\s*([^{}]*?)\s*\}\}/gi;function b0({gen:e,t,locale:r}){let n=bk(e),i=[];e.stage2Model&&(i.push({label:t("modelJobRouter"),credits:e.creditsCharged??0}),i.push({label:t("modelJobAnswer"),credits:e.stage2CreditsCharged??0}));let a=e.toolTimeline.filter(e=>"directAnswer"!==e.name),o=(e.inputTokens??0)+(e.stage2InputTokens??0),s=(e.outputTokens??0)+(e.stage2OutputTokens??0),l=null!=e.inputTokens||null!=e.outputTokens||null!=e.stage2InputTokens||null!=e.stage2OutputTokens;return(0,ew.jsxs)("div",{className:"mt-4 rounded-lg border border-gray-200 bg-white/60 p-3 dark:border-gray-700 dark:bg-gray-900/30",children:[(0,ew.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:[(0,ew.jsx)(vA.Coins,{className:"h-3.5 w-3.5","aria-hidden":!0}),t("creditsHeading")]}),(0,ew.jsxs)("dl",{className:"space-y-1 text-sm text-gray-700 dark:text-gray-200",children:[(0,ew.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,ew.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:t("creditsTotalLabel")}),(0,ew.jsx)("dd",{className:"font-medium tabular-nums",children:t("creditsAmount",{credits:n.toLocaleStr
93ing(r)})})]}),i.map((e,n)=>(0,ew.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,ew.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:e.label}),(0,ew.jsx)("dd",{className:"tabular-nums",children:t("creditsAmount",{credits:e.credits.toLocaleString(r)})})]},n)),l&&(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,ew.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:t("creditsTokensSent")}),(0,ew.jsx)("dd",{className:"tabular-nums",children:t("creditsTokenAmount",{tokens:o.toLocaleString(r)})})]}),(0,ew.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,ew.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:t("creditsTokensWritten")}),(0,ew.jsx)("dd",{className:"tabular-nums",children:t("creditsTokenAmount",{tokens:s.toLocaleString(r)})})]})]})]}),a.length>0&&(0,ew.jsxs)("div",{className:"mt-2",children:[(0,ew.jsx)("p",{className:"mb-1 text-xs text-gray-400 dark:text-gray-500",children:t("creditsToolsLabel")}),(0,ew.jsx)("ul",{className:"space-y-0.5 text-sm text-gray-600 dark:text-gray-300",children:a.map((e,r)=>(0,ew.jsx)("li",{children:bI(e,t)},r))})]})]})}function b1({message:e,t,piiMode:r}){if(b_(e.metadata))return(0,ew.jsxs)("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-200",children:[(0,ew.jsx)("p",{className:"text-gray-500 dark:text-gray-400",children:t("explainErrorNote")}),(0,ew.jsx)("p",{children:t("curatedDemoNote")})]});let n=bv(e),i=n[0],a=i?function(e,t){switch(e.name){case"directAnswer":return t("firstStepDirectAnswer");case"webSearch":return e.query?t("firstStepWebSearchQ",{query:e.query}):t("firstStepWebSearch");case"webContext":return e.query?t("firstStepWebContextQ",{query:e.query}):t("firstStepWebContext");case"newsSearch":return e.query?t("firstStepNewsSearchQ",{query:e.query}):t("firstStepNewsSearch");case"routeToSpecialist":return e.category?t("firstStepRoutedTo",{category:e.category}):t("firstStepRouted");default:return""}}(i,t):"",o=n.filter(e=>"directAnswer"!==e.name),s=a?o.filter(e=>e!==i):o;return(0,ew.jsxs)("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-200",children:[(0,ew.jsx)("p",{className:"text-gray-500 dark:text-gray-400",children:t("explainErrorNote")}),"off"!==r&&(0,ew.jsx)("p",{children:t("piiStepOn")}),"off"===r&&(0,ew.jsx)("p",{children:t("piiStepOff")}),(0,ew.jsx)("p",{children:t("step3Body")}),a&&(0,ew.jsx)("p",{children:a}),s.map((e,r)=>(0,ew.jsx)("p",{children:bI(e,t)},r)),(0,ew.jsx)("p",{children:t("step5Body")}),(0,ew.jsx)("p",{className:"text-gray-500 dark:text-gray-400",children:t("privacyFooter")})]})}function b2({message:e,conversationId:t,conversationLocale:r,hasEarlierWebSources:n=!1,hasPriorConversation:i=!1,priorMessageCount:a,onSuggestionClick:o}){let s=(0,eS.useTranslations)("generationReport"),l=(0,by.useLocale)(),u=(0,yC.useRouter)(),c=r??l??"en",{settings:d}=(0,bR.useUserSettings)(),p=(0,bP.resolvePiiFilterMode)(d),h=(0,e_.useMemo)(()=>{var t,r;let n,i,a=`${e.id}:${c}:15`,o=bX.get(a);if(o)return o;let s=(t=e.metadata,(n=t?.explanation)&&"object"==typeof n&&15===n.version&&n.locale===c&&"string"==typeof n.text&&n.text.trim()?n.text:null);return s?{text:s,modelsUsed:(r=e.metadata,((i=r?.explanation)&&"object"==typeof i&&Array.isArray(i.modelsUsed)&&i.modelsUsed.length?i.modelsUsed:null)??void 0)}:null},[e.id,e.metadata,c]),[f,m]=(0,e_.useState)(()=>h?.text??""),[g,y]=(0,e_.useState)(()=>h?"done":t?"loading":"error"),[v,b]=(0,e_.useState)(null),[x,k]=(0,e_.useState)(()=>h?.generation??null),[w,_]=(0,e_.useState)(()=>h?.modelsUsed??[]),S=(0,e_.useMemo)(()=>{var t;let r,n=bb(e);return n.length?n:v&&v.length?v:(t=e.metadata,((r=t?.explanation)&&"object"==typeof r&&Array.isArray(r.sources)&&r.sources.length?r.sources:null)??[])},[e,v]);(0,e_.useEffect)(()=>{if(h||!t)return;let r=`${e.id}:${c}:15`,o=new AbortController,s=function(e,t){let r=bS(e.metadata),n=r?.toolTimeline&&r.toolTimeline.length>0?r.toolTimeline.map(e=>({name:e.name,stage:e.stage,query:e.query,category:e.category,resultCount:e.resultCount})):bv(e).map(e=>({name:e.name,query:e.query,category:e.category})),i=function(e){let t=e.parts??[],r=[];for(let e of t){if(!g_(e))continue;let t=gE(e);t&&r.push({name:t,input:e.input,output:e.output,state:"string"==typeof e.state?e.state:void 0,errorText:"string"==typeof e.errorText?e.errorText:void 0})}return r}(e),a=Array(i.length).fill(!1);for(let e of n){if("directAnswer"===e.name)continue;let t=i.findIndex((t,r)=>!a[r]&&t.name===e.name);if(t>=0){a[t]=!0;let r=i[t];"routeToSpecialist"!==e.name&&(e.inputDigest=function(e){if(!e||"object"!=typeof e)return;let t=[];for(let r of["query","location","city","place","units","from","to","amount","count","code","prompt","language","country","topic","url","type","title"]){let n=e[r];"string"==typeof n&&n.trim()?t.push(`${r}=${bE(n.trim(),160)}
93`):("number"==typeof n||"boolean"==typeof n)&&t.push(`${r}=${n}`)}if(t.length)return t.join(", ");let r=b$(e);return r&&"{}"!==r?bE(r,200):void 0}(r.input),e.outputDigest=function(e){if(null!=e){if("string"==typeof e)return bE(bC(e),280)||void 0;if(Array.isArray(e))return bT(e);if("object"==typeof e){for(let t of["results","sources","articles","items","matches","chunks"])if(Array.isArray(e[t]))return bT(e[t]);for(let t of["content","text","answer","result","summary","output","stdout","description"])if("string"==typeof e[t]&&e[t].trim())return bE(bC(e[t]),280);let t=Object.entries(e).filter(([,e])=>["string","number","boolean"].includes(typeof e)).slice(0,8).map(([e,t])=>`${e}: ${bE(bC(String(t)),60)}`);if(t.length)return bE(t.join("; "),280);let r=b$(e);return r&&"{}"!==r?bE(r,280):void 0}}}(r.output)),"output-error"===r.state&&(e.errored=!0,e.errorText=r.errorText)}}let o=bb(e).map((e,t)=>({index:t+1,domain:e.domain,title:e.title,age:e.age,originTool:e.originTool,snippet:e.snippets&&e.snippets[0]?bE(bC(e.snippets[0]),160):void 0})),s=0===n.filter(e=>"directAnswer"!==e.name).length&&!!t.hasEarlierWebSources,l=(e.parts??[]).filter(e=>"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n").trim(),u=l?{text:bE(l,1200),truncated:l.length>1200}:void 0,c=r&&(r.durationMs||r.stage2DurationMs)?{stage1Ms:r.durationMs,stage2Ms:r.stage2DurationMs}:void 0;return{version:15,locale:t.locale,modelLabel:bw(r?.model),stage2ModelLabel:r?.stage2Model?bw(r.stage2Model):void 0,modelId:r?.model,stage2ModelId:r?.stage2Model,routedTo:r?.routedTo,userPrompt:r?.userPromptExcerpt,steps:n,sources:o,sourceCount:o.length,reusedEarlierSources:s,hasPriorConversation:void 0!==t.priorMessageCount?t.priorMessageCount>0:!!t.hasPriorConversation,priorMessageCount:t.priorMessageCount,answerExcerpt:u,timings:c,curated:b_(e.metadata),piiFilterMode:t.piiFilterMode}}(e,{locale:c,hasEarlierWebSources:n,hasPriorConversation:i,priorMessageCount:a,piiFilterMode:p});return(async()=>{try{let n,i,a=await fetch(`/api/conversations/${t}/messages/${e.id}/explain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:c,dossier:s,sources:S,streamProtocol:2}),signal:o.signal});if(!a.ok||!a.body)throw Error(`explain ${a.status}`);if((a.headers.get("content-type")||"").includes("application/json")){let e=await a.json(),t=(e.text||"").trim();if(!t)throw Error("empty explanation");let n=Array.isArray(e.modelsUsed)?e.modelsUsed:void 0;bX.set(r,{text:t,modelsUsed:n,generation:e.generation}),Array.isArray(e.sources)&&e.sources.length&&b(e.sources),n?.length&&_(n),e.generation&&k(e.generation),m(t),y("done");return}let l=a.body.getReader(),u=new TextDecoder,d="",p=!1;for(;;){let{done:e,value:t}=await l.read();if(e)break;if(d+=u.decode(t,{stream:!0}),!p){let e=function(e){if(!e.startsWith(bY.slice(0,Math.min(e.length,bY.length))))return{rest:e,done:!0};let t=e.indexOf("\n");if(t<0)return{rest:e,done:!1};let r=e.slice(0,t);try{let n=JSON.parse(r);return{models:n.modelsUsed,generation:n.generation,rest:e.slice(t+1),done:!0}}catch{return{rest:e.slice(t+1),done:!0}}}(d);if(!e.done)continue;p=!0,d=e.rest,n=e.models,i=e.generation,n?.length&&_(n),i&&k(i)}m(d),y("streaming")}if(!(d=d.trim()))throw Error("empty explanation");bX.set(r,{text:d,modelsUsed:n,generation:i}),m(d),y("done")}catch{if(o.signal.aborted)return;y("error")}})(),()=>o.abort()},[e.id,c]);let E=(0,e_.useMemo)(()=>bS(e.metadata)??x,[e.metadata,x]),{body:C,questions:$}=function(e){let t,r=null;for(bQ.lastIndex=0;null!==(t=bQ.exec(e));)r=t;if(r){let t=r[1].split("|").map(e=>e.trim()).filter(Boolean).slice(0,4);return{body:(e.slice(0,r.index)+e.slice(r.index+r[0].length)).trimEnd(),questions:t}}return{body:e.replace(/\{\{\s*(?:ask:)?[^{}]*$/i,"").trimEnd(),questions:[]}}(f),T=(0,e_.useMemo)(()=>[s("explainingReading"),s("explainingJourney"),s("explaining")],[s]),[I,N]=(0,e_.useState)(0),A="loading"===g&&!C;(0,e_.useEffect)(()=>{if(!A)return;N(0);let e=setInterval(()=>{N(e=>Math.min(e+1,T.length-1))},2800);return()=>clearInterval(e)},[A,T.length]);let j=(0,e_.useRef)(null);return(0,e_.useEffect)(()=>{yA(j.current,"pin-top")},[]),(0,ew.jsx)("div",{ref:j,className:"px-4 pb-3",children:(0,ew.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-gray-50/60 p-4 dark:border-gray-700 dark:bg-gray-900/40",children:["error"===g?(0,ew.jsx)(b1,{message:e,t:s,piiMode:p}):C?(0,ew.jsx)("div",{className:"prose prose-sm prose-gray max-w-none dark:prose-invert [overflow-wrap:anywhere]",children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:C})}):(0,ew.jsx)("p",{className:"animate-pulse text-sm text-gray-400 dark:text-gray-500",children:T[I]}),"error"!==g&&$.length>0&&(0,ew.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:$.map(e=>(0,ew.jsx)(vj.Button,{type:"button",size:"sm",color:"gray",className:"h-auto w-fit whitespace-normal py-2 text-left",onClick:()=>{var t;let r,n,i=(t=s("title"),r=(e??"").trim(),n=(t??"").trim(),!r||!n||r.startsWith(n)?r:`${n} â ${r}`);return o?o(i):bK(i,u)},children:e},e))}),(0,ew.jsx)(bD,{models:w,t:s,locale:c}),"error"!==g&&E&&(0,ew.jsx)(b0,{gen:E,t:s,locale:c}),S.length>0&&(0,ew.jsxs)("div",{className:"mt-4",children:[(0,ew.jsx)("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:s("sourcesHeading",{count:S.length})}),(0,ew.jsx)("div",{className:"space-y-3",children:S.map(e=>(0,ew.jsx)(bG,{source:e,t:s},e.url))})]})]})})}let b4=/^ {0,3}(`{3,}|~{3,})(.*)$/;function b5(e){let t=e.split("\n"),r=[],n=[],i=!1,a="",o=0,s=e=>{0!==n.length&&(r.push({code:e,text:n.join("\n")}),n=[])};for(let e of t){let t=b4.exec(e);if(!i&&t){s(!1),i=!0,a=t[1][0],o=t[1].length,n.push(e);continue}if(i&&t&&t[1][0]===a&&t[1].length>=o&&""===t[2].trim()){n.push(e),s(!0),i=!1;continue}n.push(e)}return s(i),r.length>0?r:[{code:!1,text:e}]}function b6(e){return e.map(e=>e.text).join("\n")}function b3(e,t){let r=b5(e);return r.some(e=>e.code)?b6(r.map(e=>e.code?e:{code:!1,text:t(e.text)})):t(e)}
93let b9=["maxTokens","searchQuery","documentId","groundingData","formatTemplate","exampleItems","previousItems","aspectRatio","_answeredBy","toolName","thumbnailSrc"];function b8(e){return e.replace(/^ {0,3}(?:`{3,}|~{3,}).*(?:\n|$)/,"").replace(/\n? {0,3}(?:`{3,}|~{3,})[ \t]*$/,"")}var b7=e.i(580673),xe=e.i(552336),xt=e.i(706281),xr=e.i(323103),xn=e_;function xi(e){this.content=e}xi.prototype={constructor:xi,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),a=n.content.slice();return -1==i?a.push(r||e,t):(a[i+1]=t,r&&(a[i]=r)),new xi(a)},remove:function(e){var t=this.find(e);if(-1==t)return this;var r=this.content.slice();return r.splice(t,2),new xi(r)},addToStart:function(e,t){return new xi([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new xi(r)},addBefore:function(e,t,r){var n=this.remove(t),i=n.content.slice(),a=n.find(e);return i.splice(-1==a?i.length:a,0,t,r),new xi(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=xi.from(e)).size?new xi(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=xi.from(e)).size?new xi(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=xi.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,r){e[t]=r}),e},get size(){return this.content.length>>1}},xi.from=function(e){if(e instanceof xi)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new xi(t)};class xa{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,r,n=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;if(l>e&&!1!==r(s,n+o,i||null,a)&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,n){let i="",a=!0;return this.nodesBetween(e,t,(o,s)=>{let l=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(a?a=!1:i+=r),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(n[n.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new xa(n,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let r=[],n=0;if(t>e)for(let i=0,a=0;a<t;i++){let o=this.content[i],s=a+o.nodeSize;s>e&&((a<e||s>t)&&(o=o.isText?o.cut(Math.max(0,e-a),Math.min(o.text.length,t-a)):o.cut(Math.max(0,e-a-1),Math.min(o.content.size,t-a-1))),r.push(o),n+=o.nodeSize),a=s}return new xa(r,n)}cutByIndex(e,t){return e==t?xa.empty:0==e&&t==this.content.length?this:new xa(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let n=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return n[e]=t,new xa(n,i)}addToStart(e){return new xa([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new xa(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let n=this.content[t];e(n,r,t),r+=n.nodeSize}}findDiffStart(e,t=0){return function e(t,r,n){for(let i=0;;i++){if(i==t.childCount||i==r.childCount)return t.childCount==r.childCount?null:n;let a=t.child(i),o=r.child(i);if(a==o){n+=a.nodeSize;continue}if(!a.sameMarkup(o))return n;if(a.isText&&a.text!=o.text){for(let e=0;a.text[e]==o.text[e];e++)n++;return n}if(a.content.size||o.content.size){let t=e(a.content,o.content,n+1);if(null!=t)return t}n+=a.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return function e(t,r,n,i){for(let a=t.childCount,o=r.childCount;;){if(0==a||0==o)return a==o?null:{a:n,b:i};let s=t.child(--a),l=r.child(--o),u=s.nodeSize;if(s==l){n-=u,i-=u;continue}if(!s.sameMarkup(l))return{a:n,b:i};if(s.isText&&s.text!=l.text){let e=0,t=Math.min(s.text.length,l.text.length);for(;e<t&&s.text[s.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,i--;return{a:n,b:i}}if(s.content.size||l.content.size){let t=e(s.content,l.content,n-1,i-1);if(t)return t}n-=u,i-=u}}(this,e,t,r)}findIndex(e){if(0==e)return xs(0,e);if(e==this.size)return xs(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let n=r+this.child(t).nodeSize;if(n>=e){if(n==e)return xs(t+1,n);return xs(t,r)}r=n}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return xa.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return new xa(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return xa.empty;let t,r=0;for(let n=0;n<e.length;n++){let i=e[n];r+=i.nodeSize,n&&i.isText&&e[n-1].sameMarkup(i)?(t||(t=e.slice(0,n)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new xa(t||e,r)}static from(e){if(!e)return xa.empty;if(e instanceof xa)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new xa([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}xa.empty=new xa([],0);let xo={index:0,offset:0};function xs(e,t){return xo.index=e,xo.offset=t,xo}function xl(e,t){if(e===t)return!0;
93if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!xl(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!xl(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class xu{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,n)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw RangeError(`There is no mark type ${t.type} in this schema`);let n=r.create(t.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return xu.none;if(e instanceof xu)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}xu.none=[];class xc extends Error{}class xd{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=function e(t,r,n,i){let{index:a,offset:o}=t.findIndex(r),s=t.maybeChild(a);if(o==r||s.isText)return i&&!i.canReplace(a,a,n)?null:t.cut(0,r).append(n).append(t.cut(r));let l=e(s.content,r-o-1,n,s);return l&&t.replaceChild(a,s.copy(l))}(this.content,e+this.openStart,t);return r&&new xd(r,this.openStart,this.openEnd)}removeBetween(e,t){return new xd(function e(t,r,n){let{index:i,offset:a}=t.findIndex(r),o=t.maybeChild(i),{index:s,offset:l}=t.findIndex(n);if(a==r||o.isText){if(l!=n&&!t.child(s).isText)throw RangeError("Removing non-flat range");return t.cut(0,r).append(t.cut(n))}if(i!=s)throw RangeError("Removing non-flat range");return t.replaceChild(i,o.copy(e(o.content,r-a-1,n-a-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return xd.empty;let r=t.openStart||0,n=t.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw RangeError("Invalid input for Slice.fromJSON");return new xd(xa.fromJSON(e,t.content),r,n)}static maxOpen(e,t=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)n++;return new xd(e,r,n)}}function xp(e,t){if(!t.type.compatibleContent(e.type))throw new xc("Cannot join "+t.type.name+" onto "+e.type.name)}function xh(e,t,r){let n=e.node(r);return xp(n,t.node(r)),n}function xf(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function xm(e,t,r,n){let i=(t||e).node(r),a=0,o=t?t.index(r):i.childCount;e&&(a=e.index(r),e.depth>r?a++:e.textOffset&&(xf(e.nodeAfter,n),a++));for(let e=a;e<o;e++)xf(i.child(e),n);t&&t.depth==r&&t.textOffset&&xf(t.nodeBefore,n)}function xg(e,t){return e.type.checkContent(t),e.copy(t)}function xy(e,t,r){let n=[];return xm(null,e,r,n),e.depth>r&&xf(xg(xh(e,t,r+1),xy(e,t,r+1)),n),xm(t,null,r,n),new xa(n)}xd.empty=new xd(xa.empty,0,0);class xv{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(t);return r?e.child(t).cut(r):n}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[3*t],n=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)n+=r.child(t).nodeSize;return n}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return xu.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),n=e.maybeChild(t);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var a=0;a<i.length;a++)!1!==i[a].type.spec.inclusive||n&&i[a].isInSet(n.marks)||(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new xw(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let r=[],n=0,i=t;for(let t=e;;){let{index:e,offset:a}=t.content.findIndex(i),o=i-a;if(r.push(t,e,n+a),!o||(t=t.child(e)).isText)break;
93i=o-1,n+=a+1}return new xv(t,r,i)}static resolveCached(e,t){let r=xk.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==t)return n}else xk.set(e,r=new xb);let n=r.elts[r.i]=xv.resolve(e,t);return r.i=(r.i+1)%xx,n}}class xb{constructor(){this.elts=[],this.i=0}}let xx=12,xk=new WeakMap;class xw{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let x_=Object.create(null);class xS{constructor(e,t,r,n=xu.none){this.type=e,this.attrs=t,this.marks=n,this.content=r||xa.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,n=0){this.content.nodesBetween(e,t,r,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,n){return this.content.textBetween(e,t,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&xl(this.attrs,t||e.defaultAttrs||x_)&&xu.sameSet(this.marks,r||xu.none)}copy(e=null){return e==this.content?this:new xS(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xS(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return xd.empty;let n=this.resolve(e),i=this.resolve(t),a=r?0:n.sharedDepth(t),o=n.start(a);return new xd(n.node(a).content.cut(n.pos-o,i.pos-o),n.depth-a,i.depth-a)}replace(e,t,r){var n=this.resolve(e),i=this.resolve(t);if(r.openStart>n.depth)throw new xc("Inserted content deeper than insertion position");if(n.depth-r.openStart!=i.depth-r.openEnd)throw new xc("Inconsistent open depths");return function e(t,r,n,i){let a=t.index(i),o=t.node(i);if(a==r.index(i)&&i<t.depth-n.openStart){let s=e(t,r,n,i+1);return o.copy(o.content.replaceChild(a,s))}if(!n.content.size)return xg(o,xy(t,r,i));if(n.openStart||n.openEnd||t.depth!=i||r.depth!=i){let{start:e,end:a}=function(e,t){let r=t.depth-e.openStart,n=t.node(r).copy(e.content);for(let e=r-1;e>=0;e--)n=t.node(e).copy(xa.from(n));return{start:n.resolveNoCache(e.openStart+r),end:n.resolveNoCache(n.content.size-e.openEnd-r)}}(n,t);return xg(o,function e(t,r,n,i,a){let o=t.depth>a&&xh(t,r,a+1),s=i.depth>a&&xh(n,i,a+1),l=[];return xm(null,t,a,l),o&&s&&r.index(a)==n.index(a)?(xp(o,s),xf(xg(o,e(t,r,n,i,a+1)),l)):(o&&xf(xg(o,xy(t,r,a+1)),l),xm(r,n,a,l),s&&xf(xg(s,xy(n,i,a+1)),l)),xm(i,null,a,l),new xa(l)}(t,e,a,r,i))}{let e=t.parent,i=e.content;return xg(e,i.cut(0,t.parentOffset).append(n.content).append(i.cut(r.parentOffset)))}}(n,i,r,0)}nodeAt(e){for(let t=this;;){let{index:r,offset:n}=t.content.findIndex(e);if(!(t=t.maybeChild(r)))return null;if(n==e||t.isText)return t;e-=n+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let n=this.content.child(t-1);return{node:n,index:t-1,offset:r-n.nodeSize}}resolve(e){return xv.resolveCached(this,e)}resolveNoCache(e){return xv.resolve(this,e)}rangeHasMark(e,t,r){let n=!1;return t>e&&this.nodesBetween(e,t,e=>(r.isInSet(e.marks)&&(n=!0),!n)),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}
93toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),xC(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=xa.empty,n=0,i=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,n,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,t,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),a=i&&i.matchFragment(this.content,t);return!!a&&a.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=xu.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!xu.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let r;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,r)}let n=xa.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,n,r);return i.type.checkAttrs(i.attrs),i}}xS.prototype.text=void 0;class xE extends xS{constructor(e,t,r,n){if(super(e,t,null,n),!r)throw RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xE(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xE(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function xC(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}class x${constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var r;let n,i=new xT(e,t);if(null==i.next)return x$.empty;let a=function e(t){let r=[];do r.push(function(t){let r=[];do r.push(function(t){let r=function(t){if(t.eat("(")){let r=e(t);return t.eat(")")||t.err("Missing closing paren"),r}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(t)&&i.push(n)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))r={type:"plus",expr:r};else if(t.eat("*"))r={type:"star",expr:r};else if(t.eat("?"))r={type:"opt",expr:r};else if(t.eat("{"))r=function(e,t){let r=xI(e),n=r;return e.eat(",")&&(n="}"!=e.next?xI(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}(t,r);else break;return r}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==r.length?r[0]:{type:"seq",exprs:r}}(t));while(t.eat("|"))return 1==r.length?r[0]:{type:"choice",exprs:r}}(i);i.next&&i.err("Unexpected trailing text");let o=(r=function(e){let t=[[]];return i(function e(t,a){if("choice"==t.type)return t.exprs.reduce((t,r)=>t.concat(e(r,a)),[]);if("seq"==t.type)for(let n=0;;n++){let o=e(t.exprs[n],a);if(n==t.exprs.length-1)return o;i(o,a=r())}
93else if("star"==t.type){let o=r();return n(a,o),i(e(t.expr,o),o),[n(o)]}else if("plus"==t.type){let o=r();return i(e(t.expr,a),o),i(e(t.expr,o),o),[n(o)]}else if("opt"==t.type)return[n(a)].concat(e(t.expr,a));else if("range"==t.type){let o=a;for(let n=0;n<t.min;n++){let n=r();i(e(t.expr,o),n),o=n}if(-1==t.max)i(e(t.expr,o),o);else for(let a=t.min;a<t.max;a++){let a=r();n(o,a),i(e(t.expr,o),a),o=a}return[n(o)]}else if("name"==t.type)return[n(a,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),r()),t;function r(){return t.push([])-1}function n(e,r,n){let i={term:n,to:r};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(a),n=Object.create(null),function e(t){let i=[];t.forEach(e=>{r[e].forEach(({term:e,to:t})=>{let n;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(n=i[t][1]);xA(r,t).forEach(t=>{n||i.push([e,n=[]]),-1==n.indexOf(t)&&n.push(t)})}})});let a=n[t.join(",")]=new x$(t.indexOf(r.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(xN);a.next.push({type:i[t][0],next:n[r.join(",")]||e(r)})}return a}(xA(r,0)));return function(e,t){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:r,next:o}=e.next[t];a.push(r.name),i&&!(r.isText||r.hasRequiredAttrs())&&(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,i),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let n=this;for(let i=t;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let n=[this];return function i(a,o){let s=a.matchFragment(e,r);if(s&&(!t||s.validEnd))return xa.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:r}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let t=n;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];a.isLeaf||a.hasRequiredAttrs()||a.name in t||n.type&&!o.validEnd||(r.push({match:a.contentMatch,type:a,via:n}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&t(r.next[n].next)}(this),e.map((t,r)=>{let n=r+(t.validEnd?"*":" ")+" ";for(let r=0;r<t.next.length;r++)n+=(r?", ":"")+t.next[r].type.name+"->"+e.indexOf(t.next[r].next);return n}).join("\n")}}x$.empty=new x$(!0);class xT{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function xI(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function xN(e,t){return t-e}function xA(e,t){let r=[];return function t(n){let i=e[n];if(1==i.length&&!i[0].term)return t(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:a}=i[e];n||-1!=r.indexOf(a)||t(a)}}(t),r.sort(xN)}function xj(e){let t=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;t[r]=n.default}return t}function xM(e,t){let r=Object.create(null);for(let n in e){let i=t&&t[n];if(void 0===i){let t=e[n];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+n)}r[n]=i}return r}function xO(e,t,r,n){for(let n in t)if(!(n in e))throw RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in e){let n=e[r];
93n.validate&&n.validate(t[r])}}function xD(e,t){let r=Object.create(null);if(t)for(let n in t)r[n]=new xP(e,n,t[n]);return r}class xR{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=xD(e,r.attrs),this.defaultAttrs=xj(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==x$.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:xM(this.attrs,e)}create(e=null,t,r){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new xS(this,this.computeAttrs(e),xa.from(t),xu.setFrom(r))}createChecked(e=null,t,r){return t=xa.from(t),this.checkContent(t),new xS(this,this.computeAttrs(e),t,xu.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),(t=xa.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let n=this.contentMatch.matchFragment(t),i=n&&n.fillBefore(xa.empty,!0);return i?new xS(this,e,t.append(i),xu.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){xO(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:xu.none:e}static compile(e,t){let r=Object.create(null);e.forEach((e,n)=>r[e]=new xR(e,t,n));let n=t.spec.topNode||"doc";if(!r[n])throw RangeError("Schema is missing its top node type ('"+n+"')");if(!r.text)throw RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw RangeError("The text node type should not have attributes");return r}}class xP{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,r){let n=r.split("|");return r=>{let i=null===r?"null":typeof r;if(0>n.indexOf(i))throw RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class xz{constructor(e,t,r,n){this.name=e,this.rank=t,this.schema=r,this.spec=n,this.attrs=xD(e,n.attrs),this.excluded=null;let i=xj(this.attrs);this.instance=i?new xu(this,i):null}create(e=null){return!e&&this.instance?this.instance:new xu(this,xM(this.attrs,e))}static compile(e,t){let r=Object.create(null),n=0;return e.forEach((e,i)=>r[e]=new xz(e,n++,t,i)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){xO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class xL{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=xi.from(e.nodes),t.marks=xi.from(e.marks||{}),this.nodes=xR.compile(this.spec.nodes,this),this.marks=xz.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],n=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=x$.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?xF(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],r=t.spec.excludes;t.excluded=null==r?[t]:""==r?[]:xF(this,r.split(" "))}this.nodeFromJSON=e=>xS.fromJSON(this,e),this.markFromJSON=e=>xu.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,n){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof xR){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,r,n)}text(e,t){let r=this.nodes.text;return new xE(r,r.defaultAttrs,e,xu.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function xF(e,t){let r=[];for(let n=0;n<t.length;n++){let i=t[n],a=e.marks[i],o=a;if(a)r.push(a);else for(let t in e.marks){let n=e.marks[t];("_"==i||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=n)}if(!o)throw SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}class xU{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];
93t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>r.indexOf(t)&&r.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let r=e.nodes[t.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let r=new xK(this,t,!1);return r.addAll(e,xu.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new xK(this,t,!0);return r.addAll(e,xu.none,t.from,t.to),xd.maxOpen(r.finish())}matchTag(e,t,r){for(let a=r?this.tags.indexOf(r)+1:0;a<this.tags.length;a++){var n,i;let r=this.tags[a];if(n=e,i=r.tag,(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,i)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}matchStyle(e,t,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],a=n.style;if(0==a.indexOf(e)&&(!n.context||r.matchesContext(n.context))&&(!(a.length>e.length)||61==a.charCodeAt(e.length)&&a.slice(e.length+1)==t)){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let t=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<t.length;n++){let e=t[n];if((null==e.priority?50:e.priority)<r)break}t.splice(n,0,e)}for(let t in e.marks){let n=e.marks[t].spec.parseDOM;n&&n.forEach(e=>{r(e=xW(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let n=e.nodes[t].spec.parseDOM;n&&n.forEach(e=>{r(e=xW(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xU(e,xU.schemaRules(e)))}}let xB={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},xZ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},xq={ol:!0,ul:!0};function xV(e,t,r){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&r}class xH{constructor(e,t,r,n,i,a){this.type=e,this.attrs=t,this.marks=r,this.solid=n,this.options=a,this.content=[],this.activeMarks=xu.none,this.match=i||(4&a?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(xa.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,r;return(r=t.findWrapping(e.type))?(this.match=t,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=xa.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(xa.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!xB.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class xK{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n=t.topNode,i,a=xV(null,t.preserveWhitespace,0)|4*!!r;i=n?new xH(n.type,n.attrs,xu.none,!0,t.topMatch||n.type.contentMatch,a):r?new xH(null,null,xu.none,!0,null,a):new xH(e.schema.topNodeType,null,xu.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,n=this.top,i=2&n.options?"full":this.localPreserveWS||(1&n.options)>0,{schema:a}=this.parser;if("full"===i||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if("full"===i)r=r.replace(/\r\n?/g,"\n");else if(a.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=r.split(/\r?\n|\r/);for(let r=0;r<e.length;r++)r&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[r]&&this.insertNode(a.text(e[r]),t,!/\S/.test(e[r]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let t=n.content[n.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(r=r.slice(1))}r&&this.insertNode(a.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let n=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;xq.hasOwnProperty(a)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;
93e&&xq.hasOwnProperty(e)&&r?(r.appendChild(t),t=r):"li"==e?r=t:e&&(r=null)}}(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(s?s.ignore:xZ.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let r,n=this.needsBlock;if(xB.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),r=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),r&&this.sync(i),this.needsBlock=n}else{let r=this.readStyles(e,t);r&&this.addElementByRule(e,s,r,!1===s.consuming?o:void 0)}this.localPreserveWS=n}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],i=r.getPropertyValue(n);if(i)for(let e;;){let r=this.parser.matchStyle(n,i,this,e);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1===r.consuming)e=r;else break}}return t}addElementByRule(e,t,r,n){let i,a;
93if(t.node)if((a=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(a.create(t.attrs),r,"BR"==e.nodeName)||this.leafFallback(e,r);else{let e=this.enter(a,t.attrs||null,r,t.preserveWhitespace);e&&(i=!0,r=e)}else{let e=this.parser.schema.marks[t.mark];r=r.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,r,!1));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,r,n){let i=r||0;for(let a=r?e.childNodes[r]:e.firstChild,o=null==n?null:e.childNodes[n];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,r){let n,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!n||n.length>s.length+a)&&(n=s,i=o,!s.length))break;if(o.solid){if(r)break;a+=2}}if(!n)return null;this.sync(i);for(let e=0;e<n.length;e++)t=this.enterInner(n[e],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let n=this.findPlace(e,t,r);if(n){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let r=xu.none;for(let i of n.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):xJ(i.type,e.type))&&(r=i.addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r,n){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,n)),i}enterInner(e,t,r,n=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=xV(e,i,a.options);4&a.options&&0==a.content.length&&(o|=4);let s=xu.none;return r=r.filter(t=>(a.type?!a.type.allowsMarkType(t.type):!xJ(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new xH(e,t,s,n,null,o)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let t=r.length-1;t>=0;t--)e+=r[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let n=0;n<this.find.length;n++)null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)&&t.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,n=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+ +!n,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(""==s){if(e==t.length-1||0==e)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||0==o&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];
93if(t.isTextblock&&t.defaultAttrs)return t}}}function xW(e){let t={};for(let r in e)t[r]=e[r];return t}function xJ(e,t){let r=t.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:i}=e.edge(r);if(n==t||0>a.indexOf(i)&&o(i))return!0}};if(o(i.contentMatch))return!0}}class xG{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=xY(t).createDocumentFragment());let n=r,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let r=0,a=0;for(;r<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[r][0])||!1===t.type.spec.spanning)break;r++,a++}for(;r<i.length;)n=i.pop()[1];for(;a<e.marks.length;){let r=e.marks[a++],o=this.serializeMark(r,e.isInline,t);o&&(i.push([r,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(e,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:n}=x0(xY(t),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,n)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let n=e.marks.length-1;n>=0;n--){let i=this.serializeMark(e.marks[n],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let n=this.marks[e.type.name];return n&&x0(xY(r),n(e,t),null,e.attrs)}static renderSpec(e,t,r=null,n){return x0(e,t,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xG(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=xX(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return xX(e.marks)}}function xX(e){let t={};for(let r in e){let n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function xY(e){return e.document||window.document}let xQ=new WeakMap;function x0(e,t,r,n){let i,a,o;if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let s=t[0],l;if("string"!=typeof s)throw RangeError("Invalid array passed to renderSpec");if(n&&(void 0===(a=xQ.get(n))&&xQ.set(n,(o=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])o||(o=[]),o.push(t);else for(let r=0;r<t.length;r++)e(t[r]);else for(let r in t)e(t[r])}(n),a=o)),l=a)&&l.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let u=s.indexOf(" ");u>0&&(r=s.slice(0,u),s=s.slice(u+1));let c=r?e.createElementNS(r,s):e.createElement(s),d=t[1],p=1;if(d&&"object"==typeof d&&null==d.nodeType&&!Array.isArray(d)){for(let e in p=2,d)if(null!=d[e]){let t=e.indexOf(" ");t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),d[e]):"style"==e&&c.style?c.style.cssText=d[e]:c.setAttribute(e,d[e])}}for(let a=p;a<t.length;a++){let o=t[a];if(0===o){if(a<t.length-1||a>p)throw RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}{let{dom:t,contentDOM:a}=x0(e,o,r,n);if(c.appendChild(t),a){if(i)throw RangeError("Multiple content holes");i=a}}}return{dom:c,contentDOM:i}}class x1{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class x2{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&x2.empty)return x2.empty}recover(e){let t=0,r=65535&e;if(!this.inverted)for(let e=0;e<r;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let n=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[o+i],u=this.ranges[o+a],c=s+l;if(e<=c){let i=l?e==s?-1:e==c?1:t:t,a=s+n+(i<0?0:u);if(r)return a;let d=e==(t<0?s:c)?null:o/3+(e-s)*65536,p=e==s?2:e==c?1:4;return(t<0?e!=s:e!=c)&&(p|=8),new x1(a,p,d)}n+=u-l}return r?e+n:new x1(e+n,0,null)}touches(e,t){let r=0,n=65535&t,i=this.inverted?2:1,a=this.inverted?1:2;
93for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?r:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==3*n)return!0;r+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let a=this.ranges[n],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),l=this.ranges[n+t],u=this.ranges[n+r];e(o,o+l,s,s+u),i+=u-l}}invert(){return new x2(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?x2.empty:new x2(e<0?[0,-e,0]:[0,0,e])}}x2.empty=new x2([]);class x4{constructor(e,t,r=0,n=e?e.length:0){this.mirror=t,this.from=r,this.to=n,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new x4(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let n=e.getMirror(t);this.appendMap(e._maps[t],null!=n&&n<t?r+n:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let n=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=n&&n>t?r-n-1:void 0)}}invert(){let e=new x4;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this._maps[r].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(r);if(null!=t&&t>r&&t<this.to){r=t,e=this._maps[t].recover(i.recover);continue}}n|=i.delInfo,e=i.pos}return r?e:new x1(e,n,null)}}let x5=Object.create(null);class x6{getMap(){return x2.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let r=x5[t.stepType];if(!r)throw RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in x5)throw RangeError("Duplicate use of step JSON ID "+e);return x5[e]=t,t.prototype.jsonID=e,t}}class x3{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new x3(e,null)}static fail(e){return new x3(null,e)}static fromReplace(e,t,r,n){try{return x3.ok(e.replace(t,r,n))}catch(e){if(e instanceof xc)return x3.fail(e.message);throw e}}}function x9(e,t,r){let n=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(x9(a.content,t,a))),a.isInline&&(a=t(a,r,i)),n.push(a)}return xa.fromArray(n)}class x8 extends x6{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.node(r.sharedDepth(this.to)),i=new xd(x9(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,n),t.openStart,t.openEnd);return x3.fromReplace(e,this.from,this.to,i)}invert(){return new x7(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new x8(t.pos,r.pos,this.mark)}merge(e){return e instanceof x8&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new x8(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new x8(t.from,t.to,e.markFromJSON(t.mark))}}x6.jsonID("addMark",x8);class x7 extends x6{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new xd(x9(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return x3.fromReplace(e,this.from,this.to,r)}invert(){return new x8(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new x7(t.pos,r.pos,this.mark)}merge(e){return e instanceof x7&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new x7(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new x7(t.from,t.to,e.markFromJSON(t.mark))}}x6.jsonID("removeMark",x7);class ke extends x6{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return x3.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return x3.fromReplace(e,this.pos,this.pos+1,new xd(xa.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(e))return new ke(this.pos,t.marks[r]);return new ke(this.pos,this.mark)}}return new kt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ke(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ke(t.pos,e.markFromJSON(t.mark))}}x6.jsonID("addNodeMark",ke);class kt extends x6{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return x3.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return x3.fromReplace(e,this.pos,this.pos+1,new xd(xa.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ke(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kt(t.pos,this.mark)}
93toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new kt(t.pos,e.markFromJSON(t.mark))}}x6.jsonID("removeNodeMark",kt);class kr extends x6{constructor(e,t,r,n=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=n}apply(e){return this.structure&&ki(e,this.from,this.to)?x3.fail("Structure replace would overwrite content"):x3.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new x2([this.from,this.to-this.from,this.slice.size])}invert(e){return new kr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new kr(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof kr)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?xd.empty:new xd(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new kr(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?xd.empty:new xd(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new kr(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new kr(t.from,t.to,xd.fromJSON(e,t.slice),!!t.structure)}}x6.jsonID("replace",kr);class kn extends x6{constructor(e,t,r,n,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(ki(e,this.from,this.gapFrom)||ki(e,this.gapTo,this.to)))return x3.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return x3.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?x3.fromReplace(e,this.from,this.to,r):x3.fail("Content does not fit in gap")}getMap(){return new x2([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new kn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),n=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||n<t.pos||i>r.pos?null:new kn(t.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new kn(t.from,t.to,t.gapFrom,t.gapTo,xd.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ki(e,t,r){let n=e.resolve(t),i=r-t,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let e=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ka(e,t,r,n=r.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let l=a.child(t),u=s+l.nodeSize,c=n.matchType(l.type);if(c){n=c;for(let t=0;t<l.marks.length;t++)r.allowsMarkType(l.marks[t].type)||e.step(new x7(s,u,l.marks[t]));if(i&&l.isText&&"pre"!=r.whitespace){let e,t=/\r?\n|\r/g,n;for(;e=t.exec(l.text);)n||(n=new xd(xa.from(r.schema.text(" ",r.allowedMarks(l.marks))),0,0)),o.push(new kr(s+e.index,s+e.index+e[0].length,n))}}else o.push(new kr(s,u,xd.empty));s=u}if(!n.validEnd){let t=n.fillBefore(xa.empty,!0);e.replace(s,s,new xd(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function ko(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,n=0,i=0;;--r){let a=e.$from.node(r),o=e.$from.index(r)+n,s=e.$to.indexAfter(r)-i;if(r<e.depth&&a.canReplace(o,s,t))return r;if(0==r||a.type.spec.isolating||!((0==o||a.canReplace(o,a.childCount))&&(s==a.childCount||a.canReplace(0,s))))break;o&&(n=1),s<a.childCount&&(i=1)}return null}function ks(e,t,r=null,n=e){let i=function(e,t){let{parent:r,startIndex:n,endIndex:i}=e,a=r.contentMatchAt(n).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return r.canReplaceWith(n,i,o)?a:null}(e,t),a=i&&function(e,t){let{parent:r,startIndex:n,endIndex:i}=e,a=r.child(n),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=n;s&&e<i;e++)s=s.matchType(r.child(e).type);return s&&s.validEnd?o:null}(n,t);return a?i.map(kl).concat({type:t,attrs:r}).concat(a.map(kl)):null}function kl(e){return{type:e,attrs:null}}function ku(e,t,r,n){t.forEach((i,a)=>
93{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(n).map(r+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function kc(e,t,r,n){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+a);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function kd(e,t,r=1,n){let i=e.resolve(t),a=i.depth-r,o=n&&n[n.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=r-2;e>a;e--,t--){let r=i.node(e),a=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(a,r.childCount),s=n&&n[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let l=n&&n[t]||r;if(!r.canReplace(a+1,r.childCount)||!l.type.validContent(o))return!1}let s=i.indexAfter(a),l=n&&n[0];return i.node(a).canReplaceWith(s,s,l?l.type:i.node(a+1).type)}function kp(e,t){let r=e.resolve(t),n=r.index();return kh(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function kh(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==n?e.type.schema.nodes.text:a.type;if(!(r=r.matchType(o))||!e.type.allowsMarks(a.marks))return!1}return r.validEnd}(e,t))}function kf(e,t,r=-1){let n=e.resolve(t);for(let e=n.depth;;e--){let i,a,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,a=n.nodeAfter):r>0?(i=n.node(e+1),o++,a=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),a=n.node(e+1)),i&&!i.isTextblock&&kh(i,a)&&n.node(e).canReplace(o,o+1))return t;if(0==e)break;t=r<0?n.before(e):n.after(e)}}function km(e,t,r){let n=e.resolve(t);if(!r.content.size)return t;let i=r.content;for(let e=0;e<r.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==r.openStart&&r.size?2:1);e++)for(let t=n.depth;t>=0;t--){let r=t==n.depth?0:n.pos<=(n.start(t+1)+n.end(t+1))/2?-1:1,a=n.index(t)+ +(r>0),o=n.node(t),s=!1;if(1==e)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return 0==r?n.pos:r<0?n.before(t+1):n.after(t+1)}return null}function kg(e,t,r=t,n=xd.empty){if(t==r&&!n.size)return null;let i=e.resolve(t),a=e.resolve(r);return ky(i,a,n)?new kr(t,r,n):new kv(i,a,n).fit()}function ky(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}x6.jsonID("replaceAround",kn);class kv{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=xa.empty;for(let t=0;t<=e.depth;t++){let r=e.node(t);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=xa.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,n=this.close(e<0?this.$to:r.doc.resolve(e));if(!n)return null;let i=this.placed,a=r.depth,o=n.depth;for(;a&&o&&1==i.childCount;)i=i.firstChild.content,a--,o--;let s=new xd(i,a,o);return e>-1?new kn(r.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||r.pos!=this.$to.pos?new kr(r.pos,n.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=1==t?e:this.unplaced.openStart;r>=0;r--){let e=null,n=(r?(e=kk(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:a,match:o}=this.frontier[i],s,l=null;if(1==t&&(n?o.matchType(n.type)||(l=o.fillBefore(xa.from(n),!1)):e&&a.compatibleContent(e.type)))return{sliceDepth:r,frontierDepth:i,parent:e,inject:l};if(2==t&&n&&(s=o.findWrapping(n.type)))return{sliceDepth:r,frontierDepth:i,parent:e,wrap:s};if(e&&o.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,n=kk(e,t);return!!n.childCount&&!n.firstChild.isLeaf&&(this.unplaced=new xd(e,t+1,Math.max(r,n.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,n=kk(e,t);if(n.childCount<=1&&t>0){let i=e.size-t<=t+n.size;this.unplaced=new xd(kb(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new xd(kb(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:n,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=r?r.content:a.content,s=a.openStart-e,l=0,u=[],{match:c,type:d}=this.frontier[t];if(n){for(let e=0;e<n.childCount;e++)u.push(n.child(e));c=c.matchFragment(n)}let p=o.size+e-(a.content.size-a.openEnd);for(;l<o.childCount;){let e=o.child(l),t=c.matchType(e.type);if(!t)break;(++l>1||0==s||e.content.size)&&(c=t,u.push(function e(t,r,n){if(r<=0)return t;let i=t.content;return r>1&&(i=i.replaceChild(0,e(i.firstChild,r-1,1==i.childCount?n-1:0))),r>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(xa.empty,!0)))),t.copy(i)}(e.mark(d.allowedMarks(e.marks)),1==l?s:0,l==o.childCount?p:-1)))}let h=l==o.childCount;h||(p=-1),this.placed=kx(this.placed,t,xa.from(u)),this.frontier[t].match=c,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?xd.empty:new xd(kb(a.content,e-1,1),e-1,p<0?a.openEnd:e-1):new xd(kb(a.content,e,l),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!kw(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:n}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=kw(e,t,n,r,i);if(a){for(let r=t-1;r>=0;r--){let{match:t,type:n}=this.frontier[r],i=kw(e,r,n,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=kx(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let t=e.node(r),n=t.type.contentMatch.fillBefore(t.content,!0,e.index(r));this.openFrontierNode(t.type,t.attrs,n)}return e}openFrontierNode(e,t=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=kx(this.placed,this.depth,xa.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(xa.empty,!0);e.childCount&&(this.placed=kx(this.placed,this.frontier.length,e))}}function kb(e,t,r){return 0==t?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(kb(e.firstChild.content,t-1,r)))}function kx(e,t,r){return 0==t?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(kx(e.last
93Child.content,t-1,r)))}function kk(e,t){for(let r=0;r<t;r++)e=e.firstChild.content;return e}function kw(e,t,r,n,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!r.compatibleContent(a.type))return null;let s=n.fillBefore(a.content,!0,o);return s&&!function(e,t,r){for(let n=r;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}(r,a.content,o)?s:null}function k_(e,t){let r=[],n=Math.min(e.depth,t.depth);for(let i=n;i>=0;i--){let n=e.start(i);if(n<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(n==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==n-1)&&r.push(i)}return r}class kS extends x6{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return x3.fail("No node at attribute step's position");let r=Object.create(null);for(let e in t.attrs)r[e]=t.attrs[e];r[this.attr]=this.value;let n=t.type.create(r,null,t.marks);return x3.fromReplace(e,this.pos,this.pos+1,new xd(xa.from(n),0,+!t.isLeaf))}getMap(){return x2.empty}invert(e){return new kS(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kS(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new kS(t.pos,t.attr,t.value)}}x6.jsonID("attr",kS);class kE extends x6{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return x3.ok(r)}getMap(){return x2.empty}invert(e){return new kE(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new kE(t.attr,t.value)}}x6.jsonID("docAttr",kE);let kC=class extends Error{};(kC=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r}).prototype=Object.create(Error.prototype),kC.prototype.constructor=kC,kC.prototype.name="TransformError";class k${constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new x4}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new kC(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let n=this.mapping.maps[r];r&&(e=n.map(e,1),t=n.map(t,-1)),n.forEach((r,n,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=xd.empty){let n=kg(this.doc,e,t,r);return n&&this.step(n),this}replaceWith(e,t,r){return this.replace(e,t,new xd(xa.from(r),0,0))}delete(e,t){return this.replace(e,t,xd.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return!function(e,t,r,n){if(!n.size)return e.deleteRange(t,r);let i=e.doc.resolve(t),a=e.doc.resolve(r);if(ky(i,a,n))return e.step(new kr(t,r,n));let o=k_(i,a);0==o[o.length-1]&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let r=i.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let l=o.indexOf(s),u=[],c=n.openStart;for(let e=n.content,t=0;;t++){let r=e.firstChild;if(u.push(r),t==n.openStart)break;e=r.content}for(let e=c-1;e>=0;e--){var d;let t=u[e],r=(d=t.type).spec.defining||d.spec.definingForContent;if(r&&!t.sameMarkup(i.node(Math.abs(s)-1)))c=e;else if(r||!t.type.isTextblock)break}for(let t=n.openStart;t>=0;t--){let s=(t+c+1)%(n.openStart+1),d=u[s];if(d)for(let t=0;t<o.length;t++){let u=o[(t+l)%o.length],c=!0;u<0&&(c=!1,u=-u);let p=i.node(u-1),h=i.index(u-1);if(p.canReplaceWith(h,h,d.type,d.marks))return e.replace(i.before(u),c?a.after(u):r,new xd(function e(t,r,n,i,a){if(r<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(e(a.content,r+1,n,i,a)))}if(r>i){let e=a.contentMatchAt(0),r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(xa.empty,!0))}return t}(n.content,0,n.openStart,s),s,n.openEnd))}}let p=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,r,n),!(e.steps.length>p));s--){let e=o[s];e<0||(t=i.before(e),r=a.after(e))}}(this,e,t,r),this}replaceRangeWith(e,t,r){var n=e,i=t;if(!r.isInline&&n==i&&this.doc.resolve(n).parent.content.size){let e=function(e,t,r){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),r))return t;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let t=n.index(e);if(n.node(e).canReplaceWith(t,t,r))return n.before(e+1);if(t>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let t=n.indexAfter(e);if(n.node(e).canReplaceWith(t,t,r))return n.after(e+1);if(t<n.node(e).childCount)break}return null}(this.doc,n,r.type);null!=e&&(n=i=e)}return this.replaceRange(n,i,new xd(xa.from(r),0,0)),this}deleteRange(e,t){return!function(e,t,r){let n=e.doc.resolve(t),i=e.doc.resolve(r),a=k_(n,i);for(let t=0;t<a.length;t++){let r=a[t],o=t==a.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return e.delete(n.start(r),i.end(r));if(r>
930&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let a=1;a<=n.depth&&a<=i.depth;a++)if(t-n.start(a)==n.depth-a&&r>n.end(a)&&i.end(a)-r!=i.depth-a&&n.start(a-1)==i.start(a-1)&&n.node(a-1).canReplace(n.index(a-1),i.index(a-1)))return e.delete(n.before(a),r);e.delete(t,r)}(this,e,t),this}lift(e,t){return!function(e,t,r){let{$from:n,$to:i,depth:a}=t,o=n.before(a+1),s=i.after(a+1),l=o,u=s,c=xa.empty,d=0;for(let e=a,t=!1;e>r;e--)t||n.index(e)>0?(t=!0,c=xa.from(n.node(e).copy(c)),d++):l--;let p=xa.empty,h=0;for(let e=a,t=!1;e>r;e--)t||i.after(e+1)<i.end(e)?(t=!0,p=xa.from(i.node(e).copy(p)),h++):u++;e.step(new kn(l,u,o,s,new xd(c.append(p),d,h),c.size-d,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-r),o=a.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,t=!!o.contentMatch.matchType(i);e&&!t?n=!1:!e&&t&&(n=!0)}let s=e.steps.length;if(!1===n){let n=e.doc.resolve(t+r);kc(e,n.node(),n.before(),s)}o.inlineContent&&ka(e,t+r-1,o,a.node().contentMatchAt(a.index()),null==n);let l=e.mapping.slice(s),u=l.map(t-r);if(e.step(new kr(u,l.map(t+r,-1),xd.empty,!0)),!0===n){let t=e.doc.resolve(u);ku(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,r){let n=xa.empty;for(let e=r.length-1;e>=0;e--){if(n.size){let t=r[e].type.contentMatch.matchFragment(n);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=xa.from(r[e].type.create(r[e].attrs,n))}let i=t.start,a=t.end;e.step(new kn(i,a,i,a,new xd(n,0,0),r.length,!0))}(this,e,t),this}setBlockType(e,t=e,r,n=null){var i=this;if(!r.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let a=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var o,s,l;let u,c,d="function"==typeof n?n(e):n;if(e.isTextblock&&!e.hasMarkup(r,d)&&(o=i.doc,s=i.mapping.slice(a).map(t),l=r,c=(u=o.resolve(s)).index(),u.parent.canReplaceWith(c,c+1,l))){let n=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?n=!1:!e&&t&&(n=!0)}!1===n&&kc(i,e,t,a),ka(i,i.mapping.slice(a).map(t,1),r,void 0,null===n);let o=i.mapping.slice(a),s=o.map(t,1),l=o.map(t+e.nodeSize,1);return i.step(new kn(s,l,s+1,l-1,new xd(xa.from(r.create(d,null,e.marks)),0,0),1,!0)),!0===n&&ku(i,e,t,a),!1}}),this}setNodeMarkup(e,t,r=null,n){return!function(e,t,r,n,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError("No node at given position");r||(r=a.type);let o=r.create(n,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!r.validContent(a.content))throw RangeError("Invalid content for node type "+r.name);e.step(new kn(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new xd(xa.from(o),0,0),1,!0))}(this,e,t,r,n),this}setNodeAttribute(e,t,r){return this.step(new kS(e,t,r)),this}setDocAttribute(e,t){return this.step(new kE(e,t)),this}addNodeMark(e,t){return this.step(new ke(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw RangeError("No node at position "+e);if(t instanceof xu)t.isInSet(r.marks)&&this.step(new kt(e,t));else{let n=r.marks,i,a=[];for(;i=t.isInSet(n);)a.push(new kt(e,i)),n=i.removeFromSet(n);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,r){return!function(e,t,r=1,n){let i=e.doc.resolve(t),a=xa.empty,o=xa.empty;for(let e=i.depth,t=i.depth-r,s=r-1;e>t;e--,s--){a=xa.from(i.node(e).copy(a));let t=n&&n[s];o=xa.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new kr(t,t,new xd(a.append(o),r,r),!0))}(this,e,t,r),this}addMark(e,t,r){var n;let i,a,o,s;return n=this,o=[],s=[],n.doc.nodesBetween(e,t,(n,l,u)=>{if(!n.isInline)return;let c=n.marks;if(!r.isInSet(c)&&u.type.allowsMarkType(r.type)){let u=Math.max(l,e),d=Math.min(l+n.nodeSize,t),p=r.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(p)||(i&&i.to==u&&i.mark.eq(c[e])?i.to=d:o.push(i=new x7(u,d,c[e])));a&&a.to==u?a.to=d:s.push(a=new x8(u,d,r))}}),o.forEach(e=>
93n.step(e)),s.forEach(e=>n.step(e)),this}removeMark(e,t,r){var n;let i,a;return n=this,i=[],a=0,n.doc.nodesBetween(e,t,(n,o)=>{if(!n.isInline)return;a++;let s=null;if(r instanceof xz){let e=n.marks,t;for(;t=r.isInSet(e);)(s||(s=[])).push(t),e=t.removeFromSet(e)}else r?r.isInSet(n.marks)&&(s=[r]):s=n.marks;if(s&&s.length){let r=Math.min(o+n.nodeSize,t);for(let t=0;t<s.length;t++){let n=s[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(l=t)}l?(l.to=r,l.step=a):i.push({style:n,from:Math.max(o,e),to:r,step:a})}}}),i.forEach(e=>n.step(new x7(e.from,e.to,e.style))),this}clearIncompatible(e,t,r){return ka(this,e,t,r),this}}let kT=Object.create(null);class kI{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new kN(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=xd.empty){let r=t.content.lastChild,n=null;for(let e=0;e<t.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:l}=a[o],u=e.mapping.slice(i);e.replaceRange(u.map(s.pos),u.map(l.pos),o?xd.empty:t),0==o&&kF(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:a,$to:o}=n[i],s=e.mapping.slice(r),l=s.map(a.pos),u=s.map(o.pos);i?e.deleteRange(l,u):(e.replaceRangeWith(l,u,t),kF(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let n=e.parent.inlineContent?new kM(e):kL(e.node(0),e.parent,e.pos,e.index(),t,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=t<0?kL(e.node(0),e.node(n),e.before(n+1),e.index(n),t,r):kL(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,t,r);if(i)return i}return null}
93static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new kP(e.node(0))}static atStart(e){return kL(e,e,0,0,1)||new kP(e)}static atEnd(e){return kL(e,e,e.content.size,e.childCount,-1)||new kP(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let r=kT[t.type];if(!r)throw RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in kT)throw RangeError("Duplicate use of selection JSON ID "+e);return kT[e]=t,t.prototype.jsonID=e,t}getBookmark(){return kM.between(this.$anchor,this.$head).getBookmark()}}kI.prototype.visible=!0;class kN{constructor(e,t){this.$from=e,this.$to=t}}let kA=!1;function kj(e){kA||e.parent.inlineContent||(kA=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class kM extends kI{constructor(e,t=e){kj(e),kj(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return kI.near(r);let n=e.resolve(t.map(this.anchor));return new kM(n.parent.inlineContent?n:r,r)}replace(e,t=xd.empty){if(super.replace(e,t),t==xd.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof kM&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new kO(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new kM(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let n=e.resolve(t);return new this(n,r==t?n:e.resolve(r))}static between(e,t,r){let n=e.pos-t.pos;if((!r||n)&&(r=n>=0?1:-1),!t.parent.inlineContent){let e=kI.findFrom(t,r,!0)||kI.findFrom(t,-r,!0);if(!e)return kI.near(t,r);t=e.$head}return e.parent.inlineContent||(0==n?e=t:(e=(kI.findFrom(e,-r,!0)||kI.findFrom(e,r,!0)).$anchor).pos<t.pos!=n<0&&(e=t)),new kM(e,t)}}kI.jsonID("text",kM);class kO{constructor(e,t){this.anchor=e,this.head=t}map(e){return new kO(e.map(this.anchor),e.map(this.head))}resolve(e){return kM.between(e.resolve(this.anchor),e.resolve(this.head))}}class kD extends kI{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:n}=t.mapResult(this.anchor),i=e.resolve(n);return r?kI.near(i):new kD(i)}content(){return new xd(xa.from(this.node),0,0)}eq(e){return e instanceof kD&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new kR(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new kD(e.resolve(t.anchor))}static create(e,t){return new kD(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}kD.prototype.visible=!1,kI.jsonID("node",kD);class kR{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new kO(r,r):new kR(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&kD.isSelectable(r)?new kD(t):kI.near(t)}}class kP extends kI{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=xd.empty){if(t==xd.empty){e.delete(0,e.doc.content.size);let t=kI.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new kP(e)}map(e){return new kP(e)}eq(e){return e instanceof kP}getBookmark(){return kz}}kI.jsonID("all",kP);let kz={map(){return this},resolve:e=>new kP(e)};function kL(e,t,r,n,i,a=!1){if(t.inlineContent)return kM.create(e,r);for(let o=n-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let n=t.child(o);if(n.isAtom){if(!a&&kD.isSelectable(n))return kD.create(e,r-(i<0?n.nodeSize:0))}else{let t=kL(e,n,r+i,i<0?n.childCount:0,i,a);if(t)return t}r+=n.nodeSize*i}return null}function kF(e,t,r){let n,i=e.steps.length-1;if(i<t)return;let a=e.steps[i];(a instanceof kr||a instanceof kn)&&(e.mapping.maps[i].forEach((e,t,r,i)=>{null==n&&(n=i)}),e.setSelection(kI.near(e.doc.resolve(n),r)))}class kU extends k${constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return xu.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||xu.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let n=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=r==t?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,n.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(kI.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function kB(e,t){return t&&e?e.bind(t):e}class kZ{constructor(e,t,r){this.name=e,this.init=kB(t.init,r),this.apply=kB(t.a
93pply,r)}}let kq=[new kZ("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new kZ("selection",{init:(e,t)=>e.selection||kI.atStart(t.doc),apply:e=>e.selection}),new kZ("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,r,n)=>n.selection.$cursor?e.storedMarks:null}),new kZ("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class kV{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=kq.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new kZ(e.key,e.spec.state,e))})}}class kH{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let t=this.config.plugins[r];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),n=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=n?n[a].n:0,l=n?n[a].state:this,u=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,l,r);if(u&&r.filterTransaction(u,a)){if(u.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<a?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}n&&(n[a]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new kH(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new kU(this)}static create(e){let t=new kV(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new kH(t);for(let n=0;n<t.fields.length;n++)r[t.fields[n].name]=t.fields[n].init(e,r);return r}reconfigure(e){let t=new kV(this.schema,e.plugins),r=t.fields,n=new kH(t);for(let t=0;t<r.length;t++){let i=r[t].name;n[i]=this.hasOwnProperty(i)?this[i]:r[t].init(e,n)}return n}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],i=n.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(n,this[n.key]))}return t}static fromJSON(e,t,r){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let n=new kV(e.schema,e.plugins),i=new kH(n);return n.fields.forEach(n=>{if("doc"==n.name)i.doc=xS.fromJSON(e.schema,t.doc);else if("selection"==n.name)i.selection=kI.fromJSON(i.doc,t.selection);else if("storedMarks"==n.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let o=r[a],s=o.spec.state;if(o.key==n.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[n.name]=s.fromJSON.call(o,e,t[a],i);return}}i[n.name]=n.init(e,i)}}),i}}class kK{constructor(e){this.spec=e,this.props={},e.props&&function e(t,r,n){for(let i in t){let a=t[i];a instanceof Function?a=a.bind(r):"handleDOMEvents"==i&&(a=e(a,r,{})),n[i]=a}return n}(e.props,this,this.props),this.key=e.key?e.key.key:kJ("plugin")}getState(e){return e[this.key]}}let kW=Object.create(null);function kJ(e){return e in kW?e+"$"+ ++kW[e]:(kW[e]=0,e+"$")}class kG{constructor(e="key"){this.key=kJ(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let kX=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function kY(e,t){let{$cursor:r}=e.selection;return r&&(t?t.endOfTextblock("backward",e):!(r.parentOffset>0))?r:null}let kQ=(e,t,r)=>{let n=kY(e,r);if(!n)return!1;let i=k4(n);if(!i){let r=n.blockRange(),i=r&&ko(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(wn(e,i,t,-1))return!0;
93if(0==n.parent.content.size&&(k1(a,"end")||kD.isSelectable(a)))for(let r=n.depth;;r--){let o=kg(e.doc,n.before(r),n.after(r),xd.empty);if(o&&o.slice.size<o.to-o.from){if(t){let r=e.tr.step(o);r.setSelection(k1(a,"end")?kI.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):kD.create(r.doc,i.pos-a.nodeSize)),t(r.scrollIntoView())}return!0}if(1==r||n.node(r-1).childCount>1)break}return!!a.isAtom&&i.depth==n.depth-1&&(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0)};function k0(e,t,r){let n=t.nodeBefore,i=t.pos-1;for(;!n.isTextblock;i--){if(n.type.spec.isolating)return!1;let e=n.lastChild;if(!e)return!1;n=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=kg(e.doc,i,o,xd.empty);if(!s||s.from!=i||s instanceof kr&&s.slice.size>=o-i)return!1;if(r){let t=e.tr.step(s);t.setSelection(kM.create(t.doc,i)),r(t.scrollIntoView())}return!0}function k1(e,t,r=!1){for(let n=e;n;n="start"==t?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)break}return!1}let k2=(e,t,r)=>{let{$head:n,empty:i}=e.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;a=k4(n)}let o=a&&a.nodeBefore;return!!o&&!!kD.isSelectable(o)&&(t&&t(e.tr.setSelection(kD.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function k4(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function k5(e,t){let{$cursor:r}=e.selection;return r&&(t?t.endOfTextblock("forward",e):!(r.parentOffset<r.parent.content.size))?r:null}let k6=(e,t,r)=>{let n=k5(e,r);if(!n)return!1;let i=k9(n);if(!i)return!1;let a=i.nodeAfter;if(wn(e,i,t,1))return!0;if(0==n.parent.content.size&&(k1(a,"start")||kD.isSelectable(a))){let r=kg(e.doc,n.before(),n.after(),xd.empty);if(r&&r.slice.size<r.to-r.from){if(t){let n=e.tr.step(r);n.setSelection(k1(a,"start")?kI.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):kD.create(n.doc,n.mapping.map(i.pos))),t(n.scrollIntoView())}return!0}}return!!a.isAtom&&i.depth==n.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0)},k3=(e,t,r)=>{let{$head:n,empty:i}=e.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;a=k9(n)}let o=a&&a.nodeAfter;return!!o&&!!kD.isSelectable(o)&&(t&&t(e.tr.setSelection(kD.create(e.doc,a.pos)).scrollIntoView()),!0)};function k9(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let r=e.node(t);if(e.index(t)+1<r.childCount)return e.doc.resolve(e.after(t+1));if(r.type.spec.isolating)break}return null}let k8=(e,t)=>{let{$head:r,$anchor:n}=e.selection;return!!r.parent.type.spec.code&&!!r.sameParent(n)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function k7(e){for(let t=0;t<e.edgeCount;t++){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}let we=(e,t)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),a=r.indexAfter(-1),o=k7(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let n=r.after(),i=e.tr.replaceWith(n,n,o.createAndFill());i.setSelection(kI.near(i.doc.resolve(n),1)),t(i.scrollIntoView())}return!0},wt=(e,t)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof kP||n.parent.inlineContent||i.parent.inlineContent)return!1;let a=k7(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(r,a.createAndFill());o.setSelection(kM.create(o.doc,r+1)),t(o.scrollIntoView())}return!0},wr=(e,t)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(kd(e.doc,n))return t&&t(e.tr.split(n).scrollIntoView()),!0}let n=r.blockRange(),i=n&&ko(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)};function wn(e,t,r,n){let i,a,o,s=t.nodeBefore,l=t.nodeAfter,u,c,d=s.type.spec.isolating||l.type.spec.isolating;if(!d&&(i=t.nodeBefore,a=t.nodeAfter,o=t.index(),i&&a&&i.type.compatibleContent(a.type)&&(!i.content.size&&t.parent.canReplace(o-1,o)?(r&&r(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(o,o+1)&&
93!!(a.isTextblock||kp(e.doc,t.pos))&&(r&&r(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let p=!d&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(u=(c=s.contentMatchAt(s.childCount)).findWrapping(l.type))&&c.matchType(u[0]||l.type).validEnd){if(r){let n=t.pos+l.nodeSize,i=xa.empty;for(let e=u.length-1;e>=0;e--)i=xa.from(u[e].create(null,i));i=xa.from(s.copy(i));let a=e.tr.step(new kn(t.pos-1,n,t.pos,n,new xd(i,1,0),u.length,!0)),o=a.doc.resolve(n+2*u.length);o.nodeAfter&&o.nodeAfter.type==s.type&&kp(a.doc,o.pos)&&a.join(o.pos),r(a.scrollIntoView())}return!0}let h=l.type.spec.isolating||n>0&&d?null:kI.findFrom(t,1),f=h&&h.$from.blockRange(h.$to),m=f&&ko(f);if(null!=m&&m>=t.depth)return r&&r(e.tr.lift(f,m).scrollIntoView()),!0;if(p&&k1(l,"start",!0)&&k1(s,"end")){let n=s,i=[];for(;i.push(n),!n.isTextblock;)n=n.lastChild;let a=l,o=1;for(;!a.isTextblock;a=a.firstChild)o++;if(n.canReplace(n.childCount,n.childCount,a.content)){if(r){let n=xa.empty;for(let e=i.length-1;e>=0;e--)n=xa.from(i[e].copy(n));r(e.tr.step(new kn(t.pos-i.length,t.pos+l.nodeSize,t.pos+o,t.pos+l.nodeSize-o,new xd(n,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function wi(e){return function(t,r){let n=t.selection,i=e<0?n.$from:n.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return!!i.node(a).isTextblock&&(r&&r(t.tr.setSelection(kM.create(t.doc,e<0?i.start(a):i.end(a)))),!0)}}let wa=wi(-1),wo=wi(1);function ws(e,t=null){return function(r,n){let i=!1;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:a},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(a,o,(n,a)=>{if(i)return!1;if(!(!n.isTextblock||n.hasMarkup(e,t)))if(n.type==e)i=!0;else{let t=r.doc.resolve(a),n=t.index();i=t.parent.canReplaceWith(n,n+1,e)}})}if(!i)return!1;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:a},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(a,o,e,t)}n(i.scrollIntoView())}return!0}}function wl(...e){return function(t,r,n){for(let i=0;i<e.length;i++)if(e[i](t,r,n))return!0;return!1}}let wu=wl(kX,kQ,k2),wc=wl(kX,k6,k3),wd={Enter:wl(k8,wt,wr,(e,t)=>{let{$from:r,$to:n}=e.selection;if(e.selection instanceof kD&&e.selection.node.isBlock)return!!r.parentOffset&&!!kd(e.doc,r.pos)&&(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],a,o,s=!1,l=!1;for(let e=r.depth;;e--){if(r.node(e).isBlock){let t;s=r.end(e)==r.pos+(r.depth-e),l=r.start(e)==r.pos-(r.depth-e),o=k7(r.node(e-1).contentMatchAt(r.indexAfter(e-1)));i.unshift(t||(s&&o?{type:o}:null)),a=e;break}if(1==e)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof kM||e.selection instanceof kP)&&u.deleteSelection();let c=u.mapping.map(r.pos),d=kd(u.doc,c,i.length,i);if(d||(i[0]=o?{type:o}:null,d=kd(u.doc,c,i.length,i)),!d)return!1;if(u.split(c,i.length,i),!s&&l&&r.node(a).type!=o){let e=u.mapping.map(r.before(a)),t=u.doc.resolve(e);o&&r.node(a-1).canReplaceWith(t.index(),t.index()+1,o)&&u.setNodeMarkup(u.mapping.map(r.before(a)),o)}return t&&t(u.scrollIntoView()),!0}),"Mod-Enter":we,Backspace:wu,"Mod-Backspace":wu,"Shift-Backspace":wu,Delete:wc,"Mod-Delete":wc,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new kP(e.doc))),!0)},wp={"Ctrl-h":wd.Backspace,"Alt-Backspace":wd["Mod-Backspace"],"Ctrl-d":wd.Delete,"Ctrl-Alt-Backspace":wd["Mod-Delete"],"Alt-Delete":wd["Mod-Delete"],"Alt-d":wd["Mod-Delete"],"Ctrl-a":wa,"Ctrl-e":wo};for(let e in wd)wp[e]=wd[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let wh=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},wf=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},wm=null,wg=function(e,t,r){let n=wm||(wm=document.createRange());return n.setEnd(e,null==r?e.nodeValue.length:r),n.setStart(e,t||0),n},wy=function(){wm=null},wv=function(e,t,r,n){return r&&(wx(e,t,r,n,-1)||wx(e,t,r,n,1))},wb=/^(img|br|input|textarea|hr)$/i;function wx(e,t,r,n,i){for(var a;;){if(e==r&&t==n)return!0;if(t==(i<0?0:wk(e))){let r=e.parentNode;if(!r||1!=r.nodeType||ww(e)||wb.test(e.nodeName)||"false"==e.contentEditable)return!1;t=wh(e)+(i<0?0:1),e=r}
93else{if(1!=e.nodeType)return!1;let r=e.childNodes[t+(i<0?-1:0)];if(1==r.nodeType&&"false"==r.contentEditable)if(null==(a=r.pmViewDesc)||!a.ignoreForSelection)return!1;else t+=i;else e=r,t=i<0?wk(e):0}}}function wk(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ww(e){let t;for(let r=e;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let w_=function(e){return e.focusNode&&wv(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function wS(e,t){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=t,r}let wE="u">typeof navigator?navigator:null,wC="u">typeof document?document:null,w$=wE&&wE.userAgent||"",wT=/Edge\/(\d+)/.exec(w$),wI=/MSIE \d/.exec(w$),wN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w$),wA=!!(wI||wN||wT),wj=wI?document.documentMode:wN?+wN[1]:wT?+wT[1]:0,wM=!wA&&/gecko\/(\d+)/i.test(w$);wM&&(/Firefox\/(\d+)/.exec(w$)||[0,0])[1];let wO=!wA&&/Chrome\/(\d+)/.exec(w$),wD=!!wO,wR=wO?+wO[1]:0,wP=!wA&&!!wE&&/Apple Computer/.test(wE.vendor),wz=wP&&(/Mobile\/\w+/.test(w$)||!!wE&&wE.maxTouchPoints>2),wL=wz||!!wE&&/Mac/.test(wE.platform),wF=!!wE&&/Win/.test(wE.platform),wU=/Android \d/.test(w$),wB=!!wC&&"webkitFontSmoothing"in wC.documentElement.style,wZ=wB?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wq(e,t){return"number"==typeof e?e:e[t]}function wV(e,t,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,a=e.dom.ownerDocument;for(let o=r||e.dom;o;){if(1!=o.nodeType){o=wf(o);continue}let e=o,r=e==a.body,s=r?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(a):function(e){let t=e.getBoundingClientRect(),r=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*r,top:t.top,bottom:t.top+e.clientHeight*n}}(e),l=0,u=0;if(t.top<s.top+wq(n,"top")?u=-(s.top-t.top+wq(i,"top")):t.bottom>s.bottom-wq(n,"bottom")&&(u=t.bottom-t.top>s.bottom-s.top?t.top+wq(i,"top")-s.top:t.bottom-s.bottom+wq(i,"bottom")),t.left<s.left+wq(n,"left")?l=-(s.left-t.left+wq(i,"left")):t.right>s.right-wq(n,"right")&&(l=t.right-s.right+wq(i,"right")),l||u)if(r)a.defaultView.scrollBy(l,u);else{let r=e.scrollLeft,n=e.scrollTop;u&&(e.scrollTop+=u),l&&(e.scrollLeft+=l);let i=e.scrollLeft-r,a=e.scrollTop-n;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let c=r?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(c))break;o="absolute"==c?o.offsetParent:wf(o)}}function wH(e){let t=[],r=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=wf(n));return t}function wK(e,t){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:a}=e[r];n.scrollTop!=i+t&&(n.scrollTop=i+t),n.scrollLeft!=a&&(n.scrollLeft=a)}}let wW=null;function wJ(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function wG(e){return e.top<e.bottom||e.left<e.right}function wX(e,t){let r=e.getClientRects();if(r.length){let e=r[t<0?0:r.length-1];if(wG(e))return e}return Array.prototype.find.call(r,wG)||e.getBoundingClientRect()}let wY=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function wQ(e,t,r){let{node:n,offset:i,atom:a}=e.docView.domFromPos(t,r<0?-1:1),o=wB||wM;if(3==n.nodeType)if(o&&(wY.test(n.nodeValue)||(r<0?!i:i==n.nodeValue.length))){let e=wX(wg(n,i,i),r);if(wM&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let t=wX(wg(n,i-1,i-1),-1);if(t.top==e.top){let r=wX(wg(n,i,i+1),-1);if(r.top!=e.top)return w0(r,r.left<t.left)}}return e}else{let e=i,t=i,a=r<0?1:-1;return r<0&&!i?(t++,a=-1):r>=0&&i==n.nodeValue.length?(e--,a=1):r<0?e--:t++,w0(wX(wg(n,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(null==a&&i&&(r<0||i==wk(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return w1(e.getBoundingClientRect(),!1)}if(null==a&&i<wk(n)){let e=n.childNodes[i];if(1==e.nodeType)return w1(e.getBoundingClientRect(),!0)}return w1(n.getBoundingClientRect(),r>=0)}if(null==a&&i&&(r<0||i==wk(n))){let e=n.childNodes[i-1],t=3==e.nodeType?wg(e,wk(e)-!o):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return w0(wX(t,1),!1)}if(null==a&&i<wk(n)){let e=n.childNodes[i];for(;
93e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?wg(e,0,+!o):1==e.nodeType?e:null:null;if(t)return w0(wX(t,-1),!0)}return w0(wX(3==n.nodeType?wg(n):n,-r),r>=0)}function w0(e,t){if(0==e.width)return e;let r=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function w1(e,t){if(0==e.height)return e;let r=t?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function w2(e,t,r){let n=e.state,i=e.root.activeElement;n!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return r()}finally{n!=t&&e.updateState(n),i!=e.dom&&i&&i.focus()}}let w4=/[\u0590-\u08ac]/,w5=null,w6=null,w3=!1;class w9{constructor(e,t,r,n){this.parent=e,this.children=t,this.dom=r,this.contentDOM=n,this.dirty=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let n=this.children[t];if(n==e)return r;r+=n.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){let n;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(r<0){let r,n;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((n=r.pmViewDesc)&&n.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}else{let r,n;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((n=r.pmViewDesc)&&n.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}if(e==this.dom&&this.contentDOM)n=t>wh(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){n=!1;break}if(t.previousSibling)break}if(null==n&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){n=!0;break}if(t.nextSibling)break}}return(null==n?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,n=e;n;n=n.parentNode){let i=this.getDesc(n),a;if(i&&(!t||i.node))if(!r||!(a=i.nodeDOM)||(1==a.nodeType?a.contains(1==e.nodeType?e:e.parentNode):a==e))return i;else r=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,r){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,t,r)}return -1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let n=this.children[t],i=r+n.size;if(r==e&&i!=r){for(;!n.border&&n.children.length;)for(let e=0;e<n.children.length;e++){let t=n.children[e];if(t.size){n=t;break}}return n}if(e<i)return n.descAt(e-r-n.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,n=0;for(let t=0;r<this.children.length;r++){let i=this.children[r],a=t+i.size;if(a>e||i instanceof _i){n=e-t;break}t=a}if(n)return this.children[r].domFromPos(n-this.children[r].border,t);for(let e;r&&!(e=this.children[r-1]).size&&e instanceof w8&&e.side>=0;r--);if(t<=0){let e,n=!0;for(;(e=r?this.children[r-1]:null)&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&t&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?wh(e.dom)+1:0}}{let e,n=!0;for(;(e=r<this.children.length?this.children[r]:null)&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?wh(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let a=r,o=0;;o++){let r=this.children[o],s=a+r.size;if(-1==n&&e<=s){let i=a+r.border;if(e>=i&&t<=s-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let r=this.children[t-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=wh(r.dom)+1;break}e-=r.size}-1==n&&(n=0)}if(n>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let r=this.children[e];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=wh(r.dom);break}t+=r.size}-1==i&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(1!=t.nodeType||r==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,n=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let l=this.children[o],u=s+l.size;if(i>s&&a<u)return l.setSelection(e-s-l.border,t-s-l.border,r,n);s=u}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),l=r.root.getSelection(),u=r.domSelectionRange(),c=!1;if((wM||wP)&&e==t){let{node:e,offset:t}=o;if(3==e.nodeType){if((c=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,r;t;
93t=t.parentNode){if(r=t.nextSibling){"BR"==r.nodeName&&(o=s={node:r.parentNode,offset:wh(r)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let r=e.childNodes[t-1];c=r&&("BR"==r.nodeName||"false"==r.contentEditable)}}if(wM&&u.focusNode&&u.focusNode!=s.node&&1==u.focusNode.nodeType){let e=u.focusNode.childNodes[u.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||c&&wP)&&wv(o.node,o.offset,u.anchorNode,u.anchorOffset)&&wv(s.node,s.offset,u.focusNode,u.focusOffset))return;let d=!1;if((l.extend||e==t)&&!(c&&wM)){l.collapse(o.node,o.offset);try{e!=t&&l.extend(s.node,s.offset),d=!0}catch(e){}}if(!d){if(e>t){let e=o;o=s,s=e}let r=document.createRange();r.setEnd(s.node,s.offset),r.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(r)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],a=r+i.size;if(r==a?e<=a&&t>=r:e<a&&t>r){let n=r+i.border,o=a-i.border;if(e>=n&&t<=o){this.dirty=e==r||t==a?2:1,e==n&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-n,t-n);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}r=a}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=1==e?2:1;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class w8 extends w9{constructor(e,t,r,n){let i,a=t.type.toDOM;if("function"==typeof a&&(a=a(r,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n)),!t.type.spec.raw){if(1!=a.nodeType){let e=document.createElement("span");e.appendChild(a),a=e}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class w7 extends w9{constructor(e,t,r,n){super(e,[],t,null),this.textDOM=r,this.text=n}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class _e extends w9{constructor(e,t,r,n,i){super(e,[],r,n),this.mark=t,this.spec=i}static create(e,t,r,n){let i=n.nodeViews[t.type.name],a=i&&i(t,n,r);return a&&a.dom||(a=xG.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new _e(e,t,a.dom,a.contentDOM||a.dom,a)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,r){let n=_e.create(this.parent,this.mark,!0,r),i=this.children,a=this.size;t<a&&(i=_m(i,t,a,r)),e>0&&(i=_m(i,0,e,r));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class _t extends w9{constructor(e,t,r,n,i,a,o,s,l){super(e,[],i,a),this.node=t,this.outerDeco=r,this.innerDeco=n,this.nodeDOM=o}static create(e,t,r,n,i,a){let o=i.nodeViews[t.type.name],s,l=o&&o(t,i,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:a,r,n),u=l&&l.dom,c=l&&l.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);
93else if(!u){let e=xG.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:u,contentDOM:c}=e)}c||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return(u=_c(u,r,t),l)?s=new _a(e,t,r,n,u,c||null,d,l,i,a+1):t.isText?new _n(e,t,r,n,u,d,i):new _t(e,t,r,n,u,c||null,d,i,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>xa.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,r){return 0==this.dirty&&e.eq(this.node)&&_d(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let r=this.node.inlineContent,n=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new _h(this,a&&a.node,e);(function(e,t,r,n){let i=t.locals(e),a=0;if(0==i.length){for(let r=0;r<e.childCount;r++){let o=e.child(r);n(o,i,t.forChild(a,o),r),a+=o.nodeSize}return}let o=0,s=[],l=null;for(let u=0;;){let c,d,p,h;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(c?(d||(d=[c])).push(e):c=e)}if(c)if(d){d.sort(_f);for(let e=0;e<d.length;e++)r(d[e],u,!!l)}else r(c,u,!!l);if(l)h=-1,p=l,l=null;else if(u<e.childCount)h=u,p=e.child(u++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let f=a+p.nodeSize;if(p.isText){let e=f;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<f&&(l=p.cut(e-a),p=p.cut(0,e-a),f=e,h=-1)}else for(;o<i.length&&i[o].to<f;)o++;let m=p.isInline&&!p.isLeaf?s.filter(e=>!e.inline):s.slice();n(p,m,t.forChild(a,p),h),a=f}})(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,r,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?xu.none:this.node.child(i).marks,r,e,i),s.placeWidget(t,e,n)},(t,a,l,u)=>{let c;s.syncToMarks(t.marks,r,e,u),s.findNodeMatch(t,a,l,u)||o&&e.state.selection.from>n&&e.state.selection.to<n+t.nodeSize&&(c=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,l,c,e)||s.updateNextNode(t,a,l,e,u,n)||s.addNode(t,a,l,e,n),n+=t.nodeSize}),s.syncToMarks([],r,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(a&&this.protectLocalComposition(e,a),function e(t,r,n){let i=t.firstChild,a=!1;for(let o=0;o<r.length;o++){let s=r[o],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=_p(i),a=!0;i=i.nextSibling}else a=!0,t.insertBefore(l,i);if(s instanceof _e){let r=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,n),i=r?r.nextSibling:t.firstChild}}for(;i;)i=_p(i),a=!0;a&&n.trackWrites==t&&(n.trackWrites=null)}(this.contentDOM,this.children,e),wz&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:r,to:n}=e.state.selection;if(!(e.state.selection instanceof kM)||r<t||n>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,a=function(e,t,r,n){for(let i=0,a=0;i<e.childCount&&a<=n;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;l+=t.text}if(a>=r){if(a>=n&&l.slice(n-t.length-s,n-s)==t)return n-t.length;let e=s<n?l.lastIndexOf(t,n-s-1):-1;if(e>=0&&e+t.length+s>=r)return s+e;if(r==n&&l.length>=n+t.length-s&&l.slice(n-s,n-s+t.length)==t)return n}}return -1}(this.node.content,e,r-t,n-t);return a<0?null:{node:i,pos:a,text:e}}}protectLocalComposition(e,{node:t,pos:r,text:n}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new w7(this,i,t,n);e.input.compositionNodes.push(a),this.children=_m(this.children,r,r+n.length,e,a)}update(e,t,r,n){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,r,n),!0)}updateInner(e,t,r,n){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(_d(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,r=this.dom;this.dom=_u(this.dom,this.nodeDOM,_l(this.outerDeco,this.node,t),_l(e,this.node,t)),this.dom!=r&&(r.pmVie
93wDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function _r(e,t,r,n,i){_c(n,t,e);let a=new _t(void 0,e,t,r,n,n,n,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class _n extends _t{constructor(e,t,r,n,i,a,o){super(e,t,r,n,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,n){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,r){let n=this.node.cut(e,t),i=document.createTextNode(n.text);return new _n(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _i extends w9{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class _a extends _t{constructor(e,t,r,n,i,a,o,s,l,u){super(e,t,r,n,i,a,o,l,u),this.spec=s}update(e,t,r,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,n),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,r,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,n){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,n)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let _o=function(e){e&&(this.nodeName=e)};_o.prototype=Object.create(null);let _s=[new _o];function _l(e,t,r){if(0==e.length)return _s;let n=r?_s[0]:new _o,i=[n];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o)for(let e in o.nodeName&&i.push(n=new _o(o.nodeName)),o){let a=o[e];null!=a&&(r&&1==i.length&&i.push(n=new _o(t.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+a:"style"==e?n.style=(n.style?n.style+";":"")+a:"nodeName"!=e&&(n[e]=a))}}return i}function _u(e,t,r,n){if(r==_s&&n==_s)return t;let i=t;for(let t=0;t<n.length;t++){let a=n[t],o=r[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName||((t=document.createElement(a.nodeName)).pmIsDeco=!0,t.appendChild(i),o=_s[0]),i=t}!function(e,t,r){for(let n in t)"class"==n||"style"==n||"nodeName"==n||n in r||e.removeAttribute(n);for(let n in r)"class"!=n&&"style"!=n&&"nodeName"!=n&&r[n]!=t[n]&&e.setAttribute(n,r[n]);if(t.class!=r.class){let n=t.class?t.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let t=0;t<n.length;t++)-1==i.indexOf(n[t])&&e.classList.remove(n[t]);for(let t=0;t<i.length;t++)-1==n.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=r.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,n;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}r.style&&(e.style.cssText+=r.style)}}(i,o||_s[0],a)}return i}function _c(e,t,r){return _u(e,e,_s,_l(t,r,1!=e.nodeType))}function _d(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(t[r].type))return!1;return!0}function _p(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class _h{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let r=t,n=r.children.length,i=e.childCount,a=new Map,o=[];r:for(;i>0;){let s;for(;;)if(n){let e=r.children[n-1];if(e instanceof _e)r=e,n=e.children.length;else{s=e,n--;break}}else if(r==t)break r;else n=r.parent.children.indexOf(r),r=r.parent;let l=s.node;if(l){if(l!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,n){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;n<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let r=this.top.children[t];if(r.matchesMark(e[a])&&!this.isLocked(r.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let n=_e.create(this.top,e[a],t,r);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,r,n){let i=-1,a;if(n>=this.preMatch.index&&(a=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,r))i=this.top.children.indexOf(a,this.index);else for(let n=this.index,a=Math.min(this.top.children.length,n+5);n<a;n++){let a=this.top.children[n];if(a.matchesNode(e,t,r)&&!this.preMatch.matched.has(a)){i=n;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,n,i){let a=this.top.children[n];
93return 3==a.dirty&&a.dom==a.contentDOM&&(a.dirty=2),!!a.update(e,t,r,i)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,r,n,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof _t){let l=this.preMatch.matched.get(s);if(null!=l&&l!=i)return!1;let u=s.dom,c,d=this.isLocked(u)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&_d(t,s.outerDeco));if(!d&&s.update(e,t,r,n))return this.destroyBetween(this.index,o),s.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(s,e,t,r,n,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,a+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,n,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!_d(r,e.outerDeco)||!n.eq(e.innerDeco))return null;let o=_t.create(this.top,t,r,n,i,a);if(o.contentDOM)for(let t of(o.children=e.children,e.children=[],o.children))t.parent=o;return e.destroy(),o}addNode(e,t,r,n,i){let a=_t.create(this.top,e,t,r,n,i);a.contentDOM&&a.updateChildren(n,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(n&&n.matchesWidget(e)&&(e==n.widget||!n.widget.type.toDOM.parentNode))this.index++;else{let n=new w8(this.top,e,t,r);this.top.children.splice(this.index++,0,n),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof _e;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof _n)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((wP||wD)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);"IMG"==e&&(r.className="ProseMirror-separator",r.alt=""),"BR"==e&&(r.className="ProseMirror-trailingBreak");let n=new _i(this.top,[],r,null);t!=this.top?t.children.push(n):t.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function _f(e,t){return e.type.side-t.type.side}function _m(e,t,r,n,i){let a=[];for(let o=0,s=0;o<e.length;o++){let l=e[o],u=s,c=s+=l.size;u>=r||c<=t?a.push(l):(u<t&&a.push(l.slice(0,t-u,n)),i&&(a.push(i),i=void 0),c>r&&a.push(l.slice(r-u,l.size,n)))}return a}function _g(e,t=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),a=i&&0==i.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let s=n.resolve(o),l,u;if(w_(r)){for(l=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&kD.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,r){for(let n=0==t,i=t==wk(e);n||i;){if(e==r)return!0;let t=wh(e);if(!(e=e.parentNode))return!1;n=n&&0==t,i=i&&t==wk(e)}}(r.focusNode,r.focusOffset,i.dom))){let e=i.posBefore;u=new kD(o==e?s:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let t=o,i=o;for(let n=0;n<r.rangeCount;n++){let a=r.getRangeAt(n);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[l,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=n.resolve(o)}else l=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let c=n.resolve(l);if(!u){let r="pointer"==t||e.state.selection.head<s.pos&&!a?1:-1;u=_E(e,c,s,r)}return u}function _y(e){return e.editable?e.hasFocus():_$(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function _v(e,t=!1){let r=e.state.selection;if(__(e,r),_y(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&wD){let t=e.domSelectionRange(),r=e.domObserver.currentSelection;if(t.anchorNode&&r.anchorNode&&wv(t.anchorNode,t.anchorOffset,r.anchorNode,r.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let r=e.cursorWrapper.dom,n="IMG"==r.nodeName;n?t.collapse(r.parentNode,wh(r)+1):t.collapse(r,0),!n&&!e.state.selection.visible&&wA&&wj<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var n;let i,a,o,s,{anchor:l,head:u}=r,c,d;_b&&!(r instanceof kM)&&(r.$from.parent.inlineContent||(c=_x(e,r.from)),r.empty||r.$from.parent.inlineContent||(d=_x(e,r.to))),e.docView.setSelection(l,u,e,t),_b&&(c&&_w(c),d&&_w(d)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(n=e).dom.ownerDocument).removeEventListener("selectionchange",n.input.hide
93SelectionGuard),o=(a=n.domSelectionRange()).anchorNode,s=a.anchorOffset,i.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(a.anchorNode!=o||a.anchorOffset!=s)&&(i.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!_y(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let _b=wP||wD&&wR<63;function _x(e,t){let{node:r,offset:n}=e.docView.domFromPos(t,0),i=n<r.childNodes.length?r.childNodes[n]:null,a=n?r.childNodes[n-1]:null;if(wP&&i&&"false"==i.contentEditable)return _k(i);if((!i||"false"==i.contentEditable)&&(!a||"false"==a.contentEditable)){if(i)return _k(i);else if(a)return _k(a)}}function _k(e){return e.contentEditable="true",wP&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function _w(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function __(e,t){if(t instanceof kD){let r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(_S(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else _S(e)}function _S(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function _E(e,t,r,n){return e.someProp("createSelectionBetween",n=>n(e,t,r))||kM.between(t,r,n)}function _C(e){return(!e.editable||!!e.hasFocus())&&_$(e)}function _$(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function _T(e,t){let{$anchor:r,$head:n}=e.selection,i=t>0?r.max(n):r.min(n),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&kI.findFrom(a,t)}function _I(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function _N(e,t,r){let n=e.state.selection;if(n instanceof kM){if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(r.pos+i.nodeSize*(t<0?-1:1));return _I(e,new kM(n.$anchor,a))}else if(!n.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let r=_T(e.state,t);return!!r&&r instanceof kD&&_I(e,r)}else if(!(wL&&r.indexOf("m")>-1)){let r=n.$head,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?r.pos-i.nodeSize:r.pos;return!!(i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM)&&(kD.isSelectable(i)?_I(e,new kD(t<0?e.state.doc.resolve(r.pos-i.nodeSize):r)):!!wB&&_I(e,new kM(e.state.doc.resolve(t<0?o:o+i.nodeSize))))}}else{if(n instanceof kD&&n.node.isInline)return _I(e,new kM(t>0?n.$to:n.$from));let r=_T(e.state,t);return!!r&&_I(e,r)}}function _A(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function _j(e,t){let r=e.pmViewDesc;return r&&0==r.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function _M(e,t){return t<0?function(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i,a,o=!1;for(wM&&1==r.nodeType&&n<_A(r)&&_j(r.childNodes[n],-1)&&(o=!0);;)if(n>0)if(1!=r.nodeType)break;else{let e=r.childNodes[n-1];if(_j(e,-1))i=r,a=--n;else if(3==e.nodeType)n=(r=e).nodeValue.length;else break}else if(_O(r))break;else{let t=r.previousSibling;for(;t&&_j(t,-1);)i=r.parentNode,a=wh(t),t=t.previousSibling;if(t)n=_A(r=t);else{if((r=r.parentNode)==e.dom)break;n=0}}o?_D(e,r,n):i&&_D(e,i,a)}(e):function(e){let t,r,n=e.domSelectionRange(),i=n.focusNode,a=n.focusOffset;if(!i)return;let o=_A(i);for(;;)if(a<o){if(1!=i.nodeType)break;if(_j(i.childNodes[a],1))t=i,r=++a;else break}else if(_O(i))break;else{let n=i.nextSibling;for(;n&&_j(n,1);)t=n.parentNode,r=wh(n)+1,n=n.nextSibling;if(n)a=0,o=_A(i=n);else{if((i=i.parentNode)==e.dom)break;a=o=0}}t&&_D(e,t,r)}(e)}function _O(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function _D(e,t,r){if(3!=t.nodeType){let e,n;(n=function(e,t){for(;e&&t==e.childNodes.length&&!ww(e);)t=wh(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let r=e.childNodes[t];
93if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;e=r,t=0}}(t,r))?(t=n,r=0):(e=function(e,t){for(;e&&!t&&!ww(e);)t=wh(e),e=e.parentNode;for(;e&&t;){let r=e.childNodes[t-1];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;t=(e=r).childNodes.length}}(t,r))&&(t=e,r=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(w_(n)){let e=document.createRange();e.setEnd(t,r),e.setStart(t,r),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(t,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&_v(e)},50)}function _R(e,t){let r=e.state.doc.resolve(t);if(!(wD||wF)&&r.parent.inlineContent){let n=e.coordsAtPos(t);if(t>r.start()){let r=e.coordsAtPos(t-1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(t<r.end()){let r=e.coordsAtPos(t+1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function _P(e,t,r){let n=e.state.selection;if(n instanceof kM&&!n.empty||r.indexOf("s")>-1||wL&&r.indexOf("m")>-1)return!1;let{$from:i,$to:a}=n;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let r=_T(e.state,t);if(r&&r instanceof kD)return _I(e,r)}if(!i.parent.inlineContent){let r=t<0?i:a,o=n instanceof kP?kI.near(r,t):kI.findFrom(r,t);return!!o&&_I(e,o)}return!1}function _z(e,t){if(!(e.state.selection instanceof kM))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){let n=e.state.tr;return t<0?n.delete(r.pos-a.nodeSize,r.pos):n.delete(r.pos,r.pos+a.nodeSize),e.dispatch(n),!0}return!1}function _L(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function _F(e,t){e.someProp("transformCopied",r=>{t=r(t,e)});let r=[],{content:n,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&1==n.childCount&&1==n.firstChild.childCount;){i--,a--;let e=n.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let o=e.someProp("clipboardSerializer")||xG.fromSchema(e.state.schema),s=_W(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let u=l.firstChild,c,d=0;for(;u&&1==u.nodeType&&(c=_H[u.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=s.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),d++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${i} ${a}${d?` -${d}`:""} ${JSON.stringify(r)}`),{dom:l,text:e.someProp("clipboardTextSerializer",r=>r(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function _U(e,t,r,n,i){let a,o,s=i.parent.type.spec.code;if(!r&&!t)return null;let l=!!t&&(n||s||!r);if(l){if(e.someProp("transformPastedText",r=>{t=r(t,s||n,e)}),s)return o=new xd(xa.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{o=t(o,e,!0)}),o;let r=e.someProp("clipboardTextParser",r=>r(t,i,n,e));if(r)o=r;else{let r=i.marks(),{schema:n}=e.state,o=xG.fromSchema(n);a=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=a.appendChild(document.createElement("p"));e&&t.appendChild(o.serializeNode(n.text(e,r)))})}}else e.someProp("transformPastedHTML",t=>{r=t(r,e)}),a=function(e){var t;let r,n=/^(\s*<meta [^>]*>)*/.exec(e);n&&(e=e.slice(n[0].length));let i=_W().createElement("div"),a=/<([a-z][^>\s]+)/i.exec(e),o;if((o=a&&_H[a[1].toLowerCase()])&&(e=o.map(e=>"<"+e+">").join("")+e+o.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(r=window.trustedTypes)?(_J||(_J=r.defaultPolicy||r.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),_J.createHTML(t)):t),o)for(let e=0;e<o.length;e++)i=i.querySelector(o[e])||i;return i}(r),wB&&function(e){let t=e.querySelectorAll(wD?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<t.length;r++){let n=t[r];1==n.childNodes.length&&"Â "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(a);let u=a&&a.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let e=+c[3];e>0;e--){let e=a.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;a=e}if(o||(o=(e.someProp("clipboardParser")||e.someProp("domParser")||xU.fromSc
93hema(e.state.schema)).parseSlice(a,{preserveWhitespace:!!(l||c),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||_B.test(e.parentNode.nodeName)?null:{ignore:!0}})),c)o=function(e,t){if(!e.size)return e;let r=e.content.firstChild.type.schema,n;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=xa.from(t.create(n[e+1],i)),a++,o++}return new xd(i,a,o)}(_V(o,+c[1],+c[2]),c[4]);else if((o=xd.maxOpen(function(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let n=t.node(r).contentMatchAt(t.index(r)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=n.findWrapping(e.type),r;if(!t)return a=null;if(r=a.length&&i.length&&function e(t,r,n,i,a){if(a<t.length&&a<r.length&&t[a]==r[a]){let o=e(t,r,n,i.lastChild,a+1);if(o)return i.copy(i.content.replaceChild(i.childCount-1,o));if(i.contentMatchAt(i.childCount).matchType(a==t.length-1?n.type:t[a+1]))return i.copy(i.content.append(xa.from(_Z(n,t,a+1))))}}(t,i,e,a[a.length-1],0))a[a.length-1]=r;else{a.length&&(a[a.length-1]=function e(t,r){if(0==r)return t;let n=t.content.replaceChild(t.childCount-1,e(t.lastChild,r-1)),i=t.contentMatchAt(t.childCount).fillBefore(xa.empty,!0);return t.copy(n.append(i))}(a[a.length-1],i.length));let r=_Z(e,t);a.push(r),n=n.matchType(r.type),i=t}}),a)return xa.from(a)}return e}(o.content,i),!0)).openStart||o.openEnd){let e=0,t=0;for(let t=o.content.firstChild;e<o.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=o.content.lastChild;t<o.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);o=_V(o,e,t)}return e.someProp("transformPasted",t=>{o=t(o,e,l)}),o}let _B=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function _Z(e,t,r=0){for(let n=t.length-1;n>=r;n--)e=t[n].create(null,xa.from(e));return e}function _q(e,t,r,n,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<n-1&&(s=_q(s,t,r,n,i+1,a)),i>=r&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(xa.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function _V(e,t,r){return t<e.openStart&&(e=new xd(_q(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),r<e.openEnd&&(e=new xd(_q(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}let _H={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},_K=null;function _W(){return _K||(_K=document.implementation.createHTMLDocument("title"))}let _J=null,_G={},_X={},_Y={touchstart:!0,touchmove:!0};class _Q{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _0(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function _1(e){e.someProp("handleDOMEvents",t=>{for(let r in t)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=t=>_2(e,t))})}function _2(e,t){return e.someProp("handleDOMEvents",r=>{let n=r[t.type];return!!n&&(n(e,t)||t.defaultPrevented)})}function _4(e){return{left:e.clientX,top:e.clientY}}function _5(e,t,r,n,i){if(-1==n)return!1;let a=e.state.doc.resolve(n);for(let n=a.depth+1;n>0;n--)if(e.someProp(t,t=>n>a.depth?t(e,r,a.nodeAfter,a.before(n),i,!0):t(e,r,a.node(n),a.before(n),i,!1)))return!0;return!1}function _6(e,t,r){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);"pointer"==r&&n.setMeta("pointer",!0),e.dispatch(n)}_X.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!_8(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!wU||!wD||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!wz||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",r=>r(e,t))||function(e,t){let r,n=t.keyCode,i=(r="",t.ctrlKey&&(r+="c"),t.metaKey&&(r+="m"),t.altKey&&
93(r+="a"),t.shiftKey&&(r+="s"),r);if(8==n||wL&&72==n&&"c"==i)return _z(e,-1)||_M(e,-1);if(46==n&&!t.shiftKey||wL&&68==n&&"c"==i)return _z(e,1)||_M(e,1);if(13==n||27==n)return!0;if(37==n||wL&&66==n&&"c"==i){let t=37==n?"ltr"==_R(e,e.state.selection.from)?-1:1:-1;return _N(e,t,i)||_M(e,t)}if(39==n||wL&&70==n&&"c"==i){let t=39==n?"ltr"==_R(e,e.state.selection.from)?1:-1:1;return _N(e,t,i)||_M(e,t)}else if(38==n||wL&&80==n&&"c"==i)return _P(e,-1,i)||_M(e,-1);else if(40==n||wL&&78==n&&"c"==i)return function(e){if(!wP||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(t&&1==t.nodeType&&0==r&&t.firstChild&&"false"==t.firstChild.contentEditable){let r=t.firstChild;_L(e,r,"true"),setTimeout(()=>_L(e,r,"false"),20)}return!1}(e)||_P(e,1,i)||_M(e,1);else if(i==(wL?"m":"c")&&(66==n||73==n||89==n||90==n))return!0;return!1}(e,t)?t.preventDefault():_0(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,wS(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},_X.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},_X.keypress=(e,t)=>{if(_8(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||wL&&t.metaKey)return;if(e.someProp("handleKeyPress",r=>r(e,t)))return void t.preventDefault();let r=e.state.selection;if(!(r instanceof kM)||!r.$from.sameParent(r.$to)){let n=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(n).scrollIntoView();/[\r\n]/.test(n)||e.someProp("handleTextInput",t=>t(e,r.$from.pos,r.$to.pos,n,i))||e.dispatch(i()),t.preventDefault()}};let _3=wL?"metaKey":"ctrlKey";_G.mousedown=(e,t)=>{var r;let n,i;e.input.shiftKey=t.shiftKey;let a=Sr(e),o=Date.now(),s="singleClick";o-e.input.lastClick.time<500&&(n=(r=e.input.lastClick).x-t.clientX)*n+(i=r.y-t.clientY)*i<100&&!t[_3]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?s="doubleClick":"doubleClick"==e.input.lastClick.type&&(s="tripleClick")),e.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:s,button:t.button};let l=e.posAtCoords(_4(t));l&&("singleClick"==s?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new _9(e,l,t,!!a)):("doubleClick"==s?function(e,t,r,n){return _5(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",r=>r(e,t,n))}:function(e,t,r,n){return _5(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",r=>r(e,t,n))||function(e,t,r){if(0!=r.button)return!1;let n=e.state.doc;if(-1==t)return!!n.inlineContent&&(_6(e,kM.create(n,0,n.content.size),"pointer"),!0);let i=n.resolve(t);for(let t=i.depth+1;t>0;t--){let r=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(r.inlineContent)_6(e,kM.create(n,a+1,a+1+r.content.size),"pointer");else{if(!kD.isSelectable(r))continue;_6(e,kD.create(n,a),"pointer")}return!0}}(e,r,n)})(e,l.pos,l.inside,t)?t.preventDefault():_0(e,"pointer"))};class _9{constructor(e,t,r,n){let i,a;if(this.view=e,this.pos=t,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[_3],this.allowDefault=r.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let r=e.state.doc.resolve(t.pos);i=r.parent,a=r.depth?r.before():0}const o=n?null:r.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&1==s.nodeDOM.nodeType?s.nodeDOM:null;let{selection:l}=e.state;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof kD&&l.from<=a&&l.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&wM&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),_0(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>_v(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(_4(e))),this.updateAllowDefault(e),this.allowDefault||!t)_0(this.view,"pointer");else{var r,n,i,a;(r=this.view,n=t.pos,i=t.inside,a=this.selectNode,_5(r,"handleClickOn",n,i,e)||r.someProp("handleClick",t=>t(r,n,e))||(a?function(e,t){if(-1==t)return!1;let r=e.state.selection,n,i;r instanceof kD&&(n=r.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(kD.isSelectable(t)){i=n&&r.$from.depth>0&&e>=r.$from.depth&&a.before(r.$from.depth+1)==r.$from.pos?a.before(r.$from.depth):a.before(e);break}}
93return null!=i&&(_6(e,kD.create(e.state.doc,i),"pointer"),!0)}(r,i):function(e,t){if(-1==t)return!1;let r=e.state.doc.resolve(t),n=r.nodeAfter;return!!(n&&n.isAtom&&kD.isSelectable(n))&&(_6(e,new kD(r),"pointer"),!0)}(r,i)))?e.preventDefault():0==e.button&&(this.flushed||wP&&this.mightDrag&&!this.mightDrag.node.isAtom||wD&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(_6(this.view,kI.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):_0(this.view,"pointer")}}move(e){this.updateAllowDefault(e),_0(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function _8(e,t){return!!e.composing||!!(wP&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}_G.touchstart=e=>{e.input.lastTouch=Date.now(),Sr(e),_0(e,"pointer")},_G.touchmove=e=>{e.input.lastTouch=Date.now(),_0(e,"pointer")},_G.contextmenu=e=>Sr(e);let _7=wU?5e3:-1;function Se(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Sr(e),t))}function St(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Sr(e,t=!1){if(!wU||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),St(e),t||e.docView&&e.docView.dirty){let r=_g(e),n=e.state.selection;return r&&!r.eq(n)?e.dispatch(e.state.tr.setSelection(r)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}_X.compositionstart=_X.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,r=t.selection.$to;if(t.selection instanceof kM&&(t.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||wD&&wF&&function(e){let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(!t||1!=t.nodeType||r>=t.childNodes.length)return!1;let n=t.childNodes[r];return 1==n.nodeType&&"false"==n.contentEditable}(e)))e.markCursor=e.state.storedMarks||r.marks(),Sr(e,!0),e.markCursor=null;else if(Sr(e,!t.selection.empty),wM&&t.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let t=e.domSelectionRange();for(let r=t.focusNode,n=t.focusOffset;r&&1==r.nodeType&&0!=n;){let t=n<0?r.lastChild:r.childNodes[n-1];if(!t)break;if(3==t.nodeType){let r=e.domSelection();r&&r.collapse(t,t.nodeValue.length);break}r=t,n=-1}}e.input.composing=!0}Se(e,_7)},_X.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Se(e,20))};let Sn=wA&&wj<15||wz&&wZ<604;function Si(e,t,r,n,i){let a=_U(e,t,r,n,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,a||xd.empty)))return!0;if(!a)return!1;let o=0==a.openStart&&0==a.openEnd&&1==a.content.childCount?a.content.firstChild:null,s=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Sa(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}_G.copy=_X.cut=(e,t)=>{let r=e.state.selection,n="cut"==t.type;if(r.empty)return;let i=Sn?null:t.clipboardData,{dom:a,text:o}=_F(e,r.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",o)):function(e,t){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(t),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()},50)}(e,a),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},_X.paste=(e,t)=>
93{if(e.composing&&!wU)return;let r=Sn?null:t.clipboardData,n=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Si(e,Sa(r),r.getData("text/html"),n,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Si(e,n.value,null,i,t):Si(e,n.textContent,n.innerHTML,i,t)},50)}(e,t)};class So{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}let Ss=wL?"altKey":"ctrlKey";function Sl(e,t){let r=e.someProp("dragCopies",e=>!e(t));return null!=r?r:!t[Ss]}for(let e in _G.dragstart=(e,t)=>{let r,n=e.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(_4(t));if(a&&a.pos>=i.from&&a.pos<=(i instanceof kD?i.to-1:i.to));else if(n&&n.mightDrag)r=kD.create(e.state.doc,n.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let n=e.docView.nearestDesc(t.target,!0);n&&n.node.type.spec.draggable&&n!=e.docView&&(r=kD.create(e.state.doc,n.posBefore))}let o=(r||e.state.selection).content(),{dom:s,text:l,slice:u}=_F(e,o);t.dataTransfer.files.length&&wD&&!(wR>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(Sn?"Text":"text/html",s.innerHTML),t.dataTransfer.effectAllowed="copyMove",Sn||t.dataTransfer.setData("text/plain",l),e.dragging=new So(u,Sl(e,t),r)},_G.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},_X.dragover=_X.dragenter=(e,t)=>t.preventDefault(),_X.drop=(e,t)=>{try{!function(e,t,r){if(!t.dataTransfer)return;let n=e.posAtCoords(_4(t));if(!n)return;let i=e.state.doc.resolve(n.pos),a=r&&r.slice;a?e.someProp("transformPasted",t=>{a=t(a,e,!1)}):a=_U(e,Sa(t.dataTransfer),Sn?null:t.dataTransfer.getData("text/html"),!1,i);let o=!!(r&&Sl(e,t));if(e.someProp("handleDrop",r=>r(e,t,a||xd.empty,o)))return t.preventDefault();if(!a)return;t.preventDefault();let s=a?km(e.state.doc,i.pos,a):i.pos;null==s&&(s=i.pos);let l=e.state.tr;if(o){let{node:e}=r;e?e.replace(l):l.deleteSelection()}let u=l.mapping.map(s),c=0==a.openStart&&0==a.openEnd&&1==a.content.childCount,d=l.doc;if(c?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(d))return;let p=l.doc.resolve(u);if(c&&kD.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new kD(p));else{let t=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((e,r,n,i)=>t=i),l.setSelection(_E(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},_G.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&_v(e)},20))},_G.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},_G.beforeinput=(e,t)=>{if(wD&&wU&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,wS(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}},_X)_G[e]=_X[e];function Su(e,t){if(e==t)return!0;for(let r in e)if(e[r]!==t[r])return!1;for(let r in t)if(!(r in e))return!1;return!0}class Sc{constructor(e,t){this.toDOM=e,this.spec=t||Sm,this.side=this.spec.side||0}map(e,t,r,n){let{pos:i,deleted:a}=e.mapResult(t.from+n,this.side<0?-1:1);return a?null:new Sh(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Sc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Su(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Sd{constructor(e,t){this.attrs=e,this.spec=t||Sm}map(e,t,r,n){let i=e.map(t.from+n,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=a?null:new Sh(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Sd&&Su(this.attrs,e.attrs)&&Su(this.spec,e.spec)}static is(e){return e.type instanceof Sd}destroy(){}}class Sp{constructor(e,t){this.attrs=e,this.spec=t||Sm}map(e,t,r,n){let i=e.mapResult(t.from+n,1);if(i.deleted)return null;let a=e.mapResult(t.to+n,-1);return a.deleted||a.pos<=i.pos?null:new Sh(i.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:n}=e.content.findIndex(t.from),i;return n==t.from&&!(i=e.child(r)).isText&&n+i.nodeSize==t.to}eq(e){return this==e||e instanceof Sp&&Su(this.attrs,e.attrs)&&Su(this.spec,e.spec)}destroy(){}}class Sh{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Sh(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Sh(e,e,new Sc(t,r))}static inline(e,t,r,n){return new Sh(e,t,new Sd(r,n))}
vendor: 4,417 bytes, line 93
93static node(e,t,r,n){return new Sh(e,t,new Sp(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof Sd}get widget(){return this.type instanceof Sc}}let Sf=[],Sm={};class Sg{constructor(e,t){this.local=e.length?e:Sf,this.children=t.length?t:Sf}static create(e,t){return t.length?Sw(t,e,0,Sm):Sy}find(e,t,r){let n=[];return this.findInner(null==e?0:e,null==t?1e9:t,n,0,r),n}findInner(e,t,r,n,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+n,o.to+n))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,r,n+o,i)}}map(e,t,r){return this==Sy||0==e.maps.length?this:this.mapInner(e,t,0,0,r||Sm)}mapInner(e,t,r,n,i){let a;for(let o=0;o<this.local.length;o++){let s=this.local[o].map(e,r,n);s&&s.type.valid(t,s)?(a||(a=[])).push(s):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,t,r,n,i,a,o){let s=e.slice();for(let e=0,t=a;e<r.maps.length;e++){let n=0;r.maps[e].forEach((e,r,i,a)=>{let o=a-i-(r-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-n)continue;let l=s[i]+t-n;r>=l?s[i+1]=e<=l?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}n+=o}),t=r.maps[e].map(t,-1)}let l=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(-2==s[t+1]){l=!0,s[t+1]=-1;continue}let u=r.map(e[t]+a),c=u-i;if(c<0||c>=n.content.size){l=!0;continue}let d=r.map(e[t+1]+a,-1)-i,{index:p,offset:h}=n.content.findIndex(c),f=n.maybeChild(p);if(f&&h==c&&h+f.nodeSize==d){let n=s[t+2].mapInner(r,f,u+1,e[t]+a+1,o);n!=Sy?(s[t]=c,s[t+1]=d,s[t+2]=n):(s[t+1]=-2,l=!0)}else l=!0}if(l){let l=Sw(function(e,t,r,n,i,a,o){for(let s=0;s<e.length;s+=3)-1==e[s+1]&&function e(t,a){for(let e=0;e<t.local.length;e++){let s=t.local[e].map(n,i,a);s?r.push(s):o.onRemove&&o.onRemove(t.local[e].spec)}for(let r=0;r<t.children.length;r+=3)e(t.children[r+2],t.children[r]+a+1)}(e[s+2],t[s]+a+1);return r}(s,e,t,r,i,a,o),n,0,o);t=l.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let r=l.children[e];for(;t<s.length&&s[t]<r;)t+=3;s.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new Sg(t.sort(S_),s)}(this.children,a||[],e,t,r,n,i):a?new Sg(a.sort(S_),Sf):Sy}add(e,t){return t.length?this==Sy?Sg.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let n,i=0;e.forEach((e,a)=>{let o=a+r,s;if(s=Sx(t,e,o)){for(n||(n=this.children.slice());i<n.length&&n[i]<a;)i+=3;n[i]==a?n[i+2]=n[i+2].addInner(e,s,o+1):n.splice(i,0,a,a+e.nodeSize,Sw(s,e,o+1,Sm)),i+=3}});let a=Sb(i?Sk(t):t,-r);for(let t=0;t<a.length;t++)a[t].type.valid(e,a[t])||a.splice(t--,1);return new Sg(a.length?this.local.concat(a).sort(S_):this.local,n||this.children)}remove(e){return 0==e.length||this==Sy?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i,a=r[n]+t,o=r[n+1]+t;for(let t=0,r;t<e.length;t++)(r=e[t])&&r.from>a&&r.to<o&&(e[t]=null,(i||(i=[])).push(r));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[n+2].removeInner(i,a+1);s!=Sy?r[n+2]=s:(r.splice(n,3),n-=3)}if(n.length){for(let r=0,i;r<e.length;r++)if(i=e[r])for(let e=0;e<n.length;e++)n[e].eq(i,t)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1))}return r==this.children&&n==this.local?this:n.length||r.length?new Sg(n,r):Sy}forChild(e,t){let r,n;if(this==Sy)return this;if(t.isLeaf)return Sg.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(r=this.children[t+2]);break}let i=e+1,a=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<a&&t.to>i&&t.type instanceof Sd){let e=Math.max(i,t.from)-i,r=Math.min(a,t.to)-i;e<r&&(n||(n=[])).push(t.copy(e,r))}}if(n){let e=new Sg(n.sort(S_),Sf);return r?new Sv([e,r]):e}return r||Sy}eq(e){if(this==e)return!0;if(!(e instanceof Sg)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return SS(this.localsInner(e))}localsInner(e){if(this==Sy)return Sf;if(e.inlineContent||!this.local.some(Sd.is))return this.local;let t=[];for(let e=0;e<this.local.length;
vendor: 5,076 bytes, line 93
93e++)this.local[e].type instanceof Sd||t.push(this.local[e]);return t}forEachSet(e){e(this)}}Sg.empty=new Sg([],[]),Sg.removeOverlap=SS;let Sy=Sg.empty;class Sv{constructor(e){this.members=e}map(e,t){let r=this.members.map(r=>r.map(e,t,Sm));return Sv.from(r)}forChild(e,t){if(t.isLeaf)return Sg.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,t);i!=Sy&&(i instanceof Sv?r=r.concat(i.members):r.push(i))}return Sv.from(r)}eq(e){if(!(e instanceof Sv)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length)if(t){r&&(t=t.slice(),r=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?SS(r?t:t.sort(S_)):Sf}static from(e){switch(e.length){case 0:return Sy;case 1:return e[0];default:return new Sv(e.every(e=>e instanceof Sg)?e:e.reduce((e,t)=>e.concat(t instanceof Sg?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Sb(e,t){if(!t||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new Sh(i.from+t,i.to+t,i.type))}return r}function Sx(e,t,r){if(t.isLeaf)return null;let n=r+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>r&&a.to<n&&((i||(i=[])).push(a),e[t]=null);return i}function Sk(e){let t=[];for(let r=0;r<e.length;r++)null!=e[r]&&t.push(e[r]);return t}function Sw(e,t,r,n){let i=[],a=!1;t.forEach((t,o)=>{let s=Sx(e,t,o+r);if(s){a=!0;let e=Sw(s,t,r+o+1,n);e!=Sy&&i.push(o,o+t.nodeSize,e)}});let o=Sb(a?Sk(e):e,-r).sort(S_);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(n.onRemove&&n.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new Sg(o,i):Sy}function S_(e,t){return e.from-t.from||e.to-t.to}function SS(e){let t=e;for(let r=0;r<t.length-1;r++){let n=t[r];if(n.from!=n.to)for(let i=r+1;i<t.length;i++){let a=t[i];if(a.from==n.from){a.to!=n.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,n.to),SE(t,i+1,a.copy(n.to,a.to)));continue}a.from<n.to&&(t==e&&(t=e.slice()),t[r]=n.copy(n.from,a.from),SE(t,i,n.copy(a.from,n.to)));break}}return t}function SE(e,t,r){for(;t<e.length&&S_(r,e[t])>0;)t++;e.splice(t,0,r)}function SC(e){let t=[];return e.someProp("decorations",r=>{let n=r(e.state);n&&n!=Sy&&t.push(n)}),e.cursorWrapper&&t.push(Sg.create(e.state.doc,[e.cursorWrapper.deco])),Sv.from(t)}let S$={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ST=wA&&wj<=11;class SI{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class SN{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SI,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);wA&&wj<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():wP&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),ST&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,S$)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(_C(this.view)){if(this.suppressingSelectionUpdates)return _v(this.view);if(wA&&wj<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();
93if(e.focusNode&&wv(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let r=e.focusNode;r;r=wf(r))t.add(r);for(let n=e.anchorNode;n;n=wf(n))if(t.has(n)){r=n;break}let n=r&&this.view.docView.nearestDesc(r);if(n&&n.ignoreMutation({type:"selection",target:3==r.nodeType?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&_C(t)&&!this.ignoreSelectionChange(n),a=-1,o=-1,s=!1,l=[];if(t.editable)for(let e=0;e<r.length;e++){let t=this.registerMutation(r[e],l);t&&(a=a<0?t.from:Math.min(t.from,a),o=o<0?t.to:Math.max(t.to,o),t.typeOver&&(s=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;t&&1==t.nodeType&&"false"==t.contentEditable&&e.parentNode.removeChild(e)}}else if(wM&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,r]=e;t.parentNode&&t.parentNode.parentNode==r.parentNode?r.remove():t.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of e){let e=n.parentNode;e&&"LI"==e.nodeName&&(!r||function(e,t){for(let r=t.parentNode;r&&r!=e.dom;r=r.parentNode){let t=e.docView.nearestDesc(r,!0);if(t&&t.node.isBlock)return r}return null}(t,r)!=e)&&n.remove()}}}let u=null;a<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&w_(n)&&(u=_g(t))&&u.eq(kI.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,_v(t),this.currentSelection.set(n),t.scrollToSelection()):(a>-1||i)&&(a>-1&&(t.docView.markDirty(a,o),e=t,!SA.has(e)&&(SA.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=wM,Sj||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Sj=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var r;let{focusNode:n,focusOffset:i}=e.domSelectionRange();for(let a of t)if((null==(r=a.parentNode)?void 0:r.nodeName)=="TR"){let t=a.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let r=t;for(;;){let e=r.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;r=e}r.insertBefore(a,r.firstChild),n==a&&e.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}(t,l)),this.handleDOMChange(a,o,s,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||_v(t),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(r==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if("childList"==e.type){for(let r=0;r<e.addedNodes.length;r++){let n=e.addedNodes[r];t.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let n=e.previousSibling,i=e.nextSibling;if(wA&&wj<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:r,nextSibling:a}=e.addedNodes[t];(!r||0>Array.prototype.indexOf.call(e.addedNodes,r))&&(n=r),(!a||0>Array.prototype.indexOf.call(e.addedNodes,a))&&(i=a)}let a=n&&n.parentNode==e.target?wh(n)+1:0,o=r.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?wh(i):e.target.childNodes.length;return{from:o,to:r.localPosFromDOM(e.target,s,1)}}return"attributes"==e.type?{from:r.posAtStart-r.border,to:r.posAt
93End+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let SA=new WeakMap,Sj=!1;function SM(e,t){let r=t.startContainer,n=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return wv(o.node,o.offset,i,a)&&([r,n,i,a]=[i,a,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:a}}function SO(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(wP&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||wP&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let SD=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function SR(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:_E(e,t.resolve(r.anchor),t.resolve(r.head))}function SP(e,t,r){let n=e.depth,i=t?e.end():e.pos;for(;n>0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,i++,t=!1;if(r){let t=e.node(n).maybeChild(e.indexAfter(n));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Sz(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),r=e.charCodeAt(1);return t>=56320&&t<=57343&&r>=55296&&r<=56319}class SL{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _Q,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Sq),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=SB(this),SU(this),this.nodeViews=SZ(this),this.docView=_r(this.state.doc,SF(this),SC(this),this.dom,this),this.domObserver=new SN(this,(e,t,r,n)=>(function(e,t,r,n,i){let a,o,s,l=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,r=_g(e,t);if(r&&!e.state.selection.eq(r)){if(wD&&wU&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,wS(13,"Enter"))))return;let n=e.state.tr.setSelection(r);"pointer"==t?n.setMeta("pointer",!0):"key"==t&&n.scrollIntoView(),l&&n.setMeta("composition",l),e.dispatch(n)}return}let u=e.state.doc.resolve(t),c=u.sharedDepth(r);t=u.before(c+1),r=e.state.doc.resolve(r).after(c+1);let d=e.state.selection,p=function(e,t,r){let n,{node:i,fromOffset:a,toOffset:o,from:s,to:l}=e.docView.parseRange(t,r),u=e.domSelectionRange(),c=u.anchorNode;if(c&&e.dom.contains(1==c.nodeType?c:c.parentNode)&&(n=[{node:c,offset:u.anchorOffset}
93],w_(u)||n.push({node:u.focusNode,offset:u.focusOffset})),wD&&8===e.input.lastKeyCode)for(let e=o;e>a;e--){let t=i.childNodes[e-1],r=t.pmViewDesc;if("BR"==t.nodeName&&!r){o=e;break}if(!r||r.size)break}let d=e.state.doc,p=e.someProp("domParser")||xU.fromSchema(e.state.schema),h=d.resolve(s),f=null,m=p.parse(i,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:a,to:o,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:n,ruleFromNode:SO,context:h});if(n&&null!=n[0].pos){let e=n[0].pos,t=n[1]&&n[1].pos;null==t&&(t=e),f={anchor:e+s,head:t+s}}return{doc:m,sel:f,from:s,to:l}}(e,t,r),h=e.state.doc,f=h.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(a=e.state.selection.to,o="end"):(a=e.state.selection.from,o="start"),e.input.lastKeyCode=null;let m=function(e,t,r,n,i){let a=e.findDiffStart(t,r);if(null==a)return null;let{a:o,b:s}=e.findDiffEnd(t,r+e.size,r+t.size);if("end"==i){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.size<t.size){let e=n<=a&&n>=o?a-n:0;(a-=e)&&a<t.size&&Sz(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=n<=a&&n>=s?a-n:0;(a-=t)&&a<e.size&&Sz(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}(f.content,p.doc.content,p.from,a,o);if(m&&e.input.domChangeCount++,(wz&&e.input.lastIOSEnter>Date.now()-225||wU)&&i.some(e=>1==e.nodeType&&!SD.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,wS(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(n&&d instanceof kM&&!d.empty&&d.$head.sameParent(d.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))m={start:d.from,endA:d.to,endB:d.to};else{if(p.sel){let t=SR(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let r=e.state.tr.setSelection(t);l&&r.setMeta("composition",l),e.dispatch(r)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof kM&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),wA&&wj<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>p.from&&" Â "==p.doc.textBetween(m.start-p.from-1,m.start-p.from+1)&&(m.start--,m.endA--,m.endB--);let g=p.doc.resolveNoCache(m.start-p.from),y=p.doc.resolveNoCache(m.endB-p.from),v=h.resolve(m.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=m.endA;if((wz&&e.input.lastIOSEnter>Date.now()-225&&(!b||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&g.pos<p.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(p.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,wS(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,r,n,i){if(r-t<=i.pos-n.pos||SP(n,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!n.parent.isTextblock){let e=a.nodeAfter;return null!=e&&r==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(SP(a,!0,!0));return!(!o.parent.isTextblock||o.pos>r||SP(o,!0,!1)<r)&&n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(h,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",t=>t(e,wS(8,"Backspace")))){wU&&wD&&e.domObserver.suppressSelectionUpdates();return}wD&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),wU&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==m.endA&&(m.endB-=2,y=p.doc.resolveNoCache(m.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,wS(13,"Enter"))})},20));let x=m.start,k=m.endA,w=t=>{let r=t||e.state.tr.replace(x,k,p.doc.slice(m.start-p.from,m.endB-p.from));if(p.sel){let t=SR(e,r.doc,p.sel);t&&!(wD&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==x||t.head==r.mapping.map(k)-1)||wA&&t.empty&&t.head==x)&&r.setSelection(t)}return l&&r.setMeta("composition",l),r.scrollIntoView()};if(b)if(g.pos==y.pos){wA&&wj<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>_v(e),20));let t=w(e.state.tr.delete(x,k)),r=h.resolve(m.start).marksAcross(h.resolve(m.endA));r&&t.ensureMarks(r),e.dispatch(t)}else if(m.endA==m.endB&&(s=function(e,t){let r=e.firstChild.marks,n=t.firstChild.marks,i=r,a=n,o,s,l;for(let e=0;e<n.length;e++)i=n[e].removeFromSet(i);for(let e=0;e<r.length;e++)a=r[e].removeFromSet(a);if(1==i.length&&0==a.length)s=i[0],o="add",l=e=>e.mark(s.addToSet(e.marks));else{if(0!=i.length||1!=a.length)return null;s=a[0],o="remove",l=e=>e.mark(s.removeFromSet(e.marks))}let u=[];for(let e=0;e<t.childCount;e++)u.push(l(t.child(e)));if(xa.from(u).eq(e))return{mark:s,type:o}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let t=w(e.state.tr);"add"==s.type?t.addMark(x,k,s.mark):t.removeMark(x,k,s.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-!y.textOffset){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),r=()=>w(e.state.tr.insertText(t,x,k));e.someProp("handleTextInput",n=>n(e,x,k,t,r))||e.dispatch(r())}else e.dispatch(w());else e.dispatch(w())})(this,e,t,r,n)),this.domObserver.start(),function(e){for(let t in _G){let r=_G[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;
93if(t.defaultPrevented)return!1;for(let r=t.target;r!=e.dom;r=r.parentNode)if(!r||11==r.nodeType||r.pmViewDesc&&r.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||_2(e,t)||!e.editable&&t.type in _X||r(e,t)},_Y[t]?{passive:!0}:void 0)}wP&&e.dom.addEventListener("input",()=>null),_1(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&_1(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sq),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let r in t.state=this.state,e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r,n,i;let a=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(St(this),s=!0),this.state=e;let l=a.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=SZ(this);(function(e,t){let r=0,n=0;for(let n in e){if(e[n]!=t[n])return!0;r++}for(let e in t)n++;return r!=n})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&_1(this),this.editable=SB(this),SU(this);let u=SC(this),c=SF(this),d=a.plugins==e.plugins||a.doc.eq(e.doc)?e.scrollToSelection>a.scrollToSelection?"to selection":"preserve":"reset",p=o||!this.docView.matchesNode(e.doc,c,u);(p||!e.selection.eq(a.selection))&&(s=!0);let h="preserve"==d&&s&&null==this.dom.style.overflowAnchor&&function(e){let t,r,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let a=(n.left+n.right)/2,o=i+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=e.root.elementFromPoint(a,o);if(!n||n==e.dom||!e.dom.contains(n))continue;let s=n.getBoundingClientRect();if(s.top>=i-20){t=n,r=s.top;break}}return{refDOM:t,refTop:r,stack:wH(e.dom)}}(this);if(s){let t,r,s;this.domObserver.stop();let l=p&&(wA||wD)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&(n=a.selection,i=e.selection,s=Math.min(n.$anchor.sharedDepth(n.head),i.$anchor.sharedDepth(i.head)),n.$anchor.start(s)!=i.$anchor.start(s));if(p){let t=wD?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let r=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=wk(e=e.childNodes[t-1])}else{if(!e.parentNode||ww(e))return null;t=wh(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),n=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||ww(e))return null;t=wh(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(r&&n&&r!=n){let t=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!t||!t.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=r.pmViewDesc;if(!(!e||!e.isText(r.nodeValue)))return n}}return r||n}(this)),(o||!this.docView.update(e.doc,c,u,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=_r(e.doc,c,u,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}l||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),r=this.domSelectionRange(),wv(t.node,t.offset,r.anchorNode,r.anchorOffset)))?_v(this,l):(__(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),(null==(r=this.dragging)?void 0:r.node)&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),"reset"==d?this.dom.scrollTop=0:"to selection"==d?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:r}){let n=e?e.getBoundingClientRect().top:0;wK(r,0==n?0:n-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof kD){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&wV(this,t.getBoundingClientRect(),e)}else wV(this,this.coordsAtPos(this.state.selection.head,1),e)}
93destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let r=e.node,n=-1;if(this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let e=r.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==r.node&&(n=e)}this.dragging=new So(e.slice,e.move,n<0?void 0:kD.create(this.state.doc,n))}someProp(e,t){let r=this._props&&this._props[e],n;if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let i=this.directPlugins[r].props[e];if(null!=i&&(n=t?t(i):i))return n}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let a=i[r].props[e];if(null!=a&&(n=t?t(a):a))return n}}hasFocus(){if(wA){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(wW)return e.focus(wW);let t=wH(e);e.focus(null==wW?{get preventScroll(){return wW={preventScroll:!0},!0}}:void 0),wW||(wW=!1,wK(t,0))}(this.dom),_v(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var r;let n,i,a=e.dom.ownerDocument,o,s=0,l=function(e,t,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(t,r);if(n)return{node:n.offsetNode,offset:Math.min(wk(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(t,r);if(n)return{node:n.startContainer,offset:Math.min(wk(n.startContainer),n.startOffset)}}}(a,t.left,t.top);l&&({node:o,offset:s}=l);let u=(e.root.elementFromPoint?e.root:a).elementFromPoint(t.left,t.top);if(!u||!e.dom.contains(1!=u.nodeType?u.parentNode:u)){let r=e.dom.getBoundingClientRect();if(!wJ(t,r)||!(u=function e(t,r,n){let i=t.childNodes.length;if(i&&n.top<n.bottom)for(let a=Math.max(0,Math.min(i-1,Math.floor(i*(r.top-n.top)/(n.bottom-n.top))-2)),o=a;;){let n=t.childNodes[o];if(1==n.nodeType){let t=n.getClientRects();for(let i=0;i<t.length;i++){let a=t[i];if(wJ(r,a))return e(n,r,a)}}if((o=(o+1)%i)==a)break}return t}(e.dom,t,r)))return null}if(wP)for(let e=u;o&&e;e=wf(e))e.draggable&&(o=void 0);if(u=(n=(r=u).parentNode)&&/^li$/i.test(n.nodeName)&&t.left<r.getBoundingClientRect().left?n:r,o){let r;if(wM&&1==o.nodeType&&(s=Math.min(s,o.childNodes.length))<o.childNodes.length){let e=o.childNodes[s],r;"IMG"==e.nodeName&&(r=e.getBoundingClientRect()).right<=t.left&&r.bottom>t.top&&s++}wB&&s&&1==o.nodeType&&1==(r=o.childNodes[s-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&s--,o==e.dom&&s==o.childNodes.length-1&&1==o.lastChild.nodeType&&t.top>o.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==s||1!=o.nodeType||"BR"!=o.childNodes[s-1].nodeName)&&(i=function(e,t,r,n){let i=-1;for(let r=t,a=!1;r!=e.dom;){let t=e.docView.nearestDesc(r,!0),o;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>n.left||o.top>n.top?i=t.posBefore:(!a&&o.right<n.left||o.bottom<n.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?n.top<(o.top+o.bottom)/2:n.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;r=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,r,-1)}(e,o,s,t))}null==i&&(i=function(e,t,r){let{node:n,offset:i}=function e(t,r){let n,i,a,o=2e8,s,l=0,u=r.top,c=r.top;for(let e=t.firstChild,d=0;e;e=e.nextSibling,d++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=wg(e).getClientRects()}for(let p=0;p<t.length;p++){let h=t[p];if(h.top<=u&&h.bottom>=c){u=Math.max(h.bottom,u),c=Math.min(h.top,c);let t=h.left>r.left?h.left-r.left:h.right<r.left?r.left-h.right:0;if(t<o){a=e,o=t,s=t&&3==a.nodeType?{left:h.right<r.left?h.right:h.left,top:r.top}
93:r,1==e.nodeType&&t&&(l=d+ +(r.left>=(h.left+h.right)/2));continue}}else h.top>r.top&&!n&&h.left<=r.left&&h.right>=r.left&&(n=e,i={left:Math.max(h.left,Math.min(h.right,r.left)),top:h.top});!a&&(r.left>=h.right&&r.top>=h.top||r.left>=h.left&&r.top>=h.bottom)&&(l=d+1)}}return(!a&&n&&(a=n,s=i,o=0),a&&3==a.nodeType)?function(e,t){let r=e.nodeValue.length,n=document.createRange(),i;for(let a=0;a<r;a++){n.setEnd(e,a+1),n.setStart(e,a);let r=wX(n,1);if(r.top!=r.bottom&&wJ(t,r)){i={node:e,offset:a+ +(t.left>=(r.left+r.right)/2)};break}}return n.detach(),i||{node:e,offset:0}}(a,s):!a||o&&1==a.nodeType?{node:t,offset:l}:e(a,s)}(t,r),a=-1;if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();a=e.left!=e.right&&r.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,a)}(e,u,t));let c=e.docView.nearestDesc(u,!0);return{pos:i,inside:c?c.posAtStart-c.border:-1}}(this,e)}coordsAtPos(e,t=1){return wQ(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let n=this.docView.posFromDOM(e,t,r);if(null==n)throw RangeError("DOM position not inside the editor");return n}endOfTextblock(e,t){return function(e,t,r){let n,i;return w5==t&&w6==r?w3:(w5=t,w6=r,w3="up"==r||"down"==r?(n=t.selection,i="up"==r?n.$from:n.$to,w2(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==r?-1:1);for(;;){let r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}let n=wQ(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=wg(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==r?n.top-i.top>(i.bottom-n.top)*2:i.bottom-n.bottom>(n.bottom-i.top)*2))return!1}}return!0})):function(e,t,r){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,a=i==n.parent.content.size,o=e.domSelection();return o?w4.test(n.parent.textContent)&&o.modify?w2(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:s}=e.domSelectionRange(),l=o.caretBidiLevel;o.modify("move",r,"character");let u=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:c,focusOffset:d}=e.domSelectionRange(),p=c&&!u.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==d;try{o.collapse(a,s),t&&(t!=a||i!=s)&&o.extend&&o.extend(t,i)}catch(e){}return null!=l&&(o.caretBidiLevel=l),p}):"left"==r||"backward"==r?!i:a:n.pos==n.start()||n.pos==n.end()}(e,t,r))}(this,t||this.state,e)}pasteHTML(e,t){return Si(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Si(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return _F(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],SC(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,wy()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!_2(this,e)&&_G[e.type]&&(this.editable||!(e.type in _X))&&_G[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?wP&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let r;if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return SM(e,r)}function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?SM(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function SF(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",r=>{if("function"==typeof r&&(r=r(e.state)),r)for(let e in r)"class"==e?t.class+=" "+r[e]:"style"==e?t.style=(t.style?t.style+";":"")+r[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(r[e]))}
93),t.translate||(t.translate="no"),[Sh.node(0,e.state.doc.content.size,t)]}function SU(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Sh.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function SB(e){return!e.someProp("editable",t=>!1===t(e.state))}function SZ(e){let t=Object.create(null);function r(e){for(let r in e)Object.prototype.hasOwnProperty.call(t,r)||(t[r]=e[r])}return e.someProp("nodeViews",r),e.someProp("markViews",r),t}function Sq(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}SL.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var SV={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},SH={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},SK="u">typeof navigator&&/Mac/.test(navigator.platform),SW="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),SJ=0;SJ<10;SJ++)SV[48+SJ]=SV[96+SJ]=String(SJ);for(var SJ=1;SJ<=24;SJ++)SV[SJ+111]="F"+SJ;for(var SJ=65;SJ<=90;SJ++)SV[SJ]=String.fromCharCode(SJ+32),SH[SJ]=String.fromCharCode(SJ);for(var SG in SV)SH.hasOwnProperty(SG)||(SH[SG]=SV[SG]);let SX="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),SY="u">typeof navigator&&/Win/.test(navigator.platform);function SQ(e,t,r=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),r&&t.shiftKey&&(e="Shift-"+e),e}function S0(e){let t=function(e){let t=Object.create(null);for(let r in e)t[function(e){let t,r,n,i,a=e.split(/-(?!$)/),o=a[a.length-1];"Space"==o&&(o=" ");for(let e=0;e<a.length-1;e++){let o=a[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else if(/^mod$/i.test(o))SX?i=!0:r=!0;else throw Error("Unrecognized modifier name: "+o)}return t&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),n&&(o="Shift-"+o),o}(r)]=e[r];return t}(e);return function(e,r){var n;let i=("Esc"==(n=!(SK&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||SW&&r.shiftKey&&r.key&&1==r.key.length||"Unidentified"==r.key)&&r.key||(r.shiftKey?SH:SV)[r.keyCode]||r.key||"Unidentified")&&(n="Escape"),"Del"==n&&(n="Delete"),"Left"==n&&(n="ArrowLeft"),"Up"==n&&(n="ArrowUp"),"Right"==n&&(n="ArrowRight"),"Down"==n&&(n="ArrowDown"),n),a,o=t[SQ(i,r)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(r.shiftKey){let n=t[SQ(i,r,!1)];if(n&&n(e.state,e.dispatch,e))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(SY&&r.ctrlKey&&r.altKey)&&(a=SV[r.keyCode])&&a!=i){let n=t[SQ(a,r)];if(n&&n(e.state,e.dispatch,e))return!0}}return!1}}var S1=Object.defineProperty,S2=(e,t)=>{for(var r in t)S1(e,r,{get:t[r],enumerable:!0})};function S4(e){let{state:t,transaction:r}=e,{selection:n}=r,{doc:i}=r,{storedMarks:a}=r;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,a=r.storedMarks,r}}}var S5=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:n}=t,{tr:i}=r,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let r=t(...e)(a);return i.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(i),r}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:r,editor:n,state:i}=this,{view:a}=n,o=[],s=!!e,l=e||i.tr,u=()=>(s||!t||l.getMeta("preventDispatch")||this.hasCustomState||a.dispatch(l),o.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(r).map(([e,r])=>[e,(...e)=>{let n=this.buildProps(l,t),i=r(...e)(n);return o.push(i),c}])),run:u};return c}createCan(e){let{rawCommands:t,state:r}=this,n=e||r.tr,i=this.buildProps(n,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(n,!1)}}buildProps(e,t=!0){let{rawCommands:r,editor:n,state:i}=this,{view:a}=n,o={tr:e,editor:n,view:a,state:S4({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},S6={};S2(S6,{blur:()=>S3,clearContent:()=>S9,clearNodes:()=>S8,command:()=>S7,createParagraphNear:()=>Ee,cut:()=>Et,deleteCurrentNode:()=>Er,deleteNode:()=>Ei,deleteRange:()=>Ea,deleteSelection:()=>Eo,enter:()=>Es,exitCode:()=>El,extendMarkRange:()=>Em,first:()=>Eg,focus:()=>Ew,forEach:()=>E_,insertContent:()=>ES,insertContentAt:()=>ET,joinBackward:()=>EA,joinDown:()=>EN,joinForward:()=>Ej,joinItemBackward:()=>EM,joinItemForward:()=>EO,joinTextblockBackward:()=>ED,joinTextblockForward:()=>ER,joinUp:()=>EI,keyboardShortcut:()=>Ez,lift:()=>EF,liftEmptyBlock:()=>EU,liftListItem:()=>EB,newlineInCode:()=>EZ,resetAttributes:()=>EH,scrollIntoView:()=>EK,selectAll:()=>EW,selectNodeBackward:()=>EJ,selectNodeForward:()=>EG,selectParentNode:()=>EX,selectTextblockEnd:()=>EY,selectTextblockStart:()=>EQ,setContent:()=>E1,setMark:()=>CC,setMeta:()=>C$,setNode:()=>CT,setNodeSelection:()=>CI,setTextDirection:()=>CN,setTextSelection:()=>CA,sinkListItem:()=>Cj,splitBlock:()=>CO,splitListItem:()=>CD,toggleList:()=>Cz,toggleMark:()=>CL,toggleNode:()=>CF,toggleWrap:()=>CU,undoInputRule:()=>CB,unsetAllMarks:()=>CZ,unsetMark:()=>Cq,unsetTextDirection:()=>CV,updateAttributes:()=>CH,wrapIn:()=>CK,wrapInList:()=>CW});var S3=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var r;e.isDestroyed||(t.dom.blur(),null==(r=null==window?void 0:window.getSelection())||r.removeAllRanges())}),!0),S9=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),S8=()=>({state:e,tr:t,dispatch:r})=>{let{selection:n}=t,{ranges:i}=n;return!r||(i.forEach(({$from:r,$to:n})=>{e.doc.nodesBetween(r.pos,n.pos,(e,r)=>{if(e.type.isText)return;let{doc:n,mapping:i}=t,a=n.resolve(i.map(r)),o=n.resolve(i.map(r+e.nodeSize)),s=a.blockRange(o);if(!s)return;let l=ko(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(l||0===l)&&t.lift(s,l)})}),!0)},S7=e=>t=>e(t),Ee=()=>({state:e,dispatch:t})=>wt(e,t),Et=(e,t)=>
93({editor:r,tr:n})=>{let{state:i}=r,a=i.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);let o=n.mapping.map(t);return n.insert(o,a.content),n.setSelection(new kM(n.doc.resolve(Math.max(o-1,0)))),!0},Er=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return!1;let i=e.selection.$anchor;for(let r=i.depth;r>0;r-=1)if(i.node(r).type===n.type){if(t){let t=i.before(r),n=i.after(r);e.delete(t,n).scrollIntoView()}return!0}return!1};function En(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Ei=e=>({tr:t,state:r,dispatch:n})=>{let i=En(e,r.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;e-=1)if(a.node(e).type===i){if(n){let r=a.before(e),n=a.after(e);t.delete(r,n).scrollIntoView()}return!0}return!1},Ea=e=>({tr:t,dispatch:r})=>{let{from:n,to:i}=e;return r&&t.delete(n,i),!0},Eo=()=>({state:e,dispatch:t})=>kX(e,t),Es=()=>({commands:e})=>e.keyboardShortcut("Enter"),El=()=>({state:e,dispatch:t})=>we(e,t);function Eu(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Ec(e,t,r={strict:!0}){let n=Object.keys(t);return!n.length||n.every(n=>r.strict?t[n]===e[n]:Eu(t[n])?t[n].test(e[n]):t[n]===e[n])}function Ed(e,t,r={}){return e.find(e=>e.type===t&&Ec(Object.fromEntries(Object.keys(r).map(t=>[t,e.attrs[t]])),r))}function Ep(e,t,r={}){return!!Ed(e,t,r)}function Eh(e,t,r){var n;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some(e=>e.type===t)||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(e=>e.type===t)||(r=r||(null==(n=i.node.marks[0])?void 0:n.attrs),!Ed([...i.node.marks],t,r)))return;let a=i.index,o=e.start()+i.offset,s=a+1,l=o+i.node.nodeSize;for(;a>0&&Ep([...e.parent.child(a-1).marks],t,r);)a-=1,o-=e.parent.child(a).nodeSize;for(;s<e.parent.childCount&&Ep([...e.parent.child(s).marks],t,r);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function Ef(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Em=(e,t={})=>({tr:r,state:n,dispatch:i})=>{let a=Ef(e,n.schema),{doc:o,selection:s}=r,{$from:l,from:u,to:c}=s;if(i){let e=Eh(l,a,t);if(e&&e.from<=u&&e.to>=c){let t=kM.create(o,e.from,e.to);r.setSelection(t)}}return!0},Eg=e=>t=>{let r="function"==typeof e?e(t):e;for(let e=0;e<r.length;e+=1)if(r[e](t))return!0;return!1};function Ey(e){return e instanceof kM}function Ev(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}
93function Eb(e,t=null){if(!t)return null;let r=kI.atStart(e),n=kI.atEnd(e);if("start"===t||!0===t)return r;if("end"===t)return n;let i=r.from,a=n.to;return"all"===t?kM.create(e,Ev(0,i,a),Ev(e.content.size,i,a)):kM.create(e,Ev(t,i,a),Ev(t,i,a))}function Ex(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function Ek(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Ew=(e=null,t={})=>({editor:r,view:n,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Ek()||Ex())&&n.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!Ek()&&!Ex()&&n.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!r.isDestroyed&&(n.focus(),(null==t?void 0:t.scrollIntoView)&&r.commands.scrollIntoView())})};try{if(n.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(a&&null===e&&!Ey(r.state.selection))return o(),!0;let s=Eb(i.doc,e)||r.state.selection,l=r.state.selection.eq(s);return a&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},E_=(e,t)=>r=>e.every((e,n)=>t(e,{...r,index:n})),ES=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t),EE=e=>{let t=e.childNodes;for(let r=t.length-1;r>=0;r-=1){let n=t[r];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):1===n.nodeType&&EE(n)}return e};function EC(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return EE(new window.DOMParser().parseFromString(t,"text/html").body)}function E$(e,t,r){if(e instanceof xS||e instanceof xa)return e;r={slice:!0,parseOptions:{},...r};let n="object"==typeof e&&null!==e,i="string"==typeof e;if(n)try{if(Array.isArray(e)&&e.length>0)return xa.fromArray(e.map(e=>t.nodeFromJSON(e)));let n=t.nodeFromJSON(e);return r.errorOnInvalidContent&&n.check(),n}catch(n){if(r.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),E$("",t,r)}if(i){if(r.errorOnInvalidContent){let n=!1,i="",a=new xL({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(n=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(r.slice?xU.fromSchema(a).parseSlice(EC(e),r.parseOptions):xU.fromSchema(a).parse(EC(e),r.parseOptions),r.errorOnInvalidContent&&n)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let n=xU.fromSchema(t);return r.slice?n.parseSlice(EC(e),r.parseOptions).content:n.parse(EC(e),r.parseOptions)}return E$("",t,r)}var ET=(e,t,r)=>({tr:n,dispatch:i,editor:a})=>{var o;if(i){let i,s;r={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};let l=e=>{a.emit("contentError",{editor:a,error:e,disableCollaboration:()=>{"collaboration"in a.storage&&"object"==typeof a.storage.collaboration&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{E$(t,a.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(e){l(e)}try{i=E$(t,a.schema,{parseOptions:u,errorOnInvalidContent:null!=(o=r.errorOnInvalidContent)?o:a.options.enableContentCheck})}catch(e){return l(e),!1}let{from:c,to:d}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,h=!0;if((!("type"in i)?i:[i]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),c===d&&h){let{parent:e}=n.doc.resolve(c);!e.isTextblock||e.type.spec.code||e.childCount||(c-=1,d+=1)}if(p){if(Array.isArray(t))s=t.map(e=>e.text||"").join("");else if(t instanceof xa){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),s=e}else s="object"==typeof t&&t&&t.text?t.text:t;n.insertText(s,c,d)}else{s=i;let e=n.doc.resolve(c),t=e.node(),r=0===e.parentOffset,a=t.isText||t.isTextblock,o=t.content.size>0;r&&a&&o&&(c=Math.max(0,c-1)),n.replaceWith(c,d,s)}r.updateSelection&&function(e,t){let r=e.steps.length-1;if(r<t)return;let n=e.steps[r];if(!(n instanceof kr||n instanceof kn))return;let i=e.mapping.maps[r],a=0;
93i.forEach((e,t,r,n)=>{0===a&&(a=n)}),e.setSelection(kI.near(e.doc.resolve(a),-1))}(n,n.steps.length-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:c,text:s}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:c,text:s})}return!0},EI=()=>({state:e,dispatch:t})=>((e,t)=>{let r=e.selection,n=r instanceof kD,i;if(n){if(r.node.isTextblock||!kp(e.doc,r.from))return!1;i=r.from}else if(null==(i=kf(e.doc,r.from,-1)))return!1;if(t){let r=e.tr.join(i);n&&r.setSelection(kD.create(r.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),EN=()=>({state:e,dispatch:t})=>((e,t)=>{let r=e.selection,n;if(r instanceof kD){if(r.node.isTextblock||!kp(e.doc,r.to))return!1;n=r.to}else if(null==(n=kf(e.doc,r.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),EA=()=>({state:e,dispatch:t})=>kQ(e,t),Ej=()=>({state:e,dispatch:t})=>k6(e,t),EM=()=>({state:e,dispatch:t,tr:r})=>{try{let n=kf(e.doc,e.selection.$from.pos,-1);if(null==n)return!1;return r.join(n,2),t&&t(r),!0}catch{return!1}},EO=()=>({state:e,dispatch:t,tr:r})=>{try{let n=kf(e.doc,e.selection.$from.pos,1);if(null==n)return!1;return r.join(n,2),t&&t(r),!0}catch{return!1}},ED=()=>({state:e,dispatch:t})=>((e,t,r)=>{let n=kY(e,r);if(!n)return!1;let i=k4(n);return!!i&&k0(e,i,t)})(e,t),ER=()=>({state:e,dispatch:t})=>((e,t,r)=>{let n=k5(e,r);if(!n)return!1;let i=k9(n);return!!i&&k0(e,i,t)})(e,t);function EP(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var Ez=e=>({editor:t,view:r,tr:n,dispatch:i})=>{let a=(function(e){let t,r,n,i,a=e.split(/-(?!$)/),o=a[a.length-1];"Space"===o&&(o=" ");for(let e=0;e<a.length-1;e+=1){let o=a[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else if(/^mod$/i.test(o))Ek()||EP()?i=!0:r=!0;else throw Error(`Unrecognized modifier name: ${o}`)}return t&&(o=`Alt-${o}`),r&&(o=`Ctrl-${o}`),i&&(o=`Meta-${o}`),n&&(o=`Shift-${o}`),o})(e).split(/-(?!$)/),o=a.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),s=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{r.someProp("handleKeyDown",e=>e(r,s))});return null==l||l.steps.forEach(e=>{let t=e.map(n.mapping);t&&i&&n.maybeStep(t)}),!0};function EL(e,t,r={}){let{from:n,to:i,empty:a}=e.selection,o=t?En(t,e.schema):null,s=[];e.doc.nodesBetween(n,i,(e,t)=>{if(e.isText)return;let r=Math.max(n,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:r,to:a})});let l=i-n,u=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>Ec(e.node.attrs,r,{strict:!1}));return a?!!u.length:u.reduce((e,t)=>e+t.to-t.from,0)>=l}var EF=(e,t={})=>({state:r,dispatch:n})=>{let i=En(e,r.schema);return!!EL(r,i,t)&&((e,t)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),a=i&&ko(i);return null!=a&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)})(r,n)},EU=()=>({state:e,dispatch:t})=>wr(e,t),EB=e=>({state:t,dispatch:r})=>{var n;return(n=En(e,t.schema),function(e,t){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==n);return!!a&&(!t||(r.node(a.depth-1).type==n?function(e,t,r,n){let i=e.tr,a=n.end,o=n.$to.end(n.depth);a<o&&(i.step(new kn(a-1,o,a,o,new xd(xa.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new xw(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));let s=ko(n);if(null==s)return!1;i.lift(n,s);let l=i.doc.resolve(i.mapping.map(a,-1)-1);return kp(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}(e,t,n,a):function(e,t,r){let n=e.tr,i=r.parent;for(let e=r.end,t=r.endIndex-1,a=r.startIndex;t>a;t--)e-=i.child(t).nodeSize,n.delete(e-1,e+1);let a=n.doc.resolve(r.start),o=a.nodeAfter;if(n.mapping.map(r.end)!=r.start+a.nodeAfter.nodeSize)return!1;let s=0==r.startIndex,l=r.endIndex==i.childCount,u=a.node(-1),c=a.index(-1);if(!u.canReplace(c+ +!s,c+1,o.content.append(l?xa.empty:xa.from(i))))return!1;let d=a.pos,p=d+o.nodeSize;return n.step(new kn(d-!!s,p+ +!!l,d+1,p-1,new xd((s?xa.empty:xa.from(i.copy(xa.empty))).append(l?xa.empty:xa.from(i.copy(xa.empty))),+!s,+!l),+!s)),t(n.scrollIntoView()),!0}
93(e,t,a)))})(t,r)},EZ=()=>({state:e,dispatch:t})=>k8(e,t);function Eq(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function EV(e,t){let r="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,n)=>(r.includes(n)||(t[n]=e[n]),t),{})}var EH=(e,t)=>({tr:r,state:n,dispatch:i})=>{let a=null,o=null,s=Eq("string"==typeof e?e:e.name,n.schema);if(!s)return!1;"node"===s&&(a=En(e,n.schema)),"mark"===s&&(o=Ef(e,n.schema));let l=!1;return r.selection.ranges.forEach(e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,n)=>{a&&a===e.type&&(l=!0,i&&r.setNodeMarkup(n,void 0,EV(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(l=!0,i&&r.addMark(n,n+e.nodeSize,o.create(EV(a.attrs,t))))})})}),l},EK=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),EW=()=>({tr:e,dispatch:t})=>{if(t){let t=new kP(e.doc);e.setSelection(t)}return!0},EJ=()=>({state:e,dispatch:t})=>k2(e,t),EG=()=>({state:e,dispatch:t})=>k3(e,t),EX=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:r,to:n}=e.selection,i,a=r.sharedDepth(n);return 0!=a&&(i=r.before(a),t&&t(e.tr.setSelection(kD.create(e.doc,i))),!0)})(e,t),EY=()=>({state:e,dispatch:t})=>wo(e,t),EQ=()=>({state:e,dispatch:t})=>wa(e,t);function E0(e,t,r={},n={}){return E$(e,t,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var E1=(e,{errorOnInvalidContent:t,emitUpdate:r=!0,parseOptions:n={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:l}=a;if("full"!==n.preserveWhitespace){let s=E0(e,i.schema,n,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return o&&a.replaceWith(0,l.content.size,s).setMeta("preventUpdate",!r),!0}return o&&a.setMeta("preventUpdate",!r),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:n,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function E2(e,t){let r=Ef(t,e.schema),{from:n,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===r.name);return s?{...s.attrs}:{}}function E4(e,t){let r=new k$(e);return t.forEach(e=>{e.steps.forEach(e=>{r.step(e)})}),r}function E5(e){return t=>(function(e,t){for(let r=e.depth;r>0;r-=1){let n=e.node(r);if(t(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}})(t.$from,e)}function E6(e,t,r){return void 0===e.config[t]&&e.parent?E6(e.parent,t,r):"function"==typeof e.config[t]?e.config[t].bind({...r,parent:e.parent?E6(e.parent,t,r):null}):e.config[t]}function E3(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},r=E6(e,"addExtensions",t);return r?[e,...E3(r())]:e}).flat(10)}function E9(e,t){let r=xG.fromSchema(t).serializeFragment(e),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(r),n.innerHTML}function E8(e){return"function"==typeof e}function E7(e,t,...r){return E8(e)?t?e.bind(t)(...r):e(...r):e}function Ce(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Ct(e){let t=[],{nodeExtensions:r,markExtensions:n}=Ce(e),i=[...r,...n],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=r.filter(e=>"text"!==e.name).map(e=>e.name),s=n.map(e=>e.name),l=[...o,...s];return e.forEach(e=>{let r={name:e.name,options:e.options,storage:e.storage,extensions:i},n=E6(e,"addGlobalAttributes",r);n&&n().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?o:"marks"===e.types?s:[]).forEach(r=>{Object.entries(e.attributes).forEach(([e,n])=>{t.push({type:r,name:e,attribute:{...a,...n}})})})})}
93),i.forEach(e=>{let r={name:e.name,options:e.options,storage:e.storage},n=E6(e,"addAttributes",r);n&&Object.entries(n()).forEach(([r,n])=>{let i={...a,...n};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:r,attribute:i})})}),t}function Cr(e){let t=[],r=function(e){let t=[],r="",n=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if("'"===o&&!i){n=!n,r+=o;continue}if('"'===o&&!n){i=!i,r+=o;continue}if(!n&&!i){if("("===o){a+=1,r+=o;continue}if(")"===o&&a>0){a-=1,r+=o;continue}if(";"===o&&0===a){t.push(r),r="";continue}}r+=o}return r&&t.push(r),t}(e||""),n=r.length;for(let e=0;e<n;e+=1){let n=r[e],i=n.indexOf(":");if(-1===i)continue;let a=n.slice(0,i).trim(),o=n.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function Cn(...e){return e.filter(e=>!!e).reduce((e,t)=>{let r={...e};return Object.entries(t).forEach(([e,t])=>{if(!r[e]){r[e]=t;return}if("class"===e){let n=t?String(t).split(" "):[],i=r[e]?r[e].split(" "):[],a=n.filter(e=>!i.includes(e));r[e]=[...i,...a].join(" ")}else if("style"===e){let n=new Map([...Cr(r[e]),...Cr(t)]);r[e]=Array.from(n.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else r[e]=t}),r},{})}function Ci(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Cn(e,t),{})}function Ca(e,t){return"style"in e?e:{...e,getAttrs:r=>{let n=e.getAttrs?e.getAttrs(r):e.attrs;if(!1===n)return!1;let i=t.reduce((e,t)=>{var n;let i=t.attribute.parseHTML?t.attribute.parseHTML(r):"string"!=typeof(n=r.getAttribute(t.name))?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):"true"===n||"false"!==n&&n;return null==i?e:{...e,[t.name]:i}},{});return{...n,...i}}}}function Co(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Cs(e){var t,r;let n={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(n.default=e.attribute.default),(null==(r=null==e?void 0:e.attribute)?void 0:r.validate)!==void 0&&(n.validate=e.attribute.validate),[e.name,n]}function Cl(e,t){var r;let n=Ct(e),{nodeExtensions:i,markExtensions:a}=Ce(e),o=null==(r=i.find(e=>E6(e,"topNode")))?void 0:r.name;return new xL({topNode:o,nodes:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Co({...e.reduce((e,t)=>{let n=E6(t,"extendNodeSchema",a);return{...e,...n?n(r):{}}},{}),content:E7(E6(r,"content",a)),marks:E7(E6(r,"marks",a)),group:E7(E6(r,"group",a)),inline:E7(E6(r,"inline",a)),atom:E7(E6(r,"atom",a)),selectable:E7(E6(r,"selectable",a)),draggable:E7(E6(r,"draggable",a)),code:E7(E6(r,"code",a)),whitespace:E7(E6(r,"whitespace",a)),linebreakReplacement:E7(E6(r,"linebreakReplacement",a)),defining:E7(E6(r,"defining",a)),isolating:E7(E6(r,"isolating",a)),attrs:Object.fromEntries(i.map(Cs))}),s=E7(E6(r,"parseHTML",a));s&&(o.parseDOM=s.map(e=>Ca(e,i)));let l=E6(r,"renderHTML",a);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:Ci(e,i)}));let u=E6(r,"renderText",a);return u&&(o.toText=u),[r.name,o]})),marks:Object.fromEntries(a.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Co({...e.reduce((e,t)=>{let n=E6(t,"extendMarkSchema",a);return{...e,...n?n(r):{}}},{}),inclusive:E7(E6(r,"inclusive",a)),excludes:E7(E6(r,"excludes",a)),group:E7(E6(r,"group",a)),spanning:E7(E6(r,"spanning",a)),code:E7(E6(r,"code",a)),attrs:Object.fromEntries(i.map(Cs))}),s=E7(E6(r,"parseHTML",a));s&&(o.parseDOM=s.map(e=>Ca(e,i)));let l=E6(r,"renderHTML",a);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:Ci(e,i)})),[r.name,o]}))})}function Cu(e){return e.sort((e,t)=>{let r=E6(e,"priority")||100,n=E6(t,"priority")||100;return r>n?-1:+(r<n)})}function Cc(e){var t;let r=Cu(E3(e)),n=Array.from(new Set((t=r.map(e=>e.name)).filter((e,r)=>t.indexOf(e)!==r)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),r}function Cd(e,t,r){let{from:n,to:i}
93=t,{blockSeparator:a="\n\n",textSerializers:o={}}=r||{},s="";return e.nodesBetween(n,i,(e,r,l,u)=>{var c;e.isBlock&&r>n&&(s+=a);let d=null==o?void 0:o[e.type.name];if(d)return l&&(s+=d({node:e,pos:r,parent:l,index:u,range:t})),!1;e.isText&&(s+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(n,r)-r,i-r))}),s}function Cp(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Ch(e,t){let r=Eq("string"==typeof t?t:t.name,e.schema);return"node"===r?function(e,t){let r=En(t,e.schema),{from:n,to:i}=e.selection,a=[];e.doc.nodesBetween(n,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===r.name);return o?{...o.attrs}:{}}(e,t):"mark"===r?E2(e,t):{}}function Cf(e){let t,{mapping:r,steps:n}=e,i=[];return r.maps.forEach((e,t)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:r}=n[t];if(void 0===e||void 0===r)return;a.push({from:e,to:r})}a.forEach(({from:e,to:n})=>{let a=r.slice(t).map(e,-1),o=r.slice(t).map(n),s=r.invert().map(a,-1),l=r.invert().map(o);i.push({oldRange:{from:s,to:l},newRange:{from:a,to:o}})})}),1===(t=function(e,t=JSON.stringify){let r={};return e.filter(e=>{let n=t(e);return!Object.prototype.hasOwnProperty.call(r,n)&&(r[n]=!0)})}(i)).length?t:t.filter((e,r)=>!t.filter((e,t)=>t!==r).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Cm(e,t,r){let n=[];return e===t?r.resolve(e).marks().forEach(t=>{let i=Eh(r.resolve(e),t.type);i&&n.push({mark:t,...i})}):r.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&n.push(...e.marks.map(r=>({from:t,to:t+e.nodeSize,mark:r})))}),n}function Cg(e,t){return t.nodes[e]||t.marks[e]||null}function Cy(e,t,r){return Object.fromEntries(Object.entries(r).filter(([r])=>{let n=e.find(e=>e.type===t&&e.name===r);return!!n&&n.attribute.keepOnSplit}))}function Cv(e,t,r={}){let{empty:n,ranges:i}=e.selection,a=t?Ef(t,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>Ec(e.attrs,r,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:r})=>{let n=t.pos,i=r.pos;e.doc.nodesBetween(n,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let r=Math.max(n,t),l=Math.min(i,t+e.nodeSize);o+=l-r,s.push(...e.marks.map(e=>({mark:e,from:r,to:l})))})}),0===o)return!1;let l=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>Ec(e.mark.attrs,r,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),u=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+u:l)>=o}function Cb(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Cx(e,t){let{nodeExtensions:r}=Ce(t),n=r.find(t=>t.name===e);if(!n)return!1;let i={name:n.name,options:n.options,storage:n.storage},a=E7(E6(n,"group",i));return"string"==typeof a&&a.split(" ").includes("list")}function Ck(e,{checkChildren:t=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(n=e.text)?n:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let n=!0;return e.content.forEach(e=>{!1!==n&&(Ck(e,{ignoreWhitespace:r,checkChildren:t})||(n=!1))}),n}return!1}function Cw(e){return e instanceof kD}var C_=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function CS(e,t){let r=t.mapping.mapResult(e.position);return{position:new C_(r.pos),mapResult:r}}function CE(e){return new C_(e)}var CC=(e,t={})=>({tr:r,state:n,dispatch:i})=>{let{selection:a}=r,{empty:o,ranges:s}=a,l=Ef(e,n.schema);if(i)if(o){let e=E2(n,l);r.addStoredMark(l.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;n.doc.nodesBetween(i,a,(e,n)=>{let o=Math.max(n,i),s=Math.min(n+e.nodeSize,a);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&r.addMark(o,s,l.create({...e.attrs,...t}))}):r.addMark(o,s,l.create(t))})});return function(e,t,r){var n;let{selection:i}=t,a=null;
93if(Ey(i)&&(a=i.$cursor),a){let t=null!=(n=e.storedMarks)?n:a.marks();return a.parent.type.allowsMarkType(r)&&(!!r.isInSet(t)||!t.some(e=>e.type.excludes(r)))}let{ranges:o}=i;return o.some(({$from:t,$to:n})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(r);return e.doc.nodesBetween(t.pos,n.pos,(e,t,n)=>{if(i)return!1;if(e.isInline){let t=!n||n.type.allowsMarkType(r),a=!!r.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(r));i=t&&a}return!i}),i})}(n,r,l)},C$=(e,t)=>({tr:r})=>(r.setMeta(e,t),!0),CT=(e,t={})=>({state:r,dispatch:n,chain:i})=>{let a,o=En(e,r.schema);return(r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),o.isTextblock)?i().command(({commands:e})=>!!ws(o,{...a,...t})(r)||e.clearNodes()).command(({state:e})=>ws(o,{...a,...t})(e,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},CI=e=>({tr:t,dispatch:r})=>{if(r){let{doc:r}=t,n=Ev(e,0,r.content.size),i=kD.create(r,n);t.setSelection(i)}return!0},CN=(e,t)=>({tr:r,state:n,dispatch:i})=>{let a,o,{selection:s}=n;return"number"==typeof t?(a=t,o=t):t&&"from"in t&&"to"in t?(a=t.from,o=t.to):(a=s.from,o=s.to),i&&r.doc.nodesBetween(a,o,(t,n)=>{t.isText||r.setNodeMarkup(n,void 0,{...t.attrs,dir:e})}),!0},CA=e=>({tr:t,dispatch:r})=>{if(r){let{doc:r}=t,{from:n,to:i}="number"==typeof e?{from:e,to:e}:e,a=kM.atStart(r).from,o=kM.atEnd(r).to,s=Ev(n,a,o),l=Ev(i,a,o),u=kM.create(r,s,l);t.setSelection(u)}return!0},Cj=e=>({state:t,dispatch:r})=>{var n;return(n=En(e,t.schema),function(e,t){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==n);if(!a)return!1;let o=a.startIndex;if(0==o)return!1;let s=a.parent,l=s.child(o-1);if(l.type!=n)return!1;if(t){let r=l.lastChild&&l.lastChild.type==s.type,i=xa.from(r?n.create():null),o=new xd(xa.from(n.create(null,xa.from(s.type.create(null,i)))),r?3:1,0),u=a.start,c=a.end;t(e.tr.step(new kn(u-(r?3:1),c,u,c,o,1,!0)).scrollIntoView())}return!0})(t,r)};function CM(e,t){let r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){let n=r.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(n)}}var CO=({keepMarks:e=!0}={})=>({tr:t,state:r,dispatch:n,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:l}=a,u=Cy(i.extensionManager.attributes,s.node().type.name,s.node().attrs);if(a instanceof kD&&a.node.isBlock)return!!s.parentOffset&&!!kd(o,s.pos)&&(n&&(e&&CM(r,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let c=l.parentOffset===l.parent.content.size,d=0===s.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=c&&d?[{type:d,attrs:u}]:void 0,h=kd(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!h&&kd(t.doc,t.mapping.map(s.pos),1,d?[{type:d}]:void 0)&&(h=!0,p=d?[{type:d,attrs:u}]:void 0),n){if(h&&(a instanceof kM&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),d&&!c&&!s.parentOffset&&s.parent.type!==d)){let e=t.mapping.map(s.before()),r=t.doc.resolve(e);s.node(-1).canReplaceWith(r.index(),r.index()+1,d)&&t.setNodeMarkup(t.mapping.map(s.before()),d)}e&&CM(r,i.extensionManager.splittableMarks),t.scrollIntoView()}return h},CD=(e,t={})=>({tr:r,state:n,dispatch:i,editor:a})=>{var o;let s=En(e,n.schema),{$from:l,$to:u}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;let d=l.node(-1);if(d.type!==s)return!1;let p=a.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=xa.empty,n=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-n;t>=l.depth-3;t-=1)e=xa.from(l.node(t).copy(e));let i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,a={...Cy(p,l.node().type.name,l.node().attrs),...t},u=(null==(o=s.contentMatch.defaultType)?void 0:o.createAndFill(a))||void 0;e=e.append(xa.from(s.createAndFill(null,u)||void 0));let c=l.before(l.depth-(n-1));r.replace(c,l.after(-i),new xd(e,4-n,0));let d=-1;r.doc.nodesBetween(c,r.doc.content.size,(e,t)=>{if(d>-1)return!1;e.isTextblock&&0===e.content.size&&(d=t+1)}),d>-1&&r.setSelection(kM.near(r.doc.resolve(d))),r.scrollIntoView()}return!0}let h=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...Cy(p,d.type.name,d.attrs),...t},m={...Cy(p,l.node().type.name,l.node().attrs),...t};r.delete(l.pos,u.pos);let g=h?[{type:s,attrs:f},{type:h,attrs:m}]:[{type:s,attrs:f}];if(!kd(r.doc,l.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=n,{splittableMarks:o}=a.extensionManager,s=t||e.$to.parentOffset&&e.$from.marks();if(r.split(l.pos,2,g).scrollIntoView(),!s||!i)return!0;let u=s.filter(e=>
93o.includes(e.type.name));r.ensureMarks(u)}return!0},CR=(e,t)=>{let r=E5(e=>e.type===t)(e.selection);if(!r)return!0;let n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(void 0===n)return!0;let i=e.doc.nodeAt(n);return!(r.node.type===(null==i?void 0:i.type)&&kp(e.doc,r.pos))||(e.join(r.pos),!0)},CP=(e,t)=>{let r=E5(e=>e.type===t)(e.selection);if(!r)return!0;let n=e.doc.resolve(r.start).after(r.depth);if(void 0===n)return!0;let i=e.doc.nodeAt(n);return!(r.node.type===(null==i?void 0:i.type)&&kp(e.doc,n))||(e.join(n),!0)},Cz=(e,t,r,n={})=>({editor:i,tr:a,state:o,dispatch:s,chain:l,commands:u,can:c})=>{let{extensions:d,splittableMarks:p}=i.extensionManager,h=En(e,o.schema),f=En(t,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:v}=m,b=y.blockRange(v),x=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;let k=E5(e=>Cx(e.type.name,d))(m);if(b.depth>=1&&k&&b.depth-k.depth<=1){if(k.node.type===h)return u.liftListItem(f);if(Cx(k.node.type.name,d)&&h.validContent(k.node.content)&&s)return l().command(()=>(a.setNodeMarkup(k.pos,h),!0)).command(()=>CR(a,h)).command(()=>CP(a,h)).run()}return r&&x&&s?l().command(()=>{let e=c().wrapInList(h,n),t=x.filter(e=>p.includes(e.type.name));return a.ensureMarks(t),!!e||u.clearNodes()}).wrapInList(h,n).command(()=>CR(a,h)).command(()=>CP(a,h)).run():l().command(()=>!!c().wrapInList(h,n)||u.clearNodes()).wrapInList(h,n).command(()=>CR(a,h)).command(()=>CP(a,h)).run()},CL=(e,t={},r={})=>({state:n,commands:i})=>{let{extendEmptyMarkRange:a=!1}=r,o=Ef(e,n.schema);return Cv(n,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},CF=(e,t,r={})=>({state:n,commands:i})=>{let a,o=En(e,n.schema),s=En(t,n.schema),l=EL(n,o,r);return(n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),l)?i.setNode(s,a):i.setNode(o,{...a,...r})},CU=(e,t={})=>({state:r,commands:n})=>{let i=En(e,r.schema);return EL(r,i,t)?n.lift(i):n.wrapIn(i,t)},CB=()=>({state:e,dispatch:t})=>{let r=e.plugins;for(let n=0;n<r.length;n+=1){let i,a=r[n];if(a.spec.isInputRules&&(i=a.getState(e))){if(t){let t=e.tr,r=i.transform;for(let e=r.steps.length-1;e>=0;e-=1)t.step(r.steps[e].invert(r.docs[e]));if(i.text){let r=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,r))}else t.delete(i.from,i.to)}return!0}}return!1},CZ=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,{empty:n,ranges:i}=r;
93return!!n||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},Cq=(e,t={})=>({tr:r,state:n,dispatch:i})=>{var a;let{extendEmptyMarkRange:o=!1}=t,{selection:s}=r,l=Ef(e,n.schema),{$from:u,empty:c,ranges:d}=s;if(!i)return!0;if(c&&o){let{from:e,to:t}=s,n=null==(a=u.marks().find(e=>e.type===l))?void 0:a.attrs,i=Eh(u,l,n);i&&(e=i.from,t=i.to),r.removeMark(e,t,l)}else d.forEach(e=>{r.removeMark(e.$from.pos,e.$to.pos,l)});return r.removeStoredMark(l),!0},CV=e=>({tr:t,state:r,dispatch:n})=>{let i,a,{selection:o}=r;return"number"==typeof e?(i=e,a=e):e&&"from"in e&&"to"in e?(i=e.from,a=e.to):(i=o.from,a=o.to),n&&t.doc.nodesBetween(i,a,(e,r)=>{if(e.isText)return;let n={...e.attrs};delete n.dir,t.setNodeMarkup(r,void 0,n)}),!0},CH=(e,t={})=>({tr:r,state:n,dispatch:i})=>{let a=null,o=null,s=Eq("string"==typeof e?e:e.name,n.schema);if(!s)return!1;"node"===s&&(a=En(e,n.schema)),"mark"===s&&(o=Ef(e,n.schema));let l=!1;return r.selection.ranges.forEach(e=>{let s,u,c,d,p=e.$from.pos,h=e.$to.pos;r.selection.empty?n.doc.nodesBetween(p,h,(e,t)=>{a&&a===e.type&&(l=!0,c=Math.max(t,p),d=Math.min(t+e.nodeSize,h),s=t,u=e)}):n.doc.nodesBetween(p,h,(e,n)=>{n<p&&a&&a===e.type&&(l=!0,c=Math.max(n,p),d=Math.min(n+e.nodeSize,h),s=n,u=e),n>=p&&n<=h&&(a&&a===e.type&&(l=!0,i&&r.setNodeMarkup(n,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(l=!0,i)){let i=Math.max(n,p),s=Math.min(n+e.nodeSize,h);r.addMark(i,s,o.create({...a.attrs,...t}))}}))}),u&&(void 0!==s&&i&&r.setNodeMarkup(s,void 0,{...u.attrs,...t}),o&&u.marks.length&&u.marks.forEach(e=>{o===e.type&&i&&r.addMark(c,d,o.create({...e.attrs,...t}))}))}),l},CK=(e,t={})=>({state:r,dispatch:n})=>(function(e,t=null){return function(r,n){let{$from:i,$to:a}=r.selection,o=i.blockRange(a),s=o&&ks(o,e,t);return!!s&&(n&&n(r.tr.wrap(o,s).scrollIntoView()),!0)}})(En(e,r.schema),t)(r,n),CW=(e,t={})=>({state:r,dispatch:n})=>(function(e,t=null){return function(r,n){let{$from:i,$to:a}=r.selection,o=i.blockRange(a);if(!o)return!1;let s=n?r.tr:null;return!!function(e,t,r,n=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(r)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=o.resolve(t.start-2);a=new xw(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new xw(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=ks(a,r,n,t);return!!s&&(e&&function(e,t,r,n,i){let a=xa.empty;for(let e=r.length-1;e>=0;e--)a=xa.from(r[e].type.create(r[e].attrs,a));e.step(new kn(t.start-2*!!n,t.end,t.start,t.end,new xd(a,0,0),r.length,!0));let o=0;for(let e=0;e<r.length;e++)r[e].type==i&&(o=e+1);let s=r.length-o,l=t.start+r.length-2*!!n,u=t.parent;for(let r=t.startIndex,n=t.endIndex,i=!0;r<n;r++,i=!1)!i&&kd(e.doc,l,s)&&(e.split(l,s),l+=2*s),l+=u.child(r).nodeSize}(e,t,s,i,r),!0)}(s,o,e,t)&&(n&&n(s.scrollIntoView()),!0)}})(En(e,r.schema),t)(r,n),CJ=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let r=this.callbacks[e];return r&&r.forEach(e=>e.apply(this,t)),this}off(e,t){let r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let r=(...n)=>{this.off(e,r),t.apply(this,n)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}},CG=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function CX(e){var t;let{editor:r,from:n,to:i,text:a,rules:o,plugin:s}=e,{view:l}=r;if(l.composing)return!1;let u=l.state.doc.resolve(n);if(u.parent.type.spec.code||(null==(t=u.nodeBefore||u.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,d=((e,t=500)=>{let r="",n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-t),n,(e,t,i,a)=>{var o,s;let l=(null==(s=(o=e.type.spec).toText)?void 0:s.call(o,{node:e,pos:t,parent:i,index:a}))||e.textContent||"%leaf%";r+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,n-t))}),r})(u)+a;return o.forEach(e=>{if(c)return;let t=((e,t)=>{if(Eu(t))return t.exec(e);let r=t(e);if(!r)return null;let n=[r.text];return n.index=r.index,n.input=e,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n})(d,e.find);if(!t)return;let o=l.state.tr,u=S4({state:l.state,transaction:o}),p={from:n-(t[0].length-a.length),to:i}
93,{commands:h,chain:f,can:m}=new S5({editor:r,state:u});null!==e.handler({state:u,range:p,match:t,commands:h,chain:f,can:m})&&o.steps.length&&(e.undoable&&o.setMeta(s,{transform:o,from:n,to:i,text:a}),l.dispatch(o),c=!0)}),c}function CY(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var CQ=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...E7(E6(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...E7(E6(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,r){let n={...t};return CY(t)&&CY(r)&&Object.keys(r).forEach(i=>{CY(r[i])&&CY(t[i])?n[i]=e(t[i],r[i]):n[i]=r[i]}),n})(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},C0=class e extends CQ{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){let i=n.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let a=i.find(e=>(null==e?void 0:e.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",n.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},C1=class{constructor(e){this.find=e.find,this.handler=e.handler}},C2=null,C4=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Cc(e),this.schema=Cl(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Cg(t.name,this.schema)},n=E6(t,"addCommands",r);return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return Cu([...this.extensions].reverse()).flatMap(t=>{let r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Cg(t.name,this.schema)},n=[],i=E6(t,"addKeyboardShortcuts",r),a={};if("mark"===t.type&&E6(t,"exitable",r)&&(a.ArrowRight=()=>C0.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,r])=>[t,()=>r({editor:e})]));a={...a,...t}}let o=new kK({props:{handleKeyDown:S0(a)}});n.push(o);let s=E6(t,"addInputRules",r);if(Cb(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let r=function(e){let{editor:t,rules:r}=e,n=new kK({state:{init:()=>null,apply(e,i,a){let o=e.getMeta(n);if(o)return o;let s=e.getMeta("applyInputRules");return s&&setTimeout(()=>{let{text:e}=s;"string"==typeof e||(e=E9(xa.from(e),a.schema));let{from:i}=s,o=i+e.length;CX({editor:t,from:i,to:o,text:e,rules:r,plugin:n})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,a,o)=>CX({editor:t,from:i,to:a,text:o,rules:r,plugin:n}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&CX({editor:t,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:a}=e.state.selection;return!!a&&CX({editor:t,from:a.pos,to:a.pos,text:"\n",rules:r,plugin:n})}},isInputRules:!0});return n}({editor:e,rules:t}),i=Array.isArray(r)?r:[r];n.push(...i)}}let l=E6(t,"addPasteRules",r);if(Cb(t,e.options.enablePasteRules)&&l){let t=l();if(t&&t.length){let r=function(e){let t,{editor:r,rules:n}=e,i=null,a=!1,o=!1,s="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let l=({state:e,from:n,to:i,rule:a,pasteEvt:o})=>{let l=e.tr;if(function(e){let{editor:t,state:r,from:n,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:u,can:c}=new S5({editor:t,state:r}),d=[];return r.doc.nodesBetween(n,i,(e,t)=>{var p,h,f,m,g;if((null==(h=null==(p=e.type)?void 0:p.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,v=Math.max(n,t),b=Math.min(i,t+y);v>=b||((e,t,r)=>{if(Eu(t))return[...e.matchAll(t)];let n=t(e,r);return n?n.map(t=>{let r=[t.text];
93return r.index=t.index,r.input=e,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(t.replaceWith)),r}):[]})(e.isText?e.text||"":e.textBetween(v-t,b-t,void 0,""),a.find,o).forEach(e=>{if(void 0===e.index)return;let t=v+e.index+1,n=t+e[0].length,i={from:r.tr.mapping.map(t),to:r.tr.mapping.map(n)},p=a.handler({state:r,range:i,match:e,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:s});d.push(p)})}),d.every(e=>null!==e)}({editor:r,state:S4({state:e,transaction:l}),from:Math.max(n-1,0),to:i.b-1,rule:a,pasteEvent:o,dropEvent:t})&&l.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return s="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new kK({view(e){let t=t=>{var n;(i=(null==(n=e.dom.parentElement)?void 0:n.contains(t.target))?e.dom.parentElement:null)&&(C2=r)},n=()=>{C2&&(C2=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,r)=>{if(o=i===e.dom.parentElement,t=r,!o){let e=C2;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var r;let n=null==(r=t.clipboardData)?void 0:r.getData("text/html");return s=t,a=!!(null==n?void 0:n.includes("data-pm-slice")),!1}}},appendTransaction:(t,r,n)=>{let i=t[0],u="paste"===i.getMeta("uiEvent")&&!a,c="drop"===i.getMeta("uiEvent")&&!o,d=i.getMeta("applyPasteRules"),p=!!d;if(!u&&!c&&!p)return;if(p){var h,f;let t,{text:r}=d;"string"==typeof r||(r=E9(xa.from(r),n.schema));let{from:i}=d,a=i+r.length;return l({rule:e,state:n,from:i,to:{b:a},pasteEvt:(h=r,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.setData("text/html",h),t)})}let m=r.doc.content.findDiffStart(n.doc.content),g=r.doc.content.findDiffEnd(n.doc.content);if("number"==typeof m&&g&&m!==g.b)return l({rule:e,state:n,from:m,to:g,pasteEvt:s})}}))}({editor:e,rules:t});n.push(...r)}}let u=E6(t,"addProseMirrorPlugins",r);if(u){let e=u();n.push(...e)}return n})}get attributes(){return Ct(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Ce(this.extensions);return Object.fromEntries(t.filter(e=>!!E6(e,"addNodeView")).map(t=>{let r=this.attributes.filter(e=>e.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:En(t.name,this.schema)},i=E6(t,"addNodeView",n);if(!i)return[];let a=i();return a?[t.name,(n,i,o,s,l)=>{let u=Ci(n,r);return a({node:n,view:i,getPos:o,decorations:s,innerDecorations:l,editor:e,extension:t,HTMLAttributes:u})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return Cu([...this.extensions].reverse()).reduceRight((e,r)=>{let n={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Cg(r.name,this.schema)},i=E6(r,"dispatchTransaction",n);return i?t=>{i.call(n,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return Cu([...this.extensions]).reduce((e,r)=>{let n={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Cg(r.name,this.schema)},i=E6(r,"transformPastedHTML",n);return i?(t,r)=>{let a=e(t,r);return i.call(n,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=Ce(this.extensions);return Object.fromEntries(t.filter(e=>!!E6(e,"addMarkView")).map(t=>{let r=this.attributes.filter(e=>e.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ef(t.name,this.schema)},i=E6(t,"addMarkView",n);return i?[t.name,(n,a,o)=>{let s=Ci(n,r);return i()({mark:n,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{!function(e,t,r={}){let{state:n}=t,{doc:i,tr:a}=n;i.descendants((t,n)=>{let i=a.mapping.map(n),o=a.mapping.map(n)+t.nodeSize,s=null;if(t.marks.forEach(t=>{if(t!==e)return!1;s=t}),!s)return;let l=!1;
93if(Object.keys(r).forEach(e=>{r[e]!==s.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...r});a.removeMark(i,o,e.type),a.addMark(i,o,t)}}),a.docChanged&&t.view.dispatch(a)}(n,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Cg(e.name,this.schema)};"mark"===e.type&&(null==(t=E7(E6(e,"keepOnSplit",r)))||t)&&this.splittableMarks.push(e.name);let n=E6(e,"onBeforeCreate",r),i=E6(e,"onCreate",r),a=E6(e,"onUpdate",r),o=E6(e,"onSelectionUpdate",r),s=E6(e,"onTransaction",r),l=E6(e,"onFocus",r),u=E6(e,"onBlur",r),c=E6(e,"onDestroy",r);n&&this.editor.on("beforeCreate",n),i&&this.editor.on("create",i),a&&this.editor.on("update",a),o&&this.editor.on("selectionUpdate",o),s&&this.editor.on("transaction",s),l&&this.editor.on("focus",l),u&&this.editor.on("blur",u),c&&this.editor.on("destroy",c)})}};C4.resolve=Cc,C4.sort=Cu,C4.flatten=E3;var C5={};S2(C5,{ClipboardTextSerializer:()=>C3,Commands:()=>C9,Delete:()=>C8,Drop:()=>C7,Editable:()=>$e,FocusEvents:()=>$r,Keymap:()=>$n,Paste:()=>$i,Tabindex:()=>$a,TextDirection:()=>$o,focusEventsPluginKey:()=>$t});var C6=class e extends CQ{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},C3=C6.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new kK({key:new kG("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:r}=e,{doc:n,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),l=Cp(r);return Cd(n,{from:o,to:s},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),C9=C6.create({name:"commands",addCommands:()=>({...S6})}),C8=C6.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var r,n,i;let a=()=>{var r,n,i,a;if(null!=(a=null==(i=null==(n=null==(r=this.editor.options.coreExtensionOptions)?void 0:r.delete)?void 0:n.filterTransaction)?void 0:i.call(n,e))?a:e.getMeta("y-sync$"))return;let o=E4(e.before,[e,...t]);Cf(o).forEach(t=>{o.mapping.mapResult(t.oldRange.from).deletedAfter&&o.mapping.mapResult(t.oldRange.to).deletedBefore&&o.before.nodesBetween(t.oldRange.from,t.oldRange.to,(r,n)=>{let i=n+r.nodeSize-2,a=t.oldRange.from<=n&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:r,from:n,to:i,newFrom:o.mapping.map(n),newTo:o.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!a,editor:this.editor,transaction:e,combinedTransform:o})})});let s=o.mapping;o.steps.forEach((t,r)=>{var n,i;if(t instanceof x7){let a=s.slice(r).map(t.from,-1),l=s.slice(r).map(t.to),u=s.invert().map(a,-1),c=s.invert().map(l),d=null==(n=o.doc.nodeAt(a-1))?void 0:n.marks.some(e=>e.eq(t.mark)),p=null==(i=o.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:u,to:c},newRange:{from:a,to:l},partial:!!(p||d),editor:this.editor,transaction:e,combinedTransform:o})}})};null==(i=null==(n=null==(r=this.editor.options.coreExtensionOptions)?void 0:r.delete)?void 0:n.async)||i?setTimeout(a,0):a()}}),C7=C6.create({name:"drop",addProseMirrorPlugins(){return[new kK({key:new kG("tiptapDrop"),props:{handleDrop:(e,t,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:r,moved:n})}}})]}}),$e=C6.create({name:"editable",addProseMirrorPlugins(){return[new kK({key:new kG("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$t=new kG("focusEvents"),$r=C6.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new kK({key:$t,props:{handleDOMEvents:{focus:(t,r)=>
93{e.isFocused=!0;let n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return t.dispatch(n),!1},blur:(t,r)=>{e.isFocused=!1;let n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return t.dispatch(n),!1}}}})]}}),$n=C6.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:r,doc:n}=t,{empty:i,$anchor:a}=r,{pos:o,parent:s}=a,l=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,u=l.parent.type.spec.isolating,c=a.pos-a.parentOffset,d=u&&1===l.parent.childCount?c===a.pos:kI.atStart(n).from===o;return!!i&&!!s.type.isTextblock&&!s.textContent.length&&!!d&&(!d||"paragraph"!==a.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},n={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ek()||EP()?i:n},addProseMirrorPlugins(){return[new kK({key:new kG("clearDocument"),appendTransaction:(e,t,r)=>{if(e.some(e=>e.getMeta("composition")))return;let n=e.some(e=>e.docChanged)&&!t.doc.eq(r.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!n||i)return;let{empty:a,from:o,to:s}=t.selection,l=kI.atStart(t.doc).from,u=kI.atEnd(t.doc).to;if(a||o!==l||s!==u||!Ck(r.doc))return;let c=r.tr,d=S4({state:r,transaction:c}),{commands:p}=new S5({editor:this.editor,state:d});if(p.clearNodes(),c.steps.length)return c}})]}}),$i=C6.create({name:"paste",addProseMirrorPlugins(){return[new kK({key:new kG("tiptapPaste"),props:{handlePaste:(e,t,r)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:r})}}})]}}),$a=C6.create({name:"tabindex",addProseMirrorPlugins(){return[new kK({key:new kG("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),$o=C6.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Ce(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new kK({key:new kG("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),$s=class e{constructor(e,t,r=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=n}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((r,n)=>{let i=r.isBlock&&!r.isTextblock,a=r.isAtom&&!r.isText,o=r.isInline,s=this.pos+n+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(s);if(!i&&!o&&l.depth<=this.depth)return;let u=new e(l,this.editor,i,i||o?r:null);i&&(u.actualDepth=this.depth+1),t.push(u)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,n=this.parent;for(;n&&!r;
93){if(n.node.type.name===e)if(Object.keys(t).length>0){let e=n.node.attrs,r=Object.keys(t);for(let n=0;n<r.length;n+=1){let i=r[n];if(e[i]!==t[i])break}}else r=n;n=n.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let n=[];if(!this.children||0===this.children.length)return n;let i=Object.keys(t);return this.children.forEach(a=>{r&&n.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&n.push(a),r&&n.length>0||(n=n.concat(a.querySelectorAll(e,t,r))))}),n}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},$l=`.ProseMirror { 94 position: relative; 95} 96 97.ProseMirror { 98 word-wrap: break-word; 99 white-space: pre-wrap; 100 white-space: break-spaces; 101 -webkit-font-variant-ligatures: none; 102 font-variant-ligatures: none; 103 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 104} 105 106.ProseMirror [contenteditable="false"] { 107 white-space: normal; 108} 109 110.ProseMirror [contenteditable="false"] [contenteditable="true"] { 111 white-space: pre-wrap; 112} 113 114.ProseMirror pre { 115 white-space: pre-wrap; 116} 117 118img.ProseMirror-separator { 119 display: inline !important; 120 border: none !important; 121 margin: 0 !important; 122 width: 0 !important; 123 height: 0 !important; 124} 125 126.ProseMirror-gapcursor { 127 display: none; 128 pointer-events: none; 129 position: absolute; 130 margin: 0; 131} 132 133.ProseMirror-gapcursor:after { 134 content: ""; 135 display: block; 136 position: absolute; 137 top: -2px; 138 width: 20px; 139 border-top: 1px solid black; 140 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 141} 142 143@keyframes ProseMirror-cursor-blink { 144 to { 145 visibility: hidden; 146 } 147} 148 149.ProseMirror-hideselection *::selection { 150 background: transparent; 151} 152 153.ProseMirror-hideselection *::-moz-selection { 154 background: transparent; 155} 156 157.ProseMirror-hideselection * { 158 caret-color: transparent; 159} 160 161.ProseMirror-focused .ProseMirror-gapcursor { 162 display: block; 163}`,$u=class extends CJ{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:CS,createMappablePosition:CE},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:r})=>this.options.onDrop(e,t,r)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Eb(t,this.options.autofocus);this.editorState=kH.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
163this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t){let r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.setAttribute("data-tiptap-style",""),n.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(n),n}($l,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let r=E8(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,r=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;r=r.filter(e=>!e.key.startsWith(t))}),t.length===r.length)return;let n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var e,t;let r=[...this.options.enableCoreExtensions?[$e,C3.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),C9,$r,$n,$a,C7,$i,C8,$o.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new C4(r,this)}createCommandManager(){this.commandManager=new S5({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=E0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=E0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:r}=this.options,n=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=r?this.extensionManager.dispatchTransaction(n):n,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new SL(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}
163e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:r}=this.state.applyTransaction(e),n=!this.state.selection.eq(t.selection),i=r.includes(e),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=r.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),s=null==o?void 0:o.getMeta("focus"),l=null==o?void 0:o.getMeta("blur");s&&this.emit("focus",{editor:this,event:s.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),e.getMeta("preventUpdate")||!r.some(e=>e.docChanged)||a.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return Ch(this.state,e)}isActive(e,t){let r="string"==typeof e?e:null,n="string"==typeof e?t:e;return function(e,t,r={}){if(!t)return EL(e,null,r)||Cv(e,null,r);let n=Eq(t,e.schema);return"node"===n?EL(e,t,r):"mark"===n&&Cv(e,t,r)}(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return E9(this.state.doc.content,this.schema)}getText(e){var t,r;let n,{blockSeparator:i="\n\n",textSerializers:a={}}=e||{};return t=this.state.doc,r={blockSeparator:i,textSerializers:{...Cp(this.schema),...a}},n={from:0,to:t.content.size},Cd(t,n,r)}get isEmpty(){return Ck(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var r;return(null==(r=this.$doc)?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return(null==(r=this.$doc)?void 0:r.querySelectorAll(e,t))||null}$pos(e){return new $s(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function $c(e){return new CG({find:e.find,handler:({state:t,range:r,match:n})=>{let i=E7(e.getAttributes,void 0,n);if(!1===i||null===i)return null;let{tr:a}=t,o=n[n.length-1],s=n[0];if(o){let n=s.search(/\S/),l=r.from+s.indexOf(o),u=l+o.length;if(Cm(r.from,r.to,t.doc).filter(t=>t.mark.type.excluded.find(r=>r===e.type&&r!==t.mark.type)).filter(e=>e.to>l).length)return null;u<r.to&&a.delete(u,r.to),l>r.from&&a.delete(r.from+n,l);let c=r.from+n+o.length;a.addMark(r.from+n,c,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function $d(e){return new CG({find:e.find,handler:({state:t,range:r,match:n})=>{let i=t.doc.resolve(r.from),a=E7(e.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(r.from,r.to).setBlockType(r.from,r.from,e.type,a)},undoable:e.undoable})}function $p(e){return new CG({find:e.find,handler:({state:t,range:r,match:n,chain:i})=>{let a=E7(e.getAttributes,void 0,n)||{},o=t.tr.delete(r.from,r.to),s=o.doc.resolve(r.from).blockRange(),l=s&&ks(s,e.type,a);if(!l)return null;if(o.wrap(s,l),e.keepMarks&&e.editor){let{selection:r,storedMarks:n}=t,{splittableMarks:i}=e.editor.extensionManager,a=n||r.$to.parentOffset&&r.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,a).run()}let u=o.doc.resolve(r.from-1).nodeBefore;u&&u.type===e.type&&kp(o.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(n,u))&&o.join(r.from-1)},undoable:e.undoable})}function $h(e){if(!(null==e?void 0:e.trim()))return{};let t={},r=[],n=e.replace(/["']([^"']*)["']/g,e=>(r.push(e),`__QUOTED_${r.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let a=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(n.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,n])=>{var i;let a=r[parseInt((null==(i=n.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];a&&(t[e]=a.slice(1,-1))});let o=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\
163w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function $f(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,r])=>{"class"!==e&&"id"!==e&&(!0===r?t.push(e):!1!==r&&null!=r&&t.push(`${e}="${String(r)}"`))}),t.join(" ")}function $m(e){let{nodeName:t,name:r,parseAttributes:n=$h,serializeAttributes:i=$f,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,l=r||t;return{parseMarkdown:(e,r)=>{let n={...a,...e.attributes};return r.createNode(t,n,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let r=RegExp(`^:::${l}(?:\\s|$)`,"m"),n=null==(t=e.match(r))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,r,i){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let u=n(s[1]||"");if(!o.find(e=>!(e in u)))return{type:t,raw:s[0],attributes:u}}},renderMarkdown:e=>{let t=i((e=>{if(!s)return e;let t={};return s.forEach(r=>{r in e&&(t[r]=e[r])}),t})(e.attrs||{})),r=t?` {${t}}`:"";return`:::${l}${r} :::`}}}function $g(e){let{nodeName:t,name:r,getContent:n,parseAttributes:i=$h,serializeAttributes:a=$f,defaultAttributes:o={},content:s="block",allowedAttributes:l}=e,u=r||t;return{parseMarkdown:(e,r)=>{let i;if(n){let t=n(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===s?r.parseChildren(e.tokens||[]):r.parseInline(e.tokens||[]);let a={...o,...e.attributes};return r.createNode(t,a,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let r=RegExp(`^:::${u}`,"m"),n=null==(t=e.match(r))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,r,n){var a;let o=RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(o);if(!l)return;let[c,d=""]=l,p=i(d),h=1,f=c.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){let r=g.exec(y);if(null===r)break;let i=r.index,o=r[1];if(null==(a=r[2])||!a.endsWith(":::")){if(o)h+=1;else if(0==(h-=1)){let a=y.slice(0,i);m=a.trim();let o=e.slice(0,f+i+r[0].length),l=[];if(m)if("block"===s)for((l=n.blockTokens(a)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=n.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=n.inlineTokens(m);return{type:t,raw:o,attributes:p,content:m,tokens:l}}}}}},renderMarkdown:(e,t)=>{let r=a((e=>{if(!l)return e;let t={};return l.forEach(r=>{r in e&&(t[r]=e[r])}),t})(e.attrs||{})),n=r?` {${r}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${u}${n} 164 165${i} 166 167:::`}}}function $y(e){if(!e.trim())return{};let t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,n=r.exec(e);for(;null!==n;){let[,i,a,o]=n;t[i]=a||o,n=r.exec(e)}return t}function $v(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function $b(e){let{nodeName:t,name:r,getContent:n,parseAttributes:i=$y,serializeAttributes:a=$v,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:l}=e,u=r||t,c=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,r)=>{let i={...o,...e.attributes};if(s)return r.createNode(t,i);let a=n?n(e):e.content||"";return a?r.createNode(t,i,[r.createTextNode(a)]):r.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=s?RegExp(`\\[${c}\\s*[^\\]]*\\]`):RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),r=e.match(t),n=null==r?void 0:r.index;return void 0!==n?n:-1},tokenize(e,r,n){let a=s?RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),o=e.match(a);if(!o)return;let l="",u="";if(s){let[,e]=o;u=e}else{let[,e,t]=o;u=e,l=t||""}let d=i(u.trim());return{type:t,raw:o[0],content:l.trim(),attributes:d}}},renderMarkdown:e=>{let t="";n?t=n(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let r=a((e=>{if(!l)return e;let t={};return l.forEach(r=>{let n="string"==typeof r?r:r.name,i="string"==typeof r?void 0:r.skipIfDefault;if(n in e){let r=e[n];if(void 0!==i&&r===i)return;t[n]=r}}),t})(e.attrs||{})),i=r?` ${r}`:"";return s?`[${u}${i}]`:`[${u}${i}]${t}[/${u}]`}}
167}function $x(e,t,r){var n,i,a,o;let s=e.split("\n"),l=[],u="",c=0,d=t.baseIndentSize||2;for(;c<s.length;){let e,p=s[c],h=p.match(t.itemPattern);if(!h)if(l.length>0)break;else{if(""!==p.trim())return;c+=1,u=`${u}${p} 168`;continue}let f=t.extractItemData(h),{indentLevel:m,mainContent:g}=f;u=`${u}${p} 169`;let y=[g];for(c+=1;c<s.length;){let e=s[c];if(""===e.trim()){let t=s.slice(c+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(i=null==(n=s[c+1+t].match(/^(\s*)/))?void 0:n[1])?void 0:i.length)||0)>m){y.push(e),u=`${u}${e} 170`,c+=1;continue}break}if(((null==(o=null==(a=e.match(/^(\s*)/))?void 0:a[1])?void 0:o.length)||0)>m)y.push(e),u=`${u}${e} 171`,c+=1;else break}let v=y.slice(1);if(v.length>0){let n=v.map(e=>e.slice(m+d)).join("\n");n.trim()&&(e=t.customNestedParser?t.customNestedParser(n):r.blockTokens(n))}let b=t.createToken(f,e);l.push(b)}if(0!==l.length)return{items:l,raw:u}}function $k(e,t,r,n){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof r?r(n):r,[a,...o]=e.content,s=t.renderChildren([a]),l=`${i}${s}`;return o&&o.length>0&&o.forEach((e,r)=>{var n,i;let a=null!=(i=null==(n=t.renderChild)?void 0:n.call(t,e,r+1))?i:t.renderChildren([e]);if(null!=a){let r=a.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?` 172 173${r}`:` 174${r}`}}),l}S2({},{createAtomBlockMarkdownSpec:()=>$m,createBlockMarkdownSpec:()=>$g,createInlineMarkdownSpec:()=>$b,parseAttributes:()=>$h,parseIndentedBlocks:()=>$x,renderNestedMarkdownContent:()=>$k,serializeAttributes:()=>$f});var $w=class e extends CQ{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};function $_(e){return new C1({find:e.find,handler:({state:t,range:r,match:n,pasteEvent:i})=>{let a=E7(e.getAttributes,void 0,n,i);if(!1===a||null===a)return null;let{tr:o}=t,s=n[n.length-1],l=n[0],u=r.to;if(s){let n=l.search(/\S/),i=r.from+l.indexOf(s),c=i+s.length;if(Cm(r.from,r.to,t.doc).filter(t=>t.mark.type.excluded.find(r=>r===e.type&&r!==t.mark.type)).filter(e=>e.to>i).length)return null;c<r.to&&o.delete(c,r.to),i>r.from&&o.delete(r.from+n,i),u=r.from+n+s.length,o.addMark(r.from+n,u,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}let{getOwnPropertyNames:$S,getOwnPropertySymbols:$E}=Object,{hasOwnProperty:$C}=Object.prototype;function $$(e,t){return function(r,n,i){return e(r,n,i)&&t(r,n,i)}}function $T(e){return function(t,r,n){if(!t||!r||"object"!=typeof t||"object"!=typeof r)return e(t,r,n);let{cache:i}=n,a=i.get(t),o=i.get(r);if(a&&o)return a===r&&o===t;i.set(t,r),i.set(r,t);let s=e(t,r,n);return i.delete(t),i.delete(r),s}}function $I(e){return $S(e).concat($E(e))}let $N=Object.hasOwn||((e,t)=>$C.call(e,t));function $A(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:$j,keys:$M}=Object;function $O(e,t){return e.byteLength===t.byteLength&&$H(new Uint8Array(e),new Uint8Array(t))}function $D(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function $R(e,t){return e.byteLength===t.byteLength&&$H(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function $P(e,t){return $A(e.getTime(),t.getTime())}function $z(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function $L(e,t){return e===t}function $F(e,t,r){let n,i,a=e.size;if(a!==t.size)return!1;if(!a)return!0;let o=Array(a),s=e.entries(),l=0;for(;(n=s.next())&&!n.done;){let a=t.entries(),s=!1,u=0;for(;(i=a.next())&&!i.done;){if(o[u]){u++;continue}let a=n.value,c=i.value;if(r.equals(a[0],c[0],l,u,e,t,r)&&r.equals(a[1],c[1],a[0],c[0],e,t,r)){s=o[u]=!0;break}u++}if(!s)return!1;l++}return!0}function $U(e,t,r){let n=$M(e),i=n.length;if($M(t).length!==i)return!1;for(;i-- >0;)if(!$W(e,t,r,n[i]))return!1;return!0}function $B(e,t,r){let n,i,a,o=$I(e),s=o.length;if($I(t).length!==s)return!1;for(;s-- >0;)if(!$W(e,t,r,n=o[s])||(i=$j(e,n),a=$j(t,n),(i||a)&&(!i||!a||i.configurable!==a.configurable||i.enumerable!==a.enumerable||i.writable!==a.writable)))return!1;return!0}function $Z(e,t){return $A(e.valueOf(),t.valueOf())}function $q(e,t){return e.source===t.source&&e.flags===t.flags}function $V(e,t,r){let n,i,a=e.size;if(a!==t.size)return!1;if(!a)return!0;let o=Array(a),s=e.values();for(;(n=s.next())&&!n.done;){let a=t.values(),s=!1,l=0;for(;(i=a.next())&&!i.done;){if(!o[l]&&r.equals(n.value,i.value,n.value,i.value,e,t,r)){s=o[l]=!0;break}l++}if(!s)return!1}return!0}function $H(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function $K(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function $W(e,t,r,n){return("_owner"===n||"__o"===n||"__v"===n)&&(!!e.$$typeof||!!t.$$typeof)||$N(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}let $J={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
174]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$G=Object.prototype.toString,$X=$Y();function $Y(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:i=!1}=e,a=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let v=typeof m;if(v!==typeof g)return!1;if("object"!==v)return"number"===v?s(m,g,y):"function"===v&&a(m,g,y);let b=m.constructor;if(b!==g.constructor)return!1;if(b===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(b===Date)return n(m,g,y);if(b===RegExp)return c(m,g,y);if(b===Map)return o(m,g,y);if(b===Set)return d(m,g,y);let x=$G.call(m);if("[object Date]"===x)return n(m,g,y);if("[object RegExp]"===x)return c(m,g,y);if("[object Map]"===x)return o(m,g,y);if("[object Set]"===x)return d(m,g,y);if("[object Object]"===x)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===x)return h(m,g,y);if("[object Error]"===x)return i(m,g,y);if("[object Arguments]"===x)return l(m,g,y);if($J[x])return p(m,g,y);if("[object ArrayBuffer]"===x)return e(m,g,y);if("[object DataView]"===x)return r(m,g,y);if("[object Boolean]"===x||"[object Number]"===x||"[object String]"===x)return u(m,g,y);if(f){let e=f[x];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:$O,areArraysEqual:r?$B:$D,areDataViewsEqual:$R,areDatesEqual:$P,areErrorsEqual:$z,areFunctionsEqual:$L,areMapsEqual:r?$$($F,$B):$F,areNumbersEqual:$A,areObjectsEqual:r?$B:$U,arePrimitiveWrappersEqual:$Z,areRegExpsEqual:$q,areSetsEqual:r?$$($V,$B):$V,areTypedArraysEqual:r?$$($H,$B):$H,areUrlsEqual:$K,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let e=$T(n.areArraysEqual),t=$T(n.areMapsEqual),r=$T(n.areObjectsEqual),i=$T(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:r,areSetsEqual:i})}return n}(e)),o=r?r(a):function(e,t,r,n,i,o,s){return a(e,t,s)};return function({circular:e,comparator:t,createState:r,equals:n,strict:i}){if(r)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:l}=r();return t(a,o,{cache:s,equals:n,meta:l,strict:i})};if(e)return function(e,r){return t(e,r,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};let a={cache:void 0,equals:n,meta:void 0,strict:i};return function(e,r){return t(e,r,a)}}({circular:t,comparator:a,createState:n,equals:o,strict:i})}$Y({strict:!0}),$Y({circular:!0}),$Y({circular:!0,strict:!0}),$Y({createInternalComparator:()=>$A}),$Y({strict:!0,createInternalComparator:()=>$A}),$Y({circular:!0,createInternalComparator:()=>$A}),$Y({circular:!0,createInternalComparator:()=>$A,strict:!0});var $Q=e.i(430224),$0=({contentComponent:e})=>{let t=(0,gP.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,ew.jsx)(ew.Fragment,{children:Object.values(t)})},$1=class extends xn.default.Component{constructor(e){var t;super(e),this.editorContentRef=xn.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,r;if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),e=new Set,r={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>r,getServerSnapshot:()=>r,setRenderer(t,n){r={...r,[t]:yj.default.createPortal(n.reactElement,n.element,t)},e.forEach(e=>e())},removeRenderer(t){let n={...r};delete n[t],r=n,e.forEach(e=>e())}},this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;let t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let r=document.createElement("div");r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r})}catch{}}}render(){let{editor:e,innerRef:t,...r}=this.props;return(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("div",{ref:((...e)=>t=>
174{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...r}),(null==e?void 0:e.contentComponent)&&(0,ew.jsx)($0,{contentComponent:e.contentComponent})]})}},$2=(0,xn.forwardRef)((e,t)=>{let r=xn.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return xn.default.createElement($1,{key:r,innerRef:t,...e})}),$4=xn.default.memo($2),$5="u">typeof window?xn.useLayoutEffect:xn.useEffect,$6=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}},$3="u"<typeof window,$9=$3||!!("u">typeof window&&window.next),$8=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?$3||$9?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender)?this.createEditor():null}createEditor(){return new $u({...this.options.current,onBeforeCreate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onBeforeCreate)?void 0:r.call(t,...e)},onBlur:(...e)=>{var t,r;return null==(r=(t=this.options.current).onBlur)?void 0:r.call(t,...e)},onCreate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onCreate)?void 0:r.call(t,...e)},onDestroy:(...e)=>{var t,r;return null==(r=(t=this.options.current).onDestroy)?void 0:r.call(t,...e)},onFocus:(...e)=>{var t,r;return null==(r=(t=this.options.current).onFocus)?void 0:r.call(t,...e)},onSelectionUpdate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onSelectionUpdate)?void 0:r.call(t,...e)},onTransaction:(...e)=>{var t,r;return null==(r=(t=this.options.current).onTransaction)?void 0:r.call(t,...e)},onUpdate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onUpdate)?void 0:r.call(t,...e)},onContentError:(...e)=>{var t,r;return null==(r=(t=this.options.current).onContentError)?void 0:r.call(t,...e)},onDrop:(...e)=>{var t,r;return null==(r=(t=this.options.current).onDrop)?void 0:r.call(t,...e)},onPaste:(...e)=>{var t,r;return null==(r=(t=this.options.current).onPaste)?void 0:r.call(t,...e)},onDelete:(...e)=>{var t,r;return null==(r=(t=this.options.current).onDelete)?void 0:r.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)||("extensions"===r&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,r)=>{var n;return e===(null==(n=t.extensions)?void 0:n[r])}):e[r]===t[r]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
174if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,r)=>t===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}},$7=(0,xn.createContext)({editor:null});$7.Consumer;var Te=(0,xn.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});xn.default.forwardRef((e,t)=>{let{onDragStart:r}=(0,xn.useContext)(Te),n=e.as||"div";return(0,ew.jsx)(n,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})}),xn.default.createContext({markViewContentRef:()=>{}});var Tt=(0,xn.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function Tr({editor:e,instance:t,children:r}){let n=null!=e?e:t;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,xn.useMemo)(()=>({editor:n}),[n]),a=(0,xn.useMemo)(()=>({editor:n}),[n]);return(0,ew.jsx)($7.Provider,{value:a,children:(0,ew.jsx)(Tt.Provider,{value:i,children:r})})}function Tn({...e}){let{editor:t}=(0,xn.useContext)(Tt);return(0,ew.jsx)($4,{editor:t,...e})}Tt.displayName="TiptapContext",Tr.displayName="Tiptap",Tn.displayName="Tiptap.Content",Object.assign(Tr,{Content:Tn});var Ti=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:r,...n}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,n,r]},Ta=/^\s*>\s$/,To=$w.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return Ti("blockquote",{...Cn(this.options.HTMLAttributes,e),children:Ti("slot",{})})},parseMarkdown:(e,t)=>{var r;let n=null!=(r=t.parseBlockChildren)?r:t.parseChildren;return t.createNode("blockquote",void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let r=[];return e.content.forEach((e,n)=>{var i,a;let o=(null!=(a=null==(i=t.renderChild)?void 0:i.call(t,e,n))?a:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);r.push(o.join("\n"))}),r.join(` 175> 176`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}}
176,addInputRules(){return[$p({find:Ta,type:this.type})]}}),Ts=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Tl=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Tu=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Tc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Td=C0.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Ti("strong",{...Cn(this.options.HTMLAttributes,e),children:Ti("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
176,addInputRules(){return[$c({find:Ts,type:this.type}),$c({find:Tu,type:this.type})]},addPasteRules(){return[$_({find:Tl,type:this.type}),$_({find:Tc,type:this.type})]}}),Tp=/(^|[^`])`([^`]+)`(?!`)$/,Th=/(^|[^`])`([^`]+)`(?!`)/g,Tf=C0.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Cn(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[$c({find:Tp,type:this.type})]},addPasteRules(){return[$_({find:Th,type:this.type})]}}),Tm=/^```([a-z]+)?[\s\n]$/,Tg=/^~~~([a-z]+)?[\s\n]$/,Ty=$w.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:r}=this.options;if(!r)return null;let n=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(r)).map(e=>e.replace(r,""))[0];return n||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",Cn(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var r,n;return(null==(r=e.raw)?void 0:r.startsWith("```"))===!1&&(null==(n=e.raw)?void 0:n.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var r;let n=(null==(r=e.attrs)?void 0:r.language)||"";return e.content?[`\`\`\`${n}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${n} 177 178\`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,r=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!r||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let r=null!=(t=this.options.tabSize)?t:4,{state:n}=e,{selection:i}=n,{$from:a,empty:o}=i;if(a.parent.type!==this.type)return!1;let s=" ".repeat(r);return o?e.commands.insertContent(s):e.commands.command(({tr:e})=>{let{from:t,to:r}=i,a=n.doc.textBetween(t,r,"\n","\n").split("\n").map(e=>s+e).join("\n");return e.replaceWith(t,r,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let r=null!=(t=this.options.tabSize)?t:4,{state:n}=e,{selection:i}=n,{$from:a,empty:o}=i;return a.parent.type===this.type&&(o?e.commands.command(({tr:e})=>{var t;let{pos:i}=a,o=a.start(),s=a.end(),l=n.doc.textBetween(o,s,"\n","\n").split("\n"),u=0,c=0,d=i-o;for(let e=0;e<l.length;e+=1){if(c+l[e].length>=d){u=e;break}c+=l[e].length+1}let p=Math.min(((null==(t=l[u].match(/^ */))?void 0:t[0])||"").length,r);if(0===p)return!0;let h=o;for(let e=0;e<u;e+=1)h+=l[e].length+1;return e.delete(h,h+p),i-h<=p&&e.setSelection(kM.create(e.doc,h)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:a}=i,o=n.doc.textBetween(t,a,"\n","\n").split("\n").map(e=>{var t;let n=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,r);return e.slice(n)}).join("\n");return e.replaceWith(t,a,n.schema.text(o)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:r}=t,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;let a=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return!!a&&!!o&&e.chain().command(({tr:e})=>(e.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>
178{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:r,doc:n}=t,{$from:i,empty:a}=r;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return void 0!==o&&(n.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(kI.near(n.resolve(o))),!0)):e.commands.exitCode())}}},addInputRules(){return[$d({find:Tm,type:this.type,getAttributes:e=>({language:e[1]})}),$d({find:Tg,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new kK({key:new kG("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let r=t.clipboardData.getData("text/plain"),n=t.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,a=null==i?void 0:i.mode;if(!r||!a)return!1;let{tr:o,schema:s}=e.state,l=s.text(r.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:a},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(kM.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),Tv=$w.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),Tb=$w.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Cn(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>` 179`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:r,editor:n})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=r;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=n.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Tx=$w.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){let r=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${r}`,Cn(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var r;let n=(null==(r=e.attrs)?void 0:r.level)?parseInt(e.attrs.level,10):1,i="#".repeat(n);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,...{[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}}),{})},addInputRules(){return this.options.levels.map(e=>$d({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
179)\\s$`),type:this.type,getAttributes:{level:e}}))}}),Tk=$w.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Cn(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){let{selection:r}=e,{$from:n}=r;if(r instanceof kD){let e=n.index();return n.parent.canReplaceWith(e,e+1,t)}let i=n.depth;for(;i>=0;){let e=n.index(i);if(n.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}(t,t.schema.nodes[this.name]))return!1;let{selection:r}=t,{$to:n}=r,i=e();return Cw(r)?i.insertContentAt(n.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:r})=>{if(r){let{$to:r}=t.selection,n=r.end();if(r.nodeAfter)r.nodeAfter.isTextblock?t.setSelection(kM.create(t.doc,r.pos+1)):r.nodeAfter.isBlock?t.setSelection(kD.create(t.doc,r.pos)):t.setSelection(kM.create(t.doc,r.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||r.parent.type.contentMatch.defaultType,a=null==i?void 0:i.create();a&&(t.insert(n,a),t.setSelection(kM.create(t.doc,n+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){var e;return[new CG({find:(e={find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.t
179ype}).find,handler:({state:t,range:r,match:n})=>{let i=E7(e.getAttributes,void 0,n)||{},{tr:a}=t,o=r.from,s=r.to,l=e.type.create(i);if(n[1]){let e=o+n[0].lastIndexOf(n[1]);e>s?e=s:s=e+n[1].length;let t=n[0][n[0].length-1];a.insertText(t,o+n[0].length-1),a.replaceWith(e,s,l)}else if(n[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})]}}),Tw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,T_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,TS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,TE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,TC=C0.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Cn(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}}
179,addInputRules(){return[$c({find:Tw,type:this.type}),$c({find:TS,type:this.type})]},addPasteRules(){return[$_({find:T_,type:this.type}),$_({find:TE,type:this.type})]}});let T$="numeric",TT="ascii",TI="alpha",TN="asciinumeric",TA="alphanumeric",Tj="domain",TM="emoji",TO="whitespace";function TD(e,t,r){for(let n in t[T$]&&(t[TN]=!0,t[TA]=!0),t[TT]&&(t[TN]=!0,t[TI]=!0),t[TN]&&(t[TA]=!0),t[TI]&&(t[TA]=!0),t[TA]&&(t[Tj]=!0),t[TM]&&(t[Tj]=!0),t){let t=(n in r||(r[n]=[]),r[n]);0>t.indexOf(e)&&t.push(e)}}function TR(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}TR.groups={},TR.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let r=this.jr[t][0],n=this.jr[t][1];if(n&&r.test(e))return n}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,r,n){for(let i=0;i<e.length;i++)this.tt(e[i],t,r,n)},tr(e,t,r,n){let i;return n=n||TR.groups,t&&t.j?i=t:(i=new TR(t),r&&n&&TD(t,r,n)),this.jr.push([e,i]),i},ts(e,t,r,n){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,r,n)},tt(e,t,r,n){if(n=n||TR.groups,t&&t.j)return this.j[e]=t,t;let i,a=this.go(e);return a?(Object.assign((i=new TR).j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new TR,t&&(n&&(i.t&&"string"==typeof i.t?TD(t,Object.assign(function(e,t){let r={};for(let n in t)t[n].indexOf(e)>=0&&(r[n]=!0);return r}(i.t,n),r),n):r&&TD(t,r,n)),i.t=t),this.j[e]=i,i}};let TP=(e,t,r,n,i)=>e.ta(t,r,n,i),Tz=(e,t,r,n,i)=>e.tr(t,r,n,i),TL=(e,t,r,n,i)=>e.ts(t,r,n,i),TF=(e,t,r,n,i)=>e.tt(t,r,n,i),TU="WORD",TB="UWORD",TZ="ASCIINUMERICAL",Tq="ALPHANUMERICAL",TV="LOCALHOST",TH="UTLD",TK="SCHEME",TW="SLASH_SCHEME",TJ="OPENBRACE",TG="CLOSEBRACE",TX="OPENBRACKET",TY="CLOSEBRACKET",TQ="OPENPAREN",T0="CLOSEPAREN",T1="OPENANGLEBRACKET",T2="CLOSEANGLEBRACKET",T4="FULLWIDTHLEFTPAREN",T5="FULLWIDTHRIGHTPAREN",T6="LEFTCORNERBRACKET",T3="RIGHTCORNERBRACKET",T9="LEFTWHITECORNERBRACKET",T8="RIGHTWHITECORNERBRACKET",T7="FULLWIDTHLESSTHAN",Ie="FULLWIDTHGREATERTHAN",It="AMPERSAND",Ir="APOSTROPHE",In="ASTERISK",Ii="BACKSLASH",Ia="BACKTICK",Io="CARET",Is="COLON",Il="COMMA",Iu="DOLLAR",Ic="EQUALS",Id="EXCLAMATION",Ip="HYPHEN",Ih="PERCENT",If="PIPE",Im="PLUS",Ig="POUND",Iy="QUERY",Iv="QUOTE",Ib="FULLWIDTHMIDDLEDOT",Ix="SEMI",Ik="SLASH",Iw="TILDE",I_="UNDERSCORE",IS="EMOJI";var IE=Object.freeze({__proto__:null,ALPHANUMERICAL:Tq,AMPERSAND:It,APOSTROPHE:Ir,ASCIINUMERICAL:TZ,ASTERISK:In,AT:"AT",BACKSLASH:Ii,BACKTICK:Ia,CARET:Io,CLOSEANGLEBRACKET:T2,CLOSEBRACE:TG,CLOSEBRACKET:TY,CLOSEPAREN:T0,COLON:Is,COMMA:Il,DOLLAR:Iu,DOT:"DOT",EMOJI:IS,EQUALS:Ic,EXCLAMATION:Id,FULLWIDTHGREATERTHAN:Ie,FULLWIDTHLEFTPAREN:T4,FULLWIDTHLESSTHAN:T7,FULLWIDTHMIDDLEDOT:Ib,FULLWIDTHRIGHTPAREN:T5,HYPHEN:Ip,LEFTCORNERBRACKET:T6,LEFTWHITECORNERBRACKET:T9,LOCALHOST:TV,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:T1,OPENBRACE:TJ,OPENBRACKET:TX,OPENPAREN:TQ,PERCENT:Ih,PIPE:If,PLUS:Im,POUND:Ig,QUERY:Iy,QUOTE:Iv,RIGHTCORNERBRACKET:T3,RIGHTWHITECORNERBRACKET:T8,SCHEME:TK,SEMI:Ix,SLASH:Ik,SLASH_SCHEME:TW,SYM:"SYM",TILDE:Iw,TLD:"TLD",UNDERSCORE:I_,UTLD:TH,UWORD:TB,WORD:TU,WS:"WS"});let IC=/[a-z]/,I$=/\p{L}/u,IT=/\p{Emoji}/u,II=/\d/,IN=/\s/,IA=null,Ij=null;function IM(e,t){let r=function(e){let t=[],r=e.length,n=0;for(;n<r;){let i,a=e.charCodeAt(n),o=a<55296||a>56319||n+1===r||(i=e.charCodeAt(n+1))<56320||i>57343?e[n]:e.slice(n,n+2);t.push(o),n+=o.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),n=r.length,i=[],a=0,o=0;for(;o<n;){let s=e,l=null,u=0,c=null,d=-1,p=-1;for(;o<n&&(l=s.go(r[o]));)(s=l).accepts()?(d=0,p=0,c=s):d>=0&&(d+=r[o].length,p++),u+=r[o].length,a+=r[o].length,o++;a-=d,o-=p,u-=d,i.push({t:c.t,v:t.slice(a-u,a),s:a-u,e:a})}return i}function IO(e,t,r,n,i){let a,o=t.length;for(let r=0;r<o-1;r++){let o=t[r];e.j[o]?a=e.j[o]:((a=new TR(n)).jr=i.slice(),e.j[o]=a),e=a}return(a=new TR(r)).jr=i.slice(),e.j[t[o-1]]=a,a}function ID(e){let t=[],r=[],n=0;for(;n<e.length;){let i=0;for(;"0123456789".indexOf(e[n+i])>=0;)i++;if(i>0){t.push(r.join(""));for(let t=parseInt(e.substring(n,n+i),10);t>0;t--)r.pop();n+=i}else r.push(e[n]),n++}return t}let IR={defaultProtocol:"http",events:null,format:Iz,formatHref:Iz,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function IP(e,t=null){let r=Object.assign({},IR);e&&(r=Object.assign(r,e instanceof IP?e.o:e));let n=r.ignoreTags,i=[];for(let e=0;e<n.length;e++)i.push(n[e].toUpperCase());this.o=r,t&&(this.defaultRender=t),this.ignoreTags=i}function Iz(e){return e}function IL(e,t){this.t="token",this.v=e,this.tk=t}function IF(e,t){class r extends IL{constructor(t,r){super(t,r),this.t=e}}
179for(let e in t)r.prototype[e]=t[e];return r.t=e,r}IP.prototype={o:IR,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,r){let n=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=r.t in i?i[r.t]:IR[e])&&n&&(i=i(t,r)):"function"==typeof i&&n&&(i=i(t,r.t,r))),i},getObj(e,t,r){let n=this.o[e];return"function"==typeof n&&null!=t&&(n=n(t,r.t,r)),n},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},IL.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),r=e.get("truncate",t,this),n=e.get("format",t,this);return r&&n.length>r?n.substring(0,r)+"â¦":n},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=IR.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",t,this),n=e.get("tagName",t,this),i=this.toFormattedString(e),a={},o=e.get("className",t,this),s=e.get("target",t,this),l=e.get("rel",t,this),u=e.getObj("attributes",t,this),c=e.getObj("events",t,this);return a.href=r,o&&(a.class=o),s&&(a.target=s),l&&(a.rel=l),u&&Object.assign(a,u),{tagName:n,attributes:a,content:i,eventListeners:c}}};let IU=IF("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),IB=IF("text"),IZ=IF("nl"),Iq=IF("url",{isLink:!0,toHref(e=IR.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==TV&&e[1].t===Is}}),IV=e=>new TR(e);function IH(e,t,r){let n=r[0].s,i=r[r.length-1].e;return new e(t.slice(n,i),r)}let IK="u">typeof console&&console&&console.warn||(()=>{}),IW={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function IJ(e,t=!1){if(IW.initialized&&IK(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format. 1801. Must only contain digits, lowercase ASCII letters or "-" 1812. Cannot start or end with "-" 1823. "-" cannot repeat`);IW.customSchemes.push([e,t])}function IG(e){return IW.initialized||function(){IW.scanner=function(e=[]){let t={};TR.groups=t;let r=new TR;null==IA&&(IA=ID("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
182ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Ij&&(Ij=ID("ελ1Ï
2бг1ел3деÑи4еÑ2каÑолик6ом3мÐ
182ºÐ´2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5راÙ
ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5Ù
غرب5Ù
ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2Ù
اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ
3Ù
صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4ÙÙ
راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å
«å¦2å
¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é
åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ
å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å
2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2")),TF(r,"'",Ir),TF(r,"{",TJ),TF(r,"}",TG),TF(r,"[",TX),TF(r,"]",TY),TF(r,"(",TQ),TF(r,")",T0),TF(r,"<",T1),TF(r,">",T2),TF(r,"ï¼",T4),TF(r,"ï¼",T5),TF(r,"ã",T6),TF(r,"ã",T3),TF(r,"ã",T9),TF(r,"ã",T8),TF(r,"ï¼",T7),TF(r,"ï¼",Ie),TF(r,"&",It),TF(r,"*",In),TF(r,"@","AT"),TF(r,"`",Ia),TF(r,"^",Io),TF(r,":",Is),TF(r,",",Il),TF(r,"$",Iu),TF(r,".","DOT"),TF(r,"=",Ic),TF(r,"!",Id),TF(r,"-",Ip),TF(r,"%",Ih),TF(r,"|",If),TF(r,"+",Im),TF(r,"#",Ig),TF(r,"?",Iy),TF(r,'"',Iv),TF(r,"/",Ik),TF(r,";",Ix),TF(r,"~",Iw),TF(r,"_",I_),TF(r,"\\",Ii),TF(r,"ã»",Ib);let n=Tz(r,II,"NUM",{[T$]:!0});Tz(n,II,n);let i=Tz(n,IC,TZ,{[TN]:!0}),a=Tz(n,I$,Tq,{[TA]:!0}),o=Tz(r,IC,TU,{[TT]:!0});Tz(o,II,i),Tz(o,IC,o),Tz(i,II,i),Tz(i,IC,i);let s=Tz(r,I$,TB,{[TI]:!0});Tz(s,IC),Tz(s,II,a),Tz(s,I$,s),Tz(a,II,a),Tz(a,IC),Tz(a,I$,a);let l=TF(r,"\n","NL",{[TO]:!0}),u=TF(r,"\r","WS",{[TO]:!0}),c=Tz(r,IN,"WS",{[TO]:!0});TF(r,"",c),TF(u,"\n",l),TF(u,"",c),Tz(u,IN,c),TF(c,"\r"),TF(c,"\n"),Tz(c,IN,c),TF(c,"",c);let d=Tz(r,IT,IS,{[TM]:!0});TF(d,"#"),Tz(d,IT,d),TF(d,"ï¸",d);let p=TF(d,"â");TF(p,"#"),Tz(p,IT,d);let h=[[IC,o],[II,i]],f=[[IC,null],[I$,s],[II,a]];for(let e=0;e<IA.length;e++)IO(r,IA[e],"TLD",TU,h);for(let e=0;e<Ij.length;e++)IO(r,Ij[e],TH,TB,f);TD("TLD",{tld:!0,ascii:!0},t),TD(TH,{utld:!0,alpha:!0},t),IO(r,"file",TK,TU,h),IO(r,"mailto",TK,TU,h),IO(r,"http",TW,TU,h),IO(r,"https",TW,TU,h),IO(r,"ftp",TW,TU,h),IO(r,"ftps",TW,TU,h),TD(TK,{scheme:!0,ascii:!0},t),TD(TW,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let n=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};n.indexOf("-")>=0?i[Tj]=!0:IC.test(n)?II.test(n)?i[TN]=!0:i[TT]=!0:i[T$]=!0,TL(r,n,n,i)}return TL(r,"localhost",TV,{ascii:!0}),r.jd=new TR("SYM"),{start:r,tokens:Object.assign({groups:t},IE)}}(IW.customSchemes);for(let e=0;e<IW.tokenQueue.length;e++)IW.tokenQueue[e][1]({scanner:IW.scanner});IW.parser=function({groups:e}){let t=e.domain.concat([It,In,"AT",Ii,Ia,Io,Iu,Ic,Ip,"NUM",Ih,If,Im,Ig,Ik,"SYM",Iw,I_]),r=[Ir,Is,Il,"DOT",Id,Ih,Iy,Iv,Ix,T1,T2,TJ,TG,TY,TX,TQ,T0,T4,T5,T6,T3,T9,T8,T7,Ie],n=[It,Ir,In,Ii,Ia,Io,Iu,Ic,Ip,TJ,TG,Ih,If,Im,Ig,Iy,Ik,"SYM",Iw,I_],i=IV(),a=TF(i,Iw);TP(a,n,a),TP(a,e.domain,a);let o=IV(),s=IV(),l=IV();TP(i,e.domain,o),TP(i,e.scheme,s),TP(i,e.slashscheme,l),TP(o,n,a),TP(o,e.domain,o);let u=TF(o,"AT");TF(a,"AT",u),TF(s,"AT",u),TF(l,"AT",u);let c=TF(a,"DOT");TP(c,n,a),TP(c,e.domain,a);let d=IV();TP(u,e.domain,d),TP(d,e.domain,d);let p=TF(d,"DOT");TP(p,e.domain,d);let h=IV(IU);TP(p,e.tld,h),TP(p,e.utld,h),TF(u,TV,h);let f=TF(d,Ip);TF(f,Ip,f),TP(f,e.domain,d),TP(h,e.domain,d),TF(h,"DOT",p),TF(h,Ip,f),TP(TF(h,Is),e.numeric,IU);let m=TF(o,Ip),g=TF(o,"DOT");TF(m,Ip,m),TP(m,e.domain,o),TP(g,n,a),TP(g,e.domain,o);let y=IV(Iq);TP(g,e.tld,y),TP(g,e.utld,y),TP(y,e.domain,o),TP(y,n,a),TF(y,"DOT",g),TF(y,Ip,m),TF(y,"AT",u);let v=TF(y,Is),b=IV(Iq);TP(v,e.numeric,b);let x=IV(Iq),k=IV();TP(x,t,x),TP(x,r,k),TP(k,t,x),TP(k,r,k),TF(y,Ik,x),TF(b,Ik,x);let w=TF(s,Is),_=TF(l,Is),S=TF(_,Ik),E=TF(S,Ik);TP(s,e.domain,o),TF(s,"DOT",g),TF(s,Ip,m),TP(l,e.domain,o),TF(l,"DOT",g),TF(l,Ip,m),TP(w,e.domain,x),TF(w,Ik,x),TF(w,Iy,x),TP(E,e.domain,x),TP(E,t,x),TF(E,Ik,x);let C=[[TJ,TG],[TX,TY],[TQ,T0],[T1,T2],[T4,T5],[T6,T3],[T9,T8],[T7,Ie]];for(let e=0;e<C.length;e++){let[n,i]=C[e],a=TF(x,n);TF(k,n,a),TF(a,i,x);let o=IV(Iq);TP(a,t,o);let s=IV();TP(a,r),TP(o,t,o),TP(o,r,s),TP(s,t,o),TP(s,r,s),TF(o,i,x),TF(s,i,x)}return TF(i,TV,y),TF(i,"NL",IZ),{start:i,tokens:IE}}(IW.scanner.tokens);for(let e=0;e<IW.pluginQueue.length;e++)IW.pluginQueue[e][1]({scanner:IW.scanner,parser:IW.parser});IW.initialized=!0}(),function(e,t,r){let n=r.length,i=0,a=[],o=[];for(;i<n;){let s=e,l=null,u=null,c=0,d=null,p=-1;for(;i<n&&!(l=s.go(r[i].t));)o.push(r[i++]);for(;i<n&&(u=l||s.go(r[i].t));)l=null,(s=u).accepts()?(p=0,d=s):p>=0&&p++,i++,c++;if(p<0)(i-=c)<n&&(o.push(r[i]),i++);else{o.length>0&&(a.push(IH(IB,t,o)),o=[]),i-=p,c-=p;let e=d.t,n=r.slice(i-c,i);
182a.push(IH(e,t,n))}}return o.length>0&&a.push(IH(IB,t,o)),a}(IW.parser.start,e,IM(IW.scanner.start,e))}function IX(e,t=null,r=null){if(t&&"object"==typeof t){if(r)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);r=t,t=null}let n=new IP(r),i=IG(e),a=[];for(let e=0;e<i.length;e++){let r=i[e];r.isLink&&(!t||r.t===t)&&n.check(r)&&a.push(r.toFormattedObject(n))}return a}IG.scan=IM;var IY="[\0- Â áá â-\u2029âã]",IQ=new RegExp(IY),I0=RegExp(`${IY}$`),I1=RegExp(IY,"g");function I2(e,t){let r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&r.push(t)}),!e||e.replace(I1,"").match(RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var I4=C0.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?IJ(e):IJ(e.scheme,e.optionalSlashes)})},onDestroy(){TR.groups={},IW.scanner=null,IW.parser=null,IW.tokenQueue=[],IW.pluginQueue=[],IW.customSchemes=[],IW.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!I2(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),r=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||r&&!e.includes("@"))return!0;let n=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(n)&&!!/\./.test(n)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!I2(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!I2(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Cn(this.options.HTMLAttributes,e),0]:["a",Cn(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var r,n,i,a;let o=null!=(n=null==(r=e.attrs)?void 0:r.href)?n:"",s=null!=(a=null==(i=e.attrs)?void 0:i.title)?a:"",l=t.renderChildren(e);return s?`[${l}](${o} "${s}")`:`[${l}](${o})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:r}=e;return!!this.options.isAllowedUri(r,{defaultValidate:e=>!!I2(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:r}=e||{};return(!r||!!this.options.isAllowedUri(r,{defaultValidate:e=>!!I2(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[$_({find:e=>{let t=[];if(e){let{protocols:r,defaultProtocol:n}=this.options,i=IX(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!I2(e,r),protocols:r,defaultProtocol:n}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t}
182,type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,r;let n=[],{protocols:i,defaultProtocol:a}=this.options;return this.options.autolink&&n.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!I2(e,i),protocols:i,defaultProtocol:a}),shouldAutoLink:this.options.shouldAutoLink},new kK({key:new kG("autolink"),appendTransaction:(t,r,n)=>{let i=t.some(e=>e.docChanged)&&!r.doc.eq(n.doc),a=t.some(e=>e.getMeta("preventAutolink"));if(!i||a)return;let{tr:o}=n;if(Cf(E4(r.doc,[...t])).forEach(({newRange:t})=>{var r,i;let a,s,l,u=(r=n.doc,i=e=>e.isTextblock,l=[],r.nodesBetween(t.from,t.to,(e,t)=>{i(e)&&l.push({node:e,pos:t})}),l);if(u.length>1)a=u[0],s=n.doc.textBetween(a.pos,a.pos+a.node.nodeSize,void 0," ");else if(u.length){let e=n.doc.textBetween(t.from,t.to," "," ");if(!I0.test(e))return;a=u[0],s=n.doc.textBetween(a.pos,t.to,void 0," ")}if(a&&s){let t=s.split(IQ).filter(Boolean);if(t.length<=0)return!1;let r=t[t.length-1],i=a.pos+s.lastIndexOf(r);if(!r)return!1;let l=IG(r).map(t=>t.toObject(e.defaultProtocol));if(!(1===l.length?l[0].isLink:3===l.length&&!!l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:i+e.start+1,to:i+e.end+1})).filter(e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Cm(t.from,t.to,n.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}}))),n.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new kK({key:new kG("handleClickLink"),props:{handleClick:(e,r,n)=>{var i,a;if(0!==n.button||!e.editable)return!1;let o=null;if(n.target instanceof HTMLAnchorElement)o=n.target;else{let e=n.target;if(!e)return!1;let r=t.editor.view.dom;(o=e.closest("a"))&&!r.contains(o)&&(o=null)}if(!o)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let r=Ch(e.state,t.type.name),n=null!=(i=o.href)?i:r.href,l=null!=(a=o.target)?a:r.target;n&&(window.open(n,l),s=!0)}return s}}}))),this.options.linkOnPaste&&n.push((r={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new kK({key:new kG("handlePasteLink"),props:{handlePaste:(e,t,n)=>{let{shouldAutoLink:i}=r,{state:a}=e,{selection:o}=a,{empty:s}=o;if(s)return!1;let l="";n.content.forEach(e=>{l+=e.textContent});let u=IX(l,{defaultProtocol:r.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!!l&&!!u&&(void 0===i||!!i(u.value))&&r.editor.commands.setMark(r.type,{href:u.href})}}}))),n}}),I5=Object.defineProperty,I6="textStyle",I3=/^\s*([-+*])\s$/,I9=$w.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",Cn(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(I6)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=$p({find:I3,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=$p({find:I3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(I6),editor:this.editor})),[e]}}),I8=$w.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",Cn(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var r;if("list_item"!==e.type)return[];let n=null!=(r=t.parseBlockChildren)?r:t.parseChildren,i=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))i=n(e.tokens);else{let r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(i=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));i.push(...t)}}else i=n(e.tokens)}return 0===i.length&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(e,t,r)=>$k(e,t,e=>{var t,r;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let n=(null==(r=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:r.start)||1;return`${n+e.index}. `}return"- "},r),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),I7={},Ne={findListItemPos:()=>Nr,getNextListDepth:()=>Nn,handleBackspace:()=>Ns,handleDelete:()=>Nc,hasListBefore:()=>Ni,hasListItemAfter:()=>Nd,hasListItemBefore:()=>Na,listItemHasSubList:()=>No,nextListIsDeeper:()=>Nl,nextListIsHigher:()=>Nu};for(var Nt in Ne)I5(I7,Nt,{get:Ne[Nt],enumerable:!0});var Nr=(e,t)=>
182{let{$from:r}=t.selection,n=En(e,t.schema),i=r.depth,a=r.pos,o=null;for(;i>0&&null===o;)r.node(i).type===n?o=i:(i-=1,a-=1);return null===o?null:{$pos:t.doc.resolve(a),depth:o}},Nn=(e,t)=>{let r=Nr(e,t);if(!r)return!1;let[,n]=((e,t,r,n=20)=>{let i=e.doc.resolve(r),a=n,o=null;for(;a>0&&null===o;){let e=i.node(a);(null==e?void 0:e.type.name)===t?o=e:a-=1}return[o,a]})(t,e,r.$pos.pos+4);return n},Ni=(e,t,r)=>{let{$anchor:n}=e.selection,i=Math.max(0,n.pos-2),a=e.doc.resolve(i).node();return!!a&&!!r.includes(a.type.name)},Na=(e,t)=>{var r;let{$anchor:n}=t.selection,i=t.doc.resolve(n.pos-2);return 0!==i.index()&&(null==(r=i.nodeBefore)?void 0:r.type.name)===e},No=(e,t,r)=>{if(!r)return!1;let n=En(e,t.schema),i=!1;return r.descendants(e=>{e.type===n&&(i=!0)}),i},Ns=(e,t,r)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!EL(e.state,t)&&Ni(e.state,t,r)){let{$anchor:r}=e.state.selection,n=e.state.doc.resolve(r.before()-1),i=[];n.node().descendants((e,r)=>{e.type.name===t&&i.push({node:e,pos:r})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(n.start()+a.pos+1);return e.chain().cut({from:r.start()-1,to:r.end()+1},o.end()).joinForward().run()}if(!EL(e.state,t)||!(e=>{let{$from:t,$to:r}=e.selection;return!(t.parentOffset>0)&&t.pos===r.pos})(e.state))return!1;let n=Nr(t,e.state);if(!n)return!1;let i=e.state.doc.resolve(n.$pos.pos-2).node(n.depth),a=No(t,e.state,i);return Na(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Nl=(e,t)=>{let r=Nn(e,t),n=Nr(e,t);return!!n&&!!r&&r>n.depth},Nu=(e,t)=>{let r=Nn(e,t),n=Nr(e,t);return!!n&&!!r&&r<n.depth},Nc=(e,t)=>{if(!EL(e.state,t)||!((e,t)=>{let{$from:r,$to:n,$anchor:i}=e.selection;if(t){let r=E5(e=>e.type.name===t)(e.selection);if(!r)return!1;let n=e.doc.resolve(r.pos+1);return i.pos+1===n.end()}return!(n.parentOffset<n.parent.nodeSize-2)&&r.pos===n.pos})(e.state,t))return!1;let{selection:r}=e.state,{$from:n,$to:i}=r;return!(!r.empty&&n.sameParent(i))&&(Nl(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Nu(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Nd=(e,t)=>{var r;let{$anchor:n}=t.selection,i=t.doc.resolve(n.pos-n.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(r=i.nodeAfter)?void 0:r.type.name)===e},Np=C6.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r})=>{void 0!==e.state.schema.nodes[r]&&Nc(e,r)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r})=>{void 0!==e.state.schema.nodes[r]&&Nc(e,r)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{void 0!==e.state.schema.nodes[r]&&Ns(e,r,n)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{void 0!==e.state.schema.nodes[r]&&Ns(e,r,n)&&(t=!0)}),t}}}}),Nh=/^(\s*)(\d+)\.\s+(.*)$/,Nf=/^\s/,Nm="textStyle",Ng=/^(\d+)\.\s$/,Ny=$w.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,...r}=e;return 1===t?["ol",Cn(this.options.HTMLAttributes,r),0]:["ol",Cn(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var r;if("list"!==e.type||!e.ordered)return[];let n=e.start||1,i=e.items?(r=e.items,r.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let r=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)r.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let n=t.parseChildren([e]);r.push({type:"paragraph",content:n})}else{let n=t.parseChildren([e]);n.length>0&&r.push(...n)}}),{type:"listItem",content:r}})):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:i}:{type:"orderedList",content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/),r=null==t?void 0:t.index;return void 0!==r?r:-1}
182,tokenize:(e,t,r)=>{var n;let i=e.split("\n"),[a,o]=function(e){let t=[],r=0,n=0;for(;r<e.length;){let i=e[r],a=i.match(Nh);if(!a)break;let[,o,s,l]=a,u=o.length,c=l,d=r+1,p=[i];for(;d<e.length;){let t=e[d];if(t.match(Nh))break;if(""===t.trim())p.push(t),c+="\n",d+=1;else if(t.match(Nf))p.push(t),c+=` 183${t.slice(u+2)}`,d+=1;else break}t.push({indent:u,number:parseInt(s,10),content:c.trim(),raw:p.join("\n")}),n=d,r=d}return[t,n]}(i);if(0===a.length)return;let s=function e(t,r,n){var i;let a=[],o=0;for(;o<t.length;){let s=t[o];if(s.indent===r){let l=s.content.split("\n"),u=(null==(i=l[0])?void 0:i.trim())||"",c=[];u&&c.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});let d=l.slice(1).join("\n").trim();if(d){let e=n.blockTokens(d);c.push(...e)}let p=o+1,h=[];for(;p<t.length&&t[p].indent>r;)h.push(t[p]),p+=1;if(h.length>0){let t=Math.min(...h.map(e=>e.indent)),r=e(h,t,n);c.push({type:"list",ordered:!0,start:h[0].number,items:r,raw:h.map(e=>e.raw).join("\n")})}a.push({type:"list_item",raw:s.raw,tokens:c}),o=p}else o+=1}return a}(a,0,r);if(0!==s.length)return{type:"list",ordered:!0,start:(null==(n=a[0])?void 0:n.number)||1,items:s,raw:i.slice(0,o).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Nm)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=$p({find:Ng,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=$p({find:Ng,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Nm)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Nv=/^\s*(\[([( |x])?\])\s$/,Nb=$w.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Cn(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let r=[];if(e.tokens&&e.tokens.length>0?r.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?r.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):r.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let n=t.parseChildren(e.nestedTokens);r.push(...n)}return t.createNode("taskItem",{checked:e.checked||!1},r)},renderMarkdown:(e,t)=>{var r;let n=(null==(r=e.attrs)?void 0:r.checked)?"x":" ";return $k(e,t,`- [${n}] `)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:r,editor:n})=>{let i=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),s=document.createElement("input"),l=document.createElement("div"),u=e=>{var t,r;s.ariaLabel=(null==(r=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:r.call(t,e,s.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};u(e),a.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",e=>e.preventDefault()),s.addEventListener("change",t=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;n.isEditable&&"function"==typeof r&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=r();if("number"!=typeof t)return!1;let n=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==n?void 0:n.attrs,checked:i}),!0}).run(),n.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked)}
183),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,l),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let c=new Set(Object.keys(t));return{dom:i,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,u(e);let t=Ci(e,n.extensionManager.attributes),r=new Set(Object.keys(t)),a=this.options.HTMLAttributes;return c.forEach(e=>{r.has(e)||(e in a?i.setAttribute(e,a[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in a?i.setAttribute(e,a[e]):i.removeAttribute(e):i.setAttribute(e,t)}),c=r,!0}}}},addInputRules(){return[$p({find:Nv,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),Nx=$w.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Cn(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let r=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,t,r){let n=e=>{let t=$x(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:r.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:n},r);return t?[{type:"taskList",raw:t.raw,items:t.items}]:r.blockTokens(e)},i=$x(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:r.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:n},r);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});C6.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(I9.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(I8.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Np.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Ny.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(Nb.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(Nx.configure(this.options.taskList)),e}});var Nk=" ",Nw=$w.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",Cn(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let r=e.tokens||[];if(1===r.length&&"image"===r[0].type)return t.parseChildren([r[0]]);let n=t.parseInline(r);return 1===n.length&&"text"===n[0].type&&(n[0].text===Nk||"Â "===n[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,n)},renderMarkdown:(e,t,r)=>{var n,i;if(!e)return"";let a=Array.isArray(e.content)?e.content:[];if(0===a.length){let e=Array.isArray(null==(n=null==r?void 0:r.previousNode)?void 0:n.content)?r.previousNode.content:[];return(null==(i=null==r?void 0:r.previousNode)?void 0:i.type)==="paragraph"&&0===e.length?Nk:""}return t.renderChildren(a)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),N_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,NS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,NE=C0.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Cn(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}}
183,addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[$c({find:N_,type:this.type})]},addPasteRules(){return[$_({find:NS,type:this.type})]}}),NC=$w.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),N$=C0.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",Cn(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,r){let n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!n)return;let i=n[2].trim();return{type:"underline",raw:n[0],text:i,tokens:r.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});class NT{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(r=t.width)?r:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let r=e=>{this[t](e)};return e.dom.addEventListener(t,r),{name:t,handler:r}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,r=this.editorView.state.doc.resolve(this.cursorPos),n=!r.parent.inlineContent,i,a=this.editorView.dom,o=a.getBoundingClientRect(),s=o.width/a.offsetWidth,l=o.height/a.offsetHeight;if(n){let e=r.nodeBefore,t=r.nodeAfter;if(e||t){let r=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(r){let n=r.getBoundingClientRect(),a=e?n.bottom:n.top;e&&t&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let o=this.width/2*l;i={left:n.left,right:n.right,top:a-o,bottom:a+o}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*s;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let u=this.editorView.dom.offsetParent;if(!this.element&&(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),u&&(u!=document.body||"static"!=getComputedStyle(u).position)){let r=u.getBoundingClientRect(),n=r.width/u.offsetWidth,i=r.height/u.offsetHeight;e=r.left-u.scrollLeft*n,t=r.top-u.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/s+"px",this.element.style.top=(i.top-t)/l+"px",this.element.style.width=(i.right-i.left)/s+"px",this.element.style.height=(i.bottom-i.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),n=r&&r.type.spec.disableDropCursor,i="function"==typeof n?n(this.editorView,t,e):n;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=km(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class NI extends kI{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return NI.valid(r)?new NI(r):kI.near(r)}content(){return xd.empty}eq(e){return e instanceof NI&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new NI(e.resolve(t.pos))}getBookmark(){return new NN(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let r=e.index(t),n=e.node(t);if(0==r){if(n.type.spec.isolating)return!0;continue}for(let e=n.child(r-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||NA(e.type))return!0;
183if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let r=e.indexAfter(t),n=e.node(t);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let e=n.child(r);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||NA(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let r=t.type.spec.allowGapCursor;if(null!=r)return r;let n=t.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,t,r=!1){n:for(;;){if(!r&&NI.valid(e))return e;let n=e.pos,i=null;for(let r=e.depth;;r--){let a=e.node(r);if(t>0?e.indexAfter(r)<a.childCount:e.index(r)>0){i=a.child(t>0?e.indexAfter(r):e.index(r)-1);break}if(0==r)return null;n+=t;let o=e.doc.resolve(n);if(NI.valid(o))return o}for(;;){let a=t>0?i.firstChild:i.lastChild;if(!a){if(i.isAtom&&!i.isText&&!kD.isSelectable(i)){e=e.doc.resolve(n+i.nodeSize*t),r=!1;continue n}break}i=a,n+=t;let o=e.doc.resolve(n);if(NI.valid(o))return o}return null}}}NI.prototype.visible=!1,NI.findFrom=NI.findGapCursorFrom,kI.jsonID("gapcursor",NI);class NN{constructor(e){this.pos=e}map(e){return new NN(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return NI.valid(t)?new NI(t):kI.near(t)}}function NA(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let Nj=S0({ArrowLeft:NM("horiz",-1),ArrowRight:NM("horiz",1),ArrowUp:NM("vert",-1),ArrowDown:NM("vert",1)});function NM(e,t){let r="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,n,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof kM){if(!i.endOfTextblock(r)||0==o.depth)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let l=NI.findGapCursorFrom(o,t,s);return!!l&&(n&&n(e.tr.setSelection(new NI(l))),!0)}}function NO(e,t,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(t);if(!NI.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return!(i&&i.inside>-1&&kD.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new NI(n))),!0)}function ND(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof NI))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=xa.empty;for(let e=n.length-1;e>=0;e--)i=xa.from(n[e].createAndFill(null,i));let a=e.state.tr.replace(r.pos,r.pos,new xd(i,0,0));return a.setSelection(kM.near(a.doc.resolve(r.pos+1))),e.dispatch(a),!1}function NR(e){if(!(e.selection instanceof NI))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Sg.create(e.doc,[Sh.widget(e.selection.head,t,{key:"gapcursor"})])}var NP=function(){};NP.prototype.append=function(e){return e.length?(e=NP.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},NP.prototype.prepend=function(e){return e.length?NP.from(e).append(this):this},NP.prototype.appendInner=function(e){return new NL(this,e)},NP.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?NP.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},NP.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},NP.prototype.forEach=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},NP.prototype.map=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=this.length);var n=[];return this.forEach(function(t,r){return n.push(e(t,r))},t,r),n},NP.from=function(e){return e instanceof NP?e:e&&e.length?new Nz(e):NP.empty};var Nz=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new t(this.values.slice(e,r))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,r,n){for(var i=t;i<r;i++)if(!1===e(this.values[i],n+i))return!1},t.prototype.forEachInvertedInner=function(e,t,r,n){for(var i=t-1;i>=r;i--)if(!1===e(this.values[i],n+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(t.prototype,r),t}(NP);NP.empty=new Nz([]);var NL=function(e){function t(t,r){e.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,r,n){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(r,i),n)||r>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,r)-i,n+i))return!1},t.prototype.forEachInvertedInner=function(e,t,r,n){var i=this.left.length;if(t>
183i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(r,i)-i,n+i)||r<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),r,n))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var r=this.left.length;return t<=r?this.left.slice(e,t):e>=r?this.right.slice(e-r,t-r):this.left.slice(e,r).append(this.right.slice(0,t-r))},t.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new t(r,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(NP);class NF{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let r,n,i,a;if(0==this.eventCount)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=(r=this.remapping(o,this.items.length)).maps.length);let s=e.tr,l=[],u=[];return this.items.forEach((e,t)=>{if(!e.step){r||(n=(r=this.remapping(o,t+1)).maps.length),n--,u.push(e);return}if(r){u.push(new NU(e.map));let t=e.step.map(r.slice(n)),i;t&&s.maybeStep(t).doc&&(i=s.mapping.maps[s.mapping.maps.length-1],l.push(new NU(i,void 0,void 0,l.length+u.length))),n--,i&&r.appendMap(i,n)}else s.maybeStep(e.step);if(e.selection)return i=r?e.selection.map(r.slice(n)):e.selection,a=new NF(this.items.slice(0,o).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:i}}addTransform(e,t,r,n){var i,a;let o,s=[],l=this.eventCount,u=this.items,c=!n&&u.length?u.get(u.length-1):null;for(let r=0;r<e.steps.length;r++){let i=e.steps[r].invert(e.docs[r]),a=new NU(e.mapping.maps[r],i,t),o;(o=c&&c.merge(a))&&(a=o,r?s.pop():u=u.slice(0,u.length-1)),s.push(a),t&&(l++,t=void 0),n||(c=a)}let d=l-r.depth;return d>NZ&&(i=u,a=d,i.forEach((e,t)=>{if(e.selection&&0==a--)return o=t,!1}),u=i.slice(o),l-=d),new NF(u.append(s),l)}remapping(e,t){let r=new x4;return this.items.forEach((t,n)=>{let i=null!=t.mirrorOffset&&n-t.mirrorOffset>=e?r.maps.length-t.mirrorOffset:void 0;r.appendMap(t.map,i)},e,t),r}addMaps(e){return 0==this.eventCount?this:new NF(this.items.append(e.map(e=>new NU(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-t),i=e.mapping,a=e.steps.length,o=this.eventCount;this.items.forEach(e=>{e.selection&&o--},n);let s=t;this.items.forEach(t=>{let n=i.getMirror(--s);if(null==n)return;a=Math.min(a,n);let l=i.maps[n];if(t.step){let a=e.steps[n].invert(e.docs[n]),u=t.selection&&t.selection.map(i.slice(s+1,n));u&&o++,r.push(new NU(l,a,u))}else r.push(new NU(l))},n);let l=[];for(let e=t;e<a;e++)l.push(new NU(i.maps[e]));let u=new NF(this.items.slice(0,n).append(l).append(r),o);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,n=[],i=0;return this.items.forEach((a,o)=>{if(o>=e)n.push(a),a.selection&&i++;else if(a.step){let e=a.step.map(t.slice(r)),o=e&&e.getMap();if(r--,o&&t.appendMap(o,r),e){let s=a.selection&&a.selection.map(t.slice(r));s&&i++;let l=new NU(o.invert(),e,s),u,c=n.length-1;(u=n.length&&n[c].merge(l))?n[c]=u:n.push(l)}}else a.map&&r--},this.items.length,0),new NF(NP.from(n.reverse()),i)}}NF.empty=new NF(NP.empty,0);class NU{constructor(e,t,r,n){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new NU(t.getMap().invert(),t,this.selection)}}}class NB{constructor(e,t,r,n,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=n,this.prevComposition=i}}let NZ=20;function Nq(e){let t=[];for(let r=e.length-1;r>=0&&0==t.length;r--)e[r].forEach((e,r,n,i)=>t.push(n,i));return t}function NV(e,t){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let i=t.map(e[n],1),a=t.map(e[n+1],-1);i<=a&&r.push(i,a)}return r}let NH=!1,NK=null;function NW(e){let t=e.plugins;if(NK!=t){NH=!1,NK=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){NH=!0;break}}return NH}let NJ=new kG("history"),NG=new kG("closeHistory");function NX(e,t){return(r,n)=>{let i=NJ.getState(r);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(n){let a=function(e,t,r){let n=NW(t),i=NJ.get(t).spec.config,a=(r?e.undone:e.done).popEvent(t,n);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(r?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,n),l=new NB(r?s:a.remaining,r?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(NJ,{redo:r,historyState:l})}(i,r,e);a&&n(t?a.scrollIntoView():a)}return!0}}let NY=NX(!1,!0),NQ=NX(!0,!0);NX(!1,!1),NX(!0,!1),C6.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,r=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(r)}},addProseMirrorPlugins(){let e=!1;return[new kK({key:new kG("characterCount"),appendTransaction:(t,r,n)=>{if(e)return;let i=this.options.limit;if(null==i||0===i){e=!0;return}let a=this.storage.characters({node:n.doc});if(a>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=n.tr.deleteRange(0,a-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let r=this.options.limit;if(!e.docChanged||0===r||null==r)return!0;let n=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||n>r&&i>r&&i<=n)return!0;
183if(n>r&&i>r&&i>n||!e.getMeta("paste"))return!1;let a=e.selection.$head.pos;return e.deleteRange(a-(i-r),a),!(this.storage.characters({node:e.doc})>r)}})]}});var N0=C6.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new kK({view:t=>new NT(t,e)})}(this.options)]}});C6.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new kK({key:new kG("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:r,isFocused:n}=this.editor,{anchor:i}=t,a=[];if(!r||!n)return Sg.create(e,[]);let o=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((s+=1,"deepest"===this.options.mode&&o-s>0||"shallowest"===this.options.mode&&s>1)?"deepest"===this.options.mode:void a.push(Sh.node(t,t+e.nodeSize,{class:this.options.className})))),Sg.create(e,a)}}})]}});var N1=C6.create({name:"gapCursor",addProseMirrorPlugins:()=>[new kK({props:{decorations:NR,createSelectionBetween:(e,t,r)=>t.pos==r.pos&&NI.valid(r)?new NI(r):null,handleClick:NO,handleKeyDown:Nj,handleDOMEvents:{beforeinput
183:ND}}})],extendNodeSchema(e){var t;let r={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=E7(E6(e,"allowGapCursor",r)))?t:null}}}),N2="placeholder",N4=C6.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:N2,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${this.options.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${N2}`;return[new kK({key:new kG("placeholder"),props:{decorations:({doc:t,selection:r})=>{let n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=r,a=[];if(!n)return null;let o=this.editor.isEmpty;return t.descendants((t,r)=>{let n=i>=r&&i<=r+t.nodeSize,s=!t.isLeaf&&Ck(t);if(!t.type.isTextblock)return this.options.includeChildren;if((n||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=Sh.node(r,r+t.nodeSize,{class:i.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:r,hasAnchor:n}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),Sg.create(t,a)}}})]}});function N5({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}C6.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new kK({key:new kG("selection"),props:{decorations:r=>r.selection.empty||e.isFocused||!e.isEditable||Cw(r.selection)||e.view.dragging?null:Sg.create(r.doc,[Sh.inline(r.selection.from,r.selection.to,{class:t.className})])}})]}});var N6=C6.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new kG(this.name),r=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(r).includes(e.name));return[new kK({key:t,appendTransaction:(e,n,i)=>{let{doc:a,tr:o,schema:s}=i,l=t.getState(i),u=a.content.size,c=s.nodes[r];if(l)return o.insert(u,c.create())},state:{init:(e,t)=>!N5({node:t.tr.doc.lastChild,types:n}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!N5({node:e.doc.lastChild,types:n})}})]}}),N3=C6.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>NY(e,t),redo:()=>({state:e,dispatch:t})=>NQ(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new kK({key:NJ,state:{init:()=>new NB(NF.empty,NF.empty,null,0,-1),apply:(t,r,n)=>(function(e,t,r,n){let i=r.getMeta(NJ),a;if(i)return i.historyState;r.getMeta(NG)&&(e=new NB(e.done,e.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(o&&o.getMeta(NJ))if(o.getMeta(NJ).redo)return new NB(e.done.addTransform(r,void 0,n,NW(t)),e.undone,Nq(r.mapping.maps),e.prevTime,e.prevComposition);else return new NB(e.done,e.undone.addTransform(r,void 0,n,NW(t)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))if(a=r.getMeta("rebased"))return new NB(e.done.rebased(r,a),e.undone.rebased(r,a),NV(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);else return new NB(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),NV(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let i=r.getMeta("composition"),a=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach((e,n)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&n>=t[i]&&(r=!0)}),r}(r,e.prevRanges)),s=o?NV(e.prevRanges,r.mapping):Nq(r.mapping.maps);return new NB(e.done.addTransform(r,a?t.selection.getBookmark():void 0,n,NW(t)),NF.empty,s,r.time,null==i?e.prevComposition:i)}})(r,n,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,n="historyUndo"==r?NY:"historyRedo"==r?NQ:null;return!!n&&!!e.editable&&(t.preventDefault(),n(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),N9=C6.create({name:"starterKit",addExtensions(){var e,t,r,n;let i=[];return!1!==this.options.bold&&i.push(Td.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(To.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(I9.configure(this.options.bulletList)),!1!==this.options.code&&i.push(Tf.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(Ty.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(Tv.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(N0.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(N1.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(Tb.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(Tx.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(N3.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(Tk.c
183onfigure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(TC.configure(this.options.italic)),!1!==this.options.listItem&&i.push(I8.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(Np.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(I4.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(Ny.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(Nw.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(NE.configure(this.options.strike)),!1!==this.options.text&&i.push(NC.configure(this.options.text)),!1!==this.options.underline&&i.push(N$.configure(null==(r=this.options)?void 0:r.underline)),!1!==this.options.trailingNode&&i.push(N6.configure(null==(n=this.options)?void 0:n.trailingNode)),i}});let N8={};function N7(e,t){"string"!=typeof t&&(t=N7.defaultChars);let r=function(e){let t=N8[e];if(t)return t;t=N8[e]=[];for(let e=0;e<128;e++){let r=String.fromCharCode(e);t.push(r)}for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t[n]="%"+("0"+n.toString(16).toUpperCase()).slice(-2)}return t}(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t="";for(let n=0,i=e.length;n<i;n+=3){let a=parseInt(e.slice(n+1,n+3),16);if(a<128){t+=r[a];continue}if((224&a)==192&&n+3<i){let r=parseInt(e.slice(n+4,n+6),16);if((192&r)==128){let e=a<<6&1984|63&r;e<128?t+="��":t+=String.fromCharCode(e),n+=3;continue}}if((240&a)==224&&n+6<i){let r=parseInt(e.slice(n+4,n+6),16),i=parseInt(e.slice(n+7,n+9),16);if((192&r)==128&&(192&i)==128){let e=a<<12&61440|r<<6&4032|63&i;e<2048||e>=55296&&e<=57343?t+="���":t+=String.fromCharCode(e),n+=6;continue}}if((248&a)==240&&n+9<i){let r=parseInt(e.slice(n+4,n+6),16),i=parseInt(e.slice(n+7,n+9),16),o=parseInt(e.slice(n+10,n+12),16);if((192&r)==128&&(192&i)==128&&(192&o)==128){let e=a<<18&1835008|r<<12&258048|i<<6&4032|63&o;e<65536||e>1114111?t+="����":(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(1023&e))),n+=9;continue}}t+="�"}return t})}N7.defaultChars=";/?:@&=+$,#",N7.componentChars="";let Ae={};function At(e,t,r){"string"!=typeof t&&(r=t,t=At.defaultChars),void 0===r&&(r=!0);let n=function(e){let t=Ae[e];if(t)return t;t=Ae[e]=[];for(let e=0;e<128;e++){let r=String.fromCharCode(e);/^[0-9a-z]$/i.test(r)?t.push(r):t.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2))}for(let r=0;r<e.length;r++)t[e.charCodeAt(r)]=e[r];return t}(t),i="";for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(r&&37===o&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=n[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(e[t])}return i}function Ar(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&-1!==e.hostname.indexOf(":")?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||""}function An(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}At.defaultChars=";/?:@&=+$,-_.!~*'()#",At.componentChars="-_.!~*'()";let Ai=/^([a-z0-9.+-]+:)/i,Aa=/:[0-9]*$/,Ao=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,As=["%","/","?",";","#"].concat(["'"].concat(["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n"," "]))),Al=["/","?","#"],Au=/^[+a-z0-9A-Z_-]{0,63}$/,Ac=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ad={javascript:!0,"javascript:":!0},Ap={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};An.prototype.parse=function(e,t){let r,n,i,a=e;if(a=a.trim(),!t&&1===e.split("#").length){let e=Ao.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Ai.exec(a);if(o&&(r=(o=o[0]).toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i="//"===a.substr(0,2))&&!(o&&Ad[o])&&(a=a.substr(2),this.slashes=!0),!Ad[o]&&(i||o&&!Ap[o])){let e,t,r=-1;for(let e=0;e<Al.length;e++)-1!==(n=a.indexOf(Al[e]))&&(-1===r||n<r)&&(r=n);-1!==(t=-1===r?a.lastIndexOf("@"):a.lastIndexOf("@",r))&&(e=a.slice(0,t),a=a.slice(t+1),this.auth=e),r=-1;for(let e=0;e<As.length;e++)-1!==(n=a.indexOf(As[e]))&&(-1===r||n<r)&&(r=n);-1===r&&(r=a.length),":"===a[r-1]&&r--;let i=a.slice(0,r);a=a.slice(r),this.parseHost(i),this.hostname=this.hostname||"";let o="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!o){let e=this.hostname.split(/\./);for(let t=0,r=e.length;t<r;t++){let r=e[t];if(r&&!r.match(Au)){let n="";for(let e=0,t=r.length;e<t;e++)r.charCodeAt(e)>127?n+="x":n+=r[e];if(!n.match(Au)){let n=e.slice(0,t),i=e.slice(t+1),o=r.match(Ac);o&&(n.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(".")+a),this.hostname=n.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf("#");-1!==s&&(this.hash=a.substr(s),a=a.slice(0,s));let l=a.indexOf("?");return -1!==l&&(this.search=a.substr(l),a=a.slice(0,l)),a&&(this.pathname=a),Ap[r]&&this.hostname&&!this.pathname&&(this.pathname=""),this},An.prototype.parseHost=function(e){let t=Aa.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};let Ah=function(e,t){if(e&&e instanceof An)return e;let r=new An;return r.parse(e,t),r};e.s([],56918),e.i(56918),e.s(["decode",0,N7,"encode",0,At,"format",0,Ar,"parse",0,Ah],465555);var Af=e.i(465555);let Am=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Ag=/[\0-\x1F\x7F-\x9F]/,Ay=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,Av=/[\$\+<->
183\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,Ab=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;e.s([],681911),e.i(681911),e.s(["Any",0,Am,"Cc",0,Ag,"Cf",0,/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,"P",0,Ay,"S",0,Av,"Z",0,Ab],707055);var Ax=e.i(707055);let Ak
vendor: 8,319 bytes, line 183
183=new Uint16Array('áµ<ÃıÊÒÕ»×ÙµÛÞ¢ßà à©àªà¶¡à¹à¼à¼¦áá¨á¡ááááá¥\0\0\0\0\0\0á«áá¦á°á·á½¾â â°âââ»ââ ¤â¤â´â¹â¿ããºã¹ã¬ã£¾ã¨¨ã©±ã« 㬮à EMabcfglmnoprstu\\bfms�¦³¹ÃÃligè»ÃäPè»&ä¦cuteè»Ãäreve;äÄiyx}rcè»Ãä;är;ìðraveè»Ãäpha;äacr;äd;æ©Ägp¡on;äf;ìð¸plyFunction;æ¡ingè»Ã
ä
Äcs¾Ãr;ìðign;æildeè»Ãämlè»ÃäÐaceforsuåûþÄÄĢħĪÄcrêòkslash;æÅ¶Ã¶Ã¸;æ«§ed;æy;äÆcrtÄ
ÄÄause;æµnoullis;æ¬a;är;ìð
pf;ìð¹eve;äcòÄmpeq;æÜHOacdefhilorsuÅÅÅÆÆÆ¢ÆµÆ·ÆºÇÈɳɸɾcy;ä§PYè»Â©ä©ÆcpyÅŢźute;äÄ;iŧŨætalDifferentialD;æ
leys;æÈaeioÆÆÆÆron;ädilè»Ãärc;änint;æ°ot;äÄdnƧÆilla;ä¸terDot;ä·Ã²Å¿i;ä§rcleÈDMPTÇÇÇÇot;æinus;ælus;æimes;æoÄcsǢǸkwiseContourIntegral;æ²eCurlyÄDQÈÈoubleQuote;æuote;æÈlnpuÈȨÉÉonÄ;eȥȦæ·;æ©´ÆgitȯȶȺruent;æ¡nt;æ¯ourIntegral;æ®ÄfrÉÉ;æoduct;ænterClockwiseContourIntegral;æ³oss;樯cr;ìðpÄ;CÊÊ
æap;æÖDJSZacefiosÊ Ê¬Ê°Ê´Ê¸ËËˡ˦̳ÒÄ;oŹʥtrahd;æ¤cy;äcy;ä
cy;äÆgrsÊ¿ËËger;æ¡r;æ¡hv;櫤ÄayËËron;ä;älÄ;tËËæa;är;ìðÄaf˫̧Äcm˰̢riticalÈADGTÌÌÌÌcute;ä´oÅ´ÌÌ;äbleAcute;ärave;ä ilde;äond;æferentialD;æ
Ѱ̽\0\0\0ÍÍ\0Ð
f;ìð»Æ;DEÍÍÍä¨ot;æqual;æbleÌCDLRUVͣͲÎÏϢϸontourIntegraìȹoɴ͹\0\0ͻ»ÍnArrow;æÄeoÎΤftÆARTÎÎΡrrow;æightArrow;æeÃ¥ËngÄLRΫÏeftÄARγιrrow;æ¸ightArrow;æºightArrow;æ¹ightÄATÏÏrrow;æee;æ¨pÉÏ©\0\0ϯrrow;æownArrow;æerticalBar;æ¥nÌABLRTaÐЪаÑѿͼrrowÆ;BUÐÐТæar;æ¤pArrow;æµreve;äeftËк\0Ñ\0ÑightVector;æ¥eeVector;æ¥ectorÄ;BÑÑæ½ar;æ¥ightÇѧ\0ѱeeVector;æ¥ectorÄ;BѺѻæar;æ¥eeÄ;AÒÒæ¤rrow;æ§ÄctÒÒr;ìðrok;äà NTacdfglmopqstuxÒ½ÓÓÓÓÓ¢Ó§Ó®ÓµÔ¡Ô¯Ô¶ÕÕÕ Õ¥G;ä
Hè»Ãäcuteè»ÃäÆaiyÓÓÓron;ärcè»Ãä;äot;är;ìðraveè»Ãäement;æÄapÓºÓ¾cr;ätyÉÔ\0\0ÔmallSquare;æ»erySmallSquare;æ«ÄgpÔ¦Ôªon;äf;ìð¼silon;äuÄaiÔ¼ÕlÄ;TÕÕæ©µilde;ælibrium;æÄciÕÕr;æ°m;橳a;ämlè»ÃäÄipÕªÕ¯sts;æonentialE;æ
ÊcfiosÖ
ÖÖÖ²×y;ä¤r;ìðlledÉÖ\0\0Ö£mallSquare;æ¼erySmallSquare;æªÍ°Öº\0Ö¿\0\0×f;ìð½All;æriertrf;æ±cÃ²×ØJTabcdfgorst×¨×¬×¯×ºØØØØØØ£Ù¬Ù²cy;äè»>ä¾mmaÄ;d׷׸ä;äreve;äÆeiyØØØdil;ä¢rc;ä;äot;ä r;ìð;æpf;ìð¾eaterÌEFGLSTصÙÙÙÙÙ¦qualÄ;Lؾؿæ¥ess;æullEqual;æ§reater;檢ess;æ·lantEqual;橾ilde;æ³cr;ìð¢;æ«ÐAacfiosuÚ
ÚÚÚÚÚªÚ¾ÛRDcy;äªÄctÚÚek;ä;äirc;ä¤r;ælbertSpace;æÇ°Ú¯\0Ú²f;æizontalLine;æÄctÛÛ
òکrok;ä¦mpÅÛÛownHumðįqual;æÜEJOacdfgmnostuÛºÛ¾ÜÜÜÜÜܡܨÝݸÞÞÞcy;älig;ä²cy;äcuteè»ÃäÄiyÜÜrcè»Ãä;äot;ä°r;æraveè»ÃäÆ;apÜ Ü¯Ü¿ÄcgÜ´Ü·r;äªinaryI;æ
lieóÏÇ´Ý\0Ý¢Ä;eÝÝæ¬ÄgrÝÝral;æ«section;æisibleÄCTݬݲomma;æ£imes;æ¢ÆgptÝ¿ÞÞon;ä®f;ìða;äcr;æilde;ä¨Ç«Þ\0Þcy;älè»ÃäÊcfosuÞ¬Þ·Þ¼ßßÄiyÞ±Þµrc;ä´;är;ìðpf;ìðÇ£ß\0ßr;ìð¥rcy;äkcy;äÎHJacfosߤߨ߽߬߱à à cy;ä¥cy;äppa;äÄeyß¶ß»dil;ä¶;är;ìðpf;ìðcr;ìð¦ÖJTaceflmostà ¥à ©à ¬à¡à¡£à¦³à¦¸à§à§à¨·à©cy;äè»<ä¼Êcmnprà ·à ¼à¡à¡à¡ute;ä¹bda;äg;æªlacetrf;ær;æÆaeyà¡à¡à¡¡ron;ä½dil;ä»;äÄfsࡨ॰tÔACDFRTUVarࡾࢩࢱࣦ࣠ࣼयà¥Î४Änrà¢à¢gleBracket;æ¨rowÆ;BRà¢à¢à¢æar;æ¤ightArrow;æeiling;æoǵࢷ\0à£bleBracket;æ¦nÇà£\0à£eeVector;楡ectorÄ;Bà£à£æar;æ¥loor;æightÄAV࣯ࣵrrow;æector;æ¥Äerà¤à¤eÆ;AVà¤à¤à¤æ£rrow;æ¤ector;æ¥iangleÆ;BEतथऩæ²ar;æ§qual;æ´pÆDTVषà¥à¥ownVector;æ¥eeVector;æ¥ ectorÄ;Bà¥à¥æ¿ar;æ¥ectorÄ;B॥०æ¼ar;æ¥ightáÎsÌEFGLSTॾà¦à¦à¦à¦¢à¦qualGreater;æullEqual;æ¦reater;æ¶ess;檡lantEqual;橽ilde;æ²r;ìðÄ;eঽাæftarrow;æidot;ä¿Ænpwà§à¨à¨gÈLRlrà§à§·à¨à¨eftÄAR০৬rrow;æµightArrow;æ·ightArrow;æ¶eftÄarγà¨ightáοightáÏf;ìðerÄLRਢਬeftArrow;æightArrow;æÆchtਾà©à©Ã²à¡;æ°rok;ä
;æªÐacefiosuà©à©à© ੷੼àª
àªàªp;æ¤
y;äÄdl੥੯iumSpace;ælintrf;æ³r;ìðnusPlus;æpf;ìðcò੶;äÒJacefostuણધàªà«à¬à¬à¶à¶à¶cy;äcute;ä
Æaey઴હાron;ä
dil;ä
;äÆgswà«à«°à¬ativeÆMTVà«à«à«¨ediumSpace;æhiÄcn૦à«Ã«à«eryThiîà«tedÄGL૸à¬reaterGreateòٳessLesóà©Line;är;ìðÈBnptଢନଷ଺reak;æ BreakingSpace;ä f;æÚ;CDEGHLNPRSTVàààªà¼à®¡à¯«à°à±à²à²¦à³àµ¡à¶
櫬Äouàà¤ngruent;æ¢pCap;æoubleVerticalBar;æ¦Ælqxà®à®à®ement;æualÄ;Tà®à®æ ilde;ìâ̸ists;æreaterÎ;EFGLSTஶஷ஽à¯à¯à¯à¯¥æ¯qual;æ±ullEqual;ìâ§Ì¸reater;ìâ«Ì¸ess;æ¹lantEqual;ì⩾̸ilde;æµumpÅ௲௽ownHump;ìâ̸qual;ìâ̸eÄfsà°à°§tTriangleÆ;BEà°à°à°¡æªar;ìâ§Ì¸qual;æ¬sÌ;EGLSTవశ఼à±à±à±æ®qual;æ°reater;æ¸ess;ìâªÌ¸lantEqual;ì⩽̸ilde;æ´estedÄGL౨౹reaterGreater;ì⪢̸essLess;ì⪡̸recedesÆ;ESà²à²à²æqual;ì⪯̸lantEqual;æ ÄeiಫಹverseElement;æghtTriangleÆ;BEà³à³à³æ«ar;ìâ§Ì¸qual;æÄquà³à´uareSuÄbp೨೹setÄ;Eà³°à³³ìâ̸qual;æ¢ersetÄ;Eà´à´ìâ̸qual;æ£Æbcpà´à´¤àµsetÄ;Eà´à´ìââqual;æceedsÈ;ESTà´²à´³à´»àµæqual;ì⪰̸lantEqual;æ¡ilde;ìâ¿Ì¸ersetÄ;Eàµàµìââqual;æildeÈ;EFT൮൯൵ൿæqual;æullEqual;æilde;æerticalBar;æ¤cr;ìð©ildeè»Ãä;äÜEacdfgmoprstuvà¶½à·à·à·à·à· à·§à·¼à¸à¸ ยา฿à¹lig;ä
cuteè»ÃäÄiyà·à·rcè»Ãä;äblac;ä
r;ìðraveè»ÃäÆaei෮ෲ෶cr;ä
ga;ä©cron;äpf;ìðenCurlyÄDQà¸à¸oubleQuote;æuote;æ;æ©Äclวฬr;ìðªashè»ÃäiŬื฼deè»Ãäes;樷mlè»ÃäerÄBPà¹à¹ Äarà¹à¹r;æ¾acÄekà¹à¹;æet;æ´arenthesis;æÒacfhilors๿àºàºàºàºàºàºàº°à»¼rtialD;æy;är;ìði;ä¦;ä usMinus;ä±ÄipຢàºncareplanÃ¥Úf;æÈ;eio຺ູ໠໤檻cedesÈ;ESTà»à»à»à»æºqual;檯lantEqual;æ¼ilde;æ¾me;æ³Ädp໩໮uct;æortionÄ;aȥ໹l;æÄcià¼à¼r;ìð«;ä¨ÈUfosà¼à¼à¼à¼OTè»"ä¢r;ìðpf;æcr;ìð¬ØBEacefhiorsu༾à½à½à½ ཱིྦྷྪà¾áá©á´á¾arr;æ¤Gè»Â®ä®Æcnrà½à½à½ute;ä
g;æ«rÄ;tà½à½æ l;æ¤Æaeyཧཬཱron;ä
dil;ä
;ä Ä;vླྀཹæerseÄEUà¾à¾Älqà¾à¾ement;æuilibrium;æpEquilibrium;楯r»ཹo;ä¡ghtÐACDFTUVaà¿à¿«à¿³á¢á¨ááÏÄnrà¿à¿gleBracket;æ©rowÆ;BLà¿à¿à¿¡æar;æ¥eftArrow;æeiling;æoǵ࿹\0á
bleBracket;æ§nÇá\0áeeVector;æ¥ectorÄ;Bááæar;æ¥loor;æÄerááeÆ;AVáµá¶á¼æ¢rrow;æ¦ector;æ¥iangleÆ;BEáááæ³ar;æ§qual;æµpÆDTVá£á®á¸ownVector;æ¥eeVector;æ¥ectorÄ;Bááæ¾ar;æ¥ectorÄ;Bááæar;æ¥Äpuááf;ændImplies;楰ightarrow;æÄchá¹á¼r;æ;æ±leDelayed;æ§´ÚHOacfhimoqstuá¤á±á·á½ááá
á
á
¡á
§áµá»á¿ÄCcá©á®Hcy;ä©y;ä¨FTcy;ä¬cute;ä
Ê;aeiyáááááæª¼ron;ä
dil;ä
rc;ä
;ä¡r;ìðortÈDLRUáªá´á¾á
ownArrow»ÐeftArrow»à¢ightArrow»à¿pArrow;ægma;ä£allCircle;æpf;ìðɲá
\0\0á
°t;æareÈ;ISUá
ȇ
¼áá¯æ¡ntersection;æuÄbpáásetÄ;Eááæqual;æersetÄ;Eá¨á©æqual;ænion;æcr;ìð®ar;æÈbcmpááááÄ;sááæetÄ;Eááqual;æÄchá á
eedsÈ;ESTáá®á´á¿æ»qual;檰lantEqual;æ½ilde;æ¿Tháà¾;æÆ;esááá£ærsetÄ;Eááæqual;æet»áÖHRSacfhiorsá¾ááááá±á¶ááááORNè»ÃäADE;æ¢ÄHcáácy;äy;ä¦Äbuáá;ä;䤯aeyá¥áªá¯ron;ä
¤dil;ä
¢;ä¢r;ìðÄeiá»áDzá\0áefore;æ´a;äÄcnáákSpace;ìââSpace;ældeÈ;EFTá«á¬á²á¼æ¼qual;æullEqual;æ
ilde;æpf;ìðipleDot;æÄctáár;ìð¯rok;ä
¦à«¡á·ááá¦\0á¬á±\0\0\0\0\0á¸á½á·á
\0á¿áááÄcrá»áuteè»ÃärÄ;oááæcir;æ¥rÇ£á\0áy;äve;ä
¬Äiyáá£rcè»Ãä;ä£blac;ä
°r;ìðraveè»Ãäacr;ä
ªÄdiáá©erÄBPááÄaráár;äacÄekáá;æet;æµarenthesis;æonÄ;Pá°á±ælus;æÄgpá»á¿on;ä
²f;ìðÐADETadpsáá®á¸áϨááá³rrowÆ;BDá
á á¤ar;æ¤ownArrow;æ
ownArrow;æquilibrium;楮eeÄ;Aááæ¥rrow;æ¥ownáϳerÄLRáá¨eftArrow;æightArrow;æiÄ;lá¹áºäon;ä¥ing;ä
®cr;ìð°ilde;ä
¨mlè»ÃäÒDbcdefosvá§á¬á°á³á¾á
áááash;æ«ar;æ««y;äashÄ;lá»á¼æ©;櫦Äeráá
;æÆbtyáááºar;æÄ;iáácalÈBLSTá¡á¥áªá´ar;æ£ine;ä¼eparator;æilde;æThinSpace;ær;ìðpf;ìðcr;ìð±dash;æªÊcefosá§á¬á±á¶á¼irc;ä
´dge;ær;
vendor: 7,828 bytes, line 183
183ìðpf;ìðcr;ìð²Èfiosáááár;ìð;äpf;ìðcr;ìð³ÒAIUacfosuá±áµá¹á½ááááá cy;ä¯cy;äcy;ä®cuteè»ÃäÄiyáárc;ä
¶;ä«r;ìðpf;ìðcr;ìð´ml;ä
¸ÐHacdefosáµá¹á¿áááá á¤cy;äcute;ä
¹Äayááron;ä
½;äot;ä
»Ç²á\0áoWidtèà«a;är;æ¨pf;æ¤cr;ìðµà¯¡ááá\0á°á¶á¿\0\0\0\0ááá«áá\0ááá²á¹\0á¾cuteè»Ã¡ä¡reve;äÌ;Ediuyááá¡á£á¨áæ¾;ìâ¾Ì³;æ¿rcè»Ã¢ä¢teè»Â´Ì;ä°ligè»Ã¦ä¦Ä;r²áº;ìðraveè»Ã ä ÄepááÄfpáásym;æµÃ¨áha;ä±ÄapácÄclá¤á§r;äg;樿ɤá°\0\0áÊ;adsváºá»á¿ááæ§nd;æ©;æ©lope;æ©;æ©Î;elmrszááááá¿ááæ ;榤e»ásdÄ;aá¥á¦æ¡Ñ¡á°á²á´á¶á¸áºá¼á¾;榨;榩;榪;榫;榬;æ¦;榮;榯tÄ;vá
áæbÄ;dááæ¾;æ¦Äptááh;æ¢Â»Â¹arr;æ¼Ägpá£á§on;ä
f;ìðÎ;Eaeiopáá»á½áááá;æ©°cir;橯;æd;æs;ä§roxÄ;eááñáingè»Ã¥ä¥Æctyá¡á¦á¨r;ìð¶;äªmpÄ;eáá¯Ã±Êildeè»Ã£ä£mlè»Ã¤ä¤Äciááoninôɲnt;æ¨à Nabcdefiklnoprsuáá±á°á¼ááá¸á½á á¦á ¹á¡á᤽á¥á¥°ot;æ«Äcrá¶ákÈcepsáá
ááong;æpsilon;ä¶rime;æµimÄ;eááæ½q;æÅ¶á¢á¦ee;æ½edÄ;gá¬áæ
e»árkÄ;táá·brk;æ¶Äoyáá;ä±quo;æÊcmprtááá¡á¤á¨ausÄ;eÄÄptyv;榰séánoÃµÄÆahwá¯á±á³;ä²;æ¶een;æ¬r;ìðgÎcostuvwááá³ááááÆaiuáááÃ°Ý rc;æ¯pÂ»á±Ædptá¤á¨áot;æ¨lus;æ¨imes;æ¨É±á¹\0\0á¾cup;æ¨ar;æ
riangleÄduááown;æ½p;æ³plus;æ¨eÃ¥áÃ¥áarow;æ¤Æakoáá ¦á µÄcná²á £kÆlstáºÖ«á ozenge;æ§«riangleÈ;dlrá á á á æ´own;æ¾eft;æight;æ¸k;æ£Æ±á «\0á ³Æ²á ¯\0á ±;æ;æ4;æck;æÄeoá ¾á¡Ä;qá¡á¡ì=â¥uiv;ìâ¡â¥t;æÈptwxá¡á¡á¡§á¡¬f;ìðÄ;táá¡£om»átie;æØDHUVbdhmptuvá¢
á¢á¢ªá¢»á£á£á£¬á£¿á¤
á¤á¤á¤¡ÈLRlrá¢á¢á¢á¢;æ;æ;æ;æÊ;DUduᢡᢢᢤᢦᢨæ;æ¦;æ©;æ¤;æ§ÈLRlrᢳᢵᢷᢹ;æ;æ;æ;æÎ;HLRhlrá£á£á£á£á£á£á£æ;æ¬;æ£;æ ;æ«;æ¢;æox;æ§ÈLRlrᣤᣦᣨᣪ;æ;æ;æ;æÊ;DUduڽ᣷᣹᣻᣽;æ¥;æ¨;æ¬;æ´inus;ælus;æimes;æ ÈLRlrá¤á¤á¤á¤;æ;æ;æ;æÎ;HLRhlrᤰᤱᤳᤵᤷ᤻᤹æ;æª;æ¡;æ;æ¼;æ¤;æÄevÄ£á¥barè»Â¦ä¦Èceioá¥á¥á¥á¥ r;ìð·mi;æmÄ;eáálÆ;bhᥨᥩᥫä;æ§
sub;æÅ¬á¥´á¥¾lÄ;e᥹᥺æ¢t»᥺pÆ;Eeįá¦
á¦;檮Ä;qÛÛೡᦧ\0᧨á¨á¨á¨²\0ᨷá©\0\0᪴\0\0á«\0\0ᬡᬮáá\0᯽\0á°Æcprá¦á¦²á§ute;äÌ;abcdsᦿá§á§á§á§á§æ©nd;æ©rcup;æ©Äauá§á§p;æ©p;æ©ot;æ©;ìâ©ï¸Äeo᧢᧥t;æÃ®ÚÈaeiuá§°á§»á¨á¨
ǰ᧵\0᧸s;æ©on;ädilè»Ã§ä§rc;äpsÄ;sá¨á¨æ©m;æ©ot;äÆdmná¨á¨ ᨦilè»Â¸Æptyv;榲tè¢;eá¨á¨®ä¢räƲr;ìð Æceiᨽá©á©y;äckÄ;má©á©æark»á©;ärÎ;Ecefmsá©á© ᩢᩫ᪤᪪᪮æ;æ§Æ;elᩩᩪá©äq;æeɡᩴ\0\0áªrrowÄlr᩼áªeft;æºight;æ»ÊRSacdáªáªáªáªáªÂ»à½;æst;æirc;æash;ænint;æ¨id;櫯cir;æ§ubsÄ;u᪻᪼æ£it»᪼ˬá«á«á«º\0á¬onÄ;eá«á«äºÄ;qÃÃÉá«\0\0á«¢aÄ;tá«á«ä¬;äÆ;fl᫨᫩᫫æÃ®á
eÄmx᫱᫶ent»᫩eóÉǧ᫾\0á¬Ä;dá»á¬ot;æ©nÃ´ÉÆfryá¬á¬á¬;ìðoäÉè©;sÅá¬r;æÄaoᬥᬩrr;æµss;æÄcuᬲᬷr;ìð¸ÄbpᬼáÄ;eááæ«;æ«Ä;eááæ«;æ«dot;æ¯Îdelprvwá á¬á·á®á®¬á¯á¯¹arrÄlrá¨áª;椸;椵ɰá²\0\0áµr;æc;æarrÄ;pá¿á®æ¶;椽Ì;bcdosá®á®á®á®¡á®¥á®¨æªrcap;æ©Äauá®á®p;æ©p;æ©ot;ær;æ©
;ìâªï¸Èalrv᮵ᮿá¯á¯£rrÄ;mᮼᮽæ·;椼yÆevwá¯á¯á¯qɰá¯\0\0á¯reãá³uãáµee;æedge;æenè»Â¤ä¤earrowÄlrᯮ᯳eft»á®ight»ᮽeäá¯Äciá°á°oninôǷnt;æ±lcty;æà¦AHabcdefhijlorstuwz᰸᰻᰿á±á±©á±µá²á²á²¬á²·á³»á³¿á´áµ»á¶á¶«á¶»á·á·ròÎar;楥Èglrsá±á±á±á±ger;æ eth;æ¸Ã²á³hÄ;vá±á±æÂ»à¤Å«á±¡á±§arow;æ¤aãÌÄayᱮᱳron;ä;ä´Æ;ao̲ᱼá²ÄgrÊ¿á²r;ætseq;æ©·Æglmá²á²á²è»Â°ä°ta;ä´ptyv;榱ÄirᲣᲨsht;楿;ìð¡arÄlrᲳᲵ»à£Â»áÊaegsvá³Í¸á³á³á³ mÆ;oșá³á³ndÄ;șá³uit;æ¦amma;äin;æ²Æ;io᳧᳨᳸ä·deè÷;oá³§á³°ntimes;ænø᳷cy;äcɯá´\0\0á´rn;æop;æÊlptuwá´á´á´¢áµáµlar;ä¤f;ìðÊ;empsÌá´á´·á´½áµqÄ;dÍá´³ot;æinus;æ¸lus;æquare;æ¡blebarwedgåúnÆadhá®áµáµ§ownarrowóá²arpoonÄlrᵲᵶefôᲴighôᲶŢᵿá¶
karo÷à½É¯á¶\0\0á¶rn;æop;æÆcotá¶á¶£á¶¦Äryá¶á¶¡;ìð¹;äl;æ§¶rok;äÄdrá¶°á¶´ot;æ±iÄ;fá¶ºá æ¿Äahá·á·ròЩaòྦangle;榦Äciá·á·y;ägrarr;æ¿à¤Dacdefglmnopqrstuxá¸á¸á¸á¸¸Õ¸á¸¼á¹á¹¡á¹¾áº¥áº¯áº½á»¡á¼ªá¼·á½á½á½ÄDoá¸á´´oôá²Äcsá¸á¸uteè»Ã©ä©ter;æ©®ÈaioyḢḧḱḶron;ärÄ;cá¸á¸®æè»Ãªäªlon;æ;äot;äÄDrá¹á¹
ot;æ;ìð¢Æ;rsá¹á¹á¹æªaveè»Ã¨ä¨Ä;dá¹á¹æªot;æªÈ;ilsṪṫṲṴæªnters;æ§;æÄ;dṹṺæªot;æªÆapsáº
áºáºcr;ätyÆ;sváºáºáºæ
et»áºpÄ1;áºáº¤Ä³áº¡áº£;æ;æ
æÄgsẪẬ;ä
p;æÄgpẴẸon;äf;ìðÆalsá»á»á»rÄ;sá»á»æl;æ§£us;橱iÆ;lvá»á»á»äµon»á»;äµÈcsuvỪỳá¼á¼£Äioữḱrc»Ḯɩỹ\0\0á»»ÃÕantÄglá¼á¼tr»á¹ess»ṺÆaeiá¼á¼á¼ls;ä½st;ævÄ;DȵἠD;橸parsl;æ§¥ÄDaἯἳot;ærr;楱Æcdiá¼¾á½á»¸r;æ¯oôÍÄahá½á½;ä·è»Ã°ä°Ämrá½á½lè»Ã«ä«o;æ¬Æcipὡὤὧl;ä¡sôծÄeoὬὴctatioîÕnentialåչৡá¾\0á¾\0ᾡᾧ\0\0á¿á¿\0á¿\0ῦῪâ\0ââllingdotseñá¹y;ämale;æÆilrá¾á¾³á¿lig;èï¬É©á¾¹\0\0á¾½g;èï¬ig;èï¬;ìð£lig;èï¬lig;ìfjÆaltá¿á¿á¿¡t;æig;èï¬ns;æ±of;äǰ΅\0ῳf;ìðÄakÖ¿á¿·Ä;vῼ´æ;æ«artint;æ¨ÄaoââÄcsââαââ°â¸â
â\0âβâ¢â¥â§âªâ¬\0â®è»Â½ä½;æ
è»Â¼ä¼;æ
;æ
;æ
Ƴâ´\0â¶;æ
;æ
Ê´â¾â\0\0âè»Â¾ä¾;æ
;æ
5;æ
ƶâ\0â;æ
;æ
8;æ
l;æwn;æ¢cr;ìð»à¢Eabcdefgijlnorstvââââ¥â°â´â°âµâºâ¿âââ¸Ìâ¾â
âÄ;lÙâ;æªÆcmpâââute;äµmaÄ;dâá³ä³;æªreve;äÄiyâªâ®rc;ä;ä³ot;ä¡È;lqsؾÙâ½âÆ;qsؾÙâlanô٥È;cdlÙ¥âââ¥c;檩otÄ;oââæªÄ;lâ¢â£æª;æªÄ;eâªâìâï¸s;æªr;ìð¤Ä;gÙ³Ømel;æ·cy;äÈ;EajÙâââ;æª;檥;檤ÈEaesâââ©â´;æ©pÄ;pâ£â¤æªrox»â¤Ä;qâ®â¯æªÄ;qâ®âim;æ§pf;ìðÄciâ
â
r;æmÆ;elÙ«â
â
;æª;æªè>;cdlqr×®â
â
ªâ
®â
³â
¹Äciâ
¥â
§;檧r;橺ot;æPar;æ¦uest;橼Êadelsââ
ªâÙâǰâ\0âproøâr;楸qÄlqØ¿âlesóâiÃÙ«Äenâ£ârtneqq;ìâ©ï¸Ã
âªÔAabcefkosyâââ±âµâºâââ¯â¨â½ròΠÈilmrâââârsðáf»â¤ilôکÄdrâ â¤cy;äÆ;cwࣴâ«â¯ir;æ¥;æar;æirc;䥯alrââârtsÄ;uââæ¥it»âlip;æ¦con;æ¹r;ìð¥sÄewâ£â©arow;椥arow;椦Êamoprâºâ¾âââ£rr;æ¿tht;æ»kÄlrââeftarrow;æ©ightarrow;æªf;ìðbar;æÆcltâ¯â´â¸r;ìð½asèâ´rok;ä§Äbpââull;æhen»á±à«¡â£\0âª\0â¸â
â\0ââ³\0\0â¸â¢â§â¢â¿\0ââªâ´cuteè»ÃäÆ;iyݱâ°âµrcè»Ã®ä®;ä¸Äcxâ¼â¿y;äµclè»Â¡ä¡ÄfrÎâ;ìð¦raveè»Ã¬ä¬È;inoܾââ©â®Äinâ¢â¦nt;æ¨t;æfin;æ§ta;æ©lig;䳯aopâ¾ââÆcgtâ
ââr;䫯elpÜââinÃ¥ÞarÃ´Ü h;ä±f;æ·ed;äµÊ;cfotÓ´â¬â±â½âare;æ
inÄ;tâ¸â¹æie;æ§doôâÊ;celpÝââââ¡al;æºÄgrââeróá£Ã£âarhk;æ¨rod;樼Ècgptâ¯â²â¶â»y;äon;ä¯f;ìða;ä¹uestè»Â¿ä¿Äciââr;ìð¾nÊ;EdsvÓ´âââ¡Ó³;æ¹ot;æµÄ;vâ¦â§æ´;æ³Ä;iÝ·â®lde;ä©Ç«â¸\0â¼cy;älè»Ã¯ä¯Ìcfmosuââââ¡â§âµÄiyâârc;äµ;ä¹r;ìð§ath;ä·pf;ìðÇ£â¬\0â±r;ìð¿rcy;äkcy;äÐacfghjosâââ¢â§ââ±âµâ»ppaÄ;vââäº;ä°Äeyââ dil;ä·;äºr;ìð¨reen;ä¸cy;ä
cy;äpf;ìðcr;ìðà®ABEHabcdefghjlmnoprstuvâ°ââââââ½âââââ¥â¹â½ââ²âââ¨âââ â Æartâ·âºâ¼ròà§Ã²Îail;æ¤arr;æ¤Ä;gà¦â;æªar;楢ॣâ¥\0âª\0â±\0\0\0\0\0âµâº\0âââ\0â¹ute;äºmptyv;榴raîà¡bda;ä»gÆ;dlà¢ââ;æ¦Ã¥à¢;æª
uoè»Â«ä«rÐ;bfhlpstà¢ââ¦â©â«â®â±âµÄ;fà¢â£s;æ¤s;æ¤Ã«âp;æ«l;椹im;楳l;æ¢Æ;aeâ¿ââæª«il;æ¤Ä;sââæª;ìâªï¸Æabrââârr;æ¤rk;æ²Äakâ¢â¬cÄekâ¨âª;ä»;äÄesâ±â³;æ¦lÄduâ¹â»;æ¦;æ¦Èaeuyââââron;ä¾Ädiââil;ä¼Ã¬à¢°Ã¢â©;
vendor: 10,520 bytes, line 183
183ä»Ècqrsâ£â¦ââ½a;椶uoÄ;rà¸áÄduâ²â·har;楧shar;æ¥h;æ²Ê;fgqsââà¦â³â¿æ¤tÊahlrtââ¤â·ââ¨rrowÄ;tà¢â¡aéâ¶arpoonÄduâ¯â´own»Ñp»०eftarrows;æightÆahsââârrowÄ;sࣴࢧarpoonóà¾quigarro÷â°hreetimes;æÆ;qsâà¦âºlanôবÊ;cdgsবââââ¨c;檨otÄ;oââæ©¿Ä;rââæª;æªÄ;eâ¢â¥ìâï¸s;æªÊadegsâ³â¹â½ââpproøâot;æqÄgqââ
ôà¦gtòâôà¦iÃলÆilrâ࣡âsht;楼;ìð©Ä;Eà¦â£;æªÅ¡â©â¶rÄduâ²â®Ä;l॥â³;楪lk;æcy;äÊ;achtà©ââââròâorneòá´ard;楫ri;æºÄioââ¤dot;ä
ustÄ;aâ¬âæ°che»âÈEaesâ»â½ââ;æ¨pÄ;pââæªrox»âÄ;qââæªÄ;qââ»im;æ¦Ðabnoptwzâ©â´â·ââ¯âââÄnrâ®â±g;æ¬r;æ½rëà£gÆlmrâ¿ââeftÄar০âightá৲apsto;æ¼ightá৽parrowÄlrâ¥â©efôâight;æ¬Æaflâ¶â¹â½r;æ¦
;ìðus;æ¨imes;樴šââst;æÃ¡áÆ;efââá ænge»âarÄ;lâ¤â¥ä¨t;æ¦Êachmtâ³â¶â¼â
âròࢨorneòá¶arÄ;dà¾â;æ¥;æri;æ¿Ìachiqtââà©â¢â®â»quo;æ¹r;ìðmÆ;egলâªâ¬;æª;æªÄbuâªâ³oÄ;rà¸â¹;ærok;ä
è<;cdhilqrà «ââ¹ââ â¥âªâ°Äciââ;檦r;橹reÃ¥â²mes;æarr;楶uest;æ©»ÄPiâµâ¹ar;æ¦Æ;efâ à¤á ærÄduâ â shar;æ¥har;楦Äenâ â ¡rtneqq;ìâ¨ï¸Ã
â ÜDacdefhilnopsuâ¡â¡
â¢â¢â¢â¢ ⢥⢨â£â£¢â£¤àªâ£³â¤Dot;æºÈclprâ¡â¡â¡£â¡½rè»Â¯ä¯Äetâ¡â¡;æÄ;eâ¡â¡æ se»â¡Ä;sá»â¡¨toÈ;dluá»â¡³â¡·â¡»owîÒefôà¤Ã°áker;æ®Äoyâ¢â¢mma;権;ä¼ash;æasuredangle»á¦r;ìðªo;æ§Æcdn⢯⢴â£roè»ÂµäµÈ;acdá¤â¢½â£â£sôá§ir;æ«°otè»Â·ÆµusÆ;bdâ£á¤â£æÄ;uá´¼â£;横ţâ£â£¡p;æ«Ã²âðàªÄdp⣩⣮els;æ§f;ìðÄct⣸⣽r;ìðpos»áÆ;lmâ¤â¤â¤ä¼timap;æ¸à°GLRVabcdefghijlmoprstuvwâ¥â¥â¥¾â¦â¦â§â§©â¨â¨â©â©âªâªâª¤âª¨â¬â¬ââ¿â®®â°´â±§â±¼â³©Ägtâ¥â¥;ìâ̸Ä;vâ¥à¯ìâ«âÆeltâ¥â¥²â¥¶ftÄar⥡⥧rrow;æightarrow;æ;ìâ̸Ä;v⥻à±ìâªâightarrow;æÄDdâ¦â¦ash;æ¯ash;æ®Êbcnpt⦣⦧⦬⦱â§la»Ëute;ä
g;ìâ âÊ;Eiopà¶â¦¼â§â§
â§;ì⩰̸d;ìâ̸s;ä
roøà¶urÄ;aâ§â§æ®lÄ;sâ§à¬¸Ç³â§\0â§£pè»Â ଷmpÄ;e௹à°Êaeouyâ§´â§¾â¨â¨â¨Ç°â§¹\0â§»;æ©on;ä
dil;ä
ngÄ;dൾâ¨ot;ìâ©Ì¸p;æ©;ä½ash;æÎ;Aadqsxà®â¨©â¨â¨»â©â©
â©rr;ærÄhr⨳⨶k;椤Ä;oá²á°ot;ìâ̸uiöà£Äeiâ©â©ar;椨Ãà®istÄ;sà® à®r;ìð«ÈEestà¯
⩦⩹⩼Æ;qs஼â©à¯¡Æ;qs஼à¯
â©´lanô௢iÃ௪Ä;rà®¶âªÂ»à®·ÆAapâªâªâªrò⥱rr;æ®ar;櫲Æ;svà¾âªà¾Ä;d⪡⪢æ¼;æºcy;äÎAEadest⪷⪺⪾â«â«
⫶⫹rò⥦;ìâ¦Ì¸rr;ær;æ¥È;fqsà°»â«â«£â«¯tÄarâ«â«rro÷â«ightarroÃ·âªÆ;qs఻⪺⫪lanôà±Ä;sà±â«´Â»à°¶iÃà±Ä;rవ⫾iÄ;eà°à°¥iäà¶Äptâ¬â¬f;ìðè¬;inâ¬â¬â¬¶ä¬nÈ;Edvà®â¬¤â¬¨â¬®;ìâ¹Ì¸ot;ìâµÌ¸Ç¡à®â¬³â¬µ;æ·;æ¶iÄ;vಸ⬼ǡಸââ;æ¾;æ½Æaorââ£â©rÈ;astà»âââlleìà»l;ì⫽â¥;ìâ̸lint;æ¨Æ;ceà²â°â³uåಥÄ;cà²â¸Ä;eà²â½Ã±à²ÈAaitâ®â®â®â®§ròâ¦rrÆ;cwâ®â®â®æ;ì⤳̸;ìâ̸ghtarrow»â®riÄ;eà³à³Îchimpqu⮽â¯â¯â¬à¸â¯¤â¯¯È;cerà´²â¯à´·â¯uÃ¥àµ
;ìðortÉâ¬
\0\0â¯aráâmÄ;e൮â¯Ä;q൴൳suÄbp⯫â¯Ã¥à³¸Ã¥à´Æbcp⯶â°â°È;Ees⯿â°à´¢â°æ;ìâ«
̸etÄ;eà´â°qÄ;qà´£â°cÄ;eà´²â°Ã±à´¸È;EesⰢⰣàµâ°§æ
;ìâ«Ì¸etÄ;eàµâ°®qÄ;qൠⰣÈgilrⰽⰿâ±
â±Ã¬à¯ldeè»Ã±ä±Ã§à±iangleÄlrâ±â±eftÄ;eà°â±Ã±à°¦ightÄ;eà³â±¥Ã±à³Ä;mⱬâ±ä½Æ;esⱴⱵⱹä£ro;æp;æÒDHadgilrsâ²â²â²â²â²£â²°â²¶â³â³£ash;æarr;æ¤p;ìââash;æ¬ÄetⲨⲬ;ìâ¥â;ì>ânfin;æ§ÆAetâ²½â³â³
rr;æ¤;ìâ¤âÄ;râ³â³ì<âie;ìâ´âÄAtâ³â³rr;æ¤rie;ìâµâim;ìâ¼âÆAanâ³°â³´â´rr;ærÄhr⳺⳽k;椣Ä;oá§á¥ear;椧ááª\0\0\0\0\0\0\0\0\0\0\0\0\0â´\0â´¸âµâµ ⵥ⵲â¶á¬\0\0â¶â¶«\0â·â·\0â·â¸â¸«â¸¾â¹Äcsâ´±áªuteè»Ã³ä³Äiyâ´¼âµ
rÄ;cáªâµè»Ã´ä´;ä¾Êabios᪠âµâµÇâµlac;ä
v;樸old;榼lig;ä
Äcr⵩âµir;榿;ìð¬Í¯âµ¹\0\0âµ¼\0â¶n;äaveè»Ã²ä²;æ§Äbmâ¶à·´ar;榵Èacitâ¶â¶â¶¥â¶¨ròáªÄirâ¶â¶ r;榾oss;榻nÃ¥à¹;æ§Æaeiⶱⶵⶹcr;ä
ga;äÆcdnâ·â·
Çron;ä¿;榶pf;ìð Æaelâ·â·Çr;榷rp;榹Î;adiosvⷪⷫⷮâ¸â¸â¸â¸æ¨ròáªÈ;efmâ··â·¸â¸â¸
æ©rÄ;oⷾⷿæ´f»ⷿè»Âªäªè»Âºäºgof;æ¶r;æ©lope;æ©;æ©Æcloâ¸â¸¡â¸§Ã²â¸ashè»Ã¸ä¸l;æiŬⸯ⸴deè»ÃµäµesÄ;aÇ⸺s;樶mlè»Ã¶ä¶bar;æ½à«¡â¹\0â¹½\0âºâº\0⺢⺹\0\0â»àº\0â¼\0\0⼫⾼\0â¿rÈ;astÐâ¹§â¹²àº
è¶;lâ¹â¹®ä¶leìÐɩ⹸\0\0â¹»m;櫳;櫽y;ä¿rÊcimptâºâºâºá¡¥âºnt;ä¥od;ä®il;æ°enk;æ±r;ìðÆimo⺨⺰⺴Ä;vâºâº®ä;ämaô੶ne;æÆ;tv⺿â»â»ächfork»´;äÄauâ»â»nÄckâ»â»kÄ;hâ´â»;æÃ¶â´sÒ;abcdemst⻳⻴á¤â»¹â»½â¼â¼â¼â¼ä«cir;樣ir;樢Äouáµâ¼;樥;橲nè»Â±àºim;樦wo;樧Æipuâ¼â¼ â¼¥ntint;æ¨f;ìð¡ndè»Â£ä£Ô;Eaceinosuà»â¼¿â½â½â½â¾â¾â¾â½¾â¾¶;檳p;檷uÃ¥à»Ä;cà»â½Ì;acensà»â½â½â½¦â½¨â½¾pproøâ½urlyeñà»Ã±à»Æaes⽯⽶⽺pprox;檹qq;檵im;æ¨iÃà»meÄ;sâ¾àº®æ²ÆEas⽸â¾â½ºÃ°â½µÆdfp໬â¾â¾¯Æals⾠⾥⾪lar;æ®ine;æurf;æÄ;t໻⾴ï໻rel;æ°Äciâ¿â¿
r;ìð
;äncsp;æÌfiopsuâ¿â¢â¿â¿¥â¿«â¿±r;ìð®pf;ìð¢rime;æcr;ìðÆaeo⿸ããtÄei⿾ã
rnionóڰnt;æ¨stÄ;eããä¿Ã±á¼Ã´à¼àªABHabcdefhilmnoprstuxããããã ãã«ã
ã
¢ã
²ãããã¤ã©ãã®ã²ãã°ã·Æartãããròá³Ã²Ïail;æ¤aròᱥar;楤Îcdenqrtã¨ãµã¸ã¿ãããÄeuãã±;ìâ½Ì±te;ä
iãá
®mptyv;榳gÈ;delà¿ããã;æ¦;榥åà¿uoè»Â»ä»rÖ;abcfhlpstwà¿ã¬ã¯ã·ã¹ã¼ã¾ããããp;極Ä;fà¿ ã´s;æ¤ ;椳s;æ¤Ã«âðâ®l;æ¥
im;楴l;æ£;æÄaiããil;æ¤oÄ;nããæ¶alÃ³à¼Æabrã§ãªã®ròá¥rk;æ³Äakã³ã½cÄekã¹ã»;ä½;äÄesãã;æ¦lÄduãã;æ¦;æ¦Èaeuyããã§ã©ron;ä
Ädiã¡ã¥il;ä
ì࿲âãº;äÈclqsã´ã·ã½ã
a;椷dhar;楩uoÄ;rÈÈh;æ³Æacgã
ã
à½lÈ;ipsླྀã
ã
ánÃ¥á»arôྩt;æÆilrã
©á£ã
®sht;楽;ìð¯Äaoã
·ãrÄduã
½ã
¿Â»Ñ»Ä;láã;楬Ä;vããä;䱯gnsãã¹ã¼htÌahlrstã¤ã°ããã¤ã®rrowÄ;tà¿ãaéãarpoonÄduã»ã¿owîã
¾p»áeftÄahããrrowó࿪arpoonóÕightarrows;æquigarro÷ãhreetimes;æg;äingdotseñἲÆahmãããrò࿪aòÕ;æoustÄ;aããæ±che»ãmid;æ«®Èabptã²ã½ããÄnrã·ãºg;ær;æ¾rëáÆaflãããr;æ¦;ìð£us;樮imes;樵Äapãã§rÄ;gã£ã¤ä©t;æ¦olint;æ¨aròã£Èachqã»ãá¼ã
quo;æºr;ìðÄbuã»ãoÄ;rÈÈÆhirããã reÃ¥ã¸mes;æiÈ;eflãªáá ¡ã«æ¹tri;æ§luhar;楨;æàµ¡ãããã¬ã¸ã±\0ãºã¤\0\0ã¬ã°\0ã¨ãããã±ãã±\0ã\0\0ã³cute;ä
quïâºÔ;Eaceinpsyáã³ãµã¿ããããã¦ã©;檴ǰãº\0ã¼;檸on;ä
¡uÃ¥á¾Ä;dá³ãil;ä
rc;ä
ÆEasããã;檶p;檺im;æ©olint;æ¨iÃá;äotÆ;beã´áµãµæ
;橦ÎAacmstxãããããã£ãrr;ærÄhrããëâ¨Ä;oਸ਼਴tè»Â§ä§i;ä»war;椩mÄinã©Ã°nuóñt;æ¶rÄ;oã¶âìð°Èacoyãããã rp;æ¯Ähyããcy;ä;ärtÉã\0\0ãiäá¤araì⹯è»ÂäÄgmã¨ã´maÆ;fvã±ã²ã²ä;äÐ;deglnprá«ã
ããããã¡ã¦ot;橪Ä;qá±á°Ä;Eããæª;æª Ä;Eããæª;æªe;ælus;樤arr;楲aròá½Èaeitã¸ãããÄlsã½ãlsetméãªhp;樳parsl;槤Ädlá£ãe;æ£Ä;eããæªªÄ;sã¢ã£æª¬;ìâª¬ï¸Æflpã®ã³ãtcy;äÄ;bã¸ã¹ä¯Ä;aã¾ã¿æ§r;æ¿f;ìð¤aÄdrãÐesÄ;uããæ it»ãÆcsuã ã¹ãÄauã¥ã¯pÄ;sáã«;ìâï¸pÄ;sá´ãµ;ìâï¸uÄbpã¿ãÆ;esááãetÄ;eáãñáÆ;esá¨áãetÄ;eá¨ãÃ±á®Æ;afá
»ã¦Ö°rÅ¥ã«Ö±Â»á
¼aròá
Ècemtã¹ã¾ãã
r;ìðtmîñiìãaræá¾ÄarããrÄ;fãá¿æÄanããightÄepã£ãªpsiloîỠhé⺯s»â¡Êbcmnpã»ãáããÒ;Edemnprsãããããã£ã¬ã±ã¶æ;æ«
ot;檽Ä;dáãot;æ«ult;æ«ÄEeã¨ãª;æ«;ælus;檿arr;楹Æeiuã½ããtÆ;enãã
ãqÄ;qáãeqÄ;qã«ã¨m;æ«Äbpãã;æ«;æ«cÌ;acensáã¬ã²ã¹ã»ã¦pproøãºurlyeñá¾Ã±á³Æaesãããpproøãqñãg;æªÚ123;Edehlmnpsã©ã¬ã¯áã²ã´ãããããã¨ãè»Â¹ä¹è»Â²ä²è»Â³ä³;æ«Äosã¹ã¼t;檾ub;æ«Ä;dá¢ã
ot;æ«sÄouããl;æb;æ«arr;楻ult;æ«ÄEeã¤ã¦;æ«;ælus;æ«Æeiuã´ããtÆ;enáã¼ãqÄ;qá¢ã²eqÄ;qã§ã¤m;æ«Äbpãã;æ«;æ«ÆAanãã ãrr;ærÄhrã¦ã¨Ã«â®Ä;oਫ਩war;椪ligè»Ãä௡ããã áã³ã¹\0ã¾ã\0\0\0\0\0ãã\0ãã¬\0\0\0ãɲã\0\0ãget;æ;ärÃ«à¹Æaeyã¦ã«ã°ron;ä
¥dil;ä
£;älrec;ær;ìð±Èeikoãããµã¼Ç²ã\0ãeÄ4fááaÆ;svãããä¸ym;äÄcnã¢ã²kÄasã¨ã®pproøáim»á¬sðáÄasãºã®Ã°árnè»Ã¾ä¾Ç¬Ìãâ§esèÃ;bdãããäÄ;aá¤ãr;樱;樰Æepsã¡ã£ãáâ©È;bcfÒã¬ã°ã´ot;æ¶ir;櫱Ä;oã¹ã¼ìð¥rk;æ«Ã¡ã¢rime;æ´Æaipããã¤dÃ¥áÎadempstã¡ããããããngleÊ;dlqrã°ã±ã¶ããæµown»ᶻeftÄ;eâ ã¾Ã±à¤®;æightÄ;eãªãñáot;æ¬inus;樺lus;樹b;æ§ime;樻ezium;æ¢Æchtã²ã½ãÄryã·ã»;ìð;äcy;ärok;ä
§Äioããxôá·headÄlrãã eftarro÷à¡ightarrow»à½à¤AHabcdfghlmoprstuwãããã¤ã°ã¼ã ã 㠣㠴ã¡ã¡ã¡«ã¢©ã£ã£ã£ªã£¶ròÏar;楣Äcrãã¢uteè»ÃºäºÃ²á
rÇ£ãª\0ãy;äve;ä
Äiyãµãºrcè»Ã»ä»;äÆabhã ã ã ròálac;ä
±aòáÄirã ã sht;楾;ìð²raveè»Ã¹ä¹Å¡ã §ã ±rÄlr㠬㠮»à¥Â»álk;æÄctã ¹ã¡É¯ã ¿\0\0ã¡rnÄ;eã¡
ã¡ær»ã¡op;æri;æ¸Äalã¡ã¡cr;ä
«è»Â¨ÍÄgp㡢㡦on;ä
³f;ìð¦Ìadhlsuá
㡸㡽á²ã¢ã¢ ownáá³arpoonÄlrã¢ã¢efôã ighô㠯iÆ;hlã¢ã¢ã¢ä
»áºon»ã¢parrows;æÆcit㢰ã£ã£É¯ã¢¶\0\0ã£rnÄ;e㢼㢽ær»㢽op;æng;ä
¯ri;æ¹cr;ìðÆdirã£ã£ã£¢ot;æ°lde;ä
©iÄ;fã°ã£¨Â»á Äam㣯㣲rò㢨lè»Ã¼ä¼angle;榧ÞABDacdeflnoprszã¤ã¤ã¤©ã¤ã¦µã¦¸ã¦½ã§ã§¤ã§¨ã§³ã§¹ã§½ã¨ã¨ ròϷarÄ;v㤦㤧櫨;æ«©asèϡÄnr㤲㤷grt;æ¦Îeknprstã£ã¥ã¥ã¥ã¥ã¥¤ã¦appáâothinÃ§áºÆhirã«â»ã¥opô⾵Ä;há·ã¥¢Ã¯ãÄiu㥩ã¥gmáã³Äbp㥲ã¦setneqÄ;q㥽ã¦ìâï¸;ìâ«ï¸setneqÄ;qã¦ã¦ìâï¸;ìâ«ï¸Ährã¦ã¦etáãiangleÄlr㦪㦯eft»थight»áy;ä²ashÂ»á¶Æelrã§ã§ã§Æ;beâ·ªã§ã§ar;æ»q;ælip;æ®Äbtã§á¨aòá©r;ìð³tré㦮suÄbp㧯㧱»à´Â»àµpf;ìð§roð໻tré㦴Äcuã¨ã¨r;ìðÄbpã¨ã¨nÄEeã¦ã¨Â»ã¥¾nÄEeã¦ã¨Â»ã¦igzag;æ¦Îcefoprs㨶㨻ã©ã©ã©ã©¡ã©ªirc;ä
µÄdiã©ã©Äbgã©
ã©ar;æ©eÄ;qáºã©;æerp;ær;ìð´pf;ìð¨Ä;eá¹ã©¦atèá¹cr;ìðà«£áãª\0ãª\0ãªãª\0\0ãªãª¨ãª«ãª¯\0\0ã«ã«\0ã«áátréár;ìðµÄAaãªãªròÏrò৶;ä¾ÄAa㪡㪤ròθrò৫aðâis;æ»Ædptá¤ãªµãª¾Äfl㪺á©;ìð©imÃ¥á²ÄAaã«ã«ròÏròà¨Äcqã«á¸r;ìðÄptáã«réáÐacefiosu㫰㫽ã¬ã¬ã¬ã¬ã¬ã¬¡cÄuyã«¶ã«»teè»Ã½ä½;äÄiyã¬ã¬rc;ä
·;änè»Â¥ä¥r;ìð¶cy;äpf;ìðªcr;ìðÄcm㬦㬩y;älè»Ã¿ä¿Ôacdefhioswããããã¤ã©ãã´ãºã®cute;ä
ºÄayããron;ä
¾;ä·ot;ä
¼Äetãã¡træáa;ä¶r;ìð·cy;ä¶grarr;æpf;ìð«cr;ìðÄjnã®
ã®;æj;æ'.split("").map(
183e=>e.charCodeAt(0))),Aw=new Uint16Array("Èaglq \x15\x18\x1bÉ\x0f\0\0\x12p;ä¦os;ä§t;ä¾t;ä¼uot;ä¢".split("").map(e=>e.charCodeAt(0))),A_=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),AS=null!=(em=String.fromCodePoint)?em:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+=String.fromCharCode(e)};function AE(e){return e>=eg.ZERO&&e<=eg.NINE}(l=eg||(eg={}))[l.NUM=35]="NUM",l[l.SEMI=59]="SEMI",l[l.EQUALS=61]="EQUALS",l[l.ZERO=48]="ZERO",l[l.NINE=57]="NINE",l[l.LOWER_A=97]="LOWER_A",l[l.LOWER_F=102]="LOWER_F",l[l.LOWER_X=120]="LOWER_X",l[l.LOWER_Z=122]="LOWER_Z",l[l.UPPER_A=65]="UPPER_A",l[l.UPPER_F=70]="UPPER_F",l[l.UPPER_Z=90]="UPPER_Z",(u=ey||(ey={}))[u.VALUE_LENGTH=49152]="VALUE_LENGTH",u[u.BRANCH_LENGTH=16256]="BRANCH_LENGTH",u[u.JUMP_TABLE=127]="JUMP_TABLE",(c=ev||(ev={}))[c.EntityStart=0]="EntityStart",c[c.NumericStart=1]="NumericStart",c[c.NumericDecimal=2]="NumericDecimal",c[c.NumericHex=3]="NumericHex",c[c.NamedEntity=4]="NamedEntity",(d=eb||(eb={}))[d.Legacy=0]="Legacy",d[d.Strict=1]="Strict",d[d.Attribute=2]="Attribute";class AC{constructor(e,t,r){this.decodeTree=e,this.emitCodePoint=t,this.errors=r,this.state=ev.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=eb.Strict}startEntity(e){this.decodeMode=e,this.state=ev.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case ev.EntityStart:if(e.charCodeAt(t)===eg.NUM)return this.state=ev.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1);return this.state=ev.NamedEntity,this.stateNamedEntity(e,t);case ev.NumericStart:return this.stateNumericStart(e,t);case ev.NumericDecimal:return this.stateNumericDecimal(e,t);case ev.NumericHex:return this.stateNumericHex(e,t);case ev.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===eg.LOWER_X?(this.state=ev.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=ev.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,r,n){if(t!==r){let i=r-t;
183this.result=this.result*Math.pow(n,i)+parseInt(e.substr(t,i),n),this.consumed+=i}}stateNumericHex(e,t){let r=t;for(;t<e.length;){var n;let i=e.charCodeAt(t);if(!AE(i)&&(!((n=i)>=eg.UPPER_A)||!(n<=eg.UPPER_F))&&(!(n>=eg.LOWER_A)||!(n<=eg.LOWER_F)))return this.addToNumericResult(e,r,t,16),this.emitNumericEntity(i,3);t+=1}return this.addToNumericResult(e,r,t,16),-1}stateNumericDecimal(e,t){let r=t;for(;t<e.length;){let n=e.charCodeAt(t);if(!AE(n))return this.addToNumericResult(e,r,t,10),this.emitNumericEntity(n,2);t+=1}return this.addToNumericResult(e,r,t,10),-1}emitNumericEntity(e,t){var r,n,i;if(this.consumed<=t)return null==(r=this.errors)||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===eg.SEMI)this.consumed+=1;else if(this.decodeMode===eb.Strict)return 0;return this.emitCodePoint((n=this.result)>=55296&&n<=57343||n>1114111?65533:null!=(i=A_.get(n))?i:n,this.consumed),this.errors&&(e!==eg.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:r}=this,n=r[this.treeIndex],i=(n&ey.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=function(e,t,r,n){let i=(t&ey.BRANCH_LENGTH)>>7,a=t&ey.JUMP_TABLE;if(0===i)return 0!==a&&n===a?r:-1;if(a){let t=n-a;return t<0||t>=i?-1:e[r+t]-1}let o=r,s=o+i-1;for(;o<=s;){let t=o+s>>>1,r=e[t];if(r<n)o=t+1;else{if(!(r>n))return e[t+i];s=t-1}}return -1}(r,n,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return 0===this.result||this.decodeMode===eb.Attribute&&(0===i||function(e){var t;return e===eg.EQUALS||(t=e)>=eg.UPPER_A&&t<=eg.UPPER_Z||t>=eg.LOWER_A&&t<=eg.LOWER_Z||AE(t)}(a))?0:this.emitNotTerminatedNamedEntity();if(0!=(i=((n=r[this.treeIndex])&ey.VALUE_LENGTH)>>14)){if(a===eg.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==eb.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return -1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:r}=this,n=(r[t]&ey.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,n,this.consumed),null==(e=this.errors)||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,r){let{decodeTree:n}=this;return this.emitCodePoint(1===t?n[e]&~ey.VALUE_LENGTH:n[e+1],r),3===t&&this.emitCodePoint(n[e+2],r),r}end(){var e;switch(this.state){case ev.NamedEntity:return 0!==this.result&&(this.decodeMode!==eb.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ev.NumericDecimal:return this.emitNumericEntity(0,2);case ev.NumericHex:return this.emitNumericEntity(0,3);case ev.NumericStart:return null==(e=this.errors)||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ev.EntityStart:return 0}}}function A$(e){let t="",r=new AC(e,e=>t+=AS(e));return function(e,n){let i=0,a=0;for(;(a=e.indexOf("&",a))>=0;){t+=e.slice(i,a),r.startEntity(n);let o=r.write(e,a+1);if(o<0){i=a+r.end();break}i=a+o,a=0===o?i+1:i}let o=t+e.slice(i);return t="",o}}let AT=A$(Ak);function AI(e,t=eb.Legacy){return AT(e,t)}A$(Aw);let AN=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]);function AA(e,t){return function(r){let n,i=0,a="";for(;n=e.exec(r);)i!==n.index&&(a+=r.substring(i,n.index)),a+=t.get(n[0].charCodeAt(0)),i=n.index+1;return a+r.substring(i)}}String.prototype.codePointAt,AA(/[&<>'"]/g,AN),AA(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),AA(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]])),(p=ex||(ex={}))[p.XML=0]="XML",p[p.HTML=1]="HTML",(h=ek||(ek={}))[h.UTF8=0]="UTF8",h[h.ASCII=1]="ASCII",h[h.Extensive=2]="Extensive",h[h.Attribute=3]="Attribute",h[h.Text=4]="Text";let Aj=Object.prototype.hasOwnProperty;function AM(e){let t=Array.prototype.slice.call(arguments,1);return t.forEach(function(t){if(t){if("object"!=typeof t)throw TypeError(t+"must be object");Object.keys(t).forEach(function(r){e[r]=t[r]})}}),e}function AO(e,t,r){return[].concat(e.slice(0,t),r,e.slice(t+1))}function AD(e){return(!(e>=55296)||!(e<=57343))&&(!(e>=64976)||!(e<=65007))&&(65535&e)!=65535&&(65535&e)!=65534&&(!(e>=0)||!(e<=8))&&11!==e&&(!(e>=14)||!(e<=31))&&(!(e>=127)||!(e<=159))&&!(e>1114111)&&!0}function AR(e){return e>65535?String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e)):String.fromCharCode(e)}let AP=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Az=RegExp(AP.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),AL=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function AF(e){return 0>e.indexOf("\\")&&0>e.indexOf("&")?e:e.replace(Az,function(e,t,r){if(t)return t;if(35===r.charCodeAt(0)&&AL.test(r)){let t="x"===r[1].toLowerCase()?parseInt(r.slice(2),16):parseInt(r.slice(1),10);return AD(t)?AR(t):e}let n=AI(e);return n!==e?n:e})}let AU=/[&<>"]/,AB=/[&<>"]/g,AZ={"&":"&","<":"<",">":">",'"':"""};function Aq(e){return AZ[e]}function AV(e){return AU.test(e)?e.replace(AB,Aq):e}let AH=/[.?*+^$[\]\\(){}|-]/g;function AK(e){switch(e){case 9:case 32:return!0}return!1}function AW(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function AJ(e){return Ay.test(e)||Av.test(e)}function AG(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case
18361:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function AX(e){return(e=e.trim().replace(/\s+/g," ")).toLowerCase().toUpperCase()}e.s(["arrayReplaceAt",0,AO,"assign",0,AM,"escapeHtml",0,AV,"escapeRE",0,function(e){return e.replace(AH,"\\$&")},"fromCodePoint",0,AR,"has",0,function(e,t){return Aj.call(e,t)},"isMdAsciiPunct",0,AG,"isPunctChar",0,AJ,"isSpace",0,AK,"isString",0,function(e){return"[object String]"===Object.prototype.toString.call(e)},"isValidEntityCode",0,AD,"isWhiteSpace",0,AW,"lib",0,{mdurl:Af,ucmicro:Ax},"normalizeReference",0,AX,"unescapeAll",0,AF,"unescapeMd",0,function(e){return 0>e.indexOf("\\")?e:e.replace(AP,"$1")}],937422);var AY=e.i(937422);e.s([],650919),e.i(650919),e.s(["parseLinkDestination",0,function(e,t,r){let n,i=t,a={ok:!1,pos:0,str:""};if(60===e.charCodeAt(i)){for(i++;i<r&&10!==(n=e.charCodeAt(i))&&60!==n;){if(62===n){a.pos=i+1,a.str=AF(e.slice(t+1,i)),a.ok=!0;break}if(92===n&&i+1<r){i+=2;continue}i++}return a}let o=0;for(;i<r&&32!==(n=e.charCodeAt(i))&&!(n<32)&&127!==n;){if(92===n&&i+1<r){if(32===e.charCodeAt(i+1))break;i+=2;continue}if(40===n&&++o>32)return a;
183if(41===n){if(0===o)break;o--}i++}return t===i||0!==o||(a.str=AF(e.slice(t,i)),a.pos=i,a.ok=!0),a},"parseLinkLabel",0,function(e,t,r){let n,i,a,o,s=e.posMax,l=e.pos;for(e.pos=t+1,n=1;e.pos<s;){if(93===(a=e.src.charCodeAt(e.pos))&&0==--n){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),91===a){if(o===e.pos-1)n++;else if(r)return e.pos=l,-1}}let u=-1;return i&&(u=e.pos),e.pos=l,u},"parseLinkTitle",0,function(e,t,r,n){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)o.str=n.str,o.marker=n.marker;else{if(a>=r)return o;let n=e.charCodeAt(a);if(34!==n&&39!==n&&40!==n)return o;t++,a++,40===n&&(n=41),o.marker=n}for(;a<r;){if((i=e.charCodeAt(a))===o.marker)return o.pos=a+1,o.str+=AF(e.slice(t,a)),o.ok=!0,o;if(40===i&&41===o.marker)return o;92===i&&a+1<r&&a++,a++}return o.can_continue=!0,o.str+=AF(e.slice(t,a)),o}],939414);var AQ=e.i(939414);let A0={};function A1(){this.rules=AM({},A0)}function A2(){this.__rules__=[],this.__cache__=null}function A4(e,t,r){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}function A5(e,t,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=t}A0.code_inline=function(e,t,r,n,i){let a=e[t];return"<code"+i.renderAttrs(a)+">"+AV(a.content)+"</code>"},A0.code_block=function(e,t,r,n,i){let a=e[t];return"<pre"+i.renderAttrs(a)+"><code>"+AV(e[t].content)+"</code></pre>\n"},A0.fence=function(e,t,r,n,i){let a,o=e[t],s=o.info?AF(o.info).trim():"",l="",u="";if(s){let e=s.split(/(\s+)/g);l=e[0],u=e.slice(2).join("")}if(0===(a=r.highlight&&r.highlight(o.content,l,u)||AV(o.content)).indexOf("<pre"))return a+"\n";if(s){let e=o.attrIndex("class"),t=o.attrs?o.attrs.slice():[];return e<0?t.push(["class",r.langPrefix+l]):(t[e]=t[e].slice(),t[e][1]+=" "+r.langPrefix+l),`<pre><code${i.renderAttrs({attrs:t})}>${a}</code></pre> 184`}return`<pre><code${i.renderAttrs(o)}>${a}</code></pre> 185`},A0.image=function(e,t,r,n,i){let a=e[t];return a.attrs[a.attrIndex("alt")][1]=i.renderInlineAsText(a.children,r,n),i.renderToken(e,t,r)},A0.hardbreak=function(e,t,r){return r.xhtmlOut?"<br />\n":"<br>\n"},A0.softbreak=function(e,t,r){return r.breaks?r.xhtmlOut?"<br />\n":"<br>\n":"\n"},A0.text=function(e,t){return AV(e[t].content)},A0.html_block=function(e,t){return e[t].content},A0.html_inline=function(e,t){return e[t].content},A1.prototype.renderAttrs=function(e){let t,r,n;if(!e.attrs)return"";for(t=0,n="",r=e.attrs.length;t<r;t++)n+=" "+AV(e.attrs[t][0])+'="'+AV(e.attrs[t][1])+'"';return n},A1.prototype.renderToken=function(e,t,r){let n=e[t],i="";if(n.hidden)return"";n.block&&-1!==n.nesting&&t&&e[t-1].hidden&&(i+="\n"),i+=(-1===n.nesting?"</":"<")+n.tag,i+=this.renderAttrs(n),0===n.nesting&&r.xhtmlOut&&(i+=" /");let a=!1;if(n.block&&(a=!0,1===n.nesting&&t+1<e.length)){let r=e[t+1];"inline"===r.type||r.hidden?a=!1:-1===r.nesting&&r.tag===n.tag&&(a=!1)}return i+(a?">\n":">")},A1.prototype.renderInline=function(e,t,r){let n="",i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;void 0!==i[o]?n+=i[o](e,a,t,r,this):n+=this.renderToken(e,a,t)}return n},A1.prototype.renderInlineAsText=function(e,t,r){let n="";for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case"text":case"html_inline":case"html_block":n+=e[i].content;break;case"image":n+=this.renderInlineAsText(e[i].children,t,r);break;case"softbreak":case"hardbreak":n+="\n"}return n},A1.prototype.render=function(e,t,r){let n="",i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;"inline"===o?n+=this.renderInline(e[a].children,t,r):void 0!==i[o]?n+=i[o](e,a,t,r,this):n+=this.renderToken(e,a,t,r)}return n},A2.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return -1},A2.prototype.__compile__=function(){let e=this,t=[""];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){0>t.indexOf(e)&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(r){!r.enabled||t&&0>r.alt.indexOf(t)||e.__cache__[t].push(r.fn)})})},A2.prototype.at=function(e,t,r){let n=this.__find__(e);
185if(-1===n)throw Error("Parser rule not found: "+e);this.__rules__[n].fn=t,this.__rules__[n].alt=(r||{}).alt||[],this.__cache__=null},A2.prototype.before=function(e,t,r,n){let i=this.__find__(e);if(-1===i)throw Error("Parser rule not found: "+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:r,alt:(n||{}).alt||[]}),this.__cache__=null},A2.prototype.after=function(e,t,r,n){let i=this.__find__(e);if(-1===i)throw Error("Parser rule not found: "+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:r,alt:(n||{}).alt||[]}),this.__cache__=null},A2.prototype.push=function(e,t,r){this.__rules__.push({name:e,enabled:!0,fn:t,alt:(r||{}).alt||[]}),this.__cache__=null},A2.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let r=[];return e.forEach(function(e){let n=this.__find__(e);if(n<0){if(t)return;throw Error("Rules manager: invalid rule name "+e)}this.__rules__[n].enabled=!0,r.push(e)},this),this.__cache__=null,r},A2.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},A2.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let r=[];return e.forEach(function(e){let n=this.__find__(e);if(n<0){if(t)return;throw Error("Rules manager: invalid rule name "+e)}this.__rules__[n].enabled=!1,r.push(e)},this),this.__cache__=null,r},A2.prototype.getRules=function(e){return null===this.__cache__&&this.__compile__(),this.__cache__[e]||[]},A4.prototype.attrIndex=function(e){if(!this.attrs)return -1;let t=this.attrs;for(let r=0,n=t.length;r<n;r++)if(t[r][0]===e)return r;return -1},A4.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},A4.prototype.attrSet=function(e,t){let r=this.attrIndex(e),n=[e,t];r<0?this.attrPush(n):this.attrs[r]=n},A4.prototype.attrGet=function(e){let t=this.attrIndex(e),r=null;return t>=0&&(r=this.attrs[t][1]),r},A4.prototype.attrJoin=function(e,t){let r=this.attrIndex(e);r<0?this.attrPush([e,t]):this.attrs[r][1]=this.attrs[r][1]+" "+t},A5.prototype.Token=A4;let A6=/\r\n?|\n/g,A3=/\0/g,A9=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,A8=/\((c|tm|r)\)/i,A7=/\((c|tm|r)\)/ig,je={c:"©",r:"®",tm:"â¢"};function jt(e,t){return je[t.toLowerCase()]}let jr=/['"]/,jn=/['"]/g;function ji(e,t,r){return e.slice(0,t)+r+e.slice(t+1)}let ja=[["normalize",function(e){let t;t=(t=e.src.replace(A6,"\n")).replace(A3,"�"),e.src=t}],["block",function(e){let t;e.inlineMode?((t=new e.Token("inline","",0)).content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}],["inline",function(e){let t=e.tokens;for(let r=0,n=t.length;r<n;r++){let n=t[r];"inline"===n.type&&e.md.inline.parse(n.content,e.md,e.env,n.children)}}],["linkify",function(e){let t=e.tokens;if(e.md.options.linkify)for(let i=0,a=t.length;i<a;i++){if("inline"!==t[i].type||!e.md.linkify.pretest(t[i].content))continue;let a=t[i].children,o=0;for(let s=a.length-1;s>=0;s--){let l=a[s];if("link_close"===l.type){for(s--;a[s].level!==l.level&&"link_open"!==a[s].type;)s--;continue}if("html_inline"===l.type){var r,n;r=l.content,/^<a[>\s]/i.test(r)&&o>0&&o--,n=l.content,/^<\/a\s*>/i.test(n)&&o++}if(!(o>0)&&"text"===l.type&&e.md.linkify.test(l.content)){let r=l.content,n=e.md.linkify.match(r),o=[],u=l.level,c=0;n.length>0&&0===n[0].index&&s>0&&"text_special"===a[s-1].type&&(n=n.slice(1));for(let t=0;t<n.length;t++){let i=n[t].url,a=e.md.normalizeLink(i);if(!e.md.validateLink(a))continue;let s=n[t].text;s=n[t].schema?"mailto:"!==n[t].schema||/^mailto:/i.test(s)?e.md.normalizeLinkText(s):e.md.normalizeLinkText("mailto:"+s).replace(/^mailto:/,""):e.md.normalizeLinkText("http://"+s).replace(/^http:\/\//,"");let l=n[t].index;if(l>c){let t=new e.Token("text","",0);t.content=r.slice(c,l),t.level=u,o.push(t)}let d=new e.Token("link_open","a",1);d.attrs=[["href",a]],d.level=u++,d.markup="linkify",d.info="auto",o.push(d);let p=new e.Token("text","",0);p.content=s,p.level=u,o.push(p);let h=new e.Token("link_close","a",-1);h.level=--u,h.markup="linkify",h.info="auto",o.push(h),c=n[t].lastIndex}if(c<r.length){let t=new e.Token("text","",0);t.content=r.slice(c),t.level=u,o.push(t)}t[i].children=a=AO(a,s,o)}}}}],["replacements",function(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)"inline"===e.tokens[t].type&&(A8.test(e.tokens[t].content)&&function(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e[r];"text"!==n.type||t||(n.content=n.content.replace(A7,jt)),"link_open"===n.type&&"auto"===n.info&&t--,"link_close"===n.type&&"auto"===n.info&&t++}}(e.tokens[t].children),A9.test(e.tokens[t].content)&&function(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e[r];"text"===n.type&&!t&&A9.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"â¦").replace(/([?!])â¦/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1â").replace(/(^|\s)--(?=\s|$)/mg,"$1â").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1â")),"link_open"===n.type&&"auto"===n.info&&t--,"link_close"===n.type&&"auto"===n.info&&t++}}(e.tokens[t].children))}],["smartquotes",function(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)"inline"===e.tokens[t].type&&jr.test(e.tokens[t].content)&&function(e,t){let r,n=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i].level;for(r=n.length-1;r>=0&&!(n[r].level<=o);r--);if(n.length=r+1,"text"!==a.type)continue;let s=a.content,l=0,u=s.length;i:for(;l<u;){jn.lastIndex=l;let c=jn.exec(s);if(!c)break;let d=!0,p=!0;l=c.index+1;let h="'"===c[0],f=32;if(c.index-1>=0)f=s.charCodeAt(c.index-1);else for(r=i-1;r>=0&&"softbreak"!==e[r].type&&"hardbreak"!==e[r].type;r--)if(e[r].content){f=e[r].content.charCodeAt(e[r].content.length-1);break}let m=32;if(l<u)m=s.charCodeAt(l);else for(r=i+1;r<e.length&&"softbreak"!==e[r].type&&"hardbreak"!==e[r].type;r++)if(e[r].content){m=e[r].content.charCodeAt(0);break}let g=AG(f)||AJ(String.fromCharCode(f)),y=AG(m)||AJ(String.fromCharCode(m)),v=AW(f),b=AW(m);if(b?d=!1:y&&!(v||g)&&(d=!1),v?p=!1:g&&!(b||y)&&(p=!1),34===m&&'"'===c[0]&&f>=48&&f<=57&&(p=d=!1),d&&p&&(d=g,p=y),!d&&!p){h&&(a.content=ji(a.content,c.index,"â"));continue}if(p)for(r=n.length-1;r>=0;r--){let d=n[r];if(n[r].level<o)break;if(d.single===h&&n[r].level===o){let o,p;d=n[r],h?(o=t.md.options.quotes[2],p=t.md.options.quotes[3]):(o=t.md.options.quotes[0],p=t.md.options.quotes[1]),a.content=ji(a.content,c.index,p),e[d.token].content=ji(e[d.token].content,d.pos,o),l+=p.length-1,d.token===i&&(l+=o.length-1),u=(s=a.content).length,n.length=r;continue i}}d?n.push({token:i,pos:c.index,single:h,level:o}):p&&h&&(a.content=ji(a.content,c.index,"â"))}}}(e.tokens[t].children,e)}],["text_join",function(e){let t,r,n=e.tokens,i=n.length;for(let e=0;e<i;e++){if("inline"!==n[e].type)continue;let i=n[e].children,a=i.length;for(t=0;t<a;t++)"text_special"===i[t].type&&(i[t].type="text");for(t=r=0;t<a;t++)"text"===i[t].type&&t+1<a&&"text"===i[t+1].type?i[t+1].content=i[t].content+i[t+1].content:(t!==r&&(i[r]=i[t]),r++);t!==r&&(i.length=r)}}]];function jo(){this.ruler=new A2;for(let e=0;e<ja.length;e++)this.ruler.push(ja[e][0],ja[e][1])}function js(e,t,r,n){this.src=e,this.md=t,this.env=r,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;let i=this.src;for(let e=0,t=0,r=0,n=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(AK(s)){r++,9===s?n+=4-n%4:n++;continue}else o=!0;(10===s||t===a-1)&&(10!==s&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(r),this.sCount.push(n),this.bsCount.push(0),o=!1,r=0,n=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}function jl(e,t){let r=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];return e.src.slice(r,n)}function ju(e){let t=[],r=e.length,n=0,i=e.charCodeAt(n),a=!1,o=0,s="";for(;n<r;)124===i&&(a?(s+=e.substring(o,n-1),o=n):(t.push(s+e.substring(o,n)),s="",o=n+1)),a=92===i,n++,i=e.charCodeAt(n);return t.push(s+e.substring(o)),t}function jc(e,t){let r=e.eMarks[t],n=e.bMarks[t]+e.tShift[t],i=e.src.charCo
185deAt(n++);return 42!==i&&45!==i&&43!==i||n<r&&!AK(e.src.charCodeAt(n))?-1:n}function jd(e,t){let r=e.bMarks[t]+e.tShift[t],n=e.eMarks[t],i=r;if(i+1>=n)return -1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return -1;for(;;){if(i>=n)return -1;if((a=e.src.charCodeAt(i++))>=48&&a<=57){if(i-r>=10)return -1;continue}if(41===a||46===a)break;return -1}return i<n&&!AK(a=e.src.charCodeAt(i))?-1:i}jo.prototype.process=function(e){let t=this.ruler.getRules("");for(let r=0,n=t.length;r<n;r++)t[r](e)},jo.prototype.State=A5,js.prototype.push=function(e,t,r){let n=new A4(e,t,r);return n.block=!0,r<0&&this.level--,n.level=this.level,r>0&&this.level++,this.tokens.push(n),n},js.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},js.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},js.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&AK(this.src.charCodeAt(e));e++);return e},js.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!AK(this.src.charCodeAt(--e)))return e+1;return e},js.prototype.skipChars=function(e,t){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===t;e++);return e},js.prototype.skipCharsBack=function(e,t,r){if(e<=r)return e;for(;e>r;)if(t!==this.src.charCodeAt(--e))return e+1;return e},js.prototype.getLines=function(e,t,r,n){if(e>=t)return"";let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e,s=0,l=this.bMarks[o],u=l;for(e=o+1<t||n?this.eMarks[o]+1:this.eMarks[o];u<e&&s<r;){let e=this.src.charCodeAt(u);if(AK(e))9===e?s+=4-(s+this.bsCount[o])%4:s++;else if(u-l<this.tShift[o])s++;else break;u++}s>r?i[a]=Array(s-r+1).join(" ")+this.src.slice(u,e):i[a]=this.src.slice(u,e)}return i.join("")},js.prototype.Token=A4;let jp="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",jh="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",jf=RegExp("^(?:"+jp+"|"+jh+"|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),jm=RegExp("^(?:"+jp+"|"+jh+")"),jg=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp("^</?(address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?=(\\s|/?>|$))","i"),/^$/,!0],[RegExp(jm.source+"\\s*$"),/^$/,!1]],jy=[["table",function(e,t,r,n){let i;if(t+2>r)return!1;let a=t+1;if(e.sCount[a]<e.blkIndent||e.sCount[a]-e.blkIndent>=4)return!1;let o=e.bMarks[a]+e.tShift[a];if(o>=e.eMarks[a])return!1;let s=e.src.charCodeAt(o++);if(124!==s&&45!==s&&58!==s||o>=e.eMarks[a])return!1;let l=e.src.charCodeAt(o++);if(124!==l&&45!==l&&58!==l&&!AK(l)||45===s&&AK(l))return!1;for(;o<e.eMarks[a];){let t=e.src.charCodeAt(o);if(124!==t&&45!==t&&58!==t&&!AK(t))return!1;o++}let u=jl(e,t+1),c=u.split("|"),d=[];for(let e=0;e<c.length;e++){let t=c[e].trim();if(!t)if(0===e||e===c.length-1)continue;else return!1;if(!/^:?-+:?$/.test(t))return!1;58===t.charCodeAt(t.length-1)?d.push(58===t.charCodeAt(0)?"center":"right"):58===t.charCodeAt(0)?d.push("left"):d.push("")}if(-1===(u=jl(e,t).trim()).indexOf("|")||e.sCount[t]-e.blkIndent>=4)return!1;(c=ju(u)).length&&""===c[0]&&c.shift(),c.length&&""===c[c.length-1]&&c.pop();let p=c.length;if(0===p||p!==d.length)return!1;if(n)return!0;let h=e.parentType;e.parentType="table";let f=e.md.block.ruler.getRules("blockquote"),m=e.push("table_open","table",1),g=[t,0];m.map=g,e.push("thead_open","thead",1).map=[t,t+1],e.push("tr_open","tr",1).map=[t,t+1];for(let t=0;t<c.length;t++){let r=e.push("th_open","th",1);d[t]&&(r.attrs=[["style","text-align:"+d[t]]]);let n=e.push("inline","",0);n.content=c[t].trim(),n.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let y=0;for(a=t+2;a<r&&!(e.sCount[a]<e.blkIndent);a++){let n=!1;for(let t=0,i=f.length;t<i;t++)if(f[t](e,a,r,!0)){n=!0;break}if(n||!(u=jl(e,a).trim())||e.sCount[a]-e.blkIndent>=4||((c=ju(u)).length&&""===c[0]&&c.shift(),c.length&&""===c[c.length-1]&&c.pop(),(y+=p-c.length)>65536))break;a===t+2&&(e.push("tbody_open","tbody",1).map=i=[t+2,0]),e.push("tr_open","tr",1).map=[a,a+1];for(let t=0;t<p;t++){let r=e.push("td_open","td",1);d[t]&&(r.attrs=[["style","text-align:"+d[t]]]);let n=e.push("inline","",0);n.content=c[t]?c[t].trim():"",n.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return i&&(e.push("tbody_close","tbody",-1),i[1]=a),e.push("table_close","table",-1),g[1]=a,e.parentType=h,e.line=a,!0},["paragraph","reference"]],["code",function(e,t,r){if(e.sCount[t]-e.blkIndent<4)return!1;let n=t+1,i=n;for(;n<r;){if(e.isEmpty(n)){n++;continue}if(e.sCount[n]-e.blkIndent>=4){i=++n;continue}break}e.line=i;let a=e.push("code_block","code",0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+"\n",a.map=[t,e.line],!0}],["fence",function(e,t,r,n){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;
185let o=e.src.charCodeAt(i);if(126!==o&&96!==o)return!1;let s=i,l=(i=e.skipChars(i,o))-s;if(l<3)return!1;let u=e.src.slice(s,i),c=e.src.slice(i,a);if(96===o&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(n)return!0;let d=t,p=!1;for(;!(++d>=r)&&(!((i=s=e.bMarks[d]+e.tShift[d])<(a=e.eMarks[d]))||!(e.sCount[d]<e.blkIndent));){;if(!(e.src.charCodeAt(i)!==o||e.sCount[d]-e.blkIndent>=4||(i=e.skipChars(i,o))-s<l)&&!((i=e.skipSpaces(i))<a)){p=!0;break}}l=e.sCount[t],e.line=d+ +!!p;let h=e.push("fence","code",0);return h.info=c,h.content=e.getLines(t+1,d,l,!0),h.markup=u,h.map=[t,e.line],!0},["paragraph","reference","blockquote","list"]],["blockquote",function(e,t,r,n){let i,a=e.bMarks[t]+e.tShift[t],o=e.eMarks[t],s=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||62!==e.src.charCodeAt(a))return!1;if(n)return!0;let l=[],u=[],c=[],d=[],p=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let f=!1;for(i=t;i<r;i++){let t=e.sCount[i]<e.blkIndent;if((a=e.bMarks[i]+e.tShift[i])>=(o=e.eMarks[i]))break;if(62===e.src.charCodeAt(a++)&&!t){let t,r,n=e.sCount[i]+1;32===e.src.charCodeAt(a)?(a++,n++,r=!1,t=!0):9===e.src.charCodeAt(a)?(t=!0,(e.bsCount[i]+n)%4==3?(a++,n++,r=!1):r=!0):t=!1;let s=n;for(l.push(e.bMarks[i]),e.bMarks[i]=a;a<o;){let t=e.src.charCodeAt(a);if(AK(t))9===t?s+=4-(s+e.bsCount[i]+ +!!r)%4:s++;else break;a++}f=a>=o,u.push(e.bsCount[i]),e.bsCount[i]=e.sCount[i]+1+ +!!t,c.push(e.sCount[i]),e.sCount[i]=s-n,d.push(e.tShift[i]),e.tShift[i]=a-e.bMarks[i];continue}if(f)break;let n=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,r,!0)){n=!0;break}if(n){e.lineMax=i,0!==e.blkIndent&&(l.push(e.bMarks[i]),u.push(e.bsCount[i]),d.push(e.tShift[i]),c.push(e.sCount[i]),e.sCount[i]-=e.blkIndent);break}l.push(e.bMarks[i]),u.push(e.bsCount[i]),d.push(e.tShift[i]),c.push(e.sCount[i]),e.sCount[i]=-1}let m=e.blkIndent;e.blkIndent=0;let g=e.push("blockquote_open","blockquote",1);g.markup=">";let y=[t,0];g.map=y,e.md.block.tokenize(e,t,i),e.push("blockquote_close","blockquote",-1).markup=">",e.lineMax=s,e.parentType=h,y[1]=e.line;for(let r=0;r<d.length;r++)e.bMarks[r+t]=l[r],e.tShift[r+t]=d[r],e.sCount[r+t]=c[r],e.bsCount[r+t]=u[r];return e.blkIndent=m,!0},["paragraph","reference","blockquote","list"]],["hr",function(e,t,r,n){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(42!==o&&45!==o&&95!==o)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!AK(t))return!1;t===o&&s++}if(s<3)return!1;if(n)return!0;e.line=t+1;let l=e.push("hr","hr",0);return l.map=[t,e.line],l.markup=Array(s+1).join(String.fromCharCode(o)),!0},["paragraph","reference","blockquote","list"]],["list",function(e,t,r,n){let i,a,o,s,l,u,c,d=t,p=!0;if(e.sCount[d]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[d]-e.listIndent>=4&&e.sCount[d]<e.blkIndent)return!1;let h=!1;if(n&&"paragraph"===e.parentType&&e.sCount[d]>=e.blkIndent&&(h=!0),(c=jd(e,d))>=0){if(l=!0,o=e.bMarks[d]+e.tShift[d],u=Number(e.src.slice(o,c-1)),h&&1!==u)return!1}else{if(!((c=jc(e,d))>=0))return!1;l=!1}if(h&&e.skipSpaces(c)>=e.eMarks[d])return!1;if(n)return!0;let f=e.src.charCodeAt(c-1),m=e.tokens.length;l?(s=e.push("ordered_list_open","ol",1),1!==u&&(s.attrs=[["start",u]])):s=e.push("bullet_list_open","ul",1);let g=[d,0];s.map=g,s.markup=String.fromCharCode(f);let y=!1,v=e.md.block.ruler.getRules("list"),b=e.parentType;for(e.parentType="list";d<r;){let t;a=c,i=e.eMarks[d];let n=e.sCount[d]+c-(e.bMarks[d]+e.tShift[d]),u=n;for(;a<i;){let t=e.src.charCodeAt(a);if(9===t)u+=4-(u+e.bsCount[d])%4;else if(32===t)u++;else break;a++}let h=a;(t=h>=i?1:u-n)>4&&(t=1);let m=n+t;(s=e.push("list_item_open","li",1)).markup=String.fromCharCode(f);let g=[d,0];s.map=g,l&&(s.info=e.src.slice(o,c-1));let b=e.tight,x=e.tShift[d],k=e.sCount[d],w=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=m,e.tight=!0,e.tShift[d]=h-e.bMarks[d],e.sCount[d]=u,h>=i&&e.isEmpty(d+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,d,r,!0),(!e.tight||y)&&(p=!1),y=e.line-d>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=w,e.tShift[d]=x,e.sCount[d]=k,e.tight=b,(s=e.push("list_item_close","li",-1)).markup=String.fromCharCode(f),d=e.line,g[1]=d,d>=r||e.sCount[d]<e.blkIndent||e.sCount[d]-e.blkIndent>=4)break;let _=!1;for(let t=0,n=v.length;t<n;t++)if(v[t](e,d,r,!0)){_=!0;break}if(_)break;if(l){if((c=jd(e,d))<0)break;o=e.bMarks[d]+e.tShift[d]}else if((c=jc(e,d))<0)break;
185if(f!==e.src.charCodeAt(c-1))break}return(s=l?e.push("ordered_list_close","ol",-1):e.push("bullet_list_close","ul",-1)).markup=String.fromCharCode(f),g[1]=d,e.line=d,e.parentType=b,p&&function(e,t){let r=e.level+2;for(let n=t+2,i=e.tokens.length-2;n<i;n++)e.tokens[n].level===r&&"paragraph_open"===e.tokens[n].type&&(e.tokens[n+2].hidden=!0,e.tokens[n].hidden=!0,n+=2)}(e,m),!0},["paragraph","reference","blockquote"]],["reference",function(e,t,r,n){let i,a=e.bMarks[t]+e.tShift[t],o=e.eMarks[t],s=t+1;if(e.sCount[t]-e.blkIndent>=4||91!==e.src.charCodeAt(a))return!1;function l(t){let r=e.lineMax;if(t>=r||e.isEmpty(t))return null;let n=!1;if(e.sCount[t]-e.blkIndent>3&&(n=!0),e.sCount[t]<0&&(n=!0),!n){let n=e.md.block.ruler.getRules("reference"),i=e.parentType;e.parentType="reference";let a=!1;for(let i=0,o=n.length;i<o;i++)if(n[i](e,t,r,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let u=e.src.slice(a,o+1);o=u.length;let c=-1;for(a=1;a<o;a++){let e=u.charCodeAt(a);if(91===e)return!1;if(93===e){c=a;break}if(10===e){let e=l(s);null!==e&&(u+=e,o=u.length,s++)}else if(92===e&&++a<o&&10===u.charCodeAt(a)){let e=l(s);null!==e&&(u+=e,o=u.length,s++)}}if(c<0||58!==u.charCodeAt(c+1))return!1;for(a=c+2;a<o;a++){let e=u.charCodeAt(a);if(10===e){let e=l(s);null!==e&&(u+=e,o=u.length,s++)}else if(AK(e));else break}let d=e.md.helpers.parseLinkDestination(u,a,o);if(!d.ok)return!1;let p=e.md.normalizeLink(d.str);if(!e.md.validateLink(p))return!1;let h=a=d.pos,f=s,m=a;for(;a<o;a++){let e=u.charCodeAt(a);if(10===e){let e=l(s);null!==e&&(u+=e,o=u.length,s++)}else if(AK(e));else break}let g=e.md.helpers.parseLinkTitle(u,a,o);for(;g.can_continue;){let t=l(s);if(null===t)break;u+=t,a=o,o=u.length,s++,g=e.md.helpers.parseLinkTitle(u,a,o,g)}for(a<o&&m!==a&&g.ok?(i=g.str,a=g.pos):(i="",a=h,s=f);a<o&&AK(u.charCodeAt(a));)a++;if(a<o&&10!==u.charCodeAt(a)&&i)for(i="",a=h,s=f;a<o&&AK(u.charCodeAt(a));)a++;if(a<o&&10!==u.charCodeAt(a))return!1;let y=AX(u.slice(1,c));return!!y&&(!!n||(void 0===e.env.references&&(e.env.references={}),void 0===e.env.references[y]&&(e.env.references[y]={title:i,href:p}),e.line=s,!0))}],["html_block",function(e,t,r,n){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||60!==e.src.charCodeAt(i))return!1;let o=e.src.slice(i,a),s=0;for(;s<jg.length&&!jg[s][0].test(o);s++);if(s===jg.length)return!1;if(n)return jg[s][2];let l=t+1;if(!jg[s][1].test(o)){for(;l<r&&!(e.sCount[l]<e.blkIndent);l++)if(i=e.bMarks[l]+e.tShift[l],a=e.eMarks[l],o=e.src.slice(i,a),jg[s][1].test(o)){0!==o.length&&l++;break}}e.line=l;let u=e.push("html_block","",0);return u.map=[t,l],u.content=e.getLines(t,l,e.blkIndent,!0),!0},["paragraph","reference","blockquote"]],["heading",function(e,t,r,n){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(35!==o||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);35===o&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!AK(o))return!1;if(n)return!0;a=e.skipSpacesBack(a,i);let l=e.skipCharsBack(a,35,i);l>i&&AK(e.src.charCodeAt(l-1))&&(a=l),e.line=t+1;let u=e.push("heading_open","h"+String(s),1);u.markup="########".slice(0,s),u.map=[t,e.line];let c=e.push("inline","",0);return c.content=e.src.slice(i,a).trim(),c.map=[t,e.line],c.children=[],e.push("heading_close","h"+String(s),-1).markup="########".slice(0,s),!0},["paragraph","reference","blockquote"]],["lheading",function(e,t,r){let n,i=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.parentType;e.parentType="paragraph";let o=0,s=t+1;for(;s<r&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],r=e.eMarks[s];if(t<r&&(45===(n=e.src.charCodeAt(t))||61===n)&&(t=e.skipChars(t,n),(t=e.skipSpaces(t))>=r)){o=61===n?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let n=0,a=i.length;n<a;n++)if(i[n](e,s,r,!0)){t=!0;break}if(t)break}if(!o)return!1;let l=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;let u=e.push("heading_open","h"+String(o),1);u.markup=String.fromCharCode(n),u.map=[t,e.line];let c=e.push("inline","",0);return c.content=l,c.map=[t,e.line-1],c.children=[],e.push("heading_close","h"+String(o),-1).markup=String.fromCharCode(n),e.parentType=a,!0}],["paragraph",function(e,t,r){let n=e.md.block.ruler.getRules("paragraph"),i=e.parentType,a=t+1;for(e.parentType="paragraph";a<r&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=n.length;i<o;i++)if(n[i](e,a,r,!0)){t=!0;break}if(t)break}let o=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a,e.push("paragraph_open","p",1).map=[t,e.line];let s=e.push("inline","",0);return s.content=o,s.map=[t,e.line],s.children=[],e.push("paragraph_close","p",-1),e.parentType=i,!0}]];function jv(){this.ruler=new A2;for(let e=0;e<jy.length;e++)this.ruler.push(jy[e][0],jy[e][1],{alt:(jy[e][2]||[]).slice()})}function jb(e,t,r,n){this.src=e,this.env=r,this.md=t,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}jv.prototype.tokenize=function(e,t,r){let n=this.ruler.getRules(""),i=n.length,a=e.md.options.maxNesting,o=t,
185s=!1;for(;o<r&&(e.line=o=e.skipEmptyLines(o),!(o>=r)&&!(e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=r;break}let t=e.line,l=!1;for(let a=0;a<i;a++)if(l=n[a](e,o,r,!1)){if(t>=e.line)throw Error("block rule didn't increment state.line");break}if(!l)throw Error("none of the block rules matched");e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),(o=e.line)<r&&e.isEmpty(o)&&(s=!0,e.line=++o)}},jv.prototype.parse=function(e,t,r,n){if(!e)return;let i=new this.State(e,t,r,n);this.tokenize(i,i.line,i.lineMax)},jv.prototype.State=js,jb.prototype.pushPending=function(){let e=new A4("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e},jb.prototype.push=function(e,t,r){this.pending&&this.pushPending();let n=new A4(e,t,r),i=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(i),n},jb.prototype.scanDelims=function(e,t){let r=this.posMax,n=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32,a=e;for(;a<r&&this.src.charCodeAt(a)===n;)a++;let o=a-e,s=a<r?this.src.charCodeAt(a):32,l=AG(i)||AJ(String.fromCharCode(i)),u=AG(s)||AJ(String.fromCharCode(s)),c=AW(i),d=AW(s),p=!d&&(!u||c||l),h=!c&&(!l||d||u);return{can_open:p&&(t||!h||l),can_close:h&&(t||!p||u),length:o}},jb.prototype.Token=A4;let jx=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i,jk=[];for(let e=0;e<256;e++)jk.push(0);function jw(e,t){let r,n=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(126!==i.marker||-1===i.end)continue;let o=t[i.end];(r=e.tokens[i.token]).type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",(r=e.tokens[o.token]).type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="","text"===e.tokens[o.token-1].type&&"~"===e.tokens[o.token-1].content&&n.push(o.token-1)}for(;n.length;){let t=n.pop(),i=t+1;for(;i<e.tokens.length&&"s_close"===e.tokens[i].type;)i++;t!==--i&&(r=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=r)}}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){jk[e.charCodeAt(0)]=1});function j_(e,t){let r=t.length;for(let n=r-1;n>=0;n--){let r=t[n];if(95!==r.marker&&42!==r.marker||-1===r.end)continue;let i=t[r.end],a=n>0&&t[n-1].end===r.end+1&&t[n-1].marker===r.marker&&t[n-1].token===r.token-1&&t[r.end+1].token===i.token+1,o=String.fromCharCode(r.marker),s=e.tokens[r.token];s.type=a?"strong_open":"em_open",s.tag=a?"strong":"em",s.nesting=1,s.markup=a?o+o:o,s.content="";let l=e.tokens[i.token];l.type=a?"strong_close":"em_close",l.tag=a?"strong":"em",l.nesting=-1,l.markup=a?o+o:o,l.content="",a&&(e.tokens[t[n-1].token].content="",e.tokens[t[r.end+1].token].content="",n--)}}let jS=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,jE=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/,jC=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,j$=/^&([a-z][a-z0-9]{1,31});/i;function jT(e){let t={},r=e.length;if(!r)return;let n=0,i=-2,a=[];for(let o=0;o<r;o++){let r=e[o];if(a.push(0),(e[n].marker!==r.marker||i!==r.token-1)&&(n=o),i=r.token,r.length=r.length||0,!r.close)continue;t.hasOwnProperty(r.marker)||(t[r.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[r.marker][3*!!r.open+r.length%3],l=n-a[n]-1,u=l;for(;l>s;l-=a[l]+1){let t=e[l];if(t.marker===r.marker&&t.open&&t.end<0){let n=!1;if((t.close||r.open)&&(t.length+r.length)%3==0&&(t.length%3!=0||r.length%3!=0)&&(n=!0),!n){let n=l>0&&!e[l-1].open?a[l-1]+1:0;a[o]=o-l+n,a[l]=n,r.open=!1,t.end=o,t.close=!1,u=-1,i=-2;break}}}-1!==u&&(t[r.marker][3*!!r.open+(r.length||0)%3]=u)}}let jI=[["text",function(e,t){let r=e.pos;for(;r<e.posMax&&!function(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}(e.src.charCodeAt(r));)r++;return r!==e.pos&&(t||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}],["linkify",function(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let r=e.pos;if(r+3>
185e.posMax||58!==e.src.charCodeAt(r)||47!==e.src.charCodeAt(r+1)||47!==e.src.charCodeAt(r+2))return!1;let n=e.pending.match(jx);if(!n)return!1;let i=n[1],a=e.md.linkify.matchAtStart(e.src.slice(r-i.length));if(!a)return!1;let o=a.url;if(o.length<=i.length)return!1;let s=o.length;for(;s>0&&42===o.charCodeAt(s-1);)s--;s!==o.length&&(o=o.slice(0,s));let l=e.md.normalizeLink(o);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);let t=e.push("link_open","a",1);t.attrs=[["href",l]],t.markup="linkify",t.info="auto",e.push("text","",0).content=e.md.normalizeLinkText(o);let r=e.push("link_close","a",-1);r.markup="linkify",r.info="auto"}return e.pos+=o.length-i.length,!0}],["newline",function(e,t){let r=e.pos;if(10!==e.src.charCodeAt(r))return!1;let n=e.pending.length-1,i=e.posMax;if(!t)if(n>=0&&32===e.pending.charCodeAt(n))if(n>=1&&32===e.pending.charCodeAt(n-1)){let t=n-1;for(;t>=1&&32===e.pending.charCodeAt(t-1);)t--;e.pending=e.pending.slice(0,t),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(r++;r<i&&AK(e.src.charCodeAt(r));)r++;return e.pos=r,!0}],["escape",function(e,t){let r=e.pos,n=e.posMax;if(92!==e.src.charCodeAt(r)||++r>=n)return!1;let i=e.src.charCodeAt(r);if(10===i){for(t||e.push("hardbreak","br",0),r++;r<n&&AK(i=e.src.charCodeAt(r));)r++;return e.pos=r,!0}let a=e.src[r];if(i>=55296&&i<=56319&&r+1<n){let t=e.src.charCodeAt(r+1);t>=56320&&t<=57343&&(a+=e.src[r+1],r++)}let o="\\"+a;if(!t){let t=e.push("text_special","",0);i<256&&0!==jk[i]?t.content=a:t.content=o,t.markup=o,t.info="escape"}return e.pos=r+1,!0}],["backticks",function(e,t){let r,n=e.pos;if(96!==e.src.charCodeAt(n))return!1;let i=n;n++;let a=e.posMax;for(;n<a&&96===e.src.charCodeAt(n);)n++;let o=e.src.slice(i,n),s=o.length;if(e.backticksScanned&&(e.backticks[s]||0)<=i)return t||(e.pending+=o),e.pos+=s,!0;let l=n;for(;-1!==(r=e.src.indexOf("`",l));){for(l=r+1;l<a&&96===e.src.charCodeAt(l);)l++;let i=l-r;if(i===s){if(!t){let t=e.push("code_inline","code",0);t.markup=o,t.content=e.src.slice(n,r).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=l,!0}e.backticks[i]=r}return e.backticksScanned=!0,t||(e.pending+=o),e.pos+=s,!0}],["strikethrough",function(e,t){let r=e.pos,n=e.src.charCodeAt(r);if(t||126!==n)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(n);if(a<2)return!1;a%2&&(e.push("text","",0).content=o,a--);for(let t=0;t<a;t+=2)e.push("text","",0).content=o+o,e.delimiters.push({marker:n,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}],["emphasis",function(e,t){let r=e.pos,n=e.src.charCodeAt(r);if(t||95!==n&&42!==n)return!1;let i=e.scanDelims(e.pos,42===n);for(let t=0;t<i.length;t++)e.push("text","",0).content=String.fromCharCode(n),e.delimiters.push({marker:n,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}],["link",function(e,t){let r,n,i,a,o="",s="",l=e.pos,u=!0;if(91!==e.src.charCodeAt(e.pos))return!1;let c=e.pos,d=e.posMax,p=e.pos+1,h=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(h<0)return!1;let f=h+1;if(f<d&&40===e.src.charCodeAt(f)){for(u=!1,f++;f<d&&(AK(r=e.src.charCodeAt(f))||10===r);f++);if(f>=d)return!1;if(l=f,(i=e.md.helpers.parseLinkDestination(e.src,f,e.posMax)).ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?f=i.pos:o="",l=f;f<d&&(AK(r=e.src.charCodeAt(f))||10===r);f++);if(i=e.md.helpers.parseLinkTitle(e.src,f,e.posMax),f<d&&l!==f&&i.ok)for(s=i.str,f=i.pos;f<d&&(AK(r=e.src.charCodeAt(f))||10===r);f++);}(f>=d||41!==e.src.charCodeAt(f))&&(u=!0),f++}if(u){if(void 0===e.env.references)return!1;if(f<d&&91===e.src.charCodeAt(f)?(l=f+1,(f=e.md.helpers.parseLinkLabel(e,f))>=0?n=e.src.slice(l,f++):f=h+1):f=h+1,n||(n=e.src.slice(p,h)),!(a=e.env.references[AX(n)]))return e.pos=c,!1;o=a.href,s=a.title}if(!t){e.pos=p,e.posMax=h;let t=e.push("link_open","a",1),r=[["href",o]];t.attrs=r,s&&r.push(["title",s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=f,e.posMax=d,!0}],["image",function(e,t){let r,n,i,a,o,s,l,u,c="",d=e.pos,p=e.posMax;
185if(33!==e.src.charCodeAt(e.pos)||91!==e.src.charCodeAt(e.pos+1))return!1;let h=e.pos+2,f=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(f<0)return!1;if((a=f+1)<p&&40===e.src.charCodeAt(a)){for(a++;a<p&&(AK(r=e.src.charCodeAt(a))||10===r);a++);if(a>=p)return!1;for(u=a,(s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax)).ok&&(c=e.md.normalizeLink(s.str),e.md.validateLink(c)?a=s.pos:c=""),u=a;a<p&&(AK(r=e.src.charCodeAt(a))||10===r);a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<p&&u!==a&&s.ok)for(l=s.str,a=s.pos;a<p&&(AK(r=e.src.charCodeAt(a))||10===r);a++);else l="";if(a>=p||41!==e.src.charCodeAt(a))return e.pos=d,!1;a++}else{if(void 0===e.env.references)return!1;if(a<p&&91===e.src.charCodeAt(a)?(u=a+1,(a=e.md.helpers.parseLinkLabel(e,a))>=0?i=e.src.slice(u,a++):a=f+1):a=f+1,i||(i=e.src.slice(h,f)),!(o=e.env.references[AX(i)]))return e.pos=d,!1;c=o.href,l=o.title}if(!t){n=e.src.slice(h,f);let t=[];e.md.inline.parse(n,e.md,e.env,t);let r=e.push("image","img",0),i=[["src",c],["alt",""]];r.attrs=i,r.children=t,r.content=n,l&&i.push(["title",l])}return e.pos=a,e.posMax=p,!0}],["autolink",function(e,t){let r=e.pos;if(60!==e.src.charCodeAt(r))return!1;let n=e.pos,i=e.posMax;for(;;){if(++r>=i)return!1;let t=e.src.charCodeAt(r);if(60===t)return!1;if(62===t)break}let a=e.src.slice(n+1,r);if(jE.test(a)){let r=e.md.normalizeLink(a);if(!e.md.validateLink(r))return!1;if(!t){let t=e.push("link_open","a",1);t.attrs=[["href",r]],t.markup="autolink",t.info="auto",e.push("text","",0).content=e.md.normalizeLinkText(a);let n=e.push("link_close","a",-1);n.markup="autolink",n.info="auto"}return e.pos+=a.length+2,!0}if(jS.test(a)){let r=e.md.normalizeLink("mailto:"+a);if(!e.md.validateLink(r))return!1;if(!t){let t=e.push("link_open","a",1);t.attrs=[["href",r]],t.markup="autolink",t.info="auto",e.push("text","",0).content=e.md.normalizeLinkText(a);let n=e.push("link_close","a",-1);n.markup="autolink",n.info="auto"}return e.pos+=a.length+2,!0}return!1}],["html_inline",function(e,t){let r;if(!e.md.options.html)return!1;let n=e.posMax,i=e.pos;if(60!==e.src.charCodeAt(i)||i+2>=n)return!1;let a=e.src.charCodeAt(i+1);if(33!==a&&63!==a&&47!==a&&(!((r=32|a)>=97)||!(r<=122)))return!1;let o=e.src.slice(i).match(jf);if(!o)return!1;if(!t){var s,l;let t=e.push("html_inline","",0);t.content=o[0],s=t.content,/^<a[>\s]/i.test(s)&&e.linkLevel++,l=t.content,/^<\/a\s*>/i.test(l)&&e.linkLevel--}return e.pos+=o[0].length,!0}],["entity",function(e,t){let r=e.pos,n=e.posMax;if(38!==e.src.charCodeAt(r)||r+1>=n)return!1;if(35===e.src.charCodeAt(r+1)){let n=e.src.slice(r).match(jC);if(n){if(!t){let t="x"===n[1][0].toLowerCase()?parseInt(n[1].slice(1),16):parseInt(n[1],10),r=e.push("text_special","",0);r.content=AD(t)?AR(t):AR(65533),r.markup=n[0],r.info="entity"}return e.pos+=n[0].length,!0}}else{let n=e.src.slice(r).match(j$);if(n){let r=AI(n[0]);if(r!==n[0]){if(!t){let t=e.push("text_special","",0);t.content=r,t.markup=n[0],t.info="entity"}return e.pos+=n[0].length,!0}}}return!1}]],jN=[["balance_pairs",function(e){let t=e.tokens_meta,r=e.tokens_meta.length;jT(e.delimiters);for(let e=0;e<r;e++)t[e]&&t[e].delimiters&&jT(t[e].delimiters)}],["strikethrough",function(e){let t=e.tokens_meta,r=e.tokens_meta.length;jw(e,e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&jw(e,t[n].delimiters)}],["emphasis",function(e){let t=e.tokens_meta,r=e.tokens_meta.length;j_(e,e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&j_(e,t[n].delimiters)}],["fragments_join",function(e){let t,r,n=0,i=e.tokens,a=e.tokens.length;for(t=r=0;t<a;t++)i[t].nesting<0&&n--,i[t].level=n,i[t].nesting>0&&n++,"text"===i[t].type&&t+1<a&&"text"===i[t+1].type?i[t+1].content=i[t].content+i[t+1].content:(t!==r&&(i[r]=i[t]),r++);t!==r&&(i.length=r)}]];function jA(){this.ruler=new A2;for(let e=0;e<jI.length;e++)this.ruler.push(jI[e][0],jI[e][1]);this.ruler2=new A2;for(let e=0;e<jN.length;e++)this.ruler2.push(jN[e][0],jN[e][1])}function jj(e){let t=Array.prototype.slice.call(arguments,1);return t.forEach(function(t){t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}),e}function jM(e){return Object.prototype.toString.call(e)}function jO(e){return"[object Function]"===jM(e)}function jD(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}jA.prototype.skipToken=function(e){let t=e.pos,r=this.ruler.getRules(""),n=r.length,i=e.md.options.maxNesting,a=e.cache;if(void 0!==a[t]){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<n;i++)if(e.level++,o=r[i](e,!0),e.level--,o){if(t>=e.pos)throw Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;!o&&e.pos++,a[t]=e.pos},jA.prototype.tokenize=function(e){let t=this.ruler.getRules(""),r=t.length,n=e.posMax,i=e.md.options.maxNesting;for(;e.pos<n;){let a=e.pos,o=!1;if(e.level<i){for(let n=0;n<r;n++)if(o=t[n](e,!1)){if(a>=e.pos)throw Error("inline rule didn't increment state.pos");break}}if(o){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},jA.prototype.parse=function(e,t,r,n){let i=new this.State(e,t,r,n);this.tokenize(i);let a=this.ruler2.getRules(""),o=a.length;for(let e=0;e<o;e++)a[e](i)},jA.prototype.State=jb;let jR={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},jP={"http:":{validate:function(e,t,r){let n=e.slice(t);return(r.re.http||(r.re.http=RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n))?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){let n=e.slice(t);return(r.re.no_http||(r.re.no_http=RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n))?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){let n=e.slice(t);return(r.re.mailto||(r.re.mailto=RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n))?n.match(r.re.mailto)[0].length:0}}},jz="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|ÑÑ".split("|");function jL(){return function(e,t){t.normalize(e)}}function jF(e){var t;let r,n,i=(t=e.__opts__,t=t||{},(r={}).src_Any=Am.source,r.src_Cc=Ag.source,r.src_Z=Ab.source,r.src_P=Ay.source,r.src_ZPCc=[r.src_Z,r.src_P,r.src_Cc].join("|"),r.src_ZCc=[r.src_Z,r.src_Cc].join("|"),r.src_pseudo_letter="(?:(?!"+(n="[><ï½]")+"|"+r.src_ZPCc+")"+r.src_Any+")",r.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",r.src_auth="(?:(?:(?!"+r.src_ZCc+"|[@/\\[\\]()]).)+@)?",r.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",r.src_host_terminator="(?=$|"+n+"|"+r.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+r.src_ZPCc+"))",r.src_path="(?:[/?#](?:(?!"+r.src_ZCc+"|"+n+"|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!"+r.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+r.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+r.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+r.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+r.src_ZCc+"|[']).)+\\'|\\'(?="+r.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+r.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+r.src_ZCc+"|$)|;(?!"+r.src_ZCc+"|$)|\\!+(?!"+r.src_ZCc+"|[!]|$)|\\?(?!"+r.src_ZCc+"|[?]|$))+|\\/)?",r.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',r.src_xn="xn--[a-z0-9\\-]{1,59}",r.src_domain_root="(?:"+r.src_xn+"|"+r.src_pseudo_letter+"{1,63})",r.src_domain="(?:"+r.src_xn+"|(?:"+r.src_pseudo_letter+")|(?:"+r.src_pseudo_letter+"(?:-|"+r.src_pseudo_letter+"){0,61}
185"+r.src_pseudo_letter+"))",r.src_host="(?:(?:(?:(?:"+r.src_domain+")\\.)*"+r.src_domain+"))",r.tpl_host_fuzzy="(?:"+r.src_ip4+"|(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%)))",r.tpl_host_no_ip_fuzzy="(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%))",r.src_host_strict=r.src_host+r.src_host_terminator,r.tpl_host_fuzzy_strict=r.tpl_host_fuzzy+r.src_host_terminator,r.src_host_port_strict=r.src_host+r.src_port+r.src_host_terminator,r.tpl_host_port_fuzzy_strict=r.tpl_host_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_port_no_ip_fuzzy_strict=r.tpl_host_no_ip_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+r.src_ZPCc+"|>|$))",r.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+r.src_ZCc+")("+r.src_email_name+"@"+r.tpl_host_fuzzy_strict+")",r.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|ï½]|"+r.src_ZPCc+"))((?![$+<=>^`|ï½])"+r.tpl_host_port_fuzzy_strict+r.src_path+")",r.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|ï½]|"+r.src_ZPCc+"))((?![$+<=>^`|ï½])"+r.tpl_host_port_no_ip_fuzzy_strict+r.src_path+")",e.re=r),a=e.__tlds__.slice();function o(e){return e.replace("%TLDS%",i.src_tlds)}e.onCompile(),e.__tlds_replaced__||a.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),a.push(i.src_xn),i.src_tlds=a.join("|"),i.email_fuzzy=RegExp(o(i.tpl_email_fuzzy),"i"),i.link_fuzzy=RegExp(o(i.tpl_link_fuzzy),"i"),i.link_no_ip_fuzzy=RegExp(o(i.tpl_link_no_ip_fuzzy),"i"),i.host_fuzzy_test=RegExp(o(i.tpl_host_fuzzy_test),"i");let s=[];function l(e,t){throw Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach(function(t){let r=e.__schemas__[t];if(null===r)return;let n={validate:null,link:null};if(e.__compiled__[t]=n,"[object Object]"===jM(r)){if("[object RegExp]"===jM(r.validate)){var i;i=r.validate,n.validate=function(e,t){let r=e.slice(t);return i.test(r)?r.match(i)[0].length:0}}else jO(r.validate)?n.validate=r.validate:l(t,r);jO(r.normalize)?n.normalize=r.normalize:r.normalize?l(t,r):n.normalize=jL();return}"[object String]"===jM(r)?s.push(t):l(t,r)}),s.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[""]={validate:null,normalize:jL()};let u=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(jD).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><ï½]|"+i.src_ZPCc+"))("+u+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><ï½]|"+i.src_ZPCc+"))("+u+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),e.__index__=-1,e.__text_cache__=""}function jU(e,t){let r=e.__index__,n=e.__last_index__,i=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=i,this.text=i,this.url=i}function jB(e,t){let r=new jU(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function jZ(e,t){if(!(this instanceof jZ))return new jZ(e,t);!t&&Object.keys(e||{}).reduce(function(e,t){return e||jR.hasOwnProperty(t)},!1)&&(t=e,e={}),this.__opts__=jj({},jR,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=jj({},jP,e),this.__compiled__={},this.__tlds__=jz,this.__tlds_replaced__=!1,this.re={},jF(this)}jZ.prototype.add=function(e,t){return this.__schemas__[e]=t,jF(this),this},jZ.prototype.set=function(e){return this.__opts__=jj(this.__opts__,e),this},jZ.prototype.test=function(e){let t,r,n,i,a,o,s,l;if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;if(this.re.schema_test.test(e)){for((s=this.re.schema_search).lastIndex=0;null!==(t=s.exec(e));)if(i=this.testSchemaAt(e,t[2],s.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||l<this.__index__)&&null!==(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(a=r.index+r[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__="",this.__index__=a,this.__last_index__=r.index+r[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(a=n.index+n[1].length,o=n.index+n[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=o)),this.__index__>=0},jZ.prototype.pretest=function(e){return this.re.pretest.test(e)},jZ.prototype.testSchemaAt=function(e,t,r){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,r,this):0},jZ.prototype.match=function(e){let t=[],r=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(jB(this,r)),r=this.__last_index__);let n=r?e.slice(r):e;for(;this.test(n);)t.push(jB(this,r)),n=n.slice(this.__last_index__),r+=this.__last_index__;return t.length?t:null},jZ.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let r=this.testSchemaAt(e,t[2],t[0].length);return r?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+r,jB(this,0)):null},jZ.prototype.tlds=function(e,t){return(e=Array.isArray(e)?e:[e],t)?this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,r){return e!==r[t-1]}).reverse():(this.__tlds__=e.slice(),this.__tlds_replaced__=!0),jF(this),this},jZ.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},jZ.prototype.onCompile=function(){};let jq=/^xn--/,jV=/[^\0-\x7F]/,jH=/[\x2E\u3002\uFF0E\uFF61]/g,jK={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >
185= 0x80 (not a basic code point)","invalid-input":"Invalid input"},jW=Math.floor,jJ=String.fromCharCode;function jG(e){throw RangeError(jK[e])}function jX(e,t){let r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+(function(e,t){let r=[],n=e.length;for(;n--;)r[n]=t(e[n]);return r})((e=e.replace(jH,".")).split("."),t).join(".")}let jY=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},jQ=function(e,t,r){let n=0;for(e=r?jW(e/700):e>>1,e+=jW(e/t);e>455;n+=36)e=jW(e/35);return jW(n+36*e/(e+38))},j0=function(e){let t=[],r=e.length,n=0,i=128,a=72,o=e.lastIndexOf("-");o<0&&(o=0);for(let r=0;r<o;++r)e.charCodeAt(r)>=128&&jG("not-basic"),t.push(e.charCodeAt(r));for(let l=o>0?o+1:0;l<r;){let o=n;for(let t=1,i=36;;i+=36){var s;l>=r&&jG("invalid-input");let o=(s=e.charCodeAt(l++))>=48&&s<58?26+(s-48):s>=65&&s<91?s-65:s>=97&&s<123?s-97:36;o>=36&&jG("invalid-input"),o>jW((0x7fffffff-n)/t)&&jG("overflow"),n+=o*t;let u=i<=a?1:i>=a+26?26:i-a;if(o<u)break;let c=36-u;t>jW(0x7fffffff/c)&&jG("overflow"),t*=c}let u=t.length+1;a=jQ(n-o,u,0==o),jW(n/u)>0x7fffffff-i&&jG("overflow"),i+=jW(n/u),n%=u,t.splice(n++,0,i)}return String.fromCodePoint(...t)},j1=function(e){let t=[],r=(e=function(e){let t=[],r=0,n=e.length;for(;r<n;){let i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){let n=e.charCodeAt(r++);(64512&n)==56320?t.push(((1023&i)<<10)+(1023&n)+65536):(t.push(i),r--)}else t.push(i)}return t}(e)).length,n=128,i=0,a=72;for(let r of e)r<128&&t.push(jJ(r));let o=t.length,s=o;for(o&&t.push("-");s<r;){let r=0x7fffffff;for(let t of e)t>=n&&t<r&&(r=t);let l=s+1;for(let u of(r-n>jW((0x7fffffff-i)/l)&&jG("overflow"),i+=(r-n)*l,n=r,e))if(u<n&&++i>0x7fffffff&&jG("overflow"),u===n){let e=i;for(let r=36;;r+=36){let n=r<=a?1:r>=a+26?26:r-a;if(e<n)break;let i=e-n,o=36-n;t.push(jJ(jY(n+i%o,0))),e=jW(i/o)}t.push(jJ(jY(e,0))),a=jQ(i,l,s===o),i=0,++s}++i,++n}return t.join("")},j2={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"ââââ",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"ââââ",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"ââââ",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},j4=/^(vbscript|javascript|file|data):/,j5=/^data:image\/(gif|png|jpeg|webp);/;function j6(e){let t=e.trim().toLowerCase();return!j4.test(t)||j5.test(t)}let j3=["http:","https:","mailto:"];function j9(e){let t=Ah(e,!0);if(t.hostname&&(!t.protocol||j3.indexOf(t.protocol)>=0))try{var r;r=t.hostname,t.hostname=jX(r,function(e){return jV.test(e)?"xn--"+j1(e):e})}catch(e){}return At(Ar(t))}function j8(e){let t=Ah(e,!0);if(t.hostname&&(!t.protocol||j3.indexOf(t.protocol)>=0))try{var r;r=t.hostname,t.hostname=jX(r,function(e){return jq.test(e)?j0(e.slice(4).toLowerCase()):e})}catch(e){}return N7(Ar(t),N7.defaultChars+"%")}function j7(e,t){if(!(this instanceof j7))return new j7(e,t);t||AY.isString(e)||(t=e||{},e="default"),this.inline=new jA,this.block=new jv,this.core=new jo,this.renderer=new A1,this.linkify=new jZ,this.validateLink=j6,this.normalizeLink=j9,this.normalizeLinkText=j8,this.utils=AY,this.helpers=AY.assign({},AQ),this.options={},this.configure(e),t&&this.set(t)}j7.prototype.set=function(e){return AY.assign(this.options,e),this},j7.prototype.configure=function(e){let t=this;if(AY.isString(e)){let t=e;if(!(e=j2[t]))throw Error('Wrong `markdown-it` preset "'+t+'", check name')}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEac
185h(function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)}),this},j7.prototype.enable=function(e,t){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(t){r=r.concat(this[t].ruler.enable(e,!0))},this),r=r.concat(this.inline.ruler2.enable(e,!0));let n=e.filter(function(e){return 0>r.indexOf(e)});if(n.length&&!t)throw Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this},j7.prototype.disable=function(e,t){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(t){r=r.concat(this[t].ruler.disable(e,!0))},this),r=r.concat(this.inline.ruler2.disable(e,!0));let n=e.filter(function(e){return 0>r.indexOf(e)});if(n.length&&!t)throw Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this},j7.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},j7.prototype.parse=function(e,t){if("string"!=typeof e)throw Error("Input data should be a String");let r=new this.core.State(e,this,t);return this.core.process(r),r.tokens},j7.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)},j7.prototype.parseInline=function(e,t){let r=new this.core.State(e,this,t);return r.inlineMode=!0,this.core.process(r),r.tokens},j7.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};let Me=new xL({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["div",["hr"]]},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:e=>["h"+e.attrs.level,0]},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>({params:e.getAttribute("data-params")||""})}],toDOM:e=>["pre",e.attrs.params?{"data-params":e.attrs.params}:{},["code",0]]},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:e=>({order:e.hasAttribute("start")?+e.getAttribute("start"):1,tight:e.hasAttribute("data-tight")})}],toDOM:e=>["ol",{start:1==e.attrs.order?null:e.attrs.order,"data-tight":e.attrs.tight?"true":null},0]},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:e=>({tight:e.hasAttribute("data-tight")})}],toDOM:e=>["ul",{"data-tight":e.attrs.tight?"true":null},0]},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM:()=>["li",0]},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:e=>({src:e.getAttribute("src"),title:e.getAttribute("title"),alt:e.getAttribute("alt")})}],toDOM:e=>["img",e.attrs]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:e=>"em"==e.type.name}],toDOM:()=>["em"]},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:()=>["strong"]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href"),title:e.getAttribute("title")})}],toDOM:e=>["a",e.attrs]},code:{code:!0,parseDOM:[{tag:"code"}],toDOM:()=>["code"]}}});class Mt{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:xu.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),r=t.content,n=r[r.length-1],i=this.schema.text(e,t.marks),a;
185n&&(a=function(e,t){if(e.isText&&t.isText&&xu.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}(n,i))?r[r.length-1]=a:r.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let r=e[t],n=this.tokenHandlers[r.type];if(!n)throw Error("Token type `"+r.type+"` not supported by Markdown parser");n(this,r,e,t)}}addNode(e,t,r){let n=this.top(),i=e.createAndFill(t,r,n?n.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:xu.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function Mr(e,t,r,n){return e.getAttrs?e.getAttrs(t,r,n):e.attrs instanceof Function?e.attrs(t):e.attrs}function Mn(e,t){return e.noCloseToken||"code_inline"==t||"code_block"==t||"fence"==t}function Mi(e){return"\n"==e[e.length-1]?e.slice(0,e.length-1):e}function Ma(){}function Mo(e,t){for(;++t<e.length;)if("list_item_open"!=e[t].type)return e[t].hidden;return!1}new class{constructor(e,t,r){this.schema=e,this.tokenizer=t,this.tokens=r,this.tokenHandlers=function(e,t){let r=Object.create(null);for(let n in t){let i=t[n];if(i.block){let t=e.nodeType(i.block);Mn(i,n)?r[n]=(e,r,n,a)=>{e.openNode(t,Mr(i,r,n,a)),e.addText(Mi(r.content)),e.closeNode()}:(r[n+"_open"]=(e,r,n,a)=>e.openNode(t,Mr(i,r,n,a)),r[n+"_close"]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);r[n]=(e,r,n,a)=>e.addNode(t,Mr(i,r,n,a))}else if(i.mark){let t=e.marks[i.mark];Mn(i,n)?r[n]=(e,r,n,a)=>{e.openMark(t.create(Mr(i,r,n,a))),e.addText(Mi(r.content)),e.closeMark(t)}:(r[n+"_open"]=(e,r,n,a)=>e.openMark(t.create(Mr(i,r,n,a))),r[n+"_close"]=e=>e.closeMark(t))}else if(i.ignore)Mn(i,n)?r[n]=Ma:(r[n+"_open"]=Ma,r[n+"_close"]=Ma);else throw RangeError("Unrecognized parsing spec "+JSON.stringify(i))}return r.text=(e,t)=>e.addText(t.content),r.inline=(e,t)=>e.parseTokens(t.children),r.softbreak=r.softbreak||(e=>e.addText(" ")),r}(e,r)}parse(e,t={}){let r=new Mt(this.schema,this.tokenHandlers),n;r.parseTokens(this.tokenizer.parse(e,t));do n=r.closeNode();while(r.stack.length)return n||this.schema.topNodeType.createAndFill()}}(Me,j7("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(e,t,r)=>({tight:Mo(t,r)})},ordered_list:{block:"ordered_list",getAttrs:(e,t,r)=>({order:+e.attrGet("start")||1,tight:Mo(t,r)})},heading:{block:"heading",getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:e=>({params:e.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:e=>({src:e.attrGet("src"),title:e.attrGet("title")||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:e=>({href:e.attrGet("href"),title:e.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}});let Ms={open:"",close:"",mixable:!0},Ml=new class{constructor(e,t,r={}){this.nodes=e,this.marks=t,this.options=r}serialize(e,t={}){t=Object.assign({},this.options,t);let r=new Mc(this.nodes,this.marks,t);return r.renderContent(e),r.out}}({blockquote(e,t){e.wrapBlock("> ",null,t,()=>e.renderContent(t))},code_block(e,t){let r=t.textContent.match(/`{3,}/gm),n=r?r.sort().slice(-1)[0]+"`":"```";e.write(n+(t.attrs.params||"")+"\n"),e.text(t.textContent,!1),e.write("\n"),e.write(n),e.closeBlock(t)},heading(e,t){e.write(e.repeat("#",t.attrs.level)+" "),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||"---"),e.closeBlock(t)},bullet_list(e,t){e.renderList(t," ",()=>(t.attrs.bullet||"*")+" ")},ordered_list(e,t){let r=t.attrs.order||1,n=String(r+t.childCount-1).length,i=e.repeat(" ",n+2);e.renderList(t,i,t=>{let i=String(r+t);return e.repeat(" ",n-i.length)+i+". "})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write("]/g,"\\$&")+(t.attrs.title?' "'+t.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(e,t,r,n){for(let i=n+1;i<r.childCount;i++)if(r.child(i).type!=t.type)return void e.write("\\\n")},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open:(e,t,r,n)=>(e.inAutolink=function(e,t,r){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let n=t.child(r);return!!n.isText&&n.text==e.attrs.href&&n.marks[n.marks.length-1]==e&&(r==t.childCount-1||!e.isInSet(t.child(r+1).marks))}(t,r,n),e.inAutolink?"<":"["),close(e,t,r,n){let{inAutolink:i}=e;return e.inAutolink=void 0,i?">":"]("+t.attrs.href.replace(/[\(\)"]/g,"\\$&")+(t.attrs.title?` "${t.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open:(e,t,r,n)=>Mu(r.child(n),-1),close:(e,t,r,n)=>Mu(r.child(n-1),1),escape:!1}});function Mu(e,t){let r=/`+/g,n,i=0;if(e.isText)for(;n=r.exec(e.text);)i=Math.max(i,n[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=" "),a}class Mc{constructor(e,t,r){this.nodes=e,this.marks=t,this.options=r,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,void 0===this.options.tightLists&&(this.options.tightLists=!1),void 0===this.options.hardBreakNodeName&&(this.options.hardBreakNodeName="hard_break")}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+="\n"),e>1){let t=this.delim,r=/\s+$/.exec(t);r&&(t=t.slice(0,t.length-r[0].length));for(let r=1;r<e;r++)this.out+=t+"\n"}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(!1!==this.options.strict)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=Ms}return t}wrapBlock(e,t,r,n){let i=this.delim;this.write(null!=t?t:e),this.delim+=e,n(),this.delim=i,this.closeBlock(r)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+="\n")}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let r=e.split("\n");for(let e=0;e<r.length;e++)this.write(),!t&&"["==r[e][0]&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+"\\!"),this.out+=t?this.esc(r[e],this.atBlockStart):r[e],e!=r.length-1&&(this.out+="\n")}render(e,t,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,r);else if(!1!==this.options.strict)throw Error("Token type `"+e.type.n
185ame+"` not supported by Markdown renderer");else!e.type.isLeaf&&(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,r,n)=>this.render(t,e,n))}renderInline(e,t=!0){this.atBlockStart=t;let r=[],n="",i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let r=e.child(a+1);return t.isInSet(r.marks)&&(!r.isText||/\S/.test(r.text))}));let s=n;if(n="",t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(r)})){let[e,n,i]=/^(\s*)(.*)$/m.exec(t.text);n&&(s+=n,(t=i?t.withText(i):null)||(o=r))}if(t&&t.isText&&o.some(t=>{let r=this.getMark(t.type.name);return r&&r.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(n=a,(t=i?t.withText(i):null)||(o=r))}let l=o.length?o[o.length-1]:null,u=l&&!1===this.getMark(l.type.name).escape,c=o.length-!!u;r:for(let e=0;e<c;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let n=0;n<r.length;n++){let i=r[n];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>n?o=o.slice(0,n).concat(t).concat(o.slice(n,e)).concat(o.slice(e+1,c)):n>e&&(o=o.slice(0,e).concat(o.slice(e+1,n)).concat(t).concat(o.slice(n,c)));continue r}}}let d=0;for(;d<Math.min(r.length,c)&&o[d].eq(r[d]);)++d;for(;d<r.length;)this.text(this.markString(r.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;r.length<c;){let t=o[r.length];r.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}u&&t.isText?this.text(this.markString(l,!0,e,a)+t.text+this.markString(l,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}(null==t?void 0:t.isText)&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let n=void 0!==e.attrs.tight?e.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=n,e.forEach((i,a,o)=>{o&&n&&this.flushClose(1),this.wrapBlock(t,r(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,r)=>"_"==t&&r>0&&r+1<e.length&&e[r-1].match(/\w/)&&e[r+1].match(/\w/)?t:"\\"+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let t=-1==e.indexOf('"')?'""':-1==e.indexOf("'")?"''":"()";return t[0]+e+t[1]}repeat(e,t){let r="";for(let n=0;n<t;n++)r+=e;return r}markString(e,t,r,n){let i=this.getMark(e.type.name),a=t?i.open:i.close;return"string"==typeof a?a:a(this,e,r,n)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,r){for(;;t++){if(t>=e.childCount)return!1;let n=e.child(t);if(n.type.name!=this.options.hardBreakNodeName)return r.isInSet(n.marks);t++}}}var Md=e.i(696736),Mp=Object.defineProperty,Mh=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?Mp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let Mf=C6.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>"true"===e.getAttribute("data-tight")||!e.querySelector("p"),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?"true":null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r=>{let{editor:n,commands:i}=r;return e.options.listTypes.some(e=>(function(e){if(!n.isActive(e))return!1;let r=n.getAttributes(e);return i.updateAttributes(e,{tight:null!=t?t:!(null!=r&&r.tight)})})(e))}}}}}),Mm=j7();function Mg(e,t){return Mm.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new Mm.inline.State(e,null,null,[]).scanDelims(t,!0)}function My(e,t,r,n){let i=e.substring(0,r)+e.substring(r+t.length);return i.substring(0,r+n)+t+i.substring(r+n)}class Mv extends Mc{constructor(e,t,r){super(e,t,null!=r?r:{}),Mh(this,"inTable",!1),this.inlines=[]}render(e,t,r){super.render(e,t,r);
185let n=this.inlines[this.inlines.length-1];if(null!=n&&n.start&&null!=n&&n.end){var i;let e,{delimiter:t,start:r,end:a}=this.normalizeInline(n);this.out=(i=this.out,(e=function(e,t,r,n){let i=n,a=e;for(;i>r&&!Mg(a,i).can_close;)a=My(a,t,i,-1),i--;return{text:a,from:r,to:i}}((e=function(e,t,r,n){let i=r,a=e;for(;i<n&&!Mg(a,i).can_open;)a=My(a,t,i,1),i++;return{text:a,from:i,to:n}}((e={text:i,from:r,to:a}).text,t,e.from,e.to)).text,t,e.from,e.to)).to-e.from<t.length+1&&(e.text=e.text.substring(0,e.from)+e.text.substring(e.to+t.length)),e.text),this.inlines.pop()}}markString(e,t,r,n){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,r,n)}normalizeInline(e){let{start:t,end:r}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}}let Mb=C0.create({name:"markdownHTMLMark",addStorage:()=>({markdown:{serialize:{open(e,t){var r,n;return this.editor.storage.markdown.options.html?null!=(r=null==(n=Mx(t))?void 0:n[0])?r:"":(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),"")},close(e,t){var r,n;return this.editor.storage.markdown.options.html&&null!=(r=null==(n=Mx(t))?void 0:n[1])?r:""}},parse:{}}})});function Mx(e){let t=e.type.schema,r=t.text(" ",[e]),n=E9(xa.from(r),t).match(/^(<.*?>) (<\/.*?>)$/);return n?[n[1],n[2]]:null}function Mk(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,"text/html").body}let Mw=$w.create({name:"markdownHTMLNode",addStorage:()=>({markdown:{serialize(e,t,r){var n,i;let a,o,s;this.editor.storage.markdown.options.html?e.write((n=t,i=r,a=n.type.schema,o=E9(xa.from(n),a),n.isBlock&&(i instanceof xa||i.type.name===a.topNodeType.name)?((s=Mk(o).firstElementChild).innerHTML=s.innerHTML.trim()?` 186${s.innerHTML} 187`:` 188`,s.outerHTML):o)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}})}),M_=$w.create({name:"blockquote"}).extend({addStorage:()=>({markdown:{serialize:Ml.nodes.blockquote,parse:{}}})}),MS=$w.create({name:"bulletList"}).extend({addStorage:()=>({markdown:{serialize(e,t){return e.renderList(t," ",()=>(this.editor.storage.markdown.options.bulletListMarker||"-")+" ")},parse:{}}})}),ME=$w.create({name:"codeBlock"}).extend({addStorage:()=>({markdown:{serialize(e,t){e.write("```"+(t.attrs.language||"")+"\n"),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){var t;e.set({langPrefix:null!=(t=this.options.languageClassPrefix)?t:"language-"})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}})}),MC=$w.create({name:"hardBreak"}).extend({addStorage:()=>({markdown:{serialize(e,t,r,n){for(let i=n+1;i<r.childCount;i++)if(r.child(i).type!=t.type)return void e.write(e.inTable?Mw.storage.markdown.serialize.call(this,e,t,r):"\\\n")},parse:{}}})}),M$=$w.create({name:"heading"}).extend({addStorage:()=>({markdown:{serialize:Ml.nodes.heading,parse:{}}})}),MT=$w.create({name:"horizontalRule"}).extend({addStorage:()=>({markdown:{serialize:Ml.nodes.horizontal_rule,parse:{}}})}),MI=$w.create({name:"image"}).extend({addStorage:()=>({markdown:{serialize:Ml.nodes.image,parse:{}}})}),MN=$w.create({name:"listItem"}).extend({addStorage:()=>({markdown:{serialize:Ml.nodes.list_item,parse:{}}})}),MA=$w.create({name:"orderedList"}).extend({addStorage:()=>({markdown:{serialize(e,t,r,n){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(" ",a+2),s=function(e,t,r){let n=0;for(;r-n>0&&t.child(r-n-1).type.name===e.type.name;n++);return n}(t,r,n)%2?") ":". ";e.renderList(t,o,t=>{let r=String(i+t);return e.repeat(" ",a-r.length)+r+s})},parse:{}}})}),Mj=$w.create({name:"paragraph"}).extend({addStorage:()=>({markdown:{serialize:Ml.nodes.paragraph,parse:{}}})});function MM(e){var t,r;return null!=(t=null==e||null==(r=e.content)?void 0:r.content)?t:[]}let MO=$w.create({name:"table"}).extend({addStorage:()=>({markdown:{serialize(e,t,r){let n,i,a;(i=(n=MM(t))[0],a=n.slice(1),MM(i).some(e=>
188"tableHeader"!==e.type.name||MD(e)||e.childCount>1)||a.some(e=>MM(e).some(e=>"tableHeader"===e.type.name||MD(e)||e.childCount>1)))?Mw.storage.markdown.serialize.call(this,e,t,r):(e.inTable=!0,t.forEach((t,r,n)=>{if(e.write("| "),t.forEach((t,r,n)=>{n&&e.write(" | ");let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(" |"),e.ensureNewLine(),!n){let r=Array.from({length:t.childCount}).map(()=>"---").join(" | ");e.write(`| ${r} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1)},parse:{}}})});function MD(e){return e.attrs.colspan>1||e.attrs.rowspan>1}let MR=$w.create({name:"taskItem"}).extend({addStorage:()=>({markdown:{serialize(e,t){let r=t.attrs.checked?"[x]":"[ ]";e.write(`${r} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(".task-list-item")].forEach(e=>{let t=e.querySelector("input");e.setAttribute("data-type","taskItem"),t&&(e.setAttribute("data-checked",t.checked),t.remove())})}}}})}),MP=$w.create({name:"taskList"}).extend({addStorage:()=>({markdown:{serialize:MS.storage.markdown.serialize,parse:{setup(e){e.use(Md.default)},updateDOM(e){[...e.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}})}),Mz=[M_,MS,ME,MC,M$,MT,Mw,MI,MN,MA,Mj,MO,MR,MP,$w.create({name:"text"}).extend({addStorage:()=>({markdown:{serialize(e,t){var r;e.text(null==(r=t.text)?void 0:r.replace(/</g,"<").replace(/>/g,">"))},parse:{}}})}),C0.create({name:"bold"}).extend({addStorage:()=>({markdown:{serialize:Ml.marks.strong,parse:{}}})}),C0.create({name:"code"}).extend({addStorage:()=>({markdown:{serialize:Ml.marks.code,parse:{}}})}),Mb,C0.create({name:"italic"}).extend({addStorage:()=>({markdown:{serialize:Ml.marks.em,parse:{}}})}),C0.create({name:"link"}).extend({addStorage:()=>({markdown:{serialize:Ml.marks.link,parse:{}}})}),C0.create({name:"strike"}).extend({addStorage:()=>({markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}})})];function ML(e){var t,r;let n=null==(t=e.storage)?void 0:t.markdown,i=null==(r=Mz.find(t=>t.name===e.name))?void 0:r.storage.markdown;return n||i?{...i,...n}:null}class MF{constructor(e){Mh(this,"editor",null),this.editor=e}serialize(e){let t=new Mv(this.nodes,this.marks,{hardBreakNodeName:MC.name});return t.renderContent(e),t.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(Mw)])),...Object.fromEntries(null!=(e=this.editor.extensionManager.extensions.filter(e=>"node"===e.type&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)]))?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(Mb)])),...Object.fromEntries(null!=(e=this.editor.extensionManager.extensions.filter(e=>"mark"===e.type&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)]))?e:[])}}serializeNode(e){var t;return null==(t=ML(e))||null==(t=t.serialize)?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){var t;let r=null==(t=ML(e))?void 0:t.serialize;return r?{...r,open:"function"==typeof r.open?r.open.bind({editor:this.editor,options:e.options}):r.open,close:"function"==typeof r.close?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class MU{constructor(e,t){Mh(this,"editor",null),Mh(this,"md",null);let{html:r,linkify:n,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(j7({html:r,linkify:n,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){this.editor.extensionManager.extensions.forEach(e=>{var t;return null==(t=ML(e))||null==(t=t.parse)||null==(t=t.setup)?void 0:t.call({editor:this.editor,options:e.options},this.md)});let r=Mk(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return null==(t=ML(e))||null==(t=t.parse)||null==(t=t.updateDOM)?void 0:t.call({editor:this.editor,options:e.options},r)}),this.normalizeDOM(r,{inline:t,content:e}),r.innerHTML}return e}normalizeDOM(e,t){let{inline:r,content:n}=t;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(e
188=>{var t;(null==(t=e.nextSibling)?void 0:t.nodeType)!==Node.TEXT_NODE||e.closest("pre")||(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,n),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>{var t;return null==(t=e.spec.parseDOM)?void 0:t.map(e=>e.tag)}).flat().filter(Boolean).join(",");t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches("p")&&function(e){let t=e.parentElement,r=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)r.appendChild(t.firstChild);r.childNodes.length>0&&t.parentElement.insertBefore(r,t),t.parentElement.insertBefore(e,t),0===t.childNodes.length&&t.remove()}(e)})}normalizeInline(e,t){var r,n,i,a,o;if(null!=(r=e.firstElementChild)&&r.matches("p")){let r=e.firstElementChild,{nextElementSibling:s}=r,l=null!=(n=null==(i=t.match(/^\s+/))?void 0:i[0])?n:"",u=s?"":null!=(a=null==(o=t.match(/\s+$/))?void 0:o[0])?a:"";if(t.match(/^\n\n/)){r.innerHTML=`${r.innerHTML}${u}`;return}let c=r.parentNode;for(;r.firstChild;)c.insertBefore(r.firstChild,r);c.removeChild(r),e.innerHTML=`${l}${e.innerHTML}${u}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return"\n"===t?t:"\n"===t[t.length-1]?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}}let MB=C6.create({name:"markdownClipboard",addOptions:()=>({transformPastedText:!1,transformCopiedText:!1}),addProseMirrorPlugins(){return[new kK({key:new kG("markdownClipboard"),props:{clipboardTextParser:(e,t,r)=>{if(r||!this.options.transformPastedText)return null;let n=this.editor.storage.markdown.parser.parse(e,{inline:!0});return xU.fromSchema(this.editor.schema).parseSlice(Mk(n),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),MZ=C6.create({name:"markdown",priority:50,addOptions:()=>({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}),addCommands(){let e=C5.Commands.config.addCommands();return{setContent:(t,r)=>n=>e.setContent(n.editor.storage.markdown.parser.parse(t),r)(n),insertContentAt:(t,r,n)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(r,{inline:!0}),n)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new MU(this.editor,this.options),serializer:new MF(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage:()=>({}),addExtensions(){return[Mf.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),MB.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});var Mq=e.i(482568);let MV=(0,y6.default)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),MH=(0,y6.default)("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);var MK=e.i(963032),MW=e.i(267750),MJ=e.i(866411),MG=e.i(162468),MX=e.i(263488);let MY={pdf:{color:"#EC1C24",label:"PDF"},docx:{color:"#2B579A",label:"W"},odt:{color:"#18A303",label:"ODT"},xlsx:{color:"#217346",label:"X"},pptx:{color:"#B7472A",label:"P"},md:{color:"#083FA1",label:"Mâ"}};function MQ({format:e,className:t="h-5 w-5"}){let{color:r,label:n}=MY[e],i=n.length<=1?13:n.length<=2?10:7.5;return(0,ew.jsxs)("svg",{viewBox:"0 0 20 20",className:t,"aria-hidden":!0,
188children:[(0,ew.jsx)("rect",{x:"1",y:"1",width:"18",height:"18",rx:"3",fill:r}),(0,ew.jsx)("text",{x:"10",y:"10",textAnchor:"middle",dominantBaseline:"central",fontSize:i,fontWeight:"700",fill:"#fff",fontFamily:"system-ui, -apple-system, sans-serif",children:n})]})}function M0({className:e="h-5 w-5"}){return(0,ew.jsx)(MX.Mail,{className:e,style:{color:"#D93025"},"aria-hidden":!0})}function M1({className:e="h-5 w-5"}){return(0,ew.jsx)(v_.Share2,{className:e,style:{color:"#007AFF"},"aria-hidden":!0})}function M2({onClick:e,active:t,disabled:r,label:n,title:i,children:a}){return(0,ew.jsx)("button",{type:"button",onClick:e,disabled:r,"aria-label":n,title:i??n,className:(0,v7.cn)("rounded p-1.5 transition-colors disabled:opacity-40",t?"bg-gray-200 text-gray-900 dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-200"),children:a})}function M4(){return(0,ew.jsx)("div",{className:"mx-1 h-5 w-px bg-gray-200 dark:bg-gray-700"})}let M5=(0,y6.default)("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),M6=(0,y6.default)("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),M3=(0,y6.default)("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),M9=(0,y6.default)("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]),M8=(0,y6.default)("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]),M7=(0,y6.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Oe=(0,y6.default)("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]),Ot=(0,y6.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);function Or({editor:e,t,onSetLink:r}){return(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleBold().run(),active:e.isActive("bold"),label:t("bold"),children:(0,ew.jsx)(M5,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleItalic().run(),active:e.isActive("italic"),label:t("italic"),children:(0,ew.jsx)(M6,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M4,{}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleHeading({level:1}).run(),active:e.isActive("heading",{level:1}),label:"H1",children:(0,ew.jsx)(M3,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),active:e.isActive("heading",{level:2}),label:"H2",children:(0,ew.jsx)(M9,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleHeading({level:3}).run(),active:e.isActive("heading",{level:3}),label:"H3",children:(0,ew.jsx)(M8,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M4,{}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleBulletList().run(),active:e.isActive("bulletList"),label:t("bulletList"),children:(0,ew.jsx)(M7,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleOrderedList().run(),active:e.isActive("orderedList"),label:t("orderedList"),children:(0,ew.jsx)(vg.ListOrdered,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M4,{}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleBlockquote().run(),active:e.isActive("blockquote"),label:t("quote"),children:(0,ew.jsx)(Oe,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:()=>e.chain().focus().toggleCodeBlock().run(),active:e.isActive("codeBlock"),label:t("code"),children:(0,ew.jsx)(y8.Code,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:r,active:e.isActive("link"),label:t("link"),
188children:(0,ew.jsx)(Ot,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]})}var On=e.i(265169),Oi=e.i(925616);function Oa({editor:e,onSetLink:t,disabled:r=!1}){let n=(0,eS.useTranslations)("editResponse"),i=(0,eS.useTranslations)("textEditor"),a=[{label:n("bold"),icon:(0,ew.jsx)(M5,{className:"h-5 w-5"}),active:e.isActive("bold"),onTap:()=>e.chain().focus().toggleBold().run()},{label:n("italic"),icon:(0,ew.jsx)(M6,{className:"h-5 w-5"}),active:e.isActive("italic"),onTap:()=>e.chain().focus().toggleItalic().run(),divider:!0},{label:"H1",icon:(0,ew.jsx)(M3,{className:"h-5 w-5"}),active:e.isActive("heading",{level:1}),onTap:()=>e.chain().focus().toggleHeading({level:1}).run()},{label:"H2",icon:(0,ew.jsx)(M9,{className:"h-5 w-5"}),active:e.isActive("heading",{level:2}),onTap:()=>e.chain().focus().toggleHeading({level:2}).run()},{label:"H3",icon:(0,ew.jsx)(M8,{className:"h-5 w-5"}),active:e.isActive("heading",{level:3}),onTap:()=>e.chain().focus().toggleHeading({level:3}).run(),divider:!0},{label:n("bulletList"),icon:(0,ew.jsx)(M7,{className:"h-5 w-5"}),active:e.isActive("bulletList"),onTap:()=>e.chain().focus().toggleBulletList().run()},{label:n("orderedList"),icon:(0,ew.jsx)(vg.ListOrdered,{className:"h-5 w-5"}),active:e.isActive("orderedList"),onTap:()=>e.chain().focus().toggleOrderedList().run()},{label:n("quote"),icon:(0,ew.jsx)(Oe,{className:"h-5 w-5"}),active:e.isActive("blockquote"),onTap:()=>e.chain().focus().toggleBlockquote().run()},{label:n("code"),icon:(0,ew.jsx)(y8.Code,{className:"h-5 w-5"}),active:e.isActive("codeBlock"),onTap:()=>e.chain().focus().toggleCodeBlock().run()},{label:n("link"),icon:(0,ew.jsx)(Ot,{className:"h-5 w-5"}),active:e.isActive("link"),onTap:t,divider:!0},{label:i("undo"),icon:(0,ew.jsx)(MV,{className:"h-5 w-5"}),active:!1,onTap:()=>e.chain().focus().undo().run(),disabled:!e.can().undo()},{label:i("redo"),icon:(0,ew.jsx)(MH,{className:"h-5 w-5"}),active:!1,onTap:()=>e.chain().focus().redo().run(),disabled:!e.can().redo()}];return(0,ew.jsxs)("div",{className:"relative shrink-0 border-t border-gray-200 bg-gray-100 pb-safe-kb lg:hidden dark:border-gray-700 dark:bg-gray-800",role:"toolbar","aria-label":i("toolbarFormat"),children:[(0,ew.jsx)("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:a.map((e,t)=>(0,ew.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5",children:[(0,ew.jsx)("button",{type:"button","aria-label":e.label,"aria-pressed":e.active,disabled:r||e.disabled,onPointerDown:e=>e.preventDefault(),onClick:e.onTap,className:(0,v7.cn)("flex h-10 min-w-[40px] items-center justify-center rounded-md px-2 transition-colors disabled:opacity-40",e.active?"bg-gray-300 text-gray-900 dark:bg-gray-600 dark:text-gray-100":"text-gray-700 hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700"),children:e.icon}),e.divider&&(0,ew.jsx)("span",{className:"mx-0.5 h-5 w-px bg-gray-300 dark:bg-gray-600"})]},t))}),(0,ew.jsx)(Oi.ScrollFade,{side:"left",className:"to-gray-100 dark:to-gray-800"}),(0,ew.jsx)(Oi.ScrollFade,{side:"right",className:"to-gray-100 dark:to-gray-800"})]})}function Oo({icon:e,label:t,onClick:r,trailing:n,disabled:i,busy:a,errorBelow:o}){return(0,ew.jsxs)("li",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800",children:[(0,ew.jsxs)("button",{type:"button",onClick:r,disabled:i,"aria-busy":a,className:(0,v7.cn)("flex w-full items-center gap-3 px-4 py-3 text-left transition-colors","text-gray-900 dark:text-gray-100",i?"cursor-not-allowed opacity-50":"hover:bg-gray-50 active:bg-gray-100 dark:hover:bg-gray-800 dark:active:bg-gray-700"),children:[(0,ew.jsx)("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:e}),(0,ew.jsx)("span",{className:"flex-1 truncate text-sm",children:t}),(0,ew.jsx)("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:n})]}),o&&(0,ew.jsxs)("p",{className:"-mt-1 flex items-center gap-1 px-4 pb-2 text-xs text-red-600 dark:text-red-400",children:[(0,ew.jsx)(MK.AlertCircle,{className:"h-3.5 w-3.5"}),o]})]})}function Os({hasShare:e,copied:t,downloadingFormat:r,error:n,onCopy:i,onMailto:a,onShare:o,onDownload:s}){let l=(0,eS.useTranslations)("textEditor"),u=null!==r,c=MJ.EXPORT_FORMATS.map(e=>({key:e.key,label:e.label}));return(0,ew.jsxs)("div",{className:"flex flex-col",children:[(0,ew.jsxs)("div",{className:"flex items-stretch gap-2 px-4 pt-3 pb-2",children:[(0,ew.jsxs)("button",{type:"button",onClick:i,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-gray-200 bg-white px-2 py-3 text-sm font-medium text-gray-900 transition active:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:active:bg-gray-700",children:[t?(0,ew.jsx)(v9.Check,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"}):(0,ew.jsx)(vk.Copy,{className:"h-5 w-5"}),(0,ew.jsx)("span",{className:"truncate",children:t?l("copied"):l("copyShort")})]}),e&&(0,ew.jsxs)("button",{type:"button",onClick:o,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-gray-200 bg-white px-2 py-3 text-sm font-medium text-gray-900 transition active:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:active:bg-gray-700",children:[(0,ew.jsx)(M1,{className:"h-5 w-5"}),(0,ew.jsx)("span",{className:"truncate",children:l("shareShort")})]}),(0,ew.jsxs)("button",{type:"button",onClick:a,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-gray-200 bg-white px-2 py-3 text-sm font-medium text-gray-900 transition active:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:active:bg-gray-700",children:[(0,ew.jsx)(M0,{className:"h-5 w-5"}),(0,ew.jsx)("span",{className:"truncate",children:l("emailShort")})]})]}),(0,ew.jsx)("h4",{className:"px-4 pt-4 pb-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:l("sendSaveSectionSaveFile")}),(0,ew.jsx)("ul",{className:"border-y border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900",children:c.map(e=>{let t=r===e.key,i=t&&n?n:null;return(0,ew.jsx)(Oo,{icon:(0,ew.jsx)(MQ,{format:e.key,className:"h-5 w-5"}),label:e.label,onClick:()=>s(e.key),disabled:u&&!t,busy:t,trailing:t?(0,ew.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:l("sendSaveGenerating")}):(0,ew.jsx)(vV.ChevronRight,{className:"h-4 w-4"}),errorBelow:i},e.key)})}),(0,ew.jsx)("div",{className:"h-6"})]})}let Ol=N9.configure({heading:{levels:[1,2,3]},link:{openOnClick:!1,HTMLAttributes:{class:"text-accent-text underline"}}}),Ou=MZ.configure({html:!1,linkify:!0,breaks:!0,transformPastedText:!0,bulletListMarker:"-"}),Oc=[Ol,Ou];function Od({content:t,mode:r,onSave:n,onCancel:i,defaultFilename:a,focusWord:o,focusWordOffset:s}){let l=(0,eS.useTranslations)("editResponse"),u=(0,eS.useTranslations)("textEditor"),[c,d]=(0,e_.useState)(null),[p,h]=(0,e_.useState)(!1),[f,m]=(0,e_.useState)(null),[g,y]=(0,e_.useState)(!1),[v,b]=(0,e_.useState)(!1),x=(0,e_.useRef)(null),[k,w]=(0,e_.useState)(null),[_,S]=(0,e_.useState)(!1);(0,e_.useEffect)(()=>{b("u">typeof navigator&&"function"==typeof navigator.share)},[]);let[E,C]=(0,e_.useState)(t),$=(0,e_.useRef)(null),[T,I]=(0,e_.useState)(!1),N=function(e={},t=[]){let r=(0,xn.useRef)(e);r.current=e;let[n]=(0,xn.useState)(()=>new $8(r)),i=(0,gP.useSyncExternalStore)(n.subscribe,n.getEditor,n.getServerSnapshot);return(0,xn.useDebugValue)(i),(0,xn.useEffect)(n.onRender(t)),!function(e){var t;let[r]=(0,xn.useState)(()=>new $6(e.editor)),n=(0,$Q.useSyncExternalStoreWithSelector)(r.subscribe,r.getSnapshot,r.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:$X);$5(()=>r.watch(e.editor),[e.editor,r]),(0,xn.useDebugValue)(n)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}({immediatelyRender:!1,autofocus:"end",extensions:[Ol,N4.configure({placeholder:l("placeholder")}),Ou],content:"",editorProps:{attributes:{class:"prose max-w-none focus:outline-none min-h-[200px] px-4 py-3 sm:px-6 sm:py-4 text-gray-900 dark:text-gray-100"}},onCreate:({editor:e})=>
188{if(t){var r;let n,i;e.commands.setContent((r=e.storage.markdown.parser.parse(t),n=Cl(Cc(Oc),void 0),i=EC(r),xU.fromSchema(n).parse(i).toJSON()),{emitUpdate:!1})}},onFocus:()=>S(!0),onBlur:()=>S(!1)});(0,e_.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(g?y(!1):k?w(null):i())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,g,k]),(0,e_.useEffect)(()=>{if(!g)return;let e=e=>{x.current&&!x.current.contains(e.target)&&y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]),(0,MW.useBodyScrollLock)(),(0,e_.useEffect)(()=>{T&&$.current&&$.current.focus()},[T]),(0,e_.useEffect)(()=>{if(!o)return;let e=o.toLowerCase();if(!N)return;let t=0,r=null,n=()=>{(()=>{if(N.isDestroyed)return!0;if(0===N.state.doc.textContent.length)return!1;let t=[],r=0;if(N.state.doc.descendants((n,i)=>{if(!n.isText||!n.text)return!0;let a=n.text.toLowerCase(),o=0;for(;;){let n=a.indexOf(e,o);if(n<0)break;t.push({pmFrom:i+n,plainOffset:r+n}),o=n+e.length}return r+=n.text.length,!0}),0===t.length)return!0;let n=t[0];if("number"==typeof s){let e=Math.abs(n.plainOffset-s);for(let r=1;r<t.length;r++){let i=Math.abs(t[r].plainOffset-s);i<e&&(n=t[r],e=i)}}let i=n.pmFrom+o.length;return N.chain().focus().setTextSelection({from:n.pmFrom,to:i}).scrollIntoView().run(),setTimeout(()=>{let e=window.getSelection();if(e&&0!==e.rangeCount)try{e.modify("extend","forward","character"),e.modify("extend","backward","character")}catch{}},80),!0})()||++t>20||(r=setTimeout(n,20))};return r=setTimeout(n,20),()=>{r&&clearTimeout(r)}},[N,o,s,!1,E]);let A=(0,e_.useCallback)(()=>N?N.storage.markdown.getMarkdown():"",[N,!1,E]),j=(0,e_.useCallback)(()=>{N&&n(A())},[N,!1,A,n]),M=(0,e_.useCallback)(async()=>{if(N){m(null);try{await (0,vZ.writeRichText)(A()),h(!0),setTimeout(()=>h(!1),1500)}catch{m(l("downloadError"))}}},[N,!1,A,l]),O=(0,e_.useCallback)(()=>{if(!N)return;let t=(0,vZ.mdToPlain)(A());Mq.Capacitor.isNativePlatform()?e.A(506891).then(({Share:e})=>e.share({text:t})).catch(()=>m(l("downloadError"))):window.location.href=`mailto:?body=${encodeURIComponent(t)}`},[N,!1,A,l]),D=(0,e_.useCallback)(async()=>{if(N){m(null);try{await navigator.share({text:(0,vZ.mdToPlain)(A())})}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;m(l("downloadError"))}}},[N,!1,A,l]),R=(0,e_.useCallback)(async e=>{if(N){m(null),d(e);try{let t=A(),r=await fetch("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t,format:e,filename:a,title:a})});if(!r.ok)throw Error(`Download failed: ${r.status}`);let{pageUrl:n,fileUrl:i,filename:o}=await r.json();(0,MG.downloadFile)({url:"ios"===Mq.Capacitor.getPlatform()?n:i,filename:o})}catch{m(l("downloadError"))}finally{d(null)}}},[N,!1,A,a,l]),P=(0,e_.useCallback)(()=>{if(!N)return;let e=N.getAttributes("link").href,t=window.prompt("URL",e||"https://");null!==t&&(""===t?N.chain().focus().extendMarkRange("link").unsetLink().run():N.chain().focus().extendMarkRange("link").setLink({href:t}).run())},[N]);if(!N)return null;let z="user-message"===r?l("send"):l("ok");return(0,ew.jsxs)("div",{className:"fixed inset-x-0 z-[60] flex flex-col px-safe py-safe-kb bg-white dark:bg-gray-800",style:{height:"var(--vv-height, 100%)",top:"var(--vv-offset-top, 0px)"},children:[(0,ew.jsxs)("div",{className:"flex h-full w-full flex-col bg-white dark:bg-gray-800",children:[(0,ew.jsxs)("div",{className:"shrink-0 border-b border-gray-200 dark:border-gray-700",children:[(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 sm:px-4 sm:py-2",children:[(0,ew.jsx)("div",{className:"flex items-center gap-1",children:(0,ew.jsx)("button",{type:"button",onClick:()=>w(e=>"sendSave"===e?null:"sendSave"),"aria-pressed":"sendSave"===k,className:(0,v7.cn)("rounded-md px-3 py-1.5 text-sm font-medium transition-colors lg:hidden","sendSave"===k?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-gray-100":"text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"),children:u("exportTab")})}),(0,ew.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ew.jsx)("button",{type:"button",onClick:i,className:"rounded-md px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700",children:l("cancel")}),(0,ew.jsx)(vj.Button,{size:"sm",onClick:j,children:z})]})]}),N&&(0,ew.jsxs)("fieldset",{className:"hidden items-center gap-0.5 overflow-x-auto border-t border-gray-100 px-3 py-1 sm:flex-wrap sm:py-1.5 lg:flex dar
188k:border-gray-800 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[(0,ew.jsx)(Or,{editor:N,t:l,onSetLink:P}),(0,ew.jsx)(M4,{}),(0,ew.jsx)(M2,{onClick:()=>N.chain().focus().undo().run(),disabled:!N.can().undo(),label:u("undo"),children:(0,ew.jsx)(MV,{className:"h-5 w-5 sm:h-4 sm:w-4"})}),(0,ew.jsx)(M2,{onClick:()=>N.chain().focus().redo().run(),disabled:!N.can().redo(),label:u("redo"),children:(0,ew.jsx)(MH,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]}),(0,ew.jsx)("div",{className:"hidden border-t border-gray-100 bg-gray-50 lg:block dark:border-gray-800 dark:bg-gray-900",children:(0,ew.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,ew.jsxs)("button",{type:"button",onClick:M,className:"flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1.5 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p?(0,ew.jsx)(v9.Check,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}):(0,ew.jsx)(vk.Copy,{className:"h-4 w-4"}),(0,ew.jsx)("span",{children:p?u("copied"):u("copyShort")})]}),v&&(0,ew.jsxs)("button",{type:"button",onClick:D,className:"flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1.5 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[(0,ew.jsx)(M1,{className:"h-4 w-4"}),(0,ew.jsx)("span",{children:u("shareShort")})]}),(0,ew.jsxs)("button",{type:"button",onClick:O,className:"flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1.5 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[(0,ew.jsx)(M0,{className:"h-4 w-4"}),(0,ew.jsx)("span",{children:u("emailShort")})]}),f&&(0,ew.jsxs)("span",{className:"flex items-center gap-1 text-xs text-red-600 dark:text-red-400",children:[(0,ew.jsx)(MK.AlertCircle,{className:"h-3.5 w-3.5"}),f]}),(0,ew.jsx)("div",{className:"flex-1"}),(0,ew.jsxs)("div",{className:"relative",ref:x,children:[(0,ew.jsxs)("button",{type:"button","aria-expanded":g,"aria-haspopup":"menu",disabled:null!==c,"aria-busy":null!==c,onClick:()=>y(e=>!e),className:"flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1.5 text-sm font-medium text-gray-700 transition hover:bg-gray-100 disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[(0,ew.jsx)(vK.Download,{className:"h-4 w-4"}),(0,ew.jsx)("span",{children:u("exportTab")}),(0,ew.jsx)(vq.ChevronDown,{className:(0,v7.cn)("h-4 w-4 transition-transform",g&&"rotate-180")})]}),g&&(0,ew.jsx)("div",{role:"menu",className:"absolute right-0 top-full z-10 mt-1 flex w-56 flex-col gap-0.5 rounded-md border border-gray-200 bg-white p-1 shadow-lg dark:border-gray-700 dark:bg-gray-800",children:MJ.EXPORT_FORMATS.map(e=>(0,ew.jsxs)("button",{type:"button",role:"menuitem",disabled:null!==c,"aria-busy":c===e.key,onClick:()=>{y(!1),R(e.key)},className:"flex items-center gap-2 rounded-sm px-2 py-2 text-left text-sm text-gray-700 transition hover:bg-gray-100 disabled:opacity-50 dark:text-gray-200 dark:hover:bg-gray-700",children:[(0,ew.jsx)(MQ,{format:e.key,className:"h-5 w-5 shrink-0"}),(0,ew.jsx)("span",{className:"flex-1",children:e.label}),c===e.key&&(0,ew.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:u("sendSaveGenerating")})]},e.key))})]})]})})]}),(0,ew.jsx)("div",{className:"flex-1 overflow-y-auto flowbite-scrollbar",children:(0,ew.jsx)("div",{className:"h-full",children:N&&(0,ew.jsx)($4,{editor:N,className:"h-full"})})}),N&&_?(0,ew.jsx)(Oa,{editor:N,onSetLink:P}):null]}),(0,ew.jsx)(On.SheetFrame,{open:"sendSave"===k,onClose:()=>w(null),title:u("exportTab"),variant:"bottom",children:(0,ew.jsx)(Os,{hasShare:v,copied:p,downloadingFormat:c,error:f,onCopy:M,onMailto:O,onShare:D,onDownload:R})})]})}var Op=e.i(38581),Oh=e.i(363936),Of=e.i(92412),Om=e.i(681145),Og=e.i(280694),Oy=e.i(512273);let Ov=[[[0],"âï¸"],[[1],"ð¤ï¸"],[[2],"â
"],[[3],"âï¸"],[[45,48],"ð«ï¸"],[[51,53,55,56,57],"ð¦ï¸"],[[61,63,65,66,67],"ð§ï¸"],[[71,73,75,77],"âï¸"],[[8
1880,81,82],"ð¦ï¸"],[[85,86],"ð¨ï¸"],[[95,96,99],"âï¸"]],Ob=/^[ \t]*!\[[^\]\n]*\](?:\((?!https?:\/\/)[^)\n]*\))?[ \t]*$/gim,Ox=/^[ \t]*!(?!\[)[^\n]*\bicon\b[ \t]*$/gim;function Ok(e,t){if(!e.includes("!"))return e;let r=t??"â¢";return e.replace(Ob,r).replace(Ox,r)}async function Ow(e){try{let t=await fetch("/api/errors/report",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok){let e=await t.json();return!0===e.ticketCreated}return!1}catch{return!1}}let O_=RegExp(["<details>\\s*<summary>([\\s\\S]*?)</summary>([\\s\\S]*?)</details>",(0,yK.mediaTagSource)("images"),(0,yK.mediaTagSource)("videos"),(0,yK.mediaTagSource)("news"),yK.CHIPS_TAG_SOURCE,(0,yK.mediaTagSource)("generate")].join("|"),"g"),OS=new RegExp(yK.TRAILING_INCOMPLETE_TAG_SOURCE),OE=["webSearch","webContext","imageSearch","webBrowse","knowledgeBase","regulatoryCalculator","readDocument","createDocuments","analyzeDocuments","copyableText","runPython","generateArtifact","weather","currency","location","countryInfo","mermaidDiagram","dataChart","generateImage","ganttChart","listGenerator","thumbnailSrc"],OC=new Set(["imageSearch","generateImage","listGenerator","thumbnailSrc","generateArtifact","colorExplorer","copyableText","createDocuments","writingStyle"]);function O$(e,t){let r=0,n=!1,i=!1;for(let a=t;a<e.length;a++){let t=e[a];if(i){i=!1;continue}if("\\"===t&&n){i=!0;continue}if('"'===t){n=!n;continue}if(!n&&("{"===t&&r++,"}"===t)&&0==--r)return a}return -1}let OT=["query","maxTokens","count","url","code","language","searchQuery","documentId","content","title","format","dateA","dateB","labelA","labelB","topic","formatTemplate","exampleItems","previousItems","groundingData"];function OI(e){let t=(!e.includes("is not re-attached here")?e:e.split("(A tool was used in an earlier turn of this conversation; its result was delivered to the user and is not re-attached here.)").join("").replace(/^\s+/,"")).replace(/^[\s\]},]+/,""),r={0:"â°",1:"¹",2:"²",3:"³",4:"â´",5:"âµ",6:"â¶",7:"â·",8:"â¸",9:"â¹"};t=(t=(t=b3(t,e=>e.replace(/<sup>(\d+)<\/sup>/gi,(e,t)=>t.split("").map(e=>r[e]??e).join("")))).replace(/(?:^|\n)\[[\p{L}\p{N} _-]+\]\s*/gu,e=>e.startsWith("\n")?"\n":"")).replace(/[*_]*\[action:[^\]\n]*\](?:\([^)\n]*\))?[*_]*/g,"").replace(/[*_]*\[action:[^\]\n]*$/gm,"").replace(RegExp("[*_]*\\[[^\\]\\n]*\\]\\((?:routeToSpecialist|directAnswer|webSearch|webContext|knowledgeBase)[^)\\n]*\\)[*_]*","g"),"").replace(/[*_]*\[action\][^[\n]*?\[\/action\][*_]*/g,"").replace(/[*_]*\[\/?action\][*_]*/g,"").replace(/[*_(\s]*\[(?:a(?:c(?:t(?:i(?:o(?:n)?)?)?)?)?)?$/,"").replace(/^[ \t]*\|[ \t]*$/gm,"");let n=(t=(t=(t=(t=(t=(t=(t=b3(t,yN)).replace(/\(#"[^"]*"\)\s*/g,"")).replace(/^(\*\*[^*\n]+?\*\*):?\s*\n\s*\n?:[\t ]+/gm,"$1: ")).replace(/^(#{1,6}[\t ]+[^\n]+?):?\s*\n\s*\n?:[\t ]+/gm,"$1\n\n")).replace(/(?:\n---\n?)?\n\*{0,2}\s*action:\s*\*{0,2}\s*[\s\S]*$/i,"")).replace(/\[(?:REF|sources|citation)\][^[]*\[\/(?:REF|sources|citation)\]/gi,"")).replace(/\[\/?(?:REF|sources|citation)\]/gi,""))!==e;{let e,r=RegExp(`(?:^|\\n)[ \\t]*\\*{0,2}Tool\\*{0,2}:[^\\S\\n]*(?:${OE.join("|")})?[^\\S\\n]*\\n+(?:\`\`\`\\w*[^\\S\\n]*\\n)?[^\\S\\n]*(?=\\{)`,"g");for(;null!==(e=r.exec(t));){let i=e.index,a=O$(t,e.index+e[0].length);if(-1===a){t=t.substring(0,i),n=!0;break}let o=a+1,s=/^\s*```[^\S\n]*(\n|$)/.exec(t.substring(o));s&&(o+=s[0].length);let l=e[0].startsWith("\n")?"\n":"";t=t.substring(0,i)+l+t.substring(o),n=!0,r.lastIndex=0}}let i=t;(t=b3(t,ON))!==i&&(n=!0);{let e=b5(t);if(e.some(e=>e.code)){let r=e.filter(e=>{let t;return!(e.code&&(((t=b8(e.text).trim()).startsWith("{")||t.startsWith("["))&&/"\w+":\s*/.test(t)&&b9.some(e=>t.includes(`"${e}"`))||e.code&&""===b8(e.text).trim()))});r.length!==e.length&&(t=b6(r),n=!0)}}return function(e,t,r){let n=e,i=t;{let e=n;(n=n.replace(/^[ \t]*[*_]{0,2}Tool[*_]{0,2}:[*_]{0,2}[ \t]*$\n?/gim,""))!==e&&(i=!0)}let a=n.length;(n=(n=(n=(n=(n=n.replace(/(.)\1{14,}$/,"")).replace(/(.{2,5})\1{7,}$/,"")).replace(/([\]\[\}\{\)\(])\1{9,}[\s\S]*$/,"")).replace(/(?:[\]\[\}\{\)\(`]\s*){12,}[\s\S]*$/,"")).replace(/([^\w\s])(?:[\s]*\1){19,}\s*$/,"")).length!==a&&(i=!0);{var o;let e,t,r=n;o=n,(n=(t=(e=b5(o))[e.length-1])&&!t.code?b6([...e.slice(0,-1),{code:!1,text:(e=>{let t=e.split("\n");if(t.length>=8){let e=Math.min(t.length,30),r=t.length-e,n=t.slice(r),i={};for(let e of n){let t=e.trim();t.length<8||(i[t]=(i[t]??0)+1)}let a="",o=0;for(let[e,t]of Object.entries(i))t>o&&(o=t,a=e);if(o>=4){let e=-1;for(let n=r;n<t.length;n++)if(t[n].trim()===a){e=n;break}if(e>=0)return t.slice(0,e+1).join("\n")}}return e})(t.text)}]):o)!==r&&(i=!0)}let s=n;if((n=(n=(n=(n=n.replace(/!\s*\[[^\]]*\]\([^)]*\)?/g,"")).replace(/!\s*\[[^\]\n]*$/gm,"")).replace(/(?:^|\s)!\s+[^!()\n]+\s*\(?\s*$/gm,"")).replace(/!\s+[^!()\n]{3,}\s*\(/g," "))!==s&&(i=!0),!i)return r;let l=(n=(n=(n=(n=(n=(n=(n=(n=n.replace(/\baction:\s*/gi,"")).replace(/\{\{(?:images|videos|news):.*?\}\}/g,"")).replace(/\(?(?:\*\()?\s*buttons?\s+for\s+follow[- ]?up\s+actions?\s*\)?\*?\)?[)"']*/gi,"")).replace(/^[)"'\s]+/,"")).replace(/[)"']{2,}\s*$/,"")).replace(/[\[\]\{\}]+/g," ")).replace(/[^\S\n\r]+/g," ")).replace(/\n{3,}/g,"\n\n")).trim();return l.length<5&&r.trim().length>20&&i?"":!l&&r.trim()?r.trim():l}(t,n,e)}function ON(e){let t=e;for(let e of OE){let r=0;for(;r<t.length;){let n=t.indexOf(e,r);if(-1===n)break;let i=n+e.length,a=t.substring(i,i+50).indexOf("{");
188if(-1===a){r=i;continue}let o=O$(t,i+a);if(-1!==o)t=t.substring(0,n)+t.substring(o+1);else{t=t.substring(0,n);break}}}for(let e of OE){let r=0;for(;r<t.length;){let n=t.indexOf(e,r);if(-1===n)break;let i=n+e.length,a=t.substring(i,i+10).indexOf("(");if(-1===a){r=i;continue}let o=i+a,s=0,l=!1,u=!1,c=-1;for(let e=o;e<t.length;e++){let r=t[e];if(u){u=!1;continue}if("\\"===r&&l){u=!0;continue}if('"'===r){l=!l;continue}if(!l&&("("===r&&s++,")"===r)&&0==--s){c=e;break}}if(-1!==c)t=t.substring(0,n)+t.substring(c+1);else{t=t.substring(0,n);break}}}{let e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(-1===r)break;let n=O$(t,r);if(-1===n){let e=t.substring(r);OT.some(t=>e.includes(`"${t}"`))&&(t=t.substring(0,r));break}let i=t.substring(r,n+1);OT.filter(e=>i.includes(`"${e}"`)).length>=1&&/"\w+":\s*/.test(i)?t=t.substring(0,r)+t.substring(n+1):e=n+1}}for(let e of OE)/[A-Z]/.test(e)&&t.includes(e)&&(t=t.replace(RegExp(e+"\\S*","g"),""));return t}let OA=/\[User uploaded file: "(.+?)" \(document ID: ([a-f0-9-]+)\)\]/g,Oj=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico"]);function OM({file:e}){let[t,r]=(0,yE.useState)(!1);return t?(0,ew.jsx)("div",{className:"flex h-16 w-16 shrink-0 items-center justify-center rounded-lg border border-gray-700 dark:border-gray-300 bg-gray-800/50 dark:bg-gray-200/50",children:(0,ew.jsx)(vt.ImageIcon,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}):(0,ew.jsx)("div",{className:"relative h-16 w-16 shrink-0 overflow-hidden rounded-lg border border-gray-700 dark:border-gray-300",children:(0,ew.jsx)(vM.ViewableImage,{src:`/api/conversation-documents/${e.id}/download`,alt:e.name,filename:e.name,tapOpensFullscreen:!0,disableDelete:!0,className:"h-full w-full object-cover",onError:()=>r(!0)})})}function OO({media:e,className:t,children:r,...n}){let[i,a]=(0,yE.useState)(!1);return e&&e.thumbnailSrc&&!i?(0,ew.jsxs)("li",{className:t,...n,children:[(0,ew.jsx)("div",{className:"not-prose mb-2",children:(0,ew.jsx)("a",{href:e.pageUrl,target:"_blank",rel:"noopener noreferrer",className:"block overflow-hidden rounded-lg transition-opacity hover:opacity-90","aria-label":e.title??e.sourceDomain??"source",children:(0,ew.jsx)(vM.ViewableImage,{src:(0,bJ.viaImageProxy)(e.thumbnailSrc),alt:e.title??"",filename:e.title,loading:"lazy",className:"aspect-video w-full object-cover",onError:()=>a(!0),onLoad:e=>{e.target.naturalWidth<=1&&a(!0)}})})}),r]}):(0,ew.jsx)("li",{className:t,...n,children:r})}function OD({text:e}){let{files:t,remaining:r}=function(e){let t,r=[];for(;null!==(t=OA.exec(e));){let e=t[1],n=t[2],i=e.split(".").pop()?.toLowerCase()??"";r.push({name:e,id:n,isImage:Oj.has(i)})}return OA.lastIndex=0,{files:r,remaining:e.replace(OA,"").trim()}}(e.replace(/^\[[a-zA-Z]+\] ?/,"")),n=t.filter(e=>e.isImage),i=t.filter(e=>!e.isImage);return(0,ew.jsxs)(ew.Fragment,{children:[n.length>0&&(0,ew.jsx)("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:n.map(e=>(0,ew.jsx)(OM,{file:e},e.id))}),i.length>0&&(0,ew.jsx)("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:i.map(e=>(0,ew.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-lg bg-gray-800 px-2.5 py-1 text-xs text-gray-300 dark:bg-gray-200 dark:text-gray-700",children:[(0,ew.jsx)(ve.Paperclip,{className:"h-3 w-3"}),(0,ew.jsx)("span",{className:"max-w-[180px] truncate",children:e.name})]},e.id))}),r&&(0,ew.jsx)("p",{className:"text-sm whitespace-pre-wrap [overflow-wrap:anywhere]",children:r})]})}let OR={webSearch:y1.Globe,webContext:y1.Globe,webBrowse:y1.Globe,imageSearch:vt.ImageIcon,thumbnailSrc:vt.ImageIcon,generateImage:vd.Paintbrush,writingStyle:vx.Pencil,videoSearch:vr.Video,newsSearch:vn.Newspaper,knowledgeBase:y2.BookOpen,regulatoryCalculator:y4.Calculator,readDocument:y5.FileText,createDocuments:y3,analyzeDocuments:y9,copyableText:y7.ClipboardCopy,runPython:y8.Code,generateArtifact:vi.Blocks,weather:va.CloudSun,currency:vo.ArrowLeftRight,location:vs.MapPin,localSearch:vs.MapPin,countryInfo:vl.Flag,geocoding:vs.MapPin,ipGeolocation:vu.Locate,interactiveMap:vm,mermaidDiagram:vh.Workflow,ganttChart:vh.Workflow,dataChart:vf.BarChart3,listGenerator:vg.ListOrdered,colorExplorer:vy.Palette,comparePrices:vv},OP=new Set(Object.keys(OR));class Oz extends yE.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?(0,ew.jsx)("div",{className:"flex items-start gap-2 px-3 py-2 sm:gap-3 sm:px-4 sm:py-1",children:(0,ew.jsx)("div",{className:"rounded-2xl bg-white px-4 py-2.5 shadow-sm dark:bg-gray-800 dark:shadow-md dark:shadow-gray-900/20",children:(0,ew.jsxs)("div",{className:"flex items-center gap-2 text-sm text-amber-700 dark:text-amber-400",children:[(0,ew.jsx)(y0.AlertTriangle,{className:"h-3.5 w-3.5 shrink-0"}),(0,ew.jsx)("span",{children:"This message could not be displayed."})]})})}):this.props.children}}let OL=yE.default.memo(function(e){return(0,ew.jsx)(Oz,{children:(0,ew.jsx)(OF,{...e})})},function(e,t){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let n of r){let r=e[n],i=t[n];if("function"==typeof r||"function"==typeof i){if(!!r!=!!i)return!1}else if(!Object.is(r,i))return!1}return!0});function OF({message:e,isStreaming:t=!1,isReady:r=!1,isLastAssistant:n=!1,hasEarlierWebSources:i=!1,hasPriorConversation:a=!1,priorMessageCount:o,waitLine:s,waitLineSince:l,onEditSubmit:u,onRetry:c,onContinue:d,isContinuing:p=!1,onSuggestionClick:h,onStop:f,onShareMessage:m,onDiscuss:g,onDeleteFromHere:y,onEditResponseSave:v,onKeepOnlyThis:b,onToolTimeout:x,isBookmarked:k,onToggleBookmark:w,conversationLocale:_,chatDisplay:S,autoZenEnabled:E,autoZenRecoverSignal:C,autoZenSettingOn:$,onAutoZenChange:T,onZenChange:I,conversationId:N,conversationTitle:A}){let j,M,O,D="user"===e.role,{data:R}=(0,yS.useSession)(),P=(0,eS.useTranslations)("editResponse"),z=(0,eS.useTranslations)("chat"),L=(0,eS.useTranslations)("feedback"),F=(0,eS.useTranslations)("chat.whyAmISeeing"),U=(0,eS.useTranslations)("statusLine"),B=(0,eS.useTranslations)("toolLabels"),[Z,q]=(0,yE.useState)(!1),V=p?z("truncationContinueLoading"):z("truncationContinueInline"),H=` ⦠[${V}](#gdprchat-continue) | [${F("toggle")}](#gdprchat-why)`,[K,W]=(0,yE.useState)(!1),[J,G]=(0,yE.useState)(!1),[X,Y]=(0,yE.useState)(!1),[Q,ee]=(0,yE.useState)(""),[et,er]=(0,yE.useState)(void 0),en=(0,yE.useRef)(null),[ei,ea]=(0,yE.useState)(null),[eo,es]=(0,yE.useState)(!1),[el,eu]=(0,yE.useState)(()=>new Set),[ec,ed]=(0,yE.useState)(!1),ep=(0,yE.useRef)(null),[eh,ef]=(0,yE.useState)(!1),[em,eg]=(0,yE.useState)(!1),[ey,ev]=(0,yE.useState)(!1),eb=(0,yE.useRef)(null),ex=(0,yE.useRef)(null),ek=(0,yE.useCallback)(()=>{em||ey||(ev(!0),eb.current=setTimeout(()=>eg(!0),900),ex.current=setTimeout(()=>ev(!1),2e3))},[em,ey]),eE=(0,yE.useCallback)(()=>{eb.current&&(clearTimeout(eb.current),eb.current=null),ex.current&&(clearTimeout(ex.current),ex.current=null),ev(!1)},[]),e$=(0,yE.useCallback)(()=>{eE(),em&&eg(!1)},[em,eE]),eT=(0,yE.useCallback)(e=>{h?h(e):(console.error("[message-bubble] action button clicked with
188no handler wired",{text:e}),Ow({source:"client",errorType:"suggestion-click-no-handler",message:`A chat action button was clicked but no handler was wired: ${e.slice(0,120)}`,conversationId:N}))},[h,N]),eI=(0,yE.useCallback)(e=>{eg(!1),eT(e)},[eT]);(0,yE.useEffect)(()=>()=>{eb.current&&clearTimeout(eb.current),ex.current&&clearTimeout(ex.current)},[]),(0,yE.useEffect)(()=>{I?.(em)},[em,I]);let eN=(0,yE.useRef)(null),eA=(0,yE.useRef)(null),ej=(0,yE.useMemo)(()=>{let t=e.metadata;return t?.userEdit?t.userEdit:null},[e]),[eM,eO]=(0,yE.useState)("latest"),eD=!D&&!!ej&&"original"===eM,eR=(0,yE.useCallback)(()=>eD&&ej?ej.originalContent:e.parts.filter(e=>"text"===e.type).map(e=>D?e.text.replace(OA,"").trim():e.text).filter(Boolean).join("\n\n"),[e.parts,D,eD,ej]),eP=(0,yE.useCallback)(()=>{let e=en.current;en.current=null,ee(e?.word??""),er(e?.offset),D?(W(!0),G(!1)):Y(!0)},[D]),ez=(0,yE.useCallback)(()=>{let t=[];for(let r of e.parts)if(g_(r)&&"runPython"===gE(r)&&"output-available"===r.state){let e=r.output;e?.images?.length&&t.push(...e.images)}return t},[e.parts]),eL=null;if(!D){for(let t of e.parts)if(g_(t)&&"output-available"===t.state&&"weather"===gE(t)){let e=t.output?.current?.weatherCode;if("number"==typeof e){eL=function(e){for(let[t,r]of Ov)if(t.includes(e))return r;return"ð¡ï¸"}(e);break}}}let eF=(0,yE.useMemo)(()=>{if(D)return[];let t=[];for(let r of e.parts)g_(r)&&"output-available"===r.state&&OP.has(gE(r))&&t.push({toolName:gE(r),output:r.output});return t},[e.parts,D]),eU=(0,yE.useMemo)(()=>!D&&eF.length>0&&eF.every(e=>"generateImage"===e.toolName),[D,eF]);(0,yE.useEffect)(()=>{if(!E||D||!t||!n||em||eU||eN.current===e.id||"u">typeof document&&"1"===document.documentElement.dataset.shortcutEditing)return;let r="u">typeof document?document.activeElement:null;if((r instanceof HTMLTextAreaElement||r instanceof HTMLInputElement)&&r.value.trim().length>0)return;let i=eR();eF.length>0&&i.trim().length<30||(0,Om.isZenableMessage)(i,eF)&&(eN.current=e.id,ek())},[E,D,t,n,em,e.id,eR,eF,ek,eU]);let eB=(0,yE.useRef)(C);(0,yE.useEffect)(()=>{if(C===eB.current||(eB.current=C,!E||D||!n||em||eU||eN.current===e.id||"u">typeof document&&"1"===document.documentElement.dataset.shortcutEditing))return;let t="u">typeof document?document.activeElement:null;if((t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement)&&t.value.trim().length>0)return;let r=eR();(0,Om.isZenableMessage)(r,eF)&&(eN.current=e.id,ek())},[C,E,D,n,em,eU,e.id,eR,eF,ek]);let eZ=(0,yE.useMemo)(()=>{if(D)return!1;let t=e.parts.filter(g_);if(0===t.length)return!1;let r=t.filter(e=>OP.has(gE(e)));return 0!==r.length&&!!r.every(e=>OC.has(gE(e)))&&e.parts.filter(e=>"text"===e.type).map(e=>e.text??"").join(" ").trim().length<=240},[e.parts,D]),eq=(0,yE.useMemo)(()=>e.parts.some(e=>g_(e)&&"mermaidDiagram"===gE(e)),[e.parts]),eV=(0,yE.useMemo)(()=>e.parts.some(e=>g_(e)&&("dataChart"===gE(e)||"ganttChart"===gE(e))),[e.parts]),eH=(0,yE.useMemo)(()=>!!D||e.parts.some(e=>gx(e)&&!eZ&&!!OI(e.text)),[e.parts,D,eZ]),eK=(0,yE.useMemo)(()=>!!D||eH||e.parts.some(e=>g_(e)&&"output-available"===e.state),[D,eH,e.parts]),eW=(0,yE.useMemo)(()=>!eZ&&eR()?"text":ez().length>0?"image":"none",[eR,ez,eZ]),eJ=(0,yE.useCallback)(t=>{t.trim()&&(W(!1),u?.(e.id,t.trim()))},[e.id,u]),eG=(0,yE.useCallback)(()=>{eA.current&&clearTimeout(eA.current),G(!0),eA.current=setTimeout(()=>G(!1),4e3)},[]);(0,yE.useEffect)(()=>()=>{eA.current&&clearTimeout(eA.current)},[]);let[eX,eY]=(0,yE.useState)({open:!1,anchor:null}),[eQ,e0]=(0,yE.useState)(!1),e1=(0,xe.useLongPress)(e=>{let t="u">typeof document?document.elementFromPoint(e.clientX,e.clientY):null,r=t?.closest("[data-long-press]");en.current=r?function(e,t,r){if("u"<typeof document)return null;let n=null,i=0,a=document;if("function"==typeof a.caretPositionFromPoint){let e=a.caretPositionFromPoint(t,r);e&&e.offsetNode.nodeType===Node.TEXT_NODE&&(n=e.offsetNode,i=e.offset)}else if("function"==typeof a.caretRangeFromPoint){let e=a.caretRangeFromPoint(t,r);e&&e.startContainer.nodeType===Node.TEXT_NODE&&(n=e.startContainer,i=e.startOffset)}if(!n||!n.textContent||!e.contains(n)||n.parentElement?.closest("code, pre"))return null;let o=n.textContent,s=e=>/[\p{L}\p{N}_]/u.test(e),l=i;for(;l>0&&s(o[l-1]);)l--;let u=i;for(;u<o.length&&s(o[u]);)u++;if(l===u)return null;
188let c=o.slice(l,u),d=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),p=0,h=d.nextNode();for(;h;){if(h===n)return{word:c,offset:p+l};p+=h.textContent?.length??0,h=d.nextNode()}return{word:c,offset:l}}(r,e.clientX,e.clientY):null,eY({open:!0,anchor:{x:e.clientX,y:e.clientY}})},{enabled:!K,thresholdMs:250}),e2=function(e={}){let{enabled:t=!0}=e,r=(0,e_.useRef)(t);(0,e_.useEffect)(()=>{r.current=t},[t]);let n=(0,e_.useRef)(null),i=(0,e_.useRef)(null),a=(0,e_.useRef)(!1),o=(0,e_.useRef)(null);(0,e_.useEffect)(()=>()=>{o.current?.()},[]);let s=(0,e_.useCallback)((e,t,r)=>{if(a.current)return;a.current=!0,e.setAttribute("data-text-selecting","true");let n=performance.now(),i=[],s=null,l=()=>{let t=window.getSelection();return!!t&&0!==t.rangeCount&&!t.isCollapsed&&!!t.anchorNode&&e.contains(t.anchorNode)};function u(){if(!a.current)return;a.current=!1,o.current=null,document.removeEventListener("selectionchange",c),i.forEach(clearTimeout),s&&clearTimeout(s),e.removeAttribute("data-text-selecting");let t=window.getSelection();t&&!t.isCollapsed&&t.anchorNode&&e.contains(t.anchorNode)&&t.removeAllRanges()}function c(){!(performance.now()-n<500)&&(l()?s&&(clearTimeout(s),s=null):s||(s=setTimeout(()=>{l()||u()},350)))}o.current=u,document.addEventListener("selectionchange",c),i.push(setTimeout(()=>{l()||function(e,t,r){let n=null,i=0,a=document;if("function"==typeof a.caretPositionFromPoint){let e=a.caretPositionFromPoint(t,r);e&&e.offsetNode.nodeType===Node.TEXT_NODE&&(n=e.offsetNode,i=e.offset)}else if("function"==typeof a.caretRangeFromPoint){let e=a.caretRangeFromPoint(t,r);e&&e.startContainer.nodeType===Node.TEXT_NODE&&(n=e.startContainer,i=e.startOffset)}if(!n||!n.textContent||!e.contains(n))return;let o=n.textContent,s=e=>/[\p{L}\p{N}_]/u.test(e),l=i;for(;l>0&&s(o[l-1]);)l--;let u=i;for(;u<o.length&&s(o[u]);)u++;if(l===u)return;let c=document.createRange();c.setStart(n,l),c.setEnd(n,u);let d=window.getSelection();d&&(d.removeAllRanges(),d.addRange(c))}(e,t,r)},400)),i.push(setTimeout(()=>{l()||u()},900))},[]);return{onPointerDown:(0,e_.useCallback)(e=>{if("touch"!==e.pointerType)return!1;if(a.current)return!0;if(!r.current)return!1;let t=e.target;if(t?.closest(xe.INTERACTIVE_SELECTOR))return n.current=null,!1;let o=n.current;return o&&e.timeStamp-o.t<=300&&35>=Math.abs(e.clientX-o.x)&&35>=Math.abs(e.clientY-o.y)?(n.current=null,s(e.currentTarget,e.clientX,e.clientY),!0):(i.current={x:e.clientX,y:e.clientY,t:e.timeStamp,pointerId:e.pointerId},!1)},[s]),onPointerUp:(0,e_.useCallback)(e=>{if("touch"!==e.pointerType||a.current)return;let t=i.current;i.current=null,t&&t.pointerId===e.pointerId&&(n.current=e.timeStamp-t.t<=280&&10>=Math.abs(e.clientX-t.x)&&10>=Math.abs(e.clientY-t.y)?{x:e.clientX,y:e.clientY,t:e.timeStamp}:null)},[])}}({enabled:!K}),e4=(0,yE.useMemo)(()=>{let t=[];for(let r of e.parts){let e=t[t.length-1];gx(r)&&e&&gx(e)?t[t.length-1]={type:"text",text:e.text+"\n\n"+r.text}:t.push(r)}return t},[e.parts]),e5=(0,yE.useMemo)(()=>{if(D)return null;let t=e.metadata,r=e4.some(e=>"string"==typeof e.type&&"data-response-truncated"===e.type);if(!(t?.truncated===!0||r))return null;let i=t?.truncationReason??null;if("length"===i||"mid-word"===i){if(!n)return"mid-word"===i?"retry":null;let e=e4.filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("\n").trimEnd();return e.length>0&&/[.!?:;â¦)\]"']$/.test(e)?null:"continue"}return"retry"},[D,e.metadata,e4,n]),e6=(0,yE.useMemo)(()=>{if(D||!n)return null;let t=e.metadata;return t?.slowResponseOffer?"slow":null},[D,n,e.metadata]),e3=(0,yE.useMemo)(()=>e4.some(e=>{if(!g_(e))return!1;let t=gE(e);return"generateArtifact"===t||"runPython"===t||"mermaidDiagram"===t||"ganttChart"===t||"dataChart"===t||"location"===t||"interactiveMap"===t||"colorExplorer"===t}),[e4]),e9=(0,yE.useMemo)(()=>(0,Of.derivePipelineState)(e4),[e4]),e8=(0,yE.useMemo)(()=>{if(D)return new Set;let e=new Set,t=e4.findIndex(e=>g_(e)&&"routeToSpecialist"===gE(e));if(-1===t)return e;for(let r=t-1;r>=0;r--){let t=e4[r];if(gx(t)){e.add(r);break}if(g_(t))break}return e},[e4,D]),e7=(0,yE.useMemo)(()=>{for(let e=0;e<e4.length;e++)if(gx(e4[e])&&!e8.has(e))return e;return -1},[e4,e8]),te=(0,yE.useCallback)(()=>eD&&ej?ej.originalContent:ej?.supersedesTools?ej.editedContent:vB(e.parts,{isUser:D,stripText:OI}),[e.parts,D,eD,ej]),tt=(0,yE.useCallback)(async()=>{let e=te();if(e)return void await (0,vZ.writeRichText)(e);let t=ez();if(t.length>0)try{let e=t[0].startsWith("R0lGOD")?"image/gif":"image/png",r=fetch(`data:${e};base64,${t[0]}`).then(e=>e.blob());r.catch(()=>{}),await navigator.clipboard.write([new ClipboardItem({[e]:r})])}catch{}},[te,ez]),tr=(0,yE.useCallback)(async()=>
188{if(!eo&&!ei){es(!0);try{let e=await fetch("/api/expand-buttons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answerText:te(),userLanguage:_??void 0})});if(e.ok){let t=await e.json(),r=Array.isArray(t.buttons)?t.buttons:[];r.length>0&&ea(r)}}catch{}finally{es(!1)}}},[eo,ei,te,_]);(0,yE.useEffect)(()=>{ei&&0!==ei.length&&yA(ep.current,"frame")},[ei]);let tn=(0,yE.useMemo)(()=>(0,Og.pairTextItemsWithMedia)(e4),[e4]),ti=(0,yE.useMemo)(()=>{if(!em)return[];let e=[],t=[];for(let r=0;r<e4.length;r++){let n=e4[r];if(gx(n)){if(e8.has(r)||eZ)continue;let t=(0,Om.splitTextForZen)(Ok(OI(n.text),eL)),i=tn.itemPairs.get(r);if(i){let e=0;for(let r of t)if("listItem"===r.type){let t=i.byIndex.get(e);t&&(r.media=t),e++}}e.push(...t)}else if(g_(n)&&"output-available"===n.state){if(tn.consumedToolPartIndices.has(r))continue;let i=gE(n);if((0,Om.resolveZenToolName)(i,n.output)){let r="newsSearch"===i||"webSearch"===i&&(()=>{let e=n.output,t=e?._searchType;return"news"===t||"video"===t})()?t:e,a=(0,Om.explodeToolForZen)(i,n.output);a?r.push(...a):r.push({type:"toolResult",toolName:i,toolOutput:n.output,content:i})}}}let r=[...e,...t];return r.length<1?[]:r.slice(0,Om.ZEN_MAX_CARDS)},[e4,em,e8,tn,eZ,eL]),ta=(0,yE.useRef)(void 0),to=(0,yE.useMemo)(()=>{if(D||!t)return[];let e=[],r=!1,n=!1,i=0;for(let t of e4){if(g_(t)){let r=gE(t),n=t.state,i=t.input,a=e=>{let t=i?.[e];return"string"==typeof t&&t.length>0?t:null},o=(e,t)=>(function(e,t=120){let r=e.trim();if(r.length<=t)return r;let n=r.slice(0,t),i=n.lastIndexOf(" ");return(i>.6*t?n.slice(0,i):n).replace(/[\s,.;:â-]+$/,"")+"â¦"})(e);if("input-available"===n){let t=a("query"),n=a("description"),i=a("url");switch(r){case"webSearch":{let r=a("type"),n=o(t??"",40);"news"===r?e.push(U("tool.searchingNews",{query:n})):"video"===r?e.push(U("tool.searchingVideos",{query:n})):e.push(U("tool.searchingWeb",{query:n}));break}case"webContext":e.push(U("tool.deepSearch",{query:o(t??"",40)}));break;case"comparePrices":e.push(t?U("tool.comparingPrices",{query:o(t)}):U("tool.comparingPricesGeneric"));break;case"knowledgeBase":e.push(t?U("tool.searchingRegulations",{query:o(t,40)}):U("tool.searchingRegulationsGeneric"));break;case"imageSearch":e.push(U("tool.searchingImages",{query:o(t??"",40)}));break;case"generateImage":e.push(n?U("tool.generatingImageDesc",{description:o(n,50)}):U("tool.generatingImage"));break;case"runPython":e.push(n?U("tool.writingPythonDesc",{description:o(n,50)}):U("tool.writingPython"));break;case"generateArtifact":e.push(n?U("tool.buildingArtifactDesc",{description:o(n,50)}):U("tool.buildingArtifact"));break;case"mermaidDiagram":e.push(U("tool.creatingDiagram"));break;case"listGenerator":{let t=a("topic");e.push(t?U("tool.generatingList",{topic:o(t,40)}):U("tool.generatingListGeneric"));break}case"currency":{let t=a("from"),r=a("to");e.push(t&&r?U("tool.convertingCurrency",{from:t,to:r}):U("tool.convertingCurrencyGeneric"));break}case"location":e.push(t?U("tool.lookingUpLocation",{query:o(t,40)}):U("tool.lookingUpLocationGeneric"));break;case"countryInfo":{let t=a("country");e.push(t?U("tool.lookingUpCountry",{country:t}):U("tool.lookingUpCountryGeneric"));break}case"webBrowse":if(i)try{e.push(U("tool.readingPageDomain",{domain:new URL(i).hostname.replace("www.","")}))}catch{e.push(U("tool.readingPage"))}else e.push(U("tool.readingPage"));break;case"readDocument":e.push(U("tool.readingDocument"));break;case"createDocuments":e.push(U("tool.creatingDocument"));break;case"analyzeDocuments":e.push(U("tool.analyzingDocuments"));break;default:e.push(U("tool.generic"))}}if("output-available"===n&&("webSearch"===r||"webContext"===r)){let r=t.output,n=r?.results,i=r?.sources,a=n?.length??i?.length??0;a>0&&e.push(U("tool.foundSources",{count:a}))}}if(gb(t)){if("data-searchResults"===t.type){let r=t.data;r.results?.length&&e.push(U("tool.foundSources",{count:r.results.length}))}if("data-shoppingProgress"===t.type){let r=t.data?.phase;("searching"===r||"reading"===r||"matching"===r||"converting"===r||"comparing"===r)&&e.push(U(`shopping.steps.${r}`))}if("data-codeAgentProgress"===t.type){let r=t.data,n="runPython"===r.tool?"Python":"generateArtifact"===r.tool?"Html":"Diagram";switch(r.phase){case"writing":e.push(U("codeAgent.writing"+n));break;case"editing":e.push(U("codeAgent.editing"+n));break;case"executing":e.push(U("codeAgent.executing"));break;case"retrying":e.push(U("codeAgent.retrying"));break;case"complete":e.push(U("codeAgent.complete"))}}if("data-agentProgress"===t.type){let r=t.data;"complete"!==r.phase&&e.push(U("agent.researchingItem",{current:r.current+1,total:r.total}))}{let e=t.data,r="number"==typeof e?.tier?e.tier:0;r>0&&r>i&&(i=r)}if("data-progress"===t.type){let e=t.data;e?.state!=="start"||r||(r=!0)}if("data-heartbeat"===t.type){let r=t.data;r?.phase!=="stage1-waiting"||n||(n=!0,e.push(U("pipeline.classifying")))}"data-pipeline"===t.type&&"stage1-done"===t.data.phase&&e.push(U("pipeline.classifying"))}}return s&&(ta.current&&e[e.length-1]===ta.current&&e.pop(),e.push(s)),ta.current=s,e},[e4,D,t,U,s]),ts=(0,yE.useMemo)(()=>{let e=to.filter(e=>e!==s);return e[e.length-1]},[to,s]),tl=(0,yE.useRef)({at:0});ts!==tl.current.line&&(tl.current={line:ts,at:Date.now()});let tu=function({toolLine:e,toolLineChangedAt:t,waitLine:r,now:n}){let i=e?.trim()||void 0,a=r?.trim()||void 0;return i&&!a||i&&void 0!==t&&n-t<7e3?i:a}({toolLine:ts,toolLineChangedAt:ts?tl.current.at:void 0,waitLine:s,now:Date.now()}),[tc,td]=(0,yE.useState)(void 0),tp=(0,yE.useRef)(void 0),th=(0,yE.useRef)(tu);th.current=tu;let tf=(0,yE.useRef)(void 0);tf.current=s&&void 0!==l?{line:s,since:l}:void 0,(0,yE.useEffect)(()=>{let e,t=()=>{let{shown:r,recheckInMs:n}=yH(tp.current??tf.current,th.current,Date.now());r!==tp.current&&(tp.current=r,td(r)),null!==n&&(e=setTimeout(t,n))};return t(),()=>clearTimeout(e)},[tu]);let tm=tc?.line??(void 0!==l&&s?s:tu),tg=void 0!==l&&tm===s&&Date.now()-l>400,ty=(0,yE.useMemo)(()=>{let e=-1,t=[];return e4.forEach((r,n)=>{gb(r)&&"data-codeStream"===r.type&&(e=n,t.push(r.data.delta))}),{lastIndex:e,code:t.join("")}},[e4]),tv=(0,yE.useMemo)(()=>e4.some(e=>g_(e)&&("input-available"===e.state||"input-streaming"===e.state)),[e4]),tb=(0,yE.useCallback)(()=>g?.(e.id),[g,e.id]),{forMessage:tx}=(0,xt.useReportedMessages)(),tk=(0,yC.useRouter)(),tw=D?void 0:tx(e.id),t_=(0,yE.useMemo)(()=>tw?{state:"done"===tw.status?"fixReady":"reported",onOpen:()=>tk.push(`/support?post=${tw.postId}`)}:void 0,[tw,tk]),tS=(0,yE.useCallback)(t=>{let r=ej?.originalContent??te();v?.(e.id,t,r),Y(!1)},[e.id,v,te,ej]),tE=(0,yE.useMemo)(()=>({deleteMessage:S?.deleteButton!==!1&&r&&y?()=>y(e.id):void 0}),[S?.deleteButton,r,y,e.id]);return(0,ew.jsx)(vD.ImageActionContext.Provider,{value:tE,children:(0,ew.jsxs)(eC.motion.div,{variants:yG.messageBubbleVariants,initial:"initial",animate:"animate",exit:"exit",className:`group flex items-start px-2 sm:px-3 py-2 sm:py-1 ${k?D?"border-r-2 border-[#39ff14] bg-[#39ff14]/[0.06] dark:bg-[#39ff14]/[0.08]":"border-l-2 border-[#39ff14] bg-[#39ff14]/[0.06] dark:bg-[#39ff14]/[0.08]":""}`,"aria-busy":!D&&t&&n||void 0,onTouchStart:eG,children:[(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("h2",{className:"sr-only",tabIndex:-1,"data-turn-heading":!0,children:D?z("a11y.youSaid"):z("a11y.botSaid")}),(0,ew.jsxs)("div",{className:"group/content",children:[(0,ew.jsxs)("div",{"data-long-press":"true",className:`${K?"max-w-full":e3?"max-w-full sm:max-w-[95%]":D?"max-w-[75vw] sm:max-w-[80%]":"max-w-full"} ${D&&!K?"ml-auto text-right":""} ${K?"":"overflow-x-clip"}`,onPointerDown:e=>{e2.onPointerDown(e)||e1.onPointerDown(e)},onPointerMove:e1.onPointerMove,onPointerUp:e=>{e2.onPointerUp(e),e1.onPointerUp(e)},onPointerCancel:e1.onPointerCancel,onPointerLeave:e1.onPointerLeave,onContextMenu:e1.onContextMenu,onClickCapture:e1.onClickCapture,children:[D&&K&&(0,yj.createPortal)((0,ew.jsx)(Od,{content:te(),onSave:eJ,onCancel:()=>W(!1),mode:"user-message",focusWord:Q,focusWordOffset:et}),document.body),!D&&ej?.supersedesTools&&(0,ew.jsx)("div",{className:"px-4 py-2.5",children:(0,ew.jsx)("div",{className:"prose prose-sm prose-gray max-w-none dark:prose-invert [overflow-wrap:anywhere]","data-msg-id":e.id,children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:yD.markdownComponents,children:eD?ej.originalContent:ej.editedContent})})}),e4.map((i,a)=>
188{if(ej?.supersedesTools)return null;if(gx(i)){var o;let s;if(eZ||!D&&t&&n&&e9.visible)return null;if(e8.has(a)){let e=OI(i.text).trim();return e?(0,ew.jsx)("div",{className:"px-1 py-1 text-sm text-gray-500 dark:text-gray-400 italic",children:e},a):null}let l=i.text;if(eD&&ej)if(a!==e7)return null;else l=ej.originalContent;let u=D?null:function(e){let t=e.trim(),r=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?\s*```\s*$/);if(r&&(t=r[1].trim()),!t.startsWith("{")&&!t.startsWith("["))return null;try{let e,r=JSON.parse(t);if(Array.isArray(r))e=r;else{if("object"!=typeof r||null===r)return null;let t=Object.values(r).filter(Array.isArray);if(1!==t.length)return null;e=t[0]}if(e.length<3||!e.every(e=>"object"==typeof e&&null!==e))return null;return e.map((e,t)=>{let r=[],n=Object.keys(e).find(e=>/title|name|heading/i.test(e)),i=n?String(e[n]):`Item ${t+1}`;for(let[a,o]of(r.push(`**${t+1}. ${i}**`),Object.entries(e))){if(a===n||null==o)continue;let e=a.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());r.push(`*${e}:* ${String(o)}`)}return r.join("\n")}).join("\n\n")}catch{return null}}(l.trim()),c=D?l:Ok(OI((o=u??l).length<=3e4?o:o.slice(0,3e4)+"\n\nâ¦").replace(/(?<=^|[\s(>])\*\*\s+([^*\n]+)\*\*/gm,"**$1**"),eL),h=eq?c.replace(/```mermaid[\s\S]*?```/g,"").replace(/^(?:graph\s+(?:TD|LR|RL|BT|TB)|flowchart(?:\s+(?:TD|LR|RL|BT|TB))?|sequenceDiagram|stateDiagram(?:-v2)?|gantt|pie\b|erDiagram|journey|gitGraph|mindmap|timeline)\b[^\n]*(?:\n(?!\s*\n)[^\n]*)*/gim,"").trim():c,f=D||eV?null:yL(h),m=f?f.rest:!D&&eV&&(s=yL(h))?s.rest:h,g=D||eq?null:(0,yF.extractLeakedDiagram)(m),y=g?g.rest:m,v=D?y:function(e,t){let r=[];for(let e of t.parts)if(g_(e)&&"webContext"===gE(e)&&"output-available"===e.state){let t=e.output,n=t?.sources;n&&r.push(...n)}return 0===r.length?e:e.replace(/\[\^?(\d+)\^?\]/g,(e,t)=>{let n=parseInt(t,10),i=e.includes("^")?n-1:n;if(i>=0&&i<r.length){let e=r[i];try{let t=new URL(e.url).hostname.replace(/^www\./,"");return`[${t}](${e.url})`}catch{}}return e})}(y,e);return(v||f||g)&&(!D||!K)?(0,ew.jsxs)("div",{className:`px-4 py-2.5 transition-[filter,opacity] duration-300 ${D?"inline-block max-w-full text-left rounded-2xl bg-gray-900 text-gray-50 shadow-md dark:bg-gray-100 dark:text-gray-900 dark:shadow-lg dark:shadow-gray-900/30":"block w-full text-gray-800 dark:text-gray-100"} ${eX.open?"ring-2 ring-amber-400 dark:ring-amber-500":""}`,children:[D?(0,ew.jsx)(OD,{text:i.text}):(0,ew.jsx)("div",{className:"prose prose-sm prose-gray max-w-none dark:prose-invert [overflow-wrap:anywhere]","data-msg-id":e.id,children:(()=>{let t=function(e){let t,r=e.replace(OS,""),n=[],i=0;for(O_.lastIndex=0;null!==(t=O_.exec(r));){if(t.index>i&&n.push({type:"text",content:r.slice(i,t.index)}),void 0!==t[1])n.push({type:"details",title:t[1].trim(),content:t[2].trim()});else if(void 0!==t[3])n.push({type:"imageButton",query:(0,yK.cleanTagPayload)(t[3])});else if(void 0!==t[4])n.push({type:"videoButton",query:(0,yK.cleanTagPayload)(t[4])});else if(void 0!==t[5])n.push({type:"newsButton",query:(0,yK.cleanTagPayload)(t[5])});else if(void 0!==t[6])for(let e of t[6].split("|").map(e=>(0,yK.cleanTagPayload)(e.trim())).filter(Boolean))n.push({type:"suggestion",title:e});else void 0!==t[7]&&n.push({type:"generateButton",query:(0,yK.cleanTagPayload)(t[7])});i=t.index+t[0].length}return i<r.length&&n.push({type:"text",content:r.slice(i)}),n}(v),i=[],o=0,s=-1;for(let e=t.length-1;e>=0;e--)if("text"===t[e].type){s=e;break}let l=-1;for(let e=e4.length-1;e>=0;e--)if(gx(e4[e])){l=e;break}let u="continue"===e5&&!!d&&a===l,c=tn.itemPairs.get(a),h=yD.markdownComponents;if(c){let e=c.byStartLine;h={...yD.markdownComponents,ol:({className:e,children:t,...r})=>(0,ew.jsx)("ol",{className:e,style:{paddingInlineStart:"10px"},...r,children:t}),li:({node:t,className:r,children:n,...i})=>{let a=t?.position?.start?.line,o=null!=a?e.get(a):void 0;return(0,ew.jsx)(OO,{media:o,className:r,...i,children:n})}}}let f=h.a??yD.markdownComponents.a,m=u?{...h,a:({href:t,children:n,...i})=>"#gdprchat-continue"===t?(0,ew.jsx)("button",{type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),d?.(e.id)},onMouseDown:e=>{e.stopPropagation()},disabled:!r||p,"data-continue-link":"true","data-long-press-skip":"true","data-disabled-hit":"keep",className:"underline underline-offset-2 hover:opacity-80 curs
188or-pointer disabled:cursor-progress disabled:opacity-70 disabled:hover:opacity-70 px-1 py-1 -mx-1 -my-1 relative z-10",children:n}):"#gdprchat-why"===t?(0,ew.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),q(e=>!e)},onMouseDown:e=>{e.stopPropagation()},"data-why-link":"true","data-long-press-skip":"true",className:"underline underline-offset-2 hover:opacity-80 cursor-pointer px-1 py-1 -mx-1 -my-1 relative z-10",children:n}):f({href:t,children:n,...i})}:h,g=!ec&&n;for(;o<t.length;){let e=t[o];if("text"===e.type){let t=u&&o===s?e.content+function(e){let t=e.match(/^[ \t]*```/gm);return t&&t.length%2==1?"\n```\n\n":""}(e.content)+H:e.content;i.push((0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:m,children:t},o)),o++}else if("details"===e.type)i.push((0,ew.jsx)(v3,{title:e.title,children:(0,ew.jsx)("div",{className:"prose prose-sm prose-gray max-w-none dark:prose-invert",children:(0,ew.jsx)(yO.default,{remarkPlugins:yD.remarkPlugins,rehypePlugins:yD.rehypePlugins,components:h,children:e.content})})},o)),o++;else if("imageButton"===e.type||"videoButton"===e.type||"newsButton"===e.type||"generateButton"===e.type){let e=["imageButton","videoButton","newsButton","generateButton"],r=[];for(;o<t.length&&e.includes(t[o].type);)r.push(t[o]),o++;let n=e=>"generateButton"===e?"mediaBtnGenerateImage":"imageButton"===e?"mediaBtnFindImage":"videoButton"===e?"mediaBtnFindVideo":"mediaBtnFindNews",a=e=>"imageButton"===e?"imageSearch":"videoButton"===e?"videoSearch":"generateButton"===e?"generateImage":"newsSearch",s=r.some(e=>"generateButton"===e.type)&&r.some(e=>"imageButton"===e.type);!g&&s&&i.push((0,ew.jsx)("p",{className:"not-prose my-3 text-sm text-gray-700 dark:text-gray-200",children:z("mediaBtnChooseLead")},`media-btn-${o}`)),g&&i.push((0,ew.jsxs)("div",{className:"not-prose my-3",children:[s&&(0,ew.jsx)("p",{className:"mb-2 text-sm text-gray-700 dark:text-gray-200",children:z("mediaBtnChooseLead")}),(0,ew.jsx)("div",{className:"flex flex-col gap-2",children:r.map((e,t)=>(0,ew.jsx)(vj.Button,{size:"sm",color:"gray",className:"h-auto w-fit whitespace-normal py-2 text-left",onClick:()=>{ed(!0),eT(`[${a(e.type)}] ${e.query}`)},children:z(n(e.type))},t))})]},`media-btn-${o}`))}else{let e=[];for(;o<t.length&&"suggestion"===t[o].type;)e.push(t[o]),o++;g&&i.push((0,ew.jsx)("div",{className:"not-prose my-3 flex flex-col gap-2",children:e.map((e,t)=>(0,ew.jsx)(vj.Button,{size:"sm",color:"gray",className:"h-auto w-fit whitespace-normal py-2 text-left",onClick:()=>{ed(!0),eT(e.title)},children:e.title},t))},`suggest-${o}`))}}return i})()}),g&&(0,ew.jsx)("div",{className:"not-prose mt-3",children:(0,ew.jsx)(yJ.MermaidRenderer,{title:B("mermaidDiagram"),code:g.diagram.code})}),f&&(0,ew.jsx)("div",{className:"not-prose mt-3",children:(0,ew.jsx)(yW.ChartRenderer,{title:f.chart.title||"Chart",chartType:f.chart.chartType,data:f.chart.data,seriesNames:f.chart.seriesNames,xAxisLabel:f.chart.xAxisLabel,yAxisLabel:f.chart.yAxisLabel,valuePrefix:f.chart.valuePrefix,valueSuffix:f.chart.valueSuffix,colors:f.chart.colors})})]},a):null}if(g_(i)){let r=gE(i);if(!OP.has(r))return null;if("output-available"===i.state){if(S?.toolDetails===!1||tn.consumedToolPartIndices.has(a))return null;if("webSearch"===r&&(eH||t)){let e=i.output,t=e?._searchType;if("news"===t||"video"===t)return null}return"newsSearch"===r&&(eH||t)?null:(0,ew.jsx)(vR.ToolResult,{toolName:r,result:i.output,toolInput:i.input,conversationLocale:_,isStreaming:t},a)}if("output-error"===i.state||"output-denied"===i.state){let e=OR[r]??y8.Code;return(0,ew.jsxs)("div",{className:"my-2 flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 dark:border-amber-800 dark:bg-amber-950/30",children:[(0,ew.jsx)(y0.AlertTriangle,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,ew.jsx)(e,{className:"h-3.5 w-3.5 shrink-0 text-amber-500 dark:text-amber-400"}),(0,ew.jsx)("span",{className:"text-xs text-amber-700 dark:text-amber-400",children:z("toolErrorFailed",{tool:r.replace(/([A-Z])/g," $1").trim()})}),g?(0,ew.jsx)("button",{type:"button",onClick:tb,className:"ml-auto shrink-0 text-xs font-medium text-amber-800 underline underline-offset-2 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-200",children:z("toolErrorTellUs")}):null]},a)}if(!t)return null;let n=i.toolCallId;if(n&&e.parts.some(e=>
188g_(e)&&e.toolCallId===n&&"output-available"===e.state))return null;if("generateImage"===r){let e=i.input,t=function(e){let t=/^(\d+):(\d+)$/.exec((e??"").trim());if(!t)return{w:1,h:1};let r=Number(t[1]),n=Number(t[2]);return r>0&&n>0?{w:r,h:n}:{w:1,h:1}}(e?.aspectRatio);return(0,ew.jsx)(eC.motion.div,{variants:yG.toolIndicatorVariants,initial:"initial",animate:"animate",exit:"exit",className:"my-2",style:{overflowAnchor:"none"},children:(0,ew.jsx)(yM.ImageGeneratingShimmer,{width:t.w,height:t.h,className:"w-full max-w-sm",label:z("imageWorking")})},a)}return null}if(gb(i)){let e=i.type;if("data-writingStyleName"===e||"data-specialist-status"===e||"data-pipeline"===e)return null;if("data-searchResults"===e){if(!t||e4.some(e=>g_(e)&&"output-available"===e.state&&("webSearch"===gE(e)||"webContext"===gE(e))))return null;let e=i.data;return e.results?.length?(0,ew.jsx)(eC.motion.div,{variants:yG.scaleInVariants,initial:"initial",animate:"animate",className:"my-2",children:(0,ew.jsx)("div",{className:"space-y-0.5",children:e.results.map((e,t)=>(0,ew.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded px-1.5 py-1 text-xs text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200 transition-colors",children:[(0,ew.jsx)("span",{className:"w-28 shrink-0 truncate font-medium text-gray-500 dark:text-gray-400",children:(()=>{try{return new URL(e.url).hostname.replace("www.","")}catch{return e.url}})()}),(0,ew.jsx)("span",{className:"truncate",children:e.title}),(0,ew.jsx)(vb.ExternalLink,{className:"ml-auto h-2.5 w-2.5 shrink-0 text-gray-400"})]},t))})},i.id??a):null}if("data-codeStream"===e){if(!t||a!==ty.lastIndex)return null;let e=ty.code;if(!e)return null;let r=i.data.tool;return(0,ew.jsx)(v6,{code:e,tool:r},"code-stream")}if("data-scratchpad"===e)return(0,ew.jsx)(vX,{data:i.data},i.id??a);if("data-generatedDocument"===e)return(0,ew.jsx)(v4,{data:i.data},i.id??a);if("data-codeAgentProgress"===e||"data-agentProgress"===e)return null;if("data-credits-exhausted"===e){let e=i.data,t=e.plan;return(0,ew.jsx)(b7.CreditsExhaustedNotice,{planSlug:e.planSlug??t?.slug,planDailyCredits:e.planDailyCredits??t?.dailyCredits,resetAt:e.resetAt,upgradeUrl:e.upgradeUrl,nextTier:e.nextTier},i.id??a)}}return null}),!t&&e4.map((e,r)=>{if(ej?.supersedesTools||!g_(e)||"output-available"!==e.state||S?.toolDetails===!1||tn.consumedToolPartIndices.has(r))return null;let n=gE(e),i=!1;if("newsSearch"===n&&eH)i=!0;else if("webSearch"===n&&eH){let t=e.output,r=t?._searchType;("news"===r||"video"===r)&&(i=!0)}return i?(0,ew.jsx)(vR.ToolResult,{toolName:n,result:e.output,toolInput:e.input,conversationLocale:_,isStreaming:t},`deferred-${r}`):null}),!D&&!t&&S?.toolDetails!==!1&&(M=(j=e4.find(e=>g_(e)&&"comparePrices"===gE(e)&&"output-available"===e.state))?j.output:void 0,M?.deepAvailable&&M.query&&Array.isArray(M.offers)&&0!==M.offers.length?(0,ew.jsx)(vR.PriceHunterDeepSearch,{query:M.query,locale:_}):null),!D&&t&&n&&!!tu&&!!tm&&(!eH||tv)&&(0,ew.jsx)("div",{className:"py-1 h-[2.125rem]",style:{overflowAnchor:"none"},children:(0,ew.jsx)(yY,{realMessages:[tm],startComplete:tg})}),"continue"===e5&&Z&&(0,ew.jsx)("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 leading-relaxed",children:F("continue")}),"retry"===e5&&(0,ew.jsxs)("div",{className:"my-2 flex flex-wrap items-center gap-2 text-sm text-gray-600 dark:text-gray-400",role:"status",children:[(0,ew.jsx)("span",{children:z("truncated")}),c&&(0,ew.jsx)(vO.Button,{variant:"secondary",size:"sm",onClick:()=>c(e.id),children:z("truncationTryAgain")})]}),"slow"===e6&&"retry"!==e5&&(0,ew.jsxs)("div",{className:"my-2 flex flex-wrap items-center gap-2 text-sm text-gray-600 dark:text-gray-400",role:"status",children:[(0,ew.jsx)("span",{children:z("slowResponseNotice")}),c&&(0,ew.jsx)(vO.Button,{variant:"secondary",size:"sm",onClick:()=>c(e.id),children:z("slowResponseRetry")})]}),!D&&ej&&(O=e=>`text-xs font-medium px-3 py-1.5 sm:px-2 sm:py-0.5 rounded transition-colors flex items-center gap-1 ${e?"text-blue-600 dar
188k:text-blue-400":"text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400"}`,(0,ew.jsxs)("div",{className:"mt-2 flex items-center gap-1",children:[(0,ew.jsxs)("button",{type:"button",onClick:()=>eO("latest"),className:O("latest"===eM),children:[(0,ew.jsx)(vx.Pencil,{className:"h-3.5 w-3.5"}),P("yourVersion")]}),(0,ew.jsx)("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),(0,ew.jsxs)("button",{type:"button",onClick:()=>eO("original"),className:O("original"===eM),children:[(0,ew.jsx)(vc.UserRound,{className:"h-3.5 w-3.5"}),P("original")]})]})),!D&&!K&&!t&&r&&((0,Oy.isUserStoppedAssistant)(e)||!eK||(0,Oy.isFetchOnlyAssistant)(e))&&(0,ew.jsx)("div",{className:"px-4 py-2.5 text-sm text-gray-500 dark:text-gray-400",children:z("answerStopped")})]}),!K&&eK&&(0,ew.jsx)("div",{className:`mt-1 hidden sm:flex ${D?"justify-end":"justify-start"} ${J?"opacity-100 pointer-events-auto transition-opacity duration-150":"opacity-0 pointer-events-none transition-opacity duration-1000 ease-in can-hover:group-hover/content:opacity-100 can-hover:group-hover/content:pointer-events-auto can-hover:group-hover/content:duration-150 can-hover:group-hover/content:ease-out"}`,children:(0,ew.jsx)(bo,{isUser:D,onCopy:S?.copyButton!==!1?tt:void 0,copyMode:S?.copyButton!==!1?eW:"none",onShareMessage:S?.shareButton!==!1&&!D&&r&&m?()=>{let t=ej?eM:"original",r=ej&&"latest"===eM?"edited":null;m(e.id,{versionView:t,author:r})}:void 0,onDiscuss:S?.ratingButtons!==!1?tb:void 0,reportedCase:S?.ratingButtons!==!1?t_:void 0,onExplain:!D&&r&&eK&&!eU?()=>ef(e=>!e):void 0,explanationOpen:eh,onDeleteFromHere:S?.deleteButton!==!1&&r&&y?()=>y(e.id):void 0,onRetry:S?.retryButton!==!1&&D&&r&&c?()=>c(e.id):void 0,onKeepOnlyThis:S?.keepOnlyButton!==!1&&!D&&r&&b?()=>b(e.id):void 0,isBookmarked:k,onToggleBookmark:S?.bookmarkButton!==!1&&r&&w?()=>w(e.id):void 0,onGenerateExpand:S?.expandButtons!==!1&&!D&&r?tr:void 0,expandLoading:eo,expandGenerated:null!==ei,isReady:r,onRewrite:S?.textEditorButton!==!1&&r&&(D||!D&&v)?eP:void 0})})]}),!D&&!K&&r&&!t&&eK&&!em&&(0,ew.jsx)(bg,{messageId:e.id,conversationId:N??null,persisted:e.metadata?.tailoringOffer??null}),!D&&!K&&r&&!t&&eK&&!eU&&(0,ew.jsx)("div",{className:"flex items-center justify-end gap-2 px-4 empty:hidden",children:(0,ew.jsx)(Op.ZenButton,{content:eZ?"":te(),toolParts:eF,onOpen:ek})}),eh&&!D&&(0,ew.jsx)(b2,{message:e,conversationId:N??null,conversationLocale:_,hasEarlierWebSources:i,hasPriorConversation:a,priorMessageCount:o,onSuggestionClick:h}),em&&ti.length>0&&(0,yj.createPortal)((0,ew.jsx)(Oh.ZenOverlay,{cards:ti,onClose:e$,onStartNewSearch:h?eI:void 0,conversationLocale:_,streamingParts:t?e4:void 0,onContinue:"continue"===e5&&d?()=>d(e.id):void 0,autoZenOn:$,onToggleAutoZen:T}),document.body),ey&&(0,yj.createPortal)((0,ew.jsx)("div",{className:"fixed inset-0 z-[10000] pointer-events-none bg-black",style:{animation:"zen-fade-to-black 2s ease-in-out forwards"}}),document.body),X&&(0,yj.createPortal)((0,ew.jsx)(Od,{content:te(),onSave:tS,onCancel:()=>Y(!1),mode:"assistant",defaultFilename:(0,MJ.slugifyFilename)(A??"gdprchat-document"),focusWord:Q,focusWordOffset:et}),document.body),(()=>{let t=[];if(ei&&ei.length>0)t=ei.map(e=>{let t=e.replace(/^\[\d+\]\s*/,"");return{label:t.replace(/^\[.+?\]\s*/,""),onClick:()=>{eu(e=>new Set(e).add(t)),eT(t)},fireKey:t}});else{let r=e.parts.find(e=>"data-expand-buttons"===e.type),n=r?r.data:null,i=n?.buttons??[];t=[...(n?.mediaSuggestions??[]).map(e=>{let t=`[${e.type}] ${e.query}`;return{label:e.query,onClick:()=>{eu(e=>new Set(e).add(t)),eT(t)},fireKey:t}}),...i.map(e=>{let t=e.replace(/^\[\d+\]\s*/,"");return{label:t.replace(/^\[.+?\]\s*/,""),onClick:()=>{eu(e=>new Set(e).add(t)),eT(t)},fireKey:t}})]}let n=(S?.expandButtons!==!1?t:[]).filter(e=>!el.has(e.fireKey));return 0===n.length?null:(0,ew.jsx)("div",{ref:ep,className:"not-prose mt-4 flex flex-col gap-2",children:n.map((e,t)=>(0,ew.jsxs)(vj.Button,{size:"sm",color:"gray",disabled:!r,className:`h-auto w-fit whitespace-normal py-2 text-left${!r?" opacity-50 cursor-not-allowed":""}`,onClick:e.onClick,children:[(0,ew.jsx)(vp.Lightbulb,{className:"mr-1.5 h-3.5 w-3.5 shrink-0"}),e.label]},t))})})()]}),(0,ew.jsxs)(xr.ContextActionSheet,{open:eX.open,onClose:()=>{eY({open:!1,anchor:null}),en.current=null},anchor:eX.anchor,children:["none"!==eW&&S?.copyButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:"image"===eW?vt.ImageIcon:vk.Copy,label:"image"===eW?z("tooltipCopyImage"):z("tooltipCopy"),onSelect:()=>{tt()}}),"text"===eW&&S?.copyButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:vw,label:z("tooltipSelectText"),onSelect:()=>e0(!0)}),!D&&r&&m&&S?.shareButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:v_.Share2,label:z("tooltipShare"),onSelect:()=>{let t=ej?eM:"original",r=ej&&"latest"===eM?"edited":null;m(e.id,{versionView:t,author:r})}}),r&&(D||!D&&!!v)&&S?.textEditorButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:vx.Pencil,label:P(D?"titleUserEdit":"titleAssistantEdit"),onSelect:eP}),!D&&r&&S?.expandButtons!==!1&&null===ei&&(0,ew.jsx)(xr.ContextAction,{icon:vp.Lightbulb,label:z("tooltipSuggestions"),disabled:eo,onSelect:()=>{tr()}}),!D&&r&&eK&&!eU&&(0,ew.jsx)(xr.ContextAction,{icon:vI.Info,label:z("tooltipGenerated"),onSelect:()=>ef(e=>!e)}),!D&&S?.ratingButtons!==!1&&(t_?(0,ew.jsx)(xr.ContextAction,{icon:"fixReady"===t_.state?vN.Wrench:vS.ThumbsDown,label:L("fixReady"===t_.state?"fixReadyMarker":"reportedMarker"),onSelect:t_.onOpen}):(0,ew.jsx)(xr.ContextAction,{icon:vS.ThumbsDown,label:L("reportAnswer"),onSelect:tb})),!D&&r&&b&&S?.keepOnlyButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:vC,label:z("tooltipKeepOnly"),onSelect:()=>b(e.id)}),r&&w&&S?.bookmarkButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:vE,label:k?z("tooltipBookmarked"):z("tooltipBookmark"),onSelect:()=>w(e.id)}),D&&r&&c&&S?.retryButton!==!1&&(0,ew.jsx)(xr.ContextAction,{icon:v$.RefreshCw,label:z("tooltipRetry"),onSelect:()=>c(e.id)}),r&&y&&S?.deleteButton!==!1&&(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(xr.ContextActionDivider,{}),(0,ew.jsx)(xr.ContextAction,{icon:vT.Trash2,label:z("tooltipDeleteFromHere"),destructive:!0,onSelect:()=>y(e.id)})]}),!D&&r&&(()=>{let t=bS(e.metadata);if(!t)return null;let r=bk(t);return(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(xr.ContextActionDivider,{}),(0,ew.jsxs)("div",{className:"flex w-full items-center gap-3 px-4 py-3 text-sm text-gray-500 sm:py-2 sm:text-xs dar
188k:text-gray-400",children:[(0,ew.jsx)(vA.Coins,{className:"h-5 w-5 shrink-0 sm:h-4 sm:w-4","aria-hidden":!0}),(0,ew.jsx)("span",{className:"flex-1",children:z("creditsUsedFact",{credits:r.toLocaleString()})})]})]})})()]}),eQ&&(0,ew.jsx)(vQ,{open:eQ,onOpenChange:e0,text:te(),...r&&(D||!D&&v)&&S?.textEditorButton!==!1?{editorLabel:P(D?"titleUserEdit":"titleAssistantEdit"),onOpenEditor:eP}:{}})]})})}var OU=e.i(751737),OB=e.i(500110);let OZ={EMAIL_ADDRESS:"Email address",PHONE_NUMBER:"Phone number",CREDIT_CARD:"Credit card number",IBAN_CODE:"IBAN",IP_ADDRESS:"IP address",MAC_ADDRESS:"MAC address",DK_CPR:"CPR number (Danish SSN)",NATIONAL_ID:"National ID number",VAT_NUMBER:"VAT number",PASSPORT:"Passport number",DRIVER_LICENSE:"Driver's license number",TAX_ID:"Tax ID number",SOCIAL_INSURANCE:"Social insurance number",FISCAL_CODE:"Fiscal code (Italy)",NATIONAL_INSURANCE:"National Insurance number (UK)",PERSON_NAME:"Person name",LOCATION_IDENTIFIER:"Identifying location reference",INDIRECT_IDENTIFIER:"Indirect personal identifier"};function Oq({text:e,entities:t}){let r=[],n=0;for(let i of t)i.start>n&&r.push(e.slice(n,i.start)),r.push((0,ew.jsx)("mark",{className:"rounded-sm px-0.5 bg-red-400/40 text-inherit dark:bg-red-500/30",children:e.slice(i.start,i.end)},`${i.start}-${i.end}`)),n=i.end;return n<e.length&&r.push(e.slice(n)),(0,ew.jsx)(ew.Fragment,{children:r})}function OV({blocked:e,onDelete:t,onTogglePiiLock:r,onAllowFile:n}){let i=(0,eS.useTranslations)("piiBlock"),a=(0,eS.useTranslations)("chat");if(e.fileUpload){let r=Array.from(new Set(e.entities.map(e=>OZ[e.entity_type]).filter(Boolean))).join(", ");return(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:yG.springBouncy,className:"flex px-2 sm:px-3 py-3",role:"status",children:(0,ew.jsx)("div",{className:"mr-auto min-w-0 max-w-[85vw] rounded-2xl border border-gray-200 bg-gray-50 p-4 sm:max-w-md dark:border-gray-700 dark:bg-gray-800/50",children:(0,ew.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,ew.jsx)(bN.ShieldCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-gray-500 dark:text-gray-400"}),(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:i("fileHasPersonalData")}),(0,ew.jsxs)("div",{className:"mt-1 flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[(0,ew.jsx)(y5.FileText,{className:"h-3.5 w-3.5 shrink-0"}),(0,ew.jsx)("span",{className:"truncate",title:e.fileUpload.filename,children:e.fileUpload.filename})]}),r&&(0,ew.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:i("foundInFile",{types:r})}),(0,ew.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:i("caughtOnDevice")}),(0,ew.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,ew.jsxs)("button",{type:"button",onClick:()=>t(e.id),className:"inline-flex items-center gap-1.5 rounded-md bg-accent-solid px-3 py-1.5 text-xs font-medium text-accent-foreground transition-colors hover:bg-accent-solid-hover",children:[(0,ew.jsx)(vT.Trash2,{className:"h-3.5 w-3.5"}),i("removeFile")]}),n&&(0,ew.jsxs)("button",{type:"button",onClick:()=>n(e),className:"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-200 dark:text-gray-300 dark:hover:bg-gray-700",children:[(0,ew.jsx)(ve.Paperclip,{className:"h-3.5 w-3.5"}),i("attachAnyway")]})]}),(0,ew.jsx)("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:i("filterStaysOn")})]})]})})})}return(0,ew.jsxs)(eC.motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:yG.springBouncy,className:"flex items-start px-2 sm:px-3 py-3",children:[(0,ew.jsx)("h2",{className:"sr-only",tabIndex:-1,"data-turn-heading":!0,children:a("a11y.youSaid")}),(0,ew.jsxs)("div",{className:"min-w-0 max-w-[75vw] sm:max-w-[80%] ml-auto text-right",children:[(0,ew.jsx)("div",{className:"inline-block max-w-full rounded-2xl bg-gray-900 px-4 py-2.5 text-gray-50 dark:bg-gray-100 dark:text-gray-900",children:(0,ew.jsx)("p",{className:"text-sm whitespace-pre-wrap text-left [overflow-wrap:anywhere]",children:(0,ew.jsx)(Oq,{text:e.text,entities:e.entities})})}),(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,scale:.95}
188,animate:{opacity:1,scale:1},transition:{delay:.15,duration:.25},className:"mt-2 flex items-start gap-2 justify-end",role:"alert",children:(0,ew.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-950/30",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ew.jsx)(OU.ShieldAlert,{className:"h-3.5 w-3.5 shrink-0 text-amber-500 dark:text-amber-400"}),(0,ew.jsxs)("span",{className:"text-xs font-medium text-gray-900 dark:text-gray-100",children:[i("piiDetected")," â ",i("messageBlocked")]})]}),(0,ew.jsx)("ul",{className:"mt-1 space-y-0.5 pl-6",children:e.entities.map((e,t)=>(0,ew.jsxs)("li",{className:"text-xs text-gray-600 dark:text-gray-300",children:[OZ[e.entity_type],": â",e.text,"â"]},t))}),(0,ew.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-2 pl-6",children:[(0,ew.jsxs)("button",{type:"button",onClick:()=>t(e.id),className:(0,v7.cn)("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors","bg-comp-a-surface-emphasis text-comp-a-text-strong","hover:bg-amber-200 dark:hover:bg-amber-900/50"),children:[(0,ew.jsx)(vT.Trash2,{className:"h-3 w-3"}),i("deleteMessage")]}),r&&(0,ew.jsxs)("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-200 dark:text-gray-300 dark:hover:bg-gray-700",children:[(0,ew.jsx)(OB.ShieldOff,{className:"h-3 w-3"}),i("turnOffPiiFilter")]})]}),(0,ew.jsx)("p",{className:"mt-2 pl-6 text-xs text-gray-500 dark:text-gray-400",children:i("piiExplanation")}),(0,ew.jsxs)("div",{className:"mt-2 pl-6 space-y-1",children:[(0,ew.jsx)("p",{className:"text-xs font-medium text-gray-900 dark:text-gray-100",children:i("protectionLayers")}),(0,ew.jsxs)("ul",{className:"text-xs text-gray-500 dark:text-gray-400 space-y-0.5 list-none",children:[(0,ew.jsxs)("li",{children:["1. ",i("layer1Short")]}),(0,ew.jsxs)("li",{children:["2. ",i("layer2Short")]}),(0,ew.jsxs)("li",{children:["3. ",i("layer3Short")]})]}),(0,ew.jsxs)("a",{href:"/dpa",target:"_blank",rel:"noopener noreferrer",className:"inline-block mt-1 text-xs font-medium text-accent-text hover:underline",children:[i("learnMore"),"â"]})]})]})})]})]})}function OH({bodyKey:e,className:t}){let r=(0,eS.useTranslations)("chat.whyAmISeeing"),[n,i]=(0,e_.useState)(!1);return(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e=>!e)},"aria-expanded":n,className:(0,v7.cn)("cursor-pointer text-gray-500 dark:text-gray-400 underline underline-offset-2 hover:text-gray-700 dark:hover:text-gray-200",t),children:r(n?"hide":"toggle")}),n?(0,ew.jsx)("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400 leading-relaxed",children:r(e)}):null]})}function OK({summary:e,rawHistory:t}){let r=(0,eS.useTranslations)("chat.dreamerSummary"),[n,i]=(0,e_.useState)(!1);return(0,ew.jsxs)("div",{className:"my-3 rounded-2xl border border-gray-200 bg-gray-50 p-4 text-sm text-gray-700 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200",children:[(0,ew.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,ew.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r("header")}),t?(0,ew.jsx)("button",{type:"button",onClick:()=>i(e=>!e),className:"text-xs text-gray-500 underline-offset-2 hover:underline dark:text-gray-400",children:r(n?"collapse":"expand")}):null]}),n&&t?(0,ew.jsx)("div",{className:"space-y-2",children:t}):(0,ew.jsx)("p",{className:"whitespace-pre-wrap leading-relaxed",children:e}),(0,ew.jsx)("div",{className:"mt-2",children:(0,ew.jsx)(OH,{bodyKey:"dreamerSummary"})})]})}var OW=e.i(759684),OJ=e.i(118583);class OG extends y_.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("[MessageList] Render crash caught by error boundary:",e)}render(){return this.state.hasError?(0,ew.jsx)("div",{className:"flex h-full items-center justify-center p-8",children:(0,ew.jsxs)("div",{className:"max-w-sm rounded-2xl bg-white p-6 text-center shadow-sm dark:bg-gray-800 dark:shadow-md dark:shadow-gray-900/20",children:[(0,ew.jsx)(y0.AlertTriangle,{className:"mx-auto mb-3 h-8 w-8 text-amber-500 dark:text-amber-400"}),(0,ew.jsx)("p",{className:"mb-1 text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Something went wrong"}),(0,ew.jsx)("p",{className:"mb-4 text-xs text-gray-500 dark:text-gray-400",children:"The conversation display crashed. Your messages are safe."}),(0,ew.jsxs)("button",{onClick:()=>{this.setState({hasError:!1}),window.location.reload()},className:"inline-flex items-center gap-1.5 rounded-lg bg-gray-100 px-4 py-2 text-xs font-medium text-gray-900 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600",children:[(0,ew.jsx)(v$.RefreshCw,{className:"h-3.5 w-3.5"}),"Reload"]})]})}):this.props.children}}let OX=new Set(["data-progress","data-drift","data-pipeline","data-heartbeat","data-dreamer","data-phase"]),OY=new Set(["comparePrices","generateArtifact","runPython"]);function OQ(e){return"assistant"===e.role&&(0===e.parts.length||e.parts.every(e=>gx(e)?!OI(e.text??"").trim():!!gb(e)&&OX.has(e.type)))}function O0({messages:e,blockedMessages:t,isStreaming:r,isLoading:n,onEditSubmit:i,onRetry:a,onContinue:o,continuingMessageId:s,onSuggestionClick:l,onStop:u,onDeleteBlockedMessage:c,onTogglePiiLock:d,onAllowBlockedFile:p,pendingUserText:h,onShareMessage:f,conversationId:m,conversationTitle:g,onThumbsDown:y,onDeleteFromHere:v,onEditResponseSave:b,onKeepOnlyThis:x,onToolTimeout:k,chatDisplay:w,autoZenEnabled:_,autoZenRecoverSignal:S,auto
188ZenSettingOn:E,onAutoZenChange:C,onZenChange:$,recovering:T,scrollCommand:I}){let N=(0,y_.useRef)(new Map),A=(0,y_.useRef)([]),{data:j}=(0,yS.useSession)(),{votedLocale:M,locale:O}=(0,OJ.useLocale)(),D=M??O,R=(0,eS.useTranslations)("chat"),P=(0,eS.useTranslations)("statusLine"),[z,L]=(0,y_.useState)(new Set),F=(0,y_.useRef)(null);(0,y_.useEffect)(()=>{if(!m||0===e.length||F.current===m)return;F.current=m;let t=new Set;for(let r of e){let e=r.metadata;e?.bookmarked&&t.add(r.id)}t.size>0&&L(t)},[m,e]),(0,y_.useEffect)(()=>{m||(L(new Set),F.current=null)},[m]);let U=(0,y_.useRef)(z);(0,y_.useEffect)(()=>{U.current=z},[z]);let B=(0,y_.useCallback)(e=>{if(!m)return;let t=U.current.has(e);L(r=>{let n=new Set(r);return t?n.delete(e):n.add(e),n}),fetch(`/api/conversations/${m}/messages/${e}/highlights`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bookmarked:!t})}).catch(()=>{})},[m]),Z=(0,y_.useRef)(null),q=(0,y_.useRef)(null),V=(0,y_.useRef)(null),H=(0,y_.useRef)(e.length),K=(0,y_.useRef)(!1),W=(0,y_.useRef)(null),J=(0,y_.useRef)(null),G=(0,y_.useRef)(!1),X=(0,y_.useRef)(!1),Y=(0,y_.useRef)(void 0),[Q,ee]=(0,y_.useState)(!1),et=(0,y_.useCallback)(()=>{G.current=!1,X.current=!0,K.current=!1,J.current&&(J.current.style.height="0px"),requestAnimationFrame(()=>{Z.current?.scrollIntoView({behavior:"smooth",block:"end"})})},[]),er=(0,y_.useCallback)(()=>{let e=q.current,t=V.current,r=J.current,n=W.current;if(!e||!t||!r)return;if(!G.current||!n){"0px"!==r.style.height&&(r.style.height="0px");return}let i=r.offsetHeight,a=n.getBoundingClientRect().top-t.getBoundingClientRect().top,o=t.scrollHeight-i-a,s=Math.max(0,Math.round(e.clientHeight-o-12));Math.abs(s-i)>1&&(r.style.height=`${s}px`)},[]);(0,y_.useEffect)(()=>{let e=V.current,t=q.current;if(!e||!t)return;let r=null,n=new ResizeObserver(()=>{null===r&&(r=requestAnimationFrame(()=>{r=null,er()}))});return n.observe(e),n.observe(t),()=>{n.disconnect(),null!==r&&cancelAnimationFrame(r)}},[er]);let en=(0,y_.useCallback)(()=>{let e=q.current,t=V.current;if(!e)return;er();let r=W.current;if(!r||!t){e.scrollTop=e.scrollHeight;return}if(X.current)return;let n=0,i=()=>{er();let n=Math.max(0,Math.round(r.getBoundingClientRect().top-t.getBoundingClientRect().top-12));Math.abs(e.scrollTop-n)>2&&(e.scrollTop=n)};i(),requestAnimationFrame(function t(){e.isConnected&&!X.current&&(i(),++n<72&&requestAnimationFrame(t))})},[er]);(0,y_.useEffect)(()=>{let e=q.current;if(!e)return;let t=()=>{X.current=!0};return e.addEventListener("wheel",t,{passive:!0}),e.addEventListener("touchstart",t,{passive:!0}),e.addEventListener("keydown",t,!0),()=>{e.removeEventListener("wheel",t),e.removeEventListener("touchstart",t),e.removeEventListener("keydown",t,!0)}},[m,e.length]),(0,y_.useEffect)(()=>{let t=e.length>H.current,n=e.length>0&&"user"===e[e.length-1].role;if(H.current=e.length,t&&n){G.current=!0,X.current=!1,K.current=!0,requestAnimationFrame(en);return}r&&G.current&&!K.current&&(K.current=!0,requestAnimationFrame(en))},[e,r,en]),(0,y_.useEffect)(()=>{if(I){if("centerLastImage"===I.intent){G.current=!1,K.current=!0;let e=q.current,t=V.current;if(!e||!t)return;let r=0,n=()=>{let r=t.querySelectorAll("[data-generated-image]"),n=r[r.length-1];if(!n)return;let i=Math.max(0,Math.round(n.getBoundingClientRect().top-t.getBoundingClientRect().top-(e.clientHeight-n.offsetHeight)/2));Math.abs(e.scrollTop-i)>2&&(e.scrollTop=i)};n();let i=requestAnimationFrame(function t(){e.isConnected&&!X.current&&(n(),++r<180&&(i=requestAnimationFrame(t)))});return()=>cancelAnimationFrame(i)}"pinLastQuestion"===I.intent?(G.current=!0,X.current=!1,K.current=!0,requestAnimationFrame(en)):(G.current=!1,K.current=!1,J.current&&(J.current.style.height="0px"),requestAnimationFrame(()=>{Z.current?.scrollIntoView({behavior:"smooth",block:"end"})}))}},[I,en]);let ei=(0,y_.useRef)(r);(0,y_.useEffect)(()=>{let e=ei.current;if(ei.current=r,!(e&&!r))return;let t=q.current;if(!t)return;if(G.current&&!X.current)return void en();let n=t.scrollTop,i=0,a=requestAnimationFrame(function e(){t.isConnected&&(Math.abs(t.scrollTop-n)>1&&(t.scrollTop=n),++i<8&&(a=requestAnimationFrame(e)))});return()=>cancelAnimationFrame(a)},[r,en]),(0,y_.useEffect)(()=>{G.current=!1,X.current=!1,K.current=!1,J.current&&(J.current.style.height="0px"),Y.current=void 0},[m]),(0,y_.useEffect)(()=>
188{if(!m||0===e.length||G.current||Y.current===m)return;let t=q.current;if(!t)return;Y.current=m;let r=0,n=-1,i=0,a=!1,o=()=>{a=!0};t.addEventListener("wheel",o,{passive:!0}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("keydown",o,!0);let s=requestAnimationFrame(function e(){if(!t.isConnected||a)return;t.scrollTop=t.scrollHeight;let o=t.scrollHeight,l=t.scrollHeight>t.clientHeight+1;o===n?i++:(i=0,n=o),r++,l&&i>=4&&r>=6||r<72&&(s=requestAnimationFrame(e))});return()=>{cancelAnimationFrame(s),t.removeEventListener("wheel",o),t.removeEventListener("touchstart",o),t.removeEventListener("keydown",o,!0)}},[m,e.length]);let[ea,eo]=(0,y_.useState)(m),[es,el]=(0,y_.useState)(!1);m!==ea&&(el(null==ea&&null!=m),eo(m)),e.length>0&&es&&el(!1);let eu=!!m&&0===e.length&&!es,ec=0===e.length&&0===t.length&&!n&&!h&&!eu;(0,y_.useEffect)(()=>{let e=q.current;if(ec||!e)return void ee(!1);let t=()=>{ee(e.scrollHeight-e.scrollTop-e.clientHeight>240)};t(),e.addEventListener("scroll",t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),V.current&&r.observe(V.current),()=>{e.removeEventListener("scroll",t),r.disconnect()}},[ec,e.length]);let ed=(0,y_.useMemo)(()=>0===e.length?e:e.filter((t,r)=>"assistant"!==t.role||r===e.length-1||!OQ(t)&&!(0,Oy.isFetchOnlyAssistant)(t)),[e]),ep=(()=>{for(let e=ed.length-1;e>=0;e--)if("assistant"===ed[e].role)return e;return -1})(),eh=(()=>{for(let e=ed.length-1;e>=0;e--)if("user"===ed[e].role)return e;return -1})(),ef=(0,y_.useMemo)(()=>{let t=Array(ed.length).fill(!1),r=!1,n=0;for(let i of e)n<ed.length&&ed[n].id===i.id&&(t[n]=r,n++),"assistant"===i.role&&bb(i).length>0&&(r=!0);return t},[e,ed]),em=(0,y_.useMemo)(()=>{let e=Array(ed.length).fill(!1),t=0;for(let r=0;r<ed.length;r++)"user"===ed[r].role&&t++,e[r]=t>1;return e},[ed]),eg=(0,y_.useMemo)(()=>{let e=Array(ed.length).fill(0),t=0;for(let r=0;r<ed.length;r++)"user"===ed[r].role&&t++,e[r]=Math.max(0,t-1);return e},[ed]),ey=(0,y_.useRef)(e);(0,y_.useEffect)(()=>{ey.current=e},[e]);let ev=(0,y_.useCallback)(e=>{let t=ey.current,r=t.findIndex(t=>t.id===e);if(-1===r)return;let n=t[r].parts.filter(e=>"text"===e.type).map(e=>e.text).join("");y?.(e,n)},[y]),eb=n&&!r||r&&(0===ed.length||"assistant"!==ed[ed.length-1].role)||!!T&&(0===ed.length||"user"===ed[ed.length-1].role),ex=(0,y_.useMemo)(()=>{let t=[...e].reverse().find(e=>"assistant"===e.role);return!!t&&t.parts.length>0},[e]),ek=(0,y_.useMemo)(()=>{let t=[...e].reverse().find(e=>"assistant"===e.role);return t?function(e){let t="routing",r=!1;for(let n of e){let e=n?.type??"";if(e.startsWith("tool-")){let i=yV[e.slice(5)];if(!i)continue;if("search"===i){let e="output-available"===n.state||"output-error"===n.state;e&&(r=!0),t=yq(t,e?"answerFromWeb":"search")}else t=yq(t,i);continue}let i=n?.data;if(i?.phase){let e=function(e){switch(e){case"search":case"deepSearch":return"search";case"direct-answer-waiting":case"specialist-waiting":return"answer";case"searching":case"reading":case"matching":case"converting":case"comparing":return"shopping";case"writing":case"editing":case"executing":case"retrying":case"stubs":return"code";default:return"routing"}}(i.phase);t=yq(t,"answer"===e&&r?"answerFromWeb":e)}else i?.state==="routing"&&(t=yq(t,"routing"))}return t}(t.parts):"routing"},[e]),e_=n||r,eE=ex?ek:"send",[eC,e$]=(0,y_.useState)({phase:"send",elapsed:0});(0,y_.useEffect)(()=>{let e;if(!e_)return void e$({phase:"send",elapsed:0});let t=Date.now(),r=()=>{var n,i;let a,o=Date.now()-t;e$({phase:eE,elapsed:o}),e=setTimeout(r,Math.max(50,(n=eE,i=o,(a=yB[n].find(e=>e.atMs>i))?a.atMs-i:7e3-(i-yB[n][yB[n].length-1].atMs)%7e3)))};return r(),()=>clearTimeout(e)},[e_,eE]);let eT=(0,y_.useMemo)(()=>{if(e_)return P(function(e,t){let r=yB[e],n=r[r.length-1];if(t>=n.atMs&&r.length>=2){let e=r[r.length-2];return Math.floor((t-n.atMs)/7e3)%2==0?n.key:e.key}let i=r[0].key;for(let e of r)if(t>=e.atMs)i=e.key;else break;return i}(eC.phase,eC.elapsed))},[e_,eC,P]),[eI,eN]=(0,y_.useState)(void 0),eA=(0,y_.useRef)(void 0),ej=(0,y_.useRef)(eT);ej.current=eT,(0,y_.useEffect)(()=>{let e,t=()=>{let{shown:r,recheckInMs:n}=yH(eA.current,ej.current,Date.now());r!==eA.current&&(eA.current=r,eN(r)),null!==n&&(e=setTimeout(t,n))};return t(),()=>clearTimeout(e)},[eT]);let eM=eI?.line??eT,eO=(0,y_.useMemo)(()=>eb&&eM?[eM]:[],[eb,eM]);return(0,ew.jsx)(OG,{children:(0,ew.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[!ec&&(0,ew.jsxs)(OW.ScrollArea,{className:"h-full",viewportRef:q,children:[(0,ew.jsx)(Oi.ScrollFade,{side:"top",className:"h-2.5 -mb-2.5 to-gray-50 dark:to-gray-900"}),(0,ew.jsxs)("div",{ref:V,className:"mx-auto max-w-3xl py-4 pb-40",children:[(()=>{let e=ed.map(e=>e.id);if(e.length===A.current.length)for(let t=0;t<e.length;t++){let r=A.current[t],n=e[t];r===n||N.current.has(n)||N.current.set(n,N.current.get(r)??r)}else{let t=new Set(e);for(let e of N.current.keys())t.has(e)||N.current.delete(e)}return A.current=e,null})(),ed.map((e,t)=>{if("summary"===e.role){let t="string"==typeof e.content&&e.content?e.content:Array.isArray(e.parts)?e.parts.filter(e=>e?.type==="text").map(e=>e.text).join("\n\n"):"";return(0,ew.jsx)("div",{children:(0,ew.jsx)(OK,{summary:t})},N.current.get(e.id)??e.id)}let c="assistant"===e.role&&t===ep,d=!eb&&c&&r&&!e.parts.some(e=>{if(!g_(e))return!1;let t=e.state;return"output-available"!==t&&"output-error"!==t&&"output-denied"!==t&&OY.has(gE(e))}),p="assistant"===e.role&&j?.user&&!r;return(0,ew.jsx)("div",{ref:t===eh?W:void 0,style:c?void 0:{contentVisibility:"auto",containIntrinsicSize:"auto 120px"},children:(0,ew.jsx)(OL,{message:e,isStreaming:r,isReady:!n,isLastAssistant:c,hasEarlierWebSources:ef[t],hasPriorConversation:em[t],priorMessageCount:eg[t],showThinkingDots:d,waitLine:eb?void 0:eM,waitLineSince:eb?void 0:eI?.since,onEditSubmit:i,onRetry:a,onContinue:o,isContinuing:s===e.id,onSuggestionClick:l,onStop:u,onShareMessage:f,onDeleteFromHere:v,onEditResponseSave:b,onKeepOnlyThis:ed.length>2?x:void 0,onToolTimeout:k,isBookmarked:z.has(e.id),onToggleBookmark:j?.user?B:void 0,conversationLocale:D,chatDisplay:w,onDiscuss:p?ev:void 0,autoZenEnabled:_,autoZenRecoverSignal:S,auto
188ZenSettingOn:E,onAutoZenChange:C,onZenChange:$,conversationId:m,conversationTitle:g})},N.current.get(e.id)??e.id)}),t.map(e=>(0,ew.jsx)(OV,{blocked:e,onDelete:c,onTogglePiiLock:d,onAllowFile:p},e.id)),h&&0===e.length&&(0,ew.jsxs)("div",{className:"group flex items-start px-2 sm:px-3 py-2 sm:py-1",children:[(0,ew.jsx)("h2",{className:"sr-only",tabIndex:-1,"data-turn-heading":!0,children:R("a11y.youSaid")}),(0,ew.jsx)("div",{className:"min-w-0 max-w-[75vw] sm:max-w-[80%] overflow-hidden ml-auto text-right",children:(0,ew.jsx)("div",{className:"inline-block max-w-full text-left rounded-2xl px-4 py-2.5 bg-gray-900 text-gray-50 shadow-md dark:bg-gray-100 dark:text-gray-900 dark:shadow-lg dark:shadow-gray-900/30",children:(0,ew.jsx)("p",{className:"whitespace-pre-wrap break-words text-sm",children:h})})})]}),eb&&(0,ew.jsx)("div",{style:{overflowAnchor:"none"},children:(0,ew.jsx)(yQ,{realMessages:eO})}),(0,ew.jsx)("div",{ref:J,"aria-hidden":!0,style:{height:0,flexShrink:0,overflowAnchor:"none"}}),(0,ew.jsx)("div",{ref:Z,style:{overflowAnchor:"none"}})]}),(0,ew.jsx)(Oi.ScrollFade,{className:"h-2.5 -mt-2.5 to-gray-50 dark:to-gray-900"})]}),Q&&!ec&&(0,ew.jsx)("button",{type:"button",onClick:et,"aria-label":R("a11y.skipToLatest"),className:"absolute bottom-4 left-1/2 z-20 flex h-9 w-9 -translate-x-1/2 items-center justify-center rounded-full border border-gray-200 bg-white text-gray-600 shadow-md transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",children:(0,ew.jsx)(vq.ChevronDown,{className:"h-5 w-5 sm:h-4 sm:w-4","aria-hidden":"true"})})]})})}var O1=e.i(651507);let O2=e_.useLayoutEffect;var O4=e.i(548697),O5=e.i(885663),O6=e.i(514764);let O3=(0,y6.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var O9=e.i(569074),O8=e.i(110031);let O7=(0,y6.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);var De=e.i(239616),Dt=e.i(968553);let Dr=(0,y6.default)("images",[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]]);var Dn=e.i(672138);function Di({progress:e,phase:t,size:r=96,strokeWidth:n=4}){let i=r/2-n/2,a=2*Math.PI*i;return(0,ew.jsxs)("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,style:{transform:"rotate(-90deg)"},children:[(0,ew.jsx)("circle",{cx:r/2,cy:r/2,r:i,fill:"transparent",stroke:"rgba(255, 255, 255, 0.08)",strokeWidth:n}),(0,ew.jsx)("circle",{cx:r/2,cy:r/2,r:i,fill:"transparent",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:n,strokeDasharray:a,strokeDashoffset:a*(1-("countdown"===t?1-e:e)),style:{transition:"stroke-dashoffset 100ms linear"}})]})}var Da=e.i(619479),Do=e.i(444871);function Ds({filename:e,previewUrl:t,onRemove:r,statusText:n}){return n?(0,ew.jsxs)(eC.motion.div,{layout:!0,variants:yG.chipVariants,initial:"initial",animate:"animate",exit:"exit",className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 py-1 pl-1 pr-2.5 dark:border-gray-700 dark:bg-gray-800",children:[t?(0,ew.jsx)("span",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:(0,ew.jsx)(vM.ViewableImage,{src:t,alt:e,disableActions:!0,className:"h-full w-full object-cover opacity-70"})}):(0,ew.jsx)(y5.FileText,{className:"ml-1 h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400"}),(0,ew.jsx)("span",{className:"whitespace-nowrap text-xs text-gray-600 dark:text-gray-300",children:n})]}):t?(0,ew.jsxs)(eC.motion.div,{layout:!0,variants:yG.chipVariants,initial:"initial",animate:"animate",exit:"exit",className:"group relative h-16 w-16 shrink-0 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:[(0,ew.jsx)(vM.ViewableImage,{src:t,alt:e,disableActions:!0,className:"h-full w-full object-cover"}),(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:r,className:"absolute right-0.5 top-0.5 !rounded-full !bg-black/60 !p-0.5 !text-white opacity-100 transition-opacity can-hover:opacity-0 can-hover:group-hover:opacity-100",children:(0,ew.jsx)(vW.X,{className:"h-3 w-3"})})]}):(0,ew.jsx)(eC.motion.div,{layout:!0,variants:yG.chipVariants,initial:"initial",animate:"animate",exit:"exit",children:(0,ew.jsx)(Do.Badge,{color:"gray",size:"sm",children:(0,ew.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,ew.jsx)(y5.FileText,{className:"h-3.5 w-3.5"}),(0,ew.jsx)("span",{className:"max-w-[200px] truncate",children:e}),(0,ew.jsx)(vj.Button,{size:"xs",color:"gray",onClick:r,className:"!p-0.5",children:(0,ew.jsx)(vW.X,{className:"h-3 w-3"})})]})})})}var Dl=e.i(871689);let Du=(0,y6.default)("baby",[["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"11xh7x"}],["path",{d:"M9 12h.01",key:"157uk2"}]]);var Dc=e.i(63727),Dd=e.i(607486);let Dp=(0,y6.default)("contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]),Dh=(0,y6.default)("crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]),Df=(0,y6.default)("droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]),Dm=(0,y6.default)("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Dg=(0,y6.default)("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),Dy=(0,y6.default)("frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]),Dv=(0,y6.default)("grid-2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);var Db=e.i(473708),Dx=e.i(852008);let Dk=(0,y6.default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);var Dw=e.i(486631);let D_=(0,y6.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}
188],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),DS=(0,y6.default)("shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]),DE=(0,y6.default)("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),DC=(0,y6.default)("snowflake",[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]]);var D$=e.i(897250);let DT=(0,y6.default)("trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]),DI=(0,y6.default)("type",[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]);var DN=e.i(284614);let DA=(0,y6.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]),Dj=[{id:"look",labelKey:"groupLook",icon:"Palette",groupControl:{kind:"degree",labelKey:"lookStrength",stops:5,defaultStop:3},actions:[{id:"look.watercolour",labelKey:"lookWatercolour",icon:"Droplet",costKey:"balanced"},{id:"look.oil",labelKey:"lookOil",icon:"Palette",costKey:"balanced"},{id:"look.pencil",labelKey:"lookPencil",icon:"Pencil",costKey:"balanced"},{id:"look.lineart",labelKey:"lookLineArt",icon:"Pencil",costKey:"balanced"},{id:"look.anime",labelKey:"lookAnime",icon:"Image",costKey:"balanced"},{id:"look.comic",labelKey:"lookComic",icon:"BookOpen",costKey:"balanced"},{id:"look.threed",labelKey:"lookThreeD",icon:"Package",costKey:"balanced"},{id:"look.clay",labelKey:"lookClay",icon:"Package",costKey:"balanced"},{id:"look.popart",labelKey:"lookPopArt",icon:"Palette",costKey:"balanced"},{id:"look.vintage",labelKey:"lookVintage",icon:"Camera",costKey:"balanced"},{id:"look.bw",labelKey:"lookBlackWhite",icon:"Contrast",costKey:"balanced"},{id:"look.neon",labelKey:"lookNeon",icon:"Building2",costKey:"balanced"},{id:"look.custom",labelKey:"lookCustom",icon:"Wand2",costKey:"balanced",control:{kind:"text",labelKey:"lookCustomLabel",placeholderKey:"lookCustomPlaceholder",maxLength:200,required:!0}}]},{id:"change",labelKey:"groupChange",icon:"Wand2",actions:[{id:"change.background",labelKey:"changeBackground",icon:"Layers",costKey:"balanced",control:{kind:"text",labelKey:"changeBackgroundLabel",placeholderKey:"changeBackgroundPlaceholder",maxLength:200,required:!0}},{id:"change.place",labelKey:"changePlace",icon:"MapPin",costKey:"balanced",control:{kind:"text",labelKey:"changePlaceLabel",placeholderKey:"changePlacePlaceholder",maxLength:120,required:!0}},{id:"change.season.summer",labelKey:"changeSeasonSummer",icon:"Sun",costKey:"balanced"},{id:"change.season.autumn",labelKey:"changeSeasonAutumn",icon:"Trees",costKey:"balanced"},{id:"change.season.winter",labelKey:"changeSeasonWinter",icon:"Snowflake",costKey:"balanced"},{id:"change.goldenhour",labelKey:"changeGoldenHour",icon:"Sun",costKey:"balanced"},{id:"change.night",labelKey:"changeNight",icon:"Building2",costKey:"balanced"},{id:"change.mood",labelKey:"changeMood",icon:"Smile",costKey:"balanced",control:{kind:"degree",labelKey:"changeMoodDegree",stops:5,defaultStop:3}},{id:"change.busy",labelKey:"changeBusy",icon:"Briefcase",costKey:"balanced"},{id:"change.clothes",labelKey:"changeClothes",icon:"Shirt",costKey:"balanced",control:{kind:"text",labelKey:"changeClothesLabel",placeholderKey:"changeClothesPlaceholder",maxLength:120,required:!0}},{id:"change.custom",labelKey:"changeCustom",icon:"Wand2",costKey:"balanced",control:{kind:"text",labelKey:"changeCustomLabel",placeholderKey:"changeCustomPlaceholder",maxLength:240,required:!0}}]},{id:"cleanup",labelKey:"groupCleanup",icon:"Scissors",actions:[{id:"clean.removebg",labelKey:"cleanRemoveBg",icon:"Scissors",costKey:"balanced"},{id:"clean.removeobject",labelKey:"cleanRemoveObject",icon:"Eraser",costKey:"balanced",control:{kind:"text",labelKey:"cleanRemoveObjectLabel",placeholderKey:"cleanRemoveObjectPlaceholder",maxLength:160,required:!0}},{id:"clean.removetext",labelKey:"cleanRemoveText",icon:"Type",costKey:"balanced"},{id:"clean.declutter",labelKey:"cleanDeclutter",icon:"Eraser",costKey:"balanced"},{id:"clean.retouch",labelKey:"cleanRetouch",icon:"Wand2",costKey:"balanced"},{id:"clean.sharpen",labelKey:"cleanSharpen",icon:"Focus",costKey:"balanced"},{id:"clean.lighting",labelKey:"cleanLighting",icon:"Sun",costKey:"balanced"}]},{id:"reframe",labelKey:"groupReframe",icon:"Frame",actions:[{id:"reframe.square",targetAspect:"1:1",labelKey:"reframeSquare",icon:"Crop",costKey:"balanced"},{id:"reframe.story",targetAspect:"9:16",labelKey:"reframeStory",icon:"Crop",costKey:"balanced"},{id:"reframe.wide",targetAspect:"16:9",labelKey:"reframeWide",icon:"Crop",costKey:"balanced"},{id:"reframe.slide",targetAspect:"16:9",labelKey:"reframeSlide",icon:"Presentation",costKey:"balanced"},{id:"reframe.print",targetAspect:"4:3",labelKey:"reframePrint",icon:"Crop",costKey:"balanced"},{id:"reframe.cover",targetAspect:"21:9",labelKey:"reframeCover",icon:"Crop",costKey:"balanced"},{id:"reframe.zoomout",labelKey:"reframeZoomOut",icon:"Maximize2",costKey:"balanced"}]},{id:"turn",labelKey:"groupTurn",icon:"Package",actions:[{id:"turn.packshot",labelKey:"turnPackshot",icon:"Package",costKey:"compose"},{id:"turn.bookcover",labelKey:"turnBookCover",icon:"BookOpen",costKey:"best",control:{kind:"text",labelKey:"turnBookCoverLabel",placeholderKey:"turnBookCoverPlaceholder",maxLength:120,required:!0}},{id:"turn.poster",labelKey:"turnPoster",icon:"Type",costKey:"best",control:{kind:"text",labelKey:"turnPosterLabel",placeholderKey:"turnPosterPlaceholder",maxLength:120,required:!0}}
188,{id:"turn.headshot",labelKey:"turnHeadshot",icon:"User",costKey:"balanced"},{id:"turn.banner",targetAspect:"21:9",labelKey:"turnBanner",icon:"Presentation",costKey:"balanced"},{id:"turn.mockup",labelKey:"turnMockup",icon:"Shirt",costKey:"compose",control:{kind:"text",labelKey:"turnMockupLabel",placeholderKey:"turnMockupPlaceholder",maxLength:120,required:!0}},{id:"turn.sticker",labelKey:"turnSticker",icon:"Image",costKey:"balanced"}]},{id:"more",labelKey:"groupMore",icon:"Copy",actions:[{id:"more.four",labelKey:"moreFour",icon:"Grid2x2",costKey:"compose"},{id:"more.brighter",labelKey:"moreBrighter",icon:"Sun",costKey:"balanced"},{id:"more.angle",labelKey:"moreAngle",icon:"Camera",costKey:"balanced"},{id:"more.wider",labelKey:"moreWider",icon:"Maximize2",costKey:"balanced"},{id:"more.closer",labelKey:"moreCloser",icon:"Focus",costKey:"balanced"},{id:"more.real",labelKey:"moreReal",icon:"Camera",costKey:"balanced"},{id:"more.drawing",labelKey:"moreDrawing",icon:"Pencil",costKey:"balanced"}]},{id:"combine",labelKey:"groupCombine",icon:"Layers",minImages:2,actions:[{id:"combine.together",labelKey:"combineTogether",icon:"Layers",minImages:2,costKey:"compose"},{id:"combine.personinto",labelKey:"combinePersonInto",icon:"User",minImages:2,costKey:"compose"},{id:"combine.styleof",labelKey:"combineStyleOf",icon:"Palette",minImages:2,costKey:"compose"},{id:"combine.custom",labelKey:"combineCustom",icon:"Wand2",minImages:2,costKey:"compose",control:{kind:"text",labelKey:"combineCustomLabel",placeholderKey:"combineCustomPlaceholder",maxLength:240,required:!0}}]}],DM=new Map(Dj.flatMap(e=>e.actions.map(e=>[e.id,e]))),DO={Palette:vy.Palette,Wand2:DA,Scissors:D_,Eraser:Dm,Frame:Dy,Layers:Dx.Layers,Package:Dk,BookOpen:y2.BookOpen,User:DN.User,Presentation:Dw.Presentation,Shirt:DS,Type:DI,Sun:D$.Sun,Snowflake:DC,MapPin:vs.MapPin,Smile:DE,Briefcase:Dc.Briefcase,Focus:Dg,Copy:vk.Copy,Grid2x2:Dv,Maximize2:vH.Maximize2,Camera:Dt.Camera,Building2:Dd.Building2,Pencil:vx.Pencil,Image:Db.Image,Crop:Dh,Droplet:Df,Contrast:Dp,Baby:Du,Trees:DT},DD="inline-flex shrink-0 items-center gap-1.5 rounded-xl border border-gray-200 bg-white px-3 py-1.5 text-sm text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-40 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800";function DR({imageCount:e,onPick:t,busy:r}){let n=(0,eS.useTranslations)("imageStudio"),[i,a]=(0,e_.useState)(null),[o,s]=(0,e_.useState)(null),[l,u]=(0,e_.useState)(""),[c,d]=(0,e_.useState)(3),[p,h]=(0,e_.useState)(()=>new Set);(0,e_.useEffect)(()=>{let e=!1;return fetch("/api/image-capabilities").then(e=>e.ok?e.json():null).then(t=>{!e&&t&&Array.isArray(t.unsupportedActionIds)&&h(new Set(t.unsupportedActionIds.filter(e=>"string"==typeof e)))}).catch(()=>{}),()=>{e=!0}},[]);let f=(0,e_.useMemo)(()=>(function(e,t=new Set){return Dj.filter(t=>e>=(t.minImages??1)).map(r=>({...r,actions:r.actions.filter(r=>e>=(r.minImages??1)&&!t.has(r.id))})).filter(e=>e.actions.length>0)})(e,p),[e,p]),m=f.find(e=>e.id===i)??null,g=(0,e_.useCallback)(()=>{s(null),u(""),d(3)},[]),y=(0,e_.useCallback)((e,n)=>{if(!r){if(e.control){s(e),u(""),d("degree"===e.control.kind?e.control.defaultStop:3);return}t({actionId:e.id,degree:n}),a(null)}},[r,t]),v=(0,e_.useCallback)(()=>{if(!o||r)return;let e=o.control;(e?.kind!=="text"||!e.required||l.trim())&&(t({actionId:o.id,text:e?.kind==="text"?l.trim():void 0,degree:e?.kind==="degree"?c:void 0}),g(),a(null))},[o,r,l,c,t,g]);if(o){let e=o.control;return(0,ew.jsx)(DP,{level:`ask:${o.id}`,children:(0,ew.jsxs)("div",{className:"flex w-full items-center gap-1.5 px-1",children:[(0,ew.jsx)(DF,{label:n("back"),onClick:()=>g()}),"text"===e.kind?(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("input",{autoFocus:!0,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v())},maxLength:e.maxLength,placeholder:n(e.placeholderKey),"aria-label":n(e.labelKey),className:"min-w-0 flex-1 rounded-xl border border-gray-200 bg-white px-3 py-1.5 text-sm text-gray-900 placeholder:text-gray-400 focus:border-gray-400 focus:outline-none dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:placeholder:text-gray-500"}),(0,ew.jsx)("button",{type:"button",onClick:v,disabled:r||e.required&&!l.trim(),className:"inline-flex shrink-0 items-center rounded-xl bg-accent-solid px-3 py-1.5 text-sm text-accent-foreground transition-colors hover:bg-accent-solid-hover disabled:opacity-40",children:n("apply")})]}):(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsxs)("label",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,ew.jsx)("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:n(e.labelKey)}),(0,ew.jsx)("input",{type:"range",min:1,max:e.stops,step:1,value:c,onChange:e=>d(Number(e.target.value)),className:"min-w-0 flex-1 accent-green-600"})]}),(0,ew.jsx)("button",{type:"button",onClick:v,disabled:r,className:"inline-flex shrink-0 items-center rounded-xl bg-accent-solid px-3 py-1.5 text-sm text-accent-foreground transition-colors hover:bg-accent-solid-hover disabled:opacity-40",children:n("apply")})]})]})})}return m?(0,ew.jsxs)(DP,{level:`group:${m.id}`,children:[(0,ew.jsxs)(Dz,{children:[(0,ew.jsx)(DF,{label:n("back"),onClick:()=>a(null)}),m.actions.map(e=>(0,ew.jsx)(DL,{icon:e.icon,label:n(e.labelKey),onClick:()=>y(e,m.groupControl?c:void 0),disabled:r},e.id))]}),m.groupControl&&(0,ew.jsxs)("label",{className:"mt-1.5 flex items-center gap-2 px-1",children:[(0,ew.jsx)("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:n(m.groupControl.labelKey)}),(0,ew.jsx)("input",{type:"range",min:1,max:m.groupControl.stops,step:1,value:c,disabled:r,onChange:e=>d(Number(e.target.value)),className:"min-w-0 max-w-40 flex-1 accent-green-600"})]}
188),"reframe"===m.id&&(0,ew.jsx)("p",{className:"mt-1.5 px-1 text-xs text-gray-500 dark:text-gray-400",children:n("reframeHint")})]}):(0,ew.jsx)(DP,{level:"root",children:(0,ew.jsx)(Dz,{children:f.map(e=>(0,ew.jsx)(DL,{icon:e.icon,label:n(e.labelKey),onClick:()=>{d(e.groupControl?.defaultStop??3),a(e.id)},disabled:r},e.id))})})}function DP({level:e,children:t}){return(0,ew.jsx)("div",{className:"mb-2 w-full",children:(0,ew.jsx)(eE.AnimatePresence,{initial:!1,mode:"wait",children:(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,y:2},animate:{opacity:1,y:0},transition:{duration:.12},children:t},e)})})}function Dz({children:e}){return(0,ew.jsxs)("div",{className:"relative w-full",children:[(0,ew.jsx)("div",{className:"flex w-full flex-wrap gap-1.5 px-1 max-sm:portrait:flex-nowrap max-sm:portrait:overflow-x-auto max-sm:portrait:px-0 max-sm:portrait:[scrollbar-width:none] max-sm:portrait:[-ms-overflow-style:none] max-sm:portrait:[&::-webkit-scrollbar]:hidden",children:e}),(0,ew.jsx)(Oi.ScrollFade,{side:"left",className:"to-gray-100 dark:to-gray-900"}),(0,ew.jsx)(Oi.ScrollFade,{side:"right",className:"to-gray-100 dark:to-gray-900"})]})}function DL({icon:e,label:t,onClick:r,disabled:n}){let i=DO[e]??DA;return(0,ew.jsxs)("button",{type:"button",onClick:r,disabled:n,className:DD,children:[(0,ew.jsx)(i,{className:"h-3.5 w-3.5"}),t]})}function DF({label:e,onClick:t}){return(0,ew.jsx)("button",{type:"button",onClick:t,"aria-label":e,className:(0,v7.cn)(DD,"px-2"),children:(0,ew.jsx)(Dl.ArrowLeft,{className:"h-3.5 w-3.5"})})}var DU=e.i(438569),DB=e.i(621441);let DZ=(0,O4.acceptAttribute)("chat"),Dq=new Set(DZ.split(",").map(e=>e.replace(".",""))),DV={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff"};function DH(e){return(e.split(".").pop()||"").toLowerCase()}function DK(e){let t=DH(e.name);if(Dq.has(t))return e;let r=DV[e.type]||(e.type.startsWith("image/")?e.type.slice(6).split("+")[0].split(";")[0]:"");return r?new File([e],`pasted-image.${r}`,{type:e.type}):e}let DW=(0,e_.forwardRef)(function({input:e,onInputChange:t,onSubmit:r,isStreaming:n,onStop:i,onFileSelect:a,attachedFiles:o,onRemoveFile:s,isUploading:l,isBlocked:u,isEmpty:c,onNewChat:d,chatDisplay:p,voice:h,voiceMode:f,onAutoSubmit:m,sidebarCollapsed:g,isTemporaryChat:y,onExitTemporary:v,imageStudioCount:b,onImageAction:x,imageActionBusy:k},w){let _,S,E,C,$,T=(0,eS.useTranslations)("chat"),I=(0,eS.useTranslations)("sidebar"),N=(0,DB.isNativeApp)(),A=T("placeholderStreaming"),j=(0,e_.useRef)(null),M=(0,e_.useRef)(!1),O=(0,e_.useRef)(null),D=(0,e_.useRef)(null),R=(0,e_.useRef)(null),P=(0,e_.useRef)(null),[z,L]=(0,e_.useState)(!1),[F,U]=(0,e_.useState)(!1),B=(0,e_.useRef)(0),[Z,q]=(0,e_.useState)(!1),[V,H]=(0,e_.useState)(0),K=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{h?.voicePhase==="recording"&&q(!1)},[h?.voicePhase]),(0,e_.useEffect)(()=>{let e;if(h?.voicePhase!=="processing"||Z){K.current=null,H(0);return}let t=r=>{K.current||(K.current=r),H((r-K.current)%8e3/8e3),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[h?.voicePhase,Z]);let W=!Z&&(h?.isRecording||h?.voicePhase==="processing"),J=(0,e_.useRef)(h?.stopRecording);J.current=h?.stopRecording;let G=!!h?.isRecording;(0,e_.useEffect)(()=>{if(!G)return;let e=e=>{"Enter"!==e.key||e.isComposing||e.repeat||(e.preventDefault(),e.stopPropagation(),J.current?.())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[G]);let X=(0,e_.useRef)(null),Y=!l&&o.length<25,Q=(b??0)>0&&!!x&&!e.trim()&&!n&&!u;(0,e_.useImperativeHandle)(w,()=>({focus(){let e=j.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))}}));let ee=(0,e_.useCallback)(e=>{if(!e.status)return;let t="optimising"===e.status?T("attachOptimising"):"scanning"===e.status?T("attachScanning"):T("attachUploading");return e.statusDetail?`${t} ${e.statusDetail}`:t},[T]);(0,e_.useEffect)(()=>{n&&!(0,O5.isMobileViewport)()&&j.current?.focus()},[n]),O2(()=>{let t=j.current;!t||M.current||e!==O.current&&(t.value!==e&&(t.value=e),O.current=e)},[e]);let et=(0,e_.useCallback)(()=>{let e=j.current;if(!e)return;let t=e.scrollTop;e.style.overflowY="hidden",e.style.height="auto";let r=Math.min(e.scrollHeight,200);e.style.height=`${r}px`;let n=e.closest("[data-composer-dock]");
188if(n){let t=window.visualViewport,i=t?t.offsetTop+t.height:window.innerHeight,a=function(e){let{fitted:t,overflowBelowVisible:r}=e,n=e.minHeight??91;return r>=1?Math.max(Math.min(n,t),Math.floor(t-r)):t}({fitted:r,overflowBelowVisible:n.getBoundingClientRect().bottom-i});a!==r&&(r=a,e.style.height=`${r}px`)}let i=e.scrollHeight>e.clientHeight;if(e.style.overflowY=i?"auto":"hidden",i){let r=e.selectionEnd>=e.value.length;e.scrollTop=function(e){let{scrollTop:t,clientHeight:r,scrollHeight:n,caretTop:i,lineHeight:a,atEnd:o}=e,s=Math.max(0,n-r);if(o)return s;let l=i+a;return i<t?Math.max(0,i):l>t+r?Math.min(s,l-r):t}({scrollTop:t,clientHeight:e.clientHeight,scrollHeight:e.scrollHeight,caretTop:r?e.scrollHeight:function(e){let t=getComputedStyle(e),r=document.createElement("div");for(let e of["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","lineHeight","paddingTop","paddingBottom","paddingLeft","paddingRight","borderTopWidth","borderBottomWidth","borderLeftWidth","borderRightWidth","boxSizing","tabSize","textIndent","wordSpacing","wordBreak"])r.style[e]=t[e];r.style.whiteSpace="pre-wrap",r.style.overflowWrap="break-word",r.style.position="absolute",r.style.visibility="hidden",r.style.top="0",r.style.left="-9999px",r.style.height="auto",r.style.width=`${e.clientWidth}px`,r.textContent=e.value.slice(0,e.selectionEnd);let n=document.createElement("span");n.textContent="â",r.appendChild(n),document.body.appendChild(r);let i=n.offsetTop;return r.remove(),i}(e),lineHeight:parseFloat(getComputedStyle(e).lineHeight)||20,atEnd:r})}},[]);O2(()=>{et()},[e,et]),(0,e_.useEffect)(()=>{let e=window.visualViewport,t=0,r=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>{t=requestAnimationFrame(et)})};e?.addEventListener("resize",r),window.addEventListener("resize",r);let n=j.current?.closest("[data-composer-dock]"),i=n&&"u">typeof ResizeObserver?new ResizeObserver(r):null;return n&&i&&i.observe(n),()=>{cancelAnimationFrame(t),e?.removeEventListener("resize",r),window.removeEventListener("resize",r),i?.disconnect()}},[et]);let er=(0,e_.useCallback)(e=>{r(e)},[r]),en=e=>{let t=e.target.files;t&&Array.from(t).forEach(e=>a(DK(e))),e.target.value=""},ei=(0,e_.useCallback)(e=>{let t=Array.from(e),r=[];for(let e of t){if(!(Dq.has(DH(e.name))||e.type.startsWith("image/"))&&!(e.type in DV)){r.push(e.name);continue}a(DK(e))}r.length>0&&alert(`Unsupported file type${r.length>1?"s":""}: ${r.join(", ")} 189 190Accepted: ${DZ}`)},[a]),ea=(0,e_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,Y&&e.dataTransfer.types.includes("Files")&&U(!0)},[Y]),eo=(0,e_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,B.current<=0&&(B.current=0,U(!1))},[]),es=(0,e_.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),el=(0,e_.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),B.current=0,U(!1),!Y)return;let t=e.dataTransfer.files;t.length>0&&ei(t)},[Y,ei]),eu=(0,e_.useCallback)(e=>{if(!Y)return;let t=[],r=e.clipboardData?.files;if(r&&r.length>0)t=Array.from(r);else{let r=e.clipboardData?.items;if(r){for(let e of Array.from(r))if("file"===e.kind&&e.type.startsWith("image/")){let r=e.getAsFile();r&&t.push(r)}}}0===t.length||(e.preventDefault(),t.every(e=>e.type.startsWith("image/"))&&t.length>1&&(t=[t[0]]),ei(t))},[Y,ei]),ec=d?(0,ew.jsx)("button",{type:"button",onClick:d,"aria-label":I("newChat"),className:"hidden h-9 w-9 shrink-0 items-center justify-center rounded-xl text-gray-700 transition-colors hover:bg-gray-100 sm:flex dar
190k:text-gray-300 dark:hover:bg-gray-700",children:(0,ew.jsx)(O8.SquarePen,{className:"h-4 w-4"})}):null,ed=(0,ew.jsx)("button",{type:"button",disabled:l||u||o.length>=25,onClick:()=>{(0,O5.isMobileViewport)()?L(!0):P.current?.click()},"aria-label":T("attachFile"),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl transition-colors hover:bg-gray-100 disabled:opacity-50 disabled:hover:bg-transparent dark:hover:bg-gray-700",children:(0,ew.jsx)(ve.Paperclip,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),ep=y?(0,ew.jsx)("button",{type:"button",onClick:v,"aria-label":I("temporaryChat"),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-blue-600 transition-colors hover:bg-blue-100/60 dark:text-blue-400 dark:hover:bg-blue-900/30",children:(0,ew.jsx)(Dn.Ghost,{className:"h-4 w-4"})}):null,eh=null;n&&!e.trim()&&0===o.length?eh={type:"button",onClick:()=>{i?.()},className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-white transition-colors hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200",icon:(0,ew.jsx)(O3,{className:"h-4 w-4 fill-current","aria-hidden":"true"}),label:T("a11y.stopGenerating")}:e.trim()||o.length>0?eh={type:"submit",disabled:l,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-white transition-colors hover:bg-gray-800 disabled:opacity-50 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200",icon:(0,ew.jsx)(O6.Send,{className:"h-4 w-4","aria-hidden":"true"}),label:T("a11y.sendMessage")}:h?.isRecording?eh={type:"button",onClick:()=>{h.stopRecording()},className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-red-600 text-white transition-colors hover:bg-red-700 dark:bg-red-600 dark:hover:bg-red-700",icon:(0,ew.jsx)(O3,{className:"h-4 w-4 fill-current","aria-hidden":"true"}),label:T("a11y.stopRecording")}:h?.isRequesting?eh={type:"button",disabled:!0,className:"flex h-9 w-9 shrink-0 animate-pulse items-center justify-center rounded-xl text-gray-700 dark:text-gray-300",icon:(0,ew.jsx)(O7,{className:"h-4 w-4","aria-hidden":"true"}),label:T("a11y.micRequesting")}:h?.isTranscribing?eh={type:"button",disabled:!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-gray-700 dark:text-gray-300",icon:(0,ew.jsx)(O7,{className:"h-4 w-4 animate-pulse","aria-hidden":"true"}),label:T("a11y.transcribing")}:h?.isSupported&&!u&&(eh={type:"button",onClick:()=>{h.clearError(),h.startRecording()},className:(0,v7.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-xl transition-colors hover:bg-gray-100 dark:hover:bg-gray-700",h.error?"text-red-600 dark:text-red-400":"text-gray-700 dark:text-gray-300"),icon:(0,ew.jsx)(O7,{className:"h-4 w-4","aria-hidden":"true"}),label:T("a11y.startVoiceInput")});let ef=eh?.type==="submit"&&!!h?.isSupported&&!u&&!h.isRecording&&!h.isRequesting&&"idle"===h.voicePhase&&h&&(0,ew.jsx)("button",{type:"button",onClick:()=>{h.clearError(),h.startRecording()},"aria-label":T("a11y.startVoiceInput"),className:(0,v7.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-xl transition-colors hover:bg-gray-100 dark:hover:bg-gray-700",h.error?"text-red-600 dark:text-red-400":"text-gray-700 dark:text-gray-300"),children:(0,ew.jsx)(O7,{className:"h-4 w-4","aria-hidden":"true"})}),em=eh&&(0,ew.jsx)("button",{type:eh.type,onClick:eh.onClick,disabled:eh.disabled,className:eh.className,"aria-label":eh.label,children:eh.icon});return(0,ew.jsxs)("div",{className:"relative shrink-0 px-2 sm:px-4 py-1 sm:py-2",onDragEnter:ea,onDragLeave:eo,onDragOver:es,onDrop:el,children:[W&&h&&(_=h.frequencyBands??[],E=(S=h.isRecording)?h.silenceCountdown:V,C="conversation"===f,$=S?null!==h.silenceCountdown?T(C?"voiceCountdownAutoSend":"voiceCountdownWriteOut"):T(C?"voiceRecordingHint":"voiceRecordingHintDictate"):T("voiceProcessing"),(0,ew.jsxs)("div",{className:`fixed inset-0 z-[9999] flex flex-col items-center justify-center gap-8 bg-gray-950 px-6 py-safe ${g?"xl:left-14":"xl:left-72"}`,"data-haptic":"",onClick:()=>{S?h.stopRecording():q(!0)},children:[(0,ew.jsxs)("div",{className:"relative flex items-center justify-center",style:{width:96,height:96},children:[(0,ew.jsx)(eE.AnimatePresence,{children:null!=E&&(0,ew.jsx)(eC.motion.div,{className:"absolute inset-0",initial:{opacity:0}
190,animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:(0,ew.jsx)(Di,{progress:E,phase:S?"countdown":"processing",size:96,strokeWidth:4})},"ring")}),(0,ew.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-white/10 backdrop-blur-sm",children:(0,ew.jsx)(O7,{className:"h-8 w-8 text-gray-300"})})]}),(0,ew.jsx)("div",{className:"flex items-center gap-[6px] sm:gap-2",style:{height:180},children:_.map((e,t)=>{let r=Math.min(1.3*Math.pow(e,.6),1),n=.1+.35*r,i=3+12*r;return(0,ew.jsx)("div",{className:"flex flex-col items-center justify-center",style:{width:12,height:180},children:(0,ew.jsx)("div",{style:{width:12,height:12+148*r,borderRadius:6,background:`rgba(255, 255, 255, ${.25+.75*r})`,boxShadow:`0 0 ${i}px rgba(255, 255, 255, ${n}), 0 0 ${2*i}px rgba(255, 255, 255, ${.3*n})`,transition:"height 0.075s ease-out, box-shadow 0.075s ease-out, background 0.075s ease-out"}})},t)})}),(0,ew.jsx)("div",{className:"flex items-center justify-center",children:$&&(0,ew.jsx)("p",{className:"text-sm font-medium text-gray-400 text-center leading-relaxed max-w-sm",children:$})})]})),h?.showMicPrompt&&(0,ew.jsxs)("div",{className:`fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-gray-950 px-6 py-safe ${g?"xl:left-14":"xl:left-72"}`,children:[(0,ew.jsx)("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-white/10 backdrop-blur-sm",children:(0,ew.jsx)(O7,{className:"h-10 w-10 text-gray-300"})}),(0,ew.jsx)("p",{className:"mt-5 text-center text-sm font-semibold text-gray-100",children:T("voiceWarmupTitle")}),(0,ew.jsx)("p",{className:"mt-2 max-w-xs text-center text-xs text-gray-400",children:T("voiceWarmupBody")}),(0,ew.jsxs)("div",{className:"mt-6 flex gap-3",children:[(0,ew.jsx)("button",{type:"button",onClick:()=>h.dismissPrompt(),className:"rounded-lg border border-gray-600 px-5 py-2.5 text-xs font-medium text-gray-300 hover:text-gray-200",children:T("voiceWarmupCancel")}),(0,ew.jsx)("button",{type:"button",onClick:()=>{h.confirmRecording()},className:"rounded-lg bg-white px-5 py-2.5 text-xs font-medium text-gray-900 hover:bg-gray-200",children:T("voiceWarmupContinue")})]})]}),F&&(0,ew.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-accent-border-strong bg-accent-surface/80",children:(0,ew.jsxs)("div",{className:"flex flex-col items-center gap-1 text-accent-text",children:[(0,ew.jsx)(O9.Upload,{className:"h-6 w-6"}),(0,ew.jsx)("span",{className:"text-sm font-medium",children:T("dropFiles")})]})}),(0,ew.jsxs)("form",{ref:X,onSubmit:er,className:"mx-auto max-w-lg",children:[h?.error&&(0,ew.jsxs)("div",{role:"alert",className:"mb-1.5 rounded-lg bg-red-50 px-3 py-2 text-xs text-red-700 dark:bg-red-950/30 dark:text-red-400",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ew.jsx)(O7,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),(0,ew.jsx)("span",{className:"flex-1",children:"mic-permission"===h.error?N?T("voiceMicPermissionDeniedNative"):T("voiceMicPermissionDenied"):"mic-blocked"===h.error?N?T("voiceMicPermissionDeniedNative"):T("voiceMicBlocked"):"mic-os-blocked"===h.error?N?T("voiceMicPermissionDeniedNative"):T("voiceMicOsBlocked"):"mic-unavailable"===h.error?T("voiceNotSupported"):h.error}),(0,ew.jsx)("button",{type:"button",onClick:h.clearError,"aria-label":T("a11y.dismissVoiceError"),className:"shrink-0 text-red-400 hover:text-red-600 dark:hover:text-red-300",children:(0,ew.jsx)("span",{"aria-hidden":"true",children:"Ã"})})]}),("mic-permission"===h.error||"mic-blocked"===h.error||"mic-os-blocked"===h.error)&&(()=>{let{browser:e,os:t}=(0,DU.detectPlatform)(),r=N?"ios"===(0,DB.getNativePlatform)()?"voiceUnblockNativeIOS":"voiceUnblockNativeAndroid":"mic-os-blocked"===h.error?"Android"===t?"voiceUnblockAndroidOs":"iOS"===t?"voiceUnblockIOS":"voiceUnblockDesktopOs":"Android"===t?"voiceUnblockAndroid":"iOS"===t?"voiceUnblockIOS":"Chrome"===e||"Edge"===e?"voiceUnblockChromeDesktop":"Firefox"===e?"voiceUnblockFirefox":"Safari"===e?"voiceUnblockSafari":"voiceUnblockGeneric";return(0,ew.jsxs)("div",{className:"mt-1.5",children:[(0,ew.jsxs)("div",{className:"flex items-start gap-1.5 rounded-md bg-red-100 px-2.5 py-2 dark:bg-red-900/40",children:[(0,ew.jsx)(De.Settings,{className:"mt-0.5 h-3 w-3 shrink-0 text-red-500 dark:text-red-400"}),(0,ew.jsx)("span",{className:"text-xs text-red-800 dark:text-red-300 whitespace-pre-line",children:T(r)})]}),(0,ew.jsx)("div",{className:"mt-1.5 flex gap-2",children:(0,ew.jsx)("button",{type:"button",onClick:()=>{h.clearError(),h.startRecording()},className:"rounded-md bg-red-100 px-2.5 py-1 text-xs font-medium text-red-800 hover:bg-red-200 dark:bg-red-900/40 dark:text-red-300 dark:hover:bg-red-900/60",children:T("voiceTryAgain")})})]})})()]}),o.length>0&&(0,ew.jsx)("div",{className:"mb-2 flex flex-wrap gap-1.5",children:(0,ew.jsx)(eE.AnimatePresence,{mode:"popLayout",children:o.map(e=>(0,ew.jsx)(Ds,{filename:e.name,previewUrl:e.previewUrl,onRemove:()=>s(e.id),statusText:ee(e)}
190,e.id))})}),Q&&(0,ew.jsx)(DR,{imageCount:b??0,onPick:x,busy:k}),(0,ew.jsx)("input",{ref:D,type:"file",accept:"image/*",capture:"environment",onChange:en,className:"hidden"}),(0,ew.jsx)("input",{ref:R,type:"file",accept:"image/*",multiple:!0,onChange:en,className:"hidden"}),(0,ew.jsx)("input",{ref:P,type:"file",accept:`${DZ},image/*`,multiple:!0,onChange:en,className:"hidden"}),(0,ew.jsxs)("div",{className:"relative flex min-h-[2.75rem] w-full items-end gap-0.5 rounded-2xl border border-gray-200 bg-gray-50 p-1 transition duration-200 focus-within:border-accent-border-strong dark:focus-within:border-gray-400 dark:border-gray-600 dark:bg-gray-900",children:[ec,ed,ep,(0,ew.jsxs)("div",{className:"relative flex min-w-0 flex-1 items-center",children:[n&&!e&&(0,ew.jsx)("span",{"aria-hidden":"true",className:"placeholder-trail pointer-events-none absolute inset-0 flex items-center px-2 text-sm whitespace-pre",children:A.split("").map((e,t)=>" "===e?(0,ew.jsx)("span",{children:" "},t):(0,ew.jsx)("span",{className:"placeholder-trail-letter",style:{animationDelay:`${80*t}ms`},children:e},t))}),(0,ew.jsx)(Da.Textarea,{ref:j,id:"chat-message-input",name:"message",defaultValue:e,onChange:e=>{O.current=e.target.value,t(e.target.value)},onCompositionStart:()=>{M.current=!0},onCompositionEnd:e=>{M.current=!1;let r=e.target.value;O.current=r,t(r)},onKeyDown:t=>{M.current||t.nativeEvent.isComposing||("Enter"===t.key&&!t.shiftKey&&!(0,O5.isMobileViewport)()||(0,bs.isSendShortcut)(t))&&(t.preventDefault(),(e.trim()||o.length>0)&&!l&&er(t))},onPaste:eu,"aria-label":T("a11y.messageInput"),placeholder:n?"":T(!1===c?"placeholderFollowUp":"placeholder"),rows:1,autoFocus:!(0,O5.isMobileViewport)(),autoCorrect:"on",autoCapitalize:"sentences",spellCheck:!0,inputMode:"text",className:"flowbite-scrollbar-visible max-h-[200px] w-full resize-none border-0 bg-transparent px-2 py-2 text-sm shadow-none outline-none ring-0 focus:border-0 focus:ring-0 dark:bg-transparent dark:text-white placeholder:text-gray-500 dark:placeholder:text-gray-400"})]}),ef,em]})]}),(0,ew.jsxs)(xr.ContextActionSheet,{open:z,onClose:()=>L(!1),title:T("attachMenuTitle"),children:[(0,ew.jsx)(xr.ContextAction,{icon:Dt.Camera,label:T("attachCamera"),onSelect:()=>D.current?.click()}),(0,ew.jsx)(xr.ContextAction,{icon:Dr,label:T("attachPhotos"),onSelect:()=>R.current?.click()}),(0,ew.jsx)(xr.ContextAction,{icon:y5.FileText,label:T("attachFilesOption"),onSelect:()=>P.current?.click()})]})]})}),DJ=(0,y6.default)("leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);function DG({onDismiss:e}){let t=(0,eS.useTranslations)("chat.topicChangeBanner"),r=(0,eS.useTranslations)("sidebar"),n=(0,eS.useTranslations)("common");return(0,ew.jsx)("div",{className:"mx-auto my-2 w-full max-w-3xl px-3",children:(0,ew.jsxs)("div",{role:"status",className:"flex items-start gap-2 rounded-md border border-green-400 bg-gray-100 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:border-green-400 dark:bg-gray-800/60 dark:text-gray-400",children:[(0,ew.jsxs)("span",{className:"flex-1",children:[(0,ew.jsxs)("span",{className:"inline-flex items-center gap-1 align-text-bottom",children:[(0,ew.jsx)(DJ,{className:"h-4 w-4 shrink-0 text-green-400 dark:text-green-400","aria-hidden":!0}),(0,ew.jsx)("strong",{className:"font-medium text-gray-700 dark:text-gray-300",children:t("important")})]})," ",t.rich("body",{newChatLabel:r("newChat"),newChatButton:e=>(0,ew.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap font-medium text-gray-700 dark:text-gray-300",children:['"',e,'"',(0,ew.jsx)(O8.SquarePen,{className:"h-4 w-4","aria-hidden":!0})]})})]}),(0,ew.jsx)("button",{type:"button",onClick:e,"aria-label":n("close"),className:"-my-0.5 -mr-1 shrink-0 rounded p-1 text-gray-400 hover:text-gray-600 active:opacity-70 dark:text-gray-500 dark:hover:text-gray-300",children:(0,ew.jsx)(vW.X,{className:"h-4 w-4"})})]})})}var DX=e.i(522016),DY=e.i(761911),DQ=e.i(870273),D0=e.i(492161),D1=e.i(1746),D2=e.i(953782),D4=e.i(139881);function D5({variant:e,autoZenEnabled:t,onAutoZenChange:r,isStreaming:n,auto
190ZenTriggered:i}){let a=(0,eS.useTranslations)("chat"),[o,s]=(0,e_.useState)(!1),[l,u]=(0,e_.useState)(!1),[c,d]=(0,e_.useState)(!1),[p,h]=(0,e_.useState)(t);p!==t&&(h(t),d(!0));let f=a(t?"autoZenOn":"autoZenOff"),m=o||l||c;(0,e_.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>{s(!1),u(!1),d(!1)},5e3);return()=>clearTimeout(e)},[m]);let g=(0,e_.useCallback)(()=>{r?.(!t)},[t,r]);return(0,e_.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>d(!1),1500);return()=>clearTimeout(e)},[c]),(0,ew.jsx)("div",{className:"flex items-center justify-center gap-1.5",children:r&&(0,ew.jsxs)("div",{className:"relative shrink-0",children:[(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",onClick:g,onPointerEnter:e=>{"mouse"===e.pointerType&&s(!0)},onPointerLeave:()=>s(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),"aria-label":f,"aria-pressed":t,className:"!h-9 !w-9",children:(0,ew.jsx)(D4.Bird,{className:(0,v7.cn)("h-4 w-4 -scale-x-100",t?n&&!i?"text-amber-400 animate-zen-bird-pulse":"text-amber-400 drop-shadow-[0_0_8px_rgba(251,191,36,0.6)]":"text-gray-700 dark:text-gray-300")})}),(0,ew.jsx)(eE.AnimatePresence,{children:m&&(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},className:"pointer-events-none absolute left-1/2 top-full z-50 mt-2 w-max max-w-[min(92vw,22rem)] -translate-x-1/2 rounded-lg bg-gray-800 px-3 py-1.5 text-center text-xs leading-snug text-white shadow-lg dark:bg-gray-200 dark:text-gray-900",children:f},"zen-caption")})]})})}var D6=e.i(431343);let D3=[{promptKey:"shortcut.inspirationUkraine"},{promptKey:"shortcut.inspirationWeather"},{promptKey:"shortcut.inspirationGold"},{promptKey:"shortcut.inspirationSunset"},{promptKey:"shortcut.inspirationRelations"},{promptKey:"shortcut.inspirationCrypto"}],D9="gdprchat-shortcut-onboarded";function D8({slot:e,prompt:t,viaShortcut:r}){let n=(0,yC.useRouter)(),i=(0,eS.useTranslations)("shortcut"),a=!t.trim(),[o,s]=(0,e_.useState)(()=>{if(0!==e)return!1;try{return!localStorage.getItem(D9)}catch{return!1}});(0,e_.useEffect)(()=>{if(!o)return;try{localStorage.setItem(D9,"1")}catch{}let e=setTimeout(()=>s(!1),1500);return()=>clearTimeout(e)},[]);let l=(0,e_.useRef)(!1),u=(0,e_.useCallback)(()=>{l.current||(l.current=!0,setTimeout(()=>{l.current=!1},300),a?bV(i("introPrompt"),n,e):bq(t,n,e))},[t,a,i,n,e]),c=a?i("ariaLabelEmpty"):i("ariaLabel");return(0,ew.jsx)(vO.Button,{variant:"icon-chrome",size:"md",onPointerDown:u,onClick:u,title:c,"aria-label":c,"aria-pressed":r,className:(0,v7.cn)("!h-9 !w-9",o&&"ring-2 ring-amber-400/60 shadow-[0_0_18px_rgba(251,191,36,0.45)]"),children:(0,ew.jsx)(D6.Play,{className:(0,v7.cn)("h-4 w-4 transition-colors",r?"fill-amber-400 text-amber-400":"text-gray-700 dark:text-gray-300")})})}function D7({activeSlot:e}){let{data:t}=bZ(),r=(0,e_.useMemo)(()=>t?.hasCustom&&t.prompts.length>0?t.prompts:[""],[t]);return(0,ew.jsx)(ew.Fragment,{children:r.map((t,r)=>(0,ew.jsx)(D8,{slot:r,prompt:t,viaShortcut:e===r},r))})}let Re="flex items-center gap-1.5 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-2.5 py-1 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700";function Rt({onToggleSidebar:e,onNewChat:t,currentFolderName:r,folderPath:n,onSelectFolder:i,conversationTitle:a,credits:o,onShare:s,hasActiveConversation:l,hasVisibleConversation:u,isTemporaryChat:c,starred:d,onToggleStar:p,onRename:h,onDelete:f,onMove:m,autoZenEnabled:g,onAutoZenChange:y,isStreaming:v,autoZenTriggered:b,viaShortcutSlot:x}){let{data:k}=(0,yS.useSession)(),w=(0,eS.useTranslations)("sidebar"),_=(0,eS.useTranslations)("nav"),S=(0,eS.useTranslations)("credits"),E=o?(0,D2.creditNumberEmphasis)({totalAvailable:o.totalAvailable,dailyRemaining:o.dailyRemaining??0,monthlyRemaining:o.monthlyRemaining??0,addOnRemaining:o.addOnRemaining??0,plan:{dailyCredits:o.plan.dailyCredits??0}}):null,C=(0,e_.useRef)(null),$=(0,e_.useRef)(null),T=(0,e_.useRef)(null),I=(0,e_.useRef)(null),N=(0,e_.useRef)(null),A=(0,e_.useRef)(null),[j,M]=(0,e_.useState)(!1);return O2(()=>{let e=C.current,t=$.current,r=T.current,n=I.current,i=N.current;if(!e||!t||!r||!n||!i)return;let a=()=>{let r=e.offsetWidth,i=t.offsetWidth,a=n.offsetWidth,o=A.current,s=o?.offsetWidth??0,l=r/2,u=i+12+s/2<=l&&a+12+s/2<=l;M(e=>e===u?e:u)};a();let o=new ResizeObserver(a);o.observe(e),o.observe(t),o.observe(n),o.observe(i),A.current&&o.observe(A.current);let s=new MutationObserver(a);return s.observe(t,{childList:!0,subtree:!0}),s.observe(r,{childList:!0,subtree:!0}),window.addEventListener("resize",a),()=>{o.disconnect(),s.disconnect(),window.removeEventListener("resize",a)}},[!!(k?.user&&y),l,u]),(0,ew.jsx)("nav",{ref:C,"aria-label":_("chat"),className:"relative z-20 flex shrink-0 items-center border-b border-gray-200 bg-white p-2 sm:px-4 dark:border-gray-700 dark:bg-gray-800",children:(0,ew.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:gap-3 md:grid md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]",children:[(0,ew.jsxs)("div",{ref:$,className:"flex min-w-0 items-center gap-2",children:[(0,ew.jsx)("button",{type:"button",onClick:e,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition-colors hover:bg-gray-100 dark:hover:bg-gray-700 xl:hidden","aria-label":w("openSidebar"),children:(0,ew.jsx)(D0.Menu,{className:"h-4 w-4 text-gray-900 dark:text-gray-50"})}),k?.user&&(0,ew.jsx)(D7,{activeSlot:x??null}),!(k?.user&&y)&&(0,ew.jsx)("h1",{"aria-level":2,className:"min-w-0 truncate text-sm sm:text-xs text-gray-900 lg:text-sm dark:text-white",children:(0,ew.jsx)("button",{type:"button",onClick:t,className:"font-medium hover:underline",children:w("newChat")})})]}),(0,ew.jsx)("div",{className:"hidden items-center justify-center md:flex",children:k?.user&&y&&(0,ew.jsx)(D5,{variant:"compact",autoZenEnabled:g,onAutoZenChange:y,isStreaming:v,autoZenTriggered:b})}),(0,ew.jsxs)("div",{ref:T,className:"flex min-w-0 items-center justify-end gap-2 sm:gap-3",children:[k?.user&&y&&(0,ew.jsx)("div",{ref:A,className:(0,v7.cn)("flex shrink-0 items-center md:hidden",j&&"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"),children:(0,ew.jsx)(D5,{variant:"compact",autoZenEnabled:g,onAutoZenChange:y,isStreaming:v,autoZenTriggered:b})}),(0,ew.jsxs)("div",{ref:I,className:"flex items-center gap-2 sm:gap-3",children:[(0,ew.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:(0,ew.jsxs)("div",{ref:N,className:"flex items-center gap-1",children:[l&&p&&(0,ew.jsx)("button",{type:"button",onClick:p,"aria-pressed":d,"aria-label":w("starred"),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition-colors hover:bg-gray-100 max-sm:hidden dark:hover:bg-gray-700",children:(0,ew.jsx)(DQ.Star,{"aria-hidden":"true",className:(0,v7.cn)("h-4 w-4",d?"fill-comp-a-icon text-comp-a-icon":"text-gray-700 dark:text-gray-300")})}),l&&s&&!c&&(0,ew.jsxs)("button",{type:"button",onClick:s,"aria-label":w("share"),className:"flex h-9 w-9 shrink-0 items-center justify-center gap-1 rounded-lg text-xs font-medium text-gray-700 transition-colors hover:bg-gray-100 md:w-auto md:px-2.5 lg:text-sm dark:text-gray-300 dark:hover:bg-gray-700",children:[(0,ew.jsx)(v_.Share2,{"aria-hidden":"true",className:"h-4 w-4"}),(0,ew.jsx)("span",{className:"hidden md:inline",children:w("share")})]}),(u??l)&&t&&(0,ew.jsx)("button",{type:"button",onClick:t,"aria-label":w("newChat"),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition-colors hover:bg-gray-100 sm:hidden dark:hover:bg-gray-700",children:(0,ew.jsx)(O8.SquarePen,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})})]})}),(0,ew.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 lg:flex",children:[o&&(0,ew.jsxs)(DX.default,{href:"/account/usage",draggable:!1,
190className:(0,v7.cn)(Re,E?.className),title:function(e,t,r){let n=e.dailyRemaining??0,i=e.monthlyRemaining??0,a=e.addOnRemaining??0;if(!(n>0||i>0||a>0))return`${e.plan.name} â ${r("creditsRemaining",{count:e.totalAvailable.toLocaleString()})}`;let o=e.plan.dailyCredits??0,s=e.plan.monthlyCredits??0,l=[`${e.plan.name}`,t("tooltipTotal",{total:e.totalAvailable.toLocaleString()})];if(o>0&&l.push("â "+t("tooltipDaily",{count:n.toLocaleString(),max:o.toLocaleString()})),s>0){let r="free"===e.plan.slug?"tooltipWelcome":"tooltipPeak";l.push("â "+t(r,{count:i.toLocaleString(),max:s.toLocaleString()}))}return a>0&&l.push("â "+t("tooltipAddOn",{count:a.toLocaleString()})),l.join("\n")}(o,S,_),children:[(0,ew.jsx)(vA.Coins,{className:"h-3.5 w-3.5"}),(0,ew.jsx)("span",{className:"hidden xl:inline",children:o.totalAvailable.toLocaleString()})]}),(0,D1.isToolsPortalEnabled)()?null:(0,ew.jsxs)(DX.default,{href:"/for-company",draggable:!1,className:Re,children:[(0,ew.jsx)(DY.Users,{className:"h-3.5 w-3.5"}),(0,ew.jsx)("span",{className:"hidden xl:inline",children:_("tryTeamPlans")})]})]})]})]})]})})}function Rr({status:e,wasUserStopped:t,voice:r}){let n=(0,eS.useTranslations)("chat"),[i,a]=(0,e_.useState)(["",""]),o=(0,e_.useRef)(0),s=(0,e_.useCallback)(e=>{o.current=1-o.current,a(0===o.current?[e,""]:["",e])},[]),l=(0,e_.useRef)(e);(0,e_.useEffect)(()=>{var r;let i=l.current;l.current=e;let a=(r=t(),i===e?null:"submitted"===e?"thinking":("streaming"===i||"submitted"===i)&&"ready"===e?r?"responseStopped":"responseComplete":"error"===e?"responseError":null);a&&s(n(`a11y.${a}`))},[e]);let u=(0,e_.useRef)(r);return(0,e_.useEffect)(()=>{let e=u.current;if(u.current=r,!e||!r)return;let t=!e.isRecording&&r.isRecording?"recordingStarted":!e.isTranscribing||r.isTranscribing||r.error?null:"transcriptionInserted";t&&s(n(`a11y.${t}`))},[r?.isRecording,r?.isTranscribing,r?.error]),(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:i[0]}),(0,ew.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:i[1]})]})}function Rn({planDailyCredits:e,totalAvailable:t,planSlug:r,resetAt:n,nextTier:i}){return t>0?null:(0,ew.jsx)("div",{className:"mx-auto my-2 w-full max-w-3xl",children:(0,ew.jsx)(b7.CreditsExhaustedNotice,{planSlug:r,planDailyCredits:e,resetAt:n,upgradeUrl:"/pricing",nextTier:i})})}var Ri=e.i(89128);function Ra(){let e=(0,eS.useTranslations)("credits");return(0,ew.jsx)("div",{className:"mx-auto my-2 w-full max-w-3xl px-3",children:(0,ew.jsxs)(DX.default,{href:"/account/billing?fix=payment#payment",className:"flex items-center gap-2 rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-300 dark:hover:bg-amber-900",children:[(0,ew.jsx)(Ri.TriangleAlert,{className:"h-4 w-4 shrink-0"}),(0,ew.jsxs)("span",{className:"min-w-0",children:[e("paymentIssue")," ",(0,ew.jsx)("span",{className:"font-medium underline",children:e("paymentIssueFix")})]})]})})}var Ro=e.i(782214);let Rs=new Set;function Rl(e){Rs.add(e);let t=()=>e();return window.addEventListener("storage",t),()=>{Rs.delete(e),window.removeEventListener("storage",t)}}function Ru(e,t){let r=(0,e_.useSyncExternalStore)(Rl,()=>(function(e){try{return window.localStorage.getItem(e)??""}catch{return""}})(e),()=>""),n=(0,e_.useCallback)(()=>{try{window.localStorage.setItem(e,t)}catch{}Rs.forEach(e=>e())},[e,t]);return{dismissed:!!t&&r===t,dismiss:n}}function Rc({postId:e}){let t=(0,eS.useTranslations)("forum"),r=(0,eS.useTranslations)("common"),n=(0,yC.useRouter)(),[i,a]=(0,e_.useState)(!1),[o,s]=(0,e_.useState)(!1),{dismissed:l,dismiss:u}=Ru("gdprchat.retestBannerDismiss",e),c=(0,e_.useCallback)(async()=>{if(!i){a(!0);try{let t=()=>fetch(`/api/forum/posts/${e}/confirm`,{method:"POST"}),r=await t().catch(()=>null);if((!r||r.status>=500)&&(await new Promise(e=>setTimeout(e,1200)),r=await t().catch(()=>null)),!r?.ok)return;s(!0),setTimeout(()=>{(0,Ro.refreshForumUnread)(),(0,xt.refreshReportedMessages)()},3500)}catch{}finally{a(!1)}}},[i,e]);return l?null:(0,ew.jsx)("div",{className:"mx-auto my-2 w-full max-w-3xl px-3",children:(0,ew.jsx)("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border border-green-200 bg-green-50 px-3 py-2 text-xs leading-relaxed text-green-800 dark:border-green-800 dark:bg-green-900/20 dark:text-green-300",children:o?(0,ew.jsxs)("span",{className:"flex flex-1 items-center gap-1.5",children:[(0,ew.jsx)(v9.Check,{className:"h-3.5 w-3.5 shrink-0"}),t("retest.confirmedThanks")]}):(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("span",{className:"min-w-[calc(100%-4rem)] flex-1 sm:min-w-0",children:t("retest.title")}),(0,ew.jsxs)("button",{type:"button",onClick:c,disabled:i,className:"order-2 inline-flex h-11 items-center justify-center gap-1.5 rounded-lg border border-green-600 bg-white px-3 text-xs font-medium text-green-700 transition-colors hover:bg-green-100 disabled:opacity-50 sm:h-8 dark:border-green-700 dark:bg-gray-800 dark:text-green-400 dark:hover:bg-green-900/40",children:[(0,ew.jsx)(v9.Check,{className:"h-3.5 w-3.5"}),t("retest.confirm")]}),(0,ew.jsx)("button",{type:"button",onClick:()=>n.push(`/support?post=${encodeURIComponent(e)}&reopen=1`),disabled:i,className:"order-3 inline-flex h-11 items-center justify-center rounded-lg border border-gray-200 bg-white px-3 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:opacity-50 sm:h-8 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:t("retest.stillBroken")}),(0,ew.jsx)("button",{type:"button",onClick:u,"aria-label":r("close"),className:"order-1 -my-0.5 -mr-1 shrink-0 rounded p-1 text-green-600/70 sm:order-4 transition-colors hover:text-green-800 active:opacity-70 dark:text-green-500/70 dark:hover:text-green-300",children:(0,ew.jsx)(vW.X,{className:"h-3.5 w-3.5"})})]})})})}function Rd(e){if("string"!=typeof e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}let Rp={upgrade:{early:"maintenanceUpgradeEarly",soon:"maintenanceUpgradeSoon"},maintenance:{early:"maintenancePlannedEarly",soon:"maintenancePlannedSoon"}},Rh={upgrade:"maintenanceUpgradeCountdown",maintenance:"maintenancePlannedCountdown"};function Rf({notice:e,now:t,onDismiss:r}){var n;let i,a=(0,eS.useTranslations)("chat"),o=(0,eS.useTranslations)("common"),s=(0,by.useLocale)(),l=function(e,t,r){let n=new Date(t),i=new Date(r),a={weekday:"long",day:"numeric",month:"long",hour:"2-digit",minute:"2-digit",hourCycle:"h23"};try{return new Intl.DateTimeFormat(e,a).formatRange(n,i)}catch{try{let t=new Intl.DateTimeFormat(e,a),r=new Intl.DateTimeFormat(e,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"});return`${t.format(n)} â ${r.format(i)}`}catch{return`${t} â ${r}`}}}(s,e.startsAt,e.endsAt),u="soon"===e.phase?(n=e.startsAt,null==(i=Rd(n))?0:Math.ceil((i-t)/6e4)):0,c="soon"===e.phase&&u>=1,d=c?Rh[e.kind]:Rp[e.kind][e.phase],p=c?{when:l,countdown:function(e,t){try{return new Intl.RelativeTimeFormat(e,{numeric:"always"}).format(t,"minute")}catch{return`${t} min`}}(s,u)}:{when:l};return(0,ew.jsx)("div",{className:"mx-auto my-2 w-full max-w-3xl px-3",children:(0,ew.jsxs)("div",{role:"status",className:"flex items-start gap-2 rounded-md border border-red-500 dark:border-red-500 bg-gray-100 dark:bg-gray-800/60 px-3 py-2 text-xs text-gray-600 dark:text-gray-400 leading-relaxed",children:[(0,ew.jsx)("span",{className:"flex-1",children:a(d,p)}),(0,ew.jsx)("button",{type:"button",onClick:r,"aria-label":o("close"),className:"-my-0.5 -mr-1 shrink-0 rounded p-1 text-gray-400 hover:text-gray-600 active:opacity-70 dark:text-gray-500 dark:hover:text-gray-300",children:(0,ew.jsx)(vW.X,{className:"h-3.5 w-3.5"})})]})})}var Rm=e.i(655900),Rg=e.i(107233);function Ry({initialSlot:e=0}){let t=(0,eS.useTranslations)("shortcut"),{data:r,mutate:n,incrementEditorOpens:i}=bZ(),[a,o]=(0,e_.useState)(!1);if((0,e_.useEffect)(()=>
190{if(a)return document.documentElement.dataset.shortcutEditing="1",()=>{delete document.documentElement.dataset.shortcutEditing}},[a]),!r)return null;let s=r.hasCustom&&r.prompts.length>0?r.prompts:[""];return(0,ew.jsx)("div",{className:"px-2 sm:px-3 pt-1 pb-2",children:(0,ew.jsxs)("div",{children:[(0,ew.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),className:(0,v7.cn)("flex shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium","text-gray-700 transition duration-75 lg:text-sm dark:text-gray-300","hover:bg-gray-100 dark:hover:bg-gray-700"),children:[(0,ew.jsx)("span",{children:t("pillEdit")}),a?(0,ew.jsx)(Rm.ChevronUp,{className:"h-3.5 w-3.5"}):(0,ew.jsx)(vq.ChevronDown,{className:"h-3.5 w-3.5"})]}),(0,ew.jsx)(eE.AnimatePresence,{initial:!1,children:a&&(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"overflow-hidden",children:(0,ew.jsx)(Rv,{initialPrompts:s,initialSlot:Math.min(e,s.length-1),hasCustom:r.hasCustom,editorOpens:r.editorOpens,onIncrementOpens:i,onPromptsChanged:async e=>{await n({...r,prompts:e,hasCustom:!0}),await fetch("/api/me/shortcut",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompts:e})}).catch(()=>{})},onClear:async()=>{await fetch("/api/me/shortcut",{method:"DELETE"}).catch(()=>{}),await n()},onClose:()=>o(!1)})},"shortcut-editor-panel")})]})})}function Rv({initialPrompts:e,initialSlot:t,hasCustom:r,editorOpens:n,onIncrementOpens:i,onPromptsChanged:a,onClear:o,onClose:s}){let l=(0,eS.useTranslations)("shortcut"),[u,c]=(0,e_.useState)(e),[d,p]=(0,e_.useState)(t),h=u[d]??"";(0,e_.useEffect)(()=>{i()},[i]),(0,e_.useEffect)(()=>{p(t)},[t]),(0,e_.useEffect)(()=>{c(e),v.current=e},[e.join("\0")]);let f=n>0&&n<=25,[m]=(0,e_.useState)(()=>{let e=D3.map((e,t)=>t).slice(1);for(let t=e.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return[0,...e]}),[g,y]=(0,e_.useState)(0),v=(0,e_.useRef)(e);(0,e_.useEffect)(()=>{let e=h.trim();if(!e||e===(v.current[d]??"").trim())return;let t=setTimeout(()=>{let t=[...u];t[d]=e,v.current=t,a(t)},500);return()=>clearTimeout(t)},[h,d,u,a]);let b=(0,e_.useCallback)(e=>{c(t=>{let r=[...t];return r[d]=e,r})},[d]),x=(0,e_.useCallback)(()=>{b(l(D3[m[g%m.length]].promptKey.replace(/^shortcut\./,""))),y(e=>e+1)},[m,g,l,b]),k=(0,e_.useCallback)(()=>{if(u.length>=2)return;let e=[...u,""];c(e),p(e.length-1),v.current=e},[u]),w=(0,e_.useCallback)(()=>{if(u.length<=1)return;let e=u.filter((e,t)=>t!==d);c(e),v.current=e,s(),a(e)},[u,d,a,s]),_=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{_.current?.focus()},[d]);let S=u.length<2&&u.every(e=>e.trim()),E=u.length>1;return(0,ew.jsxs)("div",{className:"mt-2 rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-gray-800 dark:shadow-md dark:shadow-gray-900/20",children:[(0,ew.jsx)("div",{className:"mb-3 flex flex-row-reverse",children:(0,ew.jsx)("div",{className:"w-full max-w-full rounded-2xl bg-gray-50 px-4 py-2.5 shadow-sm dark:bg-gray-700/60 dark:shadow-md dark:shadow-gray-900/20",children:(0,ew.jsx)("textarea",{ref:_,autoFocus:!0,value:h,onChange:e=>b(e.target.value),rows:3,className:"w-full resize-none border-0 bg-transparent text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0 dark:text-gray-100",placeholder:l("promptPlaceholder")})})}),(f||r)&&(0,ew.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[f?(0,ew.jsxs)("button",{type:"button",onClick:x,className:"inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-3 py-1.5 text-xs font-medium text-amber-900 transition-colors hover:bg-amber-100 dark:bg-amber-950/40 dark:text-amber-200 dark:hover:bg-amber-900/40",children:[(0,ew.jsx)(D6.Play,{className:"h-3.5 w-3.5"}),l("editorInspiration")]}):(0,ew.jsx)("span",{}),r?(0,ew.jsx)("button",{type:"button",onClick:o,className:"text-xs underline-offset-2 text-gray-500 hover:text-gray-900 hover:underline dark:text-gray-400 dark:hover:text-gray-100 transition-colors",children:l("editorClear")}):(0,ew.jsx)("span",{})]}),(S||E)&&(0,ew.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[S?(0,ew.jsxs)("button",{type:"button",onClick:k,className:"inline-flex items-center gap-1.5 rounded-full bg-gray-100 px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600",children:[(0,ew.jsx)(Rg.Plus,{className:"h-3.5 w-3.5"}),l("addButton")]}):(0,ew.jsx)("span",{}),E?(0,ew.jsxs)("button",{type:"button",onClick:w,className:"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-100",children:[(0,ew.jsx)(vT.Trash2,{className:"h-3.5 w-3.5"}),l("deleteButton")]}):(0,ew.jsx)("span",{})]})]})}let Rb=[{type:"EMAIL_ADDRESS",pattern:/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,score:.95,name:"email"},{type:"IP_ADDRESS",pattern:/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g,score:.9,name:"ipv4"},{type:"IP_ADDRESS",pattern:/\b(([0-9a-fA-F]{1,4}:){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}|:))\b/g,score:.9,name:"ipv6"},{type:"CREDIT_CARD",pattern:/\b(?!1\d{12}(?!\d))((4\d{3}
190)|(5[0-5]\d{2})|(6\d{3})|(1\d{3})|(3\d{3}))[- ]?(\d{3,4})[- ]?(\d{3,4})[- ]?(\d{3,5})\b/g,score:.85,name:"credit_card"},{type:"MAC_ADDRESS",pattern:/\b([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}\b/g,score:.85,name:"mac_address"},{type:"IBAN_CODE",pattern:/\b[A-Z]{2}\d{2}(?:[ ]?[A-Z0-9]){11,30}\b/g,score:.9,name:"iban",validate:function(e){let t=e.replace(/\s+/g,"").toUpperCase();if(t.length<15||t.length>34||!/^[A-Z]{2}\d{2}[A-Z0-9]+$/.test(t))return!1;let r=t.slice(4)+t.slice(0,4),n=0;for(let e of r){let t=e.charCodeAt(0),r=t>=65?(t-55).toString():e;for(let e=0;e<r.length;e++)n=(10*n+(r.charCodeAt(e)-48))%97}return 1===n}},{type:"PHONE_NUMBER",pattern:/\+\d(?:[ .\-]?\d){6,14}\b/g,score:.7,name:"phone_intl"},{type:"PHONE_NUMBER",pattern:/\+43\s?[1-9][0-9]{3,12}/g,score:.85,country:"AT",name:"AT_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+32\s?[1-9][0-9]{7,8}/g,score:.85,country:"BE",name:"BE_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+359\s?[1-9][0-9]{7,8}/g,score:.85,country:"BG",name:"BG_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+385\s?[1-9][0-9]{7,8}/g,score:.85,country:"HR",name:"HR_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+357\s?[2-9][0-9]{6,7}/g,score:.85,country:"CY",name:"CY_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+420\s?[1-9][0-9]{8}/g,score:.85,country:"CZ",name:"CZ_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+45\s?[2-9][0-9]{7}/g,score:.85,country:"DK",name:"DK_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+372\s?[5-9][0-9]{6,7}/g,score:.85,country:"EE",name:"EE_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+358\s?[1-9][0-9]{5,11}/g,score:.85,country:"FI",name:"FI_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+33\s?[1-9][0-9]{8}/g,score:.85,country:"FR",name:"FR_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+49\s?[1-9][0-9]{6,13}/g,score:.85,country:"DE",name:"DE_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+30\s?[26][0-9]{9}/g,score:.85,country:"GR",name:"GR_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+36\s?[0-9]{8,9}/g,score:.85,country:"HU",name:"HU_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+353\s?[1-9][0-9]{7,8}/g,score:.85,country:"IE",name:"IE_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+39\s?[0-9]{6,12}/g,score:.85,country:"IT",name:"IT_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+371\s?[2-9][0-9]{7}/g,score:.85,country:"LV",name:"LV_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+370\s?[0-9]{8}/g,score:.85,country:"LT",name:"LT_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+352\s?[0-9]{9}/g,score:.85,country:"LU",name:"LU_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+356\s?[279][0-9]{7}/g,score:.85,country:"MT",name:"MT_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+31\s?[0-9]{9}/g,score:.85,country:"NL",name:"NL_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+48\s?[0-9]{9}/g,score:.85,country:"PL",name:"PL_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+351\s?[1-9][0-9]{8}/g,score:.85,country:"PT",name:"PT_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+40\s?[1-9][0-9]{8,9}/g,score:.85,country:"RO",name:"RO_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+421\s?[1-9][0-9]{8}/g,score:.85,country:"SK",name:"SK_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+386\s?[1-9][0-9]{6,7}/g,score:.85,country:"SI",name:"SI_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+34\s?[6-9][0-9]{8}/g,score:.85,country:"ES",name:"ES_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+46\s?[0-9]{7,13}/g,score:.85,country:"SE",name:"SE_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+44\s?[1-9][0-9]{9,10}/g,score:.85,country:"GB",name:"GB_phone_intl"},{type:"PHONE_NUMBER",pattern:/\+45\s\d{2}\s\d{2}\s\d{2}\s\d{2}/g,score:.85,country:"DK",name:"DK_phone_spaces"},{type:"PHONE_NUMBER",pattern:/\+44\s\d{2}\s\d{4}\s\d{4}/g,score:.85,country:"GB",name:"GB_phone_spaces"},{type:"VAT_NUMBER",pattern:/\bATU\d{8}\b/g,score:.9,country:"AT",name:"AT_vat"},{type:"VAT_NUMBER",pattern:/\bBE[01]\d{9}\b/g,score:.9,country:"BE",name:"BE_vat"},{type:"VAT_NUMBER",pattern:/\bBG\d{9,10}\b/g,score:.9,country:"BG",name:"BG_vat"},{type:"VAT_NUMBER",pattern:/\bHR\d{11}\b/g,score:.9,country:"HR",name:"HR_vat"},{type:"VAT_NUMBER",pattern:/\bCY\d{8}L\b/g,score:.9,country:"CY",name:"CY_vat"},{type:"VAT_NUMBER",pattern:/\bCZ\d{8,10}\b/g,score:.9,country:"CZ",name:"CZ_vat"},{type:"VAT_NUMBER",pattern:/\bDK\s?\d{8}\b/g,score:.9,country:"DK",name:"DK_vat"},{type:"VAT_NUMBER",pattern:/\bEE\d{9}\b/g,score:.9,country:"EE",name:"EE_vat"},{type:"VAT_NUMBER",pattern:/\bFI\d{8}\b/g,score:.9,country:"FI",name:"FI_vat"},{type:"VAT_NUMBER",pattern:/\bFR[A-Z0-9]{2}\d{9}\b/g,score:.9,country:"FR",name:"FR_vat"},{type:"VAT_NUMBER",pattern:/\bDE\d{9}\b/g,score:.9,country:"DE",name:"DE_vat"},{type:"VAT_NUMBER",pattern:/\bEL\d{9}\b/g,score:.9,country:"GR",name:"GR_vat"},{type:"VAT_NUMBER",pattern:/\bHU\d{8}\b/g,score:.9,country:"HU",name:"HU_vat"},{type:"VAT_NUMBER",pattern:/\bIE\d[A-Z0-9]\d{5}[A-Z]\b/g,score:.9,country:"IE",name:"IE_vat"},{type:"VAT_NUMBER",pattern:/\bIT\d{11}\b/g,score:.9,country:"IT",name:"IT_vat"},{type:"VAT_NUMBER",pattern:/\bLV\d{11}\b/g,score:.9,country:"LV",name:"LV_vat"},{type:"VAT_NUMBER",pattern:/\bLT(\d{9}|\d{12})\b/g,score:.9,country:"LT",name:"LT_vat"},{type:"VAT_NUMBER",pattern:/\bLU\d{8}\b/g,score:.9,country:"LU",name:"LU_vat"},{type:"VAT_NUMBER",pattern:/\bMT\d{8}\b/g,score:.9,country:"MT",name:"MT_vat"},{type:"VAT_NUMBER",pattern:/\bNL\d{9}B\d{2}\b/g,score:.9,country:"NL",name:"NL_vat"},{type:"VAT_NUMBER",pattern:/\bPL\d{10}\b/g,score:.9,country:"PL",name:"PL_vat"},{type:"VAT_NUMBER",pattern:/\bPT\d{9}\b/g,score:.9,country:"PT",name:"PT_vat"},{type:"VAT_NUMBER",pattern:/\bRO\d{2,10}\b/g,score:.9,country:"RO",name:"RO_vat"},{type:"VAT_NUMBER",pattern:/\bSK\d{10}\b/g,score:.9,country:"SK",name:"SK_vat"},{type:"VAT_NUMBER",pattern:/\bSI\d{8}\b/g,score:.9,country:"SI",name:"SI_vat"},{type:"VAT_NUMBER",pattern:/\b(?:ES[A-Z]\d{7}[A-Z]|ES[A-Z]\d{7}[0-9A-Z]|ES\d{8}[A-Z])\b/g,score:.9,country:"ES",name:"ES_vat"},{type:"VAT_NUMBER",pattern:/\bSE\d{12}\b/g,score:.9,country:"SE",name:"SE_vat"},{type:"VAT_NUMBER",pattern:/\b(?:GB\d{9}|GB\d{12}|GBGD\d{3}|GBHA\d{3})\b/g,score:.9,country:"GB",name:"GB_vat"},{type:"DK_CPR",pattern:/\b(?:0[1-9]|[12]\d|3[01])(?:0[1-9]|1[0-2])\d{2}[-]?\d{4}\b/g,score:.85,country:"DK",name:"DK_cpr"},{type:"NATIONAL_ID",pattern:/\b\d{2}\.?\d{2}\.?\d{2}-\d{3}\.?\d{2}\b/g,score:.8,country:"BE",name:"BE_national_id"},{type:"NATIONAL_ID",pattern:/\b\d{2}[015]\d\d{2}\/\d{4}\b/g,score:.8,country:"CZ",name:"CZ_national_id"},{type:"NATIONAL_ID",pattern:/\b\d{6}[+\-ABCDEFYXWVU]\d{3}[0-9ABCDEFHJKLMNPRSTUVWXY]\b/g,score:.85,country:"FI",name:"FI_national_id"},{type:"NATIONAL_ID",pattern:/\b\d{2}[01]\d\d{2}-\d{5}\b/g,score:.8,country:"LV",name:"LV_national_id"},{type:"NATIONAL_ID",pattern:/\b\d{8}\s?\d\s?[A-Z]{2}\d\b/g,score:.8,country:"PT",name:"PT_national_id"},{type:"NATIONAL_ID",pattern:/\b\d{2}[015]\d\d{2}\/\d{4}\b/g,score:.8,country:"SK",name:"SK_national_id"},{type:"NATIONAL_ID",pattern:/\b[XYZ]\d{7}[A-Z]\b/g,score:.8,country:"ES",name:"ES_national_id_nie"},{type:"NATIONAL_ID",pattern:/\b\d{2}[01]\d\d{2}[-+]\d{4}\b/g,score:.85,country:"SE",name:"SE_national_id"},{type:"SOCIAL_INSURANCE",pattern:/\b\d{2}\d{2}[01]\d\d{2}[A-Z]\d{2}\d\b/g,score:.8,country:"DE",name:"DE_social_insurance"},{type:"TAX_ID",pattern:/\b\d{3}-\d{3}-\d{2}-\d{2}\b/g,score:.85,country:"PL",name:"PL_tax_id"},{type:"FISCAL_CODE",pattern:/(?:[A-Z][AEIOU][AEIOUX]|[AEIOU]X{2}|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}(?:[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[15MR][\dLMNP-V]|[26NS][0-8LMNP-U])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM]|[AC-EHLMPR-T][26NS][9V])|(?:[02468LNQSU][048LQU]|[13579MPRTV][26NS])B[26NS][9V])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[1-9MNP-V][\dLMNP-V]|[0L][1-9MNP-V]))[A-Z]/gi,score:.9,country:"IT",name:"IT_fiscal_code"},{type:"NATIONAL_INSURANCE",pattern:/\b[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\d{6}[A-DFM\s]?\b/g,score:.85,country:"GB",name:"GB_national_insurance"},{type:"PASSPORT",pattern:/\b\d{2}[A-Z]{2}\d{5}
190\b/g,score:.75,country:"FR",name:"FR_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}[A-Z0-9]{6}\d\b/g,score:.7,country:"NL",name:"NL_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{3}\d{6}[A-Z]?\b/g,score:.7,country:"ES",name:"ES_passport"},{type:"DRIVER_LICENSE",pattern:/\b[A-Z]{2}\d{7}[A-Z]\b/g,score:.75,country:"IT",name:"IT_driver_license"},{type:"DRIVER_LICENSE",pattern:/\b[A-Z]{5}\d{6}[A-Z]{2}\d{3}[A-Z]{2}\b/g,score:.85,country:"GB",name:"GB_driver_license"}],Rx=[...Rb,{type:"PHONE_NUMBER",pattern:/\b[2-9]\d{7}\b/g,score:.45,country:"DK",name:"DK_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{5,13}\b/g,score:.4,country:"DE",name:"DE_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"FR",name:"FR_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{9,10}\b/g,score:.4,country:"GB",name:"GB_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{7,8}\b/g,score:.4,country:"NL",name:"NL_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{7,8}\b/g,score:.4,country:"BE",name:"BE_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"IT",name:"IT_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[6-9]\d{8}\b/g,score:.4,country:"ES",name:"ES_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"PT",name:"PT_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{3,12}\b/g,score:.4,country:"AT",name:"AT_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{7,8}\b/g,score:.4,country:"SE",name:"SE_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{5,11}\b/g,score:.4,country:"FI",name:"FI_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{7,8}\b/g,score:.4,country:"IE",name:"IE_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"PL",name:"PL_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8,9}\b/g,score:.4,country:"RO",name:"RO_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"CZ",name:"CZ_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"HU",name:"HU_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{7,8}\b/g,score:.4,country:"BG",name:"BG_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{7,8}\b/g,score:.4,country:"HR",name:"HR_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[2-9]\d{6,7}\b/g,score:.4,country:"CY",name:"CY_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[5-9]\d{6,7}\b/g,score:.4,country:"EE",name:"EE_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[2-9]\d{7}\b/g,score:.4,country:"LV",name:"LV_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[0-9]\d{7}\b/g,score:.4,country:"LT",name:"LT_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[0-9]\d{8}\b/g,score:.4,country:"LU",name:"LU_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[279]\d{7}\b/g,score:.4,country:"MT",name:"MT_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{8}\b/g,score:.4,country:"SK",name:"SK_phone_local"},{type:"PHONE_NUMBER",pattern:/\b0[1-9]\d{6,7}\b/g,score:.4,country:"SI",name:"SI_phone_local"},{type:"PHONE_NUMBER",pattern:/\b[26]\d{9}\b/g,score:.4,country:"GR",name:"GR_phone_local"},{type:"NATIONAL_ID",pattern:/\b\d{2}[0-5]\d[0-3]\d\d{4}\b/g,score:.5,country:"BG",name:"BG_egn"},{type:"NATIONAL_ID",pattern:/\b[1-6]\d{2}[01]\d[0-3]\d\d{4}\b/g,score:.5,country:"EE",name:"EE_isikukood"},{type:"NATIONAL_ID",pattern:/\b\d{6}\d{4}\b/g,score:.35,country:"HU",name:"HU_national_id"},{type:"NATIONAL_ID",pattern:/\b[3-6]\d{2}[01]\d[0-3]\d\d{4}\b/g,score:.5,country:"LT",name:"LT_asmens_kodas"},{type:"NATIONAL_ID",pattern:/\b\d{2}[0-3]\d[0-3]\d\d{5}\b/g,score:.5,country:"PL",name:"PL_pesel"},{type:"NATIONAL_ID",pattern:/\b[1-8]\d{2}[01]\d[0-3]\d\d{6}\b/g,score:.5,country:"RO",name:"RO_cnp"},{type:"TAX_ID",pattern:/\b\d{9}\b/g,score:.3,country:"GR",name:"GR_afm"},{type:"NATIONAL_ID",pattern:/\b\d{7}[A-Z]{1,2}\b/g,score:.55,country:"IE",name:"IE_pps"},{type:"NATIONAL_ID",pattern:/\b\d{8}[A-Z]\b/g,score:.55,country:"ES",name:"ES_dni"},{type:"TAX_ID",pattern:/\b\d{11}\b/g,score:.3,country:"DE",name:"DE_steuer_id"},{type:"TAX_ID",pattern:/\b\d{10}\b/g,score:.3,country:"HU",name:"HU_tax_id"},{type:"NATIONAL_ID",pattern:/\b\d{3}\s\d{3}\s\d{4}\b/g,score:.45,country:"GB",name:"GB_nhs"},{type:"SOCIAL_INSURANCE",pattern:/\b[12]\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{3}\s?\d{3}\s?\d{2}\b/g,score:.5,country:"FR",name:"FR_nir"},{type:"SOCIAL_INSURANCE",pattern:/\b\d{2}\d{8}\d{2}\b/g,score:.35,country:"ES",name:"ES_social_security"},{type:"PASSPORT",pattern:/\b[A-Z]\d{7}\b/g,score:.4,country:"AT",name:"AT_passport"},{type:"PASSPORT",pattern:/\b[A-Z]\d{6}\b/g,score:.4,country:"CY",name:"CY_passport"},{type:"PASSPORT",pattern:/\b[A-Z]\d{7}\b/g,score:.4,country:"EE",name:"EE_passport"},{type:"PASSPORT",pattern:/\b[A-Z]\d{6}\b/g,score:.4,country:"PT",name:"PT_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{6}\b/g,score:.45,country:"BE",name:"BE_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"FI",name:"FI_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"GR",name:"GR_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{6,7}\b/g,score:.45,country:"HU",name:"HU_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"IE",name:"IE_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"IT",name:"IT_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"LV",name:"LV_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"PL",name:"PL_passport"},{type:"PASSPORT",pattern:/\b[A-Z]{2}\d{7}\b/g,score:.45,country:"SI",name:"SI_passport"},{type:"DRIVER_LICENSE",pattern:/\b[A-Z]\d{8}\b/g,score:.4,country:"DE",name:"DE_driver_license"},{type:"DRIVER_LICENSE",pattern:/\b\d{10}\b/g,score:.3,country:"FR",name:"FR_driver_license"}];function Rk(e,t){let r=t?.minScore??.6,n=t?.extended?Rx:Rb,i=[];for(let{type:t,pattern:a,score:o,minLength:s,validate:l}of n){let n;if(!(o<r))for(a.lastIndex=0;null!==(n=a.exec(e));){let e=n[0];(!s||!(e.length<s))&&(!l||l(e))&&i.push({entity_type:t,start:n.index,end:n.index+e.length,score:o,text:e})}}i.sort((e,t)=>
190e.start-t.start||t.end-e.end);let a=function(e){if(0===e.length)return e;let t=[e[0]];for(let r=1;r<e.length;r++){let n=t[t.length-1],i=e[r];i.start<n.end?i.score>n.score&&(t[t.length-1]=i):t.push(i)}return t}(i);return{hasPii:a.length>0,entities:a}}var Rw=e.i(685149);function R_({open:e,retryAfter:t,onDismiss:r}){let n=(0,eS.useTranslations)("rateLimit");return(0,ew.jsx)(vY.Dialog,{open:e,onOpenChange:e=>!e&&r(),children:(0,ew.jsxs)(vY.DialogContent,{className:"max-w-sm",children:[(0,ew.jsxs)(vY.DialogHeader,{className:"items-center text-center",children:[(0,ew.jsx)("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-green-50 dark:bg-green-950/30",children:(0,ew.jsx)(DY.Users,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),(0,ew.jsx)(vY.DialogTitle,{children:n("title")}),(0,ew.jsx)(vY.DialogDescription,{className:"text-sm",children:n("message")})]}),null!=t&&t>0&&(0,ew.jsxs)("div",{className:"flex items-center justify-center gap-2 rounded-lg border border-green-200 bg-green-50 px-3 py-2 text-sm text-green-700 dark:border-green-800 dark:bg-green-950/30 dark:text-green-400",children:[(0,ew.jsx)(DY.Users,{className:"h-3.5 w-3.5 shrink-0"}),(0,ew.jsxs)("span",{children:[n("waitMessage")," ",(0,ew.jsxs)("span",{className:"font-semibold",children:[t," ",n(1===t?"second":"seconds")]})]})]}),(0,ew.jsx)("div",{className:"flex justify-center pt-2",children:(0,ew.jsx)(vj.Button,{onClick:r,children:n("tryAgainButton")})}),(0,ew.jsx)("p",{className:"text-center text-xs text-gray-500 dark:text-gray-400",children:n("poweredBy")})]})})}var RS=e.i(783721);let RE={chat:{leadKey:"chat.aiCanMakeMistakes",linkKey:"feedback.entry"},business_tool:{linkKey:"feedback.entry"},editor:{linkKey:"feedback.entry"},generated_doc:{linkKey:"feedback.entry"},settings:{linkKey:"feedback.entry"},pricing:{linkKey:"feedback.entry"},forum:{linkKey:"feedback.entry"}};function RC({surface:e,product:t,className:r,buildMessageRef:n,hasAnswers:i=!0}){let a=(0,eS.useTranslations)("feedback"),o=(0,eS.useTranslations)("chat"),s=(0,yC.usePathname)(),{openFeedback:l}=(0,RS.useFeedback)(),u=RE[e],c={surface:e,product:t,route:s},d=!!u.leadKey&&i;return(0,ew.jsxs)("p",{className:r,children:[d?(0,ew.jsxs)("span",{children:[o("aiCanMakeMistakes")," "]}):null,(0,ew.jsx)("button",{type:"button",onClick:function(){let e=i?n?.()??void 0:void 0;l({...c,message:e,...e?{chatContextKind:"fyi_context",sourceKind:"report"}:{}})},className:"inline-flex min-h-[24px] items-center rounded px-1 py-1 underline decoration-dotted underline-offset-2 transition-colors hover:text-gray-700 dark:hover:text-gray-200",children:a("entry")})]})}function R$({conversationId:e,messageIds:t,handledPostId:r,className:n}){let i=(0,eS.useTranslations)("feedback"),{forConversation:a}=(0,xt.useReportedMessages)();if(!e)return null;let o=a(e,t).filter(e=>e.postId!==r);if(0===o.length)return null;let s=o.find(e=>"done"===e.status)??o[0],l="done"===s.status,u=i(l?"fixReadyMarker":"reportedConversationMarker");return(0,ew.jsx)("div",{className:(0,v7.cn)("flex justify-center",n),children:(0,ew.jsxs)(DX.default,{href:`/support?post=${s.postId}`,className:(0,v7.cn)("inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors",l?"border-green-600/40 text-green-700 hover:bg-green-50 dark:border-green-500/40 dark:text-green-400 dark:hover:bg-green-900/20":"border-gray-200 text-gray-500 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"),children:[l?(0,ew.jsx)(vN.Wrench,{className:"h-3.5 w-3.5"}):(0,ew.jsx)(vS.ThumbsDown,{className:"h-3.5 w-3.5 fill-current"}),u]})})}function RT({open:e,onOpenChange:t,onConfirm:r}){let n=(0,eS.useTranslations)("keepOnly");return(0,ew.jsx)(vY.Dialog,{open:e,onOpenChange:t,children:(0,ew.jsxs)(vY.DialogContent,{className:"sm:max-w-sm",children:[(0,ew.jsx)(vY.DialogHeader,{children:(0,ew.jsx)(vY.DialogTitle,{children:n("title")})}),(0,ew.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,ew.jsx)(vj.Button,{size:"sm",color:"gray",onClick:()=>t(!1),children:n("cancel")}),(0,ew.jsx)(vj.Button,{size:"sm",color:"default",onClick:r,children:n("confirm")})]})]})})}var RI=e.i(368404);let RN=[.2,.55,.85,1.05,1.2,1.05,.85,.55,.2];function RA(e,t){switch(t.type){case"PREPARE":if("idle"===e.phase)return{phase:"preparing",queue:t.queue};if("streaming"===e.phase||"stopping"===e.phase)return{phase:"stopping",queue:t.queue};if("preparing"===e.phase||"sending"===e.phase)return{...e,queue:t.queue};return e;case"SEND_DIRECT":if("idle"===e.phase)return{phase:"sending",queue:t.queue};if("streaming"===e.phase||"stopping"===e.phase)return{phase:"stopping",queue:t.queue};return e;case"PREPARED":if("preparing"===e.phase)return{phase:"sending",queue:e.queue};return e;case"BLOCKED":if("preparing"===e.phase)return{phase:"idle",queue:null};return e;case"STREAM_STARTED":if("sending"===e.phase)return{phase:"streaming",queue:null};return e;case"STREAM_ENDED":case"STREAM_ERROR":if("streaming"===e.phase)return{phase:"idle",queue:null};return e;case"INTERRUPT":if("streaming"===e.phase||"stopping"===e.phase)return{phase:"stopping",queue:t.queue};return e;case"STOP":if("streaming"===e.phase)return{phase:"stopping",queue:null};return e;case"SETTLED":if("stopping"===e.phase&&e.queue)return{phase:"sending",queue:e.queue};return e;case"SETTLED_EMPTY":if("stopping"===e.phase)return{phase:"idle",queue:null};return e;case"SEND_STUCK":if("sending"===e.phase)return{phase:"idle",queue:e.queue};return e;case"RESET":return{phase:"idle",queue:null};default:return e}}let Rj={phase:"idle",queue:null};var RM=e.i(745009),RO=e.i(617577),RD=e.i(777211);let RR="gdprchat.maintenanceNoticeDismiss",RP=(0,y6.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}
190],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function Rz({state:e,onRetry:t}){let r=(0,eS.useTranslations)("connection");return(0,ew.jsx)(eE.AnimatePresence,{children:e&&(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.25},className:"shrink-0 mx-auto w-full max-w-3xl px-4 pb-2",children:(0,ew.jsxs)("div",{role:"alert",className:"flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 dark:border-amber-800 dark:bg-amber-950/30",children:[(0,ew.jsx)(RP,{className:"h-3.5 w-3.5 shrink-0 text-amber-500 dark:text-amber-400"}),(0,ew.jsxs)("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:["offline"===e&&r("offline"),"reconnecting"===e&&r("reconnecting"),"gaveUp"===e&&r("gaveUp"),"stalled"===e&&r("stalled")]}),("gaveUp"===e||"stalled"===e)&&t&&(0,ew.jsxs)("button",{onClick:t,className:"ml-auto flex items-center gap-1 rounded-md border border-amber-200 bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700 transition-colors hover:bg-amber-200 dark:border-amber-700 dark:bg-amber-900/50 dark:text-amber-400 dark:hover:bg-amber-900/80",children:[(0,ew.jsx)(v$.RefreshCw,{className:"h-3 w-3"}),r("retryButton")]})]})},"connection-notice")})}var RL=e.i(931091);let RF=(0,y6.default)("clipboard-pen",[["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M21.34 15.664a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"16fuwn"}],["path",{d:"M8 22H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"120tdm"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),RU=(0,y6.default)("chef-hat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]),RB=(0,y6.default)("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),RZ=(0,y6.default)("compass",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]),Rq=[{id:101,promptKey:"promptZen",answerKey:"answerZen",titleKey:"titleZen"},{id:102,promptKey:"promptBestAnswers",answerKey:"answerBestAnswers",titleKey:"titleBestAnswers"},{id:103,promptKey:"promptTrust",answerKey:"answerTrust",titleKey:"titleTrust"},{id:104,promptKey:"promptSaveEnergy",answerKey:"answerSaveEnergy",titleKey:"titleSaveEnergy"},{id:105,promptKey:"promptLanguage",answerKey:"answerLanguage",titleKey:"titleLanguage"},{id:106,promptKey:"promptFindChats",answerKey:"answerFindChats",titleKey:"titleFindChats"}
190,{id:107,promptKey:"promptFollowTopic",answerKey:"answerFollowTopic",titleKey:"titleFollowTopic"},{id:108,promptKey:"promptEditExport",answerKey:"answerEditExport",titleKey:"titleEditExport"},{id:109,promptKey:"promptBusinessTools",answerKey:"answerBusinessTools",titleKey:"titleBusinessTools"},{id:110,promptKey:"promptFeatureRequest",answerKey:"answerFeatureRequest",titleKey:"titleFeatureRequest"}];Rq.reduce((e,t)=>t.id>e?t.id:e,0);let RV=[{id:"picture",icon:Db.Image,labelKey:"chipPicture",promptCount:5},{id:"rewrite",icon:RF,labelKey:"chipRewrite",promptCount:5},{id:"recipe",icon:RU,labelKey:"chipRecipe",promptCount:5},{id:"learn",icon:RB,labelKey:"chipLearn",promptCount:5},{id:"write",icon:vp.Lightbulb,labelKey:"chipWrite",promptCount:5}];function RH({onPick:e,onGuidedTourStep:t}){let r=(0,eS.useTranslations)("messageList"),n=(0,eS.useTranslations)("guidedTour"),i=(0,eS.useTranslations)("shortcut"),{unseenCount:a,nextEntry:o,markSeen:s}=function(){let e,{settings:t,updateSettings:r}=(0,bR.useUserSettings)(),n=t.lastSeenTourId,i=(e="number"==typeof n?n:-1,Rq.filter(t=>t.id>e)),a=(0,e_.useCallback)(e=>{(n??-1)<e&&r({lastSeenTourId:e})},[n,r]);return{unseenCount:i.length,nextEntry:i[0]??null,markSeen:a}}(),[l,u]=(0,e_.useState)(!1);(0,e_.useEffect)(()=>u(!0),[]);let c=l&&a>0&&null!=o,d=(0,e_.useRef)(!1),[p,h]=(0,e_.useState)(!1),f=async()=>{if(d.current||!o)return;d.current=!0,h(!0);let e=n(o.promptKey),r=n(o.answerKey,{editLabel:i("pillEdit")}),a=n(o.titleKey);try{await t(e,r,a)&&s(o.id)}finally{d.current=!1,h(!1)}},m=c?RV.filter(e=>"write"!==e.id):RV;return(0,ew.jsxs)("div",{className:"relative w-full",children:[(0,ew.jsxs)("div",{className:(0,v7.cn)("flex w-full flex-wrap justify-center gap-2 px-4","max-sm:portrait:flex-nowrap max-sm:portrait:justify-start max-sm:portrait:overflow-x-auto max-sm:portrait:px-0","max-sm:portrait:[scrollbar-width:none] max-sm:portrait:[-ms-overflow-style:none] max-sm:portrait:[&::-webkit-scrollbar]:hidden"),children:[c&&(0,ew.jsxs)("button",{type:"button",onClick:f,disabled:p,"aria-busy":p,"data-guided-tour-pill":!0,className:(0,v7.cn)("inline-flex shrink-0 items-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2 text-sm text-gray-700 transition-colors dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200",p?"animate-pulse cursor-default bg-gray-100 dark:bg-gray-800":"hover:bg-gray-50 dark:hover:bg-gray-800"),children:[(0,ew.jsx)(RZ,{className:"h-3.5 w-3.5"}),n("tourLabel")," (",a,")"]}),m.map(t=>{let n=t.icon;return(0,ew.jsxs)("button",{type:"button",onClick:()=>{let n;return n=Math.floor(Math.random()*t.promptCount)+1,void e(r(`${t.labelKey}Prompt${n}`))},className:"inline-flex shrink-0 items-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2 text-sm text-gray-700 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800",children:[(0,ew.jsx)(n,{className:"h-3.5 w-3.5"}),r(t.labelKey)]},t.id)})]}),(0,ew.jsx)(Oi.ScrollFade,{side:"left",className:"to-gray-50 dark:to-gray-900"}),(0,ew.jsx)(Oi.ScrollFade,{side:"right",className:"to-gray-50 dark:to-gray-900"})]})}function RK({temporary:t=!1}){let r=(0,eS.useTranslations)("messageList"),n=(0,eS.useTranslations)("update"),i=(0,eS.useTranslations)("install"),a=(0,eS.useTranslations)("common"),o=(0,yC.useRouter)(),s=function(){let[t,r]=(0,e_.useState)({status:"current",platform:"web",storeUrl:null}),n=(0,e_.useRef)(!1);return(0,e_.useEffect)(()=>{let t=!1,i=null,a=null;async function o(){if(!n.current){n.current=!0;try{let n=await fetch("/api/version",{cache:"no-store"});if(!n.ok)return;let i=await n.json();if(t)return;let a="d034c0c",{isNativeApp:o,getNativePlatform:s,getNativeAppInfo:l}=await e.A(820447),u=o(),c=u?s():"web",d="android"===c?i.storeUrls.android:"ios"===c?i.storeUrls.ios:null;if(u){let e=await l(),n=e?Number.parseInt(e.build,10):NaN,a="android"===c?i.minNative.android:i.minNative.ios;if(Number.isFinite(n)&&n<a){if(t)return;r(e=>"native-stale"===e.status?e:{status:"native-stale",platform:c,storeUrl:d});return}}let p=i.build;if(a&&p&&"dev"!==p&&a!==p){if(t)return;r(e=>"web-stale"===e.status?e:{status:"web-stale",platform:c,storeUrl:d});return}if(t)return;r(e=>"current"===e.status?e:{status:"current",platform:c,storeUrl:d})}catch{}finally{n.current=!1}}}let s=setTimeout(o,3e4);function l(){document.hidden||o()}return i=setInterval(o,9e5),document.addEventListener("visibilitychange",l),(async()=>{try{let{isNativeApp:t}=await e.A(820447);if(!t())return;let{App:r}=await e.A(746046),n=await r.addListener("appStateChange",e=>{e.isActive&&o()});a=()=>{n.remove()}}catch{}})(),()=>{t=!0,clearTimeout(s),i&&clearInterval(i),document.removeEventListener("visibilitychange",l),a?.()}},[]),t}(),l=(0,e_.useRef)(null),{needsYou:u,signature:c,waiting:d}=(0,Ro.useForumUnread)(),{dismissed:p,dismiss:h}=Ru("gdprchat.forumNudgeDismiss",c),f=!t&&(0,RD.isForumEnabled)()&&u>0&&!p,m=1===u&&d[0]?`/support?post=${encodeURIComponent(d[0].postId)}`:"/support/notifications";(0,e_.useEffect)(()=>{f&&o.prefetch(m)},[f,m,o]),(0,e_.useEffect)(()=>{"current"===s.status||l.current!==s.status&&(l.current=s.status,console.info(`[update] empty-state affordance type=${s.status} platform=${s.platform}`))},[s.status,s.platform]);let g=(0,e_.useCallback)(async()=>
190{if("web-stale"===s.status)return void window.location.reload();if("native-stale"===s.status&&s.storeUrl)try{let{Browser:t}=await e.A(875192);await t.open({url:s.storeUrl})}catch{window.open(s.storeUrl,"_blank","noopener,noreferrer")}},[s.status,s.storeUrl]);return(0,ew.jsxs)("div",{className:"mx-auto flex w-full max-w-2xl flex-col items-center gap-4 px-4",children:[t&&(0,ew.jsx)(Dn.Ghost,{className:"h-8 w-8 text-blue-600 dark:text-blue-400","aria-hidden":"true"}),(0,ew.jsx)("h2",{className:"max-w-[14rem] sm:max-w-none text-center text-2xl sm:text-3xl font-semibold text-gray-900 dark:text-gray-100",children:r(t?"temporaryTitle":f?"forumNews":"howCanIHelp")}),t&&(0,ew.jsx)("p",{className:"max-w-sm text-center text-sm text-gray-500 dark:text-gray-400",children:r("temporaryBody")}),f&&(0,ew.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ew.jsxs)("button",{type:"button",onClick:()=>o.push(m),className:"inline-flex items-center gap-2 rounded-full bg-accent-solid px-4 py-1.5 text-sm font-semibold text-accent-foreground shadow-sm transition hover:bg-accent-solid-hover",children:[(0,ew.jsx)(RL.Megaphone,{className:"h-4 w-4"}),r("forumNewsCta"),(0,ew.jsx)("span",{className:"flex h-5 min-w-[20px] items-center justify-center rounded-full bg-red-500 px-1.5 text-xs font-medium leading-none text-white",children:u>99?"99+":u})]}),(0,ew.jsx)("button",{type:"button",onClick:h,"aria-label":a("close"),className:"flex h-11 w-11 items-center justify-center rounded-full text-gray-400 transition hover:bg-gray-100 hover:text-gray-600 active:opacity-70 sm:h-9 sm:w-9 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:(0,ew.jsx)(vW.X,{className:"h-4 w-4"})})]}),"web-stale"===s.status&&(0,ew.jsxs)("button",{type:"button",onClick:g,"data-update-type":"web",className:"inline-flex items-center gap-1.5 rounded-full bg-amber-500 px-3 py-1 text-xs font-medium text-white transition hover:bg-amber-600 dark:bg-amber-600 dark:hover:bg-amber-500",children:[(0,ew.jsx)(v$.RefreshCw,{className:"h-3.5 w-3.5"}),(0,ew.jsx)("span",{children:n("pillWeb")})]}),"native-stale"===s.status&&(0,ew.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,ew.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("availableNative")}),"ios"===s.platform?(0,ew.jsx)("button",{type:"button",onClick:g,"data-update-type":"native","aria-label":i("appStoreBadgeLabel"),className:"transition hover:opacity-80",children:(0,ew.jsx)(bW.default,{src:"/badges/app-store-en.svg",alt:i("appStoreBadgeLabel"),width:135,height:45,className:"h-9 w-auto",unoptimized:!0})}):(0,ew.jsx)("button",{type:"button",onClick:g,"data-update-type":"native","aria-label":i("googlePlayBadgeLabel"),className:"transition hover:opacity-80",children:(0,ew.jsx)(bW.default,{src:"/badges/google-play-en.png",alt:i("googlePlayBadgeLabel"),width:564,height:168,className:"h-9 w-auto",unoptimized:!0})})]})]})}function RW({onChipPick:e,onGuidedTourStep:t}){return(0,ew.jsx)("div",{className:"mx-auto flex w-full max-w-2xl flex-col items-center gap-4 px-4 max-sm:portrait:px-2",children:(0,ew.jsx)(RH,{onPick:e,onGuidedTourStep:t})})}var RJ=e.i(949617),RG=e.i(908549);let RX=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function RY(e){return RX.test(e)}let RQ=/\.(png|jpe?g|gif|webp|bmp|tiff?|avif|heic|heif|svg)$/i;function R0(e){let t=Array.isArray(e.parts)?e.parts:[];if(t.some(e=>e?.type==="text"&&e.text))return t;let r={type:"text",text:e.content??""};return t.length>0?[r,...t]:[r]}function R1(e){if(!e)return!1;let t=(e.message??"").toLowerCase(),r=(e.name??"").toLowerCase();return t.includes("fetch")||t.includes("network")||t.includes("networkerror")||t.includes("failed to fetch")||t.includes("load failed")||"typeerror"===r&&t.includes("fetch")||"networkerror"===r}function R2(e){return vB(e,{isUser:!1,stripText:OI}).trim()}async function R4(e,t,r,n){try{let i=await fetch(`/api/conversations/${e}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userMessage:t,assistantMessage:r})});if(!i.ok||!i.body)return{ok:!1,status:i.status};let a=i.body.getReader(),o=new TextDecoder,s="";for(;;){let{done:e,value:t}=await a.read();if(e)break;let r=(s+=o.decode(t,{stream:!0})).trim().replace(/^["']|["']$/g,"");r&&n(r)}return{ok:!0,title:s.trim().replace(/^["']|["']$/g,"")}}catch(e){return{ok:!1,error:e}}}function R5(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function R6(e){for(let t=e.length-1;t>=0;t--)if("assistant"===e[t].role)return e[t].parts.some(e=>g_(e)&&"input-available"===e.state);return!1}function R3({emptyStateKey:t,onToggleSidebar:r,sidebarCollapsed:n,onNewChat:i,onTogglePiiLock:a,currentFolderId:o,currentFolder
190Name:s,conversationTitle:l,folderPath:u,onSelectFolder:c,piiLockEnabled:d,activeConversationId:p,onConversationCreated:h,onTitleGenerated:f,onShare:m,isTemporaryChat:g,onShareMessage:y,initialDraft:v,onDraftChanged:b,starred:x,onToggleStar:k,onRename:w,onDelete:_,onMove:S,isShortcutChat:E,viaShortcutSlot:C,isShortcutIntro:$}){let T=(0,eS.useTranslations)("sidebar"),I=(0,eS.useTranslations)("shortcut"),N=(0,eS.useTranslations)("imageStudio"),{prefs:A}=(0,RI.useChatDisplay)(),{settings:j}=(0,bR.useUserSettings)(),M=(0,bP.isPiiExtended)(j),O=j.voiceMode??"tap",D=j.hapticFeedback??((0,DB.isNativeApp)()||(0,O5.isMobileViewport)()),[R,P]=(0,e_.useState)(!1),[z,L]=(0,e_.useState)(!1),[F,U]=(0,e_.useState)(0),B=(0,e_.useCallback)(e=>{P(e),e&&L(!0)},[]),Z=(0,e_.useRef)(!1),q=(0,e_.useRef)(()=>{}),V=(0,e_.useRef)(new Set),[H,K]=(0,e_.useState)(void 0),W=function(e){let{onTranscribe:t,language:r,maxDuration:n=120}=e,[i,a]=(0,e_.useState)(!1),[o,s]=(0,e_.useState)(!1),[l,u]=(0,e_.useState)(!1),[c,d]=(0,e_.useState)(!1),[p,h]=(0,e_.useState)(null),[f,m]=(0,e_.useState)(0),[g,y]=(0,e_.useState)(()=>Array(9).fill(0)),[v,b]=(0,e_.useState)(!1),[x,k]=(0,e_.useState)(null),[w,_]=(0,e_.useState)("idle"),S=(0,e_.useRef)(null),E=(0,e_.useRef)([]),C=(0,e_.useRef)(null),$=(0,e_.useRef)(null),T=(0,e_.useRef)(null),I=(0,e_.useRef)(null),N=(0,e_.useRef)(null),A=(0,e_.useRef)(null),j=(0,e_.useRef)(!1),M=(0,e_.useRef)(()=>{}),[O,D]=(0,e_.useState)(!1);(0,e_.useEffect)(()=>{D(!!navigator.mediaDevices?.getUserMedia)},[]);let R=(0,e_.useCallback)(()=>h(null),[]),P=(0,e_.useCallback)(()=>{I.current&&(clearInterval(I.current),I.current=null),$.current&&($.current.close().catch(()=>{}),$.current=null),T.current=null,N.current=null,A.current=null,m(0),y(Array(9).fill(0))},[]),z=(0,e_.useCallback)(()=>{C.current&&(clearTimeout(C.current),C.current=null),S.current&&"inactive"!==S.current.state&&S.current.stop(),P()},[P]),L=(0,e_.useCallback)(async()=>{h(null),d(!1),a(!0),b(!1),k(null),j.current=!1,E.current=[];try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),i=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":"",o=new MediaRecorder(e,i?{mimeType:i}:void 0);S.current=o,o.ondataavailable=e=>{e.data.size>0&&E.current.push(e.data)},o.onstop=async()=>{e.getTracks().forEach(e=>e.stop()),s(!1),_("processing");let n=new Blob(E.current,{type:o.mimeType||"audio/webm"});if(0===n.size){h("No audio recorded"),_("idle");return}u(!0);try{let e=new FormData;e.append("audio",n,"recording.webm"),r&&e.append("language",r);let i=await fetch("/api/voice/transcribe",{method:"POST",body:e});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`HTTP ${i.status}`)}let a=await i.json();a.text?t(a.text,a.language):_("idle")}catch(e){h(e instanceof Error?e.message:"Transcription failed"),_("idle")}finally{u(!1)}},o.onerror=()=>{P(),e.getTracks().forEach(e=>e.stop()),s(!1),a(!1),_("idle"),h("Recording error")},o.start(),a(!1),s(!0),_("recording");{let t=new AudioContext;"suspended"===t.state&&await t.resume(),$.current=t;let r=t.createMediaStreamSource(e),n=t.createAnalyser();n.fftSize=2048,n.smoothingTimeConstant=.75,n.minDecibels=-80,n.maxDecibels=-10,r.connect(n),T.current=n;let i=new Uint8Array(n.fftSize),a=new Uint8Array(n.frequencyBinCount),o=t.sampleRate/n.fftSize,s=Math.max(1,Math.round(60/o)),l=Math.min(Math.round(6e3/o),n.frequencyBinCount);I.current=setInterval(()=>{n.getByteTimeDomainData(i);let e=0;for(let t=0;t<i.length;t++){let r=i[t]-128;e+=r*r}let t=Math.sqrt(e/i.length);if(m(t),t>5&&(b(!0),j.current=!0),t<3&&j.current){if(N.current||(N.current=Date.now()),Date.now()-N.current>=1e3){A.current||(A.current=Date.now());let e=Date.now()-A.current,t=Math.min(e/2e3,1);k(t),t>=1&&M.current()}}else t>=3&&(N.current=null,A.current&&(A.current=null,k(null)));n.getByteFrequencyData(a);let r=0;for(let e=s;e<l;e++)a[e]>r&&(r=a[e]);let o=r/255,u=Array(9);for(let e=0;e<9;e++)u[e]=Math.min(o*RN[e],1);y(u)},50)}C.current=setTimeout(()=>{z()},1e3*n)}catch(e){if(a(!1),e instanceof DOMException&&"NotAllowedError"===e.name)try{let e=await navigator.permissions.query({name:"microphone"});h("granted"===e.state?"mic-os-blocked":"mic-permission")}catch{h("mic-permission")}else h("mic-unavailable")}},[r,n,t,z,P]),F=(0,e_.useCallback)(async()=>
190{if(h(null),(0,DB.isNativeApp)())return void await L();try{let e=await navigator.permissions.query({name:"microphone"});if("granted"===e.state)return void await L();if("denied"===e.state)return void h("mic-blocked");d(!0)}catch{await L()}},[L]),U=(0,e_.useCallback)(async()=>{d(!1),await L()},[L]),B=(0,e_.useCallback)(()=>{d(!1)},[]);M.current=z;let Z=(0,e_.useCallback)(()=>_("idle"),[]);return(0,e_.useEffect)(()=>()=>{P()},[P]),{startRecording:F,confirmRecording:U,dismissPrompt:B,stopRecording:z,isSupported:O,isRequesting:i,isRecording:o,isTranscribing:l,showMicPrompt:c,error:p,clearError:R,audioLevel:f,frequencyBands:g,hasSpeechStarted:v,silenceCountdown:x,voicePhase:w,endProcessing:Z}}({onTranscribe:(0,e_.useCallback)((e,t)=>{V.current.add(e),q.current(e)},[]),language:H,autoStopOnSilence:"conversation"===O}),J=(0,e_.useRef)(W);J.current=W;let G=W.showMicPrompt||W.isRequesting||"idle"!==W.voicePhase,[X,Y]=(0,e_.useState)(v||""),[Q,ee]=(0,e_.useState)([]),[et,er]=(0,e_.useState)([]),en=et.some(e=>void 0!==e.status),[ei,ea]=(0,e_.useState)(null),[eo,es]=(0,e_.useState)(null),[el,eu]=(0,e_.useState)(null),{openFeedback:ec}=(0,RS.useFeedback)(),[ed,ep]=(0,e_.useState)(null),eh=(0,e_.useRef)(0),[ef,em]=(0,e_.useState)(null),[eg,ey]=(0,e_.useState)(()=>{let e=localStorage.getItem("gdprchat-auto-zen");return null!==e&&"true"===e}),ev=(0,e_.useCallback)(e=>{ey(e),localStorage.setItem("gdprchat-auto-zen",String(e)),e&&U(e=>e+1)},[]),eb=(0,e_.useRef)(o);eb.current=o;let ex=(0,e_.useRef)("regular");ex.current=E?"shortcut":g?"temporary":"regular";let ek=(0,e_.useRef)(null),e$=(0,e_.useRef)([]),eT=(0,e_.useRef)(d),eI=(0,e_.useRef)(o);(0,e_.useEffect)(()=>{let e=eI.current;eI.current=o,o!==Rw.TEMP_FOLDER_ID||e===Rw.TEMP_FOLDER_ID||(0,O5.isMobileViewport)()||requestAnimationFrame(()=>ek.current?.focus())},[o]);let eN=(0,e_.useRef)(0),eA=(0,e_.useRef)(()=>{}),ej=(0,e_.useRef)(null),[eM,eO]=(0,e_.useState)(!1),eD=(0,e_.useRef)(!1),eR=(0,e_.useRef)(0),eP=(0,e_.useRef)(!1),ez=(0,e_.useRef)(0),eL=(0,e_.useRef)(null),eF=(0,e_.useCallback)(()=>{ez.current=Date.now(),eL.current&&clearInterval(eL.current),eL.current=setInterval(()=>{ez.current=Date.now()},1e3)},[]),eU=(0,e_.useCallback)(()=>{if(eL.current&&(clearInterval(eL.current),eL.current=null),0===ez.current)return!1;let e=Date.now()-ez.current;return ez.current=0,e>5e3},[]);(0,e_.useEffect)(()=>{let e=()=>{"hidden"===document.visibilityState&&eF()};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e),eL.current&&clearInterval(eL.current)}},[eF]);let eB=(0,e_.useRef)(0),eZ=(0,e_.useRef)(!1),eq=(0,e_.useRef)(!1),[eV,eH]=(0,e_.useState)(!1),[eK,eW]=(0,e_.useState)(!1),eJ=(0,e_.useRef)(null),{isOnline:eG,wasOffline:eX,clearWasOffline:eY}=function(){let[e,t]=(0,e_.useState)("u"<typeof navigator||navigator.onLine),r=(0,e_.useRef)(!1),[n,i]=(0,e_.useState)(!1);return(0,e_.useEffect)(()=>{let e=()=>{t(!1),r.current=!0,i(!0)},n=()=>{t(!0)};return window.addEventListener("offline",e),window.addEventListener("online",n),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",n)}},[]),{isOnline:e,wasOffline:n,clearWasOffline:(0,e_.useCallback)(()=>{r.current=!1,i(!1)},[])}}(),[eQ,e0]=(0,e_.useState)(null),[e1,e2]=(0,e_.useState)(!1),e4=(0,e_.useRef)(!1),e5=(0,e_.useRef)(0),[e6,e3]=(0,e_.useState)(!1),[e9,e8]=(0,e_.useState)(null),{notice:e7,now:te,dismiss:tt}=function(){let[e,t]=(0,e_.useState)(null),[r,n]=(0,e_.useState)(()=>Date.now()),[i,a]=(0,e_.useState)(()=>(function(){try{let e=window.localStorage.getItem(RR);if(!e)return null;let t=JSON.parse(e);if("string"!=typeof t?.startsAt||"early"!==t.phase&&"soon"!==t.phase)return null;return{startsAt:t.startsAt,phase:t.phase}}catch{return null}})());(0,e_.useEffect)(()=>{let e=!1,r=async()=>{try{let r=await fetch("/api/health/load",{cache:"no-store"});if(!r.ok||e)return;let i=await r.json();if(e)return;t(i.maintenance??null),n(Date.now())}catch{}};r();let i=setInterval(r,6e5);return()=>{e=!0,clearInterval(i)}},[]);let o=null!=e;(0,e_.useEffect)(()=>{if(!o)return;let e=setInterval(()=>n(Date.now()),3e4);return()=>clearInterval(e)},[o]);let s=function(e,t){if(!e)return null;let r=Rd(e.startsAt),n=Rd(e.endsAt);if(null==r||null==n||n<=r||t>=r)return null;let i=Rd(e.noticeFrom)??r-864e5;return t<i?null:{startsAt:new Date(r).toISOString(),endsAt:new Date(n).toISOString(),noticeFrom:new Date(i).toISOString(),kind:"maintenance"===e.kind?"maintenance":"upgrade",phase:t<r-36e5?"early":"soon"}}(e,r),l=null!=s&&null!=i&&i.startsAt===s.startsAt&&i.phase===s.phase,u=(0,e_.useCallback)(()=>
190{if(!s)return;let e={startsAt:s.startsAt,phase:s.phase};a(e);try{window.localStorage.setItem(RR,JSON.stringify(e))}catch{}},[s]);return{notice:l?null:s,now:r,dismiss:u}}(),{waiting:tr}=(0,Ro.useForumUnread)(),tn=(0,e_.useMemo)(()=>p&&(0,RD.isForumEnabled)()?tr.find(e=>e.conversationId===p)?.postId??null:null,[tr,p]),ti=(0,e_.useRef)(p??null),ta=(0,e_.useRef)(new Map),to=(0,e_.useRef)(!1),ts=(0,e_.useRef)(!1),tl=(0,e_.useRef)(null),tu=(0,e_.useRef)(null),tc=(0,e_.useRef)(!1),td=(0,e_.useRef)(!!p),tp=(0,e_.useRef)(p),th=(0,e_.useRef)(new Set),tf=(0,e_.useRef)(t);(0,e_.useEffect)(()=>{let e=tf.current!==t;if(tf.current=t,tp.current===p&&!e)return;if(eO(!1),eD.current=!1,eR.current++,eW(!1),eH(!1),eJ.current=null,tI(),tc.current&&!e){console.log("[chat-diag] activeConversationId changed but justCreated=true, skipping stop()",{prev:tp.current,next:p,status:t$}),tp.current=p,td.current=!1;return}let r="streaming"===t$||"submitted"===t$;if(console.warn("[chat-diag] activeConversationId changed, calling stop()",{prev:tp.current,next:p,status:t$,wasStreaming:r,justCreated:tc.current}),r&&tp.current&&th.current.add(tp.current),tN(),tY.reset(),ea(null),J.current.endProcessing(),tm.current){clearTimeout(tm.current),tm.current=null;let e=ti.current;if(e){let t=ty.current||null;navigator.sendBeacon(`/api/conversations/${e}/draft`,JSON.stringify({draft:t}))}}tp.current=p,ti.current=p??null,tc.current=!1,ts.current=!1,tl.current=null,td.current=!!p,e$.current=[],tE([]),er([]),ee([]),ri(!1),ra.current=0,p?Y(v||""):Y(localStorage.getItem("gdprchat-new-chat-draft")||"")},[p,t]);let tm=(0,e_.useRef)(null),tg=(0,e_.useRef)(null),ty=(0,e_.useRef)(X);(0,e_.useEffect)(()=>{ty.current=X},[X]);let tv=(0,e_.useCallback)(e=>{let t=ti.current;t&&(tm.current&&clearTimeout(tm.current),tm.current=setTimeout(()=>{tg.current?.abort();let r=new AbortController;tg.current=r;let n=e||null;fetch(`/api/conversations/${t}/draft`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:n}),signal:r.signal}).catch(()=>{}),b?.(t,n)},1e3))},[b]),tb=(0,e_.useCallback)(()=>{tm.current&&clearTimeout(tm.current),tg.current?.abort();let e=ti.current;e&&(fetch(`/api/conversations/${e}/draft`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:null})}).catch(()=>{}),b?.(e,null)),localStorage.removeItem("gdprchat-new-chat-draft")},[b]),tx=(0,e_.useCallback)(e=>{Y(e),tv(e),ti.current||(e?(localStorage.setItem("gdprchat-new-chat-draft",e),tu.current?.()):localStorage.removeItem("gdprchat-new-chat-draft"))},[tv]);(0,e_.useEffect)(()=>{if(p||v)return;let e=new URLSearchParams(window.location.search).get("ask");if(e&&e.trim()){Y(e.trim().slice(0,2e3)),ek.current?.focus();let t=new URL(window.location.href);t.searchParams.delete("ask"),window.history.replaceState(null,"",t.toString());return}let t=localStorage.getItem("gdprchat-new-chat-draft");t&&Y(t)},[]),(0,e_.useEffect)(()=>()=>{if(tm.current){clearTimeout(tm.current);let e=ti.current,t=ty.current;e&&t&&navigator.sendBeacon(`/api/conversations/${e}/draft`,new Blob([JSON.stringify({draft:t})],{type:"application/json"}))}},[]);let tk=(0,e_.useCallback)(async()=>{if(ti.current)return;if(ts.current&&tl.current)return void await tl.current;ts.current=!0;let e=o&&o!==Rw.TEMP_FOLDER_ID?o:null,t=(async()=>{try{console.log("[chat] Creating conversation",{dbFolderId:e,currentFolderId:o});let t=await fetch("/api/conversations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:T("newChat"),folderId:e,piiFilterEnabled:d,ephemeral:"regular"!==ex.current})});if(t.ok){let e=await t.json();ti.current=e.id,tc.current=!0,console.log("[chat] Conversation created",{id:e.id,folderId:e.folderId}),h?.(e)}else{let e=await t.text().catch(()=>"");console.error("[chat] Failed to create conversation",{status:t.status,body:e}),eW(!0),Ow({source:"client",errorType:"ConversationCreationFailed",message:`HTTP ${t.status}: ${e.slice(0,500)}`,conversationId:null,metadata:{origin:"ensureConversation",httpStatus:t.status}})}}catch(t){let e=t instanceof Error?t:Error(String(t));console.error("[chat] Conversation creation error",t),eW(!0),Ow({s
190ource:"client",errorType:"ConversationCreationFailed",message:e.message,stackTrace:e.stack,conversationId:null,metadata:{origin:"ensureConversation.catch"}})}finally{ts.current=!1,tl.current=null}})();tl.current=t,await t},[o,d,h,T]);tu.current=tk;let tw=[2e3,5e3],t_=(e=0)=>{(0,O1.fetchCreditsJson)().then(e=>{e?.totalAvailable!==void 0&&es({totalAvailable:e.totalAvailable,dailyRemaining:e.dailyRemaining??0,monthlyRemaining:e.monthlyRemaining??0,addOnRemaining:e.addOnRemaining??0,plan:e.plan,nextTier:e.nextTier??null,subscriptionStatus:e.subscriptionStatus??null,source:e.source??null})}).catch(t=>{let r=tw[e];if(void 0!==r){console.warn(`[credits] Fetch error (retry in ${r}ms):`,t),setTimeout(()=>t_(e+1),r);return}console.warn("[credits] Fetch error (retries exhausted):",t),("u"<typeof navigator||!1!==navigator.onLine)&&Ow({source:"client",errorType:"CreditFetchFailed",message:t instanceof Error?t.message:String(t),stackTrace:t instanceof Error?t.stack:void 0,conversationId:ti.current,metadata:{origin:"fetchCredits",attempts:e+1}})})};(0,e_.useEffect)(()=>{p||requestAnimationFrame(()=>{(0,O5.isMobileViewport)()||ek.current?.focus()})},[p]),(0,e_.useEffect)(()=>{t_();let e=()=>{"visible"===document.visibilityState&&t_()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,e_.useEffect)(()=>{let e=()=>{eq.current=!0};return window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e),()=>{window.removeEventListener("pagehide",e),window.removeEventListener("beforeunload",e)}},[]);let{messages:tS,setMessages:tE,sendMessage:tC,status:t$,error:tT,clearError:tI,stop:tN}=function({experimental_throttle:e,resume:t=!1,...r}={}){let n=(0,e_.useRef)("chat"in r?{}:{onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen});"chat"in r||(n.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen});let i={...r,onToolCall:e=>{var t,r;return null==(r=(t=n.current).onToolCall)?void 0:r.call(t,e)},onData:e=>{var t,r;return null==(r=(t=n.current).onData)?void 0:r.call(t,e)},onFinish:e=>{var t,r;return null==(r=(t=n.current).onFinish)?void 0:r.call(t,e)},onError:e=>{var t,r;return null==(r=(t=n.current).onError)?void 0:r.call(t,e)},sendAutomaticallyWhen:e=>{var t,r,i;return null!=(i=null==(r=(t=n.current).sendAutomaticallyWhen)?void 0:r.call(t,e))&&i}},a=(0,e_.useRef)("chat"in r?r.chat:new yw(i));("chat"in r&&r.chat!==a.current||"id"in r&&a.current.id!==r.id)&&(a.current="chat"in r?r.chat:new yw(i));let o=(0,e_.useCallback)(t=>a.current["~registerMessagesCallback"](t,e),[e,a.current.id]),s=(0,e_.useSyncExternalStore)(o,()=>a.current.messages,()=>a.current.messages),l=(0,e_.useSyncExternalStore)(a.current["~registerStatusCallback"],()=>a.current.status,()=>a.current.status),u=(0,e_.useSyncExternalStore)(a.current["~registerErrorCallback"],()=>a.current.error,()=>a.current.error),c=(0,e_.useCallback)(e=>{"function"==typeof e&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,e_.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:s,setMessages:c,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:u,resumeStream:a.current.resumeStream,status:l,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}({transport:(0,e_.useMemo)(()=>new gO({api:"/api/chat",body:()=>({folderId:eb.current??null,chatKind:ex.current,documentIds:e$.current,conversationId:ti.current,platform:(0,DB.getNativePlatform)(),language:localStorage.getItem("gdprchat-language")||void 0,replyLanguage:localStorage.getItem("gdprchat-reply-language")||void 0,replyLanguageLocked:"true"===localStorage.getItem("gdprchat-reply-language-locked")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||void 0,locationConsent:localStorage.getItem("gdprchat-location-consent")||void 0,location:(()=>{try{let e=localStorage.getItem("gdprchat-location-cache");return e?JSON.parse(e):void 0}catch{return}})()}),prepareSendMessagesRequest:({messages:e,body:t,headers:r,credentials:n,api:i})=>{ti.current&&ta.current.set(ti.current,Date.now());let a=to.current;to.current=!1;let o=e.map(e=>{if("assistant"!==e.role||!Array.isArray(e.parts))return e;let t=!1,r=e.parts.map(e=>{if(e.output&&"object"==typeof e.output&&Array.isArray(e.output.images)&&e.output.images.some(e=>"string"==typeof e&&e.length>200))return t=!0,{...e,output:{...e.output,images:e.output.images.map(e=>"string"==typeof e&&e.length>200?"[image data stripped for transport]":e)}};if(e.output&&"object"==typeof e.output){let r=e.output;if("string"==typeof r.html&&r.html.length>5e3||"string"==typeof r.svg&&r.svg.length>5e3)return t=!0,{...e,output:{...r,..."string"==typeof r.html&&r.html.length>5e3?{html:"[HTML stripped for transport]"}:{},..."string"==typeof r.svg&&r.svg.length>5e3?{svg:"[SVG stripped for transport]"}:{}}}}return e});return t?{...e,parts:r}:e});return{body:{...t,messages:o,...a?{autoRetry:!0}:{}},headers:r,credentials:n,api:i}}}),[]),onError:e=>{if(/still-generating/.test(e.message??"")){tI();let e=ej.current;e&&(ej.current=null,clearTimeout(e.timer),ti.current===e.convId&&tE(e.snapshot)),setTimeout(()=>tR.current(),3e3);return}if("AI_UIMessageStreamError"===e.name&&/text-(end|delta) for missing text part/.test(e.message??"")){console.info("[chat] Suppressed length-truncation stream error â Continue chip will surface recovery"),e3(!0);let e=ti.current;e&&setTimeout(async()=>{try{let t=await fetch(`/api/conversations/${e}/messages`);if(!t.ok)return;let r=await t.json();if(!Array.isArray(r)||ti.current!==e)return;let n=r.map(e=>({id:e.id,role:e.role,parts:R0(e),metadata:e.metadata,createdAt:new Date(e.createdAt)}));if(tE(n),!td.current&&n.length>=2){let t=n.find(e=>"user"===e.role),r=n.find(e=>"assistant"===e.role);if(t&&r){let n=t.parts.filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>
190e.text).join(""),i=R2(r.parts);n.trim()&&i.trim()&&(td.current=!0,R4(e,n,i,t=>f?.(e,t)).then(e=>{e.ok||(td.current=!1)}))}}}catch{}},800);return}console.error("[chat] Error:",e.message||"(empty message)","| name:",e.name,"| stack:",e.stack?.split("\n")[0]);let t=function(e){if(!e)return null;if("RATE_LIMITED"===e)return{retryAfter:null};try{let t=JSON.parse(e);if("string"==typeof t?.error&&/rate limit/i.test(t.error))return{retryAfter:"number"==typeof t.retryAfter&&Number.isFinite(t.retryAfter)?t.retryAfter:null};return null}catch{}return/rate limit/i.test(e)?{retryAfter:null}:null}(e.message);if(t){console.info("[chat] Rate limited â retryAfter:",t.retryAfter),eu({retryAfter:t.retryAfter});return}if((0,RJ.isUserAbortError)(e)||eq.current)return void console.info("[chat] Stream error from user-initiated abort/unload â not reporting (not a bug)");if("hidden"===document.visibilityState)return void console.info("[chat] Stream error while page is hidden â deferring to recoverIfOrphaned");if(R1(e)&&"u">typeof navigator&&!1===navigator.onLine){console.info("[chat] Network error + navigator offline â entering connection recovery mode"),e2(!0),e4.current=!1,e0("offline");return}let r=tA.current,n=-1;for(let e=r.length-1;e>=0;e--)if("user"===r[e].role){n=e;break}let i=n>=0?r[n]:void 0,a=r.slice(n+1).some(e=>"assistant"===e.role&&e.parts?.some(e=>"text"===e.type&&OI(e.text??"").trim()||"string"==typeof e.type&&e.type.startsWith("tool-")));if(i&&!a&&eN.current<2){eN.current+=1,console.warn("[chat] Stream error before any content â auto-retrying",{attempt:eN.current,errName:e.name,convId:ti.current}),Ow({source:"client",errorType:"StreamErrorAutoRetry",message:e.message,stackTrace:e.stack,conversationId:ti.current,metadata:{origin:"useChat.onError",attempt:eN.current}}),eA.current(i.id,{auto:!0});return}a?tR.current({force:!0,onExhausted:t=>{Ow({source:"client",errorType:"StreamError",message:e.message,stackTrace:e.stack,conversationId:ti.current,metadata:{origin:"useChat.onError",hadPartialContent:!0,recovery:"exhausted",...t}}),tL()}}):(Ow({source:"client",errorType:"StreamError",message:e.message,stackTrace:e.stack,conversationId:ti.current,metadata:{origin:"useChat.onError",hadPartialContent:!1}}),tL())}}),tA=(0,e_.useRef)(tS);(0,e_.useEffect)(()=>{tA.current=tS},[tS]);let tj=(0,e_.useRef)(t$);(0,e_.useEffect)(()=>{tj.current=t$},[t$]);let tM=(0,e_.useRef)(t$);(0,e_.useEffect)(()=>{let e=tM.current,t="streaming"===e||"submitted"===e;"streaming"!==t$&&"submitted"!==t$||t?t&&"ready"===t$&&(eP.current=!1):eP.current=!0,tM.current=t$},[t$]),(0,e_.useEffect)(()=>{if("streaming"!==t$)return;let e=ej.current;e&&(ej.current=null,clearTimeout(e.timer),e.purge())},[t$]),(0,e_.useEffect)(()=>()=>{ej.current&&clearTimeout(ej.current.timer)},[]);let tO=(0,e_.useRef)(t$);(0,e_.useEffect)(()=>{let e=tO.current;if(tO.current=t$,"streaming"!==e||"ready"!==t$)return;let t=ti.current;if(!t)return;let r=()=>{let e=tA.current;for(let t=e.length-1;t>=0;t--)if("assistant"===e[t].role)return(e[t].parts??[]).filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("").length;return 0},n=r();if(0===n)return;let i=setTimeout(()=>{ti.current!==t||Date.now()-eB.current<15e3||tR.current({force:!0,onExhausted:()=>{}}).then(()=>{let e=r();e>n+50&&console.warn("[chat] Settle reconcile adopted a longer server answer",{beforeLen:n,afterLen:e,convId:t})})},4e3);return()=>clearTimeout(i)},[t$]);let tD=(0,e_.useCallback)(async e=>{let t=e?.force??!1;if(eD.current)return;let r=ti.current;if(!r)return;let n=e=>e.filter(e=>"assistant"!==e.role||(0,Oy.isUserStoppedAssistant)(e)||!OQ(e)&&!(0,Oy.isFetchOnlyAssistant)(e)),i=()=>{let e=n(tA.current);return 0!==e.length&&"user"===e[e.length-1].role};if(!t&&!i()||Date.now()-eB.current<3e3)return;eD.current=!0;let a=++eR.current,o=()=>eD.current&&eR.current===a;eO(!0);let s=e=>(e?.parts??[]).filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("").length,l=null,u=()=>ti.current!==r,c=async()=>{try{let e=await fetch(`/api/conversations/${r}/messages`);if(!e.ok)return"error";let i=await e.json();if(!Array.isArray(i))return"error";if(u())return"no-change";let a=i.map(e=>({id:e.id,role:e.role,parts:R0(e),metadata:e.metadata,createdAt:new Date(e.createdAt)}));{let e=a[a.length-1];if(e?.role==="assistant"&&!OQ(e)&&!(0,Oy.isFetchOnlyAssistant)(e)){let t=s(e);(null===l||t>l)&&(l=t)}}let o=!1;return tE(e=>{if(u()||"streaming"===tj.current||"submitted"===tj.current||n(a).length<n(e).length)return e;let r=a[a.length-1];if(r?.role==="assistant"&&!OQ(r)&&!(0,Oy.isFetchOnlyAssistant)(r)){if(t){let t=e=>(e?.parts??[]).filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("").length,n=[...e].reverse().find(e=>"assistant"===e.role);if(n&&t(n)>t(r))return e}return o=!0,a}return e}),o?"adopted":"no-change"}catch{return"error"}},d=async()=>{try{let e=await fetch(`/api/chat/active?conversationId=${r}`);if(!e.ok)return null;return!!(await e.json()).active}catch{return null}};try{let n=await d(),a=!1===n?5e4:18e4,p=Date.now(),h=0,f=n;for(;o()&&!u()&&Date.now()-p<a;){let e=await c();if(u())return;if("adopted"===e){t&&(U(e=>e+1),eP.current=!1),t_();return}if(!o())return;if(h++,!1!==f&&h%10==0){let e=await d();if(!1===e){f=!1;let e=Date.now();for(;Date.now()-e<5e4;){let e=await c();if(u()||!o())return;if("adopted"===e){t&&(U(e=>e+1),eP.current=!1),t_();return}await new Promise(e=>setTimeout(e,2e3))}break}}await new Promise(e=>setTimeout(e,2e3))}if(!o()||u())return;if(!i()){if(t){let t=[...tA.current].reverse().find(e=>"assistant"===e.role);e?.onExhausted?.({dbAssistantLen:l,localPartialLen:s(t),finalServerActive:f,pollAttempts:h,windowMs:a})}return}if(!1===f){let e=[...tA.current].reverse().find(e=>"user"===e.role);if(!e)return;let t=ta.current.get(r),n=void 0!==t&&Date.now()-t<6e5,a=e.createdAt,s=void 0!==a&&Date.now()-new Date(a).getTime()>2e5;if(!n&&!s||await d()!==!1||u()||!o()||!i())return;if(eZ.current)return void tz.current();eA.current(e.id,{auto:!0})}}finally{eR.current===a&&(eD.current=!1,eO(!1))}},[tE]),tR=(0,e_.useRef)(tD);(0,e_.useEffect)(()=>{tR.current=tD},[tD]);let tP=(0,e_.useCallback)(()=>{tE(e=>{let t=e[e.length-1];return t&&"user"===t.role?[...e,{id:`stopped-${t.id}`,role:"assistant",parts:[],metadata:{interrupted:"user-stop"}}]:e})},[tE]),tz=(0,e_.useRef)(tP);(0,e_.useEffect)(()=>{tz.current=tP},[tP]);let tL=(0,e_.useCallback)(()=>{tE(e=>{let t=[...e].reverse().findIndex(e=>"assistant"===e.role);if(t>=0){let r=e.length-1-t,n=e[r],i=n.metadata??{};if(i.truncated&&"service-error"===i.truncationReason)return e;let a=[...e];return a[r]={...n,metadata:{...i,truncated:!0,truncationReason:"service-error",truncationSignals:["client-onerror"]}},a}return[...e,{id:`service-error-${Date.now()}`,role:"assistant",parts:[{type:"data-response-truncated",data:{reason:"service-error",signals:["client-onerror-no-bubble"]}}],metadata:{truncated:!0,truncationReason:"service-error",truncationSignals:["client-onerror-no-bubble"]}}]})},[tE]),tF=(0,e_.useCallback)(()=>{tE(e=>{let t=[...e].reverse().findIndex(e=>"assistant"===e.role);if(t<0)return e;let r=e.length-1-t,n=e[r],i=n.metadata??{};if(!0===i.slowResponseOffer)return e;let a=[...e];return a[r]={...n,metadata:{...i,slowResponseOffer:!0}},a})},[tE]),tU=(0,e_.useCallback)(()=>{tE(e=>{let t=[...e].reverse().findIndex(e=>"assistant"===e.role);if(t<0)return e;let r=e.length-1-t,n=e[r],i=n.metadata??{};if(!i.slowResponseOffer)return e;let{slowResponseOffer:a,...o}=i,s=[...e];return s[r]={...n,metadata:o},s})},[tE]);(0,e_.useEffect)(()=>{tT?.message.includes("Unauthorized")&&(0,yS.signOut)({redirectTo:"/login?reason=session-expired"})},[tT]),(0,e_.useEffect)(()=>{ei&&tS.length>0&&"user"===tS[tS.length-1].role&&(ea(null),J.current.endProcessing())},[tS,ei]);let tB="submitted"===t$||"streaming"===t$,[tZ,tq]=(0,e_.useState)(p),[tV,tH]=(0,e_.useState)(!1);p!==tZ&&(tH(null==tZ&&null!=p),tq(p)),tS.length>0&&tV&&tH(!1);let tK=!!p&&0===tS.length&&!tV,tW=0===tS.length&&0===Q.length&&!tB&&!ei&&!tK,tJ=tS.some(e=>Array.isArray(e.parts)&&e.parts.some(e=>"data-credits-exhausted"===e.type)),tG=(0,e_.useCallback)(e=>{Y(e),requestAnimationFrame(()=>ek.current?.focus())},[]),tX=(0,e_.useRef)(t$);(0,e_.useEffect)(()=>{t$!==tX.current&&(console.log("[useChat] status:",tX.current,"â",t$,tT?`error: ${tT.message}`:""),tX.current=t$)},[t$,tT]);let tY=function(e){let{sendMessage:t,status:r,stop:n,conversationIdRef:i,onAbandon:a}=e,[o,s]=(0,e_.useReducer)(RA,Rj),l=(0,e_.useRef)(o.phase),u=(0,e_.useRef)(t),c=(0,e_.useRef)(a);(0,e_.useEffect)(()=>{l.current=o.phase,u.current=t,c.current=a});let d=(0,e_.useCallback)(()=>{let e=i?.current;e&&fetch("/api/chat/abort",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:e}),keepalive:!0}
190).catch(()=>{}),n()},[n,i]),p=(0,e_.useCallback)(async(e=!1)=>{let t=i?.current;if(t)try{await Promise.race([fetch("/api/chat/abort",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:t,replacesTurn:e}),keepalive:!0}),new Promise(e=>setTimeout(e,1500))])}catch{}n()},[n,i]);(0,e_.useEffect)(()=>{let e="submitted"===r||"streaming"===r,t="ready"===r||"error"===r;"sending"===o.phase&&e?s({type:"STREAM_STARTED"}):"streaming"===o.phase&&"ready"===r?s({type:"STREAM_ENDED"}):"streaming"===o.phase&&"error"===r?s({type:"STREAM_ERROR"}):"stopping"===o.phase&&t&&(o.queue?s({type:"SETTLED"}):s({type:"SETTLED_EMPTY"}))},[r,o.phase,o.queue]);let h=(0,e_.useRef)("idle");(0,e_.useEffect)(()=>{o.phase!==h.current&&console.log("[gate]",h.current,"â",o.phase,o.queue?`(queued: ${o.queue.text.slice(0,30)})`:""),"sending"===o.phase&&"sending"!==h.current&&o.queue&&u.current({text:o.queue.text},{body:o.queue.body??{}}),h.current=o.phase},[o.phase,o.queue]);let f=(0,e_.useRef)(!1);return(0,e_.useEffect)(()=>{if("streaming"===o.phase&&(f.current=!1),"sending"!==o.phase)return;let e=setTimeout(()=>s({type:"SEND_STUCK"}),8e3);return()=>clearTimeout(e)},[o.phase]),(0,e_.useEffect)(()=>{if("idle"===o.phase&&o.queue){if(f.current){c.current?.(o.queue.text),s({type:"RESET"});return}f.current=!0,s({type:"SEND_DIRECT",queue:o.queue})}},[o.phase,o.queue]),{send:(0,e_.useCallback)((e,t)=>{var r;if(t?.validate&&!t.validate())return;let n={text:e,body:t?.body},i="streaming"===(r=l.current)||"stopping"===r?"interrupt":"preparing"===r||"sending"===r?"queue":"start";if("interrupt"===i){s({type:"INTERRUPT",queue:n}),p(n.body?.replacesTurn===!0);return}"queue"===i?s({type:"PREPARE",queue:n}):t?.prepare?(s({type:"PREPARE",queue:n}),t.prepare().then(e=>{s(e?{type:"PREPARED"}:{type:"BLOCKED"})},()=>{s({type:"BLOCKED"})})):s({type:"SEND_DIRECT",queue:n})},[p]),stop:(0,e_.useCallback)(()=>{let e=l.current;"streaming"===e?(d(),s({type:"STOP"})):"stopping"===e&&d()},[d]),reset:(0,e_.useCallback)(()=>{f.current=!1,s({type:"RESET"})},[]),phase:o.phase,canSend:"idle"===o.phase,canInterrupt:"streaming"===o.phase||"stopping"===o.phase,isActive:"sending"===o.phase||"streaming"===o.phase||"stopping"===o.phase,queuedMessage:o.queue?.text||null}}({sendMessage:tC,status:t$,stop:tN,conversationIdRef:ti,onAbandon:(0,e_.useCallback)(e=>{ea(null),J.current.endProcessing(),Y(t=>t.trim()?t:e)},[])}),tQ=(0,e_.useCallback)(()=>{eB.current=Date.now(),eZ.current=!0,tY.stop()},[tY]),t0=(0,e_.useCallback)(()=>Date.now()-eB.current<1e4,[]);!function({status:e,messages:t,enabled:r}){var n;let i=(0,e_.useRef)(0),a=(0,e_.useRef)(0),o=(0,e_.useRef)(e),s=(0,e_.useRef)(void 0),l=(0,e_.useRef)(void 0),u=function(e){for(let t=e.length-1;t>=0;t--)if("assistant"===e[t].role)return e[t]}(t),c=function(e){if(!e?.parts)return 0;let t="";for(let r of e.parts)"text"===r.type&&r.text&&(t+=r.text);return t?t.trim().split(/\s+/).length:0}(u),d=(n=u,!!n?.parts&&n.parts.some(e=>"string"==typeof e.type&&e.type.startsWith("tool-")&&"input-available"===e.state));(0,e_.useEffect)(()=>()=>{clearTimeout(s.current),clearInterval(l.current)},[]),(0,e_.useEffect)(()=>{if(!r||!d){clearInterval(l.current),l.current=void 0;return}l.current||((0,RM.hapticTick)(),(0,RO.haptic)("tick"),l.current=setInterval(()=>{(0,RM.hapticTick)(),(0,RO.haptic)("tick")},500))},[r,d]),(0,e_.useEffect)(()=>{if(!r)return;let t="streaming"===o.current||"submitted"===o.current;if(t&&"ready"===e){clearTimeout(s.current),s.current=setTimeout(()=>{(0,RM.hapticSuccess)(),(0,RO.haptic)("success")},200),i.current=0,a.current=0,o.current=e;return}if(t&&"error"===e&&((0,RO.haptic)("warning"),i.current=0,a.current=0),o.current=e,"streaming"!==e){i.current=0;return}let n=c-i.current,l=Date.now();if(n>0&&l-a.current>=40){let e=Math.min(n,3);for(let t=0;t<e;t++)(0,RM.hapticTick)(),(0,RO.haptic)("tick");a.current=l,i.current=c}},[e,c,r])}({status:t$,messages:tS,enabled:D&&!R}),(0,e_.useEffect)(()=>{"submitted"===t$&&(L(!1),eZ.current=!1)},[t$]),(0,e_.useEffect)(()=>{!Z.current||W.hasSpeechStarted&&("streaming"===t$||"submitted"===t$)&&tY.stop()},[W.hasSpeechStarted]);let t1=(0,e_.useCallback)(()=>{Z.current=!0,W.startRecording()},[W]),t2=(0,e_.useCallback)(()=>{Z.current=!1,W.stopRecording()},[W]);(0,e_.useEffect)(()=>{let t,r=e=>{let t=eP.current,r="streaming"===t$||"submitted"===t$;e&&r&&tN(),tR.current(t&&(e||!r)?{force:!0}:void 0)},n=()=>
190{"hidden"!==document.visibilityState&&r(eU())},i=()=>r(!1);document.addEventListener("visibilitychange",n),window.addEventListener("focus",i);let a=!1;return e.A(746046).then(({App:e})=>e.addListener("appStateChange",e=>{e.isActive&&r((0,DB.isNativeApp)())})).then(e=>{a?e.remove():t=e}).catch(()=>{}),()=>{a=!0,document.removeEventListener("visibilitychange",n),window.removeEventListener("focus",i),t?.remove()}},[t$,tN,eU]),(0,e_.useEffect)(()=>{if("submitted"!==t$&&"streaming"!==t$)return;let e=setTimeout(()=>{let e=[...tS].reverse().find(e=>"assistant"===e.role);e?.parts?.some(e=>"text"===e.type&&e.text?.trim()||"string"==typeof e.type&&e.type.startsWith("tool-"))||(console.info("[chat] 30s no-content â surfacing slow-response offer (stream continues)"),tF())},3e4);return()=>clearTimeout(e)},[t$,tS,tF]);let t4=(0,e_.useRef)(0),t5=(0,e_.useRef)("");(0,e_.useEffect)(()=>{if("submitted"===t$){t4.current=0,t5.current="";return}if("streaming"!==t$)return;let e=tS[tS.length-1];if(!e||"assistant"!==e.role)return;let t=e.parts??[],r=t.filter(e=>e?.type==="text"&&"string"==typeof e?.text).reduce((e,t)=>e+t.text.length,0),n=t.filter(e=>"string"==typeof e?.type&&e.type.startsWith("tool-")).length,i=t.filter(e=>e?.type==="data-codeStream").length,a=`${r}-${n}-${i}`;a!==t5.current&&(r>0||n>0||i>0)&&(t5.current=a,t4.current=Date.now())},[tS,t$]),(0,e_.useEffect)(()=>{if("streaming"!==t$)return;let e=setInterval(()=>{0===t4.current||!R6(tA.current)&&Date.now()-t4.current>25e3&&(console.info("[chat] mid-stream silence >25s â surfacing slow-response offer"),tF())},5e3);return()=>clearInterval(e)},[t$,tF]),(0,e_.useEffect)(()=>{let e=[...tS].reverse().find(e=>"assistant"===e.role);if(!e?.metadata?.slowResponseOffer)return;if("submitted"!==t$&&"streaming"!==t$)return void tU();let t=t4.current;t>0&&Date.now()-t<5e3&&tU()},[tS,t$,tU]),(0,e_.useEffect)(()=>{if("submitted"!==t$&&"streaming"!==t$)return;let e=setTimeout(()=>{let e=[...tS].reverse().find(e=>"assistant"===e.role);e?.parts?.some(e=>"text"===e.type&&e.text?.trim()||"string"==typeof e.type&&e.type.startsWith("tool-"))||(console.warn("[chat] Stream stall detected â no content after 90s, stopping"),tN(),tL(),Ow({source:"client",errorType:"StreamStall",message:"Stream produced no visible content for 90 seconds",conversationId:ti.current,metadata:{origin:"stallDetection",status:t$,messageCount:tS.length}}))},9e4);return()=>clearTimeout(e)},[t$,tS,tN,tL]),(0,e_.useEffect)(()=>{"streaming"===t$&&(e5.current=Date.now()),"streaming"!==t$&&"stalled"===eQ&&e0(null)},[t$,eQ]),(0,e_.useEffect)(()=>{"streaming"===t$&&(e5.current=Date.now())},[tS,t$]),(0,e_.useEffect)(()=>{if("streaming"!==t$)return;let e=setInterval(()=>{let e=Date.now()-e5.current;if(e<5e4||R6(tS))return;let t=[...tS].reverse().find(e=>"assistant"===e.role);t?.parts?.some(e=>"text"===e.type&&e.text?.trim().length>10)&&(console.warn("[chat] Mid-stream stall detected â no tokens for 50s after partial content, stopping"),tN(),e0("stalled"),tR.current({force:!0,onExhausted:()=>tL()}),Ow({source:"client",errorType:"MidStreamStall",message:`No tokens for ${Math.round(e/1e3)}s after partial content`,conversationId:ti.current,metadata:{origin:"midStreamStallDetection",silenceMs:e}}))},5e3);return()=>clearInterval(e)},[t$,tS,tN,tL]),(0,e_.useEffect)(()=>{!eG&&("streaming"===t$||"submitted"===t$||e1)?e0("offline"):eG&&"offline"===eQ&&e0("reconnecting")},[eG]),(0,e_.useEffect)(()=>{if(!eG||!eX||!e1||e4.current)return;e4.current=!0,e0("reconnecting"),tI();let e=ti.current,t=[...tS].reverse().find(e=>"user"===e.role);e&&t?tR.current():t&&eA.current(t.id,{auto:!0}),setTimeout(()=>{e0(null),e2(!1),eY()},2e3)},[eG,eX,e1]),(0,e_.useEffect)(()=>{if("stalled"===eQ){let e=setTimeout(()=>e0(null),3e4);return()=>clearTimeout(e)}},[eQ]);let t6=(0,eS.useTranslations)("errors"),{locale:t3,updateFromMessages:t9,votedLocale:t8}=(0,OJ.useLocale)();(0,e_.useEffect)(()=>{t9(tS,V.current)},[tS,t9]),(0,e_.useEffect)(()=>{K(t3??void 0)},[t3]);let t7=(0,e_.useCallback)(e=>{let t,r=-1;if(e)r=tS.findIndex(t=>t.id===e);else for(let e=tS.length-1;e>=0;e--)if("assistant"===tS[e].role){r=e;break}if(r<0)return null;let n=tS[r],i=e=>e?e.parts.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"):"",a=i(n),o=a.length>1e5?a.slice(0,1e5)+"\nâ¦[truncated]":a,s=[],l=/\[[^\]]+\]\(([^)]*)\)/g;for(;null!==(t=l.exec(a))&&(s.push(t[1]),!(s.length>=200)););let u="";for(let e=r-1;e>=0;e--)if("user"===tS[e].role){u=i(tS[e]).slice(0,1e5);break}let c=[],d=!1;for(let e of n.parts)e.type.startsWith("tool-")&&c.push(e.toolName??e.type.replace("tool-","")),"output-error"===e.state&&(d=!0);return{messageId:n.id,conversationId:ti.current??null,userQuery:u,aiResponse:o,toolsUsed:c,hasErrors:d,aiResponseLinks:s}},[tS]),re=(0,e_.useCallback)(()=>t7(),[t7]),rt=(0,e_.useCallback)(e=>{ec({surface:"chat",sourceKind:"thumbs_down",message:t7(e)??void 0})}
190,[ec,t7]),rr=(0,e_.useCallback)(e=>{tY.stop(),tY.send(`[SYSTEM: The ${e} tool took too long and was stopped. Please let the user know something went wrong, apologize briefly, and suggest they try again. Respond in the user's language.]`)},[tY]);(0,e_.useEffect)(()=>{if("ready"!==t$||!tS.length)return;let e=[...tS].reverse().find(e=>"assistant"===e.role);if(!e)return;let t=e.parts.find(e=>"data-rate-limited"===e.type);if(t){let e=t.data;eu(t=>t?.retryAfter===e.retryAfter?t:{retryAfter:e.retryAfter})}},[t$,tS]),(0,e_.useEffect)(()=>{e6&&tT&&tI()},[e6,tT,tI]);let[rn,ri]=(0,e_.useState)(!1),ra=(0,e_.useRef)(0);(0,e_.useEffect)(()=>{if("ready"!==t$||!tS.length)return;let e=[...tS].reverse().find(e=>"assistant"===e.role);if(!e)return;if((e.parts??[]).find(e=>"data-drift"===e.type)){let e=tS.filter(e=>"user"===e.role).length,t=ti.current;if(t&&!rn){let r=tS.reduce((e,t)=>e+(t.parts??[]).reduce((e,t)=>e+("string"==typeof t?.text?t.text.length:0),0),0),n=e-ra.current>=2;if(e>=2&&(e>=4||r>=8e3)&&n){ra.current=e,fetch(`/api/conversations/${t}/drift-nudge`,{method:"POST"}).then(e=>e.ok?e.json():null).then(e=>{e?.topicChanged===!0&&ri(!0)}).catch(()=>{});return}}}let t=ti.current;t&&fetch(`/api/conversations/${t}`).then(e=>e.ok?e.json():null).then(e=>{e?.metadata?.driftNudgePending===!0&&ri(!0)}).catch(()=>{})},[t$,tS]);let ro=(0,e_.useRef)(null),rs=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{let e=[...tS].reverse().find(e=>"assistant"===e.role);rs.current=e?.id??null},[tS]);let rl=(0,e_.useRef)(null),ru=(0,e_.useRef)(!1),rc=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{if("ready"!==t$)return;let e=ti.current;if(!e)return;let t=[...tS].reverse().find(e=>"assistant"===e.role);if(!t||ro.current===t.id)return;ro.current=t.id;let r=t8??t3;if(!1!==j.tailoringSuggestions&&eb.current!==Rw.TEMP_FOLDER_ID&&eb.current){if(rl.current){let n=rl.current;rl.current=null;let i=rs.current??t.id;bp(i,n),fetch(`/api/conversations/${e}/tailoring-offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageId:i,locale:r,commit:!0})}).catch(()=>{});return}ru.current||fetch(`/api/conversations/${e}/tailoring-offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageId:t.id,locale:r})}).then(e=>e.ok?e.json():null).then(e=>{e?.offer&&bp(rs.current??t.id,e.offer)}).catch(()=>{})}},[t$,tS]),(0,e_.useEffect)(()=>{if("streaming"!==t$||!1===j.tailoringSuggestions||eb.current===Rw.TEMP_FOLDER_ID||!eb.current)return;let e=ti.current;if(!e)return;let t=[...tS].reverse().find(e=>"user"===e.role);t&&rc.current!==t.id&&(rc.current=t.id,rl.current=null,ru.current=!1,fetch(`/api/conversations/${e}/tailoring-offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:t8??t3,prepare:!0})}).then(e=>e.ok?e.json():null).then(e=>{e?.offer?(rl.current=e.offer,ru.current=!0):e?.reason&&"no_user_message"!==e.reason&&(ru.current=!0)}).catch(()=>{}))},[t$,tS]);let rd=(0,e_.useCallback)(()=>{ri(!1);let e=ti.current;e&&fetch(`/api/conversations/${e}/drift-nudge`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pending:!1})}).catch(()=>{})},[]),rp=(0,e_.useCallback)(async e=>{if(!E)try{let t=await fetch(`/api/conversations/${e}`);if(!t.ok)return;let r=await t.json();if(ti.current!==e||!r?.pendingExpiresAt)return;let n=Array.isArray(r.documents)?r.documents:[];if(n.length>0){let e=n.map(e=>({id:crypto.randomUUID(),docId:e.id,name:e.originalFilename??"file",previewUrl:"string"==typeof e.mimeType&&e.mimeType.startsWith("image/")?`/api/conversation-documents/${e.id}/download`:void 0}));er(e),e$.current=[...e$.current,...e.map(e=>e.docId)]}tH(!0),"string"==typeof r.draft&&r.draft.length>0&&!ty.current&&Y(r.draft)}catch{}},[E]);(0,e_.useEffect)(()=>{if(!p)return;if(tc.current){tc.current=!1;return}let e=(e,t)=>fetch(`/api/conversations/${e}/messages`).then(r=>r.ok?r.json():(console.error("[chat] Failed to load messages",{status:r.status,origin:t}),Ow({source:"client",errorType:"MessageLoadFailed",message:`HTTP ${r.status} loading messages`,conversationId:e,metadata:{origin:t,httpStatus:r.status}}),[])).then(r=>{if(ti.current!==e)return;if(console.log("[chat] Loaded messages",{count:Array.isArray(r)?r.length:0,origin:t}),!Array.isArray(r)||0===r.length){"loadMessages"===t&&rp(e);return}let n=r.map(e=>({id:e.id,role:e.role,parts:R0(e),createdAt:new Date(e.createdAt),...e.metadata?{metadata:e.metadata}:{}}));tE(n);let i=n[n.length-1];i&&"user"===i.role&&queueMicrotask(()=>tR.current())}).catch(r=>{console.error("[chat] Error loading messages",r),Ow({source:"client",errorType:"MessageLoadFailed",message:r instanceof Error?r.message:String(r),stackTrace:r instanceof Error?r.stack:void 0,conversationId:e,metadata:{origin:`${t}.catch`}})});console.log("[chat] Loading messages for conversation",p),e(p,"loadMessages");let t=null;return th.current.has(p)&&(th.current.delete(p),t=setTimeout(()=>{console.log("[chat] Delayed re-fetch after aborted stream",p),e(p,"loadMessages.delayedRefetch")},2e3)),()=>{t&&clearTimeout(t)}}
190,[p]);let rh=(0,e_.useCallback)(async(e,t)=>{},[]),rf=(0,e_.useRef)(t$);(0,e_.useEffect)(()=>{let e="streaming"===rf.current&&"ready"===t$,t="submitted"===rf.current&&"ready"===t$;if(rf.current!==t$&&console.log("[chat-diag] status transition",{from:rf.current,to:t$,msgCount:tS.length,convId:ti.current}),e||t||0){if(e||t){var r;let e,n,i,a,o=-1===(e=tS.findLastIndex(e=>"user"===e.role))?[]:tS.slice(e+1).filter(e=>"assistant"===e.role),s=o[o.length-1],l=new Set(["generateImage","generateArtifact","createDocuments","runPython","copyableText"]),u=o.some(e=>e.parts.some(e=>{if("text"===e.type&&OI(e.text??"").trim())return!0;if("string"==typeof e.type&&e.type.startsWith("tool-")){let t=e.state??e.toolInvocation?.state;if("input-streaming"===t||"input-available"===t)return!0;let r=e.toolName??e.toolInvocation?.toolName??e.type.slice(5);if(r&&l.has(r))return!0;let n=e.output??e.toolInvocation?.result;if("output-available"===t&&r&&(0,Om.resolveZenToolName)(r,n))return!0}return!!(gb(e)&&new Set(["data-credits-exhausted","data-rate-limited","data-response-truncated"]).has(e.type))||!1}));if(s?!u:t){let e=[...tS].reverse().find(e=>"user"===e.role);if(t0())eN.current=0;else if(e&&eN.current<2){eN.current+=1,console.warn("[chat] Empty AI response â asking the server what it already has",{retryCount:eN.current,convId:ti.current,transition:t?"submittedâready":"streamingâready",hadAssistantMsg:!!s}),tR.current({force:!0,onExhausted:()=>{eA.current(e.id,{auto:!0})}}),rf.current=t$;return}if(eN.current>=2){if(console.error("[chat] Empty AI response after auto-retry, giving up"),eN.current=0,!s?.parts.some(e=>"string"==typeof e.type&&e.type.startsWith("tool-")&&"output-available"===e.state)){let e=tS.findLastIndex(e=>"assistant"===e.role);-1!==e&&tE(tS.slice(0,e))}eH(!0),Ow({source:"client",errorType:"EmptyAIResponseFinal",message:"AI produced empty response after auto-retry â removed empty bubble",conversationId:ti.current,metadata:{origin:"autoRetryExhausted"}})}}else eN.current=0,window.dispatchEvent(new CustomEvent("gdprchat:assistant-message-completed"));t_(),r=ti.current,n=tS.findLastIndex(e=>"user"===e.role),i=tS.findLastIndex(e=>"assistant"===e.role),a=[],n>=0&&a.push(tS[n]),i>=0&&a.push(tS[i]),0===a.length||fetch("/api/god/debug/client-capture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:r,messages:a.map(e=>{let t=(e.parts??[]).filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),r=(e.parts??[]).filter(e=>"string"==typeof e.type&&e.type.startsWith("tool-")).map(e=>{let t=e.type.replace(/^tool-/,""),r=e.state??"unknown",n="";return"output-available"===e.state&&null!=e.output?n="string"==typeof e.output?e.output.slice(0,2e3):JSON.stringify(e.output,null,2)?.slice(0,2e3)??"":"output-error"===e.state&&(n="Error (tool failed)"),{toolName:t,status:r,resultSummary:n}}),n=(e.parts??[]).filter(e=>"string"==typeof e.type&&e.type.startsWith("data-")).map(e=>e.type);return{role:e.role,text:t,...r.length?{toolCalls:r}:{},...n.length?{dataParts:n}:{}}})})}).catch(()=>{})}if((e||t)&&ti.current&&fetch(`/api/conversations/${ti.current}/messages`).then(e=>e.ok?e.json():null).then(e=>{Array.isArray(e)&&0!==e.length&&tE(t=>t.map((t,r)=>{let n=e[r];return n&&n.role===t.role?{...t,...n.id!==t.id?{id:n.id}:{},createdAt:new Date(n.createdAt),metadata:n.metadata}:t}))}).catch(()=>{}),e||t){let e=ti.current;if(console.log("[chat] Stream complete",{convId:e,hasGeneratedTitle:td.current,messageCount:tS.length,messageRoles:tS.map(e=>e.role)}),e&&!td.current){let t=tS.find(e=>"user"===e.role),r=[...tS].reverse().find(e=>"assistant"===e.role&&""!==R2(e.parts));if(console.log("[chat] Title generation check",{hasUser:!!t,hasAssistant:!!r,userParts:t?.parts?.length,asstParts:r?.parts?.length}),t&&r){let n=t.parts.filter(e=>"text"===e.type).map(e=>e.text).join(""),i=R2(r.parts);if(!n.trim()||!i.trim())return void console.log("[chat] Skipping title generation â empty text",{convId:e,userTextLen:n.length,asstTextLen:i.length});td.current=!0,console.log("[chat] Generating title",{convId:e,userTextLen:n.length,asstTextLen:i.length}),R4(e,n.slice(0,500),i.slice(0,500),t=>f?.(e,t)).then(t=>{if(!t.ok){if(td.current=!1,t.status)console.error("[chat] Title generation failed",{status:t.status}),Ow({source:"client",errorType:"TitleGenerationFailed",message:`HTTP ${t.status} generating title`,conversationId:e,metadata:{origin:"generateTitle",httpStatus:t.status}});else{let r=t.error;console.error("[chat] Title generation error",r),Ow({source:"client",errorType:"TitleGenerationFailed",message:r instanceof Error?r.message:String(r),stackTrace:r instanceof Error?r.stack:void 0,conversationId:e,metadata:{origin:"generateTitle.catch"}})}return}console.log("[chat] Title generated",{title:t.title}),t.title&&f?.(e,t.title)})}}}}rf.current=t$},[t$,tS,rh]),(0,e_.useEffect)(()=>{let e="streaming"===rf.current||"submitted"===rf.current,t="error"===t$||"ready"===t$&&!!tT;
190("stalled"===eQ&&"ready"===t$||e&&t)&&ti.current&&tR.current()},[t$,tT,eQ]),(0,e_.useEffect)(()=>{let e=eT.current;if(eT.current=d,e&&!d&&Q.length>0){let e=Q.filter(e=>!e.fileUpload),t=Q.filter(e=>e.fileUpload);for(let e of(ee([]),t))fetch(`/api/conversation-documents/${e.fileUpload.documentId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({piiBlocked:!1})}).catch(()=>{}),er(t=>[...t,{name:e.fileUpload.filename,id:crypto.randomUUID(),docId:e.fileUpload.documentId}]);if(e.length>0){let t=e[e.length-1];tY.send(t.text)}}},[d]),(0,e_.useEffect)(()=>{0===Q.length||!Q.some(e=>!e.fileUpload)||X.trim().length>0&&Rk(X,{extended:M}).hasPii||ee(e=>{let t=e.filter(e=>e.fileUpload||!e.inComposer);return t.length===e.length?e:t})},[X,Q,M]);let rm=(0,e_.useCallback)(e=>{if(!d||!e.trim())return!0;let t=Rk(e,{extended:M});if(!t.hasPii)return!0;let r=!X.trim()||X===e;return ee(n=>[...n,{id:crypto.randomUUID(),text:e,entities:t.entities,timestamp:Date.now(),inComposer:r}]),r&&Y(e),!1},[d,M,X]),rg=async e=>{if(et.length>=25)return void alert("Maximum 25 files can be attached at once");let t=crypto.randomUUID(),r=e.type.startsWith("image/");if(!r&&e.size>0x1900000)return void alert(t6("application/pdf"===e.type||/\.pdf$/i.test(e.name)?"fileTooLargePdf":"fileTooLarge",{max:25}));let n=d?"scanning":"uploading",i=r?URL.createObjectURL(e):void 0;er(r=>[...r,{name:e.name,id:t,previewUrl:i,status:(0,RG.willDownscale)(e)?"optimising":n}]);let a=()=>{i&&URL.revokeObjectURL(i),er(e=>e.filter(e=>e.id!==t))},o=e;try{if(r){let r=await (0,RG.downscaleImage)(e);if(r.didShrink){o=r.file;let e=URL.createObjectURL(r.file);i&&URL.revokeObjectURL(i),i=e;let n=`${R5(r.originalSize)} â ${R5(r.newSize)}`;er(r=>r.map(r=>r.id===t?{...r,previewUrl:e,statusDetail:n}:r))}er(e=>e.map(e=>e.id===t?{...e,status:n}:e))}let s=new FormData;s.append("file",o),s.append("piiLockEnabled",String(d)),s.append("piiExtended",String(M));let l=await fetch("/api/conversation-documents/upload",{method:"POST",body:s});if(!l.ok){let e=await l.json().catch(()=>({})),t={legacy_excel:"fileLegacyExcel",legacy_word:"fileLegacyWord",content_mismatch:"fileDamaged",unsupported_type:"fileUnsupported"}[e.reason]??null;alert(t?t6(t):e.error||"Failed to upload file"),a(),Ow({source:"client",errorType:"FileUploadFailed",message:`HTTP ${l.status}: ${e.detail||e.error||"Failed to upload file"}`,conversationId:ti.current,metadata:{origin:"handleFileSelect",httpStatus:l.status,fileName:o.name,fileType:o.type,fileSize:o.size,serverDetail:e.detail}});return}let u=await l.json();if(u.archive){a();let e=u.files||[],t=[];for(let r of e)r.piiBlocked?ee(e=>[...e,{id:crypto.randomUUID(),text:`[Uploaded file "${r.filename}" blocked â PII detected: ${r.piiEntities?.join(", ")}]`,entities:(r.piiEntities||[]).map(e=>({entity_type:e,text:"[in document]",start:0,end:0,score:1})),timestamp:Date.now(),fileUpload:{documentId:r.id,filename:r.filename}}]):t.push({name:r.filename,id:crypto.randomUUID(),docId:r.id});t.length>0&&er(e=>[...e,...t].slice(0,25));return}if(u.piiBlocked){a(),ee(e=>[...e,{id:crypto.randomUUID(),text:`[Uploaded file "${u.filename}" blocked â PII detected: ${u.piiEntities?.join(", ")}]`,entities:(u.piiEntities||[]).map(e=>({entity_type:e,text:"[in document]",start:0,end:0,score:1})),timestamp:Date.now(),fileUpload:{documentId:u.id,filename:u.filename}}]);return}er(e=>e.map(e=>e.id===t?{...e,name:u.filename,docId:u.id,status:void 0,statusDetail:void 0}:e))}catch(e){a(),alert("Failed to upload file"),Ow({source:"client",errorType:"FileUploadFailed",message:e instanceof Error?e.message:"Failed to upload file",stackTrace:e instanceof Error?e.stack:void 0,conversationId:ti.current,metadata:{origin:"handleFileSelect.catch",fileName:o.name,fileType:o.type,fileSize:o.size}})}},ry=e=>{e.trim()?(ea(e.trim()),tY.send(e,{validate:()=>!!rm(e)||(ea(null),J.current.endProcessing(),!1),prepare:async()=>(await tk(),ti.current)?(eN.current=0,eO(!1),eH(!1),eW(!1),eJ.current=null,tI(),!0):(eJ.current=e.trim(),ea(null),J.current.endProcessing(),!1)})):J.current.endProcessing()};q.current=e=>{let t=function(e,t,r){let n=r.trim();if("conversation"===e)return{action:"send",text:r};if(!n)return{action:"discard"};let i=t.replace(/\s+$/,"");return{action:"compose",draft:i?`${i} ${n}`:n}}(O,X,e);"send"===t.action?ry(t.text):("compose"===t.action&&(tx(t.draft),requestAnimationFrame(()=>{(0,O5.isMobileViewport)()||ek.current?.focus()})),J.current.endProcessing())};let rv=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{E&&!$&&p&&rv.current!==p&&v&&v.trim()&&!(tS.length>0)&&"ready"===t$&&"idle"===tY.phase&&(rv.current=p,Y(""),ry(v))},[E,$,p,v,tS.length,t$,tY.phase]);let rb=(0,e_.useCallback)(async(e,t)=>{let r=t.filter(e=>"user"===e.role).length,n=[...t].reverse().map(e=>e.id).find(RY)??null;for(let t=0;t<3;t++){try{let t=await fetch(`/api/conversations/${e}/messages`);if(t.ok){let e=await t.json();if(Array.isArray(e)){let t=function(e,t,r=null){let n=r?e.findIndex(e=>e.id===r):-1,i=0;for(let r=0;r<e.length;r++)if("user"===e[r].role){if(i===t){if(-1!==n&&r<=n)return null;return e.slice(r).map(e=>e.id)}i++}return null}(e,r,n);if(t)return t}}}catch{}t<2&&await new Promise(e=>setTimeout(e,400))}return[]},[]),rx=(0,e_.useCallback)((e,t)=>{0!==t.length&&fetch(`/api/conversations/${e}/messages`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageIds:t})}).then(async e=>{if(!e.ok)return void console.warn("[chat] Superseded-row delete failed",{status:e.status,ids:t});let r=await e.json().catch(()=>null);r&&(r.ignored??0)>0&&console.warn("[chat] Superseded-row delete ignored ids the DB cannot hold",r)}).catch(()=>{})},[]),rk=(0,e_.useCallback)(async(e,t)=>{let r=tS.findIndex(t=>t.id===e);if(-1===r||!rm(t))return;let n=tS[r].parts.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),i=n.match(/\[User uploaded file: ".+?" \(document ID: [a-f0-9-]+\)\]/g)?.join("\n")??"",a=i?`${i} 191 192${t}`:t;tE(tS.slice(0,r));let o=ti.current;o&&rx(o,await rb(o,tS.slice(0,r))),tI(),eH(!1),eW(!1),tY.send(a,{body:{replacesTurn:!0}})},[tS,tE,tY,tI,rm,rb,rx]),rw=(0,e_.useCallback)(async(e,t)=>{let r=tS.findIndex(t=>t.id===e);if(-1===r)return;if("assistant"===tS[r].role){for(let e=r-1;e>=0;e--)if("user"===tS[e].role){r=e;break}if("user"!==tS[r].role)return}let n=tS[r].parts.filter(e=>"text"===e.type).map(e=>e.text).join("");if(!n.trim())return;let i=ti.current,a=i?await rb(i,tS.slice(0,r)):[];if(ti.current!==i)return;tE(tS.slice(0,r));let o=()=>{i&&rx(i,a)};if(t?.auto){ej.current&&clearTimeout(ej.current.timer);let e=setTimeout(()=>{ej.current=null,ti.current===i&&tE(e=>e.length<tS.length?tS:e)},12e3);ej.current={snapshot:tS,convId:i,purge:o,timer:e}}else o();tI(),eH(!1),eW(!1),e0(null),e3(!1),e2(!1),to.current=!!t?.auto,tY.send(n,{body:{replacesTurn:!0}})},[tS,tE,tY,tI,rb,rx]);eA.current=rw;let r_=(0,e_.useCallback)(async e=>{let t;e3(!1),tI(),e8(e);let r=ti.current;if(!r||"streaming"===t$||"submitted"===t$)return void e8(null);let n=tS.findIndex(t=>t.id===e);if(-1===n)return void e8(null);let i=tS[n];if("assistant"!==i.role)return void e8(null);let a=Array.isArray(i.parts)?[...i.parts]:[],o={messages:tS,folderId:eb.current??null,chatKind:ex.current,documentIds:e$.current,conversationId:r,platform:(0,DB.getNativePlatform)(),language:localStorage.getItem("gdprchat-language")||void 0,replyLanguage:localStorage.getItem("gdprchat-reply-language")||void 0,replyLanguageLocked:"true"===localStorage.getItem("gdprchat-reply-language-locked")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||void 0,locationConsent:localStorage.getItem("gdprchat-location-consent")||void 0,location:(()=>{try{let e=localStorage.getItem("gdprchat-location-cache");return e?JSON.parse(e):void 0}catch{return}})(),continueFromMessageId:e};try{t=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})}catch(e){console.error("[continue] fetch failed",e);return}if(!t.ok||!t.body)return void console.error("[continue] non-OK response",t.status);tE(t=>t.map(t=>{if(t.id!==e)return t;let r=t.metadata??{};return{...t,metadata:{...r,truncated:!1}}}));
192try{let r=hJ({stream:t.body,schema:gy}).pipeThrough(new TransformStream({transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}));for await(let t of function({message:e,stream:t,onError:r,terminateOnError:n=!1}){var i;let a,o,s=!1,l=new ReadableStream({start(e){a=e}}),u=gC({messageId:null!=(i=null==e?void 0:e.id)?i:"",lastMessage:e}),c=e=>{null==r||r(e),!s&&n&&(s=!0,null==a||a.error(e))};return gT({stream:g$({stream:t,runUpdateMessageJob:e=>e({state:u,write:()=>{null==a||a.enqueue(structuredClone(u.message))}}),onError:c}),onError:c}).finally(()=>{s||null==a||a.close()}),(o=l.pipeThrough(new TransformStream))[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function r(r){var n;if(!t){t=!0;try{r&&await (null==(n=e.cancel)?void 0:n.call(e))}finally{try{e.releaseLock()}catch(e){}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:n,value:i}=await e.read();return n?(await r(!0),{done:!0,value:void 0}):{done:!1,value:i}},return:async()=>(await r(!0),{done:!0,value:void 0}),async throw(e){throw await r(!0),e}}},o}({stream:r})){let r=t.parts??[];tE(t=>t.map(t=>t.id!==e?t:{...t,parts:[...a,...r]}))}}catch(e){console.error("[continue] stream parse failed",e)}finally{e8(null)}},[tS,tE,t$,tI]),rS=(0,e_.useCallback)(e=>{let t=tS.findIndex(t=>t.id===e);if(-1===t)return;let r=tS.slice(0,t);if(0===r.length&&_)return void _();let n=tS[t];tE(r),em({intent:"tail",nonce:++eh.current});let i=ti.current;if(!i)return;let a=e=>fetch(`/api/conversations/${i}/messages`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({afterCreatedAt:e})}).catch(()=>{}),o=n.createdAt;if(o)return void a(o);let s=e=>(Array.isArray(e.parts)?e.parts:[]).filter(e=>!!e&&"object"==typeof e&&"text"===e.type).map(e=>e.text).join("").trim(),l=s(n);if(!l)return;let u=null,c=-1;for(let e=t-1;e>=0;e--){let t=r[e].createdAt;if(t){u=new Date(t).getTime(),c=e;break}}let d=(e,t)=>e.role===n.role&&t===l,p=0,h=0;for(let e=c+1;e<tS.length;e++)d(tS[e],s(tS[e]))&&(h++,e===t&&(p=h));fetch(`/api/conversations/${i}/messages`).then(e=>e.ok?e.json():null).then(e=>{if(!Array.isArray(e))return;let t=e.filter(e=>!!e.createdAt&&(null===u||new Date(e.createdAt).getTime()>u)&&d(e,(e.content??"").trim()));if(p&&t.length===h)return a(t[p-1].createdAt)}).catch(()=>{})},[tS,tE,_]),rE=(0,e_.useCallback)(e=>{ep(e)},[]),rC=(0,e_.useCallback)(()=>{if(!ed)return;let e=tS.findIndex(e=>e.id===ed);if(-1===e)return;let t=e;for(let r=e-1;r>=0;r--)if("user"===tS[r].role){t=r;break}let r=tS.slice(t,e+1),n=r.map(e=>e.id);tE(r),em({intent:"pinLastQuestion",nonce:++eh.current});let i=ti.current;i&&fetch(`/api/conversations/${i}/messages`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({keepOnly:n})}).catch(()=>{}),ep(null)},[ed,tS,tE]),r$=(0,e_.useCallback)(e=>{ee(t=>t.filter(t=>t.id!==e))},[]),rT=(0,e_.useCallback)(e=>{if(!e.fileUpload)return;let{documentId:t,filename:r}=e.fileUpload;fetch(`/api/conversation-documents/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({piiBlocked:!1})}).catch(()=>{}),er(e=>[...e,{name:r,id:crypto.randomUUID(),docId:t}].slice(0,25)),ee(t=>t.filter(t=>t.id!==e.id))},[]),rI=(0,e_.useCallback)((e,t,r)=>{tE(n=>n.map(n=>{if(n.id!==e)return n;let i=n.parts.map(e=>"text"===e.type?{...e,text:t}:e),a=n.metadata??{};return{...n,parts:i,metadata:{...a,userEdit:{editedContent:t,originalContent:r,editedAt:new Date().toISOString(),supersedesTools:!0}}}}));let n=ti.current;n&&fetch(`/api/conversations/${n}/messages/${e}/edit`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({editedContent:t,originalContent:r,supersedesTools:!0})}).catch(()=>{})},[tE]),rN=(0,e_.useCallback)(e=>{let t=/^\[.+?\] /.test(e)?e:`[action] ${e}`;eN.current=0,ea(t),tY.send(t,{prepare:async()=>(await tk(),ti.current)?(eJ.current=null,!0):(eJ.current=t,ea(null),!1)})},[tY,tk]),rA=(0,e_.useMemo)(()=>{let e=et.filter(e=>RQ.test(e.name)).length;if(e>0)return e;for(let e=tS.length-1;e>=0;e--){let t=tS[e];if("assistant"===t.role){if((t.parts??[]).filter(e=>e?.type==="tool-generateImage"&&e?.output?.success===!0).length>0)return 1;break}}return 0},[et,tS]),[rj,rM]=(0,e_.useState)(!1),rO=(0,e_.useRef)(!1),rD=(0,e_.useCallback)(async e=>{if(rO.current||"streaming"===t$||"submitted"===t$)return;rO.current=!0,rM(!0);let t=crypto.randomUUID(),r=crypto.randomUUID(),n=crypto.randomUUID(),i={imageAction:{id:e.actionId,source:"actionBar",version:1}},a=et.map(e=>e.docId).filter(e=>!!e).reverse().slice(0,6),o=(()=>{var t;let r,n=(t=DM.get(e.actionId)?.targetAspect,(r=/^(\d+):(\d+)$/.exec((t??"").trim()))?{w:Number(r[1]),h:Number(r[2])}:null);if(n)return n;let i=[...document.querySelectorAll("img")],a=et.filter(e=>e.previewUrl).pop()?.previewUrl,o=a?i.find(e=>e.src===a):void 0,s=[...document.querySelectorAll("[data-generated-image] img")].pop(),l=o??s;
192return l?.naturalWidth&&l?.naturalHeight?{w:l.naturalWidth,h:l.naturalHeight}:{w:1,h:1}})();try{await tk();let s=ti.current;if(!s)return;if(!td.current){td.current=!0;let t=R9(e.actionId,N);f?.(s,t),fetch(`/api/conversations/${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})}).catch(()=>{})}let l=new Date,u=R9(e.actionId,N),c={id:r,role:"user",parts:[{type:"text",text:u}],createdAt:l,metadata:i},d={id:t,role:"assistant",createdAt:l,metadata:i,parts:[{type:"tool-generateImage",toolCallId:n,state:"output-available",input:{prompt:u},output:{pending:!0,width:o.w,height:o.h}}]};tE(e=>[...e,c,d]),em({intent:"centerLastImage",nonce:++eh.current});let p=t=>fetch(`/api/conversations/${t}/image-action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionId:e.actionId,text:e.text,degree:e.degree,sourceDocumentIds:a,clientActionId:n})}),h=await p(s);if(404===h.status){ti.current=null,await tk();let e=ti.current;e&&(h=await p(e))}let m=await h.json().catch(()=>({}));tE(e=>e.map(e=>{var r;return e.id!==t?e:h.ok&&m?.ok&&Array.isArray(m.results)?{...e,parts:m.results.map((e,t)=>({type:"tool-generateImage",toolCallId:0===t?n:`${n}-${t}`,state:"output-available",input:{prompt:u},output:e}))}:{...e,parts:[{type:"tool-generateImage",toolCallId:n,state:"output-available",input:{prompt:u},output:{success:!1,errorCode:(r=m?.errorCode,"cr400"===r?"cr400":"moderated"===r?"imageBlocked":"busy"===r?"rateLimited":"generic")}}]}})),em({intent:"centerLastImage",nonce:++eh.current}),h.ok&&m?.ok&&t_()}catch{tE(e=>e.map(e=>e.id===t?{...e,parts:[{type:"tool-generateImage",toolCallId:n,state:"output-available",input:{},output:{success:!1,errorCode:"generic"}}]}:e))}finally{rO.current=!1,rM(!1)}},[t$,tk,tE,f,t_,N,et]);(0,e_.useEffect)(()=>{let e=()=>{if("visible"!==document.visibilityState)return;let e=ti.current;!e||(tA.current??[]).some(e=>(e.parts??[]).some(e=>e?.type==="tool-generateImage"&&e?.output?.pending))&&fetch(`/api/conversations/${e}/messages`).then(e=>e.ok?e.json():null).then(e=>{if(!Array.isArray(e)||0===e.length)return;let t=e.map(e=>({id:e.id,role:e.role,parts:e.parts??[{type:"text",text:e.content??""}],metadata:e.metadata??void 0,createdAt:e.createdAt?new Date(e.createdAt):new Date}));t.some(e=>(e.parts??[]).some(e=>e?.type==="tool-generateImage"&&e?.output?.success))&&(rO.current=!1,rM(!1),tE(t),t_())}).catch(()=>{})};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[tE,t_]);let rR=(0,e_.useRef)(!1),rP=(0,e_.useCallback)(async(e,t,r)=>{if(rR.current||"streaming"===t$||"submitted"===t$)return!1;rR.current=!0;try{await tk();let n=ti.current;n&&(td.current=!0,f?.(n,r));let i=new Date,a=crypto.randomUUID(),o={curated:{kind:"guided-tour"}},s={id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:e}],createdAt:i,metadata:o},l={id:a,role:"assistant",parts:[{type:"text",text:""}],createdAt:i,metadata:o},u=e=>{tE(t=>[...t.filter(e=>e.id!==s.id&&e.id!==a),s,{...l,parts:[{type:"text",text:e}]}])};if(u(""),await new Promise(e=>{let r=t.length,n=Math.max(1,Math.ceil(r/24)),i=0,a=!1,o=()=>{a||(a=!0,window.removeEventListener("pointerdown",s,!0),u(t),e())},s=e=>{"mouse"!==e.pointerType&&o()};window.addEventListener("pointerdown",s,!0);let l=()=>{a||(i=Math.min(r,i+n),u(t.slice(0,i)),i<r?setTimeout(l,28):o())};setTimeout(l,220)}),eg&&U(e=>e+1),n){try{await fetch(`/api/conversations/${n}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r})})}catch{}try{await fetch(`/api/conversations/${n}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:"user",content:e,parts:[{type:"text",text:e}],metadata:o})}),await fetch(`/api/conversations/${n}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:"assistant",content:t,parts:[{type:"text",text:t}],metadata:o})})}catch{}}return!0}finally{rR.current=!1}},[t$,tk,tE,f,eg]);return(0,e_.useEffect)(()=>{$&&p&&rv.current!==p&&!(tS.length>0)&&"ready"===t$&&(rv.current=p,Y(""),tb(),rP(I("introPrompt"),I("introAnswer",{editLabel:I("pillEdit")}),I("introTitle")))},[$,p,tS.length,t$]),(0,ew.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col",children:[(0,ew.jsx)(Rr,{status:t$,wasUserStopped:t0,voice:W}
192),(0,ew.jsx)(Rt,{onToggleSidebar:r,onNewChat:i,currentFolderName:s,folderPath:u,onSelectFolder:c,conversationTitle:l,credits:eo,onShare:m,hasActiveConversation:!!(p||ti.current),hasVisibleConversation:!tW,isTemporaryChat:g,viaShortcutSlot:C,starred:x,onToggleStar:k,onRename:w,onDelete:_,onMove:S,autoZenEnabled:eg,onAutoZenChange:ev,isStreaming:"streaming"===t$,autoZenTriggered:z}),eo&&"past_due"===eo.subscriptionStatus&&"mollie"===eo.source&&(0,ew.jsx)(Ra,{}),eo&&!tJ&&eo.totalAvailable<=0&&(0,ew.jsx)(Rn,{planDailyCredits:eo.plan?.dailyCredits??0,totalAvailable:eo.totalAvailable,planSlug:eo.plan?.slug,nextTier:eo.nextTier??null}),e7&&(0,ew.jsx)(Rf,{notice:e7,now:te,onDismiss:tt}),tn&&(0,ew.jsx)(Rc,{postId:tn}),rn&&tS.length>0&&(0,ew.jsx)(DG,{onDismiss:rd}),(0,ew.jsxs)(ew.Fragment,{children:[E&&(0,ew.jsx)(Ry,{initialSlot:C??0}),tW?(0,ew.jsx)("div",{className:"min-h-0 flex-1","aria-hidden":!0}):(0,ew.jsx)(O0,{messages:tS,blockedMessages:Q,isStreaming:"streaming"===t$,isLoading:tB,recovering:eM,onEditSubmit:rk,onRetry:rw,onContinue:r_,continuingMessageId:e9,onDeleteFromHere:rS,onSuggestionClick:rN,onStop:tQ,onDeleteBlockedMessage:r$,onTogglePiiLock:a,onAllowBlockedFile:rT,pendingUserText:ei,onShareMessage:y,conversationId:p||ti.current,conversationTitle:l,onThumbsDown:rt,onEditResponseSave:rI,onKeepOnlyThis:rE,onToolTimeout:rr,chatDisplay:A,autoZenEnabled:eg&&!rn&&!G,autoZenRecoverSignal:F,autoZenSettingOn:eg,onAutoZenChange:ev,onZenChange:B,scrollCommand:ef}),(0,ew.jsx)(RT,{open:null!==ed,onOpenChange:e=>{e||ep(null)},onConfirm:rC}),(0,ew.jsx)(eE.AnimatePresence,{initial:!1,mode:"popLayout",children:tW&&(0,ew.jsx)(eC.motion.div,{initial:{opacity:0}
192,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"w-full mb-4 max-sm:portrait:mb-0 min-h-0 overflow-hidden",children:(0,ew.jsx)(RK,{temporary:!!g})},`empty-above-${t??0}`)}),tW&&(0,ew.jsx)("div",{className:"hidden min-h-0 flex-1 max-sm:portrait:block","aria-hidden":!0}),(0,ew.jsxs)("div",{"data-composer-dock":"",className:"relative z-10 flex w-full flex-col items-center gap-4 py-1 sm:py-2",children:[(0,ew.jsx)(Rz,{state:eQ,onRetry:()=>{let e=[...tS].reverse().find(e=>"user"===e.role);e&&(e0(null),e2(!1),tI(),eA.current(e.id))}}),(tT&&!el&&!eM&&!e1&&!e6&&!tT.message.includes("Unauthorized")&&!R1(tT)||eV&&!tT&&!tB||eK)&&(0,ew.jsx)("div",{className:"mx-auto w-full max-w-3xl px-4 pb-2",children:(0,ew.jsxs)("div",{role:"alert",className:"flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 dark:border-amber-800 dark:bg-amber-950/30",children:[(0,ew.jsx)("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:t6("generic")}),(0,ew.jsxs)("button",{onClick:()=>{eN.current=0;let e=[...tS].reverse().find(e=>"user"===e.role);if(e)eA.current(e.id);else if(eK&&eJ.current?.trim()){let e=eJ.current;eJ.current=null,eW(!1),tI(),ea(e),tY.send(e,{prepare:async()=>(await tk(),ti.current)?(eJ.current=null,!0):(eJ.current=e,ea(null),!1)})}},className:"ml-auto flex items-center gap-1 rounded-md border border-amber-200 bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700 transition-colors hover:bg-amber-200 dark:border-amber-700 dark:bg-amber-900/50 dark:text-amber-400 dark:hover:bg-amber-900/80",children:[(0,ew.jsx)(v$.RefreshCw,{className:"h-3.5 w-3.5"}),t6("retryButton")]})]})}),(0,ew.jsxs)("div",{className:"w-full",children:[(0,ew.jsx)(DW,{ref:ek,input:X,onInputChange:tx,onSubmit:e=>{if(e.preventDefault(),!X.trim()&&0===et.length||en)return;let t=X,r=et.filter(e=>e.docId);if(r.length>0){let e=r.map(e=>`[User uploaded file: "${e.name}" (document ID: ${e.docId})]`).join("\n");t=t.trim()?`${e} 193 194${t}`:e,er([])}ea(X.trim()),Y(""),tb(),tY.send(t,{validate:()=>!!rm(X)||(ea(null),!1),prepare:async()=>{if(console.log("[chat] prepare: ensureConversation start",{phase:tY.phase,convId:ti.current}),await tk(),console.log("[chat] prepare: ensureConversation done",{convId:ti.current}),!ti.current)return console.warn("[chat] prepare: blocked â no conversationId after ensureConversation"),eJ.current=X.trim(),ea(null),Y(X),!1;let e=et.map(e=>e.docId).filter(e=>!!e);return e$.current=[...e$.current,...e],eN.current=0,eO(!1),eH(!1),eW(!1),eJ.current=null,tI(),!0}})},isStreaming:"streaming"===t$,onStop:tQ,onFileSelect:rg,attachedFiles:et,onRemoveFile:e=>{er(t=>{let r=t.find(t=>t.id===e);return r?.previewUrl&&URL.revokeObjectURL(r.previewUrl),t.filter(t=>t.id!==e)})},isUploading:en,isBlocked:Q.some(e=>!e.fileUpload&&e.inComposer),isEmpty:tW,onNewChat:tW?void 0:i,chatDisplay:A,imageStudioCount:rA,onImageAction:rD,imageActionBusy:rj,voice:W,voiceMode:O,isConversationModeActive:Z.current,onConversationModeStart:t1,onConversationModeEnd:t2,onAutoSubmit:ry,sidebarCollapsed:n,isTemporaryChat:g,onExitTemporary:()=>c?.(null)}),!tW&&(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(R$,{conversationId:p,messageIds:tS.map(e=>e.id),handledPostId:tn,className:"-mt-1 mb-1"}),(0,ew.jsx)(RC,{surface:"chat",buildMessageRef:re,className:"-mt-1 px-4 text-center text-xs leading-tight text-gray-500 dark:text-gray-400"})]})]}),(0,ew.jsx)(eE.AnimatePresence,{initial:!1,mode:"popLayout",children:tW&&(0,ew.jsx)(eC.motion.div,{initial:{opacity:0}
194,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"w-full max-sm:-order-1",children:(0,ew.jsx)(RW,{onChipPick:tG,onGuidedTourStep:rP})},`empty-below-${t??0}`)})]}),tW&&(0,ew.jsx)("div",{className:"min-h-0 flex-1 max-sm:portrait:hidden","aria-hidden":!0})]}),(0,ew.jsx)(R_,{open:!!el,retryAfter:el?.retryAfter,onDismiss:()=>eu(null)})]})}function R9(e,t){let r=DM.get(e);if(!r)return e;try{return t(r.labelKey)}catch{return e}}var R8=e.i(249403),R7=e.i(669062);class Pe extends Error{status;detail;constructor(e,t){super(`Share API returned error: ${t}`),this.status=e,this.detail=t,this.name="ShareLinkError"}}async function Pt(e){let t=await fetch("/api/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw new Pe(t.status,e?.error??`HTTP ${t.status}`)}let r=await t.json();return`${window.location.origin}${r.url}`}async function Pr(t,r){if((0,DB.isNativeApp)()){let n=await t,{Share:i}=await e.A(506891);try{return await i.share({title:r,url:n}),"shared"}catch(e){if(e instanceof Error&&"Share canceled"===e.message)return"cancelled";throw e}}if("u">typeof ClipboardItem&&navigator.clipboard?.write){let e=t.then(e=>new Blob([e],{type:"text/plain"}));e.catch(()=>{});try{return await navigator.clipboard.write([new ClipboardItem({"text/plain":e})]),"copied"}catch{}}let n=await t;try{return await navigator.clipboard.writeText(n),"copied"}catch{return"manual"}}var Pn=e.i(792119);let Pi="gdprchat-sidebar-open";var Pa=e.i(403213);function Po(){let e,t=(0,eS.useTranslations)("sidebar"),r=(0,eS.useTranslations)("share"),n=(0,eS.useTranslations)("chat");(0,Pn.useKeyboardHeight)();let[i,a]=function(){let[e,t]=(0,e_.useState)(!1);return(0,e_.useEffect)(()=>{try{"true"===sessionStorage.getItem(Pi)&&t(!0)}catch{}},[]),[e,(0,e_.useCallback)(e=>{t(e);try{e?sessionStorage.setItem(Pi,"true"):sessionStorage.removeItem(Pi)}catch{}},[])]}(),[o,s]=(0,e_.useState)(0),[l,u]=(0,Pa.useSidebarCollapsed)(),[c,d]=(0,e_.useState)([]),[p,h]=(0,e_.useState)([]),[f,m]=(0,e_.useState)(null),g=(0,e_.useMemo)(()=>p.find(e=>!e.parentId)?.id??null,[p]),[y,v]=(0,e_.useState)(()=>{try{let e=sessionStorage.getItem("expandedFolderId");if(null!==e)return e||null}catch{}return null}),b=(0,e_.useCallback)(e=>{v(t=>{let r="function"==typeof e?e(t):e;try{r?sessionStorage.setItem("expandedFolderId",r):sessionStorage.setItem("expandedFolderId","")}catch{}return r})},[]),[x,k]=(0,e_.useState)(()=>{try{return sessionStorage.getItem("lastActiveConversationId")}catch{return null}}),[w,_]=(0,e_.useState)(!1),[S,E]=(0,e_.useState)(""),C=(0,e_.useCallback)(e=>{E(e?.text??""),_(!0)},[]);(0,e_.useEffect)(()=>{let e=e=>{C(e.detail)};return window.addEventListener("open-text-editor",e),()=>window.removeEventListener("open-text-editor",e)},[C]);let $=(0,yC.useSearchParams)(),T=(0,yC.useRouter)(),I=(0,yC.usePathname)();(0,e_.useEffect)(()=>{if("1"!==$.get("openTextEditor"))return;C({text:$.get("text")??void 0});let e=new URLSearchParams($.toString());e.delete("openTextEditor"),e.delete("text"),e.delete("conversationId");let t=e.toString();T.replace(`${I}${t?`?${t}`:""}`,{scroll:!1})},[$,T,I,C]);let N=(0,e_.useRef)(new Set),[A,j]=(0,e_.useState)(new Set),[M,O]=(0,e_.useState)(()=>new Map),[D,R]=(0,e_.useState)(()=>new Set),{settings:P}=(0,bR.useUserSettings)(),z=(0,bP.isPiiFilterEnabledByDefault)(P),L=(0,e_.useRef)(z);(0,e_.useEffect)(()=>{L.current=z},[z]);let[F,U]=(0,e_.useState)(()=>z);(0,e_.useEffect)(()=>{let e,t=null,r=null;try{t=sessionStorage.getItem("lastFolderId"),r=sessionStorage.getItem("lastActiveConversationId");let n=sessionStorage.getItem("expandedFolderId");null!==n&&(e=n||null)}catch{}let n=!1,i=async e=>{let t;for(let r=0;r<4;r++){r>0&&await new Promise(e=>setTimeout(e,300*2**(r-1)));try{let r=await fetch(e);if(r.ok)return await r.json();t=Error(`${e} â HTTP ${r.status}`)}catch(e){t=e}}throw t};return Promise.all([i("/api/folders"),i("/api/conversations"),fetch("/api/user/last-folder").then(e=>e.ok?e.json():null).catch(()=>null)]).then(async([i,a,o])=>{if(n)return;let s=Array.isArray(i)?i:[];Array.isArray(a)&&d(e=>{if(0===e.length)return a;let t=new Set(a.map(e=>e.id)),r=e.filter(e=>!t.has(e.id));return r.length>0?[...a,...r]:a});let l=s.find(e=>!e.parentId);if(!l)try{let e=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"My projects",parentId:null})});e.ok&&(l=await e.json(),s=[...s,l])}catch{}h(s);let u=o?.lastFolderId??null,c=t||u,p=c?s.find(e=>e.id===c):null,f=s.find(e=>!e.parentId),g=p??l??f??null;g&&(m(g.id),void 0!==e?v(e):b(null));let y=Array.isArray(a)?a:[];if(r){let e=y.find(e=>e.id===r);e?(k(r),U(e.piiFilterEnabled),e.folderId&&(m(e.folderId),b(e.folderId))):k(e=>e===r?null:e)}}).catch(()=>{}),()=>{n=!0}},[b]);let B=(0,e_.useCallback)(()=>{let e=Array.from(new Set([...Array.from(N.current),...Array.from(M.keys())]));if(0===e.length)return;let t=new Set(e);for(let r of(d(e=>e.filter(e=>!t.has(e.id))),e))fetch(`/api/conversations/${r}`,{method:"DELETE"}).catch(()=>{});N.current.clear(),j(new Set),O(e=>0===e.size?e:new Map)},[M]);(0,e_.useEffect)(()=>{let e=()=>{for(let e of Array.from(new Set([...N.current,...M.keys()])))navigator.sendBeacon(`/api/conversations/${e}/delete`,""),fetch(`/api/conversations/${e}`,{method:"DELETE"}).catch(()=>{})};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[M]),(0,e_.useEffect)(()=>{try{x?sessionStorage.setItem("lastActiveConversationId",x):sessionStorage.removeItem("lastActiveConversationId")}catch{}},[x]),(0,e_.useEffect)(()=>{let e=x?c.find(e=>e.id===x):null;document.title=e?.title||"GDPRchat"},[x,c]),(0,e_.useEffect)(()=>
194{if(!x)return;let e=c.find(e=>e.id===x);e&&U(e.piiFilterEnabled)},[x]);let Z=(0,e_.useCallback)(()=>{B(),k(null),s(e=>e+1),a(!1),U(L.current)},[B]),q=(0,e_.useCallback)(e=>{k(e),a(!1)},[]),V=(0,e_.useCallback)(async e=>{d(t=>t.filter(t=>t.id!==e)),k(t=>t===e?null:t);try{await fetch(`/api/conversations/${e}`,{method:"DELETE"})}catch{}},[]),H=(0,e_.useRef)(null);(0,e_.useEffect)(()=>{let e="1"===$.get("ingress")?$.get("conversationId"):null,t="1"===$.get("newChat"),r="1"===$.get("temp"),n="1"===$.get("shortcut"),i="1"===$.get("shortcutIntro"),a=$.get("shortcutSlot"),o=null!==a?parseInt(a,10):0,s=Number.isFinite(o)&&o>=0&&o<=2?o:0;if(!e&&!t)return;let l=$.toString();H.current!==l&&(H.current=l,(async()=>{if(e){try{let t=await fetch(`/api/conversations/${e}`);if(t.ok){let e=await t.json();d(t=>t.some(t=>t.id===e.id)?t:[e,...t])}}catch{}n?(O(t=>{if(t.get(e)===s)return t;let r=new Map(t);return r.set(e,s),r}),i&&R(t=>{if(t.has(e))return t;let r=new Set(t);return r.add(e),r})):r&&(m(Rw.TEMP_FOLDER_ID),N.current.add(e),j(new Set(N.current))),q(e)}else t&&Z();let a=new URLSearchParams($.toString());a.delete("conversationId"),a.delete("ingress"),a.delete("newChat"),a.delete("voice"),a.delete("temp"),a.delete("shortcut"),a.delete("shortcutSlot"),a.delete("shortcutIntro");let o=a.toString();T.replace(`${I}${o?`?${o}`:""}`,{scroll:!1})})())},[$,T,I,q,Z]);let K=(0,e_.useCallback)(async e=>{let t=new Set(c.filter(t=>t.folderId===e).map(e=>e.id));d(t=>t.filter(t=>t.folderId!==e)),k(e=>e&&t.has(e)?null:e);try{if(!(await fetch(`/api/folders/${e}/clear-conversations`,{method:"DELETE"})).ok)throw Error("Server error")}catch{d(c)}},[c]),W=(0,e_.useCallback)(async e=>{let t=new Set,r=!0;for(;r;)for(let n of(r=!1,p))(n.parentId===e||n.parentId&&t.has(n.parentId))&&!t.has(n.id)&&(t.add(n.id),r=!0);let n=new Set([e,...t]),i=p.find(t=>t.id===e),a=i&&!i.parentId,o=new Set(c.filter(e=>e.folderId?n.has(e.folderId):a).map(e=>e.id));d(e=>e.filter(e=>e.folderId?!n.has(e.folderId):!a)),k(e=>e&&o.has(e)?null:e),h(e=>e.filter(e=>!t.has(e.id))),f&&t.has(f)&&(m(e),b(e));try{if(!(await fetch(`/api/folders/${e}/clear-all`,{method:"DELETE"})).ok)throw Error("Server error")}catch(e){console.error("[clear-all] Failed to clear folder contents:",e),d(c),h(p),f&&t.has(f)&&m(f)}},[p,c,f,b]),J=(0,e_.useCallback)(async(e,t)=>{d(r=>r.map(r=>r.id===e?{...r,title:t}:r));try{await fetch(`/api/conversations/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})})}catch{}},[]),G=(0,e_.useCallback)(async(e,t)=>{d(r=>r.map(r=>r.id===e?{...r,folderId:t}:r));try{await fetch(`/api/conversations/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderId:t})})}catch{}},[]),X=(0,e_.useCallback)(async(e,t)=>{d(r=>r.map(r=>r.id===e?{...r,starred:t}:r));try{await fetch(`/api/conversations/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({starred:t})})}catch{}},[]),[Y,Q]=(0,e_.useState)(null),[ee,et]=(0,e_.useState)(null),er=(0,e_.useCallback)(e=>{let t=Pr(Pt({conversationId:e}),r("shareConversation"));(async()=>{let n=3e3;try{let e=await t;if("cancelled"===e)return;"manual"===e?Q(r("linkCreatedNotCopied")):(Q("shared"===e?r("linkReadySnapshot"):r("linkCopiedSnapshot")),n=7e3)}catch(t){if(t instanceof Pe&&409===t.status){Q(r("stillGenerating")),setTimeout(()=>Q(null),4e3);return}Ow({source:"client",errorType:t instanceof Pe?"ShareConversationFailed":"ShareConversationException",message:t instanceof Error?t.message:String(t),conversationId:e,metadata:t instanceof Pe?{status:t.status,detail:t.detail}:{stack:t instanceof Error?t.stack:void 0}}),Q(r("shareFailed"))}setTimeout(()=>Q(null),n)})()},[r]),en=(0,e_.useCallback)((e,t)=>{if(!x)return;let n=Pr(Pt({conversationId:x,messageId:e,...t?{versionView:t.versionView,author:t.author}:{}}),r("shareConversation"));(async()=>{try{let e=await n;if("cancelled"===e||"shared"===e)return;Q("copied"===e?r("linkCopied"):r("linkCreatedNotCopied"))}catch(t){if(t instanceof Pe&&409===t.status){Q(r("stillGenerating")),setTimeout(()=>Q(null),4e3);return}Ow({source:"client",errorType:t instanceof Pe?"ShareMessageFailed":"ShareMessageException",message:t instanceof Error?t.message:String(t),conversationId:x,metadata:t instanceof Pe?{status:t.status,detail:t.detail,messageId:e}:{stack:t instanceof Error?t.stack:void 0,messageId:e}}),Q(r("shareFailed"))}setTimeout(()=>Q(null),3e3)})()},[x,r]),ei=(0,e_.useCallback)(async(e,t)=>{try{let r=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,parentId:t})});if(r.ok){let e=await r.json();return h(t=>t.some(t=>t.id===e.id)?t:[...t,e]),e.id}}catch{}return null},[]),ea=(0,e_.useCallback)(async(e,t)=>{h(r=>r.map(r=>r.id===e?{...r,name:t}:r));try{await fetch(`/api/folders/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})})}catch{}},[]),eo=(0,e_.useCallback)(async(e,t)=>{let r=t.trim().length>0?t.trim():null;h(t=>t.map(t=>
194t.id===e?{...t,customInstructions:r}:t));try{await fetch(`/api/folders/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({customInstructions:r})})}catch{}},[]);(0,e_.useEffect)(()=>{!f&&g&&m(g)},[f,g]),(0,e_.useEffect)(()=>{function e(e){let t=e.detail;t?.folderId&&h(e=>e.map(e=>e.id===t.folderId?{...e,customInstructions:t.customInstructions??null}:e))}return window.addEventListener(bu,e),()=>window.removeEventListener(bu,e)},[]);let es=(0,e_.useCallback)(async(e,t)=>{h(r=>r.map(r=>r.id===e?{...r,parentId:t}:r));try{await fetch(`/api/folders/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentId:t})})}catch{}},[]),el=(0,e_.useCallback)(async(e,t)=>{let r=p.find(t=>t.id===e),n=r?.parentId??null;if(!n){let t=p.find(t=>t.id!==e&&!t.parentId);n=t?.id??null}if("reparent"===t)h(t=>t.map(t=>t.parentId===e?{...t,parentId:n}:t).filter(t=>t.id!==e)),d(t=>t.map(t=>t.folderId===e?{...t,folderId:n}:t));else{let t=new Set([e]),r=!0;for(;r;)for(let e of(r=!1,p))e.parentId&&t.has(e.parentId)&&!t.has(e.id)&&(t.add(e.id),r=!0);h(e=>e.filter(e=>!t.has(e.id))),d(e=>e.filter(e=>!e.folderId||!t.has(e.folderId)))}f===e&&m(n??g);try{await fetch(`/api/folders/${e}?mode=${t}`,{method:"DELETE"})}catch{}},[p,f,g]),eu=(0,e_.useCallback)(e=>{let t=e??g;if(t!==f&&B(),t===Rw.TEMP_FOLDER_ID&&a(!1),k(null),m(t),t&&t!==Rw.TEMP_FOLDER_ID&&t!==y&&b(t),U(L.current),t!==Rw.TEMP_FOLDER_ID){try{t?sessionStorage.setItem("lastFolderId",t):sessionStorage.removeItem("lastFolderId")}catch{}fetch("/api/user/last-folder",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderId:t})}).catch(()=>{})}},[f,g,B,y,b]),ec=(0,e_.useCallback)(()=>{U(e=>{let t=!e;return x&&(d(e=>e.map(e=>e.id===x?{...e,piiFilterEnabled:t}:e)),fetch(`/api/conversations/${x}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({piiFilterEnabled:t})}).catch(()=>{})),t})},[x]),ed=(0,e_.useMemo)(()=>{if(!f)return null;if(f===Rw.TEMP_FOLDER_ID)return t("temporaryChat");let e=p.find(e=>e.id===f);return e?.name??null},[f,p,t]),ep=(0,e_.useMemo)(()=>f?f===Rw.TEMP_FOLDER_ID?[{id:Rw.TEMP_FOLDER_ID,name:t("temporaryChat")}]:(0,R7.getFolderPath)(f,p).map(e=>({id:e.id,name:e.name})):[],[f,p,t]),eh=(0,e_.useMemo)(()=>x?c.find(e=>e.id===x)??null:null,[x,c]),ef=x&&M.has(x)?"shortcut":x&&A.has(x)?"temporary":x||f!==Rw.TEMP_FOLDER_ID?"regular":"temporary",em=(0,e_.useCallback)(e=>{d(t=>[e,...t]),k(e.id),f===Rw.TEMP_FOLDER_ID&&(N.current.add(e.id),j(new Set(N.current)))},[f]);return(0,ew.jsxs)("div",{className:"fixed inset-0 z-10 flex overflow-hidden bg-background safe-area-left safe-area-right py-safe-kb",style:{height:"var(--vv-height, calc(100% - var(--vv-offset-top, 0px)))",top:"var(--vv-offset-top, 0px)"},children:[(0,ew.jsx)("a",{href:"#chat-message-input",className:"sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-50 focus:rounded-lg focus:bg-gray-900 focus:px-3 focus:py-2 focus:text-sm focus:text-white dark:focus:bg-gray-100 dark:focus:text-gray-900",children:n("a11y.skipToInput")}),(0,ew.jsx)("button",{type:"button",onClick:()=>{let e=document.querySelectorAll("[data-turn-heading]");e[e.length-1]?.focus()},className:"sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-12 focus:z-50 focus:rounded-lg focus:bg-gray-900 focus:px-3 focus:py-2 focus:text-sm focus:text-white dark:focus:bg-gray-100 dark:focus:text-gray-900",children:n("a11y.skipToLatest")}),(0,ew.jsx)(e$.Sidebar,{folders:p,conversations:c,activeConversationId:x,currentFolderId:f,expandedFolderId:y,isOpen:i,collapsed:l,onClose:()=>a(!1),onToggleCollapse:u,onNewChat:Z,onExpandFolder:b,onSelectFolder:eu,onCreateFolder:ei,onRenameFolder:ea,onMoveFolder:es,onUpdateFolderInstructions:eo,onDeleteFolder:el,onSelectConversation:q,onDeleteConversation:V,onRenameConversation:J,onMoveConversation:G,onToggleStar:X,onClearFolderConversations:K,onClearAllContents:W,onShareConversation:er}),(0,ew.jsxs)("main",{className:"relative flex flex-1 flex-col overflow-hidden",children:[(0,ew.jsx)("h1",{className:"sr-only",children:(e=c.find(e=>e.id===x)?.title)?n("a11y.conversationTitle",{title:e}):n("a11y.newConversation")}),(0,ew.jsx)(R3,{emptyStateKey:o,onToggleSidebar:()=>a(!0),sidebarCollapsed:l,onNewChat:Z,onTogglePiiLock:ec,currentFolderId:f,currentFolder
194Name:ed,conversationTitle:eh?.title??null,folderPath:ep,onSelectFolder:eu,piiLockEnabled:F,activeConversationId:x,isShortcutChat:"shortcut"===ef,viaShortcutSlot:x?M.get(x)??null:null,isShortcutIntro:!!x&&D.has(x),onConversationCreated:em,onTitleGenerated:(e,t)=>{d(r=>r.map(r=>r.id===e?{...r,title:t}:r))},onShare:()=>{if(x&&M.has(x)){O(e=>{if(!e.has(x))return e;let t=new Map(e);return t.delete(x),t}),R(e=>{if(!e.has(x))return e;let t=new Set(e);return t.delete(x),t}),er(x);return}if(f===Rw.TEMP_FOLDER_ID){Q(r("notShareableInMode",{mode:t("temporaryChat")})),setTimeout(()=>Q(null),3e3);return}x&&er(x)},isTemporaryChat:"temporary"===ef,onShareMessage:en,starred:eh?.starred??!1,onToggleStar:x?()=>X(x,!eh?.starred):void 0,onRename:x?e=>J(x,e):void 0,onDelete:x?()=>V(x):void 0,onMove:eh?()=>et({id:eh.id,currentFolderId:eh.folderId}):void 0,initialDraft:eh?.draft??null,onDraftChanged:(e,t)=>{d(r=>r.map(r=>r.id===e?{...r,draft:t}:r))}})]}),(0,ew.jsx)(eE.AnimatePresence,{children:Y&&(0,ew.jsx)(eC.motion.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"pointer-events-none fixed inset-0 z-50 flex items-center justify-center px-4",children:(0,ew.jsx)("div",{className:"max-w-[calc(100vw-2rem)] rounded-lg bg-gray-800 px-4 py-2 text-center text-sm leading-snug text-white shadow-lg sm:max-w-sm dark:bg-gray-200 dark:text-gray-900",children:Y})},"share-toast")}),w&&(0,ew.jsx)(Od,{content:S,mode:"temporary",onSave:()=>_(!1),onCancel:()=>_(!1)}),ee&&(0,ew.jsx)(R8.MoveToDialog,{open:!0,itemId:ee.id,itemType:"conversation",currentFolderId:ee.currentFolderId,folders:p,onClose:()=>et(null),onMove:e=>{G(ee.id,e),et(null)}})]})}var Ps=e.i(622159);e.i(125523);var Pl=e.i(756801),Pu=e.i(433264),Pc=e.i(279995),Pd=e.i(622165);function Pp(){return(0,ew.jsx)(Ps.LanguageSwitcher,{variant:"onPhoto",align:"up"})}function Ph(){let e=(0,yC.useRouter)(),t=(0,eS.useTranslations)("landing"),r=(0,eS.useTranslations)("common"),n=(0,eS.useTranslations)("nav"),i=t("welcome"),a=t("welcomeEnglishFallback");return(0,ew.jsxs)("div",{className:"fixed inset-0 z-10 overflow-hidden bg-[#003399]",children:[(0,ew.jsx)(Pc.EuCelebration,{backgroundMode:!0,ringRadius:"clamp(120px, 36vw, 320px)"}),(0,ew.jsxs)("header",{className:"absolute left-safe right-safe top-safe z-20 grid grid-cols-[1fr_auto_1fr] items-center px-6 py-5",children:[(0,ew.jsx)("div",{"aria-hidden":!0}),(0,ew.jsxs)("span",{className:"flex items-center gap-2 justify-self-center",style:{filter:"drop-shadow(0 0 8px rgba(255,255,255,0.38)) drop-shadow(0 0 18px rgba(255,204,0,0.2))"},children:[(0,ew.jsx)(Pl.LogoIcon,{className:"h-9 w-9 text-white"}),(0,ew.jsx)("span",{className:"text-lg font-semibold text-white",children:"GDPRchat"})]}),(0,ew.jsx)("div",{"aria-hidden":!0})]}),(0,ew.jsxs)("main",{className:"absolute inset-0 z-10 grid grid-rows-[minmax(0,1fr)_auto_minmax(0,1fr)] justify-items-center",children:[(0,ew.jsx)("div",{className:"flex w-full items-start justify-center px-6 pt-[calc(6rem+var(--safe-top))] text-center sm:items-end sm:pt-0 sm:pb-8",children:(0,ew.jsx)("h1",{className:"max-w-5xl text-3xl font-semibold tracking-tight text-balance text-white sm:text-4xl md:text-5xl lg:text-6xl",children:i})}),(0,ew.jsx)("button",{type:"button",onClick:()=>e.push("/login"),style:{background:"#FFCC00",color:"#003399",borderRadius:"999px",fontWeight:800,fontSize:"16px",letterSpacing:".02em",minHeight:"44px",minWidth:"96px",padding:"0 26px",boxShadow:"0 8px 26px rgba(0,0,0,0.30)",border:0,cursor:"pointer",transition:"transform 120ms ease, box-shadow 120ms ease"},className:"relative z-10 shrink-0 can-hover:hover:-translate-y-px hover:shadow-[0_12px_30px_rgba(0,0,0,0.38)] active:translate-y-px active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FFCC00] focus-visible:ring-offset-2 focus-visible:ring-offset-[#003399]",children:r("signIn")}),(0,ew.jsx)("div",{className:"flex w-full items-start justify-center px-6 pt-6 text-center sm:pt-8",children:(0,ew.jsx)("ul",{className:"flex max-w-3xl flex-col items-center justify-center gap-y-1 text-xs text-white/90 sm:flex-row sm:flex-wrap sm:gap-x-4 sm:text-sm md:text-lg",children:[t("proofEuropean"),t("proofChatsStayInEu"),t("proofNoTraining"),t("proofDevicesLanguages")].map((e,t)=>(0,ew.jsxs)("li",{className:"flex items-center gap-4",children:[t>
1940&&(0,ew.jsx)("span",{"aria-hidden":!0,className:"hidden text-white/40 sm:inline",children:"·"}),e]},e))})})]}),(0,ew.jsxs)("div",{className:"absolute bottom-safe left-safe right-safe z-20 flex flex-col items-center",children:[(0,ew.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-6 pb-3 text-center sm:flex-row sm:gap-3",children:[i!==a&&(0,ew.jsx)("p",{"aria-hidden":!0,className:"text-sm text-white/60",children:a}),(0,ew.jsx)(Pp,{})]}),(0,ew.jsxs)("button",{type:"button",onClick:()=>e.push(Pd.BUSINESS_ROUTE),className:"pb-2 text-sm text-white/70 underline underline-offset-2 transition-colors hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FFCC00]",children:[n("tryTeamPlans"),"â"]}),(0,ew.jsx)(Pu.LegalFooter,{variant:"onBlack"})]})]})}e.s(["HomeGate",0,function({authed:e}){let[t,r]=(0,e_.useState)(!1);return((0,e_.useEffect)(()=>{r(!0)},[]),e)?t?(0,ew.jsx)(Po,{}):null:(0,ew.jsx)(Ph,{})}],93987)},619663,e=>{"use strict";var t=e.i(271645),r=e.i(526732);e.s(["StaleSessionCleanup",0,function(){let e=(0,t.useRef)(!1);return(0,t.useEffect)(()=>{e.current||(e.current=!0,(0,r.signOut)({redirect:!1}).catch(()=>{}))},[]),null}])}]);
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.