UNPKG

jimp

Version:

An image processing library written entirely in JavaScript.

235 lines • 742 kB
var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),i}"undefined"==typeof self&&"object"==typeof t&&(t.self=t);var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=[],a=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function h(){s=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)n[e]=t[e],a[t.charCodeAt(e)]=e;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63}function l(t,e,i){for(var r,a,o=[],s=e;s<i;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(n[(a=r)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}function u(t){var e;s||h();for(var i=t.length,r=i%3,a="",o=[],u=16383,c=0,f=i-r;c<f;c+=u)o.push(l(t,c,c+u>f?f:c+u));return 1===r?(e=t[i-1],a+=n[e>>2],a+=n[e<<4&63],a+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],a+=n[e>>10],a+=n[e>>4&63],a+=n[e<<2&63],a+="="),o.push(a),o.join("")}function c(t,e,i,r,n){var a,o,s=8*n-r-1,h=(1<<s)-1,l=h>>1,u=-7,c=i?n-1:0,f=i?-1:1,d=t[e+c];for(c+=f,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+t[e+c],c+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+t[e+c],c+=f,u-=8);if(0===a)a=1-l;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),a-=l}return(d?-1:1)*o*Math.pow(2,a-r)}function f(t,e,i,r,n,a){var o,s,h,l=8*a-n-1,u=(1<<l)-1,c=u>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=u?(s=0,o=u):o+c>=1?(s=(e*h-1)*Math.pow(2,n),o+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[i+d]=255&s,d+=p,s/=256,n-=8);for(o=o<<n|s,l+=n;l>0;t[i+d]=255&o,d+=p,o/=256,l-=8);t[i+d-p]|=128*m}var d={}.toString,p=Array.isArray||function(t){return"[object Array]"==d.call(t)};function m(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,e){if(m()<e)throw new RangeError("Invalid typed array length");return _.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=_.prototype:(null===t&&(t=new _(e)),t.length=e),t}function _(t,e,i){if(!(_.TYPED_ARRAY_SUPPORT||this instanceof _))return new _(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return w(this,t)}return b(this,t,e,i)}function b(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r);_.TYPED_ARRAY_SUPPORT?(t=e).__proto__=_.prototype:t=v(t,e);return t}(t,e,i,r):"string"==typeof e?function(t,e,i){"string"==typeof i&&""!==i||(i="utf8");if(!_.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|E(e,i);t=g(t,r);var n=t.write(e,i);n!==r&&(t=t.slice(0,n));return t}(t,e,i):function(t,e){if(k(e)){var i=0|x(e.length);return 0===(t=g(t,i)).length||e.copy(t,0,0,i),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?g(t,0):v(t,e);if("Buffer"===e.type&&p(e.data))return v(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function y(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function w(t,e){if(y(e),t=g(t,e<0?0:0|x(e)),!_.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function v(t,e){var i=e.length<0?0:0|x(e.length);t=g(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function x(t){if(t>=m())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+m().toString(16)+" bytes");return 0|t}function k(t){return!(null==t||!t._isBuffer)}function E(t,e){if(k(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return Q(t).length;default:if(r)return X(t).length;e=(""+e).toLowerCase(),r=!0}}function S(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,i);case"utf8":case"utf-8":return L(this,e,i);case"ascii":return U(this,e,i);case"latin1":case"binary":return F(this,e,i);case"base64":return C(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function M(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function A(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=_.from(e,r)),k(e))return 0===e.length?-1:I(t,e,i,r,n);if("number"==typeof e)return e&=255,_.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):I(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function I(t,e,i,r,n){var a,o=1,s=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,s/=2,h/=2,i/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var u=-1;for(a=i;a<s;a++)if(l(t,a)===l(e,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===h)return u*o}else-1!==u&&(a-=a-u),u=-1}else for(i+h>s&&(i=s-h),a=i;a>=0;a--){for(var c=!0,f=0;f<h;f++)if(l(t,a+f)!==l(e,f)){c=!1;break}if(c)return a}return-1}function z(t,e,i,r){i=Number(i)||0;var n=t.length-i;r?(r=Number(r))>n&&(r=n):r=n;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(e.substr(2*o,2),16);if(isNaN(s))return o;t[i+o]=s}return o}function P(t,e,i,r){return tt(X(e,t.length-i),t,i,r)}function T(t,e,i,r){return tt(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function R(t,e,i,r){return T(t,e,i,r)}function O(t,e,i,r){return tt(Q(e),t,i,r)}function B(t,e,i,r){return tt(function(t,e){for(var i,r,n,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=(i=t.charCodeAt(o))>>8,n=i%256,a.push(n),a.push(r);return a}(e,t.length-i),t,i,r)}function C(t,e,i){return 0===e&&i===t.length?u(t):u(t.slice(e,i))}function L(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n<i;){var a,o,s,h,l=t[n],u=null,c=l>239?4:l>223?3:l>191?2:1;if(n+c<=i)switch(c){case 1:l<128&&(u=l);break;case 2:128==(192&(a=t[n+1]))&&(h=(31&l)<<6|63&a)>127&&(u=h);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(h=(15&l)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(u=h)}null===u?(u=65533,c=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),n+=c}return function(t){var e=t.length;if(e<=D)return String.fromCharCode.apply(String,t);var i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=D));return i}(r)}_.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT,m(),_.poolSize=8192,_._augment=function(t){return t.__proto__=_.prototype,t},_.from=function(t,e,i){return b(null,t,e,i)},_.TYPED_ARRAY_SUPPORT&&(_.prototype.__proto__=Uint8Array.prototype,_.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&_[Symbol.species]),_.alloc=function(t,e,i){return function(t,e,i,r){return y(e),e<=0?g(t,e):void 0!==i?"string"==typeof r?g(t,e).fill(i,r):g(t,e).fill(i):g(t,e)}(null,t,e,i)},_.allocUnsafe=function(t){return w(null,t)},_.allocUnsafeSlow=function(t){return w(null,t)},_.isBuffer=function(t){return null!=t&&(!!t._isBuffer||et(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&et(t.slice(0,0))}(t))},_.compare=function(t,e){if(!k(t)||!k(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,a=Math.min(i,r);n<a;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:r<i?1:0},_.isEncoding=function(t){switch(String(t).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}},_.concat=function(t,e){if(!p(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return _.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=_.allocUnsafe(e),n=0;for(i=0;i<t.length;++i){var a=t[i];if(!k(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,n),n+=a.length}return r},_.byteLength=E,_.prototype._isBuffer=!0,_.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)M(this,e,e+1);return this},_.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this},_.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this},_.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?L(this,0,t):S.apply(this,arguments)},_.prototype.equals=function(t){if(!k(t))throw new TypeError("Argument must be a Buffer");return this===t||0===_.compare(this,t)},_.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},_.prototype.compare=function(t,e,i,r,n){if(!k(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(e>>>=0),s=Math.min(a,o),h=this.slice(r,n),l=t.slice(e,i),u=0;u<s;++u)if(h[u]!==l[u]){a=h[u],o=l[u];break}return a<o?-1:o<a?1:0},_.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},_.prototype.indexOf=function(t,e,i){return A(this,t,e,i,!0)},_.prototype.lastIndexOf=function(t,e,i){return A(this,t,e,i,!1)},_.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-e;if((void 0===i||i>n)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return z(this,t,e,i);case"utf8":case"utf-8":return P(this,t,e,i);case"ascii":return T(this,t,e,i);case"latin1":case"binary":return R(this,t,e,i);case"base64":return O(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,i);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var D=4096;function U(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(127&t[n]);return r}function F(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}function N(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var n="",a=e;a<i;++a)n+=K(t[a]);return n}function j(t,e,i){for(var r=t.slice(e,i),n="",a=0;a<r.length;a+=2)n+=String.fromCharCode(r[a]+256*r[a+1]);return n}function G(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function Z(t,e,i,r,n,a){if(!k(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<a)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function H(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,a=Math.min(t.length-i,2);n<a;++n)t[i+n]=(e&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function $(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,a=Math.min(t.length-i,4);n<a;++n)t[i+n]=e>>>8*(r?n:3-n)&255}function W(t,e,i,r,n,a){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function q(t,e,i,r,n){return n||W(t,0,i,4),f(t,e,i,r,23,4),i+4}function Y(t,e,i,r,n){return n||W(t,0,i,8),f(t,e,i,r,52,8),i+8}_.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),_.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=_.prototype;else{var n=e-t;i=new _(n,void 0);for(var a=0;a<n;++a)i[a]=this[a+t]}return i},_.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||G(t,e,this.length);for(var r=this[t],n=1,a=0;++a<e&&(n*=256);)r+=this[t+a]*n;return r},_.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||G(t,e,this.length);for(var r=this[t+--e],n=1;e>0&&(n*=256);)r+=this[t+--e]*n;return r},_.prototype.readUInt8=function(t,e){return e||G(t,1,this.length),this[t]},_.prototype.readUInt16LE=function(t,e){return e||G(t,2,this.length),this[t]|this[t+1]<<8},_.prototype.readUInt16BE=function(t,e){return e||G(t,2,this.length),this[t]<<8|this[t+1]},_.prototype.readUInt32LE=function(t,e){return e||G(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},_.prototype.readUInt32BE=function(t,e){return e||G(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},_.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||G(t,e,this.length);for(var r=this[t],n=1,a=0;++a<e&&(n*=256);)r+=this[t+a]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*e)),r},_.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||G(t,e,this.length);for(var r=e,n=1,a=this[t+--r];r>0&&(n*=256);)a+=this[t+--r]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},_.prototype.readInt8=function(t,e){return e||G(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},_.prototype.readInt16LE=function(t,e){e||G(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},_.prototype.readInt16BE=function(t,e){e||G(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},_.prototype.readInt32LE=function(t,e){return e||G(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},_.prototype.readInt32BE=function(t,e){return e||G(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},_.prototype.readFloatLE=function(t,e){return e||G(t,4,this.length),c(this,t,!0,23,4)},_.prototype.readFloatBE=function(t,e){return e||G(t,4,this.length),c(this,t,!1,23,4)},_.prototype.readDoubleLE=function(t,e){return e||G(t,8,this.length),c(this,t,!0,52,8)},_.prototype.readDoubleBE=function(t,e){return e||G(t,8,this.length),c(this,t,!1,52,8)},_.prototype.writeUIntLE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||Z(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,a=0;for(this[e]=255&t;++a<i&&(n*=256);)this[e+a]=t/n&255;return e+i},_.prototype.writeUIntBE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||Z(this,t,e,i,Math.pow(2,8*i)-1,0);var n=i-1,a=1;for(this[e+n]=255&t;--n>=0&&(a*=256);)this[e+n]=t/a&255;return e+i},_.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,1,255,0),_.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},_.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):H(this,t,e,!0),e+2},_.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):H(this,t,e,!1),e+2},_.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):$(this,t,e,!0),e+4},_.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):$(this,t,e,!1),e+4},_.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);Z(this,t,e,i,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a<i&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o|0)-s&255;return e+i},_.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);Z(this,t,e,i,n-1,-n)}var a=i-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o|0)-s&255;return e+i},_.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,1,127,-128),_.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},_.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):H(this,t,e,!0),e+2},_.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):H(this,t,e,!1),e+2},_.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,4,2147483647,-2147483648),_.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):$(this,t,e,!0),e+4},_.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||Z(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):$(this,t,e,!1),e+4},_.prototype.writeFloatLE=function(t,e,i){return q(this,t,e,!0,i)},_.prototype.writeFloatBE=function(t,e,i){return q(this,t,e,!1,i)},_.prototype.writeDoubleLE=function(t,e,i){return Y(this,t,e,!0,i)},_.prototype.writeDoubleBE=function(t,e,i){return Y(this,t,e,!1,i)},_.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var n,a=r-i;if(this===t&&i<e&&e<r)for(n=a-1;n>=0;--n)t[n+e]=this[n+i];else if(a<1e3||!_.TYPED_ARRAY_SUPPORT)for(n=0;n<a;++n)t[n+e]=this[n+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+a),e);return a},_.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!_.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var a;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(a=e;a<i;++a)this[a]=t;else{var o=k(t)?t:X(new _(t,r).toString()),s=o.length;for(a=0;a<i-e;++a)this[a+e]=o[a%s]}return this};var V,J=/[^+\/0-9A-Za-z-_]/g;function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function X(t,e){var i;e=e||1/0;for(var r=t.length,n=null,a=[],o=0;o<r;++o){if((i=t.charCodeAt(o))>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&a.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&a.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;a.push(i)}else if(i<2048){if((e-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function Q(t){return function(t){var e,i,r,n,l,u;s||h();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");l="="===t[c-2]?2:"="===t[c-1]?1:0,u=new o(3*c/4-l),r=l>0?c-4:c;var f=0;for(e=0,i=0;e<r;e+=4,i+=3)n=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],u[f++]=n>>16&255,u[f++]=n>>8&255,u[f++]=255&n;return 2===l?(n=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,u[f++]=255&n):1===l&&(n=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,u[f++]=n>>8&255,u[f++]=255&n),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(J,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function tt(t,e,i,r){for(var n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function et(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}!function(t){t[t.BITMAP_INFO_HEADER=40]="BITMAP_INFO_HEADER",t[t.BITMAP_V2_INFO_HEADER=52]="BITMAP_V2_INFO_HEADER",t[t.BITMAP_V3_INFO_HEADER=56]="BITMAP_V3_INFO_HEADER",t[t.BITMAP_V4_HEADER=108]="BITMAP_V4_HEADER",t[t.BITMAP_V5_HEADER=124]="BITMAP_V5_HEADER"}(V||(V={}));var it,rt=V;!function(t){t[t.NONE=0]="NONE",t[t.BI_RLE8=1]="BI_RLE8",t[t.BI_RLE4=2]="BI_RLE4",t[t.BI_BIT_FIELDS=3]="BI_BIT_FIELDS",t[t.BI_ALPHA_BIT_FIELDS=6]="BI_ALPHA_BIT_FIELDS"}(it||(it={}));class nt{flag;fileSize;reserved1;reserved2;offset;headerSize;width;height;planes;bitPP;compression;rawSize;hr;vr;colors;importantColors;palette;data;maskRed;maskGreen;maskBlue;maskAlpha;toRGBA;pos;bottomUp;buffer;locRed;locGreen;locBlue;locAlpha;shiftRed;shiftGreen;shiftBlue;shiftAlpha;constructor(t,{toRGBA:e}={toRGBA:!1}){if(this.buffer=t,this.toRGBA=!!e,this.pos=0,this.bottomUp=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!==this.flag)throw new Error("Invalid BMP File");this.locRed=this.toRGBA?0:3,this.locGreen=this.toRGBA?1:2,this.locBlue=this.toRGBA?2:1,this.locAlpha=this.toRGBA?3:0,this.parseHeader(),this.parseRGBA()}parseHeader(){if(this.fileSize=this.readUInt32LE(),this.reserved1=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.reserved2=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.offset=this.readUInt32LE(),this.headerSize=this.readUInt32LE(),!(this.headerSize in rt))throw new Error(`Unsupported BMP header size ${this.headerSize}`);if(this.width=this.readUInt32LE(),this.height=this.readUInt32LE(),this.height=this.height>2147483647?this.height-4294967296:this.height,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compression=this.readUInt32LE(),this.rawSize=this.readUInt32LE(),this.hr=this.readUInt32LE(),this.vr=this.readUInt32LE(),this.colors=this.readUInt32LE(),this.importantColors=this.readUInt32LE(),32===this.bitPP?(this.maskAlpha=0,this.maskRed=16711680,this.maskGreen=65280,this.maskBlue=255):16===this.bitPP&&(this.maskAlpha=0,this.maskRed=31744,this.maskGreen=992,this.maskBlue=31),(this.headerSize>rt.BITMAP_INFO_HEADER||this.compression===it.BI_BIT_FIELDS||this.compression===it.BI_ALPHA_BIT_FIELDS)&&(this.maskRed=this.readUInt32LE(),this.maskGreen=this.readUInt32LE(),this.maskBlue=this.readUInt32LE()),(this.headerSize>rt.BITMAP_V2_INFO_HEADER||this.compression===it.BI_ALPHA_BIT_FIELDS)&&(this.maskAlpha=this.readUInt32LE()),this.headerSize>rt.BITMAP_V3_INFO_HEADER&&(this.pos+=rt.BITMAP_V4_HEADER-rt.BITMAP_V3_INFO_HEADER),this.headerSize>rt.BITMAP_V4_HEADER&&(this.pos+=rt.BITMAP_V5_HEADER-rt.BITMAP_V4_HEADER),this.bitPP<=8||this.colors>0){const t=0===this.colors?1<<this.bitPP:this.colors;this.palette=new Array(t);for(let e=0;e<t;e++){const t=this.buffer.readUInt8(this.pos++),i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++);this.palette[e]={red:r,green:i,blue:t,quad:n}}}this.height<0&&(this.height*=-1,this.bottomUp=!1);const t=function(t,e,i,r){const n=1+~t&t,a=1+~e&e,o=1+~i&i,s=1+~r&r,h=t/n+1,l=e/a+1,u=i/o+1,c=r/s+1;return{shiftRed:e=>(e&t)/n*256/h,shiftGreen:t=>(t&e)/a*256/l,shiftBlue:t=>(t&i)/o*256/u,shiftAlpha:0!==r?t=>(t&r)/s*256/c:()=>255}}(this.maskRed,this.maskGreen,this.maskBlue,this.maskAlpha);this.shiftRed=t.shiftRed,this.shiftGreen=t.shiftGreen,this.shiftBlue=t.shiftBlue,this.shiftAlpha=t.shiftAlpha}parseRGBA(){switch(this.data=_.alloc(this.width*this.height*4),this.bitPP){case 1:this.bit1();break;case 4:this.bit4();break;case 8:this.bit8();break;case 16:this.bit16();break;case 24:this.bit24();break;default:this.bit32()}}bit1(){const t=Math.ceil(this.width/8),e=t%4,i=0!==e?4-e:0;this.scanImage(i,t,((t,e)=>{const i=this.buffer.readUInt8(this.pos++),r=e*this.width*4+8*t*4;for(let e=0;e<8&&8*t+e<this.width;e++){const t=this.palette[i>>7-e&1];this.data[r+e*this.locAlpha]=0,this.data[r+4*e+this.locBlue]=t.blue,this.data[r+4*e+this.locGreen]=t.green,this.data[r+4*e+this.locRed]=t.red}}))}bit4(){if(this.compression===it.BI_RLE4){this.data.fill(0);let t=!1,e=this.bottomUp?this.height-1:0,i=0;for(;i<this.data.length;){const r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++);if(0===r){if(0===n){e+=this.bottomUp?-1:1,i=e*this.width*4,t=!1;continue}if(1===n)break;if(2===n){const t=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++);e+=this.bottomUp?-r:r,i+=r*this.width*4+4*t}else{let e=this.buffer.readUInt8(this.pos++);for(let r=0;r<n;r++)i=this.setPixelData(i,t?15&e:(240&e)>>4),1&r&&r+1<n&&(e=this.buffer.readUInt8(this.pos++)),t=!t;1==(n+1>>1&1)&&this.pos++}}else for(let e=0;e<r;e++)i=this.setPixelData(i,t?15&n:(240&n)>>4),t=!t}}else{const t=Math.ceil(this.width/2),e=t%4,i=0!==e?4-e:0;this.scanImage(i,t,((t,e)=>{const i=this.buffer.readUInt8(this.pos++),r=e*this.width*4+2*t*4,n=i>>4;let a=this.palette[n];if(this.data[r]=0,this.data[r+1]=a.blue,this.data[r+2]=a.green,this.data[r+3]=a.red,2*t+1>=this.width)return!1;const o=15&i;a=this.palette[o],this.data[r+4]=0,this.data[r+4+1]=a.blue,this.data[r+4+2]=a.green,this.data[r+4+3]=a.red}))}}bit8(){if(this.compression===it.BI_RLE8){this.data.fill(0);let t=this.bottomUp?this.height-1:0,e=0;for(;e<this.data.length;){const i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++);if(0===i){if(0===r){t+=this.bottomUp?-1:1,e=t*this.width*4;continue}if(1===r)break;if(2===r){const i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++);t+=this.bottomUp?-r:r,e+=r*this.width*4+4*i}else{for(let t=0;t<r;t++){const t=this.buffer.readUInt8(this.pos++);e=this.setPixelData(e,t)}!0&r&&this.pos++}}else for(let t=0;t<i;t++)e=this.setPixelData(e,r)}}else{const t=this.width%4,e=0!==t?4-t:0;this.scanImage(e,this.width,((t,e)=>{const i=this.buffer.readUInt8(this.pos++),r=e*this.width*4+4*t;if(i<this.palette.length){const t=this.palette[i];this.data[r]=0,this.data[r+1]=t.blue,this.data[r+2]=t.green,this.data[r+3]=t.red}else this.data[r]=0,this.data[r+1]=255,this.data[r+2]=255,this.data[r+3]=255}))}}bit16(){const t=this.width%2*2;this.scanImage(t,this.width,((t,e)=>{const i=e*this.width*4+4*t,r=this.buffer.readUInt16LE(this.pos);this.pos+=2,this.data[i+this.locRed]=this.shiftRed(r),this.data[i+this.locGreen]=this.shiftGreen(r),this.data[i+this.locBlue]=this.shiftBlue(r),this.data[i+this.locAlpha]=this.shiftAlpha(r)}))}bit24(){const t=this.width%4;this.scanImage(t,this.width,((t,e)=>{const i=e*this.width*4+4*t,r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),a=this.buffer.readUInt8(this.pos++);this.data[i+this.locRed]=a,this.data[i+this.locGreen]=n,this.data[i+this.locBlue]=r,this.data[i+this.locAlpha]=0}))}bit32(){this.scanImage(0,this.width,((t,e)=>{const i=e*this.width*4+4*t,r=this.readUInt32LE();this.data[i+this.locRed]=this.shiftRed(r),this.data[i+this.locGreen]=this.shiftGreen(r),this.data[i+this.locBlue]=this.shiftBlue(r),this.data[i+this.locAlpha]=this.shiftAlpha(r)}))}scanImage(t=0,e=this.width,i){for(let r=this.height-1;r>=0;r--){const n=this.bottomUp?r:this.height-1-r;for(let t=0;t<e;t++){if(!1===i.call(this,t,n))return}this.pos+=t}}readUInt32LE(){const t=this.buffer.readUInt32LE(this.pos);return this.pos+=4,t}setPixelData(t,e){const{blue:i,green:r,red:n}=this.palette[e];return this.data[t+this.locAlpha]=0,this.data[t+1+this.locBlue]=i,this.data[t+2+this.locGreen]=r,this.data[t+3+this.locRed]=n,t+4}}function at(t){return t.reduce(((t,e)=>t<<1|e),0)}function ot(t){return t.quad<<24|t.red<<16|t.green<<8|t.blue}class st{fileSize;reserved1;reserved2;offset;width;flag;height;planes;bitPP;compress;hr;vr;colors;importantColors;rawSize;headerSize;data;palette;extraBytes;buffer;bytesInColor;pos;constructor(t){switch(this.buffer=t.data,this.width=t.width,this.height=t.height,this.headerSize=rt.BITMAP_INFO_HEADER,this.flag="BM",this.bitPP=t.bitPP||24,this.offset=54,this.reserved1=t.reserved1||0,this.reserved2=t.reserved2||0,this.planes=1,this.compress=0,this.hr=t.hr||0,this.vr=t.vr||0,this.importantColors=t.importantColors||0,this.colors=Math.min(2**(this.bitPP-1||1),t.colors||1/0),this.palette=t.palette||[],this.colors&&this.bitPP<16?this.offset+=4*this.colors:this.colors=0,this.bitPP){case 32:this.bytesInColor=4;break;case 16:this.bytesInColor=2;break;case 8:this.bytesInColor=1;break;case 4:this.bytesInColor=.5;break;case 1:this.bytesInColor=1/8;break;default:this.bytesInColor=3,this.bitPP=24}const e=this.width*this.bitPP/32,i=Math.ceil(e);this.extraBytes=4*(i-e),this.rawSize=this.height*i*4+2,this.fileSize=this.rawSize+this.offset,this.data=_.alloc(this.fileSize,1),this.pos=0,this.encode()}encode(){switch(this.pos=0,this.writeHeader(),this.bitPP){case 32:this.bit32();break;case 16:this.bit16();break;case 8:this.bit8();break;case 4:this.bit4();break;case 1:this.bit1();break;default:this.bit24()}}writeHeader(){this.data.write(this.flag,this.pos,2),this.pos+=2,this.writeUInt32LE(this.fileSize),this.writeUInt32LE(this.reserved1<<16|this.reserved2),this.writeUInt32LE(this.offset),this.writeUInt32LE(this.headerSize),this.writeUInt32LE(this.width),this.writeUInt32LE(this.height),this.data.writeUInt16LE(this.planes,this.pos),this.pos+=2,this.data.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,this.writeUInt32LE(this.compress),this.writeUInt32LE(this.rawSize),this.writeUInt32LE(this.hr),this.writeUInt32LE(this.vr),this.writeUInt32LE(this.colors),this.writeUInt32LE(this.importantColors)}bit1(){this.palette.length&&2===this.colors?this.initColors(1):(this.writeUInt32LE(16777215),this.writeUInt32LE(0)),this.pos+=1;let t=[];this.writeImage(((e,i,r)=>{let n=i;n++;const a=this.buffer[n++],o=this.buffer[n++],s=.2126*this.buffer[n++]+.7152*o+.0722*a;return t.push(s>127?0:1),(r+1)%8==0?(this.data[e-1]=at(t),t=[]):r===this.width-1&&t.length>0&&(this.data[e-1]=at(t)<<4,t=[]),n}))}bit4(){const t=this.initColors(4);let e=[];this.writeImage(((i,r,n)=>{let a=r;const o=ot({quad:this.buffer[a++],blue:this.buffer[a++],green:this.buffer[a++],red:this.buffer[a++]}),s=t.findIndex((t=>t===o));return-1!==s?e.push(s):e.push(0),(n+1)%2==0&&(this.data[i]=e[0]<<4|e[1],e=[]),a}))}bit8(){const t=this.initColors(8);this.writeImage(((e,i)=>{let r=i;const n=ot({quad:this.buffer[r++],blue:this.buffer[r++],green:this.buffer[r++],red:this.buffer[r++]}),a=t.findIndex((t=>t===n));return this.data[e]=-1!==a?a:0,r}))}bit16(){this.writeImage(((t,e)=>{let i=e+1;const r=this.buffer[i++]/8,n=this.buffer[i++]/8,a=this.buffer[i++]/8<<10|n<<5|r;return this.data[t]=255&a,this.data[t+1]=(65280&a)>>8,i}))}bit24(){this.writeImage(((t,e)=>{let i=e+1;return this.data[t]=this.buffer[i++],this.data[t+1]=this.buffer[i++],this.data[t+2]=this.buffer[i++],i}))}bit32(){this.writeImage(((t,e)=>{let i=e;return this.data[t+3]=this.buffer[i++],this.data[t]=this.buffer[i++],this.data[t+1]=this.buffer[i++],this.data[t+2]=this.buffer[i++],i}))}writeImage(t){const e=this.extraBytes+this.width*this.bytesInColor;let i=0;for(let r=0;r<this.height;r++)for(let n=0;n<this.width;n++){const a=Math.floor(this.pos+(this.height-1-r)*e+n*this.bytesInColor);i=t.call(this,a,i,n,r)}}initColors(t){const e=[];if(!this.palette.length)throw new Error(`To encode ${t}-bit BMPs a pallette is needed. Please choose up to ${this.colors} colors. Colors must be 32-bit integers.`);for(let t=0;t<this.colors;t++){const i=ot(this.palette[t]);this.writeUInt32LE(i),e.push(i)}return e}writeUInt32LE(t){this.data.writeUInt32LE(t,this.pos),this.pos+=4}}function ht(t){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ht(t)}var lt=/^\s+/,ut=/\s+$/;function ct(t,e){if(e=e||{},(t=t||"")instanceof ct)return t;if(!(this instanceof ct))return new ct(t,e);var i=function(t){var e={r:0,g:0,b:0},i=1,r=null,n=null,a=null,o=!1,s=!1;"string"==typeof t&&(t=function(t){t=t.replace(lt,"").replace(ut,"").toLowerCase();var e,i=!1;if(It[t])t=It[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=jt.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=jt.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=jt.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=jt.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=jt.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=jt.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=jt.hex8.exec(t))return{r:Ot(e[1]),g:Ot(e[2]),b:Ot(e[3]),a:Dt(e[4]),format:i?"name":"hex8"};if(e=jt.hex6.exec(t))return{r:Ot(e[1]),g:Ot(e[2]),b:Ot(e[3]),format:i?"name":"hex"};if(e=jt.hex4.exec(t))return{r:Ot(e[1]+""+e[1]),g:Ot(e[2]+""+e[2]),b:Ot(e[3]+""+e[3]),a:Dt(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=jt.hex3.exec(t))return{r:Ot(e[1]+""+e[1]),g:Ot(e[2]+""+e[2]),b:Ot(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==ht(t)&&(Gt(t.r)&&Gt(t.g)&&Gt(t.b)?(e=function(t,e,i){return{r:255*Tt(t,255),g:255*Tt(e,255),b:255*Tt(i,255)}}(t.r,t.g,t.b),o=!0,s="%"===String(t.r).substr(-1)?"prgb":"rgb"):Gt(t.h)&&Gt(t.s)&&Gt(t.v)?(r=Ct(t.s),n=Ct(t.v),e=function(t,e,i){t=6*Tt(t,360),e=Tt(e,100),i=Tt(i,100);var r=Math.floor(t),n=t-r,a=i*(1-e),o=i*(1-n*e),s=i*(1-(1-n)*e),h=r%6,l=[i,o,a,a,s,i][h],u=[s,i,i,o,a,a][h],c=[a,a,s,i,i,o][h];return{r:255*l,g:255*u,b:255*c}}(t.h,r,n),o=!0,s="hsv"):Gt(t.h)&&Gt(t.s)&&Gt(t.l)&&(r=Ct(t.s),a=Ct(t.l),e=function(t,e,i){var r,n,a;function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=Tt(t,360),e=Tt(e,100),i=Tt(i,100),0===e)r=n=a=i;else{var s=i<.5?i*(1+e):i+e-i*e,h=2*i-s;r=o(h,s,t+1/3),n=o(h,s,t),a=o(h,s,t-1/3)}return{r:255*r,g:255*n,b:255*a}}(t.h,r,a),o=!0,s="hsl"),t.hasOwnProperty("a")&&(i=t.a));return i=Pt(i),{ok:o,format:t.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:i}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}function ft(t,e,i){t=Tt(t,255),e=Tt(e,255),i=Tt(i,255);var r,n,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)r=n=0;else{var h=a-o;switch(n=s>.5?h/(2-a-o):h/(a+o),a){case t:r=(e-i)/h+(e<i?6:0);break;case e:r=(i-t)/h+2;break;case i:r=(t-e)/h+4}r/=6}return{h:r,s:n,l:s}}function dt(t,e,i){t=Tt(t,255),e=Tt(e,255),i=Tt(i,255);var r,n,a=Math.max(t,e,i),o=Math.min(t,e,i),s=a,h=a-o;if(n=0===a?0:h/a,a==o)r=0;else{switch(a){case t:r=(e-i)/h+(e<i?6:0);break;case e:r=(i-t)/h+2;break;case i:r=(t-e)/h+4}r/=6}return{h:r,s:n,v:s}}function pt(t,e,i,r){var n=[Bt(Math.round(t).toString(16)),Bt(Math.round(e).toString(16)),Bt(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function mt(t,e,i,r){return[Bt(Lt(r)),Bt(Math.round(t).toString(16)),Bt(Math.round(e).toString(16)),Bt(Math.round(i).toString(16))].join("")}function gt(t,e){e=0===e?0:e||10;var i=ct(t).toHsl();return i.s-=e/100,i.s=Rt(i.s),ct(i)}function _t(t,e){e=0===e?0:e||10;var i=ct(t).toHsl();return i.s+=e/100,i.s=Rt(i.s),ct(i)}function bt(t){return ct(t).desaturate(100)}function yt(t,e){e=0===e?0:e||10;var i=ct(t).toHsl();return i.l+=e/100,i.l=Rt(i.l),ct(i)}function wt(t,e){e=0===e?0:e||10;var i=ct(t).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(-e/100*255))),i.g=Math.max(0,Math.min(255,i.g-Math.round(-e/100*255))),i.b=Math.max(0,Math.min(255,i.b-Math.round(-e/100*255))),ct(i)}function vt(t,e){e=0===e?0:e||10;var i=ct(t).toHsl();return i.l-=e/100,i.l=Rt(i.l),ct(i)}function xt(t,e){var i=ct(t).toHsl(),r=(i.h+e)%360;return i.h=r<0?360+r:r,ct(i)}function kt(t){var e=ct(t).toHsl();return e.h=(e.h+180)%360,ct(e)}function Et(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var i=ct(t).toHsl(),r=[ct(t)],n=360/e,a=1;a<e;a++)r.push(ct({h:(i.h+a*n)%360,s:i.s,l:i.l}));return r}function St(t){var e=ct(t).toHsl(),i=e.h;return[ct(t),ct({h:(i+72)%360,s:e.s,l:e.l}),ct({h:(i+216)%360,s:e.s,l:e.l})]}function Mt(t,e,i){e=e||6,i=i||30;var r=ct(t).toHsl(),n=360/i,a=[ct(t)];for(r.h=(r.h-(n*e>>1)+720)%360;--e;)r.h=(r.h+n)%360,a.push(ct(r));return a}function At(t,e){e=e||6;for(var i=ct(t).toHsv(),r=i.h,n=i.s,a=i.v,o=[],s=1/e;e--;)o.push(ct({h:r,s:n,v:a})),a=(a+s)%1;return o}ct.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,r=this.toRgb();return t=r.r/255,e=r.g/255,i=r.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=Pt(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=dt(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=dt(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),r=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+r+"%)":"hsva("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=ft(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ft(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),r=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+r+"%)":"hsla("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return pt(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,r,n){var a=[Bt(Math.round(t).toString(16)),Bt(Math.round(e).toString(16)),Bt(Math.round(i).toString(16)),Bt(Lt(r))];if(n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*Tt(this._r,255))+"%",g:Math.round(100*Tt(this._g,255))+"%",b:Math.round(100*Tt(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*Tt(this._r,255))+"%, "+Math.round(100*Tt(this._g,255))+"%, "+Math.round(100*Tt(this._b,255))+"%)":"rgba("+Math.round(100*Tt(this._r,255))+"%, "+Math.round(100*Tt(this._g,255))+"%, "+Math.round(100*Tt(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(zt[pt(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+mt(this._r,this._g,this._b,this._a),i=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var n=ct(t);i="#"+mt(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return ct(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(yt,arguments)},brighten:function(){return this._applyModification(wt,arguments)},darken:function(){return this._applyModification(vt,arguments)},desaturate:function(){return this._applyModification(gt,arguments)},saturate:function(){return this._applyModification(_t,arguments)},greyscale:function(){return this._applyModification(bt,arguments)},spin:function(){return this._applyModification(xt,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(Mt,arguments)},complement:function(){return this._applyCombination(kt,arguments)},monochromatic:function(){return this._applyCombination(At,arguments)},splitcomplement:function(){return this._applyCombination(St,arguments)},triad:function(){return this._applyCombination(Et,[3])},tetrad:function(){return this._applyCombination(Et,[4])}},ct.fromRatio=function(t,e){if("object"==ht(t)){var i={};for(var r in t)t.hasOwnProperty(r)&&(i[r]="a"===r?t[r]:Ct(t[r]));t=i}return ct(t,e)},ct.equals=function(t,e){return!(!t||!e)&&ct(t).toRgbString()==ct(e).toRgbString()},ct.random=function(){return ct.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},ct.mix=function(t,e,i){i=0===i?0:i||50;var r=ct(t).toRgb(),n=ct(e).toRgb(),a=i/100;return ct({r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a})},ct.readability=function(t,e){var i=ct(t),r=ct(e);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)},ct.isReadable=function(t,e,i){var r,n,a=ct.readability(t,e);switch(n=!1,(r=function(t){var e,i;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),i=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==i&&"large"!==i&&(i="small");return{level:e,size:i}}(i)).level+r.size){case"AAsmall":case"AAAlarge":n=a>=4.5;break;case"AAlarge":n=a>=3;break;case"AAAsmall":n=a>=7}return n},ct.mostReadable=function(t,e,i){var r,n,a,o,s=null,h=0;n=(i=i||{}).includeFallbackColors,a=i.level,o=i.size;for(var l=0;l<e.length;l++)(r=ct.readability(t,e[l]))>h&&(h=r,s=ct(e[l]));return ct.isReadable(t,s,{level:a,size:o})||!n?s:(i.includeFallbackColors=!1,ct.mostReadable(t,["#fff","#000"],i))};var It=ct.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},zt=ct.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(It);function Pt(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Tt(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Rt(t){return Math.min(1,Math.max(0,t))}function Ot(t){return parseInt(t,16)}function Bt(t){return 1==t.length?"0"+t:""+t}function Ct(t){return t<=1&&(t=100*t+"%"),t}function Lt(t){return Math.round(255*parseFloat(t)).toString(16)}function Dt(t){return Ot(t)/255}var Ut,Ft,Nt,jt=(Ft="[\\s|\\(]+("+(Ut="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Ut+")[,|\\s]+("+Ut+")\\s*\\)?",Nt="[\\s|\\(]+("+Ut+")[,|\\s]+("+Ut+")[,|\\s]+("+Ut+")[,|\\s]+("+Ut+")\\s*\\)?",{CSS_UNIT:new RegExp(Ut),rgb:new RegExp("rgb"+Ft),rgba:new RegExp("rgba"+Nt),hsl:new RegExp("hsl"+Ft),hsla:new RegExp("hsla"+Nt),hsv:new RegExp("hsv"+Ft),hsva:new RegExp("hsva"+Nt),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Gt(t){return!!jt.CSS_UNIT.exec(t)}function Zt(t){const e={width:t.bitmap.width,height:t.bitmap.height,data:_.from(t.bitmap.data)};return new t.constructor(e)}function Ht(t,e,i,r,n,a){let o,s,h,l,u;if("function"==typeof e)u=e,o=0,s=0,h=t.bitmap.width,l=t.bitmap.height;else{if(o=e,"number"!=typeof i)throw new Error("y must be a number");if(s=i,"number"!=typeof r)throw new Error("w must be a number");if(h=r,"number"!=typeof n)throw new Error("h must be a number");if(l=n,"function"!=typeof a)throw new Error("cb must be a function");u=a}o=Math.round(o),s=Math.round(s),h=Math.round(h),l=Math.round(l);const c=u.bind(t);for(let e=s;e<s+l;e++)for(let i=o;i<o+h;i++){c(i,e,t.bitmap.width*e+i<<2)}return t}function $t(t){if("number"!=typeof t)throw new Error("i must be a number");const e={r:0,g:0,b:0,a:0};return e.r=Math.floor(t/Math.pow(256,3)),e.g=Math.floor((t-e.r*Math.pow(256,3))/Math.pow(256,2)),e.b=Math.floor((t-e.r*Math.pow(256,3)-e.g*Math.pow(256,2))/Math.pow(256,1)),e.a=Math.floor((t-e.r*Math.pow(256,3)-e.g*Math.pow(256,2)-e.b*Math.pow(256,1))/Math.pow(256,0)),e}function Wt(t,e,i,r){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof i||"number"!=typeof r)throw new Error("r, g, b and a must be numbers");if(t<0||t>255)throw new Error("r must be between 0 and 255");if(e<0||e>255)throw new Error("g must be between 0 and 255");if(i<0||i>255)throw new Error("b must be between 0 and 255");if(r<0||r>255)throw new Error("a must be between 0 and 255");let n=255&t;return n<<=8,n|=255&e,n<<=8,n|=255&i,n<<=8,n|=255&r,n>>>=0,n}function qt(t,e){const i=t=>Math.pow(t,2),{max:r}=Math,n="a"in t?t.a:255,a="a"in e?e.a:255;return(r(i(t.r-e.r),i(t.r-e.r-n+a))+r(i(t.g-e.g),i(t.g-e.g-n+a))+r(i(t.b-e.b),i(t.b-e.b-n+a)))/195075}function Yt(t){return t=Math.max(t,0),t=Math.min(t,255)}function Vt(t){return"number"==typeof t?t:parseInt(ct(t).toHex8(),16)}function Jt(t,e={}){return Ht({bitmap:t},0,0,t.width,t.height,(function(e,i,r){const n=t.data[r+0],a=t.data[r+1],o=t.data[r+2],s=t.data[r+3];t.data[r+0]=s,t.data[r+1]=o,t.data[r+2]=a,t.data[r+3]=n})),(i={...t,...e},new st(i)).data;var i}function Kt(t,e){const i=function(t,e){return new nt(t,e)}(t,e);return Ht({bitmap:i},0,0,i.width,i.height,(function(t,e,r){const n=i.data[r+1],a=i.data[r+2],o=i.data[r+3];i.data[r+0]=o,i.data[r+1]=a,i.data[r+2]=n,i.data[r+3]=255})),i}function Xt(){return{mime:"image/bmp",encode:Jt,decode:Kt}}var Qt={};function te(t,e,i,r){for(var n=t[e++],a=1<<n,o=a+1,s=o+1,h=n+1,l=(1<<h)-1,u=0,c=0,f=0,d=t[e++],p=new Int32Array(4096),m=null;;){for(;u<16&&0!==d;)c|=t[e++]<<u,u+=8,1===d?d=t[e++]:--d;if(u<h)break;var g=c&l;if(c>>=h,u-=h,g!==a){if(g===o)break;for(var _=g<s?g:m,b=0,y=_;y>a;)y=p[y]>>8,++b;var w=y;if(f+b+(_!==g?1:0)>r)return void console.log("Warning, gif stream longer than expected.");i[f++]=w;var v=f+=b;for(_!==g&&(i[f++]=w),y=_;b--;)y=p[y],i[--v]=255&y,y>>=8;null!==m&&s<4096&&(p[s++]=m<<8|w,s>=l+1&&h<12&&(++h,l=l<<1|1)),m=g}else s=o+1,l=(1<<(h=n+1))-1,m=null}return f!==r&&console.log("Warning, gif stream shorter than expected."),i}try{Qt.GifWriter=function(t,e,i,r){var n=0,a=void 0===(r=void 0===r?{}:r).loop?null:r.loop,o=void 0===r.palette?null:r.palette;if(e<=0||i<=0||e>65535||i>65535)throw new Error("Width/Height invalid.");function s(t){var e=t.length;if(e<2||e>256||e&e-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}t[n++]=71,t[n++]=73,t[n++]=70,t[n++]=56,t[n++]=57,t[n++]=97;var h=0,l=0;if(null!==o){for(var u=s(o);u>>=1;)++h;if(u=1<<h,--h,void 0!==r.background){if((l=r.background)>=u)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(t[n++]=255&e,t[n++]=e>>8&255,t[n++]=255&i,t[n++]=i>>8&255,t[n++]=(null!==o?128:0)|h,t[n++]=l,t[n++]=0,null!==o)for(var c=0,f=o.length;c<f;++c){var d=o[c];t[n++]=d>>16&255,t[n++]=d>>8&255,t[n++]=255&d}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");t[n++]=33,t[n++]=255,t[n++]=11,t[n++]=78,t[n++]=69,t[n++]=84,t[n++]=83,t[n++]=67,t[n++]=65,t[n++]=80,t[n++]=69,t[n++]=50,t[n++]=46,t[n++]=48,t[n++]=3,t[n++]=1,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=0}var p=!1;this.addFrame=function(e,i,r,a,h,l){if(!0===p&&(--n,p=!1),l=void 0===l?{}:l,e<0||i<0||e>65535||i>65535)throw new Error("x/y invalid.");if(r<=0||a<=0||r>65535||a>65535)throw new Error("Width/Height invalid.");if(h.length<r*a)throw new Error("Not enough pixels for the frame size.");var u=!0,c=l.palette;if(null==c&&(u=!1,c=o),null==c)throw new Error("Must supply either a local or global palette.");for(var f=s(c),d=0;f>>=1;)++d;f=1<<d;var m=void 0===l.delay?0:l.delay,g=void 0===l.disposal?0:l.disposal;if(g<0||g>3)throw new Error("Disposal out of range.");var _=!1,b=0;if(void 0!==l.transparent&&null!==l.transparent&&(_=!0,(b=l.transparent)<0||b>=f))throw new Error("Transparent color index.");if((0!==g||_||0!==m)&&(t[n++]=33,t[n++]=249,t[n++]=4,t[n++]=g<<2|(!0===_?1:0),t[n++]=255&m,t[n++]=m>>8&255,t[n++]=b,t[n++]=0),t[n++]=44,t[n++]=255&e,t[n++]=e>>8&255,t[n++]=255&i,t[n++]=i>>8&255,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=!0===u?128|d-1:0,!0===u)for(var y=0,w=c.length;y<w;++y){var v=c[y];t[n++]=v>>16&255,t[n++]=v>>8&255,t[n++]=255&v}return n=function(t,e,i,r){t[e++]=i;var n=e++,a=1<<i,o=a-1,s=a+1,h=s+1,l=i+1,u=0,c=0;function f(i){for(;u>=i;)t[e++]=255&c,c>>=8,u-=8,e===n+256&&(t[n]=255,n=e++)}function d(t){c|=t<<u,u+=l,f(8)}var p=r[0]&o,m={};d(a);for(var g=1,_=r.length;g<_;++g){var b=r[g]&o,y=p<<8|b,w=m[y];if(void 0===w){for(c|=p<<u,u+=l;u>=8;)t[e++]=255&c,c>>=8,u-=8,e===n+256&&(t[n]=255,n=e++);4096===h?(d(a),h=s+1,l=i+1,m={}):(h>=1<<l&&++l,m[y]=h++),p=b}else p=w}return d(p),d(s),f(1),n+1===e?t[n]=0:(t[n]=e-n-1,t[e++]=0),e}(t,n,d<2?2:d,h),n},this.end=function(){return!1===p&&(t[n++]=59,p=!0),n},this.getOutputBuffer=function(){return t},this.setOutputBuffer=function(e){t=e},this.getOutputBufferPosition=function(){return n},this.setOutputBufferPosition=function(t){n=t}},Qt.GifReader=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw new Error("Invalid GIF 87a/89a header.");var i=t[e++]|t[e++]<<8,r=t[e++]|t[e++]<<8,n=t[e++],a=n>>7,o=1<<1+(7&n);t[e++],t[e++];var s=null,h=null;a&&(s=e,h=o,e+=3*o);var l=!0,u=[],c=0,f=null,d=0,p=null;for(this.width=i,this.height=r;l&&e<t.length;)switch(t[e++]){case 33:switch(t[e++]){case 255:if(11!==t[e]||78==t[e+1]&&69==t[e+2]&&84==t[e+3]&&83==t[e+4]&&67==t[e+5]&&65==t[e+6]&&80==t[e+7]&&69==t[e+8]&&50==t[e+9]&&46==t[e+10]&&48==t[e+11]&&3==t[e+12]&&1==t[e+13]&&0==t[e+16])e+=14,p=t[e++]|t[e++]<<8,e++;else for(e+=12;;){if(!((A=t[e++])>=0))throw Error("Invalid block size");if(0===A)break;e+=A}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var m=t[e++];c=t[e++]|t[e++]<<8,f=t[e++],1&m||(f=null),d=m>>2&7,e++;break;case 254:for(;;){if(!((A=t[e++])>=0))throw Error("Invalid block size");if(0===A)break;e+=A}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var g=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,w=t[e++],v=w>>6&1,x=1<<1+(7&w),k=s,E=h,S=!1;w>>7&&(S=!0,k=e,E=x,e+=3*x);var M=e;for(e++;;){var A;if(!((A=t[e++])>=0))throw Error("Invalid block size");if(0===A)break;e+=A}u.push({x:g,y:_,width:b,height:y,has_local_palette:S,palette_offset:k,palette_size:E,data_offset:M,data_length:e-M,transparent_index:f,interlaced:!!v,delay:c,disposal:d});break;case 59:l=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return p},this.frameInfo=function(t){if(t<0||t>=u.length)throw new Error("Frame index out of range.");return u[t]},this.decodeAndBlitFrameBGRA=function(e,r){var n=this.frameInfo(e),a=n.width*n.height,o=new Uint8Array(a);te(t,n.data_offset,o,a);var s=n.palette_offset,h=n.transparent_index;null===h&&(h=256);var l=n.width,u=i-l,c=l,f=4*(n.y*i+n.x),d=4*((n.y+n.height)*i+n.x),p=f,m=4*u;!0===n.interlaced&&(m+=4*i*7);for(var g=8,_=0,b=o.length;_<b;++_){var y=o[_];if(0===c&&(c=l,(p+=m)>=d&&(m=4*u+4*i*(g-1),p=f+(l+u)*(g<<1),g>>=1)),y===h)p+=4;else{var w=t[s+3*y],v=t[s+3*y+1],x=t[s+3*y+2];r[p++]=x,r[p++]=v,r[p++]=w,r[p++]=255}--c}},this.decodeAndBlitFrameRGBA=function(e,r){var n=this.frameInfo(e),a=n.width*n.height,o=new Uint8Array(a);te(t,n.data_offset,o,a);var s=n.palette_offset,h=n.transparent_index;null===h&&(h=256);var l=n.width,u=i-l,c=l,f=4*(n.y*i+n.x),d=4*((n.y+n.height)*i+n.x),p=f,m=4*u;!0===n.interlaced&&(m+=4*i*7);for(var g=8,_=0,b=o.length;_<b;++_){var y=o[_];if(0===c&&(c=l,(p+=m)>=d&&(m=4*u+4*i*(g-1),p=f+(l+u)*(g<<1),g>>=1)),y===h)p+=4;else{var w=t[s+3*y],v=t[s+3*y+1],x=t[s+3*y+2];r[p++]=w,r[p++]=v,r[p++]=x,r[p++]=255}--c}}}}catch(t){}var ee=class t{constructor(...e){if(0===e.length)throw new Error("constructor requires parameters");const i=e[0];if(null!==i&&"object"==typeof i)if(i instanceof t){const t=i.bitmap;this.bitmap={width:t.width,height:t.height,data:new _(t.width*t.height*4)},t.data.copy(this.bitmap.data)}else{if(!(i.width&&i.height&&i.data))throw new Error("unrecognized constructor parameters");this.bitmap=i}else{if("number"!=typeof i||"number"!=typeof e[1])throw new Error("unrecognized constructor parameters");{const t=i,r=e[1],n=e[2];this.bitmap={width:t,height:r},_.isBuffer(n)?this.bitmap.data=n:(this.bitmap.data=new _(t*r*4),"number"==typeof n&&this.fillRGBA(n))}}}blit(t,e,i,r,n,a,o){if(r+a>this.bitmap.width)throw new Error("copy exceeds width of source bitmap");if(e+a>t.bitmap.width)throw new Error("copy exceeds width of target bitmap");if(n+o>this.bitmap.height)throw new Error("copy exceeds height of source bitmap");if(i+o>t.bitmap.height)throw new Erro("copy exceeds height of target bitmap");const s=this.bitmap.data,h=t.bitmap.data,l=4*this.bitmap.width,u=4*t.bitmap.width,c=4*a;let f=n*l+4*r,d=i*u+4*e;for(;--o>=0;)s.copy(h,d,f,f+c),f+=l,d+=u;return this}fillRGBA(t){const e=this.bitmap.data,i=4*this.bitmap.height;let r=0;for(;r<i;)e.writeUInt32BE(t,r),r+=4;for(;r<e.length;)e.copy(e,r,0,i),r+=i;return this}getRGBA(t,e){const i=4*(e*this.bitmap.width+t);return this.bitmap.data.readUInt32BE(i)}getRGBASet(){const t=new Set,e=this.bitmap.data;for(let i=0;i<e.length;i+=4)t.add(e.readUInt32BE(i,!0));return t}greyscale(){const t=this.bitmap.data;return this.scan(0,0,this.bitmap.width,this.bitmap.height,((e,i,r)=>{const n=Math.round(.299*t[r]+.587*t[r+1]+.114*t[r+2]);t[r]=n,t[r+1]=n,t[r+2]=n})),this}reframe(e,i,r,n,a){const o=e<0?0:e,s=i<0?0:i,h=r+o>this.bitmap.width?this.bitmap.width-o:r,l=n+s>this.bitmap.height?this.bitmap.height-s:n,u=e<0?-e:0,c=i<0?-i:0;let f;if(void 0===a){if(o!==e||s!=i||h!==r||l!==n)throw new GifError("fillRGBA required for this reframing");f=new t(r,n)}else f=new t(r,n,a);return this.blit(f,u,c,o,s,h,l),this.bitmap=f.bitmap,this}scale(t){if(1===t)return;if(!Number.isInteger(t)||t<1)throw new Error("the scale must be an integer >= 1");const e=this.bitmap.width,i=this.bitmap.height,r=e*t*4,n=this.bitmap.data,a=new _(i*r*t);let o,s=0,h=0;for(let l=0;l<i;++l){o=h;for(let i=0;i<e;++i){const e=n.readUInt32BE(s,!0);for(let i=0;i<t;++i)a.writeUInt32BE(e,h),h+=4;s+=4}for(let e=1;e<t;++e)a.copy(a,h,o,h),h+=r,o+=r}return this.bitmap={width:e*t,height:i*t,data:a},this}scanAllCoords(t){const e=this.bitmap.width,i=this.bitmap.data.length;let r=0,n=0;for(let a=0;a<i;a+=4)t(r,n,a),++r===e&&(r=0,++n)}scanAllIndexes(t){const e=this.bitmap.data.length;for(let i=0;i<e;i+=4)t(i)}},ie={};let re=class{constructor(t,e,i){this.width=i.width,this.height=i.height,this.loops=i.loops,this.usesTransparency=i.usesTransparency,this.colorScope=i.colorScope,this.frames=e,this.buffer=t}};re.GlobalColorsPreferred=0,re.GlobalColorsOnly=1,re.LocalColorsOnly=2;let ne=class extends Error{constructor(t){super(t),t instanceof Error&&(this.stack="Gif"+t.stack)}};ie.Gif=re,ie.GifError=ne;var ae={},oe={},se=Object.freeze({__proto__:null,default:{}}),he=i(se),le=Object.defineProperty,ue=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyNames,fe=Object.prototype.hasOwnProperty,de=(t,e)=>{for(var i in e)le(t,i,{get:e[i],enumerable:!0})},pe=(t=>(e,i)=>t&&t.get(e)||(i=((t,e,i,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of ce(e))!fe.call(t,n)&&i&&le(t,n,{get:()=>e[n],enumerable:!(r=ue(e,n))||r.enumerable});return t})(le({},"__esModule",{value:!0}),e,1),t&&t.set(e,i),i))("undefined"!=typeof WeakMap?new WeakMap:0),me=(t,e,i)=>(((t,e,i)=>{e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,"symbol"!=typeof e?e+"":e,i),i),ge={};de(ge,{applyPalette:()=>ar,applyPaletteSync:()=>nr,buildPalette:()=>rr,buildPaletteSync:()=>ir,constants:()=>_e,conversion:()=>xe,distance:()=>Ye,image:()=>Ni,palette:()=>ci,quality:()=>Vi,utils:()=>_i});var _e={};de(_e,{bt709:()=>be});var be={};de(be,{Y:()=>ye,x:()=>we,y:()=>ve});var ye=(t=>(t[t.RED=.2126]="RED",t[t.GREEN=.7152]="GREEN",t[t.BLUE=.0722]="BLUE",t[t.WHITE=1]="WHITE",t))(ye||{}),we=(t=>(t[t.RED=.64]="RED",t[t.GREEN=.3]="GREEN",t[t.BLUE=.15]="BLUE",t[t.WHITE=.3127]="WHITE",t))(we||{}),ve=(t=>(t[t.RED=.33]="RED",t[t.GREEN=.6]="GREEN",t[t.BLUE=.06]="BLUE",t[t.WHITE=.329]="WHITE",t))(ve||{}),xe={};function ke(t){return t>.04045?((t+.055)/1.055)**2.4:t/12.92}function Ee(t,e,i){return{x:.4124*(t=ke(t/255))+.3576*(e=ke(e/255))+.1805*(i=ke(i/255)),y:.2126*t+.7152*e+.0722*i,z:.0193*t+.1192*e+.9505*i}}de(xe,{lab2rgb:()=>qe,lab2xyz:()=>He,rgb2hsl:()=>Oe,rgb2lab:()=>Fe,rgb2xyz:()=>Ee,xyz2lab:()=>Ue,xyz2rgb:()=>We});var Se={};function Me(t){return t*(Math.PI/180)}function Ae(t,e,i){let r=t;return r<e&&(r=e),r<i&&(r=i),r}function Ie(t,e,i){let r=t;return r>e&&(r=e),r>i&&(r=i),r}function ze(t,e,i){return t>i&&(t=i),t<e&&(t=e),0|t}function Pe(t){return(t=Math.round(t))>255?t=255:t<0&&(t=0),t}function Te(t){return t>255?t=255:t<0&&(t=0),t}function Re(t,e){const i=typeof t[0];let r;if("number"===i||"string"===i){const i=Object.create(null);for(let e=0,r=t.length;e<r;e++){const r=t[e];i[r]||0===i[r]||(i[r]=e)}r=t.sort(((t,r)=>e(t,r)||i[t]-i[r]))}else{const i=t.slice(0);r=t.sort(((t,r)=>e(t,r)||i.indexOf(t)-i.indexOf(r)))}return r}function Oe(t,e,i){const r=Ie(t,e,i),n=Ae(t,e,i),a=n-r,o=(r+n)/510;let s=0;o>0&&o<1&&(s=a/(o<.5?n+r:510-n-r));let h=0;return a>0&&(h=n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a,h*=60,h<0&&(h+=360)),{h:h,s:s,l:o}}de(Se,{degrees2radians:()=>Me,inRange0to255:()=>Te,inRange0to255Rounded:()=>Pe,intInRange:()=>ze,max3:()=>Ae,min3:()=>Ie,stableSort:()=>Re});var Be=.95047,Ce=1,Le=1.08883;function De(t){return t>.008856?t**(1/3):7.787*t+16/116}function Ue(t,e,i){if(t=De(t/Be),e=De(e/Ce),i=De(i/Le),116*e-16<0)throw new Error("xxx");return{L:Math.max(0,116*e-16),a:500*(t-e),b:200*(e-i)}}function Fe(t,e,i){const r=Ee(t,e,i);return Ue(r.x,r.y,r.z)}var Ne=.95047,je=1,Ge=1.08883;function Ze(t){return t>.206893034?t**3:(t-16/116)/7.787}function He(t,e,i){const r=(t+16)/116,n=r-i/200;return{x:Ne*Ze(e/500+r),y:je*Ze(r),z:Ge*Ze(n)}}function $e(t){return t>.0031308?1.055*t**(1/2.4)-.055:12.92*t}function We(t,e,i){const r=$e(3.2406*t+-1.5372*e+-.4986*i),n=$e(-.9689*t+1.8758*e+.0415*i),a=$e(.0557*t+-.204*e+1.057*i);return{r:Pe(255*r),g:Pe(255*n),b:Pe(255*a)}}function qe(t,e,i){const r=He(t,e,i);return We(r.x,r.y,r.z)}var Ye={};de(Ye,{AbstractDistanceCalculator:()=>Ve,AbstractEuclidean:()=>ii,AbstractManhattan:()=>oi,CIE94GraphicArts:()=>Xe,CIE94Textiles:()=>Ke,CIEDE2000:()=>ti,CMetric:()=>ei,Euclidean:()=>ri,EuclideanBT709:()=>ni,EuclideanBT709NoAlpha:()=>ai,Manhattan:()=>si,ManhattanBT709:()=>li,ManhattanNommyde:()=>hi,PNGQuant:()=>ui});var Ve=class{constructor(){me(this,"_maxDistance"),me(this,"_whitePoint"),this._setDefaults(),this.setWhitePoint(255,255,255,255)}setWhitePoint(t,e,i,r){this._whitePoint={r:t>0?255/t:0,g:e>0?255/e:0,b:i>0?255/i:0,a:r>0?255/r:0},this._maxDistance=this.calculateRaw(t,e,i,r,0,0,0,0)}calculateNormalized(t,e){return this.calculateRaw(t.r,t.g,t.b,t.a,e.r,e.g,e.b,e.a)/this._maxDistance}},Je=class extends Ve{calculateRaw(t,e,i,r,n,a,o,s){const h=Fe(Te(t*this._whitePoint.r),Te(e*this._whitePoint.g),Te(i*this._whitePoint.b)),l=Fe(Te(n*this._whitePoint.r),Te(a*this._whitePoint.g),Te(o*this._whitePoint.b)),u=h.L-l.L,c=h.a-l.a,f=h.b-l.b,d=Math.sqrt(h.a*h.a+h.b*h.b),p=d-Math.sqrt(l.a*l.a+l.b*l.b);let m=c*c+f*f-p*p;m=m<0?0:Math.sqrt(m);const g=(s-r)*this._whitePoint.a*this._kA;return Math.sqrt((u/this._Kl)**2+(p/(1+this._K1*d))**2+(m/(1+this._K2*d))**2+g**2)}},Ke=class extends Je{_setDefaults(){this._Kl=2,this._K1=.048,this._K2=.014,this._kA=12.5/255}},Xe=class extends Je{_setDefaults(){this._Kl=1,this._K1=.045,this._K2=.015,this._kA=25/255}},Qe=class extends Ve{_setDefaults(){}static _calculatehp(t,e){const i=Math.atan2(t,e);return i>=0?i:i+Qe._deg360InRad}static _calculateRT(t,e){const i=e**7,r=2*Math.sqrt(i/(i+Qe._pow25to7)),n=Qe._deg30InRad*Math.exp(-(((t-Qe._deg275InRad)/Qe._deg25InRad)**2));return-Math.sin(2*n)*r}static _calculateT(t){return 1-.17*Math.cos(t-Qe._deg30InRad)+.24*Math.cos(2*t)+.32*Math.cos(3*t+Qe._deg6InRad)-.2*Math.cos(4*t-Qe._deg63InRad)}static _calculate_ahp(t,e,i,r){const n=i+r;return 0===t?n:e<=Qe._deg180InRad?n/2:n<Qe._deg360InRad?(n+Qe._deg360InRad)/2:(n-Qe._deg360InRad)/2}static _calculate_dHp(t,e,i,r){let n;return n=0===t?0:e<=Qe._deg180InRad?i-r:i<=r?i-r+Qe._deg360InRad:i-r-Qe._deg360InRad,2*Math.sqrt(t)*Math.sin(n/2)}calculateRaw(t,e,i,r,n,a,o,s){const h=Fe(Te(t*this._whitePoint.r),Te(e*this._whitePoint.g),Te(i*this._whitePoint.b)),l=Fe(Te(n*this._whitePoint.r),Te(a*this._whitePoint.g),Te(o*this._whitePoint.b)),u=(s-r)*this._whitePoint.a*Qe._kA,c=this.calculateRawInLab(h,l);return Math.sqrt(c+u*u)}calculateRawInLab(t,e){const i=t.L,r=t.a,n=t.b,a=e.L,o=e.a,s=e.b,h=((Math.sqrt(r*r+n*n)+Math.sqrt(o*o+s*s))/2)**7,l=.5*(1-Math.sqrt(h/(h+Qe._pow25to7))),u=(1+l)*r,c=(1+l)*o,f=Math.sqrt(u*u+n*n),d=Math.sqrt(c*c+s*s),p=f*d,m=Qe._calculatehp(n,u),g=Qe._calculatehp(s,c),_=Math.abs(m-g),b=a-i,y=d-f,w=Qe._calculate_dHp(p,_,g,m),v=Qe._calculate_ahp(p,_,m,g),x=(f+d)/2,k=((i+a)/2-50)**2,E=y/(1+.045*x),S=w/(1+.015*Qe._calculateT(v)*x);return(b/(1+.015*k/Math.sqrt(20+k)))**2+E**2+S**2+Qe._calculateRT(v,x)*E*S}},ti=Qe;me(ti,"_kA",25/255),me(ti,"_pow25to7",25**7),me(ti,"_deg360InRad",Me(360)),me(ti,"_deg180InRad",Me(180)),me(ti,"_deg30InRad",Me(30)),me(ti,"_deg6InRad",Me(6)),me(ti,"_deg63InRad",Me(63)),me(ti,"_deg275InRad",Me(275)),me(ti,"_deg25InRad",Me(25));var ei=class extends Ve{calculateRaw(t,e,i,r,n,a,o,s){const h=(t+n)/2*this._whitePoint.r,l=(t-n)*this._whitePoint.r,u=(e-a)*this._whitePoint.g,c=(i-o)*this._whitePoint.b,f=((512+h)*l*l>>8)+4*u*u+((767-h)*c*c>>8),d=(s-r)*this._whitePoint.a;return Math.sqrt(f+d*d)}_setDefaults(){}},ii=class extends Ve{calculateRaw(t,e,i,r,n,a,o,s){const h=n-t,l=a-e,u=o-i,c=s-r;return Math.sqrt(this._kR*h*h+this._kG*l*l+this._kB*u*u+this._kA*c*c)}},ri=class extends ii{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},ni=class extends ii{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},ai=class extends ii{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=0}},oi=class extends Ve{calculateRaw(t,e,i,r,n,a,o,s){let h=n-t,l=a-e,u=o-i,c=s-r;return h<0&&(h=0-h),l<0&&(l=0-l),u<0&&(u=0-u),c<0&&(c=0-c),this._kR*h+this._kG*l+this._kB*u+this._kA*c}},si=class extends oi{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},hi=class extends oi{_setDefaults(){this._kR=.4984,this._kG=.8625,this._kB=.2979,this._kA=1}},li=class extends oi{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},ui=class extends Ve{calculateRaw(t,e,i,r,n,a,o,s){const h=(s-r)*this._whitePoint.a;return this._colordifferenceCh(t*this._whitePoint.r,n*this._whitePoint.r,h)+this._colordifferenceCh(e*this._whitePoint.g,a*this._whitePoint.g,h)+this._colordifferenceCh(i*this._whitePoint.b,o*this._whitePoint.b,h)}_colordifferenceCh(t,e,i){const r=t-e,n=r+i;return r*r+n*n}_setDefaults(){}},ci={};de(ci,{AbstractPaletteQuantizer:()=>fi,ColorHistogram:()=>zi,NeuQuant:()=>Ei,NeuQuantFloat:()=>Ai,RGBQuant:()=>Ti,WuColorCube:()=>Di,WuQuant:()=>Fi});var fi=class{quantizeSync(){for(const t of this.quantize())if(t.palette)return t.palette;throw new Error("unreachable")}},di=class{constructor(){me(this,"r"),me(this,"g"),me(this,"b"),me(this,"a"),me(this,"uint32"),me(this,"rgba"),this.uint32=-1>>>0,this.r=this.g=this.b=this.a=0,this.rgba=new Array(4),this.rgba[0]=0,this.rgba[1]=0,this.rgba[2]=0,this.rgba[3]=0}static createByQuadruplet(t){const e=new di;return e.r=0|t[0],e.g=0|t[1],e.b=0|t[2],e.a=0|t[3],e._loadUINT32(),e._loadQuadruplet(),e}static createByRGBA(t,e,i,r){const n=new di;return n.r=0|t,n.g=0|e,n.b=0|i,n.a=0|r,n._loadUINT32(),n._loadQuadruplet(),n}static createByUint32(t){const e=new di;return e.uint32=t>>>0,e._loadRGBA(),e._loadQuadruplet(),e}from(t){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this.uint32=t.uint32,this.rgba[0]=t.r,this.rgba[1]=t.g,this.rgba[2]=t.b,this.rgba[3]=t.a}getLuminosity(t){let e=this.r,i=this.g,r=this.b;return t&&(e=Math.min(255,255-this.a+this.a*e/255),i=Math.min(255,255-this.a+this.a*i/255),r=Math.min(255,255-this.a+this.a*r/255)),.2126*e+.7152*i+.0722*r}_loadUINT32(){this.uint32=(this.a<<24|this.b<<16|this.g<<8|this.r)>>>0}_loadRGBA(){this.r=255&this.uint32,this.g=this.uint32>>>8&255,this.b=this.uint32>>>16&255,this.a=this.uint32>>>24&255}_loadQuadruplet(){this.rgba[0]=this.r,this.rgba[1]=this.g,this.rgba[2]=this.b,this.rgba[3]=this.a}},pi=class{constructor(){me(this,"_pointArray"),me(this,"_width"),me(this,"_height"),this._width=0,this._height=0,this._pointArray=[]}getWidth(){return this._width}getHeight(){return this._height}setWidth(t){this._width=t}setHeight(t){this._height=t}getPointArray(){return this._pointArray}clone(){const t=new pi;t._width=this._width,t._height=this._height;for(let e=0,i=this._pointArray.length;e<i;e++)t._pointArray[e]=di.createByUint32(0|this._pointArray[e].uint32);return t}toUint32Array(){const t=this._pointArray.length,e=new Uint32Array(t);for(let i=0;i<t;i++)e[i]=this._pointArray[i].uint32;return e}toUint8Array(){return new Uint8Array(this.toUint32Array().buffer)}static fromHTMLImageElement(t){const e=t.naturalWidth,i=t.naturalHeight,r=document.createElement("canvas");r.width=e,r.height=i;return r.getContext("2d").drawImage(t,0,0,e,i,0,0,e,i),pi.fromHTMLCanvasElement(r)}static fromHTMLCanvasElement(t){const e=t.width,i=t.height,r=t.getContext("2d").getImageData(0,0,e,i);return pi.fromImageData(r)}static fromImageData(t){const e=t.width,i=t.height;return pi.fromUint8Array(t.data,e,i)}static fromUint8Array(t,e,i){switch(Object.prototype.toString.call(t)){case"[object Uint8ClampedArray]":case"[object Uint8Array]":break;default:t=new Uint8Array(t)}const r=new Uint32Array(t.buffer);return pi.fromUint32Array(r,e,i)}static fromUint32Array(t,e,i){const r=new pi;r._width=e,r._height=i;for(let e=0,i=t.length;e<i;e++)r._pointArray[e]=di.createByUint32(0|t[e]);return r}static fromBuffer(t,e,i){const r=new Uint32Array(t.buffer,t.byteOffset,t.byteLength/Uint32Array.BYTES_PER_ELEMENT);return pi.fromUint32Array(r,e,i)}};function mi(t,e){const i=360/e;for(let r=1,n=i-i/2;r<e;r++,n+=i)if(t>=n&&t<n+i)return r;return 0}var gi=class{constructor(){me(this,"_pointContainer"),me(this,"_pointArray",[]),me(this,"_i32idx",{}),this._pointContainer=new pi,this._pointContainer.setHeight(1),this._pointArray=this._pointContainer.getPointArray()}add(t){this._pointArray.push(t),this._pointContainer.setWidth(this._pointArray.length)}has(t){for(let e=this._pointArray.length-1;e>=0;e--)if(t.uint32===this._pointArray[e].uint32)return!0;return!1}getNearestColor(t,e){return this._pointArray[0|this._getNearestIndex(t,e)]}getPointContainer(){return this._pointContainer}_nearestPointFromCache(t){return"number"==typeof this._i32idx[t]?this._i32idx[t]:-1}_getNearestIndex(t,e){let i=this._nearestPointFromCache(""+e.uint32);if(i>=0)return i;let r=Number.MAX_VALUE;i=0;for(let n=0,a=this._pointArray.length;n<a;n++){const a=this._pointArray[n],o=t.calculateRaw(e.r,e.g,e.b,e.a,a.r,a.g,a.b,a.a);o<r&&(r=o,i=n)}return this._i32idx[e.uint32]=i,i}sort(){this._i32idx={},this._pointArray.sort(((t,e)=>{const i=Oe(t.r,t.g,t.b),r=Oe(e.r,e.g,e.b),n=t.r===t.g&&t.g===t.b?0:1+mi(i.h,10),a=(e.r===e.g&&e.g===e.b?0:1+mi(r.h,10))-n;if(a)return-a;const o=t.getLuminosity(!0),s=e.getLuminosity(!0);if(s-o!=0)return s-o;const h=(100*r.s|0)-(100*i.s|0);return h?-h:0}))}},_i={};de(_i,{HueStatistics:()=>yi,Palette:()=>gi,Point:()=>di,PointContainer:()=>pi,ProgressTracker:()=>vi,arithmetic:()=>Se});var bi=class{constructor(){me(this,"num",0),me(this,"cols",[])}},yi=class{constructor(t,e){me(this,"_numGroups"),me(this,"_minCols"),me(this,"_stats"),me(this,"_groupsFull"),this._numGroups=t,this._minCols=e,this._stats=[];for(let e=0;e<=t;e++)this._stats[e]=new bi;this._groupsFull=0}check(t){this._groupsFull===this._numGroups+1&&(this.check=()=>{});const e=255&t,i=t>>>8&255,r=t>>>16&255,n=e===i&&i===r?0:1+mi(Oe(e,i,r).h,this._numGroups),a=this._stats[n],o=this._minCols;a.num++,a.num>o||(a.num===o&&this._groupsFull++,a.num<=o&&this._stats[n].cols.push(t))}injectIntoDictionary(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{t[e]?t[e]++:t[e]=1}))}injectIntoArray(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{-1===t.indexOf(e)&&t.push(e)}))}},wi=class{constructor(t,e){me(this,"progress"),me(this,"_step"),me(this,"_range"),me(this,"_last"),me(this,"_progressRange"),this._range=t,this._progressRange=e,this._step=Math.max(1,this._range/(wi.steps+1)|0),this._last=-this._step,this.progress=0}shouldNotify(t){return t-this._last>=this._step&&(this._last=t,this.progress=Math.min(this._progressRange*this._last/this._range,this._progressRange),!0)}},vi=wi;me(vi,"steps",100);var xi=class{constructor(t){me(this,"r"),me(this,"g"),me(this,"b"),me(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return di.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,i,r){this.r-=0|t,this.g-=0|e,this.b-=0|i,this.a-=0|r}},ki=class extends fi{constructor(t,e=256){super(),me(this,"_pointArray"),me(this,"_networkSize"),me(this,"_network"),me(this,"_sampleFactor"),me(this,"_radPower"),me(this,"_freq"),me(this,"_bias"),me(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t<this._networkSize;t++)this._network[t]=new xi((t<<11)/this._networkSize|0),this._freq[t]=ki._initialBias/this._networkSize|0,this._bias[t]=0}*_learn(){let t=this._sampleFactor;const e=this._pointArray.length;e<ki._minpicturebytes&&(t=1);const i=30+(t-1)/3|0,r=e/t|0;let n,a=r/ki._nCycles|0,o=ki._initAlpha,s=(this._networkSize>>3)*ki._radiusBias,h=s>>ki._radiusBiasShift;h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*ki._radBias/(h*h))>>>0;n=e<ki._minpicturebytes?1:e%ki._prime1!=0?ki._prime1:e%ki._prime2!=0?ki._prime2:e%ki._prime3!=0?ki._prime3:ki._prime4;const l=new vi(r,99);for(let t=0,u=0;t<r;){l.shouldNotify(t)&&(yield{progress:l.progress});const r=this._pointArray[u],c=r.b<<3,f=r.g<<3,d=r.r<<3,p=r.a<<3,m=this._contest(c,f,d,p);if(this._alterSingle(o,m,c,f,d,p),0!==h&&this._alterNeighbour(h,m,c,f,d,p),u+=n,u>=e&&(u-=e),t++,0===a&&(a=1),t%a==0){o-=o/i|0,s-=s/ki._radiusDecrease|0,h=s>>ki._radiusBiasShift,h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*ki._radBias/(h*h))>>>0}}}_buildPalette(){const t=new gi;return this._network.forEach((e=>{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,i,r,n,a){let o=e-t;o<-1&&(o=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let h=e+1,l=e-1,u=1;for(;h<s||l>o;){const t=this._radPower[u++]/ki._alphaRadBias;if(h<s){const e=this._network[h++];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}if(l>o){const e=this._network[l--];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}}}_alterSingle(t,e,i,r,n,a){t/=ki._initAlpha;const o=this._network[e];o.subtract(t*(o.r-n),t*(o.g-r),t*(o.b-i),t*(o.a-a))}_contest(t,e,i,r){let n=~(1<<31),a=n,o=-1,s=o;for(let h=0;h<this._networkSize;h++){const l=this._network[h],u=8160*this._distance.calculateNormalized(l,{r:i,g:e,b:t,a:r})|0;u<n&&(n=u,o=h);const c=u-(this._bias[h]>>ki._initialBiasShift-3);c<a&&(a=c,s=h);const f=this._freq[h]>>ki._betaShift;this._freq[h]-=f,this._bias[h]+=f<<ki._gammaShift}return this._freq[o]+=ki._beta,this._bias[o]-=ki._betaGamma,s}},Ei=ki;me(Ei,"_prime1",499),me(Ei,"_prime2",491),me(Ei,"_prime3",487),me(Ei,"_prime4",503),me(Ei,"_minpicturebytes",ki._prime4),me(Ei,"_nCycles",100),me(Ei,"_initialBiasShift",16),me(Ei,"_initialBias",1<<ki._initialBiasShift),me(Ei,"_gammaShift",10),me(Ei,"_betaShift",10),me(Ei,"_beta",ki._initialBias>>ki._betaShift),me(Ei,"_betaGamma",ki._initialBias<<ki._gammaShift-ki._betaShift),me(Ei,"_radiusBiasShift",6),me(Ei,"_radiusBias",1<<ki._radiusBiasShift),me(Ei,"_radiusDecrease",30),me(Ei,"_alphaBiasShift",10),me(Ei,"_initAlpha",1<<ki._alphaBiasShift),me(Ei,"_radBiasShift",8),me(Ei,"_radBias",1<<ki._radBiasShift),me(Ei,"_alphaRadBiasShift",ki._alphaBiasShift+ki._radBiasShift),me(Ei,"_alphaRadBias",1<<ki._alphaRadBiasShift);var Si=class{constructor(t){me(this,"r"),me(this,"g"),me(this,"b"),me(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return di.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,i,r){this.r-=t,this.g-=e,this.b-=i,this.a-=r}},Mi=class extends fi{constructor(t,e=256){super(),me(this,"_pointArray"),me(this,"_networkSize"),me(this,"_network"),me(this,"_sampleFactor"),me(this,"_radPower"),me(this,"_freq"),me(this,"_bias"),me(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t<this._networkSize;t++)this._network[t]=new Si((t<<11)/this._networkSize),this._freq[t]=Mi._initialBias/this._networkSize,this._bias[t]=0}*_learn(){let t=this._sampleFactor;const e=this._pointArray.length;e<Mi._minpicturebytes&&(t=1);const i=30+(t-1)/3,r=e/t;let n,a=r/Mi._nCycles|0,o=Mi._initAlpha,s=(this._networkSize>>3)*Mi._radiusBias,h=s>>Mi._radiusBiasShift;h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*Mi._radBias/(h*h));n=e<Mi._minpicturebytes?1:e%Mi._prime1!=0?Mi._prime1:e%Mi._prime2!=0?Mi._prime2:e%Mi._prime3!=0?Mi._prime3:Mi._prime4;const l=new vi(r,99);for(let t=0,u=0;t<r;){l.shouldNotify(t)&&(yield{progress:l.progress});const r=this._pointArray[u],c=r.b<<3,f=r.g<<3,d=r.r<<3,p=r.a<<3,m=this._contest(c,f,d,p);if(this._alterSingle(o,m,c,f,d,p),0!==h&&this._alterNeighbour(h,m,c,f,d,p),u+=n,u>=e&&(u-=e),t++,0===a&&(a=1),t%a==0){o-=o/i,s-=s/Mi._radiusDecrease,h=s>>Mi._radiusBiasShift,h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*Mi._radBias/(h*h))}}}_buildPalette(){const t=new gi;return this._network.forEach((e=>{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,i,r,n,a){let o=e-t;o<-1&&(o=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let h=e+1,l=e-1,u=1;for(;h<s||l>o;){const t=this._radPower[u++]/Mi._alphaRadBias;if(h<s){const e=this._network[h++];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}if(l>o){const e=this._network[l--];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}}}_alterSingle(t,e,i,r,n,a){t/=Mi._initAlpha;const o=this._network[e];o.subtract(t*(o.r-n),t*(o.g-r),t*(o.b-i),t*(o.a-a))}_contest(t,e,i,r){let n=~(1<<31),a=n,o=-1,s=o;for(let h=0;h<this._networkSize;h++){const l=this._network[h],u=8160*this._distance.calculateNormalized(l,{r:i,g:e,b:t,a:r});u<n&&(n=u,o=h);const c=u-(this._bias[h]>>Mi._initialBiasShift-3);c<a&&(a=c,s=h);const f=this._freq[h]>>Mi._betaShift;this._freq[h]-=f,this._bias[h]+=f<<Mi._gammaShift}return this._freq[o]+=Mi._beta,this._bias[o]-=Mi._betaGamma,s}},Ai=Mi;me(Ai,"_prime1",499),me(Ai,"_prime2",491),me(Ai,"_prime3",487),me(Ai,"_prime4",503),me(Ai,"_minpicturebytes",Mi._prime4),me(Ai,"_nCycles",100),me(Ai,"_initialBiasShift",16),me(Ai,"_initialBias",1<<Mi._initialBiasShift),me(Ai,"_gammaShift",10),me(Ai,"_betaShift",10),me(Ai,"_beta",Mi._initialBias>>Mi._betaShift),me(Ai,"_betaGamma",Mi._initialBias<<Mi._gammaShift-Mi._betaShift),me(Ai,"_radiusBiasShift",6),me(Ai,"_radiusBias",1<<Mi._radiusBiasShift),me(Ai,"_radiusDecrease",30),me(Ai,"_alphaBiasShift",10),me(Ai,"_initAlpha",1<<Mi._alphaBiasShift),me(Ai,"_radBiasShift",8),me(Ai,"_radBias",1<<Mi._radBiasShift),me(Ai,"_alphaRadBiasShift",Mi._alphaBiasShift+Mi._radBiasShift),me(Ai,"_alphaRadBias",1<<Mi._alphaRadBiasShift);var Ii=class{constructor(t,e){me(this,"_method"),me(this,"_hueStats"),me(this,"_histogram"),me(this,"_initColors"),me(this,"_minHueCols"),this._method=t,this._minHueCols=e<<2,this._initColors=e<<2,this._hueStats=new yi(Ii._hueGroups,this._minHueCols),this._histogram=Object.create(null)}sample(t){switch(this._method){case 1:this._colorStats1D(t);break;case 2:this._colorStats2D(t)}}getImportanceSortedColorsIDXI32(){const t=Re(Object.keys(this._histogram),((t,e)=>this._histogram[e]-this._histogram[t]));if(0===t.length)return[];let e;switch(this._method){case 1:const i=Math.min(t.length,this._initColors),r=t[i-1],n=this._histogram[r];e=t.slice(0,i);let a=i;const o=t.length;for(;a<o&&this._histogram[t[a]]===n;)e.push(t[a++]);this._hueStats.injectIntoArray(e);break;case 2:e=t;break;default:throw new Error("Incorrect method")}return e.map((t=>+t))}_colorStats1D(t){const e=this._histogram,i=t.getPointArray(),r=i.length;for(let t=0;t<r;t++){const r=i[t].uint32;this._hueStats.check(r),r in e?e[r]++:e[r]=1}}_colorStats2D(t){const e=t.getWidth(),i=t.getHeight(),r=t.getPointArray(),n=Ii._boxSize[0],a=Ii._boxSize[1],o=n*a,s=this._makeBoxes(e,i,n,a),h=this._histogram;s.forEach((t=>{let i=Math.round(t.w*t.h/o)*Ii._boxPixels;i<2&&(i=2);const n={};this._iterateBox(t,e,(t=>{const e=r[t].uint32;this._hueStats.check(e),e in h?h[e]++:e in n?++n[e]>=i&&(h[e]=n[e]):n[e]=1}))})),this._hueStats.injectIntoDictionary(h)}_iterateBox(t,e,i){const r=t,n=r.y*e+r.x,a=(r.y+r.h-1)*e+(r.x+r.w-1),o=e-r.w+1;let s=0,h=n;do{i.call(this,h),h+=++s%r.w==0?o:1}while(h<=a)}_makeBoxes(t,e,i,r){const n=t%i,a=e%r,o=t-n,s=e-a,h=[];for(let l=0;l<e;l+=r)for(let e=0;e<t;e+=i)h.push({x:e,y:l,w:e===o?n:i,h:l===s?a:r});return h}},zi=Ii;me(zi,"_boxSize",[64,64]),me(zi,"_boxPixels",2),me(zi,"_hueGroups",10);var Pi=class{constructor(t,e,i){me(this,"index"),me(this,"color"),me(this,"distance"),this.index=t,this.color=e,this.distance=i}},Ti=class extends fi{constructor(t,e=256,i=2){super(),me(this,"_colors"),me(this,"_initialDistance"),me(this,"_distanceIncrement"),me(this,"_histogram"),me(this,"_distance"),this._distance=t,this._colors=e,this._histogram=new zi(i,e),this._initialDistance=.01,this._distanceIncrement=.005}sample(t){this._histogram.sample(t)}*quantize(){const t=this._histogram.getImportanceSortedColorsIDXI32();if(0===t.length)throw new Error("No colors in image");yield*this._buildPalette(t)}*_buildPalette(t){const e=new gi,i=e.getPointContainer().getPointArray(),r=new Array(t.length);for(let e=0;e<t.length;e++)i.push(di.createByUint32(t[e])),r[e]=1;const n=i.length,a=[];let o=n,s=this._initialDistance;const h=new vi(o-this._colors,99);for(;o>this._colors;){a.length=0;for(let t=0;t<n;t++){if(h.shouldNotify(n-o)&&(yield{progress:h.progress}),0===r[t])continue;const e=i[t];for(let h=t+1;h<n;h++){if(0===r[h])continue;const t=i[h],n=this._distance.calculateNormalized(e,t);n<s&&(a.push(new Pi(h,t,n)),r[h]=0,o--)}}s+=o>3*this._colors?this._initialDistance:this._distanceIncrement}if(o<this._colors){Re(a,((t,e)=>e.distance-t.distance));let t=0;for(;o<this._colors&&t<a.length;){r[a[t].index]=1,o++,t++}}let l=i.length;for(let t=l-1;t>=0;t--)0===r[t]&&(t!==l-1&&(i[t]=i[l-1]),--l);i.length=l,e.sort(),yield{palette:e,progress:100}}};function Ri(t){const e=[];for(let i=0;i<t;i++)e[i]=0;return e}function Oi(t,e,i,r){const n=new Array(t);for(let a=0;a<t;a++){n[a]=new Array(e);for(let t=0;t<e;t++){n[a][t]=new Array(i);for(let e=0;e<i;e++){n[a][t][e]=new Array(r);for(let i=0;i<r;i++)n[a][t][e][i]=0}}}return n}function Bi(t,e,i){const r=new Array(t);for(let n=0;n<t;n++){r[n]=new Array(e);for(let t=0;t<e;t++){r[n][t]=new Array(i);for(let e=0;e<i;e++)r[n][t][e]=0}}return r}function Ci(t,e,i,r,n){for(let a=0;a<e;a++){t[a]=[];for(let e=0;e<i;e++){t[a][e]=[];for(let i=0;i<r;i++)t[a][e][i]=n}}}function Li(t,e,i){for(let r=0;r<e;r++)t[r]=i}var Di=class{constructor(){me(this,"redMinimum"),me(this,"redMaximum"),me(this,"greenMinimum"),me(this,"greenMaximum"),me(this,"blueMinimum"),me(this,"blueMaximum"),me(this,"volume"),me(this,"alphaMinimum"),me(this,"alphaMaximum")}},Ui=class extends fi{constructor(t,e=256,i=5){super(),me(this,"_reds"),me(this,"_greens"),me(this,"_blues"),me(this,"_alphas"),me(this,"_sums"),me(this,"_weights"),me(this,"_momentsRed"),me(this,"_momentsGreen"),me(this,"_momentsBlue"),me(this,"_momentsAlpha"),me(this,"_moments"),me(this,"_table"),me(this,"_pixels"),me(this,"_cubes"),me(this,"_colors"),me(this,"_significantBitsPerChannel"),me(this,"_maxSideIndex"),me(this,"_alphaMaxSideIndex"),me(this,"_sideSize"),me(this,"_alphaSideSize"),me(this,"_distance"),this._distance=t,this._setQuality(i),this._initialize(e)}sample(t){const e=t.getPointArray();for(let t=0,i=e.length;t<i;t++)this._addColor(e[t]);this._pixels=this._pixels.concat(e)}*quantize(){yield*this._preparePalette();const t=new gi;for(let e=0;e<this._colors;e++)if(this._sums[e]>0){const i=this._sums[e],r=this._reds[e]/i,n=this._greens[e]/i,a=this._blues[e]/i,o=this._alphas[e]/i,s=di.createByRGBA(0|r,0|n,0|a,0|o);t.add(s)}t.sort(),yield{palette:t,progress:100}}*_preparePalette(){yield*this._calculateMoments();let t=0;const e=Ri(this._colors);for(let i=1;i<this._colors;++i){this._cut(this._cubes[t],this._cubes[i])?(e[t]=this._cubes[t].volume>1?this._calculateVariance(this._cubes[t]):0,e[i]=this._cubes[i].volume>1?this._calculateVariance(this._cubes[i]):0):(e[t]=0,i--),t=0;let r=e[0];for(let n=1;n<=i;++n)e[n]>r&&(r=e[n],t=n);if(r<=0){this._colors=i+1;break}}const i=[],r=[],n=[],a=[];for(let t=0;t<this._colors;++t){const e=Ui._volume(this._cubes[t],this._weights);e>0?(i[t]=Ui._volume(this._cubes[t],this._momentsRed)/e|0,r[t]=Ui._volume(this._cubes[t],this._momentsGreen)/e|0,n[t]=Ui._volume(this._cubes[t],this._momentsBlue)/e|0,a[t]=Ui._volume(this._cubes[t],this._momentsAlpha)/e|0):(i[t]=0,r[t]=0,n[t]=0,a[t]=0)}this._reds=Ri(this._colors+1),this._greens=Ri(this._colors+1),this._blues=Ri(this._colors+1),this._alphas=Ri(this._colors+1),this._sums=Ri(this._colors+1);for(let t=0,e=this._pixels.length;t<e;t++){const e=this._pixels[t];let o=-1,s=Number.MAX_VALUE;for(let t=0;t<this._colors;t++){const h=i[t],l=r[t],u=n[t],c=a[t],f=this._distance.calculateRaw(h,l,u,c,e.r,e.g,e.b,e.a);f<s&&(s=f,o=t)}this._reds[o]+=e.r,this._greens[o]+=e.g,this._blues[o]+=e.b,this._alphas[o]+=e.a,this._sums[o]++}}_addColor(t){const e=8-this._significantBitsPerChannel,i=1+(t.r>>e),r=1+(t.g>>e),n=1+(t.b>>e),a=1+(t.a>>e);this._weights[a][i][r][n]++,this._momentsRed[a][i][r][n]+=t.r,this._momentsGreen[a][i][r][n]+=t.g,this._momentsBlue[a][i][r][n]+=t.b,this._momentsAlpha[a][i][r][n]+=t.a,this._moments[a][i][r][n]+=this._table[t.r]+this._table[t.g]+this._table[t.b]+this._table[t.a]}*_calculateMoments(){const t=[],e=[],i=[],r=[],n=[],a=[],o=Bi(this._sideSize,this._sideSize,this._sideSize),s=Bi(this._sideSize,this._sideSize,this._sideSize),h=Bi(this._sideSize,this._sideSize,this._sideSize),l=Bi(this._sideSize,this._sideSize,this._sideSize),u=Bi(this._sideSize,this._sideSize,this._sideSize),c=Bi(this._sideSize,this._sideSize,this._sideSize);let f=0;const d=new vi(this._alphaMaxSideIndex*this._maxSideIndex,99);for(let p=1;p<=this._alphaMaxSideIndex;++p){Ci(o,this._sideSize,this._sideSize,this._sideSize,0),Ci(s,this._sideSize,this._sideSize,this._sideSize,0),Ci(h,this._sideSize,this._sideSize,this._sideSize,0),Ci(l,this._sideSize,this._sideSize,this._sideSize,0),Ci(u,this._sideSize,this._sideSize,this._sideSize,0),Ci(c,this._sideSize,this._sideSize,this._sideSize,0);for(let m=1;m<=this._maxSideIndex;++m,++f){d.shouldNotify(f)&&(yield{progress:d.progress}),Li(t,this._sideSize,0),Li(e,this._sideSize,0),Li(i,this._sideSize,0),Li(r,this._sideSize,0),Li(n,this._sideSize,0),Li(a,this._sideSize,0);for(let f=1;f<=this._maxSideIndex;++f){let d=0,g=0,_=0,b=0,y=0,w=0;for(let v=1;v<=this._maxSideIndex;++v)d+=this._weights[p][m][f][v],g+=this._momentsRed[p][m][f][v],_+=this._momentsGreen[p][m][f][v],b+=this._momentsBlue[p][m][f][v],y+=this._momentsAlpha[p][m][f][v],w+=this._moments[p][m][f][v],t[v]+=d,e[v]+=g,i[v]+=_,r[v]+=b,n[v]+=y,a[v]+=w,o[m][f][v]=o[m-1][f][v]+t[v],s[m][f][v]=s[m-1][f][v]+e[v],h[m][f][v]=h[m-1][f][v]+i[v],l[m][f][v]=l[m-1][f][v]+r[v],u[m][f][v]=u[m-1][f][v]+n[v],c[m][f][v]=c[m-1][f][v]+a[v],this._weights[p][m][f][v]=this._weights[p-1][m][f][v]+o[m][f][v],this._momentsRed[p][m][f][v]=this._momentsRed[p-1][m][f][v]+s[m][f][v],this._momentsGreen[p][m][f][v]=this._momentsGreen[p-1][m][f][v]+h[m][f][v],this._momentsBlue[p][m][f][v]=this._momentsBlue[p-1][m][f][v]+l[m][f][v],this._momentsAlpha[p][m][f][v]=this._momentsAlpha[p-1][m][f][v]+u[m][f][v],this._moments[p][m][f][v]=this._moments[p-1][m][f][v]+c[m][f][v]}}}}static _volumeFloat(t,e){return e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMaximum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum])}static _volume(t,e){return 0|Ui._volumeFloat(t,e)}static _top(t,e,i,r){let n;switch(e){case Ui._alpha:n=r[i][t.redMaximum][t.greenMaximum][t.blueMaximum]-r[i][t.redMaximum][t.greenMinimum][t.blueMaximum]-r[i][t.redMinimum][t.greenMaximum][t.blueMaximum]+r[i][t.redMinimum][t.greenMinimum][t.blueMaximum]-(r[i][t.redMaximum][t.greenMaximum][t.blueMinimum]-r[i][t.redMaximum][t.greenMinimum][t.blueMinimum]-r[i][t.redMinimum][t.greenMaximum][t.blueMinimum]+r[i][t.redMinimum][t.greenMinimum][t.blueMinimum]);break;case Ui._red:n=r[t.alphaMaximum][i][t.greenMaximum][t.blueMaximum]-r[t.alphaMaximum][i][t.greenMinimum][t.blueMaximum]-r[t.alphaMinimum][i][t.greenMaximum][t.blueMaximum]+r[t.alphaMinimum][i][t.greenMinimum][t.blueMaximum]-(r[t.alphaMaximum][i][t.greenMaximum][t.blueMinimum]-r[t.alphaMaximum][i][t.greenMinimum][t.blueMinimum]-r[t.alphaMinimum][i][t.greenMaximum][t.blueMinimum]+r[t.alphaMinimum][i][t.greenMinimum][t.blueMinimum]);break;case Ui._green:n=r[t.alphaMaximum][t.redMaximum][i][t.blueMaximum]-r[t.alphaMaximum][t.redMinimum][i][t.blueMaximum]-r[t.alphaMinimum][t.redMaximum][i][t.blueMaximum]+r[t.alphaMinimum][t.redMinimum][i][t.blueMaximum]-(r[t.alphaMaximum][t.redMaximum][i][t.blueMinimum]-r[t.alphaMaximum][t.redMinimum][i][t.blueMinimum]-r[t.alphaMinimum][t.redMaximum][i][t.blueMinimum]+r[t.alphaMinimum][t.redMinimum][i][t.blueMinimum]);break;case Ui._blue:n=r[t.alphaMaximum][t.redMaximum][t.greenMaximum][i]-r[t.alphaMaximum][t.redMaximum][t.greenMinimum][i]-r[t.alphaMaximum][t.redMinimum][t.greenMaximum][i]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][i]-(r[t.alphaMinimum][t.redMaximum][t.greenMaximum][i]-r[t.alphaMinimum][t.redMaximum][t.greenMinimum][i]-r[t.alphaMinimum][t.redMinimum][t.greenMaximum][i]+r[t.alphaMinimum][t.redMinimum][t.greenMinimum][i]);break;default:throw new Error("impossible")}return 0|n}static _bottom(t,e,i){switch(e){case Ui._alpha:return-i[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-i[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ui._red:return-i[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-i[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ui._green:return-i[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-i[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ui._blue:return-i[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]+i[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-(-i[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);default:return 0}}_calculateVariance(t){const e=Ui._volume(t,this._momentsRed),i=Ui._volume(t,this._momentsGreen),r=Ui._volume(t,this._momentsBlue),n=Ui._volume(t,this._momentsAlpha);return Ui._volumeFloat(t,this._moments)-(e*e+i*i+r*r+n*n)/Ui._volume(t,this._weights)}_maximize(t,e,i,r,n,a,o,s,h){const l=0|Ui._bottom(t,e,this._momentsRed),u=0|Ui._bottom(t,e,this._momentsGreen),c=0|Ui._bottom(t,e,this._momentsBlue),f=0|Ui._bottom(t,e,this._momentsAlpha),d=0|Ui._bottom(t,e,this._weights);let p=0,m=-1;for(let g=i;g<r;++g){let i=l+Ui._top(t,e,g,this._momentsRed),r=u+Ui._top(t,e,g,this._momentsGreen),_=c+Ui._top(t,e,g,this._momentsBlue),b=f+Ui._top(t,e,g,this._momentsAlpha),y=d+Ui._top(t,e,g,this._weights);if(0!==y){let t=i*i+r*r+_*_+b*b,e=t/y;i=n-i,r=a-r,_=o-_,b=s-b,y=h-y,0!==y&&(t=i*i+r*r+_*_+b*b,e+=t/y,e>p&&(p=e,m=g))}}return{max:p,position:m}}_cut(t,e){let i;const r=Ui._volume(t,this._momentsRed),n=Ui._volume(t,this._momentsGreen),a=Ui._volume(t,this._momentsBlue),o=Ui._volume(t,this._momentsAlpha),s=Ui._volume(t,this._weights),h=this._maximize(t,Ui._red,t.redMinimum+1,t.redMaximum,r,n,a,o,s),l=this._maximize(t,Ui._green,t.greenMinimum+1,t.greenMaximum,r,n,a,o,s),u=this._maximize(t,Ui._blue,t.blueMinimum+1,t.blueMaximum,r,n,a,o,s),c=this._maximize(t,Ui._alpha,t.alphaMinimum+1,t.alphaMaximum,r,n,a,o,s);if(c.max>=h.max&&c.max>=l.max&&c.max>=u.max){if(i=Ui._alpha,c.position<0)return!1}else i=h.max>=c.max&&h.max>=l.max&&h.max>=u.max?Ui._red:l.max>=c.max&&l.max>=h.max&&l.max>=u.max?Ui._green:Ui._blue;switch(e.redMaximum=t.redMaximum,e.greenMaximum=t.greenMaximum,e.blueMaximum=t.blueMaximum,e.alphaMaximum=t.alphaMaximum,i){case Ui._red:e.redMinimum=t.redMaximum=h.position,e.greenMinimum=t.greenMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ui._green:e.greenMinimum=t.greenMaximum=l.position,e.redMinimum=t.redMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ui._blue:e.blueMinimum=t.blueMaximum=u.position,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ui._alpha:e.alphaMinimum=t.alphaMaximum=c.position,e.blueMinimum=t.blueMinimum,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum}return t.volume=(t.redMaximum-t.redMinimum)*(t.greenMaximum-t.greenMinimum)*(t.blueMaximum-t.blueMinimum)*(t.alphaMaximum-t.alphaMinimum),e.volume=(e.redMaximum-e.redMinimum)*(e.greenMaximum-e.greenMinimum)*(e.blueMaximum-e.blueMinimum)*(e.alphaMaximum-e.alphaMinimum),!0}_initialize(t){this._colors=t,this._cubes=[];for(let e=0;e<t;e++)this._cubes[e]=new Di;this._cubes[0].redMinimum=0,this._cubes[0].greenMinimum=0,this._cubes[0].blueMinimum=0,this._cubes[0].alphaMinimum=0,this._cubes[0].redMaximum=this._maxSideIndex,this._cubes[0].greenMaximum=this._maxSideIndex,this._cubes[0].blueMaximum=this._maxSideIndex,this._cubes[0].alphaMaximum=this._alphaMaxSideIndex,this._weights=Oi(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsRed=Oi(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsGreen=Oi(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsBlue=Oi(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsAlpha=Oi(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._moments=Oi(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._table=[];for(let t=0;t<256;++t)this._table[t]=t*t;this._pixels=[]}_setQuality(t=5){this._significantBitsPerChannel=t,this._maxSideIndex=1<<this._significantBitsPerChannel,this._alphaMaxSideIndex=this._maxSideIndex,this._sideSize=this._maxSideIndex+1,this._alphaSideSize=this._alphaMaxSideIndex+1}},Fi=Ui;me(Fi,"_alpha",3),me(Fi,"_red",2),me(Fi,"_green",1),me(Fi,"_blue",0);var Ni={};de(Ni,{AbstractImageQuantizer:()=>ji,ErrorDiffusionArray:()=>Hi,ErrorDiffusionArrayKernel:()=>Zi,ErrorDiffusionRiemersma:()=>Yi,NearestColor:()=>Gi});var ji=class{quantizeSync(t,e){for(const i of this.quantize(t,e))if(i.pointContainer)return i.pointContainer;throw new Error("unreachable")}},Gi=class extends ji{constructor(t){super(),me(this,"_distance"),this._distance=t}*quantize(t,e){const i=t.getPointArray(),r=t.getWidth(),n=t.getHeight(),a=new vi(n,99);for(let t=0;t<n;t++){a.shouldNotify(t)&&(yield{progress:a.progress});for(let n=0,a=t*r;n<r;n++,a++){const t=i[a];t.from(e.getNearestColor(this._distance,t))}}yield{pointContainer:t,progress:100}}},Zi=(t=>(t[t.FloydSteinberg=0]="FloydSteinberg",t[t.FalseFloydSteinberg=1]="FalseFloydSteinberg",t[t.Stucki=2]="Stucki",t[t.Atkinson=3]="Atkinson",t[t.Jarvis=4]="Jarvis",t[t.Burkes=5]="Burkes",t[t.Sierra=6]="Sierra",t[t.TwoSierra=7]="TwoSierra",t[t.SierraLite=8]="SierraLite",t))(Zi||{}),Hi=class extends ji{constructor(t,e,i=!0,r=0,n=!1){super(),me(this,"_minColorDistance"),me(this,"_serpentine"),me(this,"_kernel"),me(this,"_calculateErrorLikeGIMP"),me(this,"_distance"),this._setKernel(e),this._distance=t,this._minColorDistance=r,this._serpentine=i,this._calculateErrorLikeGIMP=n}*quantize(t,e){const i=t.getPointArray(),r=new di,n=t.getWidth(),a=t.getHeight(),o=[];let s=1,h=1;for(const t of this._kernel){const e=t[2]+1;h<e&&(h=e)}for(let t=0;t<h;t++)this._fillErrorLine(o[t]=[],n);const l=new vi(a,99);for(let t=0;t<a;t++){l.shouldNotify(t)&&(yield{progress:l.progress}),this._serpentine&&(s*=-1);const h=t*n,u=1===s?0:n-1,c=1===s?n:-1;this._fillErrorLine(o[0],n),o.push(o.shift());const f=o[0];for(let l=u,d=h+u;l!==c;l+=s,d+=s){const h=i[d],u=f[l];r.from(h);const c=di.createByRGBA(Pe(h.r+u[0]),Pe(h.g+u[1]),Pe(h.b+u[2]),Pe(h.a+u[3])),p=e.getNearestColor(this._distance,c);if(h.from(p),this._minColorDistance){if(this._distance.calculateNormalized(r,p)<this._minColorDistance)continue}let m,g,_,b;this._calculateErrorLikeGIMP?(m=c.r-p.r,g=c.g-p.g,_=c.b-p.b,b=c.a-p.a):(m=r.r-p.r,g=r.g-p.g,_=r.b-p.b,b=r.a-p.a);const y=1===s?0:this._kernel.length-1,w=1===s?this._kernel.length:-1;for(let e=y;e!==w;e+=s){const i=this._kernel[e][1]*s,r=this._kernel[e][2];if(i+l>=0&&i+l<n&&r+t>=0&&r+t<a){const t=this._kernel[e][0],n=o[r][i+l];n[0]+=m*t,n[1]+=g*t,n[2]+=_*t,n[3]+=b*t}}}}yield{pointContainer:t,progress:100}}_fillErrorLine(t,e){t.length>e&&(t.length=e);const i=t.length;for(let e=0;e<i;e++){const i=t[e];i[0]=i[1]=i[2]=i[3]=0}for(let r=i;r<e;r++)t[r]=[0,0,0,0]}_setKernel(t){switch(t){case 0:this._kernel=[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]];break;case 1:this._kernel=[[3/8,1,0],[3/8,0,1],[2/8,1,1]];break;case 2:this._kernel=[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]];break;case 3:this._kernel=[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]];break;case 4:this._kernel=[[7/48,1,0],[5/48,2,0],[3/48,-2,1],[5/48,-1,1],[7/48,0,1],[5/48,1,1],[3/48,2,1],[1/48,-2,2],[3/48,-1,2],[5/48,0,2],[3/48,1,2],[1/48,2,2]];break;case 5:this._kernel=[[.25,1,0],[4/32,2,0],[2/32,-2,1],[4/32,-1,1],[.25,0,1],[4/32,1,1],[2/32,2,1]];break;case 6:this._kernel=[[5/32,1,0],[3/32,2,0],[2/32,-2,1],[4/32,-1,1],[5/32,0,1],[4/32,1,1],[2/32,2,1],[2/32,-1,2],[3/32,0,2],[2/32,1,2]];break;case 7:this._kernel=[[.25,1,0],[3/16,2,0],[1/16,-2,1],[2/16,-1,1],[3/16,0,1],[2/16,1,1],[1/16,2,1]];break;case 8:this._kernel=[[.5,1,0],[1/4,-1,1],[1/4,0,1]];break;default:throw new Error(`ErrorDiffusionArray: unknown kernel = ${t}`)}}};function*$i(t,e,i){const r=Math.max(t,e),n={width:t,height:e,level:Math.floor(Math.log(r)/Math.log(2)+1),callback:i,tracker:new vi(t*e,99),index:0,x:0,y:0};yield*Wi(n,1),qi(n,0)}function*Wi(t,e){if(!(t.level<1)){switch(t.tracker.shouldNotify(t.index)&&(yield{progress:t.tracker.progress}),t.level--,e){case 2:yield*Wi(t,1),qi(t,3),yield*Wi(t,2),qi(t,4),yield*Wi(t,2),qi(t,2),yield*Wi(t,4);break;case 3:yield*Wi(t,4),qi(t,2),yield*Wi(t,3),qi(t,1),yield*Wi(t,3),qi(t,3),yield*Wi(t,1);break;case 1:yield*Wi(t,2),qi(t,4),yield*Wi(t,1),qi(t,3),yield*Wi(t,1),qi(t,1),yield*Wi(t,3);break;case 4:yield*Wi(t,3),qi(t,1),yield*Wi(t,4),qi(t,2),yield*Wi(t,4),qi(t,4),yield*Wi(t,2)}t.level++}}function qi(t,e){switch(t.x>=0&&t.x<t.width&&t.y>=0&&t.y<t.height&&(t.callback(t.x,t.y),t.index++),e){case 2:t.x--;break;case 3:t.x++;break;case 1:t.y--;break;case 4:t.y++}}var Yi=class extends ji{constructor(t,e=16,i=1){super(),me(this,"_distance"),me(this,"_weights"),me(this,"_errorQueueSize"),this._distance=t,this._errorQueueSize=e,this._weights=Yi._createWeights(i,e)}*quantize(t,e){const i=t.getPointArray(),r=t.getWidth(),n=t.getHeight(),a=[];let o=0;for(let t=0;t<this._errorQueueSize;t++)a[t]={r:0,g:0,b:0,a:0};yield*$i(r,n,((t,n)=>{const s=i[t+n*r];let{r:h,g:l,b:u,a:c}=s;for(let t=0;t<this._errorQueueSize;t++){const e=this._weights[t],i=a[(t+o)%this._errorQueueSize];h+=i.r*e,l+=i.g*e,u+=i.b*e,c+=i.a*e}const f=di.createByRGBA(Pe(h),Pe(l),Pe(u),Pe(c)),d=e.getNearestColor(this._distance,f);o=(o+1)%this._errorQueueSize;const p=(o+this._errorQueueSize-1)%this._errorQueueSize;a[p].r=s.r-d.r,a[p].g=s.g-d.g,a[p].b=s.b-d.b,a[p].a=s.a-d.a,s.from(d)})),yield{pointContainer:t,progress:100}}static _createWeights(t,e){const i=[],r=Math.exp(Math.log(e)/(e-1));for(let n=0,a=1;n<e;n++)i[n]=(a+.5|0)/e*t,a*=r;return i}},Vi={};de(Vi,{ssim:()=>Xi});var Ji=.01,Ki=.03;function Xi(t,e){if(t.getHeight()!==e.getHeight()||t.getWidth()!==e.getWidth())throw new Error("Images have different sizes!");const i=(255*Ji)**2,r=(255*Ki)**2;let n=0,a=0;return function(t,e,i){const r=8,n=t.getWidth(),a=t.getHeight();for(let o=0;o<a;o+=r)for(let s=0;s<n;s+=r){const h=Math.min(r,n-s),l=Math.min(r,a-o),u=Qi(t,s,o,h,l),c=Qi(e,s,o,h,l);i(u,c,tr(u),tr(c))}}(t,e,((t,e,o,s)=>{let h=0,l=0,u=0;for(let i=0;i<t.length;i++)l+=(t[i]-o)**2,u+=(e[i]-s)**2,h+=(t[i]-o)*(e[i]-s);const c=t.length-1;l/=c,u/=c,h/=c;a+=(2*o*s+i)*(2*h+r)/((o**2+s**2+i)*(l+u+r)),n++})),a/n}function Qi(t,e,i,r,n){const a=t.getPointArray(),o=[];let s=0;for(let h=i;h<i+n;h++){const i=h*t.getWidth();for(let t=e;t<e+r;t++){const e=a[i+t];o[s]=.2126*e.r+.7152*e.g+.0722*e.b,s++}}return o}function tr(t){let e=0;for(const i of t)e+=i;return e/t.length}var er="function"==typeof setImmediate?setImmediate:"undefined"!=typeof process&&"function"==typeof(null==process?void 0:process.nextTick)?t=>process.nextTick(t):t=>setTimeout(t,0);function ir(t,{colorDistanceFormula:e,paletteQuantization:i,colors:r}={}){const n=hr(or(e),i,r);return t.forEach((t=>n.sample(t))),n.quantizeSync()}async function rr(t,{colorDistanceFormula:e,paletteQuantization:i,colors:r,onProgress:n}={}){return new Promise(((a,o)=>{const s=hr(or(e),i,r);let h;t.forEach((t=>s.sample(t)));const l=s.quantize(),u=()=>{try{const t=l.next();t.done?a(h):(t.value.palette&&(h=t.value.palette),n&&n(t.value.progress),er(u))}catch(t){o(t)}};er(u)}))}function nr(t,e,{colorDistanceFormula:i,imageQuantization:r}={}){return sr(or(i),r).quantizeSync(t,e)}async function ar(t,e,{colorDistanceFormula:i,imageQuantization:r,onProgress:n}={}){return new Promise(((a,o)=>{let s;const h=sr(or(i),r).quantize(t,e),l=()=>{try{const t=h.next();t.done?a(s):(t.value.pointContainer&&(s=t.value.pointContainer),n&&n(t.value.progress),er(l))}catch(t){o(t)}};er(l)}))}function or(t="euclidean-bt709"){switch(t){case"cie94-graphic-arts":return new Xe;case"cie94-textiles":return new Ke;case"ciede2000":return new ti;case"color-metric":return new ei;case"euclidean":return new ri;case"euclidean-bt709":return new ni;case"euclidean-bt709-noalpha":return new ai;case"manhattan":return new si;case"manhattan-bt709":return new li;case"manhattan-nommyde":return new hi;case"pngquant":return new ui;default:throw new Error(`Unknown colorDistanceFormula ${t}`)}}function sr(t,e="floyd-steinberg"){switch(e){case"nearest":return new Gi(t);case"riemersma":return new Yi(t);case"floyd-steinberg":return new Hi(t,0);case"false-floyd-steinberg":return new Hi(t,1);case"stucki":return new Hi(t,2);case"atkinson":return new Hi(t,3);case"jarvis":return new Hi(t,4);case"burkes":return new Hi(t,5);case"sierra":return new Hi(t,6);case"two-sierra":return new Hi(t,7);case"sierra-lite":return new Hi(t,8);default:throw new Error(`Unknown imageQuantization ${e}`)}}function hr(t,e="wuquant",i=256){switch(e){case"neuquant":return new Ei(t,i);case"rgbquant":return new Ti(t,i);case"wuquant":return new Fi(t,i);case"neuquant-float":return new Ai(t,i);default:throw new Error(`Unknown paletteQuantization ${e}`)}}var lr=pe(ge),ur={};const cr=ee;let fr=class t extends cr{constructor(...e){if(super(...e),e[0]instanceof t){const t=e[0];this.xOffset=t.xOffset,this.yOffset=t.yOffset,this.disposalMethod=t.disposalMethod,this.delayCentisecs=t.delayCentisecs,this.interlaced=t.interlaced}else{const i=e[e.length-1];let r={};"object"!=typeof i||i instanceof cr||(r=i),this.xOffset=r.xOffset||0,this.yOffset=r.yOffset||0,this.disposalMethod=void 0!==r.disposalMethod?r.disposalMethod:t.DisposeToBackgroundColor,this.delayCentisecs=r.delayCentisecs||8,this.interlaced=r.interlaced||!1}}getPalette(){const t=new Set,e=this.bitmap.data;let i=0,r=!1;for(;i<e.length;){if(0===e[i+3])r=!0;else{const r=e.readUInt32BE(i,!0)>>8&16777215;t.add(r)}i+=4}const n=new Array(t.size),a=t.values();for(i=0;i<n.length;++i)n[i]=a.next().value;n.sort(((t,e)=>t-e));let o=n.length;return r&&++o,{colors:n,usesTransparency:r,indexCount:o}}};var dr,pr;function mr(){return dr||(dr=1,function(t){const e=he,i=lr,r=ee,{GifFrame:n}=ur,{GifError:a}=ie,{GifCodec:o}=gr(),s=[".jpg",".jpeg",".png",".bmp"],h=new o;function l(t,e,r,n,a){const o=Array.isArray(t)?t:[t];if(a){if(["FloydSteinberg","FalseFloydSteinberg","Stucki","Atkinson","Jarvis","Burkes","Sierra","TwoSierra","SierraLite"].indexOf(a.ditherAlgorithm)<0)throw new Error(`Invalid ditherAlgorithm '${a.ditherAlgorithm}'`);void 0===a.serpentine&&(a.serpentine=!0),void 0===a.minimumColorDistanceToDither&&(a.minimumColorDistanceToDither=0),void 0===a.calculateErrorLikeGIMP&&(a.calculateErrorLikeGIMP=!1)}const s=new i.distance.Euclidean,h=new i.palette[e](s,r,n);let l;l=a?new i.image.ErrorDiffusionArray(s,i.image.ErrorDiffusionArrayKernel[a.ditherAlgorithm],a.serpentine,a.minimumColorDistanceToDither,a.calculateErrorLikeGIMP):new i.image.NearestColor(s);const u=[];o.forEach((t=>{const e=t.bitmap.data,r=new ArrayBuffer(e.length),n=new Uint32Array(r);for(let t=0,i=0;t<e.length;t+=4,++i)n[i]=e.readUInt32LE(t,!0);const a=i.utils.PointContainer.fromUint32Array(n,t.bitmap.width,t.bitmap.height);h.sample(a),u.push(a)}));const c=h.quantizeSync();for(let t=0;t<o.length;++t){const e=o[t].bitmap.data,i=l.quantizeSync(u[t],c).toUint32Array();for(let t=0,r=0;t<e.length;t+=4,++r)e.writeUInt32LE(i[r],t)}}t.cloneFrames=function(t){let e=[];return t.forEach((t=>{e.push(new n(t))})),e},t.getColorInfo=function(t,e){let i=!1;const r=[];for(let e=0;e<t.length;++e){let n=t[e].getPalette();if(n.usesTransparency&&(i=!0),n.indexCount>256)throw new a(`Frame ${e} uses more than 256 color indexes`);r.push(n)}if(0===e)return{usesTransparency:i,palettes:r};const n=new Set;r.forEach((t=>{t.colors.forEach((t=>{n.add(t)}))}));let o=n.size;if(i&&++o,e&&o>e)return{usesTransparency:i,palettes:r};const s=new Array(n.size),h=n.values();for(let t=0;t<s.length;++t)s[t]=h.next().value;return s.sort(((t,e)=>t-e)),{colors:s,indexCount:o,usesTransparency:i,palettes:r}},t.copyAsJimp=function(e,i){return t.shareAsJimp(e,new r(i))},t.getMaxDimensions=function(t){let e=0,i=0;return t.forEach((t=>{const r=t.xOffset+t.bitmap.width;r>e&&(e=r);const n=t.yOffset+t.bitmap.height;n>i&&(i=n)})),{maxWidth:e,maxHeight:i}},t.quantizeDekker=function(t,e,i){l(t,"NeuQuantFloat",e=e||256,0,i)},t.quantizeSorokin=function(t,e,i,r){let n;switch(e=e||256,i=i||"min-pop"){case"min-pop":n=2;break;case"top-pop":n=1;break;default:throw new Error(`Invalid quantizeSorokin histogram '${i}'`)}l(t,"RGBQuant",e,n,r)},t.quantizeWu=function(t,e,i,r){if(e=e||256,(i=i||5)<1||i>8)throw new Error("Invalid quantization quality");l(t,"WuQuant",e,i,r)},t.read=function(t,i){return i=i||h,_.isBuffer(t)?i.decodeGif(t):function(t){return new Promise(((i,r)=>{e.readFile(t,((t,e)=>t?r(t):i(e)))}))}(t).then((t=>i.decodeGif(t)))},t.shareAsJimp=function(t,e){const i=new t(e.bitmap.width,e.bitmap.height,0);return i.bitmap.data=e.bitmap.data,i},t.write=function(t,i,r,n){n=n||h;const a=t.match(/\.[a-zA-Z]+$/);if(null!==a&&s.includes(a[0].toLowerCase()))throw new Error(`GIF '${t}' has an unexpected suffix`);return n.encodeGif(i,r).then((i=>function(t,i){return new Promise(((r,n)=>{e.writeFile(t,i,(t=>t?n(t):r()))}))}(t,i.buffer).then((()=>i))))}}(oe)),oe}function gr(){if(pr)return ae;pr=1;const t=Qt,{Gif:e,GifError:i}=ie;function r(){const t=mr();return r=function(){return t},t}const{GifFrame:n}=ur;function a(t,e){const i=t.indexOf(e);return-1===i?null:i}function o(t,e){for(var i,r=0,n=t.length-1;r<=n;)if(t[i=Math.floor((r+n)/2)]>e)n=i-1;else{if(!(t[i]<e))return i;r=i+1}return null}function s(t){const e=t.colors;t.usesTransparency&&e.push(0);const i=e.length;let r=2;for(;i>r;)r<<=1;e.length=r,e.fill(0,i)}function h(t,e){let i=t.bitmap.width*t.bitmap.height;return i=Math.ceil(i*e/8),i+=Math.ceil(i/255),100+i+768}function l(t){let e=t.indexCount,i=0;for(--e;e;)++i,e>>=1;return i>0?i:1}function u(t,e,r,n,h){if(r.interlaced)throw new i("writing interlaced GIFs is not supported");const l=function(t,e,r){const n=r.colors,s=n.length<=8?a:o,h=e.bitmap.data,l=new _(h.length/4);let u=n.length,c=0,f=0;for(;c<h.length;){if(0!==h[c+3]){const t=h.readUInt32BE(c,!0)>>8&16777215;l[f]=s(n,t)}else l[f]=u;c+=4,++f}if(r.usesTransparency){if(256===u)throw new i(`Frame ${t} already has 256 colorsand so can't use transparency`)}else u=null;return{buffer:l,transparentIndex:u}}(e,r,n),u={delay:r.delayCentisecs,disposal:r.disposalMethod,transparent:l.transparentIndex};h&&(s(n),u.palette=n.colors);try{let e,i=t.getOutputBuffer(),n=t.getOutputBufferPosition(),a=!0;for(;a;)if(e=t.addFrame(r.xOffset,r.yOffset,r.bitmap.width,r.bitmap.height,l.buffer,u),a=!1,e>=i.length-1){const e=new _(1.5*i.length);i.copy(e),t.setOutputBuffer(e),t.setOutputBufferPosition(n),i=e,a=!0}return i}catch(t){throw new i(t)}}return ae.GifCodec=class{constructor(t={}){this._transparentRGB=null,"number"==typeof t.transparentRGB&&0!==t.transparentRGB&&(this._transparentRGBA=256*t.transparentRGB),this._testInitialBufferSize=0}decodeGif(r){try{let n;try{n=new t.GifReader(r)}catch(t){throw new i(t)}const a=n.numFrames(),o=[],s={width:n.width,height:n.height,loops:n.loopCount(),usesTransparency:!1};for(let t=0;t<a;++t){const e=this._decodeFrame(n,t,s.usesTransparency);o.push(e.frame),e.usesTransparency&&(s.usesTransparency=!0)}return Promise.resolve(new e(r,o,s))}catch(t){return Promise.reject(t)}}encodeGif(t,n={}){try{if(null===t||0===t.length)throw new i("there are no frames");const a=r().getMaxDimensions(t);return(n=Object.assign({},n)).width=a.maxWidth,n.height=a.maxHeight,void 0===n.loops&&(n.loops=0),n.colorScope=n.colorScope||e.GlobalColorsPreferred,Promise.resolve(this._encodeGif(t,n))}catch(t){return Promise.reject(t)}}_decodeFrame(t,e,r){let a,o;try{if(a=t.frameInfo(e),o=new _(t.width*t.height*4),t.decodeAndBlitFrameRGBA(e,o),a.width!==t.width||a.height!==t.height){if(a.y&&(o=o.slice(a.y*t.width*4)),t.width>a.width)for(let e=0;e<a.height;++e)o.copy(o,e*a.width*4,4*(a.x+e*t.width),4*(a.x+e*t.width)+4*a.width);o=o.slice(0,a.width*a.height*4)}}catch(t){throw new i(t)}let s=!1;if(null===this._transparentRGBA){if(!r)for(let t=3;t<o.length;t+=4)0===o[t]&&(s=!0,t=o.length)}else for(let t=3;t<o.length;t+=4)0===o[t]&&(o.writeUInt32BE(this._transparentRGBA,t-3),s=!0);return{frame:new n(a.width,a.height,o,{xOffset:a.x,yOffset:a.y,disposalMethod:a.disposal,interlaced:a.interlaced,delayCentisecs:a.delay}),usesTransparency:s}}_encodeGif(n,a){let o;if(a.colorScope===e.LocalColorsOnly)o=r().getColorInfo(n,0);else if(o=r().getColorInfo(n,256),!o.colors){if(a.colorScope===e.GlobalColorsOnly)throw new i("Too many color indexes for global color table");a.colorScope=e.LocalColorsOnly}a.usesTransparency=o.usesTransparency;const h=o.palettes;if(a.colorScope===e.LocalColorsOnly){return function(r,n,a,o){const s={loop:n.loops};let h,l=new _(a);try{h=new t.GifWriter(l,n.width,n.height,s)}catch(t){throw new i(t)}for(let t=0;t<r.length;++t)l=u(h,t,r[t],o[t],!0);return new e(l.slice(0,h.end()),r,n)}(n,a,2e3,h)}return function(r,n,a,o){const h={colors:o.colors.slice(),usesTransparency:o.usesTransparency};s(h);const l={palette:h.colors,loop:n.loops};let c,f=new _(a);try{c=new t.GifWriter(f,n.width,n.height,l)}catch(t){throw new i(t)}for(let t=0;t<r.length;++t)f=u(c,t,r[t],o,!1);return new e(f.slice(0,c.end()),r,n)}(n,a,2e3,o)}_getSizeEstimateGlobal(t,e){if(this._testInitialBufferSize>0)return this._testInitialBufferSize;let i=968;const r=l(t);return e.forEach((t=>{i+=h(t,r)})),i}_getSizeEstimateLocal(t,e){if(this._testInitialBufferSize>0)return this._testInitialBufferSize;let i=200;for(let r=0;r<e.length;++r){const n=l(t[r]);i+=h(e[r],n)}return i}},ae}fr.DisposeToAnything=0,fr.DisposeNothing=1,fr.DisposeToBackgroundColor=2,fr.DisposeToPrevious=3,ur.GifFrame=fr;const _r=ee,{Gif:br,GifError:yr}=ie,{GifCodec:wr}=gr(),{GifFrame:vr}=ur;var xr={BitmapImage:_r,Gif:br,GifCodec:wr,GifFrame:vr,GifUtil:mr(),GifError:yr};function kr(){return{mime:"image/gif",encode:async t=>{const e=new xr.BitmapImage(t);xr.GifUtil.quantizeDekker(e,256);const i=new xr.GifFrame(t),r=new xr.GifCodec;return(await r.encodeGif([i],{})).buffer},decode:t=>{const e=new Qt.GifReader(t),i=_.alloc(e.width*e.height*4);return e.decodeAndBlitFrameRGBA(0,i),{data:i,width:e.width,height:e.height}}}}var Er={exports:{}};!function(t){function e(t){var e,i,r,n,a,o=Math.floor,s=new Array(64),h=new Array(64),l=new Array(64),u=new Array(64),c=new Array(65535),f=new Array(65535),d=new Array(64),p=new Array(64),m=[],g=0,b=7,y=new Array(64),w=new Array(64),v=new Array(64),x=new Array(256),k=new Array(2048),E=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],S=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],A=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],I=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],T=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],R=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function O(t,e){for(var i=0,r=0,n=new Array,a=1;a<=16;a++){for(var o=1;o<=t[a];o++)n[e[r]]=[],n[e[r]][0]=i,n[e[r]][1]=a,r++,i++;i*=2}return n}function B(t){for(var e=t[0],i=t[1]-1;i>=0;)e&1<<i&&(g|=1<<b),i--,--b<0&&(255==g?(C(255),C(0)):C(g),b=7,g=0)}function C(t){m.push(t)}function L(t){C(t>>8&255),C(255&t)}function D(t,e,i,r,n){for(var a,o=n[0],s=n[240],h=function(t,e){var i,r,n,a,o,s,h,l,u,c,f=0;for(u=0;u<8;++u){i=t[f],r=t[f+1],n=t[f+2],a=t[f+3],o=t[f+4],s=t[f+5],h=t[f+6];var p=i+(l=t[f+7]),m=i-l,g=r+h,_=r-h,b=n+s,y=n-s,w=a+o,v=a-o,x=p+w,k=p-w,E=g+b,S=g-b;t[f]=x+E,t[f+4]=x-E;var M=.707106781*(S+k);t[f+2]=k+M,t[f+6]=k-M;var A=.382683433*((x=v+y)-(S=_+m)),I=.5411961*x+A,z=1.306562965*S+A,P=.707106781*(E=y+_),T=m+P,R=m-P;t[f+5]=R+I,t[f+3]=R-I,t[f+1]=T+z,t[f+7]=T-z,f+=8}for(f=0,u=0;u<8;++u){i=t[f],r=t[f+8],n=t[f+16],a=t[f+24],o=t[f+32],s=t[f+40],h=t[f+48];var O=i+(l=t[f+56]),B=i-l,C=r+h,L=r-h,D=n+s,U=n-s,F=a+o,N=a-o,j=O+F,G=O-F,Z=C+D,H=C-D;t[f]=j+Z,t[f+32]=j-Z;var $=.707106781*(H+G);t[f+16]=G+$,t[f+48]=G-$;var W=.382683433*((j=N+U)-(H=L+B)),q=.5411961*j+W,Y=1.306562965*H+W,V=.707106781*(Z=U+L),J=B+V,K=B-V;t[f+40]=K+q,t[f+24]=K-q,t[f+8]=J+Y,t[f+56]=J-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],d[u]=c>0?c+.5|0:c-.5|0;return d}(t,e),l=0;l<64;++l)p[E[l]]=h[l];var u=p[0]-i;i=p[0],0==u?B(r[0]):(B(r[f[a=32767+u]]),B(c[a]));for(var m=63;m>0&&0==p[m];m--);if(0==m)return B(o),i;for(var g,_=1;_<=m;){for(var b=_;0==p[_]&&_<=m;++_);var y=_-b;if(y>=16){g=y>>4;for(var w=1;w<=g;++w)B(s);y&=15}a=32767+p[_],B(n[(y<<4)+f[a]]),B(c[a]),_++}return 63!=m&&B(o),i}function U(t){if(t<=0&&(t=1),t>100&&(t=100),a!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],i=0;i<64;i++){var r=o((e[i]*t+50)/100);r<1?r=1:r>255&&(r=255),s[E[i]]=r}for(var n=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var c=o((n[a]*t+50)/100);c<1?c=1:c>255&&(c=255),h[E[a]]=c}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],d=0,p=0;p<8;p++)for(var m=0;m<8;m++)l[d]=1/(s[E[d]]*f[p]*f[m]*8),u[d]=1/(h[E[d]]*f[p]*f[m]*8),d++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),a=t}}this.encode=function(t,a){var o;(new Date).getTime(),a&&U(a),m=new Array,g=0,b=7,L(65496),L(65504),L(16),C(74),C(70),C(73),C(70),C(0),C(1),C(1),C(0),L(1),L(1),C(0),C(0),void 0!==(o=t.comments)&&o.constructor===Array&&o.forEach((t=>{if("string"==typeof t){L(65534);var e,i=t.length;for(L(i+2),e=0;e<i;e++)C(t.charCodeAt(e))}})),function(t){if(t){L(65505),69===t[0]&&120===t[1]&&105===t[2]&&102===t[3]?L(t.length+2):(L(t.length+5+2),C(69),C(120),C(105),C(102),C(0));for(var e=0;e<t.length;e++)C(t[e])}}(t.exifBuffer),function(){L(65499),L(132),C(0);for(var t=0;t<64;t++)C(s[t]);C(1);for(var e=0;e<64;e++)C(h[e])}(),function(t,e){L(65472),L(17),C(8),L(e),L(t),C(3),C(1),C(17),C(0),C(2),C(17),C(1),C(3),C(17),C(1)}(t.width,t.height),function(){L(65476),L(418),C(0);for(var t=0;t<16;t++)C(S[t+1]);for(var e=0;e<=11;e++)C(M[e]);C(16);for(var i=0;i<16;i++)C(A[i+1]);for(var r=0;r<=161;r++)C(I[r]);C(1);for(var n=0;n<16;n++)C(z[n+1]);for(var a=0;a<=11;a++)C(P[a]);C(17);for(var o=0;o<16;o++)C(T[o+1]);for(var s=0;s<=161;s++)C(R[s])}(),L(65498),L(12),C(3),C(1),C(0),C(2),C(17),C(3),C(17),C(0),C(63),C(0);var c=0,f=0,d=0;g=0,b=7,this.encode.displayName="_encode_";for(var p,x,E,O,F,N,j,G,Z,H=t.data,$=t.width,W=t.height,q=4*$,Y=0;Y<W;){for(p=0;p<q;){for(N=F=q*Y+p,j=-1,G=0,Z=0;Z<64;Z++)N=F+(G=Z>>3)*q+(j=4*(7&Z)),Y+G>=W&&(N-=q*(Y+1+G-W)),p+j>=q&&(N-=p+j-q+4),x=H[N++],E=H[N++],O=H[N++],y[Z]=(k[x]+k[E+256|0]+k[O+512|0]>>16)-128,w[Z]=(k[x+768|0]+k[E+1024|0]+k[O+1280|0]>>16)-128,v[Z]=(k[x+1280|0]+k[E+1536|0]+k[O+1792|0]>>16)-128;c=D(y,l,c,e,r),f=D(w,u,f,i,n),d=D(v,u,d,i,n),p+=32}Y+=8}if(b>=0){var V=[];V[1]=b+1,V[0]=(1<<b+1)-1,B(V)}return L(65497),_.from(m)},(new Date).getTime(),t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)x[e]=t(e)}(),e=O(S,M),i=O(z,P),r=O(A,I),n=O(T,R),function(){for(var t=1,e=2,i=1;i<=15;i++){for(var r=t;r<e;r++)f[32767+r]=i,c[32767+r]=[],c[32767+r][1]=i,c[32767+r][0]=r;for(var n=-(e-1);n<=-t;n++)f[32767+n]=i,c[32767+n]=[],c[32767+n][1]=i,c[32767+n][0]=e-1+n;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)k[t]=19595*t,k[t+256|0]=38470*t,k[t+512|0]=7471*t+32768,k[t+768|0]=-11059*t,k[t+1024|0]=-21709*t,k[t+1280|0]=32768*t+8421375,k[t+1536|0]=-27439*t,k[t+1792|0]=-5329*t}(),U(t),(new Date).getTime()}Er.exports=function(t,i){void 0===i&&(i=50);var r=new e(i),n=r.encode(t,i);return{data:n,width:t.width,height:t.height}}}();var Sr,Mr,Ar=Er.exports,Ir={exports:{}};Sr=Ir,Mr=function(){var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),e=4017,i=799,r=3406,n=2276,a=1567,o=3784,s=5793,h=2896;function l(){}function u(t,e){for(var i,r,n=0,a=[],o=16;o>0&&!t[o-1];)o--;a.push({children:[],index:0});var s,h=a[0];for(i=0;i<o;i++){for(r=0;r<t[i];r++){for((h=a.pop()).children[h.index]=e[n];h.index>0;){if(0===a.length)throw new Error("Could not recreate Huffman Table");h=a.pop()}for(h.index++,a.push(h);a.length<=i;)a.push(s={children:[],index:0}),h.children[h.index]=s.children,h=s;n++}i+1<o&&(a.push(s={children:[],index:0}),h.children[h.index]=s.children,h=s)}return a[0].children}function c(e,i,r,n,a,o,s,h,l,u){r.precision,r.samplesPerLine,r.scanLines;var c=r.mcusPerLine,f=r.progressive;r.maxH,r.maxV;var d=i,p=0,m=0;function g(){if(m>0)return m--,p>>m&1;if(255==(p=e[i++])){var t=e[i++];if(t)throw new Error("unexpected marker: "+(p<<8|t).toString(16))}return m=7,p>>>7}function _(t){for(var e,i=t;null!==(e=g());){if("number"==typeof(i=i[e]))return i;if("object"!=typeof i)throw new Error("invalid huffman sequence")}return null}function b(t){for(var e=0;t>0;){var i=g();if(null===i)return;e=e<<1|i,t--}return e}function y(t){var e=b(t);return e>=1<<t-1?e:e+(-1<<t)+1}var w,v=0,x=0;function k(t,e,i,r,n){var a=i%c,o=(i/c|0)*t.v+r,s=a*t.h+n;void 0===t.blocks[o]&&u.tolerantDecoding||e(t,t.blocks[o][s])}function E(t,e,i){var r=i/t.blocksPerLine|0,n=i%t.blocksPerLine;void 0===t.blocks[r]&&u.tolerantDecoding||e(t,t.blocks[r][n])}var S,M,A,I,z,P,T=n.length;P=f?0===o?0===h?function(t,e){var i=_(t.huffmanTableDC),r=0===i?0:y(i)<<l;e[0]=t.pred+=r}:function(t,e){e[0]|=g()<<l}:0===h?function(e,i){if(v>0)v--;else for(var r=o,n=s;r<=n;){var a=_(e.huffmanTableAC),h=15&a,u=a>>4;if(0!==h)i[t[r+=u]]=y(h)*(1<<l),r++;else{if(u<15){v=b(u)+(1<<u)-1;break}r+=16}}}:function(e,i){for(var r=o,n=s,a=0;r<=n;){var h=t[r],u=i[h]<0?-1:1;switch(x){case 0:var c=_(e.huffmanTableAC),f=15&c;if(a=c>>4,0===f)a<15?(v=b(a)+(1<<a),x=4):(a=16,x=1);else{if(1!==f)throw new Error("invalid ACn encoding");w=y(f),x=a?2:3}continue;case 1:case 2:i[h]?i[h]+=(g()<<l)*u:0==--a&&(x=2==x?3:0);break;case 3:i[h]?i[h]+=(g()<<l)*u:(i[h]=w<<l,x=0);break;case 4:i[h]&&(i[h]+=(g()<<l)*u)}r++}4===x&&0==--v&&(x=0)}:function(e,i){var r=_(e.huffmanTableDC),n=0===r?0:y(r);i[0]=e.pred+=n;for(var a=1;a<64;){var o=_(e.huffmanTableAC),s=15&o,h=o>>4;if(0!==s)i[t[a+=h]]=y(s),a++;else{if(h<15)break;a+=16}}};var R,O,B,C,L=0;for(O=1==T?n[0].blocksPerLine*n[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=O);L<O;){for(M=0;M<T;M++)n[M].pred=0;if(v=0,1==T)for(S=n[0],z=0;z<a;z++)E(S,P,L),L++;else for(z=0;z<a;z++){for(M=0;M<T;M++)for(B=(S=n[M]).h,C=S.v,A=0;A<C;A++)for(I=0;I<B;I++)k(S,P,L,A,I);if(++L===O)break}if(L===O)do{if(255===e[i]&&0!==e[i+1])break;i+=1}while(i<e.length-2);if(m=0,(R=e[i]<<8|e[i+1])<65280)throw new Error("marker was not found");if(!(R>=65488&&R<=65495))break;i+=2}return i-d}function f(t,l){var u,c,f=[],d=l.blocksPerLine,p=l.blocksPerColumn,m=d<<3,_=new Int32Array(64),b=new Uint8Array(64);function y(t,u,c){var f,d,p,m,g,_,b,y,w,v,x=l.quantizationTable,k=c;for(v=0;v<64;v++)k[v]=t[v]*x[v];for(v=0;v<8;++v){var E=8*v;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(f=s*k[0+E]+128>>8,d=s*k[4+E]+128>>8,p=k[2+E],m=k[6+E],g=h*(k[1+E]-k[7+E])+128>>8,y=h*(k[1+E]+k[7+E])+128>>8,_=k[3+E]<<4,b=k[5+E]<<4,w=f-d+1>>1,f=f+d+1>>1,d=w,w=p*o+m*a+128>>8,p=p*a-m*o+128>>8,m=w,w=g-b+1>>1,g=g+b+1>>1,b=w,w=y+_+1>>1,_=y-_+1>>1,y=w,w=f-m+1>>1,f=f+m+1>>1,m=w,w=d-p+1>>1,d=d+p+1>>1,p=w,w=g*n+y*r+2048>>12,g=g*r-y*n+2048>>12,y=w,w=_*i+b*e+2048>>12,_=_*e-b*i+2048>>12,b=w,k[0+E]=f+y,k[7+E]=f-y,k[1+E]=d+b,k[6+E]=d-b,k[2+E]=p+_,k[5+E]=p-_,k[3+E]=m+g,k[4+E]=m-g):(w=s*k[0+E]+512>>10,k[0+E]=w,k[1+E]=w,k[2+E]=w,k[3+E]=w,k[4+E]=w,k[5+E]=w,k[6+E]=w,k[7+E]=w)}for(v=0;v<8;++v){var S=v;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(f=s*k[0+S]+2048>>12,d=s*k[32+S]+2048>>12,p=k[16+S],m=k[48+S],g=h*(k[8+S]-k[56+S])+2048>>12,y=h*(k[8+S]+k[56+S])+2048>>12,_=k[24+S],b=k[40+S],w=f-d+1>>1,f=f+d+1>>1,d=w,w=p*o+m*a+2048>>12,p=p*a-m*o+2048>>12,m=w,w=g-b+1>>1,g=g+b+1>>1,b=w,w=y+_+1>>1,_=y-_+1>>1,y=w,w=f-m+1>>1,f=f+m+1>>1,m=w,w=d-p+1>>1,d=d+p+1>>1,p=w,w=g*n+y*r+2048>>12,g=g*r-y*n+2048>>12,y=w,w=_*i+b*e+2048>>12,_=_*e-b*i+2048>>12,b=w,k[0+S]=f+y,k[56+S]=f-y,k[8+S]=d+b,k[48+S]=d-b,k[16+S]=p+_,k[40+S]=p-_,k[24+S]=m+g,k[32+S]=m-g):(w=s*c[v+0]+8192>>14,k[0+S]=w,k[8+S]=w,k[16+S]=w,k[24+S]=w,k[32+S]=w,k[40+S]=w,k[48+S]=w,k[56+S]=w)}for(v=0;v<64;++v){var M=128+(k[v]+8>>4);u[v]=M<0?0:M>255?255:M}}g(m*p*8);for(var w=0;w<p;w++){var v=w<<3;for(u=0;u<8;u++)f.push(new Uint8Array(m));for(var x=0;x<d;x++){y(l.blocks[w][x],b,_);var k=0,E=x<<3;for(c=0;c<8;c++){var S=f[v+c];for(u=0;u<8;u++)S[E+u]=b[k++]}}}return f}function d(t){return t<0?0:t>255?255:t}l.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var i=1e3*this.opts.maxResolutionInMP*1e3,r=0;function n(){var t=e[r]<<8|e[r+1];return r+=2,t}function a(){var t=n(),i=e.subarray(r,r+t-2);return r+=i.length,i}function o(t){var e,i,r=1,n=1;for(i in t.components)t.components.hasOwnProperty(i)&&(r<(e=t.components[i]).h&&(r=e.h),n<e.v&&(n=e.v));var a=Math.ceil(t.samplesPerLine/8/r),o=Math.ceil(t.scanLines/8/n);for(i in t.components)if(t.components.hasOwnProperty(i)){e=t.components[i];var s=Math.ceil(Math.ceil(t.samplesPerLine/8)*e.h/r),h=Math.ceil(Math.ceil(t.scanLines/8)*e.v/n),l=a*e.h,u=o*e.v,c=[];g(u*l*256);for(var f=0;f<u;f++){for(var d=[],p=0;p<l;p++)d.push(new Int32Array(64));c.push(d)}e.blocksPerLine=s,e.blocksPerColumn=h,e.blocks=c}t.maxH=r,t.maxV=n,t.mcusPerLine=a,t.mcusPerColumn=o}e.length;var s,h,l=null,d=null,p=[],m=[],_=[],b=[],y=n(),w=-1;if(this.comments=[],65496!=y)throw new Error("SOI not found");for(y=n();65497!=y;){switch(y){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var v=a();if(65534===y){var x=String.fromCharCode.apply(null,v);this.comments.push(x)}65504===y&&74===v[0]&&70===v[1]&&73===v[2]&&70===v[3]&&0===v[4]&&(l={version:{major:v[5],minor:v[6]},densityUnits:v[7],xDensity:v[8]<<8|v[9],yDensity:v[10]<<8|v[11],thumbWidth:v[12],thumbHeight:v[13],thumbData:v.subarray(14,14+3*v[12]*v[13])}),65505===y&&69===v[0]&&120===v[1]&&105===v[2]&&102===v[3]&&0===v[4]&&(this.exifBuffer=v.subarray(5,v.length)),65518===y&&65===v[0]&&100===v[1]&&111===v[2]&&98===v[3]&&101===v[4]&&0===v[5]&&(d={version:v[6],flags0:v[7]<<8|v[8],flags1:v[9]<<8|v[10],transformCode:v[11]});break;case 65499:for(var k=n()+r-2;r<k;){var E=e[r++];g(256);var S=new Int32Array(64);if(E>>4){if(E>>4!=1)throw new Error("DQT: invalid table spec");for(q=0;q<64;q++)S[t[q]]=n()}else for(q=0;q<64;q++)S[t[q]]=e[r++];p[15&E]=S}break;case 65472:case 65473:case 65474:n(),(s={}).extended=65473===y,s.progressive=65474===y,s.precision=e[r++],s.scanLines=n(),s.samplesPerLine=n(),s.components={},s.componentsOrder=[];var M=s.scanLines*s.samplesPerLine;if(M>i){var A=Math.ceil((M-i)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${A}MP`)}var I,z=e[r++];for($=0;$<z;$++){I=e[r];var P=e[r+1]>>4,T=15&e[r+1],R=e[r+2];if(P<=0||T<=0)throw new Error("Invalid sampling factor, expected values above 0");s.componentsOrder.push(I),s.components[I]={h:P,v:T,quantizationIdx:R},r+=3}o(s),m.push(s);break;case 65476:var O=n();for($=2;$<O;){var B=e[r++],C=new Uint8Array(16),L=0;for(q=0;q<16;q++,r++)L+=C[q]=e[r];g(16+L);var D=new Uint8Array(L);for(q=0;q<L;q++,r++)D[q]=e[r];$+=17+L,(B>>4?_:b)[15&B]=u(C,D)}break;case 65501:n(),h=n();break;case 65500:n(),n();break;case 65498:n();var U=e[r++],F=[];for($=0;$<U;$++){Y=s.components[e[r++]];var N=e[r++];Y.huffmanTableDC=b[N>>4],Y.huffmanTableAC=_[15&N],F.push(Y)}var j=e[r++],G=e[r++],Z=e[r++],H=c(e,r,s,F,h,j,G,Z>>4,15&Z,this.opts);r+=H;break;case 65535:255!==e[r]&&r--;break;default:if(255==e[r-3]&&e[r-2]>=192&&e[r-2]<=254){r-=3;break}if(224===y||225==y){if(-1!==w)throw new Error(`first unknown JPEG marker at offset ${w.toString(16)}, second unknown JPEG marker ${y.toString(16)} at offset ${(r-1).toString(16)}`);w=r-1;const t=n();if(255===e[r+t-2]){r+=t-2;break}}throw new Error("unknown JPEG marker "+y.toString(16))}y=n()}if(1!=m.length)throw new Error("only single frame JPEGs supported");for(var $=0;$<m.length;$++){var W=m[$].components;for(var q in W)W[q].quantizationTable=p[W[q].quantizationIdx],delete W[q].quantizationIdx}for(this.width=s.samplesPerLine,this.height=s.scanLines,this.jfif=l,this.adobe=d,this.components=[],$=0;$<s.componentsOrder.length;$++){var Y=s.components[s.componentsOrder[$]];this.components.push({lines:f(0,Y),scaleX:Y.h/s.maxH,scaleY:Y.v/s.maxV})}},getData:function(t,e){var i,r,n,a,o,s,h,l,u,c,f,p,m,_,b,y,w,v,x,k,E,S=this.width/t,M=this.height/e,A=0,I=t*e*this.components.length;g(I);var z=new Uint8Array(I);switch(this.components.length){case 1:for(i=this.components[0],c=0;c<e;c++)for(o=i.lines[0|c*i.scaleY*M],u=0;u<t;u++)f=o[0|u*i.scaleX*S],z[A++]=f;break;case 2:for(i=this.components[0],r=this.components[1],c=0;c<e;c++)for(o=i.lines[0|c*i.scaleY*M],s=r.lines[0|c*r.scaleY*M],u=0;u<t;u++)f=o[0|u*i.scaleX*S],z[A++]=f,f=s[0|u*r.scaleX*S],z[A++]=f;break;case 3:for(E=!0,this.adobe&&this.adobe.transformCode?E=!0:void 0!==this.opts.colorTransform&&(E=!!this.opts.colorTransform),i=this.components[0],r=this.components[1],n=this.components[2],c=0;c<e;c++)for(o=i.lines[0|c*i.scaleY*M],s=r.lines[0|c*r.scaleY*M],h=n.lines[0|c*n.scaleY*M],u=0;u<t;u++)E?(f=o[0|u*i.scaleX*S],p=s[0|u*r.scaleX*S],v=d(f+1.402*((m=h[0|u*n.scaleX*S])-128)),x=d(f-.3441363*(p-128)-.71413636*(m-128)),k=d(f+1.772*(p-128))):(v=o[0|u*i.scaleX*S],x=s[0|u*r.scaleX*S],k=h[0|u*n.scaleX*S]),z[A++]=v,z[A++]=x,z[A++]=k;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(E=!1,this.adobe&&this.adobe.transformCode?E=!0:void 0!==this.opts.colorTransform&&(E=!!this.opts.colorTransform),i=this.components[0],r=this.components[1],n=this.components[2],a=this.components[3],c=0;c<e;c++)for(o=i.lines[0|c*i.scaleY*M],s=r.lines[0|c*r.scaleY*M],h=n.lines[0|c*n.scaleY*M],l=a.lines[0|c*a.scaleY*M],u=0;u<t;u++)E?(f=o[0|u*i.scaleX*S],p=s[0|u*r.scaleX*S],m=h[0|u*n.scaleX*S],_=l[0|u*a.scaleX*S],b=255-d(f+1.402*(m-128)),y=255-d(f-.3441363*(p-128)-.71413636*(m-128)),w=255-d(f+1.772*(p-128))):(b=o[0|u*i.scaleX*S],y=s[0|u*r.scaleX*S],w=h[0|u*n.scaleX*S],_=l[0|u*a.scaleX*S]),z[A++]=255-b,z[A++]=255-y,z[A++]=255-w,z[A++]=255-_;break;default:throw new Error("Unsupported color mode")}return z},copyToImageData:function(t,e){var i,r,n,a,o,s,h,l,u,c=t.width,f=t.height,p=t.data,m=this.getData(c,f),g=0,_=0;switch(this.components.length){case 1:for(r=0;r<f;r++)for(i=0;i<c;i++)n=m[g++],p[_++]=n,p[_++]=n,p[_++]=n,e&&(p[_++]=255);break;case 3:for(r=0;r<f;r++)for(i=0;i<c;i++)h=m[g++],l=m[g++],u=m[g++],p[_++]=h,p[_++]=l,p[_++]=u,e&&(p[_++]=255);break;case 4:for(r=0;r<f;r++)for(i=0;i<c;i++)o=m[g++],s=m[g++],n=m[g++],h=255-d(o*(1-(a=m[g++])/255)+a),l=255-d(s*(1-a/255)+a),u=255-d(n*(1-a/255)+a),p[_++]=h,p[_++]=l,p[_++]=u,e&&(p[_++]=255);break;default:throw new Error("Unsupported color mode")}}};var p=0,m=0;function g(t=0){var e=p+t;if(e>m){var i=Math.ceil((e-m)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${i}MB`)}p=e}return l.resetMaxMemoryUsage=function(t){p=0,m=t},l.getBytesAllocated=function(){return p},l.requestMemoryAllocation=g,l}(),Sr.exports=function(t,e={}){var i={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...e},r=new Uint8Array(t),n=new Mr;n.opts=i,Mr.resetMaxMemoryUsage(1024*i.maxMemoryUsageInMB*1024),n.parse(r);var a=i.formatAsRGBA?4:3,o=n.width*n.height*a;try{Mr.requestMemoryAllocation(o);var s={width:n.width,height:n.height,exifBuffer:n.exifBuffer,data:i.useTArray?new Uint8Array(o):_.alloc(o)};n.comments.length>0&&(s.comments=n.comments)}catch(t){if(t instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+o);if(t instanceof ReferenceError&&"Buffer is not defined"===t.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw t}return n.copyToImageData(s,i.formatAsRGBA),s};var zr=e({encode:Ar,decode:Ir.exports});function Pr(){return{mime:"image/jpeg",encode:(t,{quality:e=100}={})=>zr.encode(t,e).data,decode:(t,e)=>zr.decode(t,e)}}function Tr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Rr={exports:{}};Rr.exports=function(){function t(e,i,r){function n(o,s){if(!i[o]){if(!e[o]){if(!s&&Tr)return Tr(o);if(a)return a(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[o]={exports:{}};e[o][0].call(l.exports,(function(t){return n(e[o][1][t]||t)}),l,l.exports,t,e,i,r)}return i[o].exports}for(var a=Tr,o=0;o<r.length;o++)n(r[o]);return n}return t}()({1:[function(t,e,i){(function(e){(function(){let r=t("./interlace"),n=[function(){},function(t,e,i,r){if(r===e.length)throw new Error("Ran out of data");let n=e[r];t[i]=n,t[i+1]=n,t[i+2]=n,t[i+3]=255},function(t,e,i,r){if(r+1>=e.length)throw new Error("Ran out of data");let n=e[r];t[i]=n,t[i+1]=n,t[i+2]=n,t[i+3]=e[r+1]},function(t,e,i,r){if(r+2>=e.length)throw new Error("Ran out of data");t[i]=e[r],t[i+1]=e[r+1],t[i+2]=e[r+2],t[i+3]=255},function(t,e,i,r){if(r+3>=e.length)throw new Error("Ran out of data");t[i]=e[r],t[i+1]=e[r+1],t[i+2]=e[r+2],t[i+3]=e[r+3]}],a=[function(){},function(t,e,i,r){let n=e[0];t[i]=n,t[i+1]=n,t[i+2]=n,t[i+3]=r},function(t,e,i){let r=e[0];t[i]=r,t[i+1]=r,t[i+2]=r,t[i+3]=e[1]},function(t,e,i,r){t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=r},function(t,e,i){t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=e[3]}];function o(t,e){let i=[],r=0;function n(){if(r===t.length)throw new Error("Ran out of data");let n,a,o,s,h,l,u,c,f=t[r];switch(r++,e){default:throw new Error("unrecognised depth");case 16:u=t[r],r++,i.push((f<<8)+u);break;case 4:u=15&f,c=f>>4,i.push(c,u);break;case 2:h=3&f,l=f>>2&3,u=f>>4&3,c=f>>6&3,i.push(c,u,l,h);break;case 1:n=1&f,a=f>>1&1,o=f>>2&1,s=f>>3&1,h=f>>4&1,l=f>>5&1,u=f>>6&1,c=f>>7&1,i.push(c,u,l,h,s,o,a,n)}}return{get:function(t){for(;i.length<t;)n();let e=i.slice(0,t);return i=i.slice(t),e},resetAfterLine:function(){i.length=0},end:function(){if(r!==t.length)throw new Error("extra data found")}}}function s(t,e,i,r,a,o){let s=t.width,h=t.height,l=t.index;for(let t=0;t<h;t++)for(let h=0;h<s;h++){let s=i(h,t,l);n[r](e,a,s,o),o+=r}return o}function h(t,e,i,r,n,o){let s=t.width,h=t.height,l=t.index;for(let t=0;t<h;t++){for(let h=0;h<s;h++){let s=n.get(r),u=i(h,t,l);a[r](e,s,u,o)}n.resetAfterLine()}}i.dataToBitMap=function(t,i){let n,a,l=i.width,u=i.height,c=i.depth,f=i.bpp,d=i.interlace;8!==c&&(n=o(t,c)),a=c<=8?e.alloc(l*u*4):new Uint16Array(l*u*4);let p,m,g=Math.pow(2,c)-1,_=0;if(d)p=r.getImagePasses(l,u),m=r.getInterlaceIterator(l,u);else{let t=0;m=function(){let e=t;return t+=4,e},p=[{width:l,height:u}]}for(let e=0;e<p.length;e++)8===c?_=s(p[e],a,m,f,t,_):h(p[e],a,m,f,n,g);if(8===c){if(_!==t.length)throw new Error("extra data found")}else n.end();return a}}).call(this)}).call(this,t("buffer").Buffer)},{"./interlace":11,buffer:32}],2:[function(t,e,i){(function(i){(function(){let r=t("./constants");e.exports=function(t,e,n,a){let o=-1!==[r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(a.colorType);if(a.colorType===a.inputColorType){let e=function(){let t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256!==new Int16Array(t)[0]}();if(8===a.bitDepth||16===a.bitDepth&&e)return t}let s=16!==a.bitDepth?t:new Uint16Array(t.buffer),h=255,l=r.COLORTYPE_TO_BPP_MAP[a.inputColorType];4!==l||a.inputHasAlpha||(l=3);let u=r.COLORTYPE_TO_BPP_MAP[a.colorType];16===a.bitDepth&&(h=65535,u*=2);let c=i.alloc(e*n*u),f=0,d=0,p=a.bgColor||{};function m(){let t,e,i,n=h;switch(a.inputColorType){case r.COLORTYPE_COLOR_ALPHA:n=s[f+3],t=s[f],e=s[f+1],i=s[f+2];break;case r.COLORTYPE_COLOR:t=s[f],e=s[f+1],i=s[f+2];break;case r.COLORTYPE_ALPHA:n=s[f+1],t=s[f],e=t,i=t;break;case r.COLORTYPE_GRAYSCALE:t=s[f],e=t,i=t;break;default:throw new Error("input color type:"+a.inputColorType+" is not supported at present")}return a.inputHasAlpha&&(o||(n/=h,t=Math.min(Math.max(Math.round((1-n)*p.red+n*t),0),h),e=Math.min(Math.max(Math.round((1-n)*p.green+n*e),0),h),i=Math.min(Math.max(Math.round((1-n)*p.blue+n*i),0),h))),{red:t,green:e,blue:i,alpha:n}}void 0===p.red&&(p.red=h),void 0===p.green&&(p.green=h),void 0===p.blue&&(p.blue=h);for(let t=0;t<n;t++)for(let t=0;t<e;t++){let t=m();switch(a.colorType){case r.COLORTYPE_COLOR_ALPHA:case r.COLORTYPE_COLOR:8===a.bitDepth?(c[d]=t.red,c[d+1]=t.green,c[d+2]=t.blue,o&&(c[d+3]=t.alpha)):(c.writeUInt16BE(t.red,d),c.writeUInt16BE(t.green,d+2),c.writeUInt16BE(t.blue,d+4),o&&c.writeUInt16BE(t.alpha,d+6));break;case r.COLORTYPE_ALPHA:case r.COLORTYPE_GRAYSCALE:{let e=(t.red+t.green+t.blue)/3;8===a.bitDepth?(c[d]=e,o&&(c[d+1]=t.alpha)):(c.writeUInt16BE(e,d),o&&c.writeUInt16BE(t.alpha,d+2));break}default:throw new Error("unrecognised color Type "+a.colorType)}f+=l,d+=u}return c}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,buffer:32}],3:[function(t,e,i){(function(i,r){(function(){let n=t("util"),a=t("stream"),o=e.exports=function(){a.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};n.inherits(o,a),o.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),i.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(t,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let i;return i=r.isBuffer(t)?t:r.from(t,e||this._encoding),this._buffers.push(i),this._buffered+=i.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused},o.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},o.prototype._processRead=function(t){this._reads.shift();let e=0,i=0,n=r.alloc(t.length);for(;e<t.length;){let r=this._buffers[i++],a=Math.min(r.length,t.length-e);r.copy(n,e,0,a),e+=a,a!==r.length&&(this._buffers[--i]=r.slice(a))}i>0&&this._buffers.splice(0,i),this._buffered-=t.length,t.func.call(this,n)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}}}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:63,buffer:32,stream:65,util:84}],4:[function(t,e,i){e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],5:[function(t,e,i){let r=[];!function(){for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;r[t]=e}}();let n=e.exports=function(){this._crc=-1};n.prototype.write=function(t){for(let e=0;e<t.length;e++)this._crc=r[255&(this._crc^t[e])]^this._crc>>>8;return!0},n.prototype.crc32=function(){return~this._crc},n.crc32=function(t){let e=-1;for(let i=0;i<t.length;i++)e=r[255&(e^t[i])]^e>>>8;return~e}},{}],6:[function(t,e,i){(function(i){(function(){let r=t("./paeth-predictor");function n(t,e,i,r,n){for(let a=0;a<i;a++)r[n+a]=t[e+a]}function a(t,e,i){let r=0,n=e+i;for(let i=e;i<n;i++)r+=Math.abs(t[i]);return r}function o(t,e,i,r,n,a){for(let o=0;o<i;o++){let i=o>=a?t[e+o-a]:0,s=t[e+o]-i;r[n+o]=s}}function s(t,e,i,r){let n=0;for(let a=0;a<i;a++){let i=a>=r?t[e+a-r]:0,o=t[e+a]-i;n+=Math.abs(o)}return n}function h(t,e,i,r,n){for(let a=0;a<i;a++){let o=e>0?t[e+a-i]:0,s=t[e+a]-o;r[n+a]=s}}function l(t,e,i){let r=0,n=e+i;for(let a=e;a<n;a++){let n=e>0?t[a-i]:0,o=t[a]-n;r+=Math.abs(o)}return r}function u(t,e,i,r,n,a){for(let o=0;o<i;o++){let s=o>=a?t[e+o-a]:0,h=e>0?t[e+o-i]:0,l=t[e+o]-(s+h>>1);r[n+o]=l}}function c(t,e,i,r){let n=0;for(let a=0;a<i;a++){let o=a>=r?t[e+a-r]:0,s=e>0?t[e+a-i]:0,h=t[e+a]-(o+s>>1);n+=Math.abs(h)}return n}function f(t,e,i,n,a,o){for(let s=0;s<i;s++){let h=s>=o?t[e+s-o]:0,l=e>0?t[e+s-i]:0,u=e>0&&s>=o?t[e+s-(i+o)]:0,c=t[e+s]-r(h,l,u);n[a+s]=c}}function d(t,e,i,n){let a=0;for(let o=0;o<i;o++){let s=o>=n?t[e+o-n]:0,h=e>0?t[e+o-i]:0,l=e>0&&o>=n?t[e+o-(i+n)]:0,u=t[e+o]-r(s,h,l);a+=Math.abs(u)}return a}let p={0:n,1:o,2:h,3:u,4:f},m={0:a,1:s,2:l,3:c,4:d};e.exports=function(t,e,r,n,a){let o;if("filterType"in n&&-1!==n.filterType){if("number"!=typeof n.filterType)throw new Error("unrecognised filter types");o=[n.filterType]}else o=[0,1,2,3,4];16===n.bitDepth&&(a*=2);let s=e*a,h=0,l=0,u=i.alloc((s+1)*r),c=o[0];for(let e=0;e<r;e++){if(o.length>1){let e=1/0;for(let i=0;i<o.length;i++){let r=m[o[i]](t,l,s,a);r<e&&(c=o[i],e=r)}}u[h]=c,h++,p[c](t,l,s,u,h,a),h+=s,l+=s}return u}}).call(this)}).call(this,t("buffer").Buffer)},{"./paeth-predictor":15,buffer:32}],7:[function(t,e,i){(function(i){(function(){let r=t("util"),n=t("./chunkstream"),a=t("./filter-parse"),o=e.exports=function(t){n.call(this);let e=[],r=this;this._filter=new a(t,{read:this.read.bind(this),write:function(t){e.push(t)},complete:function(){r.emit("complete",i.concat(e))}}),this._filter.start()};r.inherits(o,n)}).call(this)}).call(this,t("buffer").Buffer)},{"./chunkstream":3,"./filter-parse":9,buffer:32,util:84}],8:[function(t,e,i){(function(e){(function(){let r=t("./sync-reader"),n=t("./filter-parse");i.process=function(t,i){let a=[],o=new r(t);return new n(i,{read:o.read.bind(o),write:function(t){a.push(t)},complete:function(){}}).start(),o.process(),e.concat(a)}}).call(this)}).call(this,t("buffer").Buffer)},{"./filter-parse":9,"./sync-reader":22,buffer:32}],9:[function(t,e,i){(function(i){(function(){let r=t("./interlace"),n=t("./paeth-predictor");function a(t,e,i){let r=t*e;return 8!==i&&(r=Math.ceil(r/(8/i))),r}let o=e.exports=function(t,e){let i=t.width,n=t.height,o=t.interlace,s=t.bpp,h=t.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],o){let t=r.getImagePasses(i,n);for(let e=0;e<t.length;e++)this._images.push({byteWidth:a(t[e].width,s,h),height:t[e].height,lineIndex:0})}else this._images.push({byteWidth:a(i,s,h),height:n,lineIndex:0});this._xComparison=8===h?s:16===h?2*s:1};o.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},o.prototype._unFilterType1=function(t,e,i){let r=this._xComparison,n=r-1;for(let a=0;a<i;a++){let i=t[1+a],o=a>n?e[a-r]:0;e[a]=i+o}},o.prototype._unFilterType2=function(t,e,i){let r=this._lastLine;for(let n=0;n<i;n++){let i=t[1+n],a=r?r[n]:0;e[n]=i+a}},o.prototype._unFilterType3=function(t,e,i){let r=this._xComparison,n=r-1,a=this._lastLine;for(let o=0;o<i;o++){let i=t[1+o],s=a?a[o]:0,h=o>n?e[o-r]:0,l=Math.floor((h+s)/2);e[o]=i+l}},o.prototype._unFilterType4=function(t,e,i){let r=this._xComparison,a=r-1,o=this._lastLine;for(let s=0;s<i;s++){let i=t[1+s],h=o?o[s]:0,l=s>a?e[s-r]:0,u=s>a&&o?o[s-r]:0,c=n(l,h,u);e[s]=i+c}},o.prototype._reverseFilterLine=function(t){let e,r=t[0],n=this._images[this._imageIndex],a=n.byteWidth;if(0===r)e=t.slice(1,a+1);else switch(e=i.alloc(a),r){case 1:this._unFilterType1(t,e,a);break;case 2:this._unFilterType2(t,e,a);break;case 3:this._unFilterType3(t,e,a);break;case 4:this._unFilterType4(t,e,a);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(e),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=e,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this)}).call(this,t("buffer").Buffer)},{"./interlace":11,"./paeth-predictor":15,buffer:32}],10:[function(t,e,i){(function(t){(function(){function i(t,e,i,r,n){let a=0;for(let o=0;o<r;o++)for(let r=0;r<i;r++){let i=n[t[a]];if(!i)throw new Error("index "+t[a]+" not in palette");for(let t=0;t<4;t++)e[a+t]=i[t];a+=4}}function r(t,e,i,r,n){let a=0;for(let o=0;o<r;o++)for(let r=0;r<i;r++){let i=!1;if(1===n.length?n[0]===t[a]&&(i=!0):n[0]===t[a]&&n[1]===t[a+1]&&n[2]===t[a+2]&&(i=!0),i)for(let t=0;t<4;t++)e[a+t]=0;a+=4}}function n(t,e,i,r,n){let a=255,o=Math.pow(2,n)-1,s=0;for(let n=0;n<r;n++)for(let r=0;r<i;r++){for(let i=0;i<4;i++)e[s+i]=Math.floor(t[s+i]*a/o+.5);s+=4}}e.exports=function(e,a,o=!1){let s=a.depth,h=a.width,l=a.height,u=a.colorType,c=a.transColor,f=a.palette,d=e;return 3===u?i(e,d,h,l,f):(c&&r(e,d,h,l,c),8===s||o||(16===s&&(d=t.alloc(h*l*4)),n(e,d,h,l,s))),d}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:32}],11:[function(t,e,i){let r=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];i.getImagePasses=function(t,e){let i=[],n=t%8,a=e%8,o=(t-n)/8,s=(e-a)/8;for(let t=0;t<r.length;t++){let e=r[t],h=o*e.x.length,l=s*e.y.length;for(let t=0;t<e.x.length&&e.x[t]<n;t++)h++;for(let t=0;t<e.y.length&&e.y[t]<a;t++)l++;h>0&&l>0&&i.push({width:h,height:l,index:t})}return i},i.getInterlaceIterator=function(t){return function(e,i,n){let a=e%r[n].x.length,o=(e-a)/r[n].x.length*8+r[n].x[a],s=i%r[n].y.length;return 4*o+((i-s)/r[n].y.length*8+r[n].y[s])*t*4}}},{}],12:[function(t,e,i){(function(i){(function(){let r=t("util"),n=t("stream"),a=t("./constants"),o=t("./packer"),s=e.exports=function(t){n.call(this);let e=t||{};this._packer=new o(e),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,n),s.prototype.pack=function(t,e,r,n){this.emit("data",i.from(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,r)),n&&this.emit("data",this._packer.packGAMA(n));let o=this._packer.filterData(t,e,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,"./packer":14,buffer:32,stream:65,util:84}],13:[function(t,e,i){(function(i){(function(){let r=!0,n=t("zlib");n.deflateSync||(r=!1);let a=t("./constants"),o=t("./packer");e.exports=function(t,e){if(!r)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let s=new o(e||{}),h=[];h.push(i.from(a.PNG_SIGNATURE)),h.push(s.packIHDR(t.width,t.height)),t.gamma&&h.push(s.packGAMA(t.gamma));let l=s.filterData(t.data,t.width,t.height),u=n.deflateSync(l,s.getDeflateOptions());if(l=null,!u||!u.length)throw new Error("bad png - invalid compressed data response");return h.push(s.packIDAT(u)),h.push(s.packIEND()),i.concat(h)}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,"./packer":14,buffer:32,zlib:31}],14:[function(t,e,i){(function(i){(function(){let r=t("./constants"),n=t("./crc"),a=t("./bitpacker"),o=t("./filter-pack"),s=t("zlib"),h=e.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||s.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:r.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:r.COLORTYPE_COLOR_ALPHA,-1===[r.COLORTYPE_GRAYSCALE,r.COLORTYPE_COLOR,r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[r.COLORTYPE_GRAYSCALE,r.COLORTYPE_COLOR,r.COLORTYPE_COLOR_ALPHA,r.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};h.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},h.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},h.prototype.filterData=function(t,e,i){let n=a(t,e,i,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(n,e,i,this._options,s)},h.prototype._packChunk=function(t,e){let r=e?e.length:0,a=i.alloc(r+12);return a.writeUInt32BE(r,0),a.writeUInt32BE(t,4),e&&e.copy(a,8),a.writeInt32BE(n.crc32(a.slice(4,a.length-4)),a.length-4),a},h.prototype.packGAMA=function(t){let e=i.alloc(4);return e.writeUInt32BE(Math.floor(t*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,e)},h.prototype.packIHDR=function(t,e){let n=i.alloc(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(r.TYPE_IHDR,n)},h.prototype.packIDAT=function(t){return this._packChunk(r.TYPE_IDAT,t)},h.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}}).call(this)}).call(this,t("buffer").Buffer)},{"./bitpacker":2,"./constants":4,"./crc":5,"./filter-pack":6,buffer:32,zlib:31}],15:[function(t,e,i){e.exports=function(t,e,i){let r=t+e-i,n=Math.abs(r-t),a=Math.abs(r-e),o=Math.abs(r-i);return n<=a&&n<=o?t:a<=o?e:i}},{}],16:[function(t,e,i){let r=t("util"),n=t("zlib"),a=t("./chunkstream"),o=t("./filter-parse-async"),s=t("./parser"),h=t("./bitmapper"),l=t("./format-normaliser"),u=e.exports=function(t){a.call(this),this._parser=new s(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};r.inherits(u,a),u.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},u.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=n.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,e=Math.max(t,n.Z_MIN_CHUNK);this._inflate=n.createInflate({chunkSize:e});let i=t,r=this.emit.bind(this,"error");this._inflate.on("error",(function(t){i&&r(t)})),this._filter.on("complete",this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){i&&(t.length>i&&(t=t.slice(0,i)),i-=t.length,a(t))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)},u.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new o(this._bitmapInfo)},u.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},u.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},u.prototype._simpleTransparency=function(){this._metaData.alpha=!0},u.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},u.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},u.prototype._complete=function(t){if(this.errord)return;let e;try{let i=h.dataToBitMap(t,this._bitmapInfo);e=l(i,this._bitmapInfo,this._options.skipRescale),i=null}catch(t){return void this._handleError(t)}this.emit("parsed",e)}},{"./bitmapper":1,"./chunkstream":3,"./filter-parse-async":7,"./format-normaliser":10,"./parser":18,util:84,zlib:31}],17:[function(t,e,i){(function(i){(function(){let r=!0,n=t("zlib"),a=t("./sync-inflate");n.deflateSync||(r=!1);let o=t("./sync-reader"),s=t("./filter-parse-sync"),h=t("./parser"),l=t("./bitmapper"),u=t("./format-normaliser");e.exports=function(t,e){if(!r)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let c,f,d;function p(t){c=t}function m(t){f=t}function g(t){f.transColor=t}function _(t){f.palette=t}function b(){f.alpha=!0}function y(t){d=t}let w=[];function v(t){w.push(t)}let x=new o(t);if(new h(e,{read:x.read.bind(x),error:p,metadata:m,gamma:y,palette:_,transColor:g,inflateData:v,simpleTransparency:b}).start(),x.process(),c)throw c;let k,E=i.concat(w);if(w.length=0,f.interlace)k=n.inflateSync(E);else{let t=(1+(f.width*f.bpp*f.depth+7>>3))*f.height;k=a(E,{chunkSize:t,maxLength:t})}if(E=null,!k||!k.length)throw new Error("bad png - invalid inflate data response");let S=s.process(k,f);E=null;let M=l.dataToBitMap(S,f);S=null;let A=u(M,f,e.skipRescale);return f.data=A,f.gamma=d||0,f}}).call(this)}).call(this,t("buffer").Buffer)},{"./bitmapper":1,"./filter-parse-sync":8,"./format-normaliser":10,"./parser":18,"./sync-inflate":21,"./sync-reader":22,buffer:32,zlib:31}],18:[function(t,e,i){(function(i){(function(){let r=t("./constants"),n=t("./crc"),a=e.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[r.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[r.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[r.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[r.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[r.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[r.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};a.prototype.start=function(){this.read(r.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(t){let e=r.PNG_SIGNATURE;for(let i=0;i<e.length;i++)if(t[i]!==e[i])return void this.error(new Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},a.prototype._parseChunkBegin=function(t){let e=t.readUInt32BE(0),a=t.readUInt32BE(4),o="";for(let e=4;e<8;e++)o+=String.fromCharCode(t[e]);let s=Boolean(32&t[4]);if(this._hasIHDR||a===r.TYPE_IHDR){if(this._crc=new n,this._crc.write(i.from(o)),this._chunks[a])return this._chunks[a](e);s?this.read(e+4,this._skipChunk.bind(this)):this.error(new Error("Unsupported critical chunk type "+o))}else this.error(new Error("Expected IHDR on beggining"))},a.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},a.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},a.prototype._parseChunkEnd=function(t){let e=t.readInt32BE(0),i=this._crc.crc32();this._options.checkCRC&&i!==e?this.error(new Error("Crc error - "+e+" - "+i)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},a.prototype._handleIHDR=function(t){this.read(t,this._parseIHDR.bind(this))},a.prototype._parseIHDR=function(t){this._crc.write(t);let e=t.readUInt32BE(0),i=t.readUInt32BE(4),n=t[8],a=t[9],o=t[10],s=t[11],h=t[12];if(8!==n&&4!==n&&2!==n&&1!==n&&16!==n)return void this.error(new Error("Unsupported bit depth "+n));if(!(a in r.COLORTYPE_TO_BPP_MAP))return void this.error(new Error("Unsupported color type"));if(0!==o)return void this.error(new Error("Unsupported compression method"));if(0!==s)return void this.error(new Error("Unsupported filter method"));if(0!==h&&1!==h)return void this.error(new Error("Unsupported interlace method"));this._colorType=a;let l=r.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:i,depth:n,interlace:Boolean(h),palette:Boolean(a&r.COLORTYPE_PALETTE),color:Boolean(a&r.COLORTYPE_COLOR),alpha:Boolean(a&r.COLORTYPE_ALPHA),bpp:l,colorType:a}),this._handleChunkEnd()},a.prototype._handlePLTE=function(t){this.read(t,this._parsePLTE.bind(this))},a.prototype._parsePLTE=function(t){this._crc.write(t);let e=Math.floor(t.length/3);for(let i=0;i<e;i++)this._palette.push([t[3*i],t[3*i+1],t[3*i+2],255]);this.palette(this._palette),this._handleChunkEnd()},a.prototype._handleTRNS=function(t){this.simpleTransparency(),this.read(t,this._parseTRNS.bind(this))},a.prototype._parseTRNS=function(t){if(this._crc.write(t),this._colorType===r.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(new Error("Transparency chunk must be after palette"));if(t.length>this._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(let e=0;e<t.length;e++)this._palette[e][3]=t[e];this.palette(this._palette)}this._colorType===r.COLORTYPE_GRAYSCALE&&this.transColor([t.readUInt16BE(0)]),this._colorType===r.COLORTYPE_COLOR&&this.transColor([t.readUInt16BE(0),t.readUInt16BE(2),t.readUInt16BE(4)]),this._handleChunkEnd()},a.prototype._handleGAMA=function(t){this.read(t,this._parseGAMA.bind(this))},a.prototype._parseGAMA=function(t){this._crc.write(t),this.gamma(t.readUInt32BE(0)/r.GAMMA_DIVISION),this._handleChunkEnd()},a.prototype._handleIDAT=function(t){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-t,this._parseIDAT.bind(this,t))},a.prototype._parseIDAT=function(t,e){if(this._crc.write(e),this._colorType===r.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw new Error("Expected palette not found");this.inflateData(e);let i=t-e.length;i>0?this._handleIDAT(i):this._handleChunkEnd()},a.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},a.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,"./crc":5,buffer:32}],19:[function(t,e,i){let r=t("./parser-sync"),n=t("./packer-sync");i.read=function(t,e){return r(t,e||{})},i.write=function(t,e){return n(t,e)}},{"./packer-sync":13,"./parser-sync":17}],20:[function(t,e,i){(function(e,r){(function(){let n=t("util"),a=t("stream"),o=t("./parser-async"),s=t("./packer-async"),h=t("./png-sync"),l=i.PNG=function(t){a.call(this),t=t||{},this.width=0|t.width,this.height=0|t.height,this.data=this.width>0&&this.height>0?r.alloc(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new s(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};n.inherits(l,a),l.sync=h,l.prototype.pack=function(){return this.data&&this.data.length?(e.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(t,e){if(e){let t,i;t=function(t){this.removeListener("error",i),this.data=t,e(null,this)}.bind(this),i=function(i){this.removeListener("parsed",t),e(i,null)}.bind(this),this.once("parsed",t),this.once("error",i)}return this.end(t),this},l.prototype.write=function(t){return this._parser.write(t),!0},l.prototype.end=function(t){this._parser.end(t)},l.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},l.prototype._gamma=function(t){this.gamma=t},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(t,e,i,r,n,a,o,s){if(r|=0,n|=0,a|=0,o|=0,s|=0,(i|=0)>t.width||r>t.height||i+n>t.width||r+a>t.height)throw new Error("bitblt reading outside image");if(o>e.width||s>e.height||o+n>e.width||s+a>e.height)throw new Error("bitblt writing outside image");for(let h=0;h<a;h++)t.data.copy(e.data,(s+h)*e.width+o<<2,(r+h)*t.width+i<<2,(r+h)*t.width+i+n<<2)},l.prototype.bitblt=function(t,e,i,r,n,a,o){return l.bitblt(this,t,e,i,r,n,a,o),this},l.adjustGamma=function(t){if(t.gamma){for(let e=0;e<t.height;e++)for(let i=0;i<t.width;i++){let r=t.width*e+i<<2;for(let e=0;e<3;e++){let i=t.data[r+e]/255;i=Math.pow(i,1/2.2/t.gamma),t.data[r+e]=Math.round(255*i)}}t.gamma=0}},l.prototype.adjustGamma=function(){l.adjustGamma(this)}}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{"./packer-async":12,"./parser-async":16,"./png-sync":19,_process:63,buffer:32,stream:65,util:84}],21:[function(t,e,i){(function(r,n){(function(){let r=t("assert").ok,a=t("zlib"),o=t("util"),s=t("buffer").kMaxLength;function h(t){if(!(this instanceof h))return new h(t);t&&t.chunkSize<a.Z_MIN_CHUNK&&(t.chunkSize=a.Z_MIN_CHUNK),a.Inflate.call(this,t),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,t&&null!=t.maxLength&&(this._maxLength=t.maxLength)}function l(t){return new h(t)}function u(t,e){t._handle&&(t._handle.close(),t._handle=null)}function c(t,e){if("string"==typeof e&&(e=n.from(e)),!(e instanceof n))throw new TypeError("Not a string or buffer");let i=t._finishFlushFlag;return null==i&&(i=a.Z_FINISH),t._processChunk(e,i)}function f(t,e){return c(new h(e),t)}h.prototype._processChunk=function(t,e,i){if("function"==typeof i)return a.Inflate._processChunk.call(this,t,e,i);let o,h,l=this,c=t&&t.length,f=this._chunkSize-this._offset,d=this._maxLength,p=0,m=[],g=0;function _(t,e){if(l._hadError)return;let i=f-e;if(r(i>=0,"have should not go down"),i>0){let t=l._buffer.slice(l._offset,l._offset+i);if(l._offset+=i,t.length>d&&(t=t.slice(0,d)),m.push(t),g+=t.length,d-=t.length,0===d)return!1}return(0===e||l._offset>=l._chunkSize)&&(f=l._chunkSize,l._offset=0,l._buffer=n.allocUnsafe(l._chunkSize)),0===e&&(p+=c-t,c=t,!0)}this.on("error",(function(t){o=t})),r(this._handle,"zlib binding closed");do{h=this._handle.writeSync(e,t,p,c,this._buffer,this._offset,f),h=h||this._writeState}while(!this._hadError&&_(h[0],h[1]));if(this._hadError)throw o;if(g>=s)throw u(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+s.toString(16)+" bytes");let b=n.concat(m,g);return u(this),b},o.inherits(h,a.Inflate),e.exports=i=f,i.Inflate=h,i.createInflate=l,i.inflateSync=f}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:63,assert:23,buffer:32,util:84,zlib:31}],22:[function(t,e,i){let r=e.exports=function(t){this._buffer=t,this._reads=[]};r.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})},r.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;{this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}}if(this._reads.length>0)throw new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)throw new Error("unrecognised content at end of stream")}},{}],23:[function(e,i,r){(function(t){(function(){var r=e("object-assign");
/*!
	 * The buffer module from node.js, for the browser.
	 *
	 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
	 * @license  MIT
	 */function n(t,e){if(t===e)return 0;for(var i=t.length,r=e.length,n=0,a=Math.min(i,r);n<a;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:r<i?1:0}function a(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=e("util/"),s=Object.prototype.hasOwnProperty,h=Array.prototype.slice,l="foo"===function(){}.name;function u(t){return Object.prototype.toString.call(t)}function c(e){return!a(e)&&"function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer)))}var f=i.exports=y,d=/\s*function\s+([^\(\s]*)\s*/;function p(t){if(o.isFunction(t)){if(l)return t.name;var e=t.toString().match(d);return e&&e[1]}}function m(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function g(t){if(l||!o.isFunction(t))return o.inspect(t);var e=p(t);return"[Function"+(e?": "+e:"")+"]"}function _(t){return m(g(t.actual),128)+" "+t.operator+" "+m(g(t.expected),128)}function b(t,e,i,r,n){throw new f.AssertionError({message:i,actual:t,expected:e,operator:r,stackStartFunction:n})}function y(t,e){t||b(t,!0,e,"==",f.ok)}function w(t,e,i,r){if(t===e)return!0;if(a(t)&&a(e))return 0===n(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(c(t)&&c(e)&&u(t)===u(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===n(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(a(t)!==a(e))return!1;var s=(r=r||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===r.expected.indexOf(e)||(r.actual.push(t),r.expected.push(e),x(t,e,i,r))}return i?t===e:t==e}function v(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function x(t,e,i,r){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(i&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var n=v(t),a=v(e);if(n&&!a||!n&&a)return!1;if(n)return w(t=h.call(t),e=h.call(e),i);var s,l,u=I(t),c=I(e);if(u.length!==c.length)return!1;for(u.sort(),c.sort(),l=u.length-1;l>=0;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(!w(t[s=u[l]],e[s],i,r))return!1;return!0}function k(t,e,i){w(t,e,!0)&&b(t,e,i,"notDeepStrictEqual",k)}function E(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function S(t){var e;try{t()}catch(t){e=t}return e}function M(t,e,i,r){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof i&&(r=i,i=null),n=S(e),r=(i&&i.name?" ("+i.name+").":".")+(r?" "+r:"."),t&&!n&&b(n,i,"Missing expected exception"+r);var a="string"==typeof r,s=!t&&n&&!i;if((!t&&o.isError(n)&&a&&E(n,i)||s)&&b(n,i,"Got unwanted exception"+r),t&&n&&i&&!E(n,i)||!t&&n)throw n}function A(t,e){t||b(t,!0,e,"==",A)}f.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=_(this),this.generatedMessage=!0);var e=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var i=new Error;if(i.stack){var r=i.stack,n=p(e),a=r.indexOf("\n"+n);if(a>=0){var o=r.indexOf("\n",a+1);r=r.substring(o+1)}this.stack=r}}},o.inherits(f.AssertionError,Error),f.fail=b,f.ok=y,f.equal=function(t,e,i){t!=e&&b(t,e,i,"==",f.equal)},f.notEqual=function(t,e,i){t==e&&b(t,e,i,"!=",f.notEqual)},f.deepEqual=function(t,e,i){w(t,e,!1)||b(t,e,i,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(t,e,i){w(t,e,!0)||b(t,e,i,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(t,e,i){w(t,e,!1)&&b(t,e,i,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=k,f.strictEqual=function(t,e,i){t!==e&&b(t,e,i,"===",f.strictEqual)},f.notStrictEqual=function(t,e,i){t===e&&b(t,e,i,"!==",f.notStrictEqual)},f.throws=function(t,e,i){M(!0,t,e,i)},f.doesNotThrow=function(t,e,i){M(!1,t,e,i)},f.ifError=function(t){if(t)throw t},f.strict=r(A,f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var I=Object.keys||function(t){var e=[];for(var i in t)s.call(t,i)&&e.push(i);return e}}).call(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":51,"util/":26}],24:[function(t,e,i){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}},{}],25:[function(t,e,i){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],26:[function(e,i,r){(function(t,i){(function(){var n=/%[sdj%]/g;r.format=function(t){if(!x(t)){for(var e=[],i=0;i<arguments.length;i++)e.push(s(arguments[i]));return e.join(" ")}i=1;for(var r=arguments,a=r.length,o=String(t).replace(n,(function(t){if("%%"===t)return"%";if(i>=a)return t;switch(t){case"%s":return String(r[i++]);case"%d":return Number(r[i++]);case"%j":try{return JSON.stringify(r[i++])}catch(t){return"[Circular]"}default:return t}})),h=r[i];i<a;h=r[++i])y(h)||!M(h)?o+=" "+h:o+=" "+s(h);return o},r.deprecate=function(e,n){if(E(i.process))return function(){return r.deprecate(e,n).apply(this,arguments)};if(!0===t.noDeprecation)return e;var a=!1;function o(){if(!a){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),a=!0}return e.apply(this,arguments)}return o};var a,o={};function s(t,e){var i={seen:[],stylize:l};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),b(e)?i.showHidden=e:e&&r._extend(i,e),E(i.showHidden)&&(i.showHidden=!1),E(i.depth)&&(i.depth=2),E(i.colors)&&(i.colors=!1),E(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=h),c(i,t,i.depth)}function h(t,e){var i=s.styles[e];return i?"["+s.colors[i][0]+"m"+t+"["+s.colors[i][1]+"m":t}function l(t,e){return t}function u(t){var e={};return t.forEach((function(t,i){e[t]=!0})),e}function c(t,e,i){if(t.customInspect&&e&&z(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(i,t);return x(n)||(n=c(t,n,i)),n}var a=f(t,e);if(a)return a;var o=Object.keys(e),s=u(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),I(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return d(e);if(0===o.length){if(z(e)){var h=e.name?": "+e.name:"";return t.stylize("[Function"+h+"]","special")}if(S(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(A(e))return t.stylize(Date.prototype.toString.call(e),"date");if(I(e))return d(e)}var l,b="",y=!1,w=["{","}"];return _(e)&&(y=!0,w=["[","]"]),z(e)&&(b=" [Function"+(e.name?": "+e.name:"")+"]"),S(e)&&(b=" "+RegExp.prototype.toString.call(e)),A(e)&&(b=" "+Date.prototype.toUTCString.call(e)),I(e)&&(b=" "+d(e)),0!==o.length||y&&0!=e.length?i<0?S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=y?p(t,e,i,s,o):o.map((function(r){return m(t,e,i,s,r,y)})),t.seen.pop(),g(l,b,w)):w[0]+b+w[1]}function f(t,e){if(E(e))return t.stylize("undefined","undefined");if(x(e)){var i="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(i,"string")}return v(e)?t.stylize(""+e,"number"):b(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,i,r,n){for(var a=[],o=0,s=e.length;o<s;++o)C(e,String(o))?a.push(m(t,e,i,r,String(o),!0)):a.push("");return n.forEach((function(n){n.match(/^\d+$/)||a.push(m(t,e,i,r,n,!0))})),a}function m(t,e,i,r,n,a){var o,s,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),C(r,n)||(o="["+n+"]"),s||(t.seen.indexOf(h.value)<0?(s=y(i)?c(t,h.value,null):c(t,h.value,i-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return"  "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return"   "+t})).join("\n")):s=t.stylize("[Circular]","special")),E(o)){if(a&&n.match(/^\d+$/))return s;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function g(t,e,i){return t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?i[0]+(""===e?"":e+"\n ")+" "+t.join(",\n  ")+" "+i[1]:i[0]+e+" "+t.join(", ")+" "+i[1]}function _(t){return Array.isArray(t)}function b(t){return"boolean"==typeof t}function y(t){return null===t}function w(t){return null==t}function v(t){return"number"==typeof t}function x(t){return"string"==typeof t}function k(t){return"symbol"==typeof t}function E(t){return void 0===t}function S(t){return M(t)&&"[object RegExp]"===T(t)}function M(t){return"object"==typeof t&&null!==t}function A(t){return M(t)&&"[object Date]"===T(t)}function I(t){return M(t)&&("[object Error]"===T(t)||t instanceof Error)}function z(t){return"function"==typeof t}function P(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function T(t){return Object.prototype.toString.call(t)}function R(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(e){if(E(a)&&(a=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(a)){var i=t.pid;o[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,i,t)}}else o[e]=function(){};return o[e]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=_,r.isBoolean=b,r.isNull=y,r.isNullOrUndefined=w,r.isNumber=v,r.isString=x,r.isSymbol=k,r.isUndefined=E,r.isRegExp=S,r.isObject=M,r.isDate=A,r.isError=I,r.isFunction=z,r.isPrimitive=P,r.isBuffer=e("./support/isBuffer");var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(){var t=new Date,e=[R(t.getHours()),R(t.getMinutes()),R(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){console.log("%s - %s",B(),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(t,e){if(!e||!M(e))return t;for(var i=Object.keys(e),r=i.length;r--;)t[i[r]]=e[i[r]];return t}}).call(this)}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":25,_process:63,inherits:24}],27:[function(e,i,r){(function(t){(function(){var e=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],r="undefined"==typeof globalThis?t:globalThis;i.exports=function(){for(var t=[],i=0;i<e.length;i++)"function"==typeof r[e[i]]&&(t[t.length]=e[i]);return t}}).call(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(t,e,i){i.byteLength=u,i.toByteArray=f,i.fromByteArray=m;for(var r=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,h=o.length;s<h;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function l(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function u(t){var e=l(t),i=e[0],r=e[1];return 3*(i+r)/4-r}function c(t,e,i){return 3*(e+i)/4-i}function f(t){var e,i,r=l(t),o=r[0],s=r[1],h=new a(c(t,o,s)),u=0,f=s>0?o-4:o;for(i=0;i<f;i+=4)e=n[t.charCodeAt(i)]<<18|n[t.charCodeAt(i+1)]<<12|n[t.charCodeAt(i+2)]<<6|n[t.charCodeAt(i+3)],h[u++]=e>>16&255,h[u++]=e>>8&255,h[u++]=255&e;return 2===s&&(e=n[t.charCodeAt(i)]<<2|n[t.charCodeAt(i+1)]>>4,h[u++]=255&e),1===s&&(e=n[t.charCodeAt(i)]<<10|n[t.charCodeAt(i+1)]<<4|n[t.charCodeAt(i+2)]>>2,h[u++]=e>>8&255,h[u++]=255&e),h}function d(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function p(t,e,i){for(var r,n=[],a=e;a<i;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),n.push(d(r));return n.join("")}function m(t){for(var e,i=t.length,n=i%3,a=[],o=16383,s=0,h=i-n;s<h;s+=o)a.push(p(t,s,s+o>h?h:s+o));return 1===n?(e=t[i-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],29:[function(t,e,i){},{}],30:[function(t,e,i){(function(e,r){(function(){var n=t("assert"),a=t("pako/lib/zlib/zstream"),o=t("pako/lib/zlib/deflate.js"),s=t("pako/lib/zlib/inflate.js"),h=t("pako/lib/zlib/constants");for(var l in h)i[l]=h[l];i.NONE=0,i.DEFLATE=1,i.INFLATE=2,i.GZIP=3,i.GUNZIP=4,i.DEFLATERAW=5,i.INFLATERAW=6,i.UNZIP=7;var u=31,c=139;function f(t){if("number"!=typeof t||t<i.DEFLATE||t>i.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}f.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,n(this.init_done,"close before init"),n(this.mode<=i.UNZIP),this.mode===i.DEFLATE||this.mode===i.GZIP||this.mode===i.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==i.INFLATE&&this.mode!==i.GUNZIP&&this.mode!==i.INFLATERAW&&this.mode!==i.UNZIP||s.inflateEnd(this.strm),this.mode=i.NONE,this.dictionary=null)},f.prototype.write=function(t,e,i,r,n,a,o){return this._write(!0,t,e,i,r,n,a,o)},f.prototype.writeSync=function(t,e,i,r,n,a,o){return this._write(!1,t,e,i,r,n,a,o)},f.prototype._write=function(t,a,o,s,h,l,u,c){if(n.equal(arguments.length,8),n(this.init_done,"write before init"),n(this.mode!==i.NONE,"already finalized"),n.equal(!1,this.write_in_progress,"write already in progress"),n.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,n.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==i.Z_NO_FLUSH&&a!==i.Z_PARTIAL_FLUSH&&a!==i.Z_SYNC_FLUSH&&a!==i.Z_FULL_FLUSH&&a!==i.Z_FINISH&&a!==i.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=r.alloc(0),h=0,s=0),this.strm.avail_in=h,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=c,this.strm.output=l,this.strm.next_out=u,this.flush=a,!t)return this._process(),this._checkError()?this._afterSync():void 0;var f=this;return e.nextTick((function(){f._process(),f._after()})),this},f.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},f.prototype._process=function(){var t=null;switch(this.mode){case i.DEFLATE:case i.GZIP:case i.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case i.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(this.strm.input[t]!==u){this.mode=i.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;this.strm.input[t]===c?(this.gzip_id_bytes_read=2,this.mode=i.GUNZIP):this.mode=i.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case i.INFLATE:case i.GUNZIP:case i.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===i.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===i.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===i.Z_DATA_ERROR&&(this.err=i.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===i.GUNZIP&&this.err===i.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},f.prototype._checkError=function(){switch(this.err){case i.Z_OK:case i.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===i.Z_FINISH)return this._error("unexpected end of file"),!1;break;case i.Z_STREAM_END:break;case i.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},f.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},f.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},f.prototype.init=function(t,e,r,a,o){n(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),n(t>=8&&t<=15,"invalid windowBits"),n(e>=-1&&e<=9,"invalid compression level"),n(r>=1&&r<=9,"invalid memlevel"),n(a===i.Z_FILTERED||a===i.Z_HUFFMAN_ONLY||a===i.Z_RLE||a===i.Z_FIXED||a===i.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(e,t,r,a,o),this._setDictionary()},f.prototype.params=function(){throw new Error("deflateParams Not supported")},f.prototype.reset=function(){this._reset(),this._setDictionary()},f.prototype._init=function(t,e,r,n,h){switch(this.level=t,this.windowBits=e,this.memLevel=r,this.strategy=n,this.flush=i.Z_NO_FLUSH,this.err=i.Z_OK,this.mode!==i.GZIP&&this.mode!==i.GUNZIP||(this.windowBits+=16),this.mode===i.UNZIP&&(this.windowBits+=32),this.mode!==i.DEFLATERAW&&this.mode!==i.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case i.DEFLATE:case i.GZIP:case i.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,i.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case i.INFLATE:case i.GUNZIP:case i.INFLATERAW:case i.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==i.Z_OK&&this._error("Init error"),this.dictionary=h,this.write_in_progress=!1,this.init_done=!0},f.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=i.Z_OK,this.mode){case i.DEFLATE:case i.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==i.Z_OK&&this._error("Failed to set dictionary")}},f.prototype._reset=function(){switch(this.err=i.Z_OK,this.mode){case i.DEFLATE:case i.DEFLATERAW:case i.GZIP:this.err=o.deflateReset(this.strm);break;case i.INFLATE:case i.INFLATERAW:case i.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==i.Z_OK&&this._error("Failed to reset stream")},i.Zlib=f}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:63,assert:23,buffer:32,"pako/lib/zlib/constants":54,"pako/lib/zlib/deflate.js":56,"pako/lib/zlib/inflate.js":58,"pako/lib/zlib/zstream":62}],31:[function(t,e,i){(function(e){(function(){var r=t("buffer").Buffer,n=t("stream").Transform,a=t("./binding"),o=t("util"),s=t("assert").ok,h=t("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+h.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var u=Object.keys(a),c=0;c<u.length;c++){var f=u[c];f.match(/^Z/)&&Object.defineProperty(i,f,{enumerable:!0,value:a[f],writable:!1})}for(var d={Z_OK:a.Z_OK,Z_STREAM_END:a.Z_STREAM_END,Z_NEED_DICT:a.Z_NEED_DICT,Z_ERRNO:a.Z_ERRNO,Z_STREAM_ERROR:a.Z_STREAM_ERROR,Z_DATA_ERROR:a.Z_DATA_ERROR,Z_MEM_ERROR:a.Z_MEM_ERROR,Z_BUF_ERROR:a.Z_BUF_ERROR,Z_VERSION_ERROR:a.Z_VERSION_ERROR},p=Object.keys(d),m=0;m<p.length;m++){var g=p[m];d[d[g]]=g}function _(t,e,i){var n=[],a=0;function o(){for(var e;null!==(e=t.read());)n.push(e),a+=e.length;t.once("readable",o)}function s(e){t.removeListener("end",u),t.removeListener("readable",o),i(e)}function u(){var e,o=null;a>=h?o=new RangeError(l):e=r.concat(n,a),n=[],t.close(),i(o,e)}t.on("error",s),t.on("end",u),t.end(e),o()}function b(t,e){if("string"==typeof e&&(e=r.from(e)),!r.isBuffer(e))throw new TypeError("Not a string or buffer");var i=t._finishFlushFlag;return t._processChunk(e,i)}function y(t){if(!(this instanceof y))return new y(t);A.call(this,t,a.DEFLATE)}function w(t){if(!(this instanceof w))return new w(t);A.call(this,t,a.INFLATE)}function v(t){if(!(this instanceof v))return new v(t);A.call(this,t,a.GZIP)}function x(t){if(!(this instanceof x))return new x(t);A.call(this,t,a.GUNZIP)}function k(t){if(!(this instanceof k))return new k(t);A.call(this,t,a.DEFLATERAW)}function E(t){if(!(this instanceof E))return new E(t);A.call(this,t,a.INFLATERAW)}function S(t){if(!(this instanceof S))return new S(t);A.call(this,t,a.UNZIP)}function M(t){return t===a.Z_NO_FLUSH||t===a.Z_PARTIAL_FLUSH||t===a.Z_SYNC_FLUSH||t===a.Z_FULL_FLUSH||t===a.Z_FINISH||t===a.Z_BLOCK}function A(t,e){var o=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||i.Z_DEFAULT_CHUNK,n.call(this,t),t.flush&&!M(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!M(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:a.Z_FINISH,t.chunkSize&&(t.chunkSize<i.Z_MIN_CHUNK||t.chunkSize>i.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<i.Z_MIN_WINDOWBITS||t.windowBits>i.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<i.Z_MIN_LEVEL||t.level>i.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<i.Z_MIN_MEMLEVEL||t.memLevel>i.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=i.Z_FILTERED&&t.strategy!=i.Z_HUFFMAN_ONLY&&t.strategy!=i.Z_RLE&&t.strategy!=i.Z_FIXED&&t.strategy!=i.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!r.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(e);var s=this;this._hadError=!1,this._handle.onerror=function(t,e){I(s),s._hadError=!0;var r=new Error(t);r.errno=e,r.code=i.codes[e],s.emit("error",r)};var h=i.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(h=t.level);var l=i.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(l=t.strategy),this._handle.init(t.windowBits||i.Z_DEFAULT_WINDOWBITS,h,t.memLevel||i.Z_DEFAULT_MEMLEVEL,l,t.dictionary),this._buffer=r.allocUnsafe(this._chunkSize),this._offset=0,this._level=h,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function I(t,i){i&&e.nextTick(i),t._handle&&(t._handle.close(),t._handle=null)}function z(t){t.emit("close")}Object.defineProperty(i,"codes",{enumerable:!0,value:Object.freeze(d),writable:!1}),i.Deflate=y,i.Inflate=w,i.Gzip=v,i.Gunzip=x,i.DeflateRaw=k,i.InflateRaw=E,i.Unzip=S,i.createDeflate=function(t){return new y(t)},i.createInflate=function(t){return new w(t)},i.createDeflateRaw=function(t){return new k(t)},i.createInflateRaw=function(t){return new E(t)},i.createGzip=function(t){return new v(t)},i.createGunzip=function(t){return new x(t)},i.createUnzip=function(t){return new S(t)},i.deflate=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new y(e),t,i)},i.deflateSync=function(t,e){return b(new y(e),t)},i.gzip=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new v(e),t,i)},i.gzipSync=function(t,e){return b(new v(e),t)},i.deflateRaw=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new k(e),t,i)},i.deflateRawSync=function(t,e){return b(new k(e),t)},i.unzip=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new S(e),t,i)},i.unzipSync=function(t,e){return b(new S(e),t)},i.inflate=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new w(e),t,i)},i.inflateSync=function(t,e){return b(new w(e),t)},i.gunzip=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new x(e),t,i)},i.gunzipSync=function(t,e){return b(new x(e),t)},i.inflateRaw=function(t,e,i){return"function"==typeof e&&(i=e,e={}),_(new E(e),t,i)},i.inflateRawSync=function(t,e){return b(new E(e),t)},o.inherits(A,n),A.prototype.params=function(t,r,n){if(t<i.Z_MIN_LEVEL||t>i.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(r!=i.Z_FILTERED&&r!=i.Z_HUFFMAN_ONLY&&r!=i.Z_RLE&&r!=i.Z_FIXED&&r!=i.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==t||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,(function(){s(o._handle,"zlib binding closed"),o._handle.params(t,r),o._hadError||(o._level=t,o._strategy=r,n&&n())}))}else e.nextTick(n)},A.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},A.prototype._flush=function(t){this._transform(r.alloc(0),"",t)},A.prototype.flush=function(t,i){var n=this,o=this._writableState;("function"==typeof t||void 0===t&&!i)&&(i=t,t=a.Z_FULL_FLUSH),o.ended?i&&e.nextTick(i):o.ending?i&&this.once("end",i):o.needDrain?i&&this.once("drain",(function(){return n.flush(t,i)})):(this._flushFlag=t,this.write(r.alloc(0),"",i))},A.prototype.close=function(t){I(this,t),e.nextTick(z,this)},A.prototype._transform=function(t,e,i){var n,o=this._writableState,s=(o.ending||o.ended)&&(!t||o.length===t.length);return null===t||r.isBuffer(t)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,t.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(t,n,i)):i(new Error("zlib binding closed")):i(new Error("invalid input"))},A.prototype._processChunk=function(t,e,i){var n=t&&t.length,a=this._chunkSize-this._offset,o=0,u=this,c="function"==typeof i;if(!c){var f,d=[],p=0;this.on("error",(function(t){f=t})),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(e,t,o,n,this._buffer,this._offset,a)}while(!this._hadError&&b(m[0],m[1]));if(this._hadError)throw f;if(p>=h)throw I(this),new RangeError(l);var g=r.concat(d,p);return I(this),g}s(this._handle,"zlib binding closed");var _=this._handle.write(e,t,o,n,this._buffer,this._offset,a);function b(h,l){if(this&&(this.buffer=null,this.callback=null),!u._hadError){var f=a-l;if(s(f>=0,"have should not go down"),f>0){var m=u._buffer.slice(u._offset,u._offset+f);u._offset+=f,c?u.push(m):(d.push(m),p+=m.length)}if((0===l||u._offset>=u._chunkSize)&&(a=u._chunkSize,u._offset=0,u._buffer=r.allocUnsafe(u._chunkSize)),0===l){if(o+=n-h,n=h,!c)return!0;var g=u._handle.write(e,t,o,n,u._buffer,u._offset,u._chunkSize);return g.callback=b,void(g.buffer=t)}if(!c)return!1;i()}}_.buffer=t,_.callback=b},o.inherits(y,A),o.inherits(w,A),o.inherits(v,A),o.inherits(x,A),o.inherits(k,A),o.inherits(E,A),o.inherits(S,A)}).call(this)}).call(this,t("_process"))},{"./binding":30,_process:63,assert:23,buffer:32,stream:65,util:84}],32:[function(t,e,i){(function(e){(function(){var e=t("base64-js"),r=t("ieee754");i.Buffer=s,i.SlowBuffer=_,i.INSPECT_MAX_BYTES=50;var n=2147483647;function a(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}function o(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,i){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return h(t,e,i)}function h(t,e,i){if("string"==typeof t)return f(t,e);if(ArrayBuffer.isView(t))return d(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return p(t,e,i);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,i);var n=m(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t,e,i){return l(t),t<=0?o(t):void 0!==e?"string"==typeof i?o(t).fill(e,i):o(t).fill(e):o(t)}function c(t){return l(t),o(t<0?0:0|g(t))}function f(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var i=0|b(t,e),r=o(i),n=r.write(t,e);return n!==i&&(r=r.slice(0,n)),r}function d(t){for(var e=t.length<0?0:0|g(t.length),i=o(e),r=0;r<e;r+=1)i[r]=255&t[r];return i}function p(t,e,i){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(i||0))throw new RangeError('"length" is outside of buffer bounds');var r;return(r=void 0===e&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,e):new Uint8Array(t,e,i)).__proto__=s.prototype,r}function m(t){if(s.isBuffer(t)){var e=0|g(t.length),i=o(e);return 0===i.length||t.copy(i,0,0,e),i}return void 0!==t.length?"number"!=typeof t.length||K(t.length)?o(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}function g(t){if(t>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|t}function _(t){return+t!=t&&(t=0),s.alloc(+t)}function b(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var i=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return Y(t).length;default:if(n)return r?-1:$(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,i);case"utf8":case"utf-8":return P(this,e,i);case"ascii":return O(this,e,i);case"latin1":case"binary":return B(this,e,i);case"base64":return z(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function w(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function v(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),K(i=+i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:x(t,e,i,r,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):x(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function x(t,e,i,r,n){var a,o=1,s=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,s/=2,h/=2,i/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var u=-1;for(a=i;a<s;a++)if(l(t,a)===l(e,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===h)return u*o}else-1!==u&&(a-=a-u),u=-1}else for(i+h>s&&(i=s-h),a=i;a>=0;a--){for(var c=!0,f=0;f<h;f++)if(l(t,a+f)!==l(e,f)){c=!1;break}if(c)return a}return-1}function k(t,e,i,r){i=Number(i)||0;var n=t.length-i;r?(r=Number(r))>n&&(r=n):r=n;var a=e.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(e.substr(2*o,2),16);if(K(s))return o;t[i+o]=s}return o}function E(t,e,i,r){return V($(e,t.length-i),t,i,r)}function S(t,e,i,r){return V(W(e),t,i,r)}function M(t,e,i,r){return S(t,e,i,r)}function A(t,e,i,r){return V(Y(e),t,i,r)}function I(t,e,i,r){return V(q(e,t.length-i),t,i,r)}function z(t,i,r){return 0===i&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(i,r))}function P(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n<i;){var a,o,s,h,l=t[n],u=null,c=l>239?4:l>223?3:l>191?2:1;if(n+c<=i)switch(c){case 1:l<128&&(u=l);break;case 2:128==(192&(a=t[n+1]))&&(h=(31&l)<<6|63&a)>127&&(u=h);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(h=(15&l)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(u=h)}null===u?(u=65533,c=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),n+=c}return R(r)}i.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=a(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(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}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(t,e,i){return h(t,e,i)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(t,e,i){return u(t,e,i)},s.allocUnsafe=function(t){return c(t)},s.allocUnsafeSlow=function(t){return c(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(J(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var i=t.length,r=e.length,n=0,a=Math.min(i,r);n<a;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:r<i?1:0},s.isEncoding=function(t){switch(String(t).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(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=s.allocUnsafe(e),n=0;for(i=0;i<t.length;++i){var a=t[i];if(J(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,n),n+=a.length}return r},s.byteLength=b,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},s.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?P(this,0,t):y.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=i.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},s.prototype.compare=function(t,e,i,r,n){if(J(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(e>>>=0),h=Math.min(a,o),l=this.slice(r,n),u=t.slice(e,i),c=0;c<h;++c)if(l[c]!==u[c]){a=l[c],o=u[c];break}return a<o?-1:o<a?1:0},s.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},s.prototype.indexOf=function(t,e,i){return v(this,t,e,i,!0)},s.prototype.lastIndexOf=function(t,e,i){return v(this,t,e,i,!1)},s.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(i)?(i>>>=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-e;if((void 0===i||i>n)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return k(this,t,e,i);case"utf8":case"utf-8":return E(this,t,e,i);case"ascii":return S(this,t,e,i);case"latin1":case"binary":return M(this,t,e,i);case"base64":return A(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,i);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function R(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);for(var i="",r=0;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=T));return i}function O(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(127&t[n]);return r}function B(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}function C(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var n="",a=e;a<i;++a)n+=H(t[a]);return n}function L(t,e,i){for(var r=t.slice(e,i),n="",a=0;a<r.length;a+=2)n+=String.fromCharCode(r[a]+256*r[a+1]);return n}function D(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,i,r,n,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<a)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function F(t,e,i,r,n,a){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function N(t,e,i,n,a){return e=+e,i>>>=0,a||F(t,e,i,4),r.write(t,e,i,n,23,4),i+4}function j(t,e,i,n,a){return e=+e,i>>>=0,a||F(t,e,i,8),r.write(t,e,i,n,52,8),i+8}s.prototype.slice=function(t,e){var i=this.length;(t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t);var r=this.subarray(t,e);return r.__proto__=s.prototype,r},s.prototype.readUIntLE=function(t,e,i){t>>>=0,e>>>=0,i||D(t,e,this.length);for(var r=this[t],n=1,a=0;++a<e&&(n*=256);)r+=this[t+a]*n;return r},s.prototype.readUIntBE=function(t,e,i){t>>>=0,e>>>=0,i||D(t,e,this.length);for(var r=this[t+--e],n=1;e>0&&(n*=256);)r+=this[t+--e]*n;return r},s.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,i){t>>>=0,e>>>=0,i||D(t,e,this.length);for(var r=this[t],n=1,a=0;++a<e&&(n*=256);)r+=this[t+a]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,i){t>>>=0,e>>>=0,i||D(t,e,this.length);for(var r=e,n=1,a=this[t+--r];r>0&&(n*=256);)a+=this[t+--r]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},s.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,i,r){t=+t,e>>>=0,i>>>=0,r||U(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,a=0;for(this[e]=255&t;++a<i&&(n*=256);)this[e+a]=t/n&255;return e+i},s.prototype.writeUIntBE=function(t,e,i,r){t=+t,e>>>=0,i>>>=0,r||U(this,t,e,i,Math.pow(2,8*i)-1,0);var n=i-1,a=1;for(this[e+n]=255&t;--n>=0&&(a*=256);)this[e+n]=t/a&255;return e+i},s.prototype.writeUInt8=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e>>>=0,!r){var n=Math.pow(2,8*i-1);U(this,t,e,i,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a<i&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o|0)-s&255;return e+i},s.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e>>>=0,!r){var n=Math.pow(2,8*i-1);U(this,t,e,i,n-1,-n)}var a=i-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o|0)-s&255;return e+i},s.prototype.writeInt8=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,i){return t=+t,e>>>=0,i||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,i){return N(this,t,e,!0,i)},s.prototype.writeFloatBE=function(t,e,i){return N(this,t,e,!1,i)},s.prototype.writeDoubleLE=function(t,e,i){return j(this,t,e,!0,i)},s.prototype.writeDoubleBE=function(t,e,i){return j(this,t,e,!1,i)},s.prototype.copy=function(t,e,i,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var n=r-i;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,i,r);else if(this===t&&i<e&&e<r)for(var a=n-1;a>=0;--a)t[a+e]=this[a+i];else Uint8Array.prototype.set.call(t,this.subarray(i,r),e);return n},s.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var n=t.charCodeAt(0);("utf8"===r&&n<128||"latin1"===r)&&(t=n)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var a;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(a=e;a<i;++a)this[a]=t;else{var o=s.isBuffer(t)?t:s.from(t,r),h=o.length;if(0===h)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(a=0;a<i-e;++a)this[a+e]=o[a%h]}return this};var G=/[^+/0-9A-Za-z-_]/g;function Z(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,e){var i;e=e||1/0;for(var r=t.length,n=null,a=[],o=0;o<r;++o){if((i=t.charCodeAt(o))>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&a.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&a.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;a.push(i)}else if(i<2048){if((e-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function W(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}function q(t,e){for(var i,r,n,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=(i=t.charCodeAt(o))>>8,n=i%256,a.push(n),a.push(r);return a}function Y(t){return e.toByteArray(Z(t))}function V(t,e,i,r){for(var n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function J(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":28,buffer:32,ieee754:45}],33:[function(t,e,i){var r=t("get-intrinsic"),n=t("./"),a=n(r("String.prototype.indexOf"));e.exports=function(t,e){var i=r(t,!!e);return"function"==typeof i&&a(t,".prototype.")>-1?n(i):i}},{"./":34,"get-intrinsic":39}],34:[function(t,e,i){var r=t("function-bind"),n=t("get-intrinsic"),a=n("%Function.prototype.apply%"),o=n("%Function.prototype.call%"),s=n("%Reflect.apply%",!0)||r.call(o,a),h=n("%Object.getOwnPropertyDescriptor%",!0),l=n("%Object.defineProperty%",!0),u=n("%Math.max%");if(l)try{l({},"a",{value:1})}catch(t){l=null}e.exports=function(t){var e=s(r,o,arguments);return h&&l&&h(e,"length").configurable&&l(e,"length",{value:1+u(0,t.length-(arguments.length-1))}),e};var c=function(){return s(r,a,arguments)};l?l(e.exports,"apply",{value:c}):e.exports.apply=c},{"function-bind":38,"get-intrinsic":39}],35:[function(t,e,i){var r,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)};function o(t){console&&console.warn&&console.warn(t)}r=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function h(){h.init.call(this)}e.exports=h,e.exports.once=w,h.EventEmitter=h,h.prototype._events=void 0,h.prototype._eventsCount=0,h.prototype._maxListeners=void 0;var l=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?h.defaultMaxListeners:t._maxListeners}function f(t,e,i,r){var n,a,s;if(u(i),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),a=t._events),s=a[e]),void 0===s)s=a[e]=i,++t._eventsCount;else if("function"==typeof s?s=a[e]=r?[i,s]:[s,i]:r?s.unshift(i):s.push(i),(n=c(t))>0&&s.length>n&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=s.length,o(h)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},n=d.bind(r);return n.listener=i,r.wrapFn=n,n}function m(t,e,i){var r=t._events;if(void 0===r)return[];var n=r[e];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?y(n):_(n,n.length)}function g(t){var e=this._events;if(void 0!==e){var i=e[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function _(t,e){for(var i=new Array(e),r=0;r<e;++r)i[r]=t[r];return i}function b(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function y(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}function w(t,e){return new Promise((function(i,r){function n(i){t.removeListener(e,a),r(i)}function a(){"function"==typeof t.removeListener&&t.removeListener("error",n),i([].slice.call(arguments))}x(t,e,a,{once:!0}),"error"!==e&&v(t,n,{once:!0})}))}function v(t,e,i){"function"==typeof t.on&&x(t,"error",e,i)}function x(t,e,i,r){if("function"==typeof t.on)r.once?t.once(e,i):t.on(e,i);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function n(a){r.once&&t.removeEventListener(e,n),i(a)}))}}Object.defineProperty(h,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");l=t}}),h.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},h.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},h.prototype.getMaxListeners=function(){return c(this)},h.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var r="error"===t,n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var h=n[t];if(void 0===h)return!1;if("function"==typeof h)a(h,this,e);else{var l=h.length,u=_(h,l);for(i=0;i<l;++i)a(u[i],this,e)}return!0},h.prototype.addListener=function(t,e){return f(this,t,e,!1)},h.prototype.on=h.prototype.addListener,h.prototype.prependListener=function(t,e){return f(this,t,e,!0)},h.prototype.once=function(t,e){return u(e),this.on(t,p(this,t,e)),this},h.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,p(this,t,e)),this},h.prototype.removeListener=function(t,e){var i,r,n,a,o;if(u(e),void 0===(r=this._events))return this;if(void 0===(i=r[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(n=-1,a=i.length-1;a>=0;a--)if(i[a]===e||i[a].listener===e){o=i[a].listener,n=a;break}if(n<0)return this;0===n?i.shift():b(i,n),1===i.length&&(r[t]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",t,o||e)}return this},h.prototype.off=h.prototype.removeListener,h.prototype.removeAllListeners=function(t){var e,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var n,a=Object.keys(i);for(r=0;r<a.length;++r)"removeListener"!==(n=a[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},h.prototype.listeners=function(t){return m(this,t,!0)},h.prototype.rawListeners=function(t){return m(this,t,!1)},h.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},h.prototype.listenerCount=g,h.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},{}],36:[function(t,e,i){var r=t("is-callable"),n=Object.prototype.toString,a=Object.prototype.hasOwnProperty,o=function(t,e,i){for(var r=0,n=t.length;r<n;r++)a.call(t,r)&&(null==i?e(t[r],r,t):e.call(i,t[r],r,t))},s=function(t,e,i){for(var r=0,n=t.length;r<n;r++)null==i?e(t.charAt(r),r,t):e.call(i,t.charAt(r),r,t)},h=function(t,e,i){for(var r in t)a.call(t,r)&&(null==i?e(t[r],r,t):e.call(i,t[r],r,t))},l=function(t,e,i){if(!r(e))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=i),"[object Array]"===n.call(t)?o(t,e,a):"string"==typeof t?s(t,e,a):h(t,e,a)};e.exports=l},{"is-callable":48}],37:[function(t,e,i){var r="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,a=Object.prototype.toString,o="[object Function]";e.exports=function(t){var e=this;if("function"!=typeof e||a.call(e)!==o)throw new TypeError(r+e);for(var i,s=n.call(arguments,1),h=function(){if(this instanceof i){var r=e.apply(this,s.concat(n.call(arguments)));return Object(r)===r?r:this}return e.apply(t,s.concat(n.call(arguments)))},l=Math.max(0,e.length-s.length),u=[],c=0;c<l;c++)u.push("$"+c);if(i=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(h),e.prototype){var f=function(){};f.prototype=e.prototype,i.prototype=new f,f.prototype=null}return i}},{}],38:[function(t,e,i){var r=t("./implementation");e.exports=Function.prototype.bind||r},{"./implementation":37}],39:[function(t,e,i){var r,n=SyntaxError,a=Function,o=TypeError,s=function(t){try{return a('"use strict"; return ('+t+").constructor;")()}catch(t){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(t){h=null}var l=function(){throw new o},u=h?function(){try{return l}catch(t){try{return h(arguments,"callee").get}catch(t){return l}}}():l,c=t("has-symbols")(),f=Object.getPrototypeOf||function(t){return t.__proto__},d={},p="undefined"==typeof Uint8Array?r:f(Uint8Array),m={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":c?f([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":c?f(f([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&c?f((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&c?f((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":c?f(""[Symbol.iterator]()):r,"%Symbol%":c?Symbol:r,"%SyntaxError%":n,"%ThrowTypeError%":u,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};try{null.error}catch(t){var g=f(f(t));m["%Error.prototype%"]=g}var _=function t(e){var i;if("%AsyncFunction%"===e)i=s("async function () {}");else if("%GeneratorFunction%"===e)i=s("function* () {}");else if("%AsyncGeneratorFunction%"===e)i=s("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(i=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&(i=f(n.prototype))}return m[e]=i,i},b={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},y=t("function-bind"),w=t("has"),v=y.call(Function.call,Array.prototype.concat),x=y.call(Function.apply,Array.prototype.splice),k=y.call(Function.call,String.prototype.replace),E=y.call(Function.call,String.prototype.slice),S=y.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A=/\\(\\)?/g,I=function(t){var e=E(t,0,1),i=E(t,-1);if("%"===e&&"%"!==i)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==e)throw new n("invalid intrinsic syntax, expected opening `%`");var r=[];return k(t,M,(function(t,e,i,n){r[r.length]=i?k(n,A,"$1"):e||t})),r},z=function(t,e){var i,r=t;if(w(b,r)&&(r="%"+(i=b[r])[0]+"%"),w(m,r)){var a=m[r];if(a===d&&(a=_(r)),void 0===a&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new n("intrinsic "+t+" does not exist!")};e.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===S(/^%?[^%]*%?$/,t))throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=I(t),r=i.length>0?i[0]:"",a=z("%"+r+"%",e),s=a.name,l=a.value,u=!1,c=a.alias;c&&(r=c[0],x(i,v([0,1],c)));for(var f=1,d=!0;f<i.length;f+=1){var p=i[f],g=E(p,0,1),_=E(p,-1);if(('"'===g||"'"===g||"`"===g||'"'===_||"'"===_||"`"===_)&&g!==_)throw new n("property names with quotes must have matching quotes");if("constructor"!==p&&d||(u=!0),w(m,s="%"+(r+="."+p)+"%"))l=m[s];else if(null!=l){if(!(p in l)){if(!e)throw new o("base intrinsic for "+t+" exists, but the property is not available.");return}if(h&&f+1>=i.length){var b=h(l,p);l=(d=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:l[p]}else d=w(l,p),l=l[p];d&&!u&&(m[s]=l)}}return l}},{"function-bind":38,has:44,"has-symbols":41}],40:[function(t,e,i){var r=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(r)try{r([],"length")}catch(t){r=null}e.exports=r},{"get-intrinsic":39}],41:[function(t,e,i){var r="undefined"!=typeof Symbol&&Symbol,n=t("./shams");e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&n()}},{"./shams":42}],42:[function(t,e,i){e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),i=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;var r=42;for(e in t[e]=r,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==r||!0!==a.enumerable)return!1}return!0}},{}],43:[function(t,e,i){var r=t("has-symbols/shams");e.exports=function(){return r()&&!!Symbol.toStringTag}},{"has-symbols/shams":42}],44:[function(t,e,i){var r=t("function-bind");e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":38}],45:[function(t,e,i){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
i.read=function(t,e,i,r,n){var a,o,s=8*n-r-1,h=(1<<s)-1,l=h>>1,u=-7,c=i?n-1:0,f=i?-1:1,d=t[e+c];for(c+=f,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+t[e+c],c+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+t[e+c],c+=f,u-=8);if(0===a)a=1-l;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),a-=l}return(d?-1:1)*o*Math.pow(2,a-r)},i.write=function(t,e,i,r,n,a){var o,s,h,l=8*a-n-1,u=(1<<l)-1,c=u>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=u?(s=0,o=u):o+c>=1?(s=(e*h-1)*Math.pow(2,n),o+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[i+d]=255&s,d+=p,s/=256,n-=8);for(o=o<<n|s,l+=n;l>0;t[i+d]=255&o,d+=p,o/=256,l-=8);t[i+d-p]|=128*m}},{}],46:[function(t,e,i){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}}},{}],47:[function(t,e,i){var r=t("has-tostringtag/shams")(),n=t("call-bind/callBound")("Object.prototype.toString"),a=function(t){return!(r&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===n(t)},o=function(t){return!!a(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==n(t)&&"[object Function]"===n(t.callee)},s=function(){return a(arguments)}();a.isLegacyArguments=o,e.exports=s?a:o},{"call-bind/callBound":33,"has-tostringtag/shams":43}],48:[function(t,e,i){var r,n,a=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},o((function(){throw 42}),null,r)}catch(t){t!==n&&(o=null)}else o=null;var s=/^\s*class\b/,h=function(t){try{var e=a.call(t);return s.test(e)}catch(t){return!1}},l=function(t){try{return!h(t)&&(a.call(t),!0)}catch(t){return!1}},u=Object.prototype.toString,c="[object Object]",f="[object Function]",d="[object GeneratorFunction]",p="[object HTMLAllCollection]",m="[object HTML document.all class]",g="[object HTMLCollection]",_="function"==typeof Symbol&&!!Symbol.toStringTag,b=!(0 in[,]),y=function(){return!1};if("object"==typeof document){var w=document.all;u.call(w)===u.call(document.all)&&(y=function(t){if((b||!t)&&(void 0===t||"object"==typeof t))try{var e=u.call(t);return(e===p||e===m||e===g||e===c)&&null==t("")}catch(t){}return!1})}e.exports=o?function(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{o(t,null,r)}catch(t){if(t!==n)return!1}return!h(t)&&l(t)}:function(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(_)return l(t);if(h(t))return!1;var e=u.call(t);return!(e!==f&&e!==d&&!/^\[object HTML/.test(e))&&l(t)}},{}],49:[function(t,e,i){var r,n=Object.prototype.toString,a=Function.prototype.toString,o=/^\s*(?:function)?\*/,s=t("has-tostringtag/shams")(),h=Object.getPrototypeOf,l=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(t){}};e.exports=function(t){if("function"!=typeof t)return!1;if(o.test(a.call(t)))return!0;if(!s)return"[object GeneratorFunction]"===n.call(t);if(!h)return!1;if(void 0===r){var e=l();r=!!e&&h(e)}return h(t)===r}},{"has-tostringtag/shams":43}],50:[function(e,i,r){(function(t){(function(){var r=e("for-each"),n=e("available-typed-arrays"),a=e("call-bind/callBound"),o=a("Object.prototype.toString"),s=e("has-tostringtag/shams")(),h=e("gopd"),l="undefined"==typeof globalThis?t:globalThis,u=n(),c=a("Array.prototype.indexOf",!0)||function(t,e){for(var i=0;i<t.length;i+=1)if(t[i]===e)return i;return-1},f=a("String.prototype.slice"),d={},p=Object.getPrototypeOf;s&&h&&p&&r(u,(function(t){var e=new l[t];if(Symbol.toStringTag in e){var i=p(e),r=h(i,Symbol.toStringTag);if(!r){var n=p(i);r=h(n,Symbol.toStringTag)}d[t]=r.get}}));var m=function(t){var e=!1;return r(d,(function(i,r){if(!e)try{e=i.call(t)===r}catch(t){}})),e};i.exports=function(t){if(!t||"object"!=typeof t)return!1;if(!s||!(Symbol.toStringTag in t)){var e=f(o(t),8,-1);return c(u,e)>-1}return!!h&&m(t)}}).call(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"available-typed-arrays":27,"call-bind/callBound":33,"for-each":36,gopd:40,"has-tostringtag/shams":43}],51:[function(t,e,i){var r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function s(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;var r=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==r.join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}e.exports=s()?Object.assign:function(t,e){for(var i,s,h=o(t),l=1;l<arguments.length;l++){for(var u in i=Object(arguments[l]))n.call(i,u)&&(h[u]=i[u]);if(r){s=r(i);for(var c=0;c<s.length;c++)a.call(i,s[c])&&(h[s[c]]=i[s[c]])}}return h}},{}],52:[function(t,e,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}i.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)n(i,r)&&(t[r]=i[r])}}return t},i.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var a={arraySet:function(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var a=0;a<r;a++)t[n+a]=e[i+a]},flattenChunks:function(t){var e,i,r,n,a,o;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(o=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)a=t[e],o.set(a,n),n+=a.length;return o}},o={arraySet:function(t,e,i,r,n){for(var a=0;a<r;a++)t[n+a]=e[i+a]},flattenChunks:function(t){return[].concat.apply([],t)}};i.setTyped=function(t){t?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,a)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(r)},{}],53:[function(t,e,i){function r(t,e,i,r){for(var n=65535&t,a=t>>>16&65535,o=0;0!==i;){i-=o=i>2e3?2e3:i;do{a=a+(n=n+e[r++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16}e.exports=r},{}],54:[function(t,e,i){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],55:[function(t,e,i){function r(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}var n=r();function a(t,e,i,r){var a=n,o=r+i;t^=-1;for(var s=r;s<o;s++)t=t>>>8^a[255&(t^e[s])];return~t}e.exports=a},{}],56:[function(t,e,i){var r,n=t("../utils/common"),a=t("./trees"),o=t("./adler32"),s=t("./crc32"),h=t("./messages"),l=0,u=1,c=3,f=4,d=5,p=0,m=1,g=-2,_=-3,b=-5,y=-1,w=1,v=2,x=3,k=4,E=0,S=2,M=8,A=9,I=15,z=8,P=286,T=30,R=19,O=2*P+1,B=15,C=3,L=258,D=L+C+1,U=32,F=42,N=69,j=73,G=91,Z=103,H=113,$=666,W=1,q=2,Y=3,V=4,J=3;function K(t,e){return t.msg=h[e],e}function X(t){return(t<<1)-(t>4?9:0)}function Q(t){for(var e=t.length;--e>=0;)t[e]=0}function tt(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(n.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function et(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,tt(t.strm)}function it(t,e){t.pending_buf[t.pending++]=e}function rt(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function nt(t,e,i,r){var a=t.avail_in;return a>r&&(a=r),0===a?0:(t.avail_in-=a,n.arraySet(e,t.input,t.next_in,a,i),1===t.state.wrap?t.adler=o(t.adler,e,a,i):2===t.state.wrap&&(t.adler=s(t.adler,e,a,i)),t.next_in+=a,t.total_in+=a,a)}function at(t,e){var i,r,n=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-D?t.strstart-(t.w_size-D):0,l=t.window,u=t.w_mask,c=t.prev,f=t.strstart+L,d=l[a+o-1],p=l[a+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(i=e)+o]===p&&l[i+o-1]===d&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<f);if(r=L-(f-a),a=f-L,r>o){if(t.match_start=e,o=r,r>=s)break;d=l[a+o-1],p=l[a+o]}}}while((e=c[e&u])>h&&0!=--n);return o<=t.lookahead?o:t.lookahead}function ot(t){var e,i,r,a,o,s=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-D)){n.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=i=t.hash_size;do{r=t.head[--e],t.head[e]=r>=s?r-s:0}while(--i);e=i=s;do{r=t.prev[--e],t.prev[e]=r>=s?r-s:0}while(--i);a+=s}if(0===t.strm.avail_in)break;if(i=nt(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=i,t.lookahead+t.insert>=C)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+C-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<C)););}while(t.lookahead<D&&0!==t.strm.avail_in)}function st(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ot(t),0===t.lookahead&&e===l)return W;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,et(t,!1),0===t.strm.avail_out))return W;if(t.strstart-t.block_start>=t.w_size-D&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===f?(et(t,!0),0===t.strm.avail_out?Y:V):(t.strstart>t.block_start&&(et(t,!1),t.strm.avail_out),W)}function ht(t,e){for(var i,r;;){if(t.lookahead<D){if(ot(t),t.lookahead<D&&e===l)return W;if(0===t.lookahead)break}if(i=0,t.lookahead>=C&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+C-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-D&&(t.match_length=at(t,i)),t.match_length>=C)if(r=a._tr_tally(t,t.strstart-t.match_start,t.match_length-C),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=C){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+C-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=t.strstart<C-1?t.strstart:C-1,e===f?(et(t,!0),0===t.strm.avail_out?Y:V):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:q}function lt(t,e){for(var i,r,n;;){if(t.lookahead<D){if(ot(t),t.lookahead<D&&e===l)return W;if(0===t.lookahead)break}if(i=0,t.lookahead>=C&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+C-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=C-1,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-D&&(t.match_length=at(t,i),t.match_length<=5&&(t.strategy===w||t.match_length===C&&t.strstart-t.match_start>4096)&&(t.match_length=C-1)),t.prev_length>=C&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-C,r=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-C),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+C-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=C-1,t.strstart++,r&&(et(t,!1),0===t.strm.avail_out))return W}else if(t.match_available){if((r=a._tr_tally(t,0,t.window[t.strstart-1]))&&et(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return W}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=a._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<C-1?t.strstart:C-1,e===f?(et(t,!0),0===t.strm.avail_out?Y:V):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:q}function ut(t,e){for(var i,r,n,o,s=t.window;;){if(t.lookahead<=L){if(ot(t),t.lookahead<=L&&e===l)return W;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=C&&t.strstart>0&&(r=s[n=t.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=t.strstart+L;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<o);t.match_length=L-(o-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=C?(i=a._tr_tally(t,1,t.match_length-C),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===f?(et(t,!0),0===t.strm.avail_out?Y:V):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:q}function ct(t,e){for(var i;;){if(0===t.lookahead&&(ot(t),0===t.lookahead)){if(e===l)return W;break}if(t.match_length=0,i=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===f?(et(t,!0),0===t.strm.avail_out?Y:V):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:q}function ft(t,e,i,r,n){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=n}function dt(t){t.window_size=2*t.w_size,Q(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=C-1,t.match_available=0,t.ins_h=0}function pt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=M,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*O),this.dyn_dtree=new n.Buf16(2*(2*T+1)),this.bl_tree=new n.Buf16(2*(2*R+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(B+1),this.heap=new n.Buf16(2*P+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*P+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function mt(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=S,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?F:H,t.adler=2===e.wrap?0:1,e.last_flush=l,a._tr_init(e),p):K(t,g)}function gt(t){var e=mt(t);return e===p&&dt(t.state),e}function _t(t,e){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=e,p):g}function bt(t,e,i,r,a,o){if(!t)return g;var s=1;if(e===y&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),a<1||a>A||i!==M||r<8||r>15||e<0||e>9||o<0||o>k)return K(t,g);8===r&&(r=9);var h=new pt;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=r,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=a+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+C-1)/C),h.window=new n.Buf8(2*h.w_size),h.head=new n.Buf16(h.hash_size),h.prev=new n.Buf16(h.w_size),h.lit_bufsize=1<<a+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new n.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=o,h.method=i,gt(t)}function yt(t,e){return bt(t,e,M,I,z,E)}function wt(t,e){var i,n,o,h;if(!t||!t.state||e>d||e<0)return t?K(t,g):g;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||n.status===$&&e!==f)return K(t,0===t.avail_out?b:g);if(n.strm=t,i=n.last_flush,n.last_flush=e,n.status===F)if(2===n.wrap)t.adler=0,it(n,31),it(n,139),it(n,8),n.gzhead?(it(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),it(n,255&n.gzhead.time),it(n,n.gzhead.time>>8&255),it(n,n.gzhead.time>>16&255),it(n,n.gzhead.time>>24&255),it(n,9===n.level?2:n.strategy>=v||n.level<2?4:0),it(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(it(n,255&n.gzhead.extra.length),it(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=s(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=N):(it(n,0),it(n,0),it(n,0),it(n,0),it(n,0),it(n,9===n.level?2:n.strategy>=v||n.level<2?4:0),it(n,J),n.status=H);else{var _=M+(n.w_bits-8<<4)<<8;_|=(n.strategy>=v||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(_|=U),_+=31-_%31,n.status=H,rt(n,_),0!==n.strstart&&(rt(n,t.adler>>>16),rt(n,65535&t.adler)),t.adler=1}if(n.status===N)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),tt(t),o=n.pending,n.pending!==n.pending_buf_size));)it(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=j)}else n.status=j;if(n.status===j)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),tt(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,it(n,h)}while(0!==h);n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.gzindex=0,n.status=G)}else n.status=G;if(n.status===G)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),tt(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,it(n,h)}while(0!==h);n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.status=Z)}else n.status=Z;if(n.status===Z&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&tt(t),n.pending+2<=n.pending_buf_size&&(it(n,255&t.adler),it(n,t.adler>>8&255),t.adler=0,n.status=H)):n.status=H),0!==n.pending){if(tt(t),0===t.avail_out)return n.last_flush=-1,p}else if(0===t.avail_in&&X(e)<=X(i)&&e!==f)return K(t,b);if(n.status===$&&0!==t.avail_in)return K(t,b);if(0!==t.avail_in||0!==n.lookahead||e!==l&&n.status!==$){var y=n.strategy===v?ct(n,e):n.strategy===x?ut(n,e):r[n.level].func(n,e);if(y!==Y&&y!==V||(n.status=$),y===W||y===Y)return 0===t.avail_out&&(n.last_flush=-1),p;if(y===q&&(e===u?a._tr_align(n):e!==d&&(a._tr_stored_block(n,0,0,!1),e===c&&(Q(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),tt(t),0===t.avail_out))return n.last_flush=-1,p}return e!==f?p:n.wrap<=0?m:(2===n.wrap?(it(n,255&t.adler),it(n,t.adler>>8&255),it(n,t.adler>>16&255),it(n,t.adler>>24&255),it(n,255&t.total_in),it(n,t.total_in>>8&255),it(n,t.total_in>>16&255),it(n,t.total_in>>24&255)):(rt(n,t.adler>>>16),rt(n,65535&t.adler)),tt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?p:m)}function vt(t){var e;return t&&t.state?(e=t.state.status)!==F&&e!==N&&e!==j&&e!==G&&e!==Z&&e!==H&&e!==$?K(t,g):(t.state=null,e===H?K(t,_):p):g}function xt(t,e){var i,r,a,s,h,l,u,c,f=e.length;if(!t||!t.state)return g;if(2===(s=(i=t.state).wrap)||1===s&&i.status!==F||i.lookahead)return g;for(1===s&&(t.adler=o(t.adler,e,f,0)),i.wrap=0,f>=i.w_size&&(0===s&&(Q(i.head),i.strstart=0,i.block_start=0,i.insert=0),c=new n.Buf8(i.w_size),n.arraySet(c,e,f-i.w_size,i.w_size,0),e=c,f=i.w_size),h=t.avail_in,l=t.next_in,u=t.input,t.avail_in=f,t.next_in=0,t.input=e,ot(i);i.lookahead>=C;){r=i.strstart,a=i.lookahead-(C-1);do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+C-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--a);i.strstart=r,i.lookahead=C-1,ot(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=C-1,i.match_available=0,t.next_in=l,t.input=u,t.avail_in=h,i.wrap=s,p}r=[new ft(0,0,0,0,st),new ft(4,4,8,4,ht),new ft(4,5,16,8,ht),new ft(4,6,32,32,ht),new ft(4,4,16,16,lt),new ft(8,16,32,32,lt),new ft(8,16,128,128,lt),new ft(8,32,128,256,lt),new ft(32,128,258,1024,lt),new ft(32,258,258,4096,lt)],i.deflateInit=yt,i.deflateInit2=bt,i.deflateReset=gt,i.deflateResetKeep=mt,i.deflateSetHeader=_t,i.deflate=wt,i.deflateEnd=vt,i.deflateSetDictionary=xt,i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":52,"./adler32":53,"./crc32":55,"./messages":60,"./trees":61}],57:[function(t,e,i){var r=30,n=12;e.exports=function(t,e){var i,a,o,s,h,l,u,c,f,d,p,m,g,_,b,y,w,v,x,k,E,S,M,A,I;i=t.state,a=t.next_in,A=t.input,o=a+(t.avail_in-5),s=t.next_out,I=t.output,h=s-(e-t.avail_out),l=s+(t.avail_out-257),u=i.dmax,c=i.wsize,f=i.whave,d=i.wnext,p=i.window,m=i.hold,g=i.bits,_=i.lencode,b=i.distcode,y=(1<<i.lenbits)-1,w=(1<<i.distbits)-1;t:do{g<15&&(m+=A[a++]<<g,g+=8,m+=A[a++]<<g,g+=8),v=_[m&y];e:for(;;){if(m>>>=x=v>>>24,g-=x,0==(x=v>>>16&255))I[s++]=65535&v;else{if(!(16&x)){if(64&x){if(32&x){i.mode=n;break t}t.msg="invalid literal/length code",i.mode=r;break t}v=_[(65535&v)+(m&(1<<x)-1)];continue e}for(k=65535&v,(x&=15)&&(g<x&&(m+=A[a++]<<g,g+=8),k+=m&(1<<x)-1,m>>>=x,g-=x),g<15&&(m+=A[a++]<<g,g+=8,m+=A[a++]<<g,g+=8),v=b[m&w];;){if(m>>>=x=v>>>24,g-=x,16&(x=v>>>16&255)){if(E=65535&v,g<(x&=15)&&(m+=A[a++]<<g,(g+=8)<x&&(m+=A[a++]<<g,g+=8)),(E+=m&(1<<x)-1)>u){t.msg="invalid distance too far back",i.mode=r;break t}if(m>>>=x,g-=x,E>(x=s-h)){if((x=E-x)>f&&i.sane){t.msg="invalid distance too far back",i.mode=r;break t}if(S=0,M=p,0===d){if(S+=c-x,x<k){k-=x;do{I[s++]=p[S++]}while(--x);S=s-E,M=I}}else if(d<x){if(S+=c+d-x,(x-=d)<k){k-=x;do{I[s++]=p[S++]}while(--x);if(S=0,d<k){k-=x=d;do{I[s++]=p[S++]}while(--x);S=s-E,M=I}}}else if(S+=d-x,x<k){k-=x;do{I[s++]=p[S++]}while(--x);S=s-E,M=I}for(;k>2;)I[s++]=M[S++],I[s++]=M[S++],I[s++]=M[S++],k-=3;k&&(I[s++]=M[S++],k>1&&(I[s++]=M[S++]))}else{S=s-E;do{I[s++]=I[S++],I[s++]=I[S++],I[s++]=I[S++],k-=3}while(k>2);k&&(I[s++]=I[S++],k>1&&(I[s++]=I[S++]))}break}if(64&x){t.msg="invalid distance code",i.mode=r;break t}v=b[(65535&v)+(m&(1<<x)-1)]}}break}}while(a<o&&s<l);a-=k=g>>3,m&=(1<<(g-=k<<3))-1,t.next_in=a,t.next_out=s,t.avail_in=a<o?o-a+5:5-(a-o),t.avail_out=s<l?l-s+257:257-(s-l),i.hold=m,i.bits=g}},{}],58:[function(t,e,i){var r=t("../utils/common"),n=t("./adler32"),a=t("./crc32"),o=t("./inffast"),s=t("./inftrees"),h=0,l=1,u=2,c=4,f=5,d=6,p=0,m=1,g=2,_=-2,b=-3,y=-4,w=-5,v=8,x=1,k=2,E=3,S=4,M=5,A=6,I=7,z=8,P=9,T=10,R=11,O=12,B=13,C=14,L=15,D=16,U=17,F=18,N=19,j=20,G=21,Z=22,H=23,$=24,W=25,q=26,Y=27,V=28,J=29,K=30,X=31,Q=852,tt=592,et=15;function it(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function rt(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function nt(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=x,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(Q),e.distcode=e.distdyn=new r.Buf32(tt),e.sane=1,e.back=-1,p):_}function at(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,nt(t)):_}function ot(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?_:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,at(t))):_}function st(t,e){var i,r;return t?(r=new rt,t.state=r,r.window=null,(i=ot(t,e))!==p&&(t.state=null),i):_}function ht(t){return st(t,et)}var lt,ut,ct=!0;function ft(t){if(ct){var e;for(lt=new r.Buf32(512),ut=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(l,t.lens,0,288,lt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(u,t.lens,0,32,ut,0,t.work,{bits:5}),ct=!1}t.lencode=lt,t.lenbits=9,t.distcode=ut,t.distbits=5}function dt(t,e,i,n){var a,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),r.arraySet(o.window,e,i-n,a,o.wnext),(n-=a)?(r.arraySet(o.window,e,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}function pt(t,e){var i,Q,tt,et,rt,nt,at,ot,st,ht,lt,ut,ct,pt,mt,gt,_t,bt,yt,wt,vt,xt,kt,Et,St=0,Mt=new r.Buf8(4),At=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return _;(i=t.state).mode===O&&(i.mode=B),rt=t.next_out,tt=t.output,at=t.avail_out,et=t.next_in,Q=t.input,nt=t.avail_in,ot=i.hold,st=i.bits,ht=nt,lt=at,xt=p;t:for(;;)switch(i.mode){case x:if(0===i.wrap){i.mode=B;break}for(;st<16;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(2&i.wrap&&35615===ot){i.check=0,Mt[0]=255&ot,Mt[1]=ot>>>8&255,i.check=a(i.check,Mt,2,0),ot=0,st=0,i.mode=k;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&ot)<<8)+(ot>>8))%31){t.msg="incorrect header check",i.mode=K;break}if((15&ot)!==v){t.msg="unknown compression method",i.mode=K;break}if(st-=4,vt=8+(15&(ot>>>=4)),0===i.wbits)i.wbits=vt;else if(vt>i.wbits){t.msg="invalid window size",i.mode=K;break}i.dmax=1<<vt,t.adler=i.check=1,i.mode=512&ot?T:O,ot=0,st=0;break;case k:for(;st<16;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(i.flags=ot,(255&i.flags)!==v){t.msg="unknown compression method",i.mode=K;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=K;break}i.head&&(i.head.text=ot>>8&1),512&i.flags&&(Mt[0]=255&ot,Mt[1]=ot>>>8&255,i.check=a(i.check,Mt,2,0)),ot=0,st=0,i.mode=E;case E:for(;st<32;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}i.head&&(i.head.time=ot),512&i.flags&&(Mt[0]=255&ot,Mt[1]=ot>>>8&255,Mt[2]=ot>>>16&255,Mt[3]=ot>>>24&255,i.check=a(i.check,Mt,4,0)),ot=0,st=0,i.mode=S;case S:for(;st<16;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}i.head&&(i.head.xflags=255&ot,i.head.os=ot>>8),512&i.flags&&(Mt[0]=255&ot,Mt[1]=ot>>>8&255,i.check=a(i.check,Mt,2,0)),ot=0,st=0,i.mode=M;case M:if(1024&i.flags){for(;st<16;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}i.length=ot,i.head&&(i.head.extra_len=ot),512&i.flags&&(Mt[0]=255&ot,Mt[1]=ot>>>8&255,i.check=a(i.check,Mt,2,0)),ot=0,st=0}else i.head&&(i.head.extra=null);i.mode=A;case A:if(1024&i.flags&&((ut=i.length)>nt&&(ut=nt),ut&&(i.head&&(vt=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,Q,et,ut,vt)),512&i.flags&&(i.check=a(i.check,Q,ut,et)),nt-=ut,et+=ut,i.length-=ut),i.length))break t;i.length=0,i.mode=I;case I:if(2048&i.flags){if(0===nt)break t;ut=0;do{vt=Q[et+ut++],i.head&&vt&&i.length<65536&&(i.head.name+=String.fromCharCode(vt))}while(vt&&ut<nt);if(512&i.flags&&(i.check=a(i.check,Q,ut,et)),nt-=ut,et+=ut,vt)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=z;case z:if(4096&i.flags){if(0===nt)break t;ut=0;do{vt=Q[et+ut++],i.head&&vt&&i.length<65536&&(i.head.comment+=String.fromCharCode(vt))}while(vt&&ut<nt);if(512&i.flags&&(i.check=a(i.check,Q,ut,et)),nt-=ut,et+=ut,vt)break t}else i.head&&(i.head.comment=null);i.mode=P;case P:if(512&i.flags){for(;st<16;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(ot!==(65535&i.check)){t.msg="header crc mismatch",i.mode=K;break}ot=0,st=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=O;break;case T:for(;st<32;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}t.adler=i.check=it(ot),ot=0,st=0,i.mode=R;case R:if(0===i.havedict)return t.next_out=rt,t.avail_out=at,t.next_in=et,t.avail_in=nt,i.hold=ot,i.bits=st,g;t.adler=i.check=1,i.mode=O;case O:if(e===f||e===d)break t;case B:if(i.last){ot>>>=7&st,st-=7&st,i.mode=Y;break}for(;st<3;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}switch(i.last=1&ot,st-=1,3&(ot>>>=1)){case 0:i.mode=C;break;case 1:if(ft(i),i.mode=j,e===d){ot>>>=2,st-=2;break t}break;case 2:i.mode=U;break;case 3:t.msg="invalid block type",i.mode=K}ot>>>=2,st-=2;break;case C:for(ot>>>=7&st,st-=7&st;st<32;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if((65535&ot)!=(ot>>>16^65535)){t.msg="invalid stored block lengths",i.mode=K;break}if(i.length=65535&ot,ot=0,st=0,i.mode=L,e===d)break t;case L:i.mode=D;case D:if(ut=i.length){if(ut>nt&&(ut=nt),ut>at&&(ut=at),0===ut)break t;r.arraySet(tt,Q,et,ut,rt),nt-=ut,et+=ut,at-=ut,rt+=ut,i.length-=ut;break}i.mode=O;break;case U:for(;st<14;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(i.nlen=257+(31&ot),ot>>>=5,st-=5,i.ndist=1+(31&ot),ot>>>=5,st-=5,i.ncode=4+(15&ot),ot>>>=4,st-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=K;break}i.have=0,i.mode=F;case F:for(;i.have<i.ncode;){for(;st<3;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}i.lens[At[i.have++]]=7&ot,ot>>>=3,st-=3}for(;i.have<19;)i.lens[At[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,kt={bits:i.lenbits},xt=s(h,i.lens,0,19,i.lencode,0,i.work,kt),i.lenbits=kt.bits,xt){t.msg="invalid code lengths set",i.mode=K;break}i.have=0,i.mode=N;case N:for(;i.have<i.nlen+i.ndist;){for(;gt=(St=i.lencode[ot&(1<<i.lenbits)-1])>>>16&255,_t=65535&St,!((mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(_t<16)ot>>>=mt,st-=mt,i.lens[i.have++]=_t;else{if(16===_t){for(Et=mt+2;st<Et;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(ot>>>=mt,st-=mt,0===i.have){t.msg="invalid bit length repeat",i.mode=K;break}vt=i.lens[i.have-1],ut=3+(3&ot),ot>>>=2,st-=2}else if(17===_t){for(Et=mt+3;st<Et;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}st-=mt,vt=0,ut=3+(7&(ot>>>=mt)),ot>>>=3,st-=3}else{for(Et=mt+7;st<Et;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}st-=mt,vt=0,ut=11+(127&(ot>>>=mt)),ot>>>=7,st-=7}if(i.have+ut>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=K;break}for(;ut--;)i.lens[i.have++]=vt}}if(i.mode===K)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=K;break}if(i.lenbits=9,kt={bits:i.lenbits},xt=s(l,i.lens,0,i.nlen,i.lencode,0,i.work,kt),i.lenbits=kt.bits,xt){t.msg="invalid literal/lengths set",i.mode=K;break}if(i.distbits=6,i.distcode=i.distdyn,kt={bits:i.distbits},xt=s(u,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,kt),i.distbits=kt.bits,xt){t.msg="invalid distances set",i.mode=K;break}if(i.mode=j,e===d)break t;case j:i.mode=G;case G:if(nt>=6&&at>=258){t.next_out=rt,t.avail_out=at,t.next_in=et,t.avail_in=nt,i.hold=ot,i.bits=st,o(t,lt),rt=t.next_out,tt=t.output,at=t.avail_out,et=t.next_in,Q=t.input,nt=t.avail_in,ot=i.hold,st=i.bits,i.mode===O&&(i.back=-1);break}for(i.back=0;gt=(St=i.lencode[ot&(1<<i.lenbits)-1])>>>16&255,_t=65535&St,!((mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(gt&&!(240&gt)){for(bt=mt,yt=gt,wt=_t;gt=(St=i.lencode[wt+((ot&(1<<bt+yt)-1)>>bt)])>>>16&255,_t=65535&St,!(bt+(mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}ot>>>=bt,st-=bt,i.back+=bt}if(ot>>>=mt,st-=mt,i.back+=mt,i.length=_t,0===gt){i.mode=q;break}if(32&gt){i.back=-1,i.mode=O;break}if(64&gt){t.msg="invalid literal/length code",i.mode=K;break}i.extra=15&gt,i.mode=Z;case Z:if(i.extra){for(Et=i.extra;st<Et;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}i.length+=ot&(1<<i.extra)-1,ot>>>=i.extra,st-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=H;case H:for(;gt=(St=i.distcode[ot&(1<<i.distbits)-1])>>>16&255,_t=65535&St,!((mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(!(240&gt)){for(bt=mt,yt=gt,wt=_t;gt=(St=i.distcode[wt+((ot&(1<<bt+yt)-1)>>bt)])>>>16&255,_t=65535&St,!(bt+(mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}ot>>>=bt,st-=bt,i.back+=bt}if(ot>>>=mt,st-=mt,i.back+=mt,64&gt){t.msg="invalid distance code",i.mode=K;break}i.offset=_t,i.extra=15&gt,i.mode=$;case $:if(i.extra){for(Et=i.extra;st<Et;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}i.offset+=ot&(1<<i.extra)-1,ot>>>=i.extra,st-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=K;break}i.mode=W;case W:if(0===at)break t;if(ut=lt-at,i.offset>ut){if((ut=i.offset-ut)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=K;break}ut>i.wnext?(ut-=i.wnext,ct=i.wsize-ut):ct=i.wnext-ut,ut>i.length&&(ut=i.length),pt=i.window}else pt=tt,ct=rt-i.offset,ut=i.length;ut>at&&(ut=at),at-=ut,i.length-=ut;do{tt[rt++]=pt[ct++]}while(--ut);0===i.length&&(i.mode=G);break;case q:if(0===at)break t;tt[rt++]=i.length,at--,i.mode=G;break;case Y:if(i.wrap){for(;st<32;){if(0===nt)break t;nt--,ot|=Q[et++]<<st,st+=8}if(lt-=at,t.total_out+=lt,i.total+=lt,lt&&(t.adler=i.check=i.flags?a(i.check,tt,lt,rt-lt):n(i.check,tt,lt,rt-lt)),lt=at,(i.flags?ot:it(ot))!==i.check){t.msg="incorrect data check",i.mode=K;break}ot=0,st=0}i.mode=V;case V:if(i.wrap&&i.flags){for(;st<32;){if(0===nt)break t;nt--,ot+=Q[et++]<<st,st+=8}if(ot!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=K;break}ot=0,st=0}i.mode=J;case J:xt=m;break t;case K:xt=b;break t;case X:return y;default:return _}return t.next_out=rt,t.avail_out=at,t.next_in=et,t.avail_in=nt,i.hold=ot,i.bits=st,(i.wsize||lt!==t.avail_out&&i.mode<K&&(i.mode<Y||e!==c))&&dt(t,t.output,t.next_out,lt-t.avail_out),ht-=t.avail_in,lt-=t.avail_out,t.total_in+=ht,t.total_out+=lt,i.total+=lt,i.wrap&&lt&&(t.adler=i.check=i.flags?a(i.check,tt,lt,t.next_out-lt):n(i.check,tt,lt,t.next_out-lt)),t.data_type=i.bits+(i.last?64:0)+(i.mode===O?128:0)+(i.mode===j||i.mode===L?256:0),(0===ht&&0===lt||e===c)&&xt===p&&(xt=w),xt}function mt(t){if(!t||!t.state)return _;var e=t.state;return e.window&&(e.window=null),t.state=null,p}function gt(t,e){var i;return t&&t.state&&2&(i=t.state).wrap?(i.head=e,e.done=!1,p):_}function _t(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&i.mode!==R?_:i.mode===R&&n(1,e,r,0)!==i.check?b:dt(t,e,r,r)?(i.mode=X,y):(i.havedict=1,p):_}i.inflateReset=at,i.inflateReset2=ot,i.inflateResetKeep=nt,i.inflateInit=ht,i.inflateInit2=st,i.inflate=pt,i.inflateEnd=mt,i.inflateGetHeader=gt,i.inflateSetDictionary=_t,i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":52,"./adler32":53,"./crc32":55,"./inffast":57,"./inftrees":59}],59:[function(t,e,i){var r=t("../utils/common"),n=15,a=852,o=592,s=0,h=1,l=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],c=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],f=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,i,p,m,g,_,b){var y,w,v,x,k,E,S,M,A,I=b.bits,z=0,P=0,T=0,R=0,O=0,B=0,C=0,L=0,D=0,U=0,F=null,N=0,j=new r.Buf16(n+1),G=new r.Buf16(n+1),Z=null,H=0;for(z=0;z<=n;z++)j[z]=0;for(P=0;P<p;P++)j[e[i+P]]++;for(O=I,R=n;R>=1&&0===j[R];R--);if(O>R&&(O=R),0===R)return m[g++]=20971520,m[g++]=20971520,b.bits=1,0;for(T=1;T<R&&0===j[T];T++);for(O<T&&(O=T),L=1,z=1;z<=n;z++)if(L<<=1,(L-=j[z])<0)return-1;if(L>0&&(t===s||1!==R))return-1;for(G[1]=0,z=1;z<n;z++)G[z+1]=G[z]+j[z];for(P=0;P<p;P++)0!==e[i+P]&&(_[G[e[i+P]]++]=P);if(t===s?(F=Z=_,E=19):t===h?(F=u,N-=257,Z=c,H-=257,E=256):(F=f,Z=d,E=-1),U=0,P=0,z=T,k=g,B=O,C=0,v=-1,x=(D=1<<O)-1,t===h&&D>a||t===l&&D>o)return 1;for(;;){S=z-C,_[P]<E?(M=0,A=_[P]):_[P]>E?(M=Z[H+_[P]],A=F[N+_[P]]):(M=96,A=0),y=1<<z-C,T=w=1<<B;do{m[k+(U>>C)+(w-=y)]=S<<24|M<<16|A}while(0!==w);for(y=1<<z-1;U&y;)y>>=1;if(0!==y?(U&=y-1,U+=y):U=0,P++,0==--j[z]){if(z===R)break;z=e[i+_[P]]}if(z>O&&(U&x)!==v){for(0===C&&(C=O),k+=T,L=1<<(B=z-C);B+C<R&&!((L-=j[B+C])<=0);)B++,L<<=1;if(D+=1<<B,t===h&&D>a||t===l&&D>o)return 1;m[v=U&x]=O<<24|B<<16|k-g}}return 0!==U&&(m[k+U]=z-C<<24|64<<16),b.bits=O,0}},{"../utils/common":52}],60:[function(t,e,i){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],61:[function(t,e,i){var r=t("../utils/common"),n=4,a=0,o=1,s=2;function h(t){for(var e=t.length;--e>=0;)t[e]=0}var l=0,u=1,c=2,f=3,d=258,p=29,m=256,g=m+1+p,_=30,b=19,y=2*g+1,w=15,v=16,x=7,k=256,E=16,S=17,M=18,A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],I=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T=512,R=new Array(2*(g+2));h(R);var O=new Array(2*_);h(O);var B=new Array(T);h(B);var C=new Array(d-f+1);h(C);var L=new Array(p);h(L);var D,U,F,N=new Array(_);function j(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function G(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Z(t){return t<256?B[t]:B[256+(t>>>7)]}function H(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function $(t,e,i){t.bi_valid>v-i?(t.bi_buf|=e<<t.bi_valid&65535,H(t,t.bi_buf),t.bi_buf=e>>v-t.bi_valid,t.bi_valid+=i-v):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function W(t,e,i){$(t,i[2*e],i[2*e+1])}function q(t,e){var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1}function Y(t){16===t.bi_valid?(H(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function V(t,e){var i,r,n,a,o,s,h=e.dyn_tree,l=e.max_code,u=e.stat_desc.static_tree,c=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(a=0;a<=w;a++)t.bl_count[a]=0;for(h[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<y;i++)(a=h[2*h[2*(r=t.heap[i])+1]+1]+1)>p&&(a=p,m++),h[2*r+1]=a,r>l||(t.bl_count[a]++,o=0,r>=d&&(o=f[r-d]),s=h[2*r],t.opt_len+=s*(a+o),c&&(t.static_len+=s*(u[2*r+1]+o)));if(0!==m){do{for(a=p-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(r=t.bl_count[a];0!==r;)(n=t.heap[--i])>l||(h[2*n+1]!==a&&(t.opt_len+=(a-h[2*n+1])*h[2*n],h[2*n+1]=a),r--)}}function J(t,e,i){var r,n,a=new Array(w+1),o=0;for(r=1;r<=w;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=q(a[s]++,s))}}function K(){var t,e,i,r,n,a=new Array(w+1);for(i=0,r=0;r<p-1;r++)for(L[r]=i,t=0;t<1<<A[r];t++)C[i++]=r;for(C[i-1]=r,n=0,r=0;r<16;r++)for(N[r]=n,t=0;t<1<<I[r];t++)B[n++]=r;for(n>>=7;r<_;r++)for(N[r]=n<<7,t=0;t<1<<I[r]-7;t++)B[256+n++]=r;for(e=0;e<=w;e++)a[e]=0;for(t=0;t<=143;)R[2*t+1]=8,t++,a[8]++;for(;t<=255;)R[2*t+1]=9,t++,a[9]++;for(;t<=279;)R[2*t+1]=7,t++,a[7]++;for(;t<=287;)R[2*t+1]=8,t++,a[8]++;for(J(R,g+1,a),t=0;t<_;t++)O[2*t+1]=5,O[2*t]=q(t,5);D=new j(R,A,m+1,g,w),U=new j(O,I,0,_,w),F=new j(new Array(0),z,0,b,x)}function X(t){var e;for(e=0;e<g;e++)t.dyn_ltree[2*e]=0;for(e=0;e<_;e++)t.dyn_dtree[2*e]=0;for(e=0;e<b;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*k]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Q(t){t.bi_valid>8?H(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function tt(t,e,i,n){Q(t),H(t,i),H(t,~i),r.arraySet(t.pending_buf,t.window,e,i,t.pending),t.pending+=i}function et(t,e,i,r){var n=2*e,a=2*i;return t[n]<t[a]||t[n]===t[a]&&r[e]<=r[i]}function it(t,e,i){for(var r=t.heap[i],n=i<<1;n<=t.heap_len&&(n<t.heap_len&&et(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!et(e,r,t.heap[n],t.depth));)t.heap[i]=t.heap[n],i=n,n<<=1;t.heap[i]=r}function rt(t,e,i){var r,n,a,o,s=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*s]<<8|t.pending_buf[t.d_buf+2*s+1],n=t.pending_buf[t.l_buf+s],s++,0===r?W(t,n,e):(W(t,(a=C[n])+m+1,e),0!==(o=A[a])&&$(t,n-=L[a],o),W(t,a=Z(--r),i),0!==(o=I[a])&&$(t,r-=N[a],o))}while(s<t.last_lit);W(t,k,e)}function nt(t,e){var i,r,n,a=e.dyn_tree,o=e.stat_desc.static_tree,s=e.stat_desc.has_stree,h=e.stat_desc.elems,l=-1;for(t.heap_len=0,t.heap_max=y,i=0;i<h;i++)0!==a[2*i]?(t.heap[++t.heap_len]=l=i,t.depth[i]=0):a[2*i+1]=0;for(;t.heap_len<2;)a[2*(n=t.heap[++t.heap_len]=l<2?++l:0)]=1,t.depth[n]=0,t.opt_len--,s&&(t.static_len-=o[2*n+1]);for(e.max_code=l,i=t.heap_len>>1;i>=1;i--)it(t,a,i);n=h;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],it(t,a,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,a[2*n]=a[2*i]+a[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,a[2*i+1]=a[2*r+1]=n,t.heap[1]=n++,it(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],V(t,e),J(a,l,t.bl_count)}function at(t,e,i){var r,n,a=-1,o=e[1],s=0,h=7,l=4;for(0===o&&(h=138,l=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=e[2*(r+1)+1],++s<h&&n===o||(s<l?t.bl_tree[2*n]+=s:0!==n?(n!==a&&t.bl_tree[2*n]++,t.bl_tree[2*E]++):s<=10?t.bl_tree[2*S]++:t.bl_tree[2*M]++,s=0,a=n,0===o?(h=138,l=3):n===o?(h=6,l=3):(h=7,l=4))}function ot(t,e,i){var r,n,a=-1,o=e[1],s=0,h=7,l=4;for(0===o&&(h=138,l=3),r=0;r<=i;r++)if(n=o,o=e[2*(r+1)+1],!(++s<h&&n===o)){if(s<l)do{W(t,n,t.bl_tree)}while(0!=--s);else 0!==n?(n!==a&&(W(t,n,t.bl_tree),s--),W(t,E,t.bl_tree),$(t,s-3,2)):s<=10?(W(t,S,t.bl_tree),$(t,s-3,3)):(W(t,M,t.bl_tree),$(t,s-11,7));s=0,a=n,0===o?(h=138,l=3):n===o?(h=6,l=3):(h=7,l=4)}}function st(t){var e;for(at(t,t.dyn_ltree,t.l_desc.max_code),at(t,t.dyn_dtree,t.d_desc.max_code),nt(t,t.bl_desc),e=b-1;e>=3&&0===t.bl_tree[2*P[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function ht(t,e,i,r){var n;for($(t,e-257,5),$(t,i-1,5),$(t,r-4,4),n=0;n<r;n++)$(t,t.bl_tree[2*P[n]+1],3);ot(t,t.dyn_ltree,e-1),ot(t,t.dyn_dtree,i-1)}function lt(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return a;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e<m;e++)if(0!==t.dyn_ltree[2*e])return o;return a}h(N);var ut=!1;function ct(t){ut||(K(),ut=!0),t.l_desc=new G(t.dyn_ltree,D),t.d_desc=new G(t.dyn_dtree,U),t.bl_desc=new G(t.bl_tree,F),t.bi_buf=0,t.bi_valid=0,X(t)}function ft(t,e,i,r){$(t,(l<<1)+(r?1:0),3),tt(t,e,i)}function dt(t){$(t,u<<1,3),W(t,k,R),Y(t)}function pt(t,e,i,r){var a,o,h=0;t.level>0?(t.strm.data_type===s&&(t.strm.data_type=lt(t)),nt(t,t.l_desc),nt(t,t.d_desc),h=st(t),a=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=a&&(a=o)):a=o=i+5,i+4<=a&&-1!==e?ft(t,e,i,r):t.strategy===n||o===a?($(t,(u<<1)+(r?1:0),3),rt(t,R,O)):($(t,(c<<1)+(r?1:0),3),ht(t,t.l_desc.max_code+1,t.d_desc.max_code+1,h+1),rt(t,t.dyn_ltree,t.dyn_dtree)),X(t),r&&Q(t)}function mt(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(C[i]+m+1)]++,t.dyn_dtree[2*Z(e)]++),t.last_lit===t.lit_bufsize-1}i._tr_init=ct,i._tr_stored_block=ft,i._tr_flush_block=pt,i._tr_tally=mt,i._tr_align=dt},{"../utils/common":52}],62:[function(t,e,i){function r(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=r},{}],63:[function(t,e,i){var r,n,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function h(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}function l(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],f=!1,d=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&m())}function m(){if(!f){var t=h(p);f=!0;for(var e=c.length;e;){for(u=c,c=[];++d<e;)u&&u[d].run();d=-1,e=c.length}u=null,f=!1,l(t)}}function g(t,e){this.fun=t,this.array=e}function _(){}a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];c.push(new g(t,e)),1!==c.length||f||h(m)},g.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=_,a.addListener=_,a.once=_,a.off=_,a.removeListener=_,a.removeAllListeners=_,a.emit=_,a.prependListener=_,a.prependOnceListener=_,a.listeners=function(t){return[]},a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],64:[function(t,e,i){
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var r=t("buffer"),n=r.Buffer;function a(t,e){for(var i in t)e[i]=t[i]}function o(t,e,i){return n(t,e,i)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(a(r,i),i.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(t,e,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,i)},o.alloc=function(t,e,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=n(t);return void 0!==e?"string"==typeof i?r.fill(e,i):r.fill(e):r.fill(0),r},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},{buffer:32}],65:[function(t,e,i){e.exports=n;var r=t("events").EventEmitter;function n(){r.call(this)}t("inherits")(n,r),n.Readable=t("readable-stream/lib/_stream_readable.js"),n.Writable=t("readable-stream/lib/_stream_writable.js"),n.Duplex=t("readable-stream/lib/_stream_duplex.js"),n.Transform=t("readable-stream/lib/_stream_transform.js"),n.PassThrough=t("readable-stream/lib/_stream_passthrough.js"),n.finished=t("readable-stream/lib/internal/streams/end-of-stream.js"),n.pipeline=t("readable-stream/lib/internal/streams/pipeline.js"),n.Stream=n,n.prototype.pipe=function(t,e){var i=this;function n(e){t.writable&&!1===t.write(e)&&i.pause&&i.pause()}function a(){i.readable&&i.resume&&i.resume()}i.on("data",n),t.on("drain",a),t._isStdio||e&&!1===e.end||(i.on("end",s),i.on("close",h));var o=!1;function s(){o||(o=!0,t.end())}function h(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(u(),0===r.listenerCount(this,"error"))throw t}function u(){i.removeListener("data",n),t.removeListener("drain",a),i.removeListener("end",s),i.removeListener("close",h),i.removeListener("error",l),t.removeListener("error",l),i.removeListener("end",u),i.removeListener("close",u),t.removeListener("close",u)}return i.on("error",l),t.on("error",l),i.on("end",u),i.on("close",u),t.on("close",u),t.emit("pipe",i),t}},{events:35,inherits:46,"readable-stream/lib/_stream_duplex.js":67,"readable-stream/lib/_stream_passthrough.js":68,"readable-stream/lib/_stream_readable.js":69,"readable-stream/lib/_stream_transform.js":70,"readable-stream/lib/_stream_writable.js":71,"readable-stream/lib/internal/streams/end-of-stream.js":75,"readable-stream/lib/internal/streams/pipeline.js":77}],66:[function(t,e,i){function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var n={};function a(t,e,i){function a(t,i,r){return"string"==typeof e?e:e(t,i,r)}i||(i=Error);var o=function(t){function e(e,i,r){return t.call(this,a(e,i,r))||this}return r(e,t),e}(i);o.prototype.name=i.name,o.prototype.code=t,n[t]=o}function o(t,e){if(Array.isArray(t)){var i=t.length;return t=t.map((function(t){return String(t)})),i>2?"one of ".concat(e," ").concat(t.slice(0,i-1).join(", "),", or ")+t[i-1]:2===i?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}function s(t,e,i){return t.substr(0,e.length)===e}function h(t,e,i){return(void 0===i||i>t.length)&&(i=t.length),t.substring(i-e.length,i)===e}function l(t,e,i){return"number"!=typeof i&&(i=0),!(i+e.length>t.length)&&-1!==t.indexOf(e,i)}a("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),a("ERR_INVALID_ARG_TYPE",(function(t,e,i){var r,n;if("string"==typeof e&&s(e,"not ")?(r="must not be",e=e.replace(/^not /,"")):r="must be",h(t," argument"))n="The ".concat(t," ").concat(r," ").concat(o(e,"type"));else{var a=l(t,".")?"property":"argument";n='The "'.concat(t,'" ').concat(a," ").concat(r," ").concat(o(e,"type"))}return n+=". Received type ".concat(typeof i)}),TypeError),a("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),a("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),a("ERR_STREAM_PREMATURE_CLOSE","Premature close"),a("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),a("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),a("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),a("ERR_STREAM_WRITE_AFTER_END","write after end"),a("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),a("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),a("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],67:[function(t,e,i){(function(i){(function(){var r=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e};e.exports=l;var n=t("./_stream_readable"),a=t("./_stream_writable");t("inherits")(l,n);for(var o=r(a.prototype),s=0;s<o.length;s++){var h=o[s];l.prototype[h]||(l.prototype[h]=a.prototype[h])}function l(t){if(!(this instanceof l))return new l(t);n.call(this,t),a.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",u)))}function u(){this._writableState.ended||i.nextTick(c,this)}function c(t){t.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t("_process"))},{"./_stream_readable":69,"./_stream_writable":71,_process:63,inherits:46}],68:[function(t,e,i){e.exports=n;var r=t("./_stream_transform");function n(t){if(!(this instanceof n))return new n(t);r.call(this,t)}t("inherits")(n,r),n.prototype._transform=function(t,e,i){i(null,t)}},{"./_stream_transform":70,inherits:46}],69:[function(e,i,r){(function(t,r){(function(){var n;i.exports=I,I.ReadableState=A,e("events").EventEmitter;var a=function(t,e){return t.listeners(e).length},o=e("./internal/streams/stream"),s=e("buffer").Buffer,h=r.Uint8Array||function(){};function l(t){return s.from(t)}function u(t){return s.isBuffer(t)||t instanceof h}var c,f=e("util");c=f&&f.debuglog?f.debuglog("stream"):function(){};var d,p,m,g=e("./internal/streams/buffer_list"),_=e("./internal/streams/destroy"),b=e("./internal/streams/state").getHighWaterMark,y=e("../errors").codes,w=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,x=y.ERR_METHOD_NOT_IMPLEMENTED,k=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(I,o);var E=_.errorOrDestroy,S=["error","close","destroy","pause","resume"];function M(t,e,i){if("function"==typeof t.prependListener)return t.prependListener(e,i);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i)}function A(t,i,r){n=n||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=i instanceof n),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=b(this,t,"readableHighWaterMark",r),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=e("string_decoder/").StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function I(t){if(n=n||e("./_stream_duplex"),!(this instanceof I))return new I(t);var i=this instanceof n;this._readableState=new A(t,this,i),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function z(t,e,i,r,n){c("readableAddChunk",e);var a,o=t._readableState;if(null===e)o.reading=!1,C(t,o);else if(n||(a=T(o,e)),a)E(t,a);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=l(e)),r)o.endEmitted?E(t,new k):P(t,o,e,!0);else if(o.ended)E(t,new v);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!i?(e=o.decoder.write(e),o.objectMode||0!==e.length?P(t,o,e,!1):U(t,o)):P(t,o,e,!1)}else r||(o.reading=!1,U(t,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function P(t,e,i,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,r?e.buffer.unshift(i):e.buffer.push(i),e.needReadable&&L(t)),U(t,e)}function T(t,e){var i;return u(e)||"string"==typeof e||void 0===e||t.objectMode||(i=new w("chunk",["string","Buffer","Uint8Array"],e)),i}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),I.prototype.destroy=_.destroy,I.prototype._undestroy=_.undestroy,I.prototype._destroy=function(t,e){e(t)},I.prototype.push=function(t,e){var i,r=this._readableState;return r.objectMode?i=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=s.from(t,e),e=""),i=!0),z(this,t,e,!1,i)},I.prototype.unshift=function(t){return z(this,t,null,!0,!1)},I.prototype.isPaused=function(){return!1===this._readableState.flowing},I.prototype.setEncoding=function(t){d||(d=e("string_decoder/").StringDecoder);var i=new d(t);this._readableState.decoder=i,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=i.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var R=1073741824;function O(t){return t>=R?t=R:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function B(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=O(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function C(t,e){if(c("onEofChunk"),!e.ended){if(e.decoder){var i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?L(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,D(t)))}}function L(e){var i=e._readableState;c("emitReadable",i.needReadable,i.emittedReadable),i.needReadable=!1,i.emittedReadable||(c("emitReadable",i.flowing),i.emittedReadable=!0,t.nextTick(D,e))}function D(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,$(t)}function U(e,i){i.readingMore||(i.readingMore=!0,t.nextTick(F,e,i))}function F(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var i=e.length;if(c("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}function N(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,$(t))}}function j(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function G(t){c("readable nexttick read 0"),t.read(0)}function Z(e,i){i.resumeScheduled||(i.resumeScheduled=!0,t.nextTick(H,e,i))}function H(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),$(t),e.flowing&&!e.reading&&t.read(0)}function $(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function W(t,e){return 0===e.length?null:(e.objectMode?i=e.buffer.shift():!t||t>=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i);var i}function q(e){var i=e._readableState;c("endReadable",i.endEmitted),i.endEmitted||(i.ended=!0,t.nextTick(Y,i,e))}function Y(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var i=e._writableState;(!i||i.autoDestroy&&i.finished)&&e.destroy()}}function V(t,e){for(var i=0,r=t.length;i<r;i++)if(t[i]===e)return i;return-1}I.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,i=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?q(this):L(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&q(this),null;var r,n=e.needReadable;return c("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",n=!0),e.ended||e.reading?c("reading or ended",n=!1):n&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=B(i,e))),null===(r=t>0?W(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&q(this)),null!==r&&this.emit("data",r),r},I.prototype._read=function(t){E(this,new x("_read()"))},I.prototype.pipe=function(e,i){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,c("pipe count=%d opts=%j",n.pipesCount,i);var o=i&&!1===i.end||e===t.stdout||e===t.stderr?_:h;function s(t,e){c("onunpipe"),t===r&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,f())}function h(){c("onend"),e.end()}n.endEmitted?t.nextTick(o):r.once("end",o),e.on("unpipe",s);var l=N(r);e.on("drain",l);var u=!1;function f(){c("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",s),r.removeListener("end",h),r.removeListener("end",_),r.removeListener("data",d),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||l()}function d(t){c("ondata");var i=e.write(t);c("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==V(n.pipes,e))&&!u&&(c("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function p(t){c("onerror",t),_(),e.removeListener("error",p),0===a(e,"error")&&E(e,t)}function m(){e.removeListener("finish",g),_()}function g(){c("onfinish"),e.removeListener("close",m),_()}function _(){c("unpipe"),r.unpipe(e)}return r.on("data",d),M(e,"error",p),e.once("close",m),e.once("finish",g),e.emit("pipe",r),n.flowing||(c("pipe resume"),r.resume()),e},I.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a<n;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=V(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,i)),this},I.prototype.on=function(e,i){var r=o.prototype.on.call(this,e,i),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,c("on readable",n.length,n.reading),n.length?L(this):n.reading||t.nextTick(G,this))),r},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(e,i){var r=o.prototype.removeListener.call(this,e,i);return"readable"===e&&t.nextTick(j,this),r},I.prototype.removeAllListeners=function(e){var i=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t.nextTick(j,this),i},I.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,Z(this,t)),t.paused=!1,this},I.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(t){var e=this,i=this._readableState,r=!1;for(var n in t.on("end",(function(){if(c("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){c("wrapped data"),i.decoder&&(n=i.decoder.write(n)),i.objectMode&&null==n||(i.objectMode||n&&n.length)&&(e.push(n)||(r=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a<S.length;a++)t.on(S[a],this.emit.bind(this,S[a]));return this._read=function(e){c("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(I.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=e("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),I._fromList=W,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(I.from=function(t,i){return void 0===m&&(m=e("./internal/streams/from")),m(I,t,i)})}).call(this)}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":66,"./_stream_duplex":67,"./internal/streams/async_iterator":72,"./internal/streams/buffer_list":73,"./internal/streams/destroy":74,"./internal/streams/from":76,"./internal/streams/state":78,"./internal/streams/stream":79,_process:63,buffer:32,events:35,inherits:46,"string_decoder/":80,util:29}],70:[function(t,e,i){e.exports=u;var r=t("../errors").codes,n=r.ERR_METHOD_NOT_IMPLEMENTED,a=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,h=t("./_stream_duplex");function l(t,e){var i=this._transformState;i.transforming=!1;var r=i.writecb;if(null===r)return this.emit("error",new a);i.writechunk=null,i.writecb=null,null!=e&&this.push(e),r(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function u(t){if(!(this instanceof u))return new u(t);h.call(this,t),this._transformState={afterTransform:l.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",c)}function c(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(e,i){f(t,e,i)}))}function f(t,e,i){if(e)return t.emit("error",e);if(null!=i&&t.push(i),t._writableState.length)throw new s;if(t._transformState.transforming)throw new o;return t.push(null)}t("inherits")(u,h),u.prototype.push=function(t,e){return this._transformState.needTransform=!1,h.prototype.push.call(this,t,e)},u.prototype._transform=function(t,e,i){i(new n("_transform()"))},u.prototype._write=function(t,e,i){var r=this._transformState;if(r.writecb=i,r.writechunk=t,r.writeencoding=e,!r.transforming){var n=this._readableState;(r.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},u.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},u.prototype._destroy=function(t,e){h.prototype._destroy.call(this,t,(function(t){e(t)}))}},{"../errors":66,"./_stream_duplex":67,inherits:46}],71:[function(e,i,r){(function(t,r){(function(){function n(t){var e=this;this.next=null,this.entry=null,this.finish=function(){H(e,t)}}var a;i.exports=A,A.WritableState=M;var o={deprecate:e("util-deprecate")},s=e("./internal/streams/stream"),h=e("buffer").Buffer,l=r.Uint8Array||function(){};function u(t){return h.from(t)}function c(t){return h.isBuffer(t)||t instanceof l}var f,d=e("./internal/streams/destroy"),p=e("./internal/streams/state").getHighWaterMark,m=e("../errors").codes,g=m.ERR_INVALID_ARG_TYPE,_=m.ERR_METHOD_NOT_IMPLEMENTED,b=m.ERR_MULTIPLE_CALLBACK,y=m.ERR_STREAM_CANNOT_PIPE,w=m.ERR_STREAM_DESTROYED,v=m.ERR_STREAM_NULL_VALUES,x=m.ERR_STREAM_WRITE_AFTER_END,k=m.ERR_UNKNOWN_ENCODING,E=d.errorOrDestroy;function S(){}function M(t,i,r){a=a||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=i instanceof a),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=p(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){C(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function A(t){var i=this instanceof(a=a||e("./_stream_duplex"));if(!i&&!f.call(A,this))return new A(t);this._writableState=new M(t,this,i),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function I(e,i){var r=new x;E(e,r),t.nextTick(i,r)}function z(e,i,r,n){var a;return null===r?a=new v:"string"==typeof r||i.objectMode||(a=new g("chunk",["string","Buffer"],r)),!a||(E(e,a),t.nextTick(n,a),!1)}function P(t,e,i){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,i)),e}function T(t,e,i,r,n,a){if(!i){var o=P(e,r,n);r!==o&&(i=!0,n="buffer",r=o)}var s=e.objectMode?1:r.length;e.length+=s;var h=e.length<e.highWaterMark;if(h||(e.needDrain=!0),e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:n,isBuf:i,callback:a,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else R(t,e,!1,s,r,n,a);return h}function R(t,e,i,r,n,a,o){e.writelen=r,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new w("write")):i?t._writev(n,e.onwrite):t._write(n,a,e.onwrite),e.sync=!1}function O(e,i,r,n,a){--i.pendingcb,r?(t.nextTick(a,n),t.nextTick(G,e,i),e._writableState.errorEmitted=!0,E(e,n)):(a(n),e._writableState.errorEmitted=!0,E(e,n),G(e,i))}function B(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function C(e,i){var r=e._writableState,n=r.sync,a=r.writecb;if("function"!=typeof a)throw new b;if(B(r),i)O(e,r,n,i,a);else{var o=F(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||U(e,r),n?t.nextTick(L,e,r,o,a):L(e,r,o,a)}}function L(t,e,i,r){i||D(t,e),e.pendingcb--,r(),G(t,e)}function D(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function U(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var r=e.bufferedRequestCount,a=new Array(r),o=e.corkedRequestsFree;o.entry=i;for(var s=0,h=!0;i;)a[s]=i,i.isBuf||(h=!1),i=i.next,s+=1;a.allBuffers=h,R(t,e,!0,e.length,a,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,u=i.encoding,c=i.callback;if(R(t,e,!1,e.objectMode?1:l.length,l,u,c),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function F(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function N(t,e){t._final((function(i){e.pendingcb--,i&&E(t,i),e.prefinished=!0,t.emit("prefinish"),G(t,e)}))}function j(e,i){i.prefinished||i.finalCalled||("function"!=typeof e._final||i.destroyed?(i.prefinished=!0,e.emit("prefinish")):(i.pendingcb++,i.finalCalled=!0,t.nextTick(N,e,i)))}function G(t,e){var i=F(e);if(i&&(j(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return i}function Z(e,i,r){i.ending=!0,G(e,i),r&&(i.finished?t.nextTick(r):e.once("finish",r)),i.ended=!0,e.writable=!1}function H(t,e,i){var r=t.entry;for(t.entry=null;r;){var n=r.callback;e.pendingcb--,n(i),r=r.next}e.corkedRequestsFree.next=t}e("inherits")(A,s),M.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(M.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===A&&t&&t._writableState instanceof M}})):f=function(t){return t instanceof this},A.prototype.pipe=function(){E(this,new y)},A.prototype.write=function(t,e,i){var r=this._writableState,n=!1,a=!r.objectMode&&c(t);return a&&!h.isBuffer(t)&&(t=u(t)),"function"==typeof e&&(i=e,e=null),a?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof i&&(i=S),r.ending?I(this,i):(a||z(this,r,t,i))&&(r.pendingcb++,n=T(this,r,a,t,e,i)),n},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||U(this,t))},A.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new k(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,i){i(new _("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,i){var r=this._writableState;return"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||Z(this,r,i),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":66,"./_stream_duplex":67,"./internal/streams/destroy":74,"./internal/streams/state":78,"./internal/streams/stream":79,_process:63,buffer:32,inherits:46,"util-deprecate":81}],72:[function(t,e,i){(function(i){(function(){var r;function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var a=t("./end-of-stream"),o=Symbol("lastResolve"),s=Symbol("lastReject"),h=Symbol("error"),l=Symbol("ended"),u=Symbol("lastPromise"),c=Symbol("handlePromise"),f=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[o];if(null!==e){var i=t[f].read();null!==i&&(t[u]=null,t[o]=null,t[s]=null,e(d(i,!1)))}}function m(t){i.nextTick(p,t)}function g(t,e){return function(i,r){t.then((function(){e[l]?i(d(void 0,!0)):e[c](i,r)}),r)}}var _=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((r={get stream(){return this[f]},next:function(){var t=this,e=this[h];if(null!==e)return Promise.reject(e);if(this[l])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(e,r){i.nextTick((function(){t[h]?r(t[h]):e(d(void 0,!0))}))}));var r,n=this[u];if(n)r=new Promise(g(n,this));else{var a=this[f].read();if(null!==a)return Promise.resolve(d(a,!1));r=new Promise(this[c])}return this[u]=r,r}},n(r,Symbol.asyncIterator,(function(){return this})),n(r,"return",(function(){var t=this;return new Promise((function(e,i){t[f].destroy(null,(function(t){t?i(t):e(d(void 0,!0))}))}))})),r),_),y=function(t){var e,i=Object.create(b,(n(e={},f,{value:t,writable:!0}),n(e,o,{value:null,writable:!0}),n(e,s,{value:null,writable:!0}),n(e,h,{value:null,writable:!0}),n(e,l,{value:t._readableState.endEmitted,writable:!0}),n(e,c,{value:function(t,e){var r=i[f].read();r?(i[u]=null,i[o]=null,i[s]=null,t(d(r,!1))):(i[o]=t,i[s]=e)},writable:!0}),e));return i[u]=null,a(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=i[s];return null!==e&&(i[u]=null,i[o]=null,i[s]=null,e(t)),void(i[h]=t)}var r=i[o];null!==r&&(i[u]=null,i[o]=null,i[s]=null,r(d(void 0,!0))),i[l]=!0})),t.on("readable",m.bind(null,i)),i};e.exports=y}).call(this)}).call(this,t("_process"))},{"./end-of-stream":75,_process:63}],73:[function(t,e,i){function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function n(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e,i){return e&&s(t.prototype,e),t}var l=t("buffer").Buffer,u=t("util").inspect,c=u&&u.custom||"inspect";function f(t,e,i){l.prototype.copy.call(t,e,i)}e.exports=function(){function t(){o(this,t),this.head=null,this.tail=null,this.length=0}return h(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i}},{key:"concat",value:function(t){if(0===this.length)return l.alloc(0);for(var e=l.allocUnsafe(t>>>0),i=this.head,r=0;i;)f(i.data,e,r),r+=i.data.length,i=i.next;return e}},{key:"consume",value:function(t,e){var i;return t<this.head.data.length?(i=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):i=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,i=1,r=e.data;for(t-=r.length;e=e.next;){var n=e.data,a=t>n.length?n.length:t;if(a===n.length?r+=n:r+=n.slice(0,t),0==(t-=a)){a===n.length?(++i,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++i}return this.length-=i,r}},{key:"_getBuffer",value:function(t){var e=l.allocUnsafe(t),i=this.head,r=1;for(i.data.copy(e),t-=i.data.length;i=i.next;){var n=i.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++r,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=n.slice(a));break}++r}return this.length-=r,e}},{key:c,value:function(t,e){return u(this,n({},e,{depth:0,customInspect:!1}))}}]),t}()},{buffer:32,util:29}],74:[function(t,e,i){(function(t){(function(){function i(e,i){var a=this,s=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return s||h?(i?i(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(o,this,e)):t.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!i&&e?a._writableState?a._writableState.errorEmitted?t.nextTick(n,a):(a._writableState.errorEmitted=!0,t.nextTick(r,a,e)):t.nextTick(r,a,e):i?(t.nextTick(n,a),i(e)):t.nextTick(n,a)})),this)}function r(t,e){o(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function a(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(t,e){t.emit("error",e)}function s(t,e){var i=t._readableState,r=t._writableState;i&&i.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}e.exports={destroy:i,undestroy:a,errorOrDestroy:s}}).call(this)}).call(this,t("_process"))},{_process:63}],75:[function(t,e,i){var r=t("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function n(t){var e=!1;return function(){if(!e){e=!0;for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];t.apply(this,r)}}}function a(){}function o(t){return t.setHeader&&"function"==typeof t.abort}function s(t,e,i){if("function"==typeof e)return s(t,null,e);e||(e={}),i=n(i||a);var h=e.readable||!1!==e.readable&&t.readable,l=e.writable||!1!==e.writable&&t.writable,u=function(){t.writable||f()},c=t._writableState&&t._writableState.finished,f=function(){l=!1,c=!0,h||i.call(t)},d=t._readableState&&t._readableState.endEmitted,p=function(){h=!1,d=!0,l||i.call(t)},m=function(e){i.call(t,e)},g=function(){var e;return h&&!d?(t._readableState&&t._readableState.ended||(e=new r),i.call(t,e)):l&&!c?(t._writableState&&t._writableState.ended||(e=new r),i.call(t,e)):void 0},_=function(){t.req.on("finish",f)};return o(t)?(t.on("complete",f),t.on("abort",g),t.req?_():t.on("request",_)):l&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",p),t.on("finish",f),!1!==e.error&&t.on("error",m),t.on("close",g),function(){t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",_),t.req&&t.req.removeListener("finish",f),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",f),t.removeListener("end",p),t.removeListener("error",m),t.removeListener("close",g)}}e.exports=s},{"../../../errors":66}],76:[function(t,e,i){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],77:[function(t,e,i){var r;function n(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var a=t("../../../errors").codes,o=a.ERR_MISSING_ARGS,s=a.ERR_STREAM_DESTROYED;function h(t){if(t)throw t}function l(t){return t.setHeader&&"function"==typeof t.abort}function u(e,i,a,o){o=n(o);var h=!1;e.on("close",(function(){h=!0})),void 0===r&&(r=t("./end-of-stream")),r(e,{readable:i,writable:a},(function(t){if(t)return o(t);h=!0,o()}));var u=!1;return function(t){if(!h&&!u)return u=!0,l(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}function c(t){t()}function f(t,e){return t.pipe(e)}function d(t){return t.length?"function"!=typeof t[t.length-1]?h:t.pop():h}function p(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var r,n=d(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,i){var o=i<e.length-1;return u(t,o,i>0,(function(t){r||(r=t),t&&a.forEach(c),o||(a.forEach(c),n(r))}))}));return e.reduce(f)}e.exports=p},{"../../../errors":66,"./end-of-stream":75}],78:[function(t,e,i){var r=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;function n(t,e,i){return null!=t.highWaterMark?t.highWaterMark:e?t[i]:null}function a(t,e,i,a){var o=n(e,a,i);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(a?i:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}e.exports={getHighWaterMark:a}},{"../../../errors":66}],79:[function(t,e,i){e.exports=t("events").EventEmitter},{events:35}],80:[function(t,e,i){var r=t("safe-buffer").Buffer,n=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function o(t){var e=a(t);if("string"!=typeof e&&(r.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}function s(t){var e;switch(this.encoding=o(t),this.encoding){case"utf16le":this.text=p,this.end=m,e=4;break;case"utf8":this.fillLast=c,e=4;break;case"base64":this.text=g,this.end=_,e=3;break;default:return this.write=b,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function h(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function l(t,e,i){var r=e.length-1;if(r<i)return 0;var n=h(e[r]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--r<i||-2===n?0:(n=h(e[r]))>=0?(n>0&&(t.lastNeed=n-2),n):--r<i||-2===n?0:(n=h(e[r]))>=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function u(t,e,i){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}function c(t){var e=this.lastTotal-this.lastNeed,i=u(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function f(t,e){var i=l(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function p(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function m(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function g(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function _(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function b(t){return t.toString(this.encoding)}function y(t){return t&&t.length?this.write(t):""}i.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""},s.prototype.end=d,s.prototype.text=f,s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":64}],81:[function(e,i,r){(function(t){(function(){function e(t,e){if(r("noDeprecation"))return t;var i=!1;function n(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}return n}function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var i=t.localStorage[e];return null!=i&&"true"===String(i).toLowerCase()}i.exports=e}).call(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],82:[function(t,e,i){arguments[4][25][0].apply(i,arguments)},{dup:25}],83:[function(t,e,i){var r=t("is-arguments"),n=t("is-generator-function"),a=t("which-typed-array"),o=t("is-typed-array");function s(t){return t.call.bind(t)}var h="undefined"!=typeof BigInt,l="undefined"!=typeof Symbol,u=s(Object.prototype.toString),c=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),d=s(Boolean.prototype.valueOf);if(h)var p=s(BigInt.prototype.valueOf);if(l)var m=s(Symbol.prototype.valueOf);function g(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function _(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch}function b(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):o(t)||j(t)}function y(t){return"Uint8Array"===a(t)}function w(t){return"Uint8ClampedArray"===a(t)}function v(t){return"Uint16Array"===a(t)}function x(t){return"Uint32Array"===a(t)}function k(t){return"Int8Array"===a(t)}function E(t){return"Int16Array"===a(t)}function S(t){return"Int32Array"===a(t)}function M(t){return"Float32Array"===a(t)}function A(t){return"Float64Array"===a(t)}function I(t){return"BigInt64Array"===a(t)}function z(t){return"BigUint64Array"===a(t)}function P(t){return"[object Map]"===u(t)}function T(t){return"undefined"!=typeof Map&&(P.working?P(t):t instanceof Map)}function R(t){return"[object Set]"===u(t)}function O(t){return"undefined"!=typeof Set&&(R.working?R(t):t instanceof Set)}function B(t){return"[object WeakMap]"===u(t)}function C(t){return"undefined"!=typeof WeakMap&&(B.working?B(t):t instanceof WeakMap)}function L(t){return"[object WeakSet]"===u(t)}function D(t){return L(t)}function U(t){return"[object ArrayBuffer]"===u(t)}function F(t){return"undefined"!=typeof ArrayBuffer&&(U.working?U(t):t instanceof ArrayBuffer)}function N(t){return"[object DataView]"===u(t)}function j(t){return"undefined"!=typeof DataView&&(N.working?N(t):t instanceof DataView)}i.isArgumentsObject=r,i.isGeneratorFunction=n,i.isTypedArray=o,i.isPromise=_,i.isArrayBufferView=b,i.isUint8Array=y,i.isUint8ClampedArray=w,i.isUint16Array=v,i.isUint32Array=x,i.isInt8Array=k,i.isInt16Array=E,i.isInt32Array=S,i.isFloat32Array=M,i.isFloat64Array=A,i.isBigInt64Array=I,i.isBigUint64Array=z,P.working="undefined"!=typeof Map&&P(new Map),i.isMap=T,R.working="undefined"!=typeof Set&&R(new Set),i.isSet=O,B.working="undefined"!=typeof WeakMap&&B(new WeakMap),i.isWeakMap=C,L.working="undefined"!=typeof WeakSet&&L(new WeakSet),i.isWeakSet=D,U.working="undefined"!=typeof ArrayBuffer&&U(new ArrayBuffer),i.isArrayBuffer=F,N.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&N(new DataView(new ArrayBuffer(1),0,1)),i.isDataView=j;var G="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function Z(t){return"[object SharedArrayBuffer]"===u(t)}function H(t){return void 0!==G&&(void 0===Z.working&&(Z.working=Z(new G)),Z.working?Z(t):t instanceof G)}function $(t){return"[object AsyncFunction]"===u(t)}function W(t){return"[object Map Iterator]"===u(t)}function q(t){return"[object Set Iterator]"===u(t)}function Y(t){return"[object Generator]"===u(t)}function V(t){return"[object WebAssembly.Module]"===u(t)}function J(t){return g(t,c)}function K(t){return g(t,f)}function X(t){return g(t,d)}function Q(t){return h&&g(t,p)}function tt(t){return l&&g(t,m)}function et(t){return J(t)||K(t)||X(t)||Q(t)||tt(t)}function it(t){return"undefined"!=typeof Uint8Array&&(F(t)||H(t))}i.isSharedArrayBuffer=H,i.isAsyncFunction=$,i.isMapIterator=W,i.isSetIterator=q,i.isGeneratorObject=Y,i.isWebAssemblyCompiledModule=V,i.isNumberObject=J,i.isStringObject=K,i.isBooleanObject=X,i.isBigIntObject=Q,i.isSymbolObject=tt,i.isBoxedPrimitive=et,i.isAnyArrayBuffer=it,["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(i,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},{"is-arguments":47,"is-generator-function":49,"is-typed-array":50,"which-typed-array":85}],84:[function(t,e,i){(function(e){(function(){var r=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),i={},r=0;r<e.length;r++)i[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return i},n=/%[sdj%]/g;i.format=function(t){if(!k(t)){for(var e=[],i=0;i<arguments.length;i++)e.push(h(arguments[i]));return e.join(" ")}i=1;for(var r=arguments,a=r.length,o=String(t).replace(n,(function(t){if("%%"===t)return"%";if(i>=a)return t;switch(t){case"%s":return String(r[i++]);case"%d":return Number(r[i++]);case"%j":try{return JSON.stringify(r[i++])}catch(t){return"[Circular]"}default:return t}})),s=r[i];i<a;s=r[++i])w(s)||!A(s)?o+=" "+s:o+=" "+h(s);return o},i.deprecate=function(t,r){if(void 0!==e&&!0===e.noDeprecation)return t;if(void 0===e)return function(){return i.deprecate(t,r).apply(this,arguments)};var n=!1;function a(){if(!n){if(e.throwDeprecation)throw new Error(r);e.traceDeprecation?console.trace(r):console.error(r),n=!0}return t.apply(this,arguments)}return a};var a={},o=/^$/;if(e.env.NODE_DEBUG){var s=e.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}function h(t,e){var r={seen:[],stylize:u};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),y(e)?r.showHidden=e:e&&i._extend(r,e),S(r.showHidden)&&(r.showHidden=!1),S(r.depth)&&(r.depth=2),S(r.colors)&&(r.colors=!1),S(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=l),f(r,t,r.depth)}function l(t,e){var i=h.styles[e];return i?"["+h.colors[i][0]+"m"+t+"["+h.colors[i][1]+"m":t}function u(t,e){return t}function c(t){var e={};return t.forEach((function(t,i){e[t]=!0})),e}function f(t,e,r){if(t.customInspect&&e&&P(e.inspect)&&e.inspect!==i.inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return k(n)||(n=f(t,n,r)),n}var a=d(t,e);if(a)return a;var o=Object.keys(e),s=c(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),z(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return p(e);if(0===o.length){if(P(e)){var h=e.name?": "+e.name:"";return t.stylize("[Function"+h+"]","special")}if(M(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(I(e))return t.stylize(Date.prototype.toString.call(e),"date");if(z(e))return p(e)}var l,u="",y=!1,w=["{","}"];return b(e)&&(y=!0,w=["[","]"]),P(e)&&(u=" [Function"+(e.name?": "+e.name:"")+"]"),M(e)&&(u=" "+RegExp.prototype.toString.call(e)),I(e)&&(u=" "+Date.prototype.toUTCString.call(e)),z(e)&&(u=" "+p(e)),0!==o.length||y&&0!=e.length?r<0?M(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=y?m(t,e,r,s,o):o.map((function(i){return g(t,e,r,s,i,y)})),t.seen.pop(),_(l,u,w)):w[0]+u+w[1]}function d(t,e){if(S(e))return t.stylize("undefined","undefined");if(k(e)){var i="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(i,"string")}return x(e)?t.stylize(""+e,"number"):y(e)?t.stylize(""+e,"boolean"):w(e)?t.stylize("null","null"):void 0}function p(t){return"["+Error.prototype.toString.call(t)+"]"}function m(t,e,i,r,n){for(var a=[],o=0,s=e.length;o<s;++o)L(e,String(o))?a.push(g(t,e,i,r,String(o),!0)):a.push("");return n.forEach((function(n){n.match(/^\d+$/)||a.push(g(t,e,i,r,n,!0))})),a}function g(t,e,i,r,n,a){var o,s,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),L(r,n)||(o="["+n+"]"),s||(t.seen.indexOf(h.value)<0?(s=w(i)?f(t,h.value,null):f(t,h.value,i-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return"  "+t})).join("\n").slice(2):"\n"+s.split("\n").map((function(t){return"   "+t})).join("\n")):s=t.stylize("[Circular]","special")),S(o)){if(a&&n.match(/^\d+$/))return s;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function _(t,e,i){return t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?i[0]+(""===e?"":e+"\n ")+" "+t.join(",\n  ")+" "+i[1]:i[0]+e+" "+t.join(", ")+" "+i[1]}function b(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function w(t){return null===t}function v(t){return null==t}function x(t){return"number"==typeof t}function k(t){return"string"==typeof t}function E(t){return"symbol"==typeof t}function S(t){return void 0===t}function M(t){return A(t)&&"[object RegExp]"===R(t)}function A(t){return"object"==typeof t&&null!==t}function I(t){return A(t)&&"[object Date]"===R(t)}function z(t){return A(t)&&("[object Error]"===R(t)||t instanceof Error)}function P(t){return"function"==typeof t}function T(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function R(t){return Object.prototype.toString.call(t)}function O(t){return t<10?"0"+t.toString(10):t.toString(10)}i.debuglog=function(t){if(t=t.toUpperCase(),!a[t])if(o.test(t)){var r=e.pid;a[t]=function(){var e=i.format.apply(i,arguments);console.error("%s %d: %s",t,r,e)}}else a[t]=function(){};return a[t]},i.inspect=h,h.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},h.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},i.types=t("./support/types"),i.isArray=b,i.isBoolean=y,i.isNull=w,i.isNullOrUndefined=v,i.isNumber=x,i.isString=k,i.isSymbol=E,i.isUndefined=S,i.isRegExp=M,i.types.isRegExp=M,i.isObject=A,i.isDate=I,i.types.isDate=I,i.isError=z,i.types.isNativeError=z,i.isFunction=P,i.isPrimitive=T,i.isBuffer=t("./support/isBuffer");var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),B[t.getMonth()],e].join(" ")}function L(t,e){return Object.prototype.hasOwnProperty.call(t,e)}i.log=function(){console.log("%s - %s",C(),i.format.apply(i,arguments))},i.inherits=t("inherits"),i._extend=function(t,e){if(!e||!A(e))return t;for(var i=Object.keys(e),r=i.length;r--;)t[i[r]]=e[i[r]];return t};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function U(t,e){if(!t){var i=new Error("Promise was rejected with a falsy value");i.reason=t,t=i}return e(t)}function F(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function i(){for(var i=[],r=0;r<arguments.length;r++)i.push(arguments[r]);var n=i.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return n.apply(a,arguments)};t.apply(this,i).then((function(t){e.nextTick(o.bind(null,null,t))}),(function(t){e.nextTick(U.bind(null,t,o))}))}return Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.defineProperties(i,r(t)),i}i.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(D&&t[D]){var e;if("function"!=typeof(e=t[D]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,D,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,i,r=new Promise((function(t,r){e=t,i=r})),n=[],a=0;a<arguments.length;a++)n.push(arguments[a]);n.push((function(t,r){t?i(t):e(r)}));try{t.apply(this,n)}catch(t){i(t)}return r}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),D&&Object.defineProperty(e,D,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,r(t))},i.promisify.custom=D,i.callbackify=F}).call(this)}).call(this,t("_process"))},{"./support/isBuffer":82,"./support/types":83,_process:63,inherits:46}],85:[function(e,i,r){(function(t){(function(){var r=e("for-each"),n=e("available-typed-arrays"),a=e("call-bind/callBound"),o=e("gopd"),s=a("Object.prototype.toString"),h=e("has-tostringtag/shams")(),l="undefined"==typeof globalThis?t:globalThis,u=n(),c=a("String.prototype.slice"),f={},d=Object.getPrototypeOf;h&&o&&d&&r(u,(function(t){if("function"==typeof l[t]){var e=new l[t];if(Symbol.toStringTag in e){var i=d(e),r=o(i,Symbol.toStringTag);if(!r){var n=d(i);r=o(n,Symbol.toStringTag)}f[t]=r.get}}}));var p=function(t){var e=!1;return r(f,(function(i,r){if(!e)try{var n=i.call(t);n===r&&(e=n)}catch(t){}})),e},m=e("is-typed-array");i.exports=function(t){return!!m(t)&&(h&&Symbol.toStringTag in t?p(t):c(s(t),8,-1))}}).call(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"available-typed-arrays":27,"call-bind/callBound":33,"for-each":36,gopd:40,"has-tostringtag/shams":43,"is-typed-array":50}]},{},[20])(20);var Or,Br,Cr,Lr,Dr=Rr.exports;function Ur(){return{mime:"image/png",hasAlpha:!0,encode:(t,{deflateLevel:e=9,deflateStrategy:i=3,filterType:r=Or.AUTO,colorType:n,inputHasAlpha:a=!0,...o}={})=>{const s=new Dr.PNG({width:t.width,height:t.height});return s.data=t.data,Dr.PNG.sync.write(s,{...o,deflateLevel:e,deflateStrategy:i,filterType:r,colorType:void 0!==n?n:a?Cr.COLOR_ALPHA:Cr.COLOR,inputHasAlpha:a})},decode:(t,e)=>{const i=Dr.PNG.sync.read(t,e);return{data:i.data,width:i.width,height:i.height}}}}(Br=Or||(Or={}))[Br.AUTO=-1]="AUTO",Br[Br.NONE=0]="NONE",Br[Br.SUB=1]="SUB",Br[Br.UP=2]="UP",Br[Br.AVERAGE=3]="AVERAGE",Br[Br.PATH=4]="PATH",(Lr=Cr||(Cr={}))[Lr.GRAYSCALE=0]="GRAYSCALE",Lr[Lr.COLOR=2]="COLOR",Lr[Lr.GRAYSCALE_ALPHA=4]="GRAYSCALE_ALPHA",Lr[Lr.COLOR_ALPHA=6]="COLOR_ALPHA";var Fr,Nr={exports:{}},jr={};function Gr(){return Fr||(Fr=1,function(t){var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},t.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var a=0;a<r;a++)t[n+a]=e[i+a]},flattenChunks:function(t){var e,i,r,n,a,o;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(o=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)a=t[e],o.set(a,n),n+=a.length;return o}},n={arraySet:function(t,e,i,r,n){for(var a=0;a<r;a++)t[n+a]=e[i+a]},flattenChunks:function(t){return[].concat.apply([],t)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,n))},t.setTyped(e)}(jr)),jr}var Zr,Hr,$r,Wr,qr,Yr,Vr,Jr,Kr={},Xr={},Qr={};function tn(){if(Zr)return Qr;Zr=1;var t=Gr(),e=0,i=1;function r(t){for(var e=t.length;--e>=0;)t[e]=0}var n=0,a=29,o=256,s=o+1+a,h=30,l=19,u=2*s+1,c=15,f=16,d=7,p=256,m=16,g=17,_=18,b=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],y=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],x=new Array(2*(s+2));r(x);var k=new Array(2*h);r(k);var E=new Array(512);r(E);var S=new Array(256);r(S);var M=new Array(a);r(M);var A,I,z,P=new Array(h);function T(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function R(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function O(t){return t<256?E[t]:E[256+(t>>>7)]}function B(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function C(t,e,i){t.bi_valid>f-i?(t.bi_buf|=e<<t.bi_valid&65535,B(t,t.bi_buf),t.bi_buf=e>>f-t.bi_valid,t.bi_valid+=i-f):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function L(t,e,i){C(t,i[2*e],i[2*e+1])}function D(t,e){var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1}function U(t,e,i){var r,n,a=new Array(c+1),o=0;for(r=1;r<=c;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=D(a[s]++,s))}}function F(t){var e;for(e=0;e<s;e++)t.dyn_ltree[2*e]=0;for(e=0;e<h;e++)t.dyn_dtree[2*e]=0;for(e=0;e<l;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*p]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function N(t){t.bi_valid>8?B(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function j(t,e,i,r){var n=2*e,a=2*i;return t[n]<t[a]||t[n]===t[a]&&r[e]<=r[i]}function G(t,e,i){for(var r=t.heap[i],n=i<<1;n<=t.heap_len&&(n<t.heap_len&&j(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!j(e,r,t.heap[n],t.depth));)t.heap[i]=t.heap[n],i=n,n<<=1;t.heap[i]=r}function Z(t,e,i){var r,n,a,s,h=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],n=t.pending_buf[t.l_buf+h],h++,0===r?L(t,n,e):(L(t,(a=S[n])+o+1,e),0!==(s=b[a])&&C(t,n-=M[a],s),L(t,a=O(--r),i),0!==(s=y[a])&&C(t,r-=P[a],s))}while(h<t.last_lit);L(t,p,e)}function H(t,e){var i,r,n,a=e.dyn_tree,o=e.stat_desc.static_tree,s=e.stat_desc.has_stree,h=e.stat_desc.elems,l=-1;for(t.heap_len=0,t.heap_max=u,i=0;i<h;i++)0!==a[2*i]?(t.heap[++t.heap_len]=l=i,t.depth[i]=0):a[2*i+1]=0;for(;t.heap_len<2;)a[2*(n=t.heap[++t.heap_len]=l<2?++l:0)]=1,t.depth[n]=0,t.opt_len--,s&&(t.static_len-=o[2*n+1]);for(e.max_code=l,i=t.heap_len>>1;i>=1;i--)G(t,a,i);n=h;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],G(t,a,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,a[2*n]=a[2*i]+a[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,a[2*i+1]=a[2*r+1]=n,t.heap[1]=n++,G(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,n,a,o,s,h=e.dyn_tree,l=e.max_code,f=e.stat_desc.static_tree,d=e.stat_desc.has_stree,p=e.stat_desc.extra_bits,m=e.stat_desc.extra_base,g=e.stat_desc.max_length,_=0;for(a=0;a<=c;a++)t.bl_count[a]=0;for(h[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<u;i++)(a=h[2*h[2*(r=t.heap[i])+1]+1]+1)>g&&(a=g,_++),h[2*r+1]=a,r>l||(t.bl_count[a]++,o=0,r>=m&&(o=p[r-m]),s=h[2*r],t.opt_len+=s*(a+o),d&&(t.static_len+=s*(f[2*r+1]+o)));if(0!==_){do{for(a=g-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[g]--,_-=2}while(_>0);for(a=g;0!==a;a--)for(r=t.bl_count[a];0!==r;)(n=t.heap[--i])>l||(h[2*n+1]!==a&&(t.opt_len+=(a-h[2*n+1])*h[2*n],h[2*n+1]=a),r--)}}(t,e),U(a,l,t.bl_count)}function $(t,e,i){var r,n,a=-1,o=e[1],s=0,h=7,l=4;for(0===o&&(h=138,l=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=e[2*(r+1)+1],++s<h&&n===o||(s<l?t.bl_tree[2*n]+=s:0!==n?(n!==a&&t.bl_tree[2*n]++,t.bl_tree[2*m]++):s<=10?t.bl_tree[2*g]++:t.bl_tree[2*_]++,s=0,a=n,0===o?(h=138,l=3):n===o?(h=6,l=3):(h=7,l=4))}function W(t,e,i){var r,n,a=-1,o=e[1],s=0,h=7,l=4;for(0===o&&(h=138,l=3),r=0;r<=i;r++)if(n=o,o=e[2*(r+1)+1],!(++s<h&&n===o)){if(s<l)do{L(t,n,t.bl_tree)}while(0!=--s);else 0!==n?(n!==a&&(L(t,n,t.bl_tree),s--),L(t,m,t.bl_tree),C(t,s-3,2)):s<=10?(L(t,g,t.bl_tree),C(t,s-3,3)):(L(t,_,t.bl_tree),C(t,s-11,7));s=0,a=n,0===o?(h=138,l=3):n===o?(h=6,l=3):(h=7,l=4)}}r(P);var q=!1;function Y(e,i,r,a){C(e,(n<<1)+(a?1:0),3),function(e,i,r,n){N(e),B(e,r),B(e,~r),t.arraySet(e.pending_buf,e.window,i,r,e.pending),e.pending+=r}(e,i,r)}return Qr._tr_init=function(t){q||(!function(){var t,e,i,r,n,u=new Array(c+1);for(i=0,r=0;r<a-1;r++)for(M[r]=i,t=0;t<1<<b[r];t++)S[i++]=r;for(S[i-1]=r,n=0,r=0;r<16;r++)for(P[r]=n,t=0;t<1<<y[r];t++)E[n++]=r;for(n>>=7;r<h;r++)for(P[r]=n<<7,t=0;t<1<<y[r]-7;t++)E[256+n++]=r;for(e=0;e<=c;e++)u[e]=0;for(t=0;t<=143;)x[2*t+1]=8,t++,u[8]++;for(;t<=255;)x[2*t+1]=9,t++,u[9]++;for(;t<=279;)x[2*t+1]=7,t++,u[7]++;for(;t<=287;)x[2*t+1]=8,t++,u[8]++;for(U(x,s+1,u),t=0;t<h;t++)k[2*t+1]=5,k[2*t]=D(t,5);A=new T(x,b,o+1,s,c),I=new T(k,y,0,h,c),z=new T(new Array(0),w,0,l,d)}(),q=!0),t.l_desc=new R(t.dyn_ltree,A),t.d_desc=new R(t.dyn_dtree,I),t.bl_desc=new R(t.bl_tree,z),t.bi_buf=0,t.bi_valid=0,F(t)},Qr._tr_stored_block=Y,Qr._tr_flush_block=function(t,r,n,a){var s,h,u=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var r,n=4093624447;for(r=0;r<=31;r++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*r])return e;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return i;for(r=32;r<o;r++)if(0!==t.dyn_ltree[2*r])return i;return e}(t)),H(t,t.l_desc),H(t,t.d_desc),u=function(t){var e;for($(t,t.dyn_ltree,t.l_desc.max_code),$(t,t.dyn_dtree,t.d_desc.max_code),H(t,t.bl_desc),e=l-1;e>=3&&0===t.bl_tree[2*v[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),s=t.opt_len+3+7>>>3,(h=t.static_len+3+7>>>3)<=s&&(s=h)):s=h=n+5,n+4<=s&&-1!==r?Y(t,r,n,a):4===t.strategy||h===s?(C(t,2+(a?1:0),3),Z(t,x,k)):(C(t,4+(a?1:0),3),function(t,e,i,r){var n;for(C(t,e-257,5),C(t,i-1,5),C(t,r-4,4),n=0;n<r;n++)C(t,t.bl_tree[2*v[n]+1],3);W(t,t.dyn_ltree,e-1),W(t,t.dyn_dtree,i-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,u+1),Z(t,t.dyn_ltree,t.dyn_dtree)),F(t),a&&N(t)},Qr._tr_tally=function(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(S[i]+o+1)]++,t.dyn_dtree[2*O(e)]++),t.last_lit===t.lit_bufsize-1},Qr._tr_align=function(t){C(t,2,3),L(t,p,x),function(t){16===t.bi_valid?(B(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)},Qr}function en(){if($r)return Hr;return $r=1,Hr=function(t,e,i,r){for(var n=65535&t,a=t>>>16&65535,o=0;0!==i;){i-=o=i>2e3?2e3:i;do{a=a+(n=n+e[r++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16},Hr}function rn(){if(qr)return Wr;qr=1;var t=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();return Wr=function(e,i,r,n){var a=t,o=n+r;e^=-1;for(var s=n;s<o;s++)e=e>>>8^a[255&(e^i[s])];return~e},Wr}function nn(){return Vr?Yr:(Vr=1,Yr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"})}function an(){if(Jr)return Xr;Jr=1;var t,e=Gr(),i=tn(),r=en(),n=rn(),a=nn(),o=0,s=4,h=0,l=-2,u=-1,c=4,f=2,d=8,p=9,m=286,g=30,_=19,b=2*m+1,y=15,w=3,v=258,x=v+w+1,k=42,E=103,S=113,M=666,A=1,I=2,z=3,P=4;function T(t,e){return t.msg=a[e],e}function R(t){return(t<<1)-(t>4?9:0)}function O(t){for(var e=t.length;--e>=0;)t[e]=0}function B(t){var i=t.state,r=i.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(e.arraySet(t.output,i.pending_buf,i.pending_out,r,t.next_out),t.next_out+=r,i.pending_out+=r,t.total_out+=r,t.avail_out-=r,i.pending-=r,0===i.pending&&(i.pending_out=0))}function C(t,e){i._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,B(t.strm)}function L(t,e){t.pending_buf[t.pending++]=e}function D(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function U(t,e){var i,r,n=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-x?t.strstart-(t.w_size-x):0,l=t.window,u=t.w_mask,c=t.prev,f=t.strstart+v,d=l[a+o-1],p=l[a+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(i=e)+o]===p&&l[i+o-1]===d&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<f);if(r=v-(f-a),a=f-v,r>o){if(t.match_start=e,o=r,r>=s)break;d=l[a+o-1],p=l[a+o]}}}while((e=c[e&u])>h&&0!=--n);return o<=t.lookahead?o:t.lookahead}function F(t){var i,a,o,s,h,l,u,c,f,d,p=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-x)){e.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,i=a=t.hash_size;do{o=t.head[--i],t.head[i]=o>=p?o-p:0}while(--a);i=a=p;do{o=t.prev[--i],t.prev[i]=o>=p?o-p:0}while(--a);s+=p}if(0===t.strm.avail_in)break;if(l=t.strm,u=t.window,c=t.strstart+t.lookahead,f=s,d=void 0,(d=l.avail_in)>f&&(d=f),a=0===d?0:(l.avail_in-=d,e.arraySet(u,l.input,l.next_in,d,c),1===l.state.wrap?l.adler=r(l.adler,u,d,c):2===l.state.wrap&&(l.adler=n(l.adler,u,d,c)),l.next_in+=d,l.total_in+=d,d),t.lookahead+=a,t.lookahead+t.insert>=w)for(h=t.strstart-t.insert,t.ins_h=t.window[h],t.ins_h=(t.ins_h<<t.hash_shift^t.window[h+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[h+w-1])&t.hash_mask,t.prev[h&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=h,h++,t.insert--,!(t.lookahead+t.insert<w)););}while(t.lookahead<x&&0!==t.strm.avail_in)}function N(t,e){for(var r,n;;){if(t.lookahead<x){if(F(t),t.lookahead<x&&e===o)return A;if(0===t.lookahead)break}if(r=0,t.lookahead>=w&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+w-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-x&&(t.match_length=U(t,r)),t.match_length>=w)if(n=i._tr_tally(t,t.strstart-t.match_start,t.match_length-w),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=w){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+w-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(C(t,!1),0===t.strm.avail_out))return A}return t.insert=t.strstart<w-1?t.strstart:w-1,e===s?(C(t,!0),0===t.strm.avail_out?z:P):t.last_lit&&(C(t,!1),0===t.strm.avail_out)?A:I}function j(t,e){for(var r,n,a;;){if(t.lookahead<x){if(F(t),t.lookahead<x&&e===o)return A;if(0===t.lookahead)break}if(r=0,t.lookahead>=w&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+w-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=w-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-x&&(t.match_length=U(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===w&&t.strstart-t.match_start>4096)&&(t.match_length=w-1)),t.prev_length>=w&&t.match_length<=t.prev_length){a=t.strstart+t.lookahead-w,n=i._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-w),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=a&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+w-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=w-1,t.strstart++,n&&(C(t,!1),0===t.strm.avail_out))return A}else if(t.match_available){if((n=i._tr_tally(t,0,t.window[t.strstart-1]))&&C(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return A}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=i._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<w-1?t.strstart:w-1,e===s?(C(t,!0),0===t.strm.avail_out?z:P):t.last_lit&&(C(t,!1),0===t.strm.avail_out)?A:I}function G(t,e,i,r,n){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=n}function Z(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=d,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new e.Buf16(2*b),this.dyn_dtree=new e.Buf16(2*(2*g+1)),this.bl_tree=new e.Buf16(2*(2*_+1)),O(this.dyn_ltree),O(this.dyn_dtree),O(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(y+1),this.heap=new e.Buf16(2*m+1),O(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(2*m+1),O(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function H(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=f,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?k:S,t.adler=2===e.wrap?0:1,e.last_flush=o,i._tr_init(e),h):T(t,l)}function $(e){var i=H(e);return i===h&&function(e){e.window_size=2*e.w_size,O(e.head),e.max_lazy_match=t[e.level].max_lazy,e.good_match=t[e.level].good_length,e.nice_match=t[e.level].nice_length,e.max_chain_length=t[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=w-1,e.match_available=0,e.ins_h=0}(e.state),i}function W(t,i,r,n,a,o){if(!t)return l;var s=1;if(i===u&&(i=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),a<1||a>p||r!==d||n<8||n>15||i<0||i>9||o<0||o>c)return T(t,l);8===n&&(n=9);var h=new Z;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=a+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+w-1)/w),h.window=new e.Buf8(2*h.w_size),h.head=new e.Buf16(h.hash_size),h.prev=new e.Buf16(h.w_size),h.lit_bufsize=1<<a+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new e.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=i,h.strategy=o,h.method=r,$(t)}return t=[new G(0,0,0,0,(function(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(F(t),0===t.lookahead&&e===o)return A;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,C(t,!1),0===t.strm.avail_out))return A;if(t.strstart-t.block_start>=t.w_size-x&&(C(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===s?(C(t,!0),0===t.strm.avail_out?z:P):(t.strstart>t.block_start&&(C(t,!1),t.strm.avail_out),A)})),new G(4,4,8,4,N),new G(4,5,16,8,N),new G(4,6,32,32,N),new G(4,4,16,16,j),new G(8,16,32,32,j),new G(8,16,128,128,j),new G(8,32,128,256,j),new G(32,128,258,1024,j),new G(32,258,258,4096,j)],Xr.deflateInit=function(t,e){return W(t,e,d,15,8,0)},Xr.deflateInit2=W,Xr.deflateReset=$,Xr.deflateResetKeep=H,Xr.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,h):l},Xr.deflate=function(e,r){var a,u,c,f;if(!e||!e.state||r>5||r<0)return e?T(e,l):l;if(u=e.state,!e.output||!e.input&&0!==e.avail_in||u.status===M&&r!==s)return T(e,0===e.avail_out?-5:l);if(u.strm=e,a=u.last_flush,u.last_flush=r,u.status===k)if(2===u.wrap)e.adler=0,L(u,31),L(u,139),L(u,8),u.gzhead?(L(u,(u.gzhead.text?1:0)+(u.gzhead.hcrc?2:0)+(u.gzhead.extra?4:0)+(u.gzhead.name?8:0)+(u.gzhead.comment?16:0)),L(u,255&u.gzhead.time),L(u,u.gzhead.time>>8&255),L(u,u.gzhead.time>>16&255),L(u,u.gzhead.time>>24&255),L(u,9===u.level?2:u.strategy>=2||u.level<2?4:0),L(u,255&u.gzhead.os),u.gzhead.extra&&u.gzhead.extra.length&&(L(u,255&u.gzhead.extra.length),L(u,u.gzhead.extra.length>>8&255)),u.gzhead.hcrc&&(e.adler=n(e.adler,u.pending_buf,u.pending,0)),u.gzindex=0,u.status=69):(L(u,0),L(u,0),L(u,0),L(u,0),L(u,0),L(u,9===u.level?2:u.strategy>=2||u.level<2?4:0),L(u,3),u.status=S);else{var p=d+(u.w_bits-8<<4)<<8;p|=(u.strategy>=2||u.level<2?0:u.level<6?1:6===u.level?2:3)<<6,0!==u.strstart&&(p|=32),p+=31-p%31,u.status=S,D(u,p),0!==u.strstart&&(D(u,e.adler>>>16),D(u,65535&e.adler)),e.adler=1}if(69===u.status)if(u.gzhead.extra){for(c=u.pending;u.gzindex<(65535&u.gzhead.extra.length)&&(u.pending!==u.pending_buf_size||(u.gzhead.hcrc&&u.pending>c&&(e.adler=n(e.adler,u.pending_buf,u.pending-c,c)),B(e),c=u.pending,u.pending!==u.pending_buf_size));)L(u,255&u.gzhead.extra[u.gzindex]),u.gzindex++;u.gzhead.hcrc&&u.pending>c&&(e.adler=n(e.adler,u.pending_buf,u.pending-c,c)),u.gzindex===u.gzhead.extra.length&&(u.gzindex=0,u.status=73)}else u.status=73;if(73===u.status)if(u.gzhead.name){c=u.pending;do{if(u.pending===u.pending_buf_size&&(u.gzhead.hcrc&&u.pending>c&&(e.adler=n(e.adler,u.pending_buf,u.pending-c,c)),B(e),c=u.pending,u.pending===u.pending_buf_size)){f=1;break}f=u.gzindex<u.gzhead.name.length?255&u.gzhead.name.charCodeAt(u.gzindex++):0,L(u,f)}while(0!==f);u.gzhead.hcrc&&u.pending>c&&(e.adler=n(e.adler,u.pending_buf,u.pending-c,c)),0===f&&(u.gzindex=0,u.status=91)}else u.status=91;if(91===u.status)if(u.gzhead.comment){c=u.pending;do{if(u.pending===u.pending_buf_size&&(u.gzhead.hcrc&&u.pending>c&&(e.adler=n(e.adler,u.pending_buf,u.pending-c,c)),B(e),c=u.pending,u.pending===u.pending_buf_size)){f=1;break}f=u.gzindex<u.gzhead.comment.length?255&u.gzhead.comment.charCodeAt(u.gzindex++):0,L(u,f)}while(0!==f);u.gzhead.hcrc&&u.pending>c&&(e.adler=n(e.adler,u.pending_buf,u.pending-c,c)),0===f&&(u.status=E)}else u.status=E;if(u.status===E&&(u.gzhead.hcrc?(u.pending+2>u.pending_buf_size&&B(e),u.pending+2<=u.pending_buf_size&&(L(u,255&e.adler),L(u,e.adler>>8&255),e.adler=0,u.status=S)):u.status=S),0!==u.pending){if(B(e),0===e.avail_out)return u.last_flush=-1,h}else if(0===e.avail_in&&R(r)<=R(a)&&r!==s)return T(e,-5);if(u.status===M&&0!==e.avail_in)return T(e,-5);if(0!==e.avail_in||0!==u.lookahead||r!==o&&u.status!==M){var m=2===u.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(F(t),0===t.lookahead)){if(e===o)return A;break}if(t.match_length=0,r=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(C(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===s?(C(t,!0),0===t.strm.avail_out?z:P):t.last_lit&&(C(t,!1),0===t.strm.avail_out)?A:I}(u,r):3===u.strategy?function(t,e){for(var r,n,a,h,l=t.window;;){if(t.lookahead<=v){if(F(t),t.lookahead<=v&&e===o)return A;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=w&&t.strstart>0&&(n=l[a=t.strstart-1])===l[++a]&&n===l[++a]&&n===l[++a]){h=t.strstart+v;do{}while(n===l[++a]&&n===l[++a]&&n===l[++a]&&n===l[++a]&&n===l[++a]&&n===l[++a]&&n===l[++a]&&n===l[++a]&&a<h);t.match_length=v-(h-a),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=w?(r=i._tr_tally(t,1,t.match_length-w),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(C(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===s?(C(t,!0),0===t.strm.avail_out?z:P):t.last_lit&&(C(t,!1),0===t.strm.avail_out)?A:I}(u,r):t[u.level].func(u,r);if(m!==z&&m!==P||(u.status=M),m===A||m===z)return 0===e.avail_out&&(u.last_flush=-1),h;if(m===I&&(1===r?i._tr_align(u):5!==r&&(i._tr_stored_block(u,0,0,!1),3===r&&(O(u.head),0===u.lookahead&&(u.strstart=0,u.block_start=0,u.insert=0))),B(e),0===e.avail_out))return u.last_flush=-1,h}return r!==s?h:u.wrap<=0?1:(2===u.wrap?(L(u,255&e.adler),L(u,e.adler>>8&255),L(u,e.adler>>16&255),L(u,e.adler>>24&255),L(u,255&e.total_in),L(u,e.total_in>>8&255),L(u,e.total_in>>16&255),L(u,e.total_in>>24&255)):(D(u,e.adler>>>16),D(u,65535&e.adler)),B(e),u.wrap>0&&(u.wrap=-u.wrap),0!==u.pending?h:1)},Xr.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==k&&69!==e&&73!==e&&91!==e&&e!==E&&e!==S&&e!==M?T(t,l):(t.state=null,e===S?T(t,-3):h):l},Xr.deflateSetDictionary=function(t,i){var n,a,o,s,u,c,f,d,p=i.length;if(!t||!t.state)return l;if(2===(s=(n=t.state).wrap)||1===s&&n.status!==k||n.lookahead)return l;for(1===s&&(t.adler=r(t.adler,i,p,0)),n.wrap=0,p>=n.w_size&&(0===s&&(O(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new e.Buf8(n.w_size),e.arraySet(d,i,p-n.w_size,n.w_size,0),i=d,p=n.w_size),u=t.avail_in,c=t.next_in,f=t.input,t.avail_in=p,t.next_in=0,t.input=i,F(n);n.lookahead>=w;){a=n.strstart,o=n.lookahead-(w-1);do{n.ins_h=(n.ins_h<<n.hash_shift^n.window[a+w-1])&n.hash_mask,n.prev[a&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=a,a++}while(--o);n.strstart=a,n.lookahead=w-1,F(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=w-1,n.match_available=0,t.next_in=c,t.input=f,t.avail_in=u,n.wrap=s,h},Xr.deflateInfo="pako deflate (from Nodeca project)",Xr}var on,sn,hn,ln,un={};function cn(){if(on)return un;on=1;var t=Gr(),e=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(t){e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){i=!1}for(var r=new t.Buf8(256),n=0;n<256;n++)r[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;function a(r,n){if(n<65534&&(r.subarray&&i||!r.subarray&&e))return String.fromCharCode.apply(null,t.shrinkBuf(r,n));for(var a="",o=0;o<n;o++)a+=String.fromCharCode(r[o]);return a}return r[254]=r[254]=1,un.string2buf=function(e){var i,r,n,a,o,s=e.length,h=0;for(a=0;a<s;a++)55296==(64512&(r=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(r=65536+(r-55296<<10)+(n-56320),a++),h+=r<128?1:r<2048?2:r<65536?3:4;for(i=new t.Buf8(h),o=0,a=0;o<h;a++)55296==(64512&(r=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(r=65536+(r-55296<<10)+(n-56320),a++),r<128?i[o++]=r:r<2048?(i[o++]=192|r>>>6,i[o++]=128|63&r):r<65536?(i[o++]=224|r>>>12,i[o++]=128|r>>>6&63,i[o++]=128|63&r):(i[o++]=240|r>>>18,i[o++]=128|r>>>12&63,i[o++]=128|r>>>6&63,i[o++]=128|63&r);return i},un.buf2binstring=function(t){return a(t,t.length)},un.binstring2buf=function(e){for(var i=new t.Buf8(e.length),r=0,n=i.length;r<n;r++)i[r]=e.charCodeAt(r);return i},un.buf2string=function(t,e){var i,n,o,s,h=e||t.length,l=new Array(2*h);for(n=0,i=0;i<h;)if((o=t[i++])<128)l[n++]=o;else if((s=r[o])>4)l[n++]=65533,i+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&i<h;)o=o<<6|63&t[i++],s--;s>1?l[n++]=65533:o<65536?l[n++]=o:(o-=65536,l[n++]=55296|o>>10&1023,l[n++]=56320|1023&o)}return a(l,n)},un.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+r[t[i]]>e?i:e},un}function fn(){if(hn)return sn;return hn=1,sn=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}var dn,pn,mn,gn,_n,bn,yn,wn,vn,xn,kn,En,Sn={},Mn={};function An(){if(_n)return Mn;_n=1;var t=Gr(),e=en(),i=rn(),r=(pn||(pn=1,dn=function(t,e){var i,r,n,a,o,s,h,l,u,c,f,d,p,m,g,_,b,y,w,v,x,k,E,S,M;i=t.state,r=t.next_in,S=t.input,n=r+(t.avail_in-5),a=t.next_out,M=t.output,o=a-(e-t.avail_out),s=a+(t.avail_out-257),h=i.dmax,l=i.wsize,u=i.whave,c=i.wnext,f=i.window,d=i.hold,p=i.bits,m=i.lencode,g=i.distcode,_=(1<<i.lenbits)-1,b=(1<<i.distbits)-1;t:do{p<15&&(d+=S[r++]<<p,p+=8,d+=S[r++]<<p,p+=8),y=m[d&_];e:for(;;){if(d>>>=w=y>>>24,p-=w,0==(w=y>>>16&255))M[a++]=65535&y;else{if(!(16&w)){if(64&w){if(32&w){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}y=m[(65535&y)+(d&(1<<w)-1)];continue e}for(v=65535&y,(w&=15)&&(p<w&&(d+=S[r++]<<p,p+=8),v+=d&(1<<w)-1,d>>>=w,p-=w),p<15&&(d+=S[r++]<<p,p+=8,d+=S[r++]<<p,p+=8),y=g[d&b];;){if(d>>>=w=y>>>24,p-=w,16&(w=y>>>16&255)){if(x=65535&y,p<(w&=15)&&(d+=S[r++]<<p,(p+=8)<w&&(d+=S[r++]<<p,p+=8)),(x+=d&(1<<w)-1)>h){t.msg="invalid distance too far back",i.mode=30;break t}if(d>>>=w,p-=w,x>(w=a-o)){if((w=x-w)>u&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(k=0,E=f,0===c){if(k+=l-w,w<v){v-=w;do{M[a++]=f[k++]}while(--w);k=a-x,E=M}}else if(c<w){if(k+=l+c-w,(w-=c)<v){v-=w;do{M[a++]=f[k++]}while(--w);if(k=0,c<v){v-=w=c;do{M[a++]=f[k++]}while(--w);k=a-x,E=M}}}else if(k+=c-w,w<v){v-=w;do{M[a++]=f[k++]}while(--w);k=a-x,E=M}for(;v>2;)M[a++]=E[k++],M[a++]=E[k++],M[a++]=E[k++],v-=3;v&&(M[a++]=E[k++],v>1&&(M[a++]=E[k++]))}else{k=a-x;do{M[a++]=M[k++],M[a++]=M[k++],M[a++]=M[k++],v-=3}while(v>2);v&&(M[a++]=M[k++],v>1&&(M[a++]=M[k++]))}break}if(64&w){t.msg="invalid distance code",i.mode=30;break t}y=g[(65535&y)+(d&(1<<w)-1)]}}break}}while(r<n&&a<s);r-=v=p>>3,d&=(1<<(p-=v<<3))-1,t.next_in=r,t.next_out=a,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=a<s?s-a+257:257-(a-s),i.hold=d,i.bits=p}),dn),n=function(){if(gn)return mn;gn=1;var t=Gr(),e=15,i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],r=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],n=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];return mn=function(o,s,h,l,u,c,f,d){var p,m,g,_,b,y,w,v,x,k=d.bits,E=0,S=0,M=0,A=0,I=0,z=0,P=0,T=0,R=0,O=0,B=null,C=0,L=new t.Buf16(16),D=new t.Buf16(16),U=null,F=0;for(E=0;E<=e;E++)L[E]=0;for(S=0;S<l;S++)L[s[h+S]]++;for(I=k,A=e;A>=1&&0===L[A];A--);if(I>A&&(I=A),0===A)return u[c++]=20971520,u[c++]=20971520,d.bits=1,0;for(M=1;M<A&&0===L[M];M++);for(I<M&&(I=M),T=1,E=1;E<=e;E++)if(T<<=1,(T-=L[E])<0)return-1;if(T>0&&(0===o||1!==A))return-1;for(D[1]=0,E=1;E<e;E++)D[E+1]=D[E]+L[E];for(S=0;S<l;S++)0!==s[h+S]&&(f[D[s[h+S]]++]=S);if(0===o?(B=U=f,y=19):1===o?(B=i,C-=257,U=r,F-=257,y=256):(B=n,U=a,y=-1),O=0,S=0,E=M,b=c,z=I,P=0,g=-1,_=(R=1<<I)-1,1===o&&R>852||2===o&&R>592)return 1;for(;;){w=E-P,f[S]<y?(v=0,x=f[S]):f[S]>y?(v=U[F+f[S]],x=B[C+f[S]]):(v=96,x=0),p=1<<E-P,M=m=1<<z;do{u[b+(O>>P)+(m-=p)]=w<<24|v<<16|x}while(0!==m);for(p=1<<E-1;O&p;)p>>=1;if(0!==p?(O&=p-1,O+=p):O=0,S++,0==--L[E]){if(E===A)break;E=s[h+f[S]]}if(E>I&&(O&_)!==g){for(0===P&&(P=I),b+=M,T=1<<(z=E-P);z+P<A&&!((T-=L[z+P])<=0);)z++,T<<=1;if(R+=1<<z,1===o&&R>852||2===o&&R>592)return 1;u[g=O&_]=I<<24|z<<16|b-c}}return 0!==O&&(u[b+O]=E-P<<24|64<<16),d.bits=I,0}}(),a=1,o=2,s=0,h=-2,l=1,u=12,c=30,f=852,d=592;function p(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(e){var i;return e&&e.state?(i=e.state,e.total_in=e.total_out=i.total=0,e.msg="",i.wrap&&(e.adler=1&i.wrap),i.mode=l,i.last=0,i.havedict=0,i.dmax=32768,i.head=null,i.hold=0,i.bits=0,i.lencode=i.lendyn=new t.Buf32(f),i.distcode=i.distdyn=new t.Buf32(d),i.sane=1,i.back=-1,s):h}function _(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,g(t)):h}function b(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?h:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,_(t))):h}function y(t,e){var i,r;return t?(r=new m,t.state=r,r.window=null,(i=b(t,e))!==s&&(t.state=null),i):h}var w,v,x=!0;function k(e){if(x){var i;for(w=new t.Buf32(512),v=new t.Buf32(32),i=0;i<144;)e.lens[i++]=8;for(;i<256;)e.lens[i++]=9;for(;i<280;)e.lens[i++]=7;for(;i<288;)e.lens[i++]=8;for(n(a,e.lens,0,288,w,0,e.work,{bits:9}),i=0;i<32;)e.lens[i++]=5;n(o,e.lens,0,32,v,0,e.work,{bits:5}),x=!1}e.lencode=w,e.lenbits=9,e.distcode=v,e.distbits=5}function E(e,i,r,n){var a,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new t.Buf8(o.wsize)),n>=o.wsize?(t.arraySet(o.window,i,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),t.arraySet(o.window,i,r-n,a,o.wnext),(n-=a)?(t.arraySet(o.window,i,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}return Mn.inflateReset=_,Mn.inflateReset2=b,Mn.inflateResetKeep=g,Mn.inflateInit=function(t){return y(t,15)},Mn.inflateInit2=y,Mn.inflate=function(f,d){var m,g,_,b,y,w,v,x,S,M,A,I,z,P,T,R,O,B,C,L,D,U,F,N,j=0,G=new t.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!f||!f.state||!f.output||!f.input&&0!==f.avail_in)return h;(m=f.state).mode===u&&(m.mode=13),y=f.next_out,_=f.output,v=f.avail_out,b=f.next_in,g=f.input,w=f.avail_in,x=m.hold,S=m.bits,M=w,A=v,U=s;t:for(;;)switch(m.mode){case l:if(0===m.wrap){m.mode=13;break}for(;S<16;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(2&m.wrap&&35615===x){m.check=0,G[0]=255&x,G[1]=x>>>8&255,m.check=i(m.check,G,2,0),x=0,S=0,m.mode=2;break}if(m.flags=0,m.head&&(m.head.done=!1),!(1&m.wrap)||(((255&x)<<8)+(x>>8))%31){f.msg="incorrect header check",m.mode=c;break}if(8!=(15&x)){f.msg="unknown compression method",m.mode=c;break}if(S-=4,D=8+(15&(x>>>=4)),0===m.wbits)m.wbits=D;else if(D>m.wbits){f.msg="invalid window size",m.mode=c;break}m.dmax=1<<D,f.adler=m.check=1,m.mode=512&x?10:u,x=0,S=0;break;case 2:for(;S<16;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(m.flags=x,8!=(255&m.flags)){f.msg="unknown compression method",m.mode=c;break}if(57344&m.flags){f.msg="unknown header flags set",m.mode=c;break}m.head&&(m.head.text=x>>8&1),512&m.flags&&(G[0]=255&x,G[1]=x>>>8&255,m.check=i(m.check,G,2,0)),x=0,S=0,m.mode=3;case 3:for(;S<32;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}m.head&&(m.head.time=x),512&m.flags&&(G[0]=255&x,G[1]=x>>>8&255,G[2]=x>>>16&255,G[3]=x>>>24&255,m.check=i(m.check,G,4,0)),x=0,S=0,m.mode=4;case 4:for(;S<16;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}m.head&&(m.head.xflags=255&x,m.head.os=x>>8),512&m.flags&&(G[0]=255&x,G[1]=x>>>8&255,m.check=i(m.check,G,2,0)),x=0,S=0,m.mode=5;case 5:if(1024&m.flags){for(;S<16;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}m.length=x,m.head&&(m.head.extra_len=x),512&m.flags&&(G[0]=255&x,G[1]=x>>>8&255,m.check=i(m.check,G,2,0)),x=0,S=0}else m.head&&(m.head.extra=null);m.mode=6;case 6:if(1024&m.flags&&((I=m.length)>w&&(I=w),I&&(m.head&&(D=m.head.extra_len-m.length,m.head.extra||(m.head.extra=new Array(m.head.extra_len)),t.arraySet(m.head.extra,g,b,I,D)),512&m.flags&&(m.check=i(m.check,g,I,b)),w-=I,b+=I,m.length-=I),m.length))break t;m.length=0,m.mode=7;case 7:if(2048&m.flags){if(0===w)break t;I=0;do{D=g[b+I++],m.head&&D&&m.length<65536&&(m.head.name+=String.fromCharCode(D))}while(D&&I<w);if(512&m.flags&&(m.check=i(m.check,g,I,b)),w-=I,b+=I,D)break t}else m.head&&(m.head.name=null);m.length=0,m.mode=8;case 8:if(4096&m.flags){if(0===w)break t;I=0;do{D=g[b+I++],m.head&&D&&m.length<65536&&(m.head.comment+=String.fromCharCode(D))}while(D&&I<w);if(512&m.flags&&(m.check=i(m.check,g,I,b)),w-=I,b+=I,D)break t}else m.head&&(m.head.comment=null);m.mode=9;case 9:if(512&m.flags){for(;S<16;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(x!==(65535&m.check)){f.msg="header crc mismatch",m.mode=c;break}x=0,S=0}m.head&&(m.head.hcrc=m.flags>>9&1,m.head.done=!0),f.adler=m.check=0,m.mode=u;break;case 10:for(;S<32;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}f.adler=m.check=p(x),x=0,S=0,m.mode=11;case 11:if(0===m.havedict)return f.next_out=y,f.avail_out=v,f.next_in=b,f.avail_in=w,m.hold=x,m.bits=S,2;f.adler=m.check=1,m.mode=u;case u:if(5===d||6===d)break t;case 13:if(m.last){x>>>=7&S,S-=7&S,m.mode=27;break}for(;S<3;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}switch(m.last=1&x,S-=1,3&(x>>>=1)){case 0:m.mode=14;break;case 1:if(k(m),m.mode=20,6===d){x>>>=2,S-=2;break t}break;case 2:m.mode=17;break;case 3:f.msg="invalid block type",m.mode=c}x>>>=2,S-=2;break;case 14:for(x>>>=7&S,S-=7&S;S<32;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if((65535&x)!=(x>>>16^65535)){f.msg="invalid stored block lengths",m.mode=c;break}if(m.length=65535&x,x=0,S=0,m.mode=15,6===d)break t;case 15:m.mode=16;case 16:if(I=m.length){if(I>w&&(I=w),I>v&&(I=v),0===I)break t;t.arraySet(_,g,b,I,y),w-=I,b+=I,v-=I,y+=I,m.length-=I;break}m.mode=u;break;case 17:for(;S<14;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(m.nlen=257+(31&x),x>>>=5,S-=5,m.ndist=1+(31&x),x>>>=5,S-=5,m.ncode=4+(15&x),x>>>=4,S-=4,m.nlen>286||m.ndist>30){f.msg="too many length or distance symbols",m.mode=c;break}m.have=0,m.mode=18;case 18:for(;m.have<m.ncode;){for(;S<3;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}m.lens[Z[m.have++]]=7&x,x>>>=3,S-=3}for(;m.have<19;)m.lens[Z[m.have++]]=0;if(m.lencode=m.lendyn,m.lenbits=7,F={bits:m.lenbits},U=n(0,m.lens,0,19,m.lencode,0,m.work,F),m.lenbits=F.bits,U){f.msg="invalid code lengths set",m.mode=c;break}m.have=0,m.mode=19;case 19:for(;m.have<m.nlen+m.ndist;){for(;R=(j=m.lencode[x&(1<<m.lenbits)-1])>>>16&255,O=65535&j,!((T=j>>>24)<=S);){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(O<16)x>>>=T,S-=T,m.lens[m.have++]=O;else{if(16===O){for(N=T+2;S<N;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(x>>>=T,S-=T,0===m.have){f.msg="invalid bit length repeat",m.mode=c;break}D=m.lens[m.have-1],I=3+(3&x),x>>>=2,S-=2}else if(17===O){for(N=T+3;S<N;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}S-=T,D=0,I=3+(7&(x>>>=T)),x>>>=3,S-=3}else{for(N=T+7;S<N;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}S-=T,D=0,I=11+(127&(x>>>=T)),x>>>=7,S-=7}if(m.have+I>m.nlen+m.ndist){f.msg="invalid bit length repeat",m.mode=c;break}for(;I--;)m.lens[m.have++]=D}}if(m.mode===c)break;if(0===m.lens[256]){f.msg="invalid code -- missing end-of-block",m.mode=c;break}if(m.lenbits=9,F={bits:m.lenbits},U=n(a,m.lens,0,m.nlen,m.lencode,0,m.work,F),m.lenbits=F.bits,U){f.msg="invalid literal/lengths set",m.mode=c;break}if(m.distbits=6,m.distcode=m.distdyn,F={bits:m.distbits},U=n(o,m.lens,m.nlen,m.ndist,m.distcode,0,m.work,F),m.distbits=F.bits,U){f.msg="invalid distances set",m.mode=c;break}if(m.mode=20,6===d)break t;case 20:m.mode=21;case 21:if(w>=6&&v>=258){f.next_out=y,f.avail_out=v,f.next_in=b,f.avail_in=w,m.hold=x,m.bits=S,r(f,A),y=f.next_out,_=f.output,v=f.avail_out,b=f.next_in,g=f.input,w=f.avail_in,x=m.hold,S=m.bits,m.mode===u&&(m.back=-1);break}for(m.back=0;R=(j=m.lencode[x&(1<<m.lenbits)-1])>>>16&255,O=65535&j,!((T=j>>>24)<=S);){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(R&&!(240&R)){for(B=T,C=R,L=O;R=(j=m.lencode[L+((x&(1<<B+C)-1)>>B)])>>>16&255,O=65535&j,!(B+(T=j>>>24)<=S);){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}x>>>=B,S-=B,m.back+=B}if(x>>>=T,S-=T,m.back+=T,m.length=O,0===R){m.mode=26;break}if(32&R){m.back=-1,m.mode=u;break}if(64&R){f.msg="invalid literal/length code",m.mode=c;break}m.extra=15&R,m.mode=22;case 22:if(m.extra){for(N=m.extra;S<N;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}m.length+=x&(1<<m.extra)-1,x>>>=m.extra,S-=m.extra,m.back+=m.extra}m.was=m.length,m.mode=23;case 23:for(;R=(j=m.distcode[x&(1<<m.distbits)-1])>>>16&255,O=65535&j,!((T=j>>>24)<=S);){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(!(240&R)){for(B=T,C=R,L=O;R=(j=m.distcode[L+((x&(1<<B+C)-1)>>B)])>>>16&255,O=65535&j,!(B+(T=j>>>24)<=S);){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}x>>>=B,S-=B,m.back+=B}if(x>>>=T,S-=T,m.back+=T,64&R){f.msg="invalid distance code",m.mode=c;break}m.offset=O,m.extra=15&R,m.mode=24;case 24:if(m.extra){for(N=m.extra;S<N;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}m.offset+=x&(1<<m.extra)-1,x>>>=m.extra,S-=m.extra,m.back+=m.extra}if(m.offset>m.dmax){f.msg="invalid distance too far back",m.mode=c;break}m.mode=25;case 25:if(0===v)break t;if(I=A-v,m.offset>I){if((I=m.offset-I)>m.whave&&m.sane){f.msg="invalid distance too far back",m.mode=c;break}I>m.wnext?(I-=m.wnext,z=m.wsize-I):z=m.wnext-I,I>m.length&&(I=m.length),P=m.window}else P=_,z=y-m.offset,I=m.length;I>v&&(I=v),v-=I,m.length-=I;do{_[y++]=P[z++]}while(--I);0===m.length&&(m.mode=21);break;case 26:if(0===v)break t;_[y++]=m.length,v--,m.mode=21;break;case 27:if(m.wrap){for(;S<32;){if(0===w)break t;w--,x|=g[b++]<<S,S+=8}if(A-=v,f.total_out+=A,m.total+=A,A&&(f.adler=m.check=m.flags?i(m.check,_,A,y-A):e(m.check,_,A,y-A)),A=v,(m.flags?x:p(x))!==m.check){f.msg="incorrect data check",m.mode=c;break}x=0,S=0}m.mode=28;case 28:if(m.wrap&&m.flags){for(;S<32;){if(0===w)break t;w--,x+=g[b++]<<S,S+=8}if(x!==(4294967295&m.total)){f.msg="incorrect length check",m.mode=c;break}x=0,S=0}m.mode=29;case 29:U=1;break t;case c:U=-3;break t;case 31:return-4;default:return h}return f.next_out=y,f.avail_out=v,f.next_in=b,f.avail_in=w,m.hold=x,m.bits=S,(m.wsize||A!==f.avail_out&&m.mode<c&&(m.mode<27||4!==d))&&E(f,f.output,f.next_out,A-f.avail_out),M-=f.avail_in,A-=f.avail_out,f.total_in+=M,f.total_out+=A,m.total+=A,m.wrap&&A&&(f.adler=m.check=m.flags?i(m.check,_,A,f.next_out-A):e(m.check,_,A,f.next_out-A)),f.data_type=m.bits+(m.last?64:0)+(m.mode===u?128:0)+(20===m.mode||15===m.mode?256:0),(0===M&&0===A||4===d)&&U===s&&(U=-5),U},Mn.inflateEnd=function(t){if(!t||!t.state)return h;var e=t.state;return e.window&&(e.window=null),t.state=null,s},Mn.inflateGetHeader=function(t,e){var i;return t&&t.state&&2&(i=t.state).wrap?(i.head=e,e.done=!1,s):h},Mn.inflateSetDictionary=function(t,i){var r,n=i.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?h:11===r.mode&&e(1,i,n,0)!==r.check?-3:E(t,i,n,n)?(r.mode=31,-4):(r.havedict=1,s):h},Mn.inflateInfo="pako inflate (from Nodeca project)",Mn}function In(){return yn?bn:(yn=1,bn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8})}function zn(){if(xn)return Sn;xn=1;var t=An(),e=Gr(),i=cn(),r=In(),n=nn(),a=fn(),o=vn?wn:(vn=1,wn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}),s=Object.prototype.toString;function h(l){if(!(this instanceof h))return new h(l);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},l||{});var u=this.options;u.raw&&u.windowBits>=0&&u.windowBits<16&&(u.windowBits=-u.windowBits,0===u.windowBits&&(u.windowBits=-15)),!(u.windowBits>=0&&u.windowBits<16)||l&&l.windowBits||(u.windowBits+=32),u.windowBits>15&&u.windowBits<48&&(15&u.windowBits||(u.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var c=t.inflateInit2(this.strm,u.windowBits);if(c!==r.Z_OK)throw new Error(n[c]);if(this.header=new o,t.inflateGetHeader(this.strm,this.header),u.dictionary&&("string"==typeof u.dictionary?u.dictionary=i.string2buf(u.dictionary):"[object ArrayBuffer]"===s.call(u.dictionary)&&(u.dictionary=new Uint8Array(u.dictionary)),u.raw&&(c=t.inflateSetDictionary(this.strm,u.dictionary))!==r.Z_OK))throw new Error(n[c])}function l(t,e){var i=new h(e);if(i.push(t,!0),i.err)throw i.msg||n[i.err];return i.result}return h.prototype.push=function(n,a){var o,h,l,u,c,f=this.strm,d=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;h=a===~~a?a:!0===a?r.Z_FINISH:r.Z_NO_FLUSH,"string"==typeof n?f.input=i.binstring2buf(n):"[object ArrayBuffer]"===s.call(n)?f.input=new Uint8Array(n):f.input=n,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new e.Buf8(d),f.next_out=0,f.avail_out=d),(o=t.inflate(f,r.Z_NO_FLUSH))===r.Z_NEED_DICT&&p&&(o=t.inflateSetDictionary(this.strm,p)),o===r.Z_BUF_ERROR&&!0===m&&(o=r.Z_OK,m=!1),o!==r.Z_STREAM_END&&o!==r.Z_OK)return this.onEnd(o),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&o!==r.Z_STREAM_END&&(0!==f.avail_in||h!==r.Z_FINISH&&h!==r.Z_SYNC_FLUSH)||("string"===this.options.to?(l=i.utf8border(f.output,f.next_out),u=f.next_out-l,c=i.buf2string(f.output,l),f.next_out=u,f.avail_out=d-u,u&&e.arraySet(f.output,f.output,l,u,0),this.onData(c)):this.onData(e.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(m=!0)}while((f.avail_in>0||0===f.avail_out)&&o!==r.Z_STREAM_END);return o===r.Z_STREAM_END&&(h=r.Z_FINISH),h===r.Z_FINISH?(o=t.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===r.Z_OK):h!==r.Z_SYNC_FLUSH||(this.onEnd(r.Z_OK),f.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===r.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Sn.Inflate=h,Sn.inflate=l,Sn.inflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},Sn.ungzip=l,Sn}function Pn(){if(En)return kn;En=1;var t=Gr().assign,e=function(){if(ln)return Kr;ln=1;var t=an(),e=Gr(),i=cn(),r=nn(),n=fn(),a=Object.prototype.toString,o=0,s=-1,h=0,l=8;function u(c){if(!(this instanceof u))return new u(c);this.options=e.assign({level:s,method:l,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},c||{});var f=this.options;f.raw&&f.windowBits>0?f.windowBits=-f.windowBits:f.gzip&&f.windowBits>0&&f.windowBits<16&&(f.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var d=t.deflateInit2(this.strm,f.level,f.method,f.windowBits,f.memLevel,f.strategy);if(d!==o)throw new Error(r[d]);if(f.header&&t.deflateSetHeader(this.strm,f.header),f.dictionary){var p;if(p="string"==typeof f.dictionary?i.string2buf(f.dictionary):"[object ArrayBuffer]"===a.call(f.dictionary)?new Uint8Array(f.dictionary):f.dictionary,(d=t.deflateSetDictionary(this.strm,p))!==o)throw new Error(r[d]);this._dict_set=!0}}function c(t,e){var i=new u(e);if(i.push(t,!0),i.err)throw i.msg||r[i.err];return i.result}return u.prototype.push=function(r,n){var s,h,l=this.strm,u=this.options.chunkSize;if(this.ended)return!1;h=n===~~n?n:!0===n?4:0,"string"==typeof r?l.input=i.string2buf(r):"[object ArrayBuffer]"===a.call(r)?l.input=new Uint8Array(r):l.input=r,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new e.Buf8(u),l.next_out=0,l.avail_out=u),1!==(s=t.deflate(l,h))&&s!==o)return this.onEnd(s),this.ended=!0,!1;0!==l.avail_out&&(0!==l.avail_in||4!==h&&2!==h)||("string"===this.options.to?this.onData(i.buf2binstring(e.shrinkBuf(l.output,l.next_out))):this.onData(e.shrinkBuf(l.output,l.next_out)))}while((l.avail_in>0||0===l.avail_out)&&1!==s);return 4===h?(s=t.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===o):2!==h||(this.onEnd(o),l.avail_out=0,!0)},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===o&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Kr.Deflate=u,Kr.deflate=c,Kr.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},Kr.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)},Kr}(),i={};return t(i,e,zn(),In()),kn=i}!function(t){!function(){var e={};function i(){"undefined"!=typeof process&&"development"!=process.env.NODE_ENV||console.log.apply(console,arguments)}t.exports=e,function(t,e){!function(){var e=function(){function t(t){this.message="JPEG error: "+t}return t.prototype=new Error,t.prototype.name="JpegError",t.constructor=t,t}(),i=function(){var t=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),i=4017,n=799,a=3406,o=2276,s=1567,h=3784,l=5793,u=2896;function c(t){null==t&&(t={}),null==t.w&&(t.w=-1),this.V=t.n,this.N=t.w}function f(t,e){for(var i,r,n,a=0,o=[],s=16;s>0&&!t[s-1];)s--;o.push({children:[],index:0});var h=o[0];for(i=0;i<s;i++){for(r=0;r<t[i];r++){for((h=o.pop()).children[h.index]=e[a];h.index>0;)h=o.pop();for(h.index++,o.push(h);o.length<=i;)o.push(n={children:[],index:0}),h.children[h.index]=n.children,h=n;a++}i+1<s&&(o.push(n={children:[],index:0}),h.children[h.index]=n.children,h=n)}return o[0].children}function d(t,e,i){return 64*((t.P+1)*e+i)}function p(i,n,a,o,s,h,l,u,c,f){null==f&&(f=!1);var p,m,g,b,y,w,v,x,k,E,S,M=a.m,A=a.Z,I=n,z=0,P=0,T=0,R=0,O=0,B=0;function C(){if(P>0)return P--,z>>P&1;if(255===(z=i[n++])){var t=i[n++];if(t){if(220===t&&f){var o=r(i,n+=2);if(n+=2,o>0&&o!==a.s)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",o)}else if(217===t){if(f){var s=8*O;if(s>0&&s<a.s/10)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",s)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new e("unexpected marker")}}return P=7,z>>>7}function L(t){for(var i=t;;){switch(typeof(i=i[C()])){case"number":return i;case"object":continue}throw new e("invalid huffman sequence")}}function D(t){for(var e=0;t>0;)e=e<<1|C(),t--;return e}function U(t){if(1===t)return 1===C()?1:-1;var e=D(t);return e>=1<<t-1?e:e+(-1<<t)+1}function F(t,e,i,r,n){var a=i%M;O=(i/M|0)*t.A+r;var o=a*t.h+n;e(t,d(t,O,o))}function N(t,e,i){O=i/t.P|0;var r=i%t.P;e(t,d(t,O,r))}var j=o.length;for(v=A?0===h?0===u?function(t,e){var i=L(t.J),r=0===i?0:U(i)<<c;t.D[e]=t.Q+=r}:function(t,e){t.D[e]|=C()<<c}:0===u?function(e,i){if(T>0)T--;else for(var r=h,n=l;r<=n;){var a=L(e.i),o=15&a,s=a>>4;if(0!==o){var u=t[r+=s];e.D[i+u]=U(o)*(1<<c),r++}else{if(s<15){T=D(s)+(1<<s)-1;break}r+=16}}}:function(i,r){for(var n,a,o=h,s=l,u=0;o<=s;){var f=r+t[o],d=i.D[f]<0?-1:1;switch(R){case 0:if(u=(a=L(i.i))>>4,0==(n=15&a))u<15?(T=D(u)+(1<<u),R=4):(u=16,R=1);else{if(1!==n)throw new e("invalid ACn encoding");p=U(n),R=u?2:3}continue;case 1:case 2:i.D[f]?i.D[f]+=d*(C()<<c):0==--u&&(R=2===R?3:0);break;case 3:i.D[f]?i.D[f]+=d*(C()<<c):(i.D[f]=p<<c,R=0);break;case 4:i.D[f]&&(i.D[f]+=d*(C()<<c))}o++}4===R&&0==--T&&(R=0)}:function(e,i){var r=L(e.J),n=0===r?0:U(r),a=1;for(e.D[i]=e.Q+=n;a<64;){var o=L(e.i),s=15&o,h=o>>4;if(0!==s){var l=t[a+=h];e.D[i+l]=U(s),a++}else{if(h<15)break;a+=16}}},k=1===j?o[0].P*o[0].c:M*a.R;B<=k;){var G=s?Math.min(k-B,s):k;if(G>0){for(g=0;g<j;g++)o[g].Q=0;if(T=0,1===j)for(m=o[0],w=0;w<G;w++)N(m,v,B),B++;else for(w=0;w<G;w++){for(g=0;g<j;g++)for(E=(m=o[g]).h,S=m.A,b=0;b<S;b++)for(y=0;y<E;y++)F(m,v,B,b,y);B++}}if(P=0,!(x=_(i,n)))break;if(x.u&&(n=x.offset),!(x.M>=65488&&x.M<=65495))break;n+=2}return n-I}function m(t,r,c){var f,d,p,m,g,_,b,y,w,v,x,k,E,S,M,A,I,z=t.$,P=t.D;if(!z)throw new e("missing required Quantization Table.");for(var T=0;T<64;T+=8)w=P[r+T],v=P[r+T+1],x=P[r+T+2],k=P[r+T+3],E=P[r+T+4],S=P[r+T+5],M=P[r+T+6],A=P[r+T+7],w*=z[T],v|x|k|E|S|M|A?(v*=z[T+1],x*=z[T+2],k*=z[T+3],E*=z[T+4],S*=z[T+5],M*=z[T+6],A*=z[T+7],d=(f=(f=l*w+128>>8)+(d=l*E+128>>8)+1>>1)-d,I=(p=x)*h+(m=M)*s+128>>8,p=p*s-m*h+128>>8,b=(g=(g=u*(v-A)+128>>8)+(b=S<<4)+1>>1)-b,_=(y=(y=u*(v+A)+128>>8)+(_=k<<4)+1>>1)-_,m=(f=f+(m=I)+1>>1)-m,p=(d=d+p+1>>1)-p,I=g*o+y*a+2048>>12,g=g*a-y*o+2048>>12,y=I,I=_*n+b*i+2048>>12,_=_*i-b*n+2048>>12,b=I,c[T]=f+y,c[T+7]=f-y,c[T+1]=d+b,c[T+6]=d-b,c[T+2]=p+_,c[T+5]=p-_,c[T+3]=m+g,c[T+4]=m-g):(I=l*w+512>>10,c[T]=I,c[T+1]=I,c[T+2]=I,c[T+3]=I,c[T+4]=I,c[T+5]=I,c[T+6]=I,c[T+7]=I);for(var R=0;R<8;++R)w=c[R],(v=c[R+8])|(x=c[R+16])|(k=c[R+24])|(E=c[R+32])|(S=c[R+40])|(M=c[R+48])|(A=c[R+56])?(d=(f=4112+((f=l*w+2048>>12)+(d=l*E+2048>>12)+1>>1))-d,I=(p=x)*h+(m=M)*s+2048>>12,p=p*s-m*h+2048>>12,m=I,b=(g=(g=u*(v-A)+2048>>12)+(b=S)+1>>1)-b,_=(y=(y=u*(v+A)+2048>>12)+(_=k)+1>>1)-_,I=g*o+y*a+2048>>12,g=g*a-y*o+2048>>12,y=I,I=_*n+b*i+2048>>12,_=_*i-b*n+2048>>12,(w=(f=f+m+1>>1)+y)<16?w=0:w>=4080?w=255:w>>=4,(v=(d=d+p+1>>1)+(b=I))<16?v=0:v>=4080?v=255:v>>=4,(x=(p=d-p)+_)<16?x=0:x>=4080?x=255:x>>=4,(k=(m=f-m)+g)<16?k=0:k>=4080?k=255:k>>=4,(E=m-g)<16?E=0:E>=4080?E=255:E>>=4,(S=p-_)<16?S=0:S>=4080?S=255:S>>=4,(M=d-b)<16?M=0:M>=4080?M=255:M>>=4,(A=f-y)<16?A=0:A>=4080?A=255:A>>=4,P[r+R]=w,P[r+R+8]=v,P[r+R+16]=x,P[r+R+24]=k,P[r+R+32]=E,P[r+R+40]=S,P[r+R+48]=M,P[r+R+56]=A):(I=(I=l*w+8192>>14)<-2040?0:I>=2024?255:I+2056>>4,P[r+R]=I,P[r+R+8]=I,P[r+R+16]=I,P[r+R+24]=I,P[r+R+32]=I,P[r+R+40]=I,P[r+R+48]=I,P[r+R+56]=I)}function g(t,e){for(var i=e.P,r=e.c,n=new Int16Array(64),a=0;a<r;a++)for(var o=0;o<i;o++){m(e,d(e,a,o),n)}return e.D}function _(t,e,i){null==i&&(i=e);var n=t.length-1,a=i<e?i:e;if(e>=n)return null;var o=r(t,e);if(o>=65472&&o<=65534)return{u:null,M:o,offset:e};for(var s=r(t,a);!(s>=65472&&s<=65534);){if(++a>=n)return null;s=r(t,a)}return{u:o.toString(16),M:s,offset:a}}return c.prototype={parse(i,n){null==n&&(n={});var a,o,s=n.F,h=0,l=null,u=null,c=0;function d(){var t=r(i,h),e=(h+=2)+t-2,n=_(i,e,h);n&&n.u&&(e=n.offset);var a=i.subarray(h,e);return h+=a.length,a}function m(t){for(var e=Math.ceil(t.o/8/t.X),i=Math.ceil(t.s/8/t.B),r=0;r<t.W.length;r++){G=t.W[r];var n=Math.ceil(Math.ceil(t.o/8)*G.h/t.X),a=Math.ceil(Math.ceil(t.s/8)*G.A/t.B),o=e*G.h,s=64*(i*G.A)*(o+1);G.D=new Int16Array(s),G.P=n,G.c=a}t.m=e,t.R=i}var b=[],y=[],w=[],v=r(i,h);if(h+=2,65496!==v)throw new e("SOI not found");v=r(i,h),h+=2;t:for(;65497!==v;){var x,k,E;switch(v){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var S=d();65504===v&&74===S[0]&&70===S[1]&&73===S[2]&&70===S[3]&&0===S[4]&&(l={version:{d:S[5],T:S[6]},K:S[7],j:S[8]<<8|S[9],H:S[10]<<8|S[11],S:S[12],I:S[13],C:S.subarray(14,14+3*S[12]*S[13])}),65518===v&&65===S[0]&&100===S[1]&&111===S[2]&&98===S[3]&&101===S[4]&&(u={version:S[5]<<8|S[6],k:S[7]<<8|S[8],q:S[9]<<8|S[10],a:S[11]});break;case 65499:for(var M=r(i,h)+(h+=2)-2;h<M;){var A=i[h++],I=new Uint16Array(64);if(A>>4){if(A>>4!=1)throw new e("DQT - invalid table spec");for(k=0;k<64;k++)I[t[k]]=r(i,h),h+=2}else for(k=0;k<64;k++)I[t[k]]=i[h++];b[15&A]=I}break;case 65472:case 65473:case 65474:if(a)throw new e("Only single frame JPEGs supported");h+=2,(a={}).G=65473===v,a.Z=65474===v,a.precision=i[h++];var z,P=r(i,h),T=0,R=0;h+=2,a.s=s||P,a.o=r(i,h),h+=2,a.W=[],a._={};var O=i[h++];for(x=0;x<O;x++){z=i[h];var B=i[h+1]>>4,C=15&i[h+1];T<B&&(T=B),R<C&&(R=C);var L=i[h+2];E=a.W.push({h:B,A:C,L:L,$:null}),a._[z]=E-1,h+=3}a.X=T,a.B=R,m(a);break;case 65476:var D=r(i,h);for(h+=2,x=2;x<D;){var U=i[h++],F=new Uint8Array(16),N=0;for(k=0;k<16;k++,h++)N+=F[k]=i[h];var j=new Uint8Array(N);for(k=0;k<N;k++,h++)j[k]=i[h];x+=17+N,(U>>4?y:w)[15&U]=f(F,j)}break;case 65501:o=r(i,h+=2),h+=2;break;case 65498:var G,Z=1==++c&&!s;h+=2;var H=i[h++],$=[];for(x=0;x<H;x++){var W=i[h++],q=a._[W];(G=a.W[q]).index=W;var Y=i[h++];G.J=w[Y>>4],G.i=y[15&Y],$.push(G)}var V=i[h++],J=i[h++],K=i[h++];try{var X=p(i,h,a,$,o,V,J,K>>4,15&K,Z);h+=X}catch(t){if(t instanceof DNLMarkerError)return this.parse(i,{F:t.s});if(t instanceof EOIMarkerError)break t;throw t}break;case 65500:h+=4;break;case 65535:255!==i[h]&&h--;break;default:var Q=_(i,h-2,h-3);if(Q&&Q.u){h=Q.offset;break}if(h>=i.length-1)break t;throw new e("JpegImage.parse - unknown marker: "+v.toString(16))}v=r(i,h),h+=2}for(this.width=a.o,this.height=a.s,this.g=l,this.b=u,this.W=[],x=0;x<a.W.length;x++){var tt=b[(G=a.W[x]).L];tt&&(G.$=tt),this.W.push({index:G.index,e:g(0,G),l:G.h/a.X,t:G.A/a.B,P:G.P,c:G.c})}this.p=this.W.length},Y(t,e,i){null==i&&(i=!1);var r,n,a,o,s,h,l,u,c,f,d,p,m=this.width/t,g=this.height/e,_=0,b=this.W.length,y=t*e*b,w=new Uint8ClampedArray(y),v=new Uint32Array(t),x=4294967288;for(l=0;l<b;l++){if(n=(r=this.W[l]).l*m,a=r.t*g,_=l,d=r.e,o=r.P+1<<3,n!==p){for(s=0;s<t;s++)u=0|s*n,v[s]=(u&x)<<3|7&u;p=n}for(h=0;h<e;h++)for(f=o*((u=0|h*a)&x)|(7&u)<<3,s=0;s<t;s++)w[_]=d[f+v[s]],_+=b}var k=this.V;if(i||4!==b||k||(k=new Int32Array([-256,255,-256,255,-256,255,-256,255])),k)for(l=0;l<y;)for(u=0,c=0;u<b;u++,l++,c+=2)w[l]=(w[l]*k[c]>>8)+k[c+1];return w},get f(){return this.b?!!this.b.a:3===this.p?0!==this.N&&(82!==this.W[0].index||71!==this.W[1].index||66!==this.W[2].index):1===this.N},z:function(t){for(var e,i,r,n=0,a=t.length;n<a;n+=3)e=t[n],i=t[n+1],r=t[n+2],t[n]=e-179.456+1.402*r,t[n+1]=e+135.459-.344*i-.714*r,t[n+2]=e-226.816+1.772*i;return t},O:function(t){for(var e,i,r,n,a=0,o=0,s=t.length;o<s;o+=4)e=t[o],i=t[o+1],r=t[o+2],n=t[o+3],t[a++]=i*(-660635669420364e-19*i+.000437130475926232*r-54080610064599e-18*e+.00048449797120281*n-.154362151871126)-122.67195406894+r*(-.000957964378445773*r+.000817076911346625*e-.00477271405408747*n+1.53380253221734)+e*(.000961250184130688*e-.00266257332283933*n+.48357088451265)+n*(-.000336197177618394*n+.484791561490776),t[a++]=107.268039397724+i*(219927104525741e-19*i-.000640992018297945*r+.000659397001245577*e+.000426105652938837*n-.176491792462875)+r*(-.000778269941513683*r+.00130872261408275*e+.000770482631801132*n-.151051492775562)+e*(.00126935368114843*e-.00265090189010898*n+.25802910206845)+n*(-.000318913117588328*n-.213742400323665),t[a++]=i*(-.000570115196973677*i-263409051004589e-19*r+.0020741088115012*e-.00288260236853442*n+.814272968359295)-20.810012546947+r*(-153496057440975e-19*r-.000132689043961446*e+.000560833691242812*n-.195152027534049)+e*(.00174418132927582*e-.00255243321439347*n+.116935020465145)+n*(-.000343531996510555*n+.24165260232407);return t.subarray(0,a)},r:function(t){for(var e,i,r,n=0,a=t.length;n<a;n+=4)e=t[n],i=t[n+1],r=t[n+2],t[n]=434.456-e-1.402*r,t[n+1]=119.541-e+.344*i+.714*r,t[n+2]=481.816-e-1.772*i;return t},U:function(t){for(var e,i,r,n,a=0,o=0,s=t.length;o<s;o+=4)e=t[o],i=t[o+1],r=t[o+2],n=t[o+3],t[a++]=255+e*(-6747147073602441e-20*e+.0008379262121013727*i+.0002894718188643294*r+.003264231057537806*n-1.1185611867203937)+i*(26374107616089405e-21*i-8626949158638572e-20*r-.0002748769067499491*n-.02155688794978967)+r*(-3878099212869363e-20*r-.0003267808279485286*n+.0686742238595345)-n*(.0003361971776183937*n+.7430659151342254),t[a++]=255+e*(.00013596372813588848*e+.000924537132573585*i+.00010567359618683593*r+.0004791864687436512*n-.3109689587515875)+i*(-.00023545346108370344*i+.0002702845253534714*r+.0020200308977307156*n-.7488052167015494)+r*(6834815998235662e-20*r+.00015168452363460973*n-.09751927774728933)-n*(.0003189131175883281*n+.7364883807733168),t[a++]=255+e*(13598650411385307e-21*e+.00012423956175490851*i+.0004751985097583589*r-36729317476630422e-22*n-.05562186980264034)+i*(.00016141380598724676*i+.0009692239130725186*r+.0007782692450036253*n-.44015232367526463)+r*(5.068882914068769e-7*r+.0017778369011375071*n-.7591454649749609)-n*(.0003435319965105553*n+.7063770186160144);return t.subarray(0,a)},getData:function(t){var i=t.width,r=t.height,n=t.forceRGB,a=t.isSourcePDF;if(this.p>4)throw new e("Unsupported color mode");var o=this.Y(i,r,a);if(1===this.p&&n){for(var s=o.length,h=new Uint8ClampedArray(3*s),l=0,u=0;u<s;u++){var c=o[u];h[l++]=c,h[l++]=c,h[l++]=c}return h}if(3===this.p&&this.f)return this.z(o);if(4===this.p){if(this.f)return n?this.O(o):this.r(o);if(n)return this.U(o)}return o}},c}();function r(t,e){return t[e]<<8|t[e+1]}t.JpegDecoder=i}(),t.encodeImage=function(e,i,r,n){var a={t256:[i],t257:[r],t258:[8,8,8,8],t259:[1],t262:[2],t273:[1e3],t277:[4],t278:[r],t279:[i*r*4],t282:[[72,1]],t283:[[72,1]],t284:[1],t286:[[0,1]],t287:[[0,1]],t296:[1],t305:["Photopea (UTIF.js)"],t338:[1]};if(n)for(var o in n)a[o]=n[o];var s=new Uint8Array(t.encode([a])),h=new Uint8Array(e),l=new Uint8Array(1e3+i*r*4);for(o=0;o<s.length;o++)l[o]=s[o];for(o=0;o<h.length;o++)l[1e3+o]=h[o];return l.buffer},t.encode=function(e){var i=new Uint8Array(2e4),r=4,n=t._binBE;i[0]=i[1]=77,n.writeUshort(i,2,42);var a=8;n.writeUint(i,r,a),r+=4;for(var o=0;o<e.length;o++){var s=t._writeIFD(n,t._types.basic,i,a,e[o]);a=s[1],o<e.length-1&&(3&a&&(a+=4-(3&a)),n.writeUint(i,s[0],a))}return i.slice(0,a).buffer},t.decode=function(e,r){null==r&&(r={parseMN:!0,debug:!1});var n=new Uint8Array(e),a=0,o=t._binBE.readASCII(n,a,2);a+=2;var s="II"==o?t._binLE:t._binBE;s.readUshort(n,a),a+=2;var h=s.readUint(n,a);a+=4;for(var l=[];;){var u=s.readUshort(n,h),c=s.readUshort(n,h+4);if(0!=u&&(c<1||13<c)){i("error in TIFF");break}if(t._readIFD(s,n,h,l,0,r),0==(h=s.readUint(n,h+2+12*u)))break}return l},t.decodeImage=function(e,r,n){if(!r.data){var a=new Uint8Array(e),o=t._binBE.readASCII(a,0,2);if(null!=r.t256){r.isLE="II"==o,r.width=r.t256[0],r.height=r.t257[0];var s=r.t259?r.t259[0]:1,h=r.t266?r.t266[0]:1;r.t284&&2==r.t284[0]&&i("PlanarConfiguration 2 should not be used!"),7==s&&r.t258&&r.t258.length>3&&(r.t258=r.t258.slice(0,3));var l=r.t277?r.t277[0]:1,u=(r.t258?r.t258[0]:1)*l;1==s&&null!=r.t279&&r.t278&&32803==r.t262[0]&&(u=Math.round(8*r.t279[0]/(r.width*r.t278[0]))),r.t50885&&4==r.t50885[0]&&(u=3*r.t258[0]);var c=8*Math.ceil(r.width*u/8),f=r.t273;(null==f||r.t322)&&(f=r.t324);var d=r.t279;1==s&&1==f.length&&(d=[r.height*(c>>>3)]),(null==d||r.t322)&&(d=r.t325);var p=new Uint8Array(r.height*(c>>>3)),m=0;if(null!=r.t322){var g=r.t322[0],_=r.t323[0],b=Math.floor((r.width+g-1)/g),y=Math.floor((r.height+_-1)/_),w=new Uint8Array(0|Math.ceil(g*_*u/8));console.log("====",b,y);for(var v=0;v<y;v++)for(var x=0;x<b;x++){var k=v*b+x;w.fill(0),t.decode._decompress(r,n,a,f[k],d[k],s,w,0,h,g,_),6==s?p=w:t._copyTile(w,0|Math.ceil(g*u/8),_,p,0|Math.ceil(r.width*u/8),r.height,0|Math.ceil(x*g*u/8),v*_)}m=8*p.length}else{if(null==f)return;var E=r.t278?r.t278[0]:r.height;E=Math.min(E,r.height);for(k=0;k<f.length;k++)t.decode._decompress(r,n,a,f[k],d[k],s,p,0|Math.ceil(m/8),h,r.width,E),m+=c*E;m=Math.min(m,8*p.length)}r.data=new Uint8Array(p.buffer,0,0|Math.ceil(m/8))}}},t.decode._decompress=function(r,n,a,o,s,h,l,u,c,f,d){if(r.t271&&"Panasonic"==r.t271[0]&&r.t45&&6==r.t45[0]&&(h=34316),1==h)for(var p=0;p<s;p++)l[u+p]=a[o+p];else if(2==h)t.decode._decodeG2(a,o,s,l,u,f,c);else if(3==h)t.decode._decodeG3(a,o,s,l,u,f,c,!!r.t292&&!(1&~r.t292[0]));else if(4==h)t.decode._decodeG4(a,o,s,l,u,f,c);else if(5==h)t.decode._decodeLZW(a,o,s,l,u,8);else if(6==h)t.decode._decodeOldJPEG(r,a,o,s,l,u);else if(7==h||34892==h)t.decode._decodeNewJPEG(r,a,o,s,l,u);else if(8==h||32946==h){var m=new Uint8Array(a.buffer,o+2,s-6),g=e.inflateRaw(m);u+g.length<=l.length&&l.set(g,u)}else 9==h?t.decode._decodeVC5(a,o,s,l,u,r.t33422):32767==h?t.decode._decodeARW(r,a,o,s,l,u):32773==h?t.decode._decodePackBits(a,o,s,l,u):32809==h?t.decode._decodeThunder(a,o,s,l,u):34316==h?t.decode._decodePanasonic(r,a,o,s,l,u):34713==h?t.decode._decodeNikon(r,n,a,o,s,l,u):34676==h?t.decode._decodeLogLuv32(r,a,o,s,l,u):i("Unknown compression",h);var _=r.t258?Math.min(32,r.t258[0]):1,b=r.t277?r.t277[0]:1,y=_*b>>>3,w=Math.ceil(_*b*f/8);if(16==_&&!r.isLE&&null==r.t33422)for(var v=0;v<d;v++)for(var x=u+v*w,k=1;k<w;k+=2){var E=l[x+k];l[x+k]=l[x+k-1],l[x+k-1]=E}if(r.t317&&2==r.t317[0])for(v=0;v<d;v++){var S=u+v*w;if(16==_)for(p=y;p<w;p+=2){var M=(l[S+p+1]<<8|l[S+p])+(l[S+p-y+1]<<8|l[S+p-y]);l[S+p]=255&M,l[S+p+1]=M>>>8&255}else if(3==b)for(p=3;p<w;p+=3)l[S+p]=l[S+p]+l[S+p-3]&255,l[S+p+1]=l[S+p+1]+l[S+p-2]&255,l[S+p+2]=l[S+p+2]+l[S+p-1]&255;else for(p=y;p<w;p++)l[S+p]=l[S+p]+l[S+p-y]&255}},t.decode._decodePanasonic=function(t,e,i,r,n,a){var o,s,h,l,u,c,f,d,p=e.buffer,m=t.t2[0],g=t.t3[0],_=t.t10[0],b=t.t45[0],y=0,w=0,v=0,x=0,k=6==b?new Uint32Array(18):new Uint8Array(16),E=[0,0],S=[0,0],M=0,A=new Uint8Array(16384),I=new Uint16Array(n.buffer);function z(t){if(0==v){var e=new Uint8Array(p,i+w+8184,8200),r=new Uint8Array(p,i+w,8184);A.set(e),A.set(r,e.length),w+=16384}if(5!=b)return(A[x=(v=v-t&131071)>>3^16368]|A[x+1]<<8)>>(7&v)&~(-1<<t);for(o=0;o<16;o++)k[o]=A[v++],v&=16383}function P(t){return A[v+15-t]}function T(){E[0]=0,E[1]=0,S[0]=0,S[1]=0}if(7==b)throw b;if(6==b){var R=12==_,O=R?function(){k[0]=P(0)<<4|P(1)>>4,k[1]=4095&((15&P(1))<<8|P(2)),k[2]=P(3)>>6&3,k[3]=(63&P(3))<<2|P(4)>>6,k[4]=(63&P(4))<<2|P(5)>>6,k[5]=(63&P(5))<<2|P(6)>>6,k[6]=P(6)>>4&3,k[7]=(15&P(6))<<4|P(7)>>4,k[8]=(15&P(7))<<4|P(8)>>4,k[9]=(15&P(8))<<4|P(9)>>4,k[10]=P(9)>>2&3,k[11]=(3&P(9))<<6|P(10)>>2,k[12]=(3&P(10))<<6|P(11)>>2,k[13]=(3&P(11))<<6|P(12)>>2,k[14]=3&P(12),k[15]=P(13),k[16]=P(14),k[17]=P(15),v+=16,x=0}:function(){k[0]=P(0)<<6|P(1)>>2,k[1]=16383&((3&P(1))<<12|P(2)<<4|P(3)>>4),k[2]=P(3)>>2&3,k[3]=(3&P(3))<<8|P(4),k[4]=P(5)<<2|P(6)>>6,k[5]=(63&P(6))<<4|P(7)>>4,k[6]=P(7)>>2&3,k[7]=(3&P(7))<<8|P(8),k[8]=P(9)<<2&1020|P(10)>>6,k[9]=1023&(P(10)<<4|P(11)>>4),k[10]=P(11)>>2&3,k[11]=(3&P(11))<<8|P(12),k[12]=1023&(P(13)<<2&1020|P(14)>>6),k[13]=1023&(P(14)<<4|P(15)>>4),v+=16,x=0},B=R?14:11,C=R?128:512,L=R?2048:8192,D=R?16383:65535,U=R?4095:16383,F=m/B,N=16*F,j=R?18:14;for(c=0;c<g-15;c+=16){var G=Math.min(16,g-c),Z=N*G;for(A=new Uint8Array(p,i+y,Z),v=0,y+=Z,d=0,f=0;d<G;d++,f=0){M=(c+d)*m;for(var H=0;H<F;H++)for(O(),T(),h=0,u=0,o=0;o<B;o++){if(l=1&o,o%3==2){var $=x<j?k[x++]:0;3==$&&($=4),u=C<<$,h=1<<$}var W=x<j?k[x++]:0;E[l]?(W*=h,u<L&&S[l]>u&&(W+=S[l]-u),S[l]=W):(E[l]=W,W?S[l]=W:W=S[l]),I[M+f++]=W-15<=D?W-15&D:W+2147483633>>31&U}}}}else if(5==b){var q=12==_?10:9;for(c=0;c<g;c++)for(f=0;f<m;f+=q)z(0),12==_?(I[M++]=((15&k[1])<<8)+k[0],I[M++]=16*k[2]+(k[1]>>4),I[M++]=((15&k[4])<<8)+k[3],I[M++]=16*k[5]+(k[4]>>4),I[M++]=((15&k[7])<<8)+k[6],I[M++]=16*k[8]+(k[7]>>4),I[M++]=((15&k[10])<<8)+k[9],I[M++]=16*k[11]+(k[10]>>4),I[M++]=((15&k[13])<<8)+k[12],I[M++]=16*k[14]+(k[13]>>4)):14==_&&(I[M++]=k[0]+((63&k[1])<<8),I[M++]=(k[1]>>6)+4*k[2]+((15&k[3])<<10),I[M++]=(k[3]>>4)+16*k[4]+((3&k[5])<<12),I[M++]=((252&k[5])>>2)+(k[6]<<6),I[M++]=k[7]+((63&k[8])<<8),I[M++]=(k[8]>>6)+4*k[9]+((15&k[10])<<10),I[M++]=(k[10]>>4)+16*k[11]+((3&k[12])<<12),I[M++]=((252&k[12])>>2)+(k[13]<<6),I[M++]=k[14]+((63&k[15])<<8))}else{if(4!=b)throw b;for(c=0;c<g;c++)for(f=0;f<m;f++)l=1&(o=f%14),0==o&&T(),o%3==2&&(h=4>>3-z(2)),S[l]?0!=(s=z(8))&&(E[l]-=128<<h,(E[l]<0||4==h)&&(E[l]&=~(-1<<h)),E[l]+=s<<h):(S[l]=z(8),(S[l]||o>11)&&(E[l]=S[l]<<4|z(4))),I[M++]=E[1&f]}},t.decode._decodeVC5=function(){var e,i,r,n=[1,0,1,0,2,2,1,1,3,7,1,2,5,25,1,3,6,48,1,4,6,54,1,5,7,111,1,8,7,99,1,6,7,105,12,0,7,107,1,7,8,209,20,0,8,212,1,9,8,220,1,10,9,393,1,11,9,394,32,0,9,416,1,12,9,427,1,13,10,887,1,18,10,784,1,14,10,790,1,15,10,835,60,0,10,852,1,16,10,885,1,17,11,1571,1,19,11,1668,1,20,11,1669,100,0,11,1707,1,21,11,1772,1,22,12,3547,1,29,12,3164,1,24,12,3166,1,25,12,3140,1,23,12,3413,1,26,12,3537,1,27,12,3539,1,28,13,7093,1,35,13,6283,1,30,13,6331,1,31,13,6335,180,0,13,6824,1,32,13,7072,1,33,13,7077,320,0,13,7076,1,34,14,12565,1,36,14,12661,1,37,14,12669,1,38,14,13651,1,39,14,14184,1,40,15,28295,1,46,15,28371,1,47,15,25320,1,42,15,25336,1,43,15,25128,1,41,15,27300,1,44,15,28293,1,45,16,50259,1,48,16,50643,1,49,16,50675,1,50,16,56740,1,53,16,56584,1,51,16,56588,1,52,17,113483,1,61,17,113482,1,60,17,101285,1,55,17,101349,1,56,17,109205,1,57,17,109207,1,58,17,100516,1,54,17,113171,1,59,18,202568,1,62,18,202696,1,63,18,218408,1,64,18,218412,1,65,18,226340,1,66,18,226356,1,67,18,226358,1,68,19,402068,1,69,19,405138,1,70,19,405394,1,71,19,436818,1,72,19,436826,1,73,19,452714,1,75,19,452718,1,76,19,452682,1,74,20,804138,1,77,20,810279,1,78,20,810790,1,79,20,873638,1,80,20,873654,1,81,20,905366,1,82,20,905430,1,83,20,905438,1,84,21,1608278,1,85,21,1620557,1,86,21,1621582,1,87,21,1621583,1,88,21,1747310,1,89,21,1810734,1,90,21,1810735,1,91,21,1810863,1,92,21,1810879,1,93,22,3621725,1,99,22,3621757,1,100,22,3241112,1,94,22,3494556,1,95,22,3494557,1,96,22,3494622,1,97,22,3494623,1,98,23,6482227,1,102,23,6433117,1,101,23,6989117,1,103,23,6989119,1,105,23,6989118,1,104,23,7243449,1,106,23,7243512,1,107,24,13978233,1,111,24,12964453,1,109,24,12866232,1,108,24,14486897,1,113,24,13978232,1,110,24,14486896,1,112,24,14487026,1,114,24,14487027,1,115,25,25732598,1,225,25,25732597,1,189,25,25732596,1,188,25,25732595,1,203,25,25732594,1,202,25,25732593,1,197,25,25732592,1,207,25,25732591,1,169,25,25732590,1,223,25,25732589,1,159,25,25732522,1,235,25,25732579,1,152,25,25732575,1,192,25,25732489,1,179,25,25732573,1,201,25,25732472,1,172,25,25732576,1,149,25,25732488,1,178,25,25732566,1,120,25,25732571,1,219,25,25732577,1,150,25,25732487,1,127,25,25732506,1,211,25,25732548,1,125,25,25732588,1,158,25,25732486,1,247,25,25732467,1,238,25,25732508,1,163,25,25732552,1,228,25,25732603,1,183,25,25732513,1,217,25,25732587,1,168,25,25732520,1,122,25,25732484,1,128,25,25732562,1,249,25,25732505,1,187,25,25732504,1,186,25,25732483,1,136,25,25928905,1,181,25,25732560,1,255,25,25732500,1,230,25,25732482,1,135,25,25732555,1,233,25,25732568,1,222,25,25732583,1,145,25,25732481,1,134,25,25732586,1,167,25,25732521,1,248,25,25732518,1,209,25,25732480,1,243,25,25732512,1,216,25,25732509,1,164,25,25732547,1,140,25,25732479,1,157,25,25732544,1,239,25,25732574,1,191,25,25732564,1,251,25,25732478,1,156,25,25732546,1,139,25,25732498,1,242,25,25732557,1,133,25,25732477,1,162,25,25732515,1,213,25,25732584,1,165,25,25732514,1,212,25,25732476,1,227,25,25732494,1,198,25,25732531,1,236,25,25732530,1,234,25,25732529,1,117,25,25732528,1,215,25,25732527,1,124,25,25732526,1,123,25,25732525,1,254,25,25732524,1,253,25,25732523,1,148,25,25732570,1,218,25,25732580,1,146,25,25732581,1,147,25,25732569,1,224,25,25732533,1,143,25,25732540,1,184,25,25732541,1,185,25,25732585,1,166,25,25732556,1,132,25,25732485,1,129,25,25732563,1,250,25,25732578,1,151,25,25732501,1,119,25,25732502,1,193,25,25732536,1,176,25,25732496,1,245,25,25732553,1,229,25,25732516,1,206,25,25732582,1,144,25,25732517,1,208,25,25732558,1,137,25,25732543,1,241,25,25732466,1,237,25,25732507,1,190,25,25732542,1,240,25,25732551,1,131,25,25732554,1,232,25,25732565,1,252,25,25732475,1,171,25,25732493,1,205,25,25732492,1,204,25,25732491,1,118,25,25732490,1,214,25,25928904,1,180,25,25732549,1,126,25,25732602,1,182,25,25732539,1,175,25,25732545,1,141,25,25732559,1,138,25,25732537,1,177,25,25732534,1,153,25,25732503,1,194,25,25732606,1,160,25,25732567,1,121,25,25732538,1,174,25,25732497,1,246,25,25732550,1,130,25,25732572,1,200,25,25732474,1,170,25,25732511,1,221,25,25732601,1,196,25,25732532,1,142,25,25732519,1,210,25,25732495,1,199,25,25732605,1,155,25,25732535,1,154,25,25732499,1,244,25,25732510,1,220,25,25732600,1,195,25,25732607,1,161,25,25732604,1,231,25,25732473,1,173,25,25732599,1,226,26,51465122,1,116,26,51465123,0,1],a=[3,3,3,3,2,2,2,1,1,1];function o(t){var e=t[1],i=t[0][e>>>3]>>>7-(7&e)&1;return t[1]++,i}function s(t,i){if(null==e){e={};for(var r=0;r<n.length;r+=4)e[n[r+1]]=n.slice(r,r+4)}for(var a=o(t),s=e[a];null==s;)a=a<<1|o(t),s=e[a];var h=s[3];0!=h&&(h=0==o(t)?h:-h),i[0]=s[2],i[1]=h}function h(t,e){for(var i=0;i<e;i++)1&~t||t++,t>>>=1;return t}function l(t,e){return t>>e}function u(t,e,i,r,n,a){e[i]=l(l(11*t[n]-4*t[n+a]+t[n+a+a]+4,3)+t[r],1),e[i+a]=l(l(5*t[n]+4*t[n+a]-t[n+a+a]+4,3)-t[r],1)}function c(t,e,i,r,n,a){var o=t[n-a]-t[n+a],s=t[n],h=t[r];e[i]=l(l(o+4,3)+s+h,1),e[i+a]=l(l(4-o,3)+s-h,1)}function f(t,e,i,r,n,a){e[i]=l(l(5*t[n]+4*t[n-a]-t[n-a-a]+4,3)+t[r],1),e[i+a]=l(l(11*t[n]-4*t[n-a]+t[n-a-a]+4,3)-t[r],1)}function d(t){return t=r[t=t<0?0:t>4095?4095:t]>>>2}return function(e,n,o,l,p,m){l=new Uint16Array(l.buffer);var g,_,b,y,w,v,x,k,E=Date.now(),S=t._binBE,M=n+o;n+=4;for(var A=1==m[0];n<M;){var I=S.readShort(e,n),z=S.readUshort(e,n+2);if(n+=4,12==I)L=z;else if(20==I)g=z;else if(21==I)_=z;else if(48==I)b=z;else if(53==I)y=z;else if(35==I);else if(62==I)w=z;else if(101==I);else if(109==I)v=z;else if(84==I);else if(106==I);else if(107==I);else if(108==I);else if(102==I);else if(104==I)it=z;else if(105==I);else{var P=I<0?-I:I,T=65280&P,R=0;if(24576&P&&(8192&P?(R=65535&z,R+=(255&P)<<16):R=65535&z),24576&~P){if(16388==P)n+=4*R;else if(8192!=T&&8448!=T&&9216!=T)throw P.toString(16)}else{if(null==x){x=[];for(var O=0;O<4;O++)x[O]=new Int16Array((g>>>1)*(_>>>1));k=new Int16Array((g>>>1)*(_>>>1)),i=new Int16Array(1024);for(O=0;O<1024;O++){var B=O-512,C=Math.abs(B),L=Math.floor(768*C*C*C/16581375)+C;i[O]=Math.sign(B)*L}r=new Uint16Array(4096);for(O=0;O<4096;O++){var D=O,U=65535*(Math.pow(113,D/4095)-1)/112;r[O]=Math.min(U,65535)}}var F=x[w],N=h(g,1+a[b]),j=h(_,1+a[b]);if(0==b)for(var G=0;G<j;G++)for(var Z=0;Z<N;Z++){var H=n+2*(G*N+Z);F[G*(g>>>1)+Z]=e[H]<<8|e[H+1]}else{var $=[e,8*n],W=[],q=0,Y=N*j,V=[0,0],J=0;for(z=0;q<Y;)for(s($,V),J=V[0],z=V[1];J>0;)W[q++]=z,J--;var K=(b-1)%3,X=1!=K?N:0,Q=0!=K?j:0;for(G=0;G<j;G++){var tt=(G+Q)*(g>>>1)+X,et=G*N;for(Z=0;Z<N;Z++)F[tt+Z]=i[W[et+Z]+512]*y}if(2==K){var it=g>>>1,rt=2*N,nt=2*j;for(G=0;G<j;G++)for(Z=0;Z<rt;Z++){O=2*G*it+Z;var at=j*it+(st=G*it+Z);0==G?u(F,k,O,at,st,it):G==j-1?f(F,k,O,at,st,it):c(F,k,O,at,st,it)}var ot=F;F=k,k=ot;for(G=0;G<nt;G++)for(Z=0;Z<N;Z++){var st;O=G*it+2*Z,at=N+(st=G*it+Z);0==Z?u(F,k,O,at,st,1):Z==N-1?f(F,k,O,at,st,1):c(F,k,O,at,st,1)}ot=F;F=k,k=ot;for(var ht=[],lt=2-~~((b-1)/3),ut=0;ut<3;ut++)ht[ut]=v>>14-2*ut&3;var ct=ht[lt];if(0!=ct)for(G=0;G<nt;G++)for(Z=0;Z<rt;Z++){F[O=G*it+Z]=F[O]<<ct}}}if(9==b&&3==w){var ft=x[0],dt=x[1],pt=x[2],mt=x[3];for(G=0;G<_;G+=2)for(Z=0;Z<g;Z+=2){var gt=G*g+Z,_t=ft[H=(G>>>1)*(g>>>1)+(Z>>>1)],bt=dt[H]-2048,yt=pt[H]-2048,wt=mt[H]-2048,vt=(bt<<1)+_t,xt=(yt<<1)+_t,kt=_t+wt,Et=_t-wt;A?(l[gt]=d(kt),l[gt+1]=d(xt),l[gt+g]=d(vt),l[gt+g+1]=d(Et)):(l[gt]=d(vt),l[gt+1]=d(kt),l[gt+g]=d(Et),l[gt+g+1]=d(xt))}}n+=4*R}}}console.log(Date.now()-E)}}(),t.decode._decodeLogLuv32=function(t,e,i,r,n,a){for(var o=t.width,s=4*o,h=0,l=new Uint8Array(s);h<r;){for(var u=0;u<s;){var c=e[i+h];if(h++,c<128){for(var f=0;f<c;f++)l[u+f]=e[i+h+f];u+=c,h+=c}else{c-=126;for(f=0;f<c;f++)l[u+f]=e[i+h];u+=c,h++}}for(var d=0;d<o;d++)n[a+0]=l[d],n[a+1]=l[d+o],n[a+2]=l[d+2*o],n[a+4]=l[d+3*o],a+=6}},t.decode._ljpeg_diff=function(e,i,r){var n,a,o=t.decode._getbithuff;return n=o(e,i,r[0],r),(a=o(e,i,n,0))&1<<n-1||(a-=(1<<n)-1),a},t.decode._decodeARW=function(e,i,r,n,a,o){var s=e.t256[0],h=e.t257[0],l=e.t258[0],u=e.isLE?t._binLE:t._binBE;if(s*h==n||s*h*1.5==n)if(s*h*1.5!=n){var c,f,d,p,m,g,_,b,y=new Uint16Array(16),w=new Uint8Array(s+1);for(I=0;I<h;I++){for(var v=0;v<s;v++)w[v]=i[r++];for(b=0,A=0;A<s-30;b+=16){for(f=2047&(c=u.readUint(w,b)),d=2047&c>>>11,p=15&c>>>22,m=15&c>>>26,g=0;g<4&&128<<g<=f-d;g++);for(_=30,x=0;x<16;x++)x==p?y[x]=f:x==m?y[x]=d:(y[x]=((u.readUshort(w,b+(_>>3))>>>(7&_)&127)<<g)+d,y[x]>2047&&(y[x]=2047),_+=7);for(x=0;x<16;x++,A+=2){L=y[x]<<1;t.decode._putsF(a,(I*s+A)*l,L<<16-l)}A-=1&A?1:31}}}else for(var x=0;x<n;x+=3){var k=i[r+x+0],E=i[r+x+1],S=i[r+x+2];a[o+x]=E<<4|k>>>4,a[o+x+1]=k<<4|S>>>4,a[o+x+2]=S<<4|E>>>4}else{h+=8;var M,A,I,z=[r,0,0,0],P=new Uint16Array(32770),T=[3857,3856,3599,3342,3085,2828,2571,2314,2057,1800,1543,1286,1029,772,771,768,514,513],R=0,O=t.decode._ljpeg_diff;for(P[0]=15,M=x=0;x<18;x++)for(var B=32768>>>(T[x]>>>8),C=0;C<B;C++)P[++M]=T[x];for(A=s;A--;)for(I=0;I<h+1;I+=2)if(I==h&&(I=1),R+=O(i,z,P),I<h){var L=4095&R;t.decode._putsF(a,(I*s+A)*l,L<<16-l)}}},t.decode._decodeNikon=function(e,i,r,n,a,o,s){var h=[[0,0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,5,4,3,6,2,7,1,0,8,9,11,10,12],[0,0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,57,90,56,39,22,5,4,3,2,1,0,11,12,12],[0,0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0,5,4,6,3,7,2,8,1,9,0,10,11,12],[0,0,1,4,3,1,1,1,1,1,2,0,0,0,0,0,0,5,6,4,7,8,3,9,2,1,0,10,11,12,13,14],[0,0,1,5,1,1,1,1,1,1,1,2,0,0,0,0,0,8,92,75,58,41,7,6,5,4,3,2,1,0,13,14],[0,0,1,4,2,2,3,1,2,0,0,0,0,0,0,0,0,7,6,8,5,9,4,10,3,11,12,2,0,1,13,14]],l=e.t256[0],u=e.t257[0],c=e.t258[0],f=0,d=0,p=t.decode._make_decoder,m=t.decode._getbithuff,g=i[0].exifIFD.makerNote,_=g.t150?g.t150:g.t140,b=0,y=_[b++],w=_[b++];73!=y&&88!=w||(b+=2110),70==y&&(f=2),14==c&&(f+=3);for(var v=[[0,0],[0,0]],x=e.isLE?t._binLE:t._binBE,k=0;k<2;k++)for(var E=0;E<2;E++)v[k][E]=x.readShort(_,b),b+=2;var S,M,A,I,z,P=1<<c&32767,T=0,R=x.readShort(_,b);b+=2,R>1&&(T=Math.floor(P/(R-1))),68==y&&32==w&&T>0&&(d=x.readShort(_,562));var O=[0,0],B=p(h[f]),C=[n,0,0,0];for(S=0;S<u;S++)for(d&&S==d&&(B=p(h[f+1])),M=0;M<l;M++){k=m(r,C,B[0],B),(z=1+(m(r,C,(A=15&k)-(I=k>>>4),0)<<1)<<I>>>1)&1<<A-1||(z-=(1<<A)-(0==I?1:0)),M<2?O[M]=v[1&S][M]+=z:O[1&M]+=z;var L=Math.min(Math.max(O[1&M],0),(1<<c)-1),D=(S*l+M)*c;t.decode._putsF(o,D,L<<16-c)}},t.decode._putsF=function(t,e,i){i<<=8-(7&e);var r=e>>>3;t[r]|=i>>>16,t[r+1]|=i>>>8,t[r+2]|=i},t.decode._getbithuff=function(e,i,r,n){var a;t.decode._get_byte;var o=i[0],s=i[1],h=i[2],l=i[3];if(0==r||h<0)return 0;for(;!l&&h<r&&-1!=(a=e[o++])&&!(l=0);)s=(s<<8)+a,h+=8;if(a=s<<32-h>>>32-r,n?(h-=n[a+1]>>>8,a=255&n[a+1]):h-=r,h<0)throw"e";return i[0]=o,i[1]=s,i[2]=h,i[3]=l,a},t.decode._make_decoder=function(t){var e,i,r,n,a,o=[];for(e=16;0!=e&&!t[e];e--);var s=17;for(o[0]=e,r=i=1;i<=e;i++)for(n=0;n<t[i];n++,++s)for(a=0;a<1<<e-i;a++)r<=1<<e&&(o[r++]=i<<8|t[s]);return o},t.decode._decodeNewJPEG=function(e,i,r,n,a,o){n=Math.min(n,i.length-r);var s=e.t347,h=s?s.length:0,l=new Uint8Array(h+n);if(s){for(var u=0,c=0;c<h-1&&(255!=s[c]||217!=s[c+1]);c++)l[u++]=s[c];var f=i[r],d=i[r+1];255==f&&216==d||(l[u++]=f,l[u++]=d);for(c=2;c<n;c++)l[u++]=i[r+c]}else for(c=0;c<n;c++)l[c]=i[r+c];if(32803==e.t262[0]||7==e.t259[0]&&34892==e.t262[0]){var p=e.t258[0],m=t.LosslessJpegDecode(l),g=m.length;if(16==p)if(e.isLE)for(c=0;c<g;c++)a[o+(c<<1)]=255&m[c],a[o+(c<<1)+1]=m[c]>>>8;else for(c=0;c<g;c++)a[o+(c<<1)]=m[c]>>>8,a[o+(c<<1)+1]=255&m[c];else if(14==p||12==p||10==p){var _=16-p;for(c=0;c<g;c++)t.decode._putsF(a,c*p,m[c]<<_)}else{if(8!=p)throw new Error("unsupported bit depth "+p);for(c=0;c<g;c++)a[o+c]=m[c]}}else{var b=new t.JpegDecoder;b.parse(l);var y=b.getData({width:b.width,height:b.height,forceRGB:!0,isSourcePDF:!1});for(c=0;c<y.length;c++)a[o+c]=y[c]}6==e.t262[0]&&(e.t262[0]=2)},t.decode._decodeOldJPEGInit=function(t,e,r,n){var a,o,s,h,l,u=216,c=0,f=0,d=!1,p=t.t513,m=p?p[0]:0,g=t.t514,_=g?g[0]:0,b=t.t324||t.t273||p,y=t.t530,w=0,v=0,x=t.t277?t.t277[0]:1,k=t.t515;if(b&&(f=b[0],d=b.length>1),!d){if(255==e[r]&&e[r+1]==u)return{jpegOffset:r};if(null!=p&&(255==e[r+m]&&e[r+m+1]==u?c=r+m:i("JPEGInterchangeFormat does not point to SOI"),null==g?i("JPEGInterchangeFormatLength field is missing"):(m>=f||m+_<=f)&&i("JPEGInterchangeFormatLength field value is invalid"),null!=c))return{jpegOffset:c}}if(null!=y&&(w=y[0],v=y[1]),null!=p&&null!=g)if(_>=2&&m+_<=f){for(a=255==e[r+m+_-2]&&e[r+m+_-1]==u?new Uint8Array(_-2):new Uint8Array(_),s=0;s<a.length;s++)a[s]=e[r+m+s];i("Incorrect JPEG interchange format: using JPEGInterchangeFormat offset to derive tables")}else i("JPEGInterchangeFormat+JPEGInterchangeFormatLength > offset to first strip or tile");if(null==a){var E=0,S=[];S[E++]=255,S[E++]=u;var M=t.t519;if(null==M)throw new Error("JPEGQTables tag is missing");for(s=0;s<M.length;s++)for(S[E++]=255,S[E++]=219,S[E++]=0,S[E++]=67,S[E++]=s,h=0;h<64;h++)S[E++]=e[r+M[s]+h];for(l=0;l<2;l++){var A=t[0==l?"t520":"t521"];if(null==A)throw new Error((0==l?"JPEGDCTables":"JPEGACTables")+" tag is missing");for(s=0;s<A.length;s++){S[E++]=255,S[E++]=196;var I=19;for(h=0;h<16;h++)I+=e[r+A[s]+h];for(S[E++]=I>>>8,S[E++]=255&I,S[E++]=s|l<<4,h=0;h<16;h++)S[E++]=e[r+A[s]+h];for(h=0;h<I;h++)S[E++]=e[r+A[s]+16+h]}}if(S[E++]=255,S[E++]=192,S[E++]=0,S[E++]=8+3*x,S[E++]=8,S[E++]=t.height>>>8&255,S[E++]=255&t.height,S[E++]=t.width>>>8&255,S[E++]=255&t.width,S[E++]=x,1==x)S[E++]=1,S[E++]=17,S[E++]=0;else for(s=0;s<3;s++)S[E++]=s+1,S[E++]=0!=s?17:(15&w)<<4|15&v,S[E++]=s;null!=k&&0!=k[0]&&(S[E++]=255,S[E++]=221,S[E++]=0,S[E++]=4,S[E++]=k[0]>>>8&255,S[E++]=255&k[0]),a=new Uint8Array(S)}var z=-1;for(s=0;s<a.length-1;){if(255==a[s]&&192==a[s+1]){z=s;break}s++}if(-1==z){var P=new Uint8Array(a.length+10+3*x);P.set(a);var T=a.length;if(z=a.length,(a=P)[T++]=255,a[T++]=192,a[T++]=0,a[T++]=8+3*x,a[T++]=8,a[T++]=t.height>>>8&255,a[T++]=255&t.height,a[T++]=t.width>>>8&255,a[T++]=255&t.width,a[T++]=x,1==x)a[T++]=1,a[T++]=17,a[T++]=0;else for(s=0;s<3;s++)a[T++]=s+1,a[T++]=0!=s?17:(15&w)<<4|15&v,a[T++]=s}if(255==e[f]&&218==e[f+1]){var R=e[f+2]<<8|e[f+3];for((o=new Uint8Array(R+2))[0]=e[f],o[1]=e[f+1],o[2]=e[f+2],o[3]=e[f+3],s=0;s<R-2;s++)o[s+4]=e[f+s+4]}else{var O=0;if((o=new Uint8Array(8+2*x))[O++]=255,o[O++]=218,o[O++]=0,o[O++]=6+2*x,o[O++]=x,1==x)o[O++]=1,o[O++]=0;else for(s=0;s<3;s++)o[O++]=s+1,o[O++]=s<<4|s;o[O++]=0,o[O++]=63,o[O++]=0}return{jpegOffset:r,tables:a,sosMarker:o,sofPosition:z}},t.decode._decodeOldJPEG=function(e,i,r,n,a,o){var s,h,l,u,c=t.decode._decodeOldJPEGInit(e,i,r,n);if(null!=c.jpegOffset)for(s=r+n-c.jpegOffset,l=new Uint8Array(s),p=0;p<s;p++)l[p]=i[c.jpegOffset+p];else{for(h=c.tables.length,(l=new Uint8Array(h+c.sosMarker.length+n+2)).set(c.tables),u=h,l[c.sofPosition+5]=e.height>>>8&255,l[c.sofPosition+6]=255&e.height,l[c.sofPosition+7]=e.width>>>8&255,l[c.sofPosition+8]=255&e.width,255==i[r]&&i[r+1]==SOS||(l.set(c.sosMarker,u),u+=sosMarker.length),p=0;p<n;p++)l[u++]=i[r+p];l[u++]=255,l[u++]=EOI}var f=new t.JpegDecoder;f.parse(l);for(var d=f.getData({width:f.width,height:f.height,forceRGB:!0,isSourcePDF:!1}),p=0;p<d.length;p++)a[o+p]=d[p];e.t262&&6==e.t262[0]&&(e.t262[0]=2)},t.decode._decodePackBits=function(t,e,i,r,n){for(var a=new Int8Array(t.buffer),o=new Int8Array(r.buffer),s=e+i;e<s;){var h=a[e];if(e++,h>=0&&h<128)for(var l=0;l<h+1;l++)o[n]=a[e],n++,e++;if(h>=-127&&h<0){for(l=0;l<1-h;l++)o[n]=a[e],n++;e++}}return n},t.decode._decodeThunder=function(t,e,i,r,n){for(var a=[0,1,0,-1],o=[0,1,2,3,0,-3,-2,-1],s=e+i,h=2*n,l=0;e<s;){var u=t[e],c=u>>>6,f=63&u;if(e++,3==c&&(l=15&f,r[h>>>1]|=l<<4*(1-h&1),h++),0==c)for(var d=0;d<f;d++)r[h>>>1]|=l<<4*(1-h&1),h++;if(2==c)for(d=0;d<2;d++){4!=(p=f>>>3*(1-d)&7)&&(l+=o[p],r[h>>>1]|=l<<4*(1-h&1),h++)}if(1==c)for(d=0;d<3;d++){var p;2!=(p=f>>>2*(2-d)&3)&&(l+=a[p],r[h>>>1]|=l<<4*(1-h&1),h++)}}},t.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},t.decode._lens=function(){var t=function(t,e,i,r){for(var n=0;n<e.length;n++)t[e[n]]=i+n*r},e="00110101,000111,0111,1000,1011,1100,1110,1111,10011,10100,00111,01000,001000,000011,110100,110101,101010,101011,0100111,0001100,0001000,0010111,0000011,0000100,0101000,0101011,0010011,0100100,0011000,00000010,00000011,00011010,00011011,00010010,00010011,00010100,00010101,00010110,00010111,00101000,00101001,00101010,00101011,00101100,00101101,00000100,00000101,00001010,00001011,01010010,01010011,01010100,01010101,00100100,00100101,01011000,01011001,01011010,01011011,01001010,01001011,00110010,00110011,00110100",i="0000110111,010,11,10,011,0011,0010,00011,000101,000100,0000100,0000101,0000111,00000100,00000111,000011000,0000010111,0000011000,0000001000,00001100111,00001101000,00001101100,00000110111,00000101000,00000010111,00000011000,000011001010,000011001011,000011001100,000011001101,000001101000,000001101001,000001101010,000001101011,000011010010,000011010011,000011010100,000011010101,000011010110,000011010111,000001101100,000001101101,000011011010,000011011011,000001010100,000001010101,000001010110,000001010111,000001100100,000001100101,000001010010,000001010011,000000100100,000000110111,000000111000,000000100111,000000101000,000001011000,000001011001,000000101011,000000101100,000001011010,000001100110,000001100111",r="11011,10010,010111,0110111,00110110,00110111,01100100,01100101,01101000,01100111,011001100,011001101,011010010,011010011,011010100,011010101,011010110,011010111,011011000,011011001,011011010,011011011,010011000,010011001,010011010,011000,010011011",n="0000001111,000011001000,000011001001,000001011011,000000110011,000000110100,000000110101,0000001101100,0000001101101,0000001001010,0000001001011,0000001001100,0000001001101,0000001110010,0000001110011,0000001110100,0000001110101,0000001110110,0000001110111,0000001010010,0000001010011,0000001010100,0000001010101,0000001011010,0000001011011,0000001100100,0000001100101",a="00000001000,00000001100,00000001101,000000010010,000000010011,000000010100,000000010101,000000010110,000000010111,000000011100,000000011101,000000011110,000000011111";e=e.split(","),i=i.split(","),r=r.split(","),n=n.split(","),a=a.split(",");var o={},s={};return t(o,e,0,1),t(o,r,64,64),t(o,a,1792,64),t(s,i,0,1),t(s,n,64,64),t(s,a,1792,64),[o,s]}(),t.decode._decodeG4=function(e,i,r,n,a,o,s){for(var h=t.decode,l=i<<3,u=0,c="",f=[],d=[],p=0;p<o;p++)d.push(0);d=h._makeDiff(d);for(var m=0,g=0,_=0,b=0,y=0,w=0,v="",x=0,k=8*Math.ceil(o/8);l>>>3<i+r;){_=h._findDiff(d,m+(0==m?0:1),1-y),b=h._findDiff(d,_,y);var E=0;if(1==s&&(E=e[l>>>3]>>>7-(7&l)&1),2==s&&(E=e[l>>>3]>>>(7&l)&1),l++,c+=E,"H"==v){if(null!=h._lens[y][c]){var S=h._lens[y][c];c="",u+=S,S<64&&(h._addNtimes(f,u,y),m+=u,y=1-y,u=0,0==--x&&(v=""))}}else"0001"==c&&(c="",h._addNtimes(f,b-m,y),m=b),"001"==c&&(c="",v="H",x=2),null!=h._dmap[c]&&(g=_+h._dmap[c],h._addNtimes(f,g-m,y),m=g,c="",y=1-y);f.length==o&&""==v&&(h._writeBits(f,n,8*a+w*k),y=0,w++,m=0,d=h._makeDiff(f),f=[])}},t.decode._findDiff=function(t,e,i){for(var r=0;r<t.length;r+=2)if(t[r]>=e&&t[r+1]==i)return t[r]},t.decode._makeDiff=function(t){var e=[];1==t[0]&&e.push(0,1);for(var i=1;i<t.length;i++)t[i-1]!=t[i]&&e.push(i,t[i]);return e.push(t.length,0,t.length,1),e},t.decode._decodeG2=function(e,i,r,n,a,o,s){for(var h=t.decode,l=i<<3,u=0,c="",f=[],d=0,p=0,m=8*Math.ceil(o/8);l>>>3<i+r;){var g=0;1==s&&(g=e[l>>>3]>>>7-(7&l)&1),2==s&&(g=e[l>>>3]>>>(7&l)&1),l++,c+=g,null!=(u=h._lens[d][c])&&(h._addNtimes(f,u,d),c="",u<64&&(d=1-d),f.length==o&&(h._writeBits(f,n,8*a+p*m),f=[],p++,d=0,7&l&&(l+=8-(7&l)),u>=64&&(l+=8)))}},t.decode._decodeG3=function(e,i,r,n,a,o,s,h){for(var l=t.decode,u=i<<3,c=0,f="",d=[],p=[],m=0;m<o;m++)d.push(0);for(var g=0,_=0,b=0,y=0,w=0,v=-1,x="",k=0,E=!0,S=8*Math.ceil(o/8);u>>>3<i+r;){b=l._findDiff(p,g+(0==g?0:1),1-w),y=l._findDiff(p,b,w);var M=0;if(1==s&&(M=e[u>>>3]>>>7-(7&u)&1),2==s&&(M=e[u>>>3]>>>(7&u)&1),u++,f+=M,E){if(null!=l._lens[w][f]){var A=l._lens[w][f];f="",c+=A,A<64&&(l._addNtimes(d,c,w),w=1-w,c=0)}}else if("H"==x){if(null!=l._lens[w][f]){A=l._lens[w][f];f="",c+=A,A<64&&(l._addNtimes(d,c,w),g+=c,w=1-w,c=0,0==--k&&(x=""))}}else"0001"==f&&(f="",l._addNtimes(d,y-g,w),g=y),"001"==f&&(f="",x="H",k=2),null!=l._dmap[f]&&(_=b+l._dmap[f],l._addNtimes(d,_-g,w),g=_,f="",w=1-w);f.endsWith("000000000001")&&(v>=0&&l._writeBits(d,n,8*a+v*S),h&&(1==s&&(E=1==(e[u>>>3]>>>7-(7&u)&1)),2==s&&(E=1==(e[u>>>3]>>>(7&u)&1)),u++),f="",w=0,v++,g=0,p=l._makeDiff(d),d=[])}d.length==o&&l._writeBits(d,n,8*a+v*S)},t.decode._addNtimes=function(t,e,i){for(var r=0;r<e;r++)t.push(i)},t.decode._writeBits=function(t,e,i){for(var r=0;r<t.length;r++)e[i+r>>>3]|=t[r]<<7-(i+r&7)},t.decode._decodeLZW=t.decode._decodeLZW=function(){var t,e,i,r,n=0,a=0,o=0,s=0,h=function(){var i=t>>>3,r=(e[i]<<16|e[i+1]<<8|e[i+2])>>>24-(7&t)-a&(1<<a)-1;return t+=a,r},l=new Uint32Array(16384),u=0,c=function(t){a=t+1,n=s+1},f=function(t){for(var e=t<<2,n=l[e+2],a=r+n-1;65535!=e;)i[a--]=l[e],e=l[e+1];r+=n},d=function(t,e){var i=n<<2,r=t<<2;l[i]=l[3+(e<<2)],l[i+1]=r,l[i+2]=l[r+2]+1,l[i+3]=l[r+3],++n+1==1<<a&&12!=a&&a++};return function(a,p,m,g,_,b){t=p<<3,e=a,i=g,r=_;var y=p+m<<3,w=0,v=0;for(!function(t){if(t!=u){u=t,s=1+(o=1<<t);for(var e=0;e<s+1;e++)l[4*e]=l[4*e+3]=e,l[4*e+1]=65535,l[4*e+2]=1}}(b),c(b);t<y&&(w=h())!=s;){if(w==o){if(c(b),(w=h())==s)break;f(w)}else w<n?(f(w),d(v,w)):(d(v,v),f(n-1));v=w}return r}}(),t.tags={},t._types=function(){var t=new Array(250);t.fill(0);return{basic:{main:t=t.concat([0,0,0,0,4,3,3,3,3,3,0,0,3,0,0,0,3,0,0,2,2,2,2,4,3,0,0,3,4,4,3,3,5,5,3,2,5,5,0,0,0,0,4,4,0,0,3,3,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,2,2,3,5,5,3,0,3,3,4,4,4,3,4,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),rest:{33432:2,33434:5,33437:5,34665:4,34850:3,34853:4,34855:3,34864:3,34866:4,36864:7,36867:2,36868:2,37121:7,37377:10,37378:5,37380:10,37381:5,37383:3,37384:3,37385:3,37386:5,37510:7,37520:2,37521:2,37522:2,40960:7,40961:3,40962:4,40963:4,40965:4,41486:5,41487:5,41488:3,41985:3,41986:3,41987:3,41988:5,41989:3,41990:3,41993:3,41994:3,41995:7,41996:3,42032:2,42033:2,42034:5,42036:2,42037:2,59932:7}},gps:{main:[1,2,5,2,5,1,5,5,0,9],rest:{18:2,29:2}}}}(),t._readIFD=function(e,r,n,a,o,s){var h=e.readUshort(r,n);n+=2;var l={};s.debug&&i("   ".repeat(o),a.length-1,">>>----------------");for(var u=0;u<h;u++){var c=e.readUshort(r,n);n+=2;var f=e.readUshort(r,n);n+=2;var d=e.readUint(r,n);n+=4;var p=e.readUint(r,n);n+=4;var m=[];if(1==f||7==f){var g=d<5?n-4:p;g+d>r.buffer.byteLength&&(d=r.buffer.byteLength-g),m=new Uint8Array(r.buffer,g,d)}if(2==f){var _=d<5?n-4:p,b=r[_],y=Math.max(0,Math.min(d-1,r.length-_));b<128||0==y?m.push(e.readASCII(r,_,y)):m=new Uint8Array(r.buffer,_,y)}if(3==f)for(var w=0;w<d;w++)m.push(e.readUshort(r,(d<3?n-4:p)+2*w));if(4==f||13==f)for(w=0;w<d;w++)m.push(e.readUint(r,(d<2?n-4:p)+4*w));if(5==f||10==f){var v=5==f?e.readUint:e.readInt;for(w=0;w<d;w++)m.push([v(r,p+8*w),v(r,p+8*w+4)])}if(8==f)for(w=0;w<d;w++)m.push(e.readShort(r,(d<3?n-4:p)+2*w));if(9==f)for(w=0;w<d;w++)m.push(e.readInt(r,(d<2?n-4:p)+4*w));if(11==f)for(w=0;w<d;w++)m.push(e.readFloat(r,p+4*w));if(12==f)for(w=0;w<d;w++)m.push(e.readDouble(r,p+8*w));if(0==d||0!=m.length){if(s.debug&&i("   ".repeat(o),c,f,t.tags[c],m),l["t"+c]=m,330==c&&l.t272&&"DSLR-A100"==l.t272[0]);else if(330==c||34665==c||34853==c||50740==c&&e.readUshort(r,e.readUint(m,0))<300||61440==c){var x=50740==c?[e.readUint(m,0)]:m,k=[];for(w=0;w<x.length;w++)t._readIFD(e,r,x[w],k,o+1,s);330==c&&(l.subIFD=k),34665==c&&(l.exifIFD=k[0]),34853==c&&(l.gpsiIFD=k[0]),50740==c&&(l.dngPrvt=k[0]),61440==c&&(l.fujiIFD=k[0])}if(37500==c&&s.parseMN){var E=m;if("Nikon"==e.readASCII(E,0,5))l.makerNote=t.decode(E.slice(10).buffer)[0];else if("OLYMP"==e.readASCII(E,0,5)||"OM SYSTEM"==e.readASCII(E,0,9)){var S=[8208,8224,8240,8256,8272],M=[];t._readIFD(e,E,77==E[1]?16:85==E[5]?12:8,M,o+1,s);var A=l.makerNote=M.pop();for(w=0;w<S.length;w++){var I="t"+S[w];null!=A[I]&&(t._readIFD(e,E,A[I][0],M,o+1,s),A[I]=M.pop())}A.t12288&&(t._readIFD(e,A.t12288,0,M,o+1,s),A.t12288=M.pop())}else if(e.readUshort(r,p)<300&&e.readUshort(r,p+4)<=12){M=[];t._readIFD(e,r,p,M,o+1,s),l.makerNote=M[0]}}}else if(i(c,"unknown TIFF tag type: ",f,"num:",d),0==u)return}return a.push(l),s.debug&&i("   ".repeat(o),"<<<---------------"),n},t._writeIFD=function(e,i,r,n,a){var o=Object.keys(a),s=o.length;a.exifIFD&&s--,a.gpsiIFD&&s--,e.writeUshort(r,n,s);for(var h=(n+=2)+12*s+4,l=0;l<o.length;l++){var u=o[l];if("t34665"!=u&&"t34853"!=u){"exifIFD"==u&&(u="t34665"),"gpsiIFD"==u&&(u="t34853");var c=parseInt(u.slice(1)),f=i.main[c];if(null==f&&(f=i.rest[c]),null==f||0==f)throw new Error("unknown type of tag: "+c);var d=a[u];if(34665==c)d=[h],h=t._writeIFD(e,i,r,h,a.exifIFD)[1];if(34853==c)d=[h],h=t._writeIFD(e,t._types.gps,r,h,a.gpsiIFD)[1];2==f&&(d=d[0]+"\0");var p=d.length;e.writeUshort(r,n,c),n+=2,e.writeUshort(r,n,f),n+=2,e.writeUint(r,n,p);var m=[-1,1,1,2,4,8,0,1,0,4,8,0,8][f]*p,g=n+=4;if(m>4&&(e.writeUint(r,n,h),g=h),1==f||7==f)for(var _=0;_<p;_++)r[g+_]=d[_];else if(2==f)e.writeASCII(r,g,d);else if(3==f)for(_=0;_<p;_++)e.writeUshort(r,g+2*_,d[_]);else if(4==f)for(_=0;_<p;_++)e.writeUint(r,g+4*_,d[_]);else if(5==f||10==f){var b=5==f?e.writeUint:e.writeInt;for(_=0;_<p;_++){var y=d[_],w=y[0],v=y[1];if(null==w)throw"e";b(r,g+8*_,w),b(r,g+8*_+4,v)}}else if(9==f)for(_=0;_<p;_++)e.writeInt(r,g+4*_,d[_]);else{if(12!=f)throw f;for(_=0;_<p;_++)e.writeDouble(r,g+8*_,d[_])}m>4&&(h+=m+=1&m),n+=4}}return[n,h]},t.toRGBA8=function(t,e){function r(t){return t<.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055}var n=t.width,a=t.height,o=n*a,s=t.data,h=new Uint8Array(4*o),l=t.t262?t.t262[0]:2,u=t.t258?Math.min(32,t.t258[0]):1;null==t.t262&&1==u&&(l=0);var c=t.t277?t.t277[0]:t.t258?t.t258.length:[1,1,3,1,1,4,3][l],f=t.t339?t.t339[0]:null;if(1==l&&32==u&&3!=f)throw"e";var d=Math.ceil(c*u*n/8);if(0==l){e=1/256;for(var p=0;p<a;p++){var m=p*d,g=p*n;if(1==u)for(var _=0;_<n;_++){var b=g+_<<2,y=s[m+(_>>3)]>>7-(7&_)&1;h[b]=h[b+1]=h[b+2]=255*(1-y),h[b+3]=255}if(4==u)for(_=0;_<n;_++){b=g+_<<2,y=s[m+(_>>1)]>>4-4*(1&_)&15;h[b]=h[b+1]=h[b+2]=17*(15-y),h[b+3]=255}if(8==u)for(_=0;_<n;_++){b=g+_<<2,y=s[m+_];h[b]=h[b+1]=h[b+2]=255-y,h[b+3]=255}if(16==u)for(_=0;_<n;_++){b=g+_<<2,y=s[(v=m+2*_)+1]<<8|s[v];h[b]=h[b+1]=h[b+2]=Math.min(255,255-~~(y*e)),h[b+3]=255}}}else if(1==l){null==e&&(e=1/256);var w=3&s.length?null:new Float32Array(s.buffer);for(p=0;p<a;p++){m=p*d,g=p*n;if(1==u)for(_=0;_<n;_++){b=g+_<<2,y=s[m+(_>>3)]>>7-(7&_)&1;h[b]=h[b+1]=h[b+2]=255*y,h[b+3]=255}if(2==u)for(_=0;_<n;_++){b=g+_<<2,y=s[m+(_>>2)]>>6-2*(3&_)&3;h[b]=h[b+1]=h[b+2]=85*y,h[b+3]=255}if(8==u)for(_=0;_<n;_++){b=g+_<<2,y=s[m+_*c];h[b]=h[b+1]=h[b+2]=y,h[b+3]=255}if(16==u)for(_=0;_<n;_++){b=g+_<<2,y=s[(v=m+2*_)+1]<<8|s[v];h[b]=h[b+1]=h[b+2]=Math.min(255,~~(y*e)),h[b+3]=255}if(32==u)for(_=0;_<n;_++){var v;b=g+_<<2,y=w[v=(m>>>2)+_];h[b]=h[b+1]=h[b+2]=~~(.5+255*y),h[b+3]=255}}}else if(2==l)if(8==u){if(1==c)for(_=0;_<o;_++)h[4*_]=h[4*_+1]=h[4*_+2]=s[_],h[4*_+3]=255;if(3==c)for(_=0;_<o;_++){var x=3*_;h[b=_<<2]=s[x],h[b+1]=s[x+1],h[b+2]=s[x+2],h[b+3]=255}if(c>=4)for(_=0;_<o;_++){x=_*c;h[b=_<<2]=s[x],h[b+1]=s[x+1],h[b+2]=s[x+2],h[b+3]=s[x+3]}}else if(16==u){if(4==c)for(_=0;_<o;_++){x=8*_+1;h[b=_<<2]=s[x],h[b+1]=s[x+2],h[b+2]=s[x+4],h[b+3]=s[x+6]}if(3==c)for(_=0;_<o;_++){x=6*_+1;h[b=_<<2]=s[x],h[b+1]=s[x+2],h[b+2]=s[x+4],h[b+3]=255}}else{if(32!=u)throw u;var k=new Float32Array(s.buffer),E=0;for(_=0;_<k.length;_++)E=Math.min(E,k[_]);if(E<0)for(_=0;_<s.length;_+=4){var S=s[_];s[_]=s[_+3],s[_+3]=S,S=s[_+1],s[_+1]=s[_+2],s[_+2]=S}var M=[];for(_=0;_<65536;_++)M.push(r(_/65535));for(_=0;_<k.length;_++){var A=Math.max(0,Math.min(1,k[_]));k[_]=M[~~(.5+65535*A)]}if(3==c)for(_=0;_<o;_++){x=3*_;h[b=_<<2]=~~(.5+255*k[x]),h[b+1]=~~(.5+255*k[x+1]),h[b+2]=~~(.5+255*k[x+2]),h[b+3]=255}else{if(4!=c)throw c;for(_=0;_<o;_++){x=4*_;h[b=_<<2]=~~(.5+255*k[x]),h[b+1]=~~(.5+255*k[x+1]),h[b+2]=~~(.5+255*k[x+2]),h[b+3]=~~(.5+255*k[x+3])}}}else if(3==l){var I=t.t320,z=1<<u,P=8==u&&c>1&&t.t338&&0!=t.t338[0];for(p=0;p<a;p++)for(var T=0;T<n;T++){b=(_=p*n+T)<<2;var R=0,O=p*d;if(1==u)R=s[O+(T>>>3)]>>>7-(7&T)&1;else if(2==u)R=s[O+(T>>>2)]>>>6-2*(3&T)&3;else if(4==u)R=s[O+(T>>>1)]>>>4-4*(1&T)&15;else{if(8!=u)throw u;R=s[O+T*c]}h[b]=I[R]>>8,h[b+1]=I[z+R]>>8,h[b+2]=I[z+z+R]>>8,h[b+3]=P?s[O+T*c+1]:255}}else if(5==l){var B=c>4?1:0;for(_=0;_<o;_++){b=_<<2;var C=_*c;if(window.UDOC){var L=s[C],D=s[C+1],U=s[C+2],F=s[C+3],N=UDOC.C.cmykToRgb([L*(1/255),D*(1/255),U*(1/255),F*(1/255)]);h[b]=~~(.5+255*N[0]),h[b+1]=~~(.5+255*N[1]),h[b+2]=~~(.5+255*N[2])}else{L=255-s[C],D=255-s[C+1],U=255-s[C+2],F=(255-s[C+3])*(1/255);h[b]=~~(L*F+.5),h[b+1]=~~(D*F+.5),h[b+2]=~~(U*F+.5)}h[b+3]=255*(1-B)+s[C+4]*B}}else if(6==l&&t.t278){var j=t.t278[0];for(p=0;p<a;p+=j){_=p*n;for(var G=j*n,Z=0;Z<G;Z++){b=4*(_+Z),U=s[(C=3*_+4*(Z>>>1))+(1&Z)];var H=s[C+2]-128,$=s[C+3]-128,W=U+(($>>2)+($>>3)+($>>5)),q=U-((H>>2)+(H>>4)+(H>>5))-(($>>1)+($>>3)+($>>4)+($>>5)),Y=U+(H+(H>>1)+(H>>2)+(H>>6));h[b]=Math.max(0,Math.min(255,W)),h[b+1]=Math.max(0,Math.min(255,q)),h[b+2]=Math.max(0,Math.min(255,Y)),h[b+3]=255}}}else if(32845==l)for(p=0;p<a;p++)for(T=0;T<n;T++){b=4*(p*n+T);var V=s[(C=6*(p*n+T))+1]<<8|s[C],J=(V=Math.pow(2,(V+.5)/256-64),(s[C+3]+.5)/410),K=(s[C+5]+.5)/410,X=9*J/(6*J-16*K+12),Q=4*K/(6*J-16*K+12),tt=X*V/Q,et=(1-X-Q)*V/Q;W=2.69*tt-1.276*(U=V)-.414*et,q=-1.022*tt+1.978*U+.044*et,Y=.061*tt-.224*U+1.163*et;h[b]=255*r(Math.min(W,1)),h[b+1]=255*r(Math.min(q,1)),h[b+2]=255*r(Math.min(Y,1)),h[b+3]=255}else i("Unknown Photometric interpretation: "+l);return h},t.replaceIMG=function(e){null==e&&(e=document.getElementsByTagName("img"));for(var i=["tif","tiff","dng","cr2","nef"],r=0;r<e.length;r++){var n=e[r],a=n.getAttribute("src");if(null!=a){var o=a.split(".").pop().toLowerCase();if(-1!=i.indexOf(o)){var s=new XMLHttpRequest;t._xhrs.push(s),t._imgs.push(n),s.open("GET",a),s.responseType="arraybuffer",s.onload=t._imgLoaded,s.send()}}}},t._xhrs=[],t._imgs=[],t._imgLoaded=function(e){var i=t._xhrs.indexOf(e.target),r=t._imgs[i];t._xhrs.splice(i,1),t._imgs.splice(i,1),r.setAttribute("src",t.bufferToURI(e.target.response))},t.bufferToURI=function(e){var i=t.decode(e),r=i,n=0,a=r[0];i[0].subIFD&&(r=r.concat(i[0].subIFD));for(var o=0;o<r.length;o++){var s=r[o];if(!(null==s.t258||s.t258.length<3)){var h=s.t256*s.t257;h>n&&(n=h,a=s)}}t.decodeImage(e,a,i);var l=t.toRGBA8(a),u=a.width,c=a.height,f=document.createElement("canvas");f.width=u,f.height=c;var d=f.getContext("2d"),p=new ImageData(new Uint8ClampedArray(l.buffer),u,c);return d.putImageData(p,0,0),f.toDataURL()},t._binBE={nextZero:function(t,e){for(;0!=t[e];)e++;return e},readUshort:function(t,e){return t[e]<<8|t[e+1]},readShort:function(e,i){var r=t._binBE.ui8;return r[0]=e[i+1],r[1]=e[i+0],t._binBE.i16[0]},readInt:function(e,i){var r=t._binBE.ui8;return r[0]=e[i+3],r[1]=e[i+2],r[2]=e[i+1],r[3]=e[i+0],t._binBE.i32[0]},readUint:function(e,i){var r=t._binBE.ui8;return r[0]=e[i+3],r[1]=e[i+2],r[2]=e[i+1],r[3]=e[i+0],t._binBE.ui32[0]},readASCII:function(t,e,i){for(var r="",n=0;n<i;n++)r+=String.fromCharCode(t[e+n]);return r},readFloat:function(e,i){for(var r=t._binBE.ui8,n=0;n<4;n++)r[n]=e[i+3-n];return t._binBE.fl32[0]},readDouble:function(e,i){for(var r=t._binBE.ui8,n=0;n<8;n++)r[n]=e[i+7-n];return t._binBE.fl64[0]},writeUshort:function(t,e,i){t[e]=i>>8&255,t[e+1]=255&i},writeInt:function(e,i,r){var n=t._binBE.ui8;t._binBE.i32[0]=r,e[i+3]=n[0],e[i+2]=n[1],e[i+1]=n[2],e[i+0]=n[3]},writeUint:function(t,e,i){t[e]=i>>24&255,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=255&i},writeASCII:function(t,e,i){for(var r=0;r<i.length;r++)t[e+r]=i.charCodeAt(r)},writeDouble:function(e,i,r){t._binBE.fl64[0]=r;for(var n=0;n<8;n++)e[i+n]=t._binBE.ui8[7-n]}},t._binBE.ui8=new Uint8Array(8),t._binBE.i16=new Int16Array(t._binBE.ui8.buffer),t._binBE.i32=new Int32Array(t._binBE.ui8.buffer),t._binBE.ui32=new Uint32Array(t._binBE.ui8.buffer),t._binBE.fl32=new Float32Array(t._binBE.ui8.buffer),t._binBE.fl64=new Float64Array(t._binBE.ui8.buffer),t._binLE={nextZero:t._binBE.nextZero,readUshort:function(t,e){return t[e+1]<<8|t[e]},readShort:function(e,i){var r=t._binBE.ui8;return r[0]=e[i+0],r[1]=e[i+1],t._binBE.i16[0]},readInt:function(e,i){var r=t._binBE.ui8;return r[0]=e[i+0],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],t._binBE.i32[0]},readUint:function(e,i){var r=t._binBE.ui8;return r[0]=e[i+0],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],t._binBE.ui32[0]},readASCII:t._binBE.readASCII,readFloat:function(e,i){for(var r=t._binBE.ui8,n=0;n<4;n++)r[n]=e[i+n];return t._binBE.fl32[0]},readDouble:function(e,i){for(var r=t._binBE.ui8,n=0;n<8;n++)r[n]=e[i+n];return t._binBE.fl64[0]},writeUshort:function(t,e,i){t[e]=255&i,t[e+1]=i>>8&255},writeInt:function(e,i,r){var n=t._binBE.ui8;t._binBE.i32[0]=r,e[i+0]=n[0],e[i+1]=n[1],e[i+2]=n[2],e[i+3]=n[3]},writeUint:function(t,e,i){t[e]=i>>>0&255,t[e+1]=i>>>8&255,t[e+2]=i>>>16&255,t[e+3]=i>>>24&255},writeASCII:t._binBE.writeASCII},t._copyTile=function(t,e,i,r,n,a,o,s){for(var h=Math.min(e,n-o),l=Math.min(i,a-s),u=0;u<l;u++)for(var c=(s+u)*n+o,f=u*e,d=0;d<h;d++)r[c+d]=t[f+d]},t.LosslessJpegDecode=function(){var t,e;function i(){return t[e++]}function r(){return t[e++]<<8|t[e++]}function n(t){for(var e=i(),r=[0,0,0,255],n=[],o=0;o<16;o++)n[o]=i();for(o=0;o<16;o++)for(var s=0;s<n[o];s++){r[a(r,0,o+1,1)+3]=i()}var h=new Uint8Array(256);t[e]=[new Uint8Array(r),h];for(o=0;o<256;o++){for(var l=8,u=o,c=0;255==r[c+3]&&0!=l;)c=r[c+(u>>--l&1)];h[o]=c}}function a(t,e,i,r){if(255!=t[e+3])return 0;if(0==i)return e;for(var n=0;n<2;n++){0==t[e+n]&&(t[e+n]=t.length,t.push(0,0,r,255));var o=a(t,t[e+n],i-1,r+1);if(0!=o)return o}return 0}function o(t){for(var e=t.b,i=t.f;e<25&&t.a<t.d;){var r=t.data[t.a++];255!=r||t.c||t.a++,i=i<<8|r,e+=8}if(e<0)throw"e";t.b=e,t.f=i}function s(t,e){return e.b<t&&o(e),e.f>>(e.b-=t)&65535>>16-t}function h(t,e){var i=t[0],r=0,n=255;e.b<16&&o(e);var a=e.f>>e.b-8&255;for(n=i[(r=t[1][a])+3],e.b-=i[r+2];255==n;)n=i[(r=i[r+(e.f>>--e.b&1)])+3];return n}function l(t,e){return t<32768>>16-e&&(t+=1-(1<<e)),t}function u(t,e){var i=h(t,e);return 0==i?0:16==i?-32768:l(s(i,e),i)}function c(t,e,i,r,n,a){for(var o=0,s=0;s<a;s++){for(var h=s*e,l=0;l<e;l+=n){o++;for(var c=0;c<n;c++)t[h+l+c]=u(r[c],i)}if(0!=i.e&&o%i.e==0&&0!=s){for(var f=i.a,d=i.data;255!=d[f]||!(208<=d[f+1]&&d[f+1]<=215);)f--;i.a=f+2,i.f=0,i.b=0}}}function f(t,e){return l(s(t,e),t)}function d(t,e,i,r,n,a,o,s){for(var h=i*o,l=n;l<a;l++)t[l]+=1<<s-1;for(var u=o;u<h;u+=o)for(l=n;l<a;l++)t[u+l]+=t[u+l-o];for(var c=1;c<r;c++){var f=c*h;for(l=n;l<a;l++)t[f+l]+=t[f+l-h];for(u=o;u<h;u+=o)for(l=n;l<a;l++){var d=f+u+l,p=d-h,m=t[d-o],g=0;if(0==e)g=0;else if(1==e)g=m;else if(2==e)g=t[p];else if(3==e)g=t[p-o];else if(4==e)g=m+(t[p]-t[p-o]);else if(5==e)g=m+(t[p]-t[p-o]>>>1);else if(6==e)g=t[p]+(m-t[p-o]>>>1);else{if(7!=e)throw e;g=m+t[p]>>>1}t[d]+=g}}}return function(a){if(t=a,e=0,65496!=r())throw"e";for(var o=[],s=0,l=0,u=0,p=[],m=[],g=[],_=0,b=0,y=0;;){var w=r();if(65535!=w){var v=r();if(65475==w){l=i(),b=r(),y=r(),_=i();for(var x=0;x<_;x++){var k=i(),E=i();if(0!=i())throw"e";o[k]=[x,E>>4,15&E]}}else if(65476==w)for(var S=e+v-2;e<S;)n(m);else{if(65498==w){e++;for(x=0;x<_;x++){var M=o[i()];g[M[0]]=m[i()>>>4],p[M[0]]=M.slice(1)}s=i(),e+=2;break}65501==w?u=r():e+=v-2}}else e--}var A=new(l>8?Uint16Array:Uint8Array)(b*y*_),I={b:0,f:0,c:8==s,a:e,data:t,d:t.length,e:u};if(I.c)!function(i,r,n,a,o){for(var s=t.length-e,l=0;l<s;l+=4){var u=t[e+l];t[e+l]=t[e+l+3],t[e+l+3]=u,u=t[e+l+1],t[e+l+1]=t[e+l+2],t[e+l+2]=u}for(var c=0;c<o;c++)for(var d=32768,p=32768,m=0;m<r;m+=2){var g=h(a,n),_=h(a,n);0!=g&&(d+=f(g,n)),0!=_&&(p+=f(_,n)),i[c*r+m]=65535&d,i[c*r+m+1]=65535&p}}(A,y*_,I,g[0],b);else{var z=[],P=0,T=0;for(x=0;x<_;x++){var R=p[x];(G=R[0])>P&&(P=G),(j=R[1])>T&&(T=j),z.push(G*j)}if(1!=P||1!=T){if(3!=_||1!=z[1]||1!=z[2])throw"e";if(2!=P||1!=T&&2!=T)throw"e";var O=[],B=0;for(x=0;x<_;x++){for(var C=0;C<z[x];C++)O.push(g[x]);B+=z[x]}var L=y/P,D=b/T,U=L*D;c(A,L*B,I,O,B,D),d(A,s,L,D,B-2,B,B,l);var F=new Uint16Array(U*z[0]);if(2==P&&2==T){for(x=0;x<U;x++)F[4*x]=A[6*x],F[4*x+1]=A[6*x+1],F[4*x+2]=A[6*x+2],F[4*x+3]=A[6*x+3];d(F,s,4*L,D,0,1,1,l);for(x=0;x<U;x++)A[6*x]=F[4*x],A[6*x+1]=F[4*x+1],A[6*x+2]=F[4*x+2],A[6*x+3]=F[4*x+3]}if(2==P&&1==T){for(x=0;x<U;x++)F[2*x]=A[4*x],F[2*x+1]=A[4*x+1];d(F,s,2*L,D,0,1,1,l);for(x=0;x<U;x++)A[4*x]=F[2*x],A[4*x+1]=F[2*x+1]}for(var N=A.slice(0),j=0;j<b;j++)if(2==T)for(var G=0;G<y;G++){var Z=((j>>>1)*L+(G>>>1))*B,H=2*(1&j)+(1&G);A[$=(j*y+G)*_]=N[Z+H],A[$+1]=N[Z+4],A[$+2]=N[Z+5]}else for(G=0;G<y;G++){var $;Z=(j*L+(G>>>1))*B,H=1&G;A[$=(j*y+G)*_]=N[Z+H],A[$+1]=N[Z+2],A[$+2]=N[Z+3]}}else if(c(A,y*_,I,g,_,b),0==u)d(A,s,y,b,0,_,_,l);else{var W=Math.floor(u/y);for(j=0;j<b;j+=W){var q=A.slice(j*y*_,(j+W)*y*_);d(q,s,y,W,0,_,_,l),A.set(q,j*y*_)}}}return A}}(),function(){var e=2,i=4,r=5,n=6,a=7,o=12,s=13,h=14,l=15,u=17;function c(t){var e={c:new Int8Array(2<<t.u)};return function(t,e,i){var r=[e,3*e+18,5*e+67,7*e+276,i];t.o=e,t.w=(r[4]+2*e)/(2*e+1)+1|0,t.v=Math.ceil(Math.log2(t.w)),t.t=9,function(t,e){for(var i=-e[4],r=0;i<=e[4];r++,i++)t[r]=i<=-e[3]?-4:i<=-e[2]?-3:i<=-e[1]?-2:i<-e[0]?-1:i<=e[0]?0:i<e[1]?1:i<e[2]?2:i<e[3]?3:4}(t.c,r)}(e,0,t.g),e}function f(t){for(var e=[[],[],[]],i=Math.max(2,t.w+32>>>6),r=0;r<3;r++)for(var n=0;n<41;n++)e[r][n]=[i,1];return e}function d(t,e){var i=0,r=8-t.a;if(t.j,t.a,e){if(e>=r)do{i<<=r,e-=r,i|=t[t.j]&(1<<r)-1,t.j++,r=8}while(e>=8);e&&(i<<=e,r-=e,i|=t[t.j]>>>r&(1<<e)-1),t.a=8-r}return i}function p(t,e,i,r,n,a,o,s){null==s&&(s=0);var h,l,u,c,f,p,m=a+1,g=m%2,_=0,b=r[n],y=r[n-1],w=r[n-2][m],v=y[m-1],x=y[m],k=y[m+1],E=b[m-1],S=b[m+1],M=Math.abs;if(g&&(u=M(k-x),c=M(w-x),f=M(v-x)),g){if(p=(p=u>f&&c<u?w+v:u<f&&c<f?w+k:k+v)+2*x>>>2,s)return void(b[m]=p);h=e.t*e.c[t.g+x-w]+e.c[t.g+v-x]}else p=x>v&&x>k||x<v&&x<k?S+E+2*x>>>2:E+S>>>1,h=e.t*e.c[t.g+x-v]+e.c[t.g+v-E];l=M(h);var A=function(t){for(var e=-1,i=0;!i;e++)i=t[t.j]>>>7-t.a&1,t.a++,t.a&=7,t.a||t.j++;return e}(i);if(A<t.n-e.v-1){var I=function(t,e){var i=0;if(e<t)for(;i<=14&&e<<++i<t;);return i}(o[l][0],o[l][1]);_=d(i,I)+(A<<I)}else _=d(i,e.v)+1;_=1&_?-1-(_>>>1):_>>>1,o[l][0]+=M(_),o[l][1]==t.f&&(o[l][0]>>>=1,o[l][1]>>>=1),o[l][1]++,p=h<0?p-_:p+_,t.i&&(p<0?p+=e.w:p>t.g&&(p-=e.w)),b[m]=p>=0?Math.min(p,t.g):0}function m(t,e,i){for(var r=t[0].length,n=e;n<=i;n++)t[n][0]=t[n-1][1],t[n][r-1]=t[n-1][r-2]}function g(t){m(t,a,o),m(t,e,i),m(t,l,u)}function _(t,e,r,n,a,o,h,l,u,c,f,d,m){for(var _=0,b=1,y=a<s&&a>i;b<t.m;)_<t.m&&(p(t,e,r,n,a,_,h[u],t.h&&(y&&c||!y&&(f||(_&d)==m))),p(t,e,r,n,o,_,h[u],t.h&&(!y&&c||y&&(f||(_&d)==m))),_+=2),_>8&&(p(t,e,r,n,a,b,l[u]),p(t,e,r,n,o,b,l[u]),b+=2);g(n)}function b(t,r,n,s,h,c){_(t,r,n,s,e,a,h,c,0,0,1,0,8),_(t,r,n,s,8,l,h,c,1,0,1,0,8),_(t,r,n,s,3,9,h,c,2,1,0,3,0),_(t,r,n,s,10,16,h,c,0,0,0,3,2),_(t,r,n,s,i,11,h,c,1,0,0,3,2),_(t,r,n,s,o,u,h,c,2,1,0,3,0)}function y(t,i,r,n,o,s){var h=s.length,u=t.l;o+1==t.s&&(u=t.e-o*t.l);for(var c=6*t.e*n+o*t.l,f=0;f<6;f++){for(var d=0;d<u;d++){var p,m=s[f%h][d%h];p=0==m?e+(f>>>1):2==m?l+(f>>>1):a+f;var g=t.h?(2*d/3&2147483646|d%3&1)+(d%3>>>1):d>>>1;i[c+d]=r[p][g+1]}c+=t.e}}t._decompressRAF=function(a,l){var d=function(e){var i=t._binBE.readUshort,r={b:i(e,0),i:e[2],C:e[3],u:e[4],q:i(e,5),k:i(e,7),e:i(e,9),l:i(e,11),s:e[13],d:i(e,14)};if(18771!=r.b||r.i>1||r.q<6||r.q%6||r.e<768||r.e%24||768!=r.l||r.k<r.l||r.k%r.l||r.k-r.e>=r.l||r.s>16||r.s!=r.k/r.l||r.s!=Math.ceil(r.e/r.l)||r.d!=r.q/6||12!=r.u&&14!=r.u&&16!=r.u||16!=r.C&&0!=r.C)throw"Invalid data";if(0==r.i)throw"Not implemented. We need this file!";return r.h=16==r.C,r.m=0|(r.h?2*r.l/3:r.l>>>1),r.A=r.m+2,r.f=64,r.g=(1<<r.u)-1,r.n=4*r.u,r}(a),p=function(e,i){var r=new Array(i.s),n=4*i.s,a=16+n;12&n&&(a+=16-(12&n));for(var o=0,s=16;o<i.s;s+=4){var h=t._binBE.readUint(e,s);r[o]=e.slice(a,a+h),r[o].j=0,r[o].a=0,a+=h,o++}if(a!=e.length)throw"Invalid data";return r}(a,d),m=c(d),_=new Int16Array(d.e*d.q);null==l&&(l=d.h?[[1,1,0,1,1,2],[1,1,2,1,1,0],[2,0,1,0,2,1],[1,1,2,1,1,0],[1,1,0,1,1,2],[0,2,1,2,0,1]]:[[0,1],[3,2]]);for(var w=[[0,3],[1,i],[r,11],[n,o],[s,16],[h,u]],v=[],x=0;x<18;x++)v[x]=new Uint16Array(d.A);for(var k=0;k<d.s;k++){var E=f(m),S=f(m);for(x=0;x<18;x++)for(var M=0;M<d.A;M++)v[x][M]=0;for(var A=0;A<d.d;A++){b(d,m,p[k],v,E,S);for(x=0;x<6;x++)for(M=0;M<d.A;M++)v[w[x][0]][M]=v[w[x][1]][M];y(d,_,v,A,k,l);for(x=e;x<18;x++)if(-1==[r,n,s,h].indexOf(x))for(M=0;M<d.A;M++)v[x][M]=0;g(v)}}return _}}()}(e,Pn())}()}(Nr);var Tn=e(Nr.exports);function Rn(t){return"number"==typeof t?t:t instanceof Uint8Array?t[0]:"string"==typeof t[0]?parseInt(t[0]):t[0]}function On(){return{mime:"image/tiff",encode:t=>{const e=Tn.encodeImage(t.data,t.width,t.height);return _.from(e)},decode:t=>{const e=Tn.decode(t),i=e[0];if(!i)throw new Error("No page found in TIFF");if(!i.t256)throw new Error("No image width found in TIFF");if(!i.t257)throw new Error("No image height found in TIFF");e.forEach((e=>{Tn.decodeImage(t,e)}));const r=Tn.toRGBA8(i);return{data:_.from(r),width:Rn(i.t256),height:Rn(i.t257)}}}}function Bn(t){const e=Object.values(t).filter((t=>"number"==typeof t)),i=Object.entries(t).filter((([t,i])=>-1===e.indexOf(+t))).map((([t,e])=>e));return i}function Cn(t,e="|"){return t.map((t=>ia(t))).join(e)}function Ln(t,e){return"bigint"==typeof e?e.toString():e}class Dn{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function Un(t){return new Dn(t)}function Fn(t){const e=t.startsWith("^")?1:0,i=t.endsWith("$")?t.length-1:t.length;return t.slice(e,i)}function Nn(t,e,i){Object.defineProperty(t,e,{value:i,writable:!0,enumerable:!0,configurable:!0})}function jn(t){const e=Object.getOwnPropertyDescriptor(t,"shape");return e?.get?e.get.raw:e?.value}function Gn(t){return jn(t._zod.def)??t._zod.def.shape}function Zn(t,e,i){Object.defineProperty(t,e,{get(){const t=i();return Nn(this,e,t),t},enumerable:!0,configurable:!0})}function Hn(t,e,i){e in t?Nn(t,e,i):t[e]=i}function $n(t,e,i,r){const n=Gn(e);for(const a of i){const i=Object.getOwnPropertyDescriptor(n,a);i.enumerable&&(i.get?Zn(t,a,(()=>{const t=e._zod.def.shape[a];return r?r(t,a):t})):Hn(t,a,r?r(i.value,a):i.value))}}function Wn(...t){const e={};for(const i of t){const t=Object.getOwnPropertyDescriptors(i);Object.assign(e,t)}return Object.defineProperties({},e)}const qn="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Yn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}const Vn=Un((()=>{if(La.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(t){return!1}}));function Jn(t){if(!1===Yn(t))return!1;const e=t.constructor;if(void 0===e)return!0;if("function"!=typeof e)return!0;const i=e.prototype;return!1!==Yn(i)&&!1!==Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")}function Kn(t){return Jn(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const Xn=new Set(["string","number","symbol"]);function Qn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ta(t,e,i){const r=new t._zod.constr(e??t._zod.def);return e&&!i?.parent||(r._zod.parent=t),r}function ea(t){const e=t;if(!e)return{};if("string"==typeof e)return{error:()=>e};if(void 0!==e?.message){if(void 0!==e?.error)throw new 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 ia(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}const ra=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),na={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function aa(t,e){const i=Gn(t),r=[];for(const t of Reflect.ownKeys(e)){if(!Object.getOwnPropertyDescriptor(i,t)?.enumerable)throw new Error(`Unrecognized key: "${String(t)}"`);e[t]&&r.push(t)}return r}function oa(t,e){const i={};return $n(i,t,Reflect.ownKeys(Gn(t))),function(t,e){for(const i of Reflect.ownKeys(e)){const r=Object.getOwnPropertyDescriptor(e,i);r.enumerable&&(r.get?Zn(t,i,(()=>e[i])):Hn(t,i,r.value))}}(i,e),i}function sa(t,e,i,r="partial"){const n=e._zod.def.checks;if(n&&n.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const a=i?new Set(aa(e,i)):void 0,o={};return $n(o,e,Reflect.ownKeys(Gn(e)),t&&((e,i)=>a&&!a.has(i)?e:new t({type:"optional",innerType:e}))),ta(e,Wn(e._zod.def,{shape:o,checks:[]}))}function ha(t,e=0){if(!0===t.aborted)return!0;for(let i=e;i<t.issues.length;i++)if(!0!==t.issues[i]?.continue)return!0;return!1}function la(t,e=0){if(!0===t.aborted)return!0;for(let i=e;i<t.issues.length;i++)if(!1===t.issues[i]?.continue)return!0;return!1}function ua(t,e){return e.map((e=>{var i;return(i=e).path??(i.path=[]),e.path.unshift(t),e}))}function ca(t){return"string"==typeof t?t:t?.message}function fa(t){const e=[];for(const i of t??[]){const t=i._zod.def;if(!/_(length|size)$|_equals$/.test(t.check))break;const r=t.maximum??t.length??t.size;r>=0&&e.push([r,i])}return e}function da(t,e,i){var r;for(let n=e;n<t.length;n++)(r=t[n]).schema??(r.schema=i)}function pa(t,e,i){var r;const n=t.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(r=t).schema??(r.schema=t.inst):t.schema=t.inst);const a=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:ca(t.inst?._zod.def?.error?.(t))??ca(a?.(t))??ca(e?.error?.(t))??ca(i.customError?.(t))??ca(i.localeError?.(t))??"Invalid input",s={};for(const e of Object.keys(t))"inst"!==e&&"schema"!==e&&"continue"!==e&&"input"!==e&&"__proto__"!==e&&(s[e]=t[e]);return s.path??(s.path=[]),s.message=o,e?.reportInput&&(s.input=t.input),s}const ma=/[\uD800-\uDBFF]/;function ga(t){const e=t.length;if(!ma.test(t))return e;let i=e;for(let r=0;r<e-1;r++)55296==(64512&t.charCodeAt(r))&&56320==(64512&t.charCodeAt(r+1))&&(i--,r++);return i}function _a(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function ba(...t){const[e,i,r]=t;return"string"==typeof e?{message:e,code:"custom",input:i,inst:r}:{...e}}function ya(t,e,i,r=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:r,value:i}),i}function wa(t,e,i){return ya(t,e,i,!1)}function va(t,e){for(const i in t){const r=t[i];Object.defineProperty(e,i,{configurable:!0,enumerable:!0,get(){return ya(this,i,r(this))},set(t){ya(this,i,t)}})}return e}function xa(t,e,i){Object.defineProperty(t,e,{configurable:!0,get(){return null==this?i:ya(this,e,i.bind(this))},set(t){ya(this,e,t)}})}let ka,Ea=!1;const Sa={configurable:!0,get(){Ea=!0}};function Ma(t,e,i){const r=Object.getPrototypeOf(t._zod);e in r&&ka!==t._zod?ka=void 0:(ka=t._zod,Object.defineProperty(r,e,{configurable:!0,get(){Object.defineProperty(this,e,Sa);const t=Ea;Ea=!1;try{const r=i(this);return Ea?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:r}),Ea=Ea||t,r}catch(i){throw delete this[e],Ea=Ea||t,i}},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}}))}function Aa(t,e,i,r){const n=function(t,e){const i=Object.getPrototypeOf(t);return e in i?void 0:i}(t,e);n&&Object.defineProperty(n,e,{configurable:!0,get(){const t={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,e,t),t.value=i(this),Object.defineProperty(this,e,t),t.value},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:r,value:t})}})}const Ia="~constantCatch";function za(t){const e=()=>t;return e[Ia]=!0,e}var Pa;const Ta={value:void 0,enumerable:!1};let Ra="captureStackTrace"in Error?Error:null;function Oa(t,e,i,r){function n(t){this.def=t,this.constr=u,this.traits=new Set}n.prototype={};const a=i,o=a&&new WeakSet;function s(i,r){if(i._zod){if(i._zod.traits.has(t))return}else{Ta.value=new n(r);try{Object.defineProperty(i,"_zod",Ta)}finally{Ta.value=void 0}}if(i._zod.traits.add(t),e(i,r),o){const t=Object.getPrototypeOf(i),e=i._zod.constr.prototype;let r=t;for(;r&&r!==e;)r=Object.getPrototypeOf(r);const n=r??t;o.has(n)||(o.add(n),function(t,e){for(const i in e){const r=Object.getOwnPropertyDescriptor(e,i);r.get?Object.defineProperty(t,i,{...r,enumerable:!1}):xa(t,i,r.value)}}(n,a))}const s=u.prototype;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(t in i||(i[t]=s[t].bind(i)))}const h=r?.Parent??Object;class l extends h{}function u(t){const e=r?.Parent?function(t){const e=Ra;if(e){const i=e.stackTraceLimit;if("number"==typeof i){try{e.stackTraceLimit=0}catch{return Ra=null,new t}try{return new t}finally{e.stackTraceLimit=i}}}return new t}(l):this;s(e,t);const i=e._zod.deferred;if(i){for(const t of i)t();e._zod.deferred=void 0}const n=globalThis.__zod_globalConfig?.postProcessor;return n&&n(e),e}return Object.defineProperty(l,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:e=>!!(r?.Parent&&e instanceof r.Parent)||e?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class Ba extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ca extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Pa=globalThis).__zod_globalConfig??(Pa.__zod_globalConfig={});const La=globalThis.__zod_globalConfig;function Da(t){return t&&Object.assign(La,t),La}const Ua={get:function(){const t=this._zod;return t.message??(t.message=JSON.stringify(t.def,Ln,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},Fa={value:void 0,enumerable:!1},Na=new WeakSet([Object.prototype,Error.prototype]),ja=(t,e)=>{t.name="$ZodError",Fa.value=e,Object.defineProperty(t,"issues",Fa),Fa.value=void 0,Object.defineProperty(t,"message",Ua);const i=Object.getPrototypeOf(t);Na.has(i)||(Na.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){const t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},Ga=Oa("$ZodError",ja),Za=Oa("$ZodError",ja,void 0,{Parent:Error});function Ha(t,e){return{callee:e?.callee??t,Err:e?.Err}}const $a=t=>{const e=(i,r,n,a)=>{const o=n?{...n,async:!1}:{async:!1},s=i._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ba;if(s.issues.length){const i=new(a?.Err??t)(s.issues.map((t=>pa(t,o,Da()))));throw qn(i,a?.callee??e),i}return s.value};return e},Wa=$a(Za),qa=t=>{const e=async(i,r,n,a)=>{const o=n?{...n,async:!0}:{async:!0};let s=i._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const i=new(a?.Err??t)(s.issues.map((t=>pa(t,o,Da()))));throw qn(i,a?.callee??e),i}return s.value};return e},Ya=qa(Za),Va=t=>(e,i,r)=>{const n=r?{...r,async:!1}:{async:!1},a=e._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Ba;return a.issues.length?Ja(t,a.issues,n):{success:!0,data:a.value}};function Ja(t,e,i){let r;return{success:!1,get error(){return r||(r=new t(e.map((t=>pa(t,i,Da())))),e=void 0,i=void 0),r},set error(t){r=t,e=void 0,i=void 0}}}const Ka=t=>async(e,i,r)=>{const n=r?{...r,async:!0}:{async:!0};let a=e._zod.run({value:i,issues:[]},n);return a instanceof Promise&&(a=await a),a.issues.length?Ja(t,a.issues,n):{success:!0,data:a.value}},Xa=Symbol.for("zod.compile.invalid"),Qa=Symbol.for("zod.compile.fallback"),to=(t,e,i)=>{const r=t._zod.bag.validator;if(void 0!==r){if(r(e)!==Xa)return!0;if(!0===r.definite&&void 0===i)return!1}return function(t,e,i){const r=i?{...i,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=t._zod.bag.fallbackRun;let a;n?(r[Qa]=!0,a=n({value:e,issues:[]},r)):a=t._zod.run({value:e,issues:[]},r);if(a instanceof Promise)throw new Ba;return 0===a.issues.length}(t,e,i)};const eo=t=>{const e=$a(t),i=(t,r,n,a)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return e(t,r,o,Ha(i,a))};return i},io=t=>{const e=$a(t),i=(t,r,n,a)=>e(t,r,n,Ha(i,a));return i},ro=t=>{const e=qa(t),i=async(t,r,n,a)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return await e(t,r,o,Ha(i,a))};return i},no=t=>{const e=qa(t),i=async(t,r,n,a)=>await e(t,r,n,Ha(i,a));return i},ao=t=>(e,i,r)=>{const n=r?{...r,direction:"backward"}:{direction:"backward"};return Va(t)(e,i,n)},oo=t=>(e,i,r)=>Va(t)(e,i,r),so=t=>async(e,i,r)=>{const n=r?{...r,direction:"backward"}:{direction:"backward"};return Ka(t)(e,i,n)},ho=t=>async(e,i,r)=>Ka(t)(e,i,r),lo=/^[cC][0-9a-z]{6,}$/,uo=/^[0-9a-z]+$/,co=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,fo=/^[0-9a-vA-V]{20}$/,po=/^[A-Za-z0-9]{27}$/,mo=/^[a-zA-Z0-9_-]{21}$/;const go=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_o=/^([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})$/,bo=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,yo=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const wo=/^(?:(?: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])$/,vo=/^(([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}|:))$/,xo=/^((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])$/,ko=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Eo=/^https?$/,So=/^\+[1-9]\d{6,14}$/,Mo="(?:(?:\\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])))";function Ao(t){return new RegExp(`^${t}$`)}const Io=Ao(Mo);function zo(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${e}`:0===t.precision?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Po=/^[\s\S]{0,}$/,To=/^-?\d+(?:\.\d+)?$/,Ro=/^(?:true|false)$/i,Oo=/^[^A-Z]*$/,Bo=/^[^a-z]*$/,Co=Oa("$ZodCheck",((t,e)=>{var i;t._zod??(t._zod={}),t._zod.def=e,(i=t._zod).onattach??(i.onattach=[])})),Lo=t=>{const e=t.value;return!(i=e,null==i||void 0===e.length);var i},Do={number:"number",bigint:"bigint",object:"date"},Uo=Oa("$ZodCheckLessThan",((t,e)=>{Co.init(t,e);const i=Do[typeof e.value];t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:Do[typeof r.value]??i,code:"too_big",maximum:"object"==typeof e.value?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}})),Fo=Oa("$ZodCheckGreaterThan",((t,e)=>{Co.init(t,e);const i=Do[typeof e.value];t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:Do[typeof r.value]??i,code:"too_small",minimum:"object"==typeof e.value?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}})),No=Oa("$ZodCheckMultipleOf",((t,e)=>{Co.init(t,e),t._zod.check=i=>{if(typeof i.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof i.value?e.value!==BigInt(0)&&i.value%e.value===BigInt(0):0===function(t,e){const i=t/e,r=Math.round(i),n=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-r)<n?0:i-r}(i.value,e.value))||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:e.value,input:i.value,inst:t,continue:!e.abort})}})),jo=Oa("$ZodCheckNumberFormat",((t,e)=>{Co.init(t,e),e.format=e.format||"float64";const i=e.format?.includes("int"),r=i?"int":"number",[n,a]=ra[e.format];t._zod.check=o=>{const s=o.value;if(i){if(!Number.isInteger(s))return void o.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}))}s<n&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:t,continue:!e.abort})}})),Go=Oa("$ZodCheckMaxLength",((t,e)=>{var i;Co.init(t,e),(i=t._zod.def).when??(i.when=Lo),t._zod.check=i=>{const r=i.value,n=r.length;if(("string"==typeof r&&n>e.maximum?ga(r):n)<=e.maximum)return;const a=_a(r);i.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:r,inst:t,continue:!e.abort})}})),Zo=Oa("$ZodCheckMinLength",((t,e)=>{var i;Co.init(t,e),(i=t._zod.def).when??(i.when=Lo),t._zod.check=i=>{const r=i.value,n=r.length;if(("string"==typeof r&&n>=e.minimum&&n<2*e.minimum?ga(r):n)>=e.minimum)return;const a=_a(r);i.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:r,inst:t,continue:!e.abort})}})),Ho=Oa("$ZodCheckLengthEquals",((t,e)=>{var i;Co.init(t,e),(i=t._zod.def).when??(i.when=Lo),t._zod.check=i=>{const r=i.value,n=r.length,a="string"==typeof r&&n>=e.length&&n<=2*e.length?ga(r):n;if(a===e.length)return;const o=_a(r),s=a>e.length;i.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}})),$o=Oa("$ZodCheckStringFormat",((t,e)=>{var i,r;Co.init(t,e),e.pattern?(i=t._zod).check??(i.check=i=>{e.pattern.lastIndex=0,e.pattern.test(i.value)||i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})})),Wo=Oa("$ZodCheckRegex",((t,e)=>{$o.init(t,e),t._zod.check=i=>{e.pattern.lastIndex=0,e.pattern.test(i.value)||i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}})),qo=Oa("$ZodCheckLowerCase",((t,e)=>{e.pattern??(e.pattern=Oo),$o.init(t,e)})),Yo=Oa("$ZodCheckUpperCase",((t,e)=>{e.pattern??(e.pattern=Bo),$o.init(t,e)})),Vo=Oa("$ZodCheckIncludes",((t,e)=>{Co.init(t,e);const i=Qn(e.includes),r=new RegExp("number"==typeof e.position?`^.{${e.position},}${i}`:i);e.pattern=r,t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}})),Jo=Oa("$ZodCheckStartsWith",((t,e)=>{Co.init(t,e);const i=new RegExp(`^${Qn(e.prefix)}.*`);e.pattern??(e.pattern=i),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}})),Ko=Oa("$ZodCheckEndsWith",((t,e)=>{Co.init(t,e);const i=new RegExp(`.*${Qn(e.suffix)}$`);e.pattern??(e.pattern=i),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}}));function Xo(t,e,i){t.issues.length&&e.issues.push(...ua(i,t.issues))}const Qo=Oa("$ZodCheckProperties",((t,e)=>{let i;Co.init(t,e),wa(t,Symbol.iterator,(function*(){yield t})),t._zod.check=r=>{if(null==r.value)return void r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:t});i??(i=Reflect.ownKeys(e.shape).map((t=>[t,e.shape[t]])));const n=r.value;let a;for(const[t,e]of i){const i=e._zod.run({value:n[t],issues:[]},{});i instanceof Promise?(a??(a=[]),a.push(i.then((e=>Xo(e,r,t))))):Xo(i,r,t)}return a?Promise.all(a).then((()=>{})):void 0}})),ts=Oa("$ZodCheckOverwrite",((t,e)=>{Co.init(t,e),t._zod.check=t=>{t.value=e.tx(t.value)}}));class es{constructor(t=[],e={}){this.content=[],this.indent=0,this.args=t,this.closed=e}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t)return t(this,{execution:"sync"}),void t(this,{execution:"async"});const e=t.split("\n").filter((t=>t)),i=Math.min(...e.map((t=>t.length-t.trimStart().length))),r=e.map((t=>t.slice(i))).map((t=>" ".repeat(2*this.indent)+t));for(const t of r)this.content.push(t)}compile(){const t=Function,e=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${e.join("\n")}\n};`)(...Object.values(this.closed))}}const is={major:4,minor:6,patch:7},rs=Oa("$ZodType",((t,e)=>{var i;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=is;const r=t._zod.def.checks,n=t._zod.traits.has("$ZodCheck")?[t,...r??[]]:r?.length?[...r]:[];for(const e of n)for(const i of e._zod.onattach)i(t);if(0===n.length)(i=t._zod).deferred??(i.deferred=[]),t._zod.deferred?.push((()=>{t._zod.run=t._zod.parse}));else{const e=(e,i,r)=>{if(e.memo)return e;let n,a=ha(e);for(const o of i){if(o._zod.def.when){if(la(e))continue;if(!o._zod.def.when(e))continue}else if(a)continue;const i=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&!1===r?.async)throw new Ba;if(n||s instanceof Promise)n=(n??Promise.resolve()).then((async()=>{await s;e.issues.length!==i&&(da(e.issues,i,t),a||(a=ha(e,i)))}));else{if(e.issues.length===i)continue;da(e.issues,i,t),a||(a=ha(e,i))}}return n?n.then((()=>e)):e},i=(i,r,a)=>{if(ha(i))return i.aborted=!0,i;const o=e(r,n,a);if(o instanceof Promise){if(!1===a.async)throw new Ba;return o.then((e=>t._zod.parse(e,a)))}return t._zod.parse(o,a)};t._zod.run=(r,a)=>{if(a.skipChecks)return t._zod.parse(r,a);if("backward"===a.direction){const e=t._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return e instanceof Promise?e.then((t=>i(t,r,a))):i(e,r,a)}const o=t._zod.parse(r,a);if(o instanceof Promise){if(!1===a.async)throw new Ba;return o.then((t=>e(t,n,a)))}return e(o,n,a)}}}),{get"~standard"(){return wa(this,"~standard",as(this))},set"~standard"(t){ya(this,"~standard",t)}}),ns=(t,e)=>t.issues.length?{issues:t.issues.map((t=>pa(t,e,Da())))}:{value:t.value};function as(t){return{validate:e=>{const i={async:!1};try{const r=t._zod.run({value:e,issues:[]},i);if(!(r instanceof Promise))return ns(r,i)}catch(t){}return async function(t,e){const i={async:!0};return ns(await t._zod.run({value:e,issues:[]},i),i)}(t,e)},vendor:"zod",version:1}}const os=Oa("$ZodString",((t,e)=>{rs.init(t,e),t._zod.pattern=e.pattern??Po,t._zod.parse=(i,r)=>{if(e.coerce)try{i.value=String(i.value)}catch(r){}return"string"==typeof i.value||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}})),ss=Oa("$ZodStringFormat",((t,e)=>{$o.init(t,e),os.init(t,e)})),hs=Oa("$ZodGUID",((t,e)=>{e.pattern??(e.pattern=_o),ss.init(t,e)})),ls=Oa("$ZodUUID",((t,e)=>{if(e.version){const t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(void 0===t)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=bo(t))}else e.pattern??(e.pattern=bo());ss.init(t,e)})),us=Oa("$ZodEmail",((t,e)=>{e.pattern??(e.pattern=yo),ss.init(t,e)})),cs=1,fs=2;function ds(t){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(t):(new URL(t),!0)}catch{return!1}}function ps(t,e){return"normalize"in e||"hostname"in e||"protocol"in e?function(t,e){if(!e.normalize&&e.protocol?.source===Eo.source&&!/^https?:\/\//i.test(t))return cs;try{if("undefined"!=typeof URL){const e=URL;if("function"==typeof e.parse)return e.parse(t)??fs}return new URL(t)}catch{return fs}}(t,e):ds(t)||fs}const ms=/[\t\n\r]/g;function gs(t){return t.replace(ms,"")}const _s=Oa("$ZodURL",((t,e)=>{ss.init(t,e),t._zod.check=i=>{try{const r=i.value.trim(),n=ps(r,e);return n===cs?void i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:t,continue:!e.abort}):n===fs?void i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:t,continue:!e.abort}):!0===n?void(i.value=gs(r)):(e.hostname&&!function(t,e){return e.lastIndex=0,e.test(t.hostname)}(n,e.hostname)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:i.value,inst:t,continue:!e.abort}),e.protocol&&!function(t,e){return e.lastIndex=0,e.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}(n,e.protocol)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:i.value,inst:t,continue:!e.abort}),void(i.value=e.normalize?n.href:gs(r)))}catch(r){i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:t,continue:!e.abort})}}})),bs=Oa("$ZodEmoji",((t,e)=>{e.pattern??(e.pattern=new RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),ss.init(t,e)})),ys=Oa("$ZodNanoID",((t,e)=>{if(void 0!==e.length&&(!Number.isInteger(e.length)||e.length<1))throw new Error(`Invalid nanoid length: ${e.length}`);var i;e.pattern??(e.pattern=void 0===e.length?mo:(i=e.length,new RegExp(`^[a-zA-Z0-9_-]{${i}}$`))),ss.init(t,e)})),ws=Oa("$ZodCUID",((t,e)=>{e.pattern??(e.pattern=lo),ss.init(t,e)})),vs=Oa("$ZodCUID2",((t,e)=>{e.pattern??(e.pattern=uo),ss.init(t,e)})),xs=Oa("$ZodULID",((t,e)=>{e.pattern??(e.pattern=co),ss.init(t,e)})),ks=Oa("$ZodXID",((t,e)=>{e.pattern??(e.pattern=fo),ss.init(t,e)})),Es=Oa("$ZodKSUID",((t,e)=>{e.pattern??(e.pattern=po),ss.init(t,e)})),Ss=Oa("$ZodISODateTime",((t,e)=>{e.pattern??(e.pattern=function(t){const e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${zo({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,r=t.local?`${i}|${zo({precision:t.precision})}`:i;return new RegExp(`^${Mo}T(?:${r})$`)}(e)),ss.init(t,e)})),Ms=Oa("$ZodISODate",((t,e)=>{e.pattern??(e.pattern=Io),ss.init(t,e)})),As=Oa("$ZodISOTime",((t,e)=>{e.pattern??(e.pattern=new RegExp(`^${zo(e)}$`)),ss.init(t,e)})),Is=Oa("$ZodISODuration",((t,e)=>{e.pattern??(e.pattern=go),ss.init(t,e)})),zs=Oa("$ZodIPv4",((t,e)=>{e.pattern??(e.pattern=wo),ss.init(t,e)})),Ps=/^[0-9a-fA-F:.]+$/;function Ts(t){return!!Ps.test(t)&&ds(`http://[${t}]`)}const Rs=Oa("$ZodIPv6",((t,e)=>{e.pattern??(e.pattern=vo),ss.init(t,e),t._zod.check=i=>{Ts(i.value)||i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:t,continue:!e.abort})}})),Os=Oa("$ZodCIDRv4",((t,e)=>{e.pattern??(e.pattern=xo),ss.init(t,e)}));const Bs=Oa("$ZodCIDRv6",((t,e)=>{e.pattern??(e.pattern=ko),ss.init(t,e),t._zod.check=i=>{(function(t){const e=t.split("/");if(2!==e.length)return!1;const[i,r]=e;if(!r)return!1;const n=Number(r);return`${n}`===r&&!(n<0||n>128)&&Ts(i)})(i.value)||i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:t,continue:!e.abort})}}));function Cs(t){if(""===t)return!0;if(/\s/.test(t))return!1;if(t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}const Ls=/^[0-9a-zA-Z+/]*={0,2}$/,Ds=Oa("$ZodBase64",((t,e)=>{e.pattern??(e.pattern=Ls),ss.init(t,e),t._zod.check=i=>{Cs(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:t,continue:!e.abort})}})),Us=/^[A-Za-z0-9_-]*$/;const Fs=Oa("$ZodBase64URL",((t,e)=>{e.pattern??(e.pattern=Us),ss.init(t,e),t._zod.check=i=>{(function(t){if(!Us.test(t))return!1;const e=t.replace(/[-_]/g,(t=>"-"===t?"+":"/"));return Cs(e.padEnd(4*Math.ceil(e.length/4),"="))})(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:t,continue:!e.abort})}})),Ns=Oa("$ZodE164",((t,e)=>{e.pattern??(e.pattern=So),ss.init(t,e)}));const js=Oa("$ZodJWT",((t,e)=>{ss.init(t,e),t._zod.check=i=>{(function(t,e=null){try{const i=t.split(".");if(3!==i.length)return!1;const[r]=i;if(!r)return!1;const n=JSON.parse(atob(r));return!("typ"in n&&"JWT"!==n?.typ||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}})(i.value,e.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:t,continue:!e.abort})}})),Gs=Oa("$ZodNumber",((t,e)=>{rs.init(t,e),t._zod.pattern=To,t._zod.parse=(i,r)=>{if(e.coerce)try{i.value=Number(i.value)}catch(t){}const n=i.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return i;const a="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return i.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...a?{received:a}:{}}),i}})),Zs=Oa("$ZodNumberFormat",((t,e)=>{jo.init(t,e),Gs.init(t,e)})),Hs=Oa("$ZodBoolean",((t,e)=>{rs.init(t,e),t._zod.pattern=Ro,t._zod.parse=(i,r)=>{if(e.coerce)try{i.value=Boolean(i.value)}catch(t){}const n=i.value;return"boolean"==typeof n||i.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),i}})),$s=Oa("$ZodUnknown",((t,e)=>{rs.init(t,e),t._zod.parse=t=>t})),Ws=Oa("$ZodNever",((t,e)=>{rs.init(t,e),t._zod.parse=(e,i)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:t}),e)}));const qs=t=>Array.isArray(t)?t.length:-1;function Ys(t,e,i){t.issues.length&&e.issues.push(...ua(i,t.issues)),e.value[i]=t.value}const Vs=Oa("$ZodArray",((t,e)=>{rs.init(t,e);const i=La.memoizer;i?.attach(t),t._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:t}),r;r.value=i?i.alloc(t,r,Array(a.length),n):Array(a.length);const o=[],s=n?.abortEarly;for(let t=0;t<a.length;t++){const i=a[t],h=e.element._zod.run({value:i,issues:[]},n);if(h instanceof Promise)o.push(h.then((e=>Ys(e,r,t))));else if(Ys(h,r,t),s&&0!==h.issues.length&&ha(h))break}return o.length?Promise.all(o).then((()=>r)):r},function(t,e){const i=fa(t._zod.def.checks);if(!i.length)return;const r=Math.min(...i.map((t=>t[0]))),n=t._zod.parse;t._zod.parse=(i,a)=>{const o=e(i.value);if(o>r&&!a?.skipChecks&&"backward"!==a?.direction)for(const[e,r]of fa(t._zod.def.checks))if(o>e&&r._zod.def.when(i)){const e=i.issues.length;return r._zod.check(i),i.issues[e].continue=!1,da(i.issues,e,t),i}return n(i,a)}}(t,qs)}));function Js(t,e,i,r,n,a){const o=i in r,s="optional"===a;if(o||!s||"optional"!==n){if(t.issues.length){if(void 0!==n&&s&&!o)return;e.issues.push(...ua(i,t.issues))}o||void 0!==n?void 0===t.value?(o||"defaulted"===n&&!s)&&(e.value[i]=void 0):e.value[i]=t.value:t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]})}}const Ks=[];function Xs(t){const e=Object.keys(t.shape),i=Object.getOwnPropertySymbols(t.shape),r=i.length?i:Ks,n=r.length?[...e,...r]:e;for(const e of n)if(!t.shape?.[e]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(e)}": expected a Zod schema`);const a=(o=t.shape,Object.keys(o).filter((t=>void 0!==o[t]._zod.optin&&"optional"===o[t]._zod.optout)));var o;return{...t,allKeys:n,symbolKeys:r,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(a)}}function Qs(t,e,i,r,n,a,o){const s=[],h=n.keySet,l=n.catchall._zod,u=l.def.type,c=l.optin,f=l.optout;let d=0;for(const n in e){if(o&&i.issues.length!==d){if(ha(i,d))break;d=i.issues.length}if(h.has(n))continue;if("__proto__"===n){"never"===u&&s.push(n);continue}if("never"===u){s.push(n);continue}const a=l.run({value:e[n],issues:[]},r);a instanceof Promise?t.push(a.then((t=>Js(t,i,n,e,c,f)))):Js(a,i,n,e,c,f)}return s.length&&i.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:a,continue:!0}),t.length?Promise.all(t).then((()=>i)):i}const th=Oa("$ZodObject",((t,e)=>{rs.init(t,e);const i=Object.getOwnPropertyDescriptor(e,"shape"),r=i?.get?i.get.raw:e.shape??{};if(r){const t=()=>{const i={...r};return Object.defineProperty(e,"shape",{value:i}),t.raw=i,i};t.raw=r,Object.defineProperty(e,"shape",{get:t})}const n=Un((()=>Xs(e)));Ma(t,"propValues",(t=>{const e=t.def.shape,i={};for(const t in e){const r=e[t]._zod;if(r.values){Object.prototype.hasOwnProperty.call(i,t)||Nn(i,t,new Set);for(const e of r.values)i[t].add(e);void 0!==r.optin&&i[t].add(void 0)}}return i}));const a=Yn,o=e.catchall;let s;const h=La.memoizer;h?.attach(t),t._zod.parse=(e,i)=>{s??(s=n.value);const r=e.value;if(!a(r))return e.issues.push({expected:"object",code:"invalid_type",input:r,inst:t}),e;e.value=h?h.alloc(t,e,{},i):{};const l=[],u=s.shape,c=i?.abortEarly;let f=e.issues.length;for(const t of s.allKeys){if(c&&e.issues.length!==f){if(ha(e,f))break;f=e.issues.length}if("__proto__"===t)continue;const n=u[t],a=n._zod.optin,o=n._zod.optout,s=n._zod.run({value:r[t],issues:[]},i);s instanceof Promise?l.push(s.then((i=>Js(i,e,t,r,a,o)))):Js(s,e,t,r,a,o)}return o?Qs(l,r,e,i,n.value,t,!0===c):l.length?Promise.all(l).then((()=>e)):e}})),eh=Oa("$ZodObjectJIT",((t,e)=>{th.init(t,e);const i=t._zod.parse,r=Un((()=>Xs(e))),n=La.memoizer;let a;const o=Yn,s=!La.jitless,h=s&&Vn.value,l=e.catchall;let u;t._zod.parse=(c,f)=>{u??(u=r.value);const d=c.value;return o(d)?s&&h&&!1===f?.async&&!0!==f.jitless?(a||(a=(e=>{const i=r.value,a=i.symbolKeys,o=new es(["payload","ctx"],{shape:e,inst:t,memo:n,syms:a}),s=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,h=(t,e)=>`\n          let ${t}_ab = false;\n          for (let i = 0; i < ${t}.issues.length; i++) {\n            const iss = ${t}.issues[i];\n            iss.path = iss.path ? [${e}, ...iss.path] : [${e}];\n            payload.issues.push(iss);\n            if (iss.continue !== true) ${t}_ab = true;\n          }\n          if (${t}_ab && ctx && ctx.abortEarly) {\n            payload.value = newResult;\n            return payload;\n          }`;o.write("const input = payload.value;");const l=Object.create(null);let u=0;for(const t of i.allKeys)l[t]="key_"+u++;o.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const t of i.allKeys){if("__proto__"===t)continue;const i=l[t],r="symbol"==typeof t?`syms[${a.indexOf(t)}]`:(c=t,JSON.stringify(c)),n=`${r} in input`,u=e[t],f=u?._zod?.optin,d=void 0!==f,p="optional"===u?._zod?.optout;if(o.write(`const ${i} = ${s(r)};`),d&&p){const t="optional"===f?`${i}_present`:`${i}.value !== undefined || ${i}_present`;o.write(`\n        const ${i}_present = ${n};\n        if (!${i}.issues.length || ${i}_present) {\n          if (${i}.issues.length) {${h(i,r)}\n          }\n\n          if (${t}) {\n            newResult[${r}] = ${i}.value;\n          }\n        }\n\n      `)}else d?(o.write(`\n        if (${i}.issues.length) {${h(i,r)}\n        }\n      `),"defaulted"===f?o.write(`newResult[${r}] = ${i}.value;`):o.write(`\n        if (${i}.value !== undefined || ${n}) {\n          newResult[${r}] = ${i}.value;\n        }\n      `)):o.write(`\n        const ${i}_present = ${n};\n        if (${i}.issues.length) {${h(i,r)}\n        }\n        if (!${i}_present && !${i}.issues.length) {\n          payload.issues.push({\n            code: "invalid_type",\n            expected: "nonoptional",\n            input: undefined,\n            path: [${r}]\n          });\n          if (ctx && ctx.abortEarly) {\n            payload.value = newResult;\n            return payload;\n          }\n        }\n\n        if (${i}_present) {\n          newResult[${r}] = ${i}.value;\n        }\n\n      `)}var c;return o.write("payload.value = newResult;"),o.write("return payload;"),o.compile()})(e.shape)),c=a(c,f),l?Qs([],d,c,f,u,t,!0===f?.abortEarly):c):i(c,f):(c.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),c)}}));function ih(t,e,i,r){for(const i of t)if(0===i.issues.length)return e.value=i.value,e;const n=t.filter((t=>!ha(t)));return 1===n.length?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:i,errors:t.map((t=>t.issues.map((t=>pa(t,r,Da())))))}),e)}const rh=Oa("$ZodUnion",((t,e)=>{rs.init(t,e),Ma(t,"optin",(t=>t.def.options.some((t=>"defaulted"===t._zod.optin))?"defaulted":t.def.options.some((t=>void 0!==t._zod.optin))?"optional":void 0)),Ma(t,"optout",(t=>t.def.options.some((t=>"optional"===t._zod.optout))?"optional":void 0)),Ma(t,"values",(t=>{if(t.def.options.every((t=>t._zod.values)))return new Set(t.def.options.flatMap((t=>Array.from(t._zod.values))))})),Ma(t,"pattern",(t=>{if(t.def.options.every((t=>t._zod.pattern))){const e=t.def.options.map((t=>t._zod.pattern));return new RegExp(`^(${e.map((t=>Fn(t.source))).join("|")})$`)}}));const i=1===e.options.length?e.options[0]._zod.run:null;t._zod.parse=(r,n)=>{if(i)return i(r,n);let a=!1;const o=[];for(const t of e.options){const e=t._zod.run({value:r.value,issues:[]},n);if(e instanceof Promise)o.push(e),a=!0;else{if(0===e.issues.length)return e;o.push(e)}}return a?Promise.all(o).then((e=>ih(e,r,t,n))):ih(o,r,t,n)}})),nh=Oa("$ZodIntersection",((t,e)=>{rs.init(t,e),t._zod.parse=(t,i)=>{const r=t.value,n=e.left._zod.run({value:r,issues:[]},i),a=e.right._zod.run({value:r,issues:[]},i);return n instanceof Promise||a instanceof Promise?Promise.all([n,a]).then((([e,i])=>oh(t,e,i))):oh(t,n,a)}}));function ah(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Jn(t)&&Jn(e)){const i=Object.keys(e),r=Object.keys(t).filter((t=>-1!==i.indexOf(t))),n={...t,...e};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(const i of r){if("__proto__"===i)continue;const r=ah(t[i],e[i]);if(!r.valid)return{valid:!1,mergeErrorPath:[i,...r.mergeErrorPath]};n[i]=r.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let r=0;r<t.length;r++){const n=ah(t[r],e[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i.push(n.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function oh(t,e,i){const r=new Map;let n;const a=new Map,o=(t,e)=>{let i;if("unrecognized_keys"!==t.code||t.path?.length){if("invalid_key"!==t.code||"record"!==t.origin||1!==t.path?.length)return!1;{const e=String(t.path[0]);a.has(e)||a.set(e,t),i=[e]}}else n??(n=t),i=t.keys;for(const t of i)r.has(t)||r.set(t,{}),r.get(t)[e]=!0;return!0};for(const i of e.issues)o(i,"l")||t.issues.push(i);for(const e of i.issues)o(e,"r")||t.issues.push(e);const s=[...r].filter((([,t])=>t.l&&t.r)).map((([t])=>t));if(s.length){const e=n?s.filter((t=>n.keys.includes(t))):[];e.length&&t.issues.push({...n,keys:e});for(const i of s)!e.includes(i)&&a.has(i)&&t.issues.push(a.get(i))}const h=ah(e.value,i.value);if(!h.valid){if(ha(t))return t;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(h.mergeErrorPath)}`)}return t.value=h.data,t}const sh=Oa("$ZodTuple",((t,e)=>{rs.init(t,e);const i=e.items,r=La.memoizer;r?.attach(t),t._zod.parse=(n,a)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=r?r.alloc(t,n,[],a):[];const s=[],h=hh(i,"optin"),l=hh(i,"optout");if(!e.rest){if(o.length<h)return n.issues.push({code:"too_small",minimum:h,inclusive:!0,input:o,inst:t,origin:"array"}),n;o.length>i.length&&n.issues.push({code:"too_big",maximum:i.length,inclusive:!0,input:o,inst:t,origin:"array"})}const u=new Array(i.length),c=e.rest?a?.abortEarly:void 0;let f=!1;for(let t=0;t<i.length;t++){const e=i[t]._zod.run({value:o[t],issues:[]},a);e instanceof Promise?s.push(e.then((e=>{u[t]=e}))):(u[t]=e,c&&!f&&e.issues.length&&(f=ha(e)))}if(e.rest&&!f){let t=i.length-1;const r=o.slice(i.length);let h=n.issues.length;for(const i of r){if(c&&n.issues.length!==h){if(ha(n,h))break;h=n.issues.length}t++;const r=e.rest._zod.run({value:i,issues:[]},a);r instanceof Promise?s.push(r.then((e=>lh(e,n,t)))):lh(r,n,t)}}return s.length?Promise.all(s).then((()=>uh(u,n,i,o,l))):uh(u,n,i,o,l)}}));function hh(t,e){for(let i=t.length-1;i>=0;i--){if(!("optin"===e?void 0!==t[i]._zod.optin:"optional"===t[i]._zod.optout))return i+1}return 0}function lh(t,e,i){t.issues.length&&e.issues.push(...ua(i,t.issues)),e.value[i]=t.value}function uh(t,e,i,r,n){for(let a=0;a<i.length;a++){const o=t[a],s=a<r.length;if(!s&&a>=n&&"optional"===i[a]._zod.optin){e.value.length=a;break}if(o.issues.length){if(!s&&a>=n){e.value.length=a;break}e.issues.push(...ua(a,o.issues))}e.value[a]=o.value}for(let t=e.value.length-1;t>=r.length&&("optional"===i[t]._zod.optout&&void 0===e.value[t]);t--)e.value.length=t;return e}const ch=Oa("$ZodEnum",((t,e)=>{rs.init(t,e);const i=Bn(e.entries),r=new Set(i);t._zod.values=r,Ma(t,"pattern",(t=>{const e=Bn(t.def.entries).filter((t=>Xn.has(typeof t)));return new RegExp(e.length?`^(${e.map((t=>Qn(t.toString()))).join("|")})$`:"^[^\\s\\S]$")})),t._zod.parse=(e,n)=>{const a=e.value;return r.has(a)||e.issues.push({code:"invalid_value",values:i,input:a,inst:t}),e}})),fh=Oa("$ZodLiteral",((t,e)=>{rs.init(t,e);const i=new Set(e.values);t._zod.values=i,Ma(t,"pattern",(t=>{const e=t.def.values;return new RegExp(e.length?`^(${e.map((t=>"string"==typeof t?Qn(t):t?Qn(t.toString()):String(t))).join("|")})$`:"^[^\\s\\S]$")})),t._zod.parse=(r,n)=>{const a=r.value;return i.has(a)||r.issues.push({code:"invalid_value",values:e.values,input:a,inst:t}),r}})),dh=Oa("$ZodTransform",((t,e)=>{rs.init(t,e),t._zod.optin="optional",La.memoizer?.guard(t),t._zod.parse=(i,r)=>{if("backward"===r.direction)throw new Ca(t.constructor.name);const n=e.transform(i.value,i);if(r.async){return(n instanceof Promise?n:Promise.resolve(n)).then((t=>(i.value=t,i)))}if(n instanceof Promise)throw new Ba;return i.value=n,i}}));function ph(t,e){return t.value=e.issues.length?void 0:e.value,t}const mh=Oa("$ZodOptional",((t,e)=>{rs.init(t,e),Ma(t,"optin",(t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional")),t._zod.optout="optional",Ma(t,"values",(t=>{const e=t.def.innerType._zod.values;return e?new Set([...e,void 0]):void 0})),Ma(t,"pattern",(t=>{const e=t.def.innerType._zod.pattern;return e?new RegExp(`^(${Fn(e.source)})?$`):void 0})),t._zod.parse=(t,i)=>{if(void 0===t.value){if("defaulted"!==e.innerType._zod.optin)return t;const r=e.innerType._zod.run({value:t.value,issues:[]},i);return r instanceof Promise?r.then((e=>ph(t,e))):ph(t,r)}return e.innerType._zod.run(t,i)}})),gh=Oa("$ZodExactOptional",((t,e)=>{mh.init(t,e),Ma(t,"values",(t=>t.def.innerType._zod.values)),Ma(t,"pattern",(t=>t.def.innerType._zod.pattern)),t._zod.parse=(t,i)=>e.innerType._zod.run(t,i)})),_h=Oa("$ZodNullable",((t,e)=>{rs.init(t,e),Ma(t,"optin",(t=>t.def.innerType._zod.optin)),Ma(t,"optout",(t=>t.def.innerType._zod.optout)),Ma(t,"pattern",(t=>{const e=t.def.innerType._zod.pattern;return e?new RegExp(`^(${Fn(e.source)}|null)$`):void 0})),Ma(t,"values",(t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0)),t._zod.parse=(t,i)=>null===t.value?t:e.innerType._zod.run(t,i)})),bh=Oa("$ZodDefault",((t,e)=>{rs.init(t,e),t._zod.optin="defaulted",Ma(t,"values",(t=>t.def.innerType._zod.values)),t._zod.parse=(t,i)=>{if("backward"===i.direction)return e.innerType._zod.run(t,i);if(void 0===t.value)return t.value=e.defaultValue,t;const r=e.innerType._zod.run(t,i);return r instanceof Promise?r.then((t=>yh(t,e))):yh(r,e)}}));function yh(t,e){return void 0===t.value&&(t.value=e.defaultValue),t}const wh=Oa("$ZodPrefault",((t,e)=>{rs.init(t,e),t._zod.optin="defaulted",Ma(t,"values",(t=>t.def.innerType._zod.values)),t._zod.parse=(t,i)=>("backward"===i.direction||void 0===t.value&&(t.value=e.defaultValue),e.innerType._zod.run(t,i))})),vh=Oa("$ZodNonOptional",((t,e)=>{rs.init(t,e),Ma(t,"values",(t=>{const e=t.def.innerType._zod.values;return e?new Set([...e].filter((t=>void 0!==t))):void 0})),t._zod.parse=(i,r)=>{const n=e.innerType._zod.run(i,r);return n instanceof Promise?n.then((e=>xh(e,t))):xh(n,t)}}));function xh(t,e){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function kh(t,e,i,r){return e.issues.length?(t.value=i.catchValue({...e,value:t.value,error:{issues:e.issues.map((t=>pa(t,r,Da())))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}const Eh=Oa("$ZodCatch",((t,e)=>{rs.init(t,e),Ma(t,"optin",(t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional")),Ma(t,"optout",(t=>t.def.innerType._zod.optout)),Ma(t,"values",(t=>t.def.innerType._zod.values)),t._zod.parse=(t,i)=>{if("backward"===i.direction)return e.innerType._zod.run(t,i);const r=e.innerType._zod.run({value:t.value,issues:[]},i);return r instanceof Promise?r.then((r=>kh(t,r,e,i))):kh(t,r,e,i)}})),Sh=Oa("$ZodPipe",((t,e)=>{rs.init(t,e),Ma(t,"values",(t=>t.def.in._zod.values)),Ma(t,"optin",(t=>t.def.in._zod.optin)),Ma(t,"optout",(t=>t.def.out._zod.optout)),Ma(t,"propValues",(t=>t.def.in._zod.propValues)),t._zod.parse=(t,i)=>{if("backward"===i.direction){const r=e.out._zod.run(t,i);return r instanceof Promise?r.then((t=>Mh(t,e.in,i))):Mh(r,e.in,i)}const r=e.in._zod.run(t,i);return r instanceof Promise?r.then((t=>Mh(t,e.out,i))):Mh(r,e.out,i)}}));function Mh(t,e,i){return t.issues.some((t=>"unrecognized_keys"!==t.code))?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},i)}const Ah=Oa("$ZodReadonly",((t,e)=>{rs.init(t,e),Ma(t,"propValues",(t=>t.def.innerType._zod.propValues)),Ma(t,"values",(t=>t.def.innerType._zod.values)),Ma(t,"optin",(t=>t.def.innerType?._zod?.optin)),Ma(t,"optout",(t=>t.def.innerType?._zod?.optout)),t._zod.parse=(t,i)=>{if("backward"===i.direction)return e.innerType._zod.run(t,i);const r=e.innerType._zod.run(t,i);return r instanceof Promise?r.then(Ih):Ih(r)}}));function Ih(t){return t.memo||(t.value=Object.freeze(t.value)),t}const zh=Oa("$ZodFunction",((t,e)=>(rs.init(t,e),Object.defineProperty(t,"_def",{value:e}),t._zod.def=e,t.implement=e=>{if("function"!=typeof e)throw new Error("implement() must be called with a function");return Object.defineProperty((function(...i){const r=t._def.input?Wa(t._def.input,i):i,n=Reflect.apply(e,this,r);return t._def.output?Wa(t._def.output,n):n}),"_zod",{value:t._zod,enumerable:!1})},t.implementAsync=e=>{if("function"!=typeof e)throw new Error("implementAsync() must be called with a function");return Object.defineProperty((async function(...i){const r=t._def.input?await Ya(t._def.input,i):i,n=await Reflect.apply(e,this,r);return t._def.output?await Ya(t._def.output,n):n}),"_zod",{value:t._zod,enumerable:!1})},t._zod.parse=(e,i)=>{if("function"!=typeof e.value)return e.issues.push({code:"invalid_type",expected:"function",input:e.value,inst:t}),e;const r=t._def.output&&"promise"===t._def.output._zod.def.type;return e.value=r?t.implementAsync(e.value):t.implement(e.value),e},t.input=(...e)=>{const i=t.constructor;return Array.isArray(e[0])?new i({type:"function",input:new sh({type:"tuple",items:e[0],rest:e[1]}),output:t._def.output}):new i({type:"function",input:e[0],output:t._def.output})},t.output=e=>new(0,t.constructor)({type:"function",input:t._def.input,output:e}),t))),Ph=Oa("$ZodCustom",((t,e)=>{Co.init(t,e),rs.init(t,e),t._zod.parse=(t,e)=>t,t._zod.check=i=>{const r=i.value,n=e.fn(r);if(n instanceof Promise)return n.then((e=>Th(e,i,r,t)));Th(n,i,r,t)}}));function Th(t,e,i,r){if(!t){const t={code:"custom",input:i,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(t.params=r._zod.def.params),e.issues.push(ba(t))}}class Rh extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Oh="~memo",Bh=[];function Ch(t){return null!==t&&"object"==typeof t}function Lh(t){return t.map((t=>t.path?{...t,path:t.path.slice()}:{...t}))}const Dh=new WeakMap,Uh=1,Fh=2;function Nh(t,e,i){const r=Dh.get(t);if(void 0!==r)return r?Fh:0;if(e.has(t))return Fh;e.add(t);let n=0;const a=t=>{if(n!==Fh&&t?._zod){const i=Nh(t,e);i>n&&(n=i)}},o=t=>{t>n&&(n=t)},s=t._zod.def;switch(s.type){case"object":{const t=jn(s);o(t?((t,i)=>{let r=0;for(const i of Reflect.ownKeys(t)){const n=Object.getOwnPropertyDescriptor(t,i);if(!n.enumerable)continue;const a=n.get?Uh:n.value?._zod?Nh(n.value,e):0;a>r&&(r=a)}return r})(t):Uh),a(s.catchall);break}case"array":a(s.element);break;case"tuple":for(const t of s.items)a(t);a(s.rest);break;case"record":case"map":a(s.keyType),a(s.valueType);break;case"set":a(s.valueType);break;case"union":for(const t of s.options)a(t);break;case"intersection":a(s.left),a(s.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":a(s.innerType);break;case"pipe":a(s.in),a(s.out);break;case"function":a(s.input),a(s.output);break;case"lazy":{const t=s._cachedInner??void 0;o(t?Nh(t,e):Uh);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const t in s){const e=Object.getOwnPropertyDescriptor(s,t);if(!e||e.get)continue;const i=e.value;if(i&&"object"==typeof i)if(i._zod)a(i);else if(Array.isArray(i))for(const t of i)a(t)}}return e.delete(t),function(t,e){e!==Uh&&Dh.set(t,e===Fh);return e}(t,n)}let jh;const Gh=[],Zh={alloc(t,e,i){const r=jh;if(!r)return i;jh=void 0;const n={value:i,issues:null};return r.set(e.value,n),Gh.push(n),i},guard(t){var e;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push((()=>{const e=t._zod.parse,i=(t,i)=>{if("backward"!==i.direction&&function(t,e){const i=t[Oh]?.backEdges;return void 0!==i&&Ch(e)&&i.has(e)}(i,t.value))throw new Rh;return e(t,i)};t._zod.parse=i,t._zod.run===e&&(t._zod.run=i)}))},attach(t){var e;let i,r,n,a=!1;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push((()=>{const e=t._zod.parse,o=(s,h)=>{if(void 0===i){const r=Nh(t,new Set);if(0===r)return t._zod.parse=e,t._zod.run===o&&(t._zod.run=e),e(s,h);r===Fh||a?i=!0:a=!0}const l=s.value;if(!Ch(l))return e(s,h);let u,c=h[Oh];c||(c={buckets:new WeakMap,backEdges:void 0},h[Oh]=c),r===h?u=n:(u=function(t,e){let i=t.buckets.get(e);return i||(i=new WeakMap,t.buckets.set(e,i)),i}(c,t),r=h,n=u);const f=u.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Lh(f.issues)):(s.memo=!0,c.backEdges??(c.backEdges=new WeakSet),c.backEdges.add(f.value)),s;jh=u;const d=Gh.length,p=e(s,h);jh=void 0;const m=Gh.length>d?Gh.pop():void 0;return p instanceof Promise?p.then((t=>(m&&(m.issues=t.issues.length?Lh(t.issues):Bh),t))):(m&&(m.issues=p.issues.length?Lh(p.issues):Bh),p)};t._zod.parse=o,t._zod.run===e&&(t._zod.run=o)}))}};const Hh=()=>{const t={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"}};function e(e){return t[e]??null}const i={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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function n(t,e){return"number"!==t||"number"!=typeof e||Number.isFinite(e)?r[t]??t:String(e)}return t=>{switch(t.code){case"invalid_type":{const e=n(t.expected),i=function(t){const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(null===t)return"null";if(Array.isArray(t))return"array";const e=t;if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}}return e}(t.input);return`Invalid input: expected ${e}, received ${n(i,t.input)}`}case"invalid_value":return 1===t.values.length?`Invalid input: expected ${ia(t.values[0])}`:`Invalid option: expected one of ${Cn(t.values,"|")}`;case"too_big":{const i=t.exact?"exactly ":t.inclusive?"<=":"<",r=e(t.origin);return r?`Too big: expected ${t.origin??"value"} to have ${i}${t.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${t.origin??"value"} to be ${i}${t.maximum.toString()}`}case"too_small":{const i=t.exact?"exactly ":t.inclusive?">=":">",r=e(t.origin);return r?`Too small: expected ${t.origin} to have ${i}${t.minimum.toString()} ${r.unit}`:`Too small: expected ${t.origin} to be ${i}${t.minimum.toString()}`}case"invalid_format":{const e=t;return"starts_with"===e.format?`Invalid string: must start with "${e.prefix}"`:"ends_with"===e.format?`Invalid string: must end with "${e.suffix}"`:"includes"===e.format?`Invalid string: must include "${e.includes}"`:"regex"===e.format?`Invalid string: must match pattern ${e.pattern}`:`Invalid ${i[e.format]??t.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${t.divisor}`;case"unrecognized_keys":return`Unrecognized key${t.keys.length>1?"s":""}: ${Cn(t.keys,", ")}`;case"invalid_key":return`Invalid key in ${t.origin}`;case"invalid_union":if(t.options&&Array.isArray(t.options)&&t.options.length>0){const e=t.options.map((t=>`'${t}'`)).join(" | ");return`Invalid discriminator value. Expected ${e}`}return!1===t.inclusive?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${t.origin}`;default:return"Invalid input"}}};var $h;class Wh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...e){const i=e[0];return this._map.set(t,i),i&&"object"==typeof i&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const e=this._map.get(t);return e&&"object"==typeof e&&"id"in e&&this._idmap.delete(e.id),this._map.delete(t),this}get(t){const e=t._zod.parent;if(e){const i={...this.get(e)??{}};delete i.id;const r={...i,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}($h=globalThis).__zod_globalRegistry??($h.__zod_globalRegistry=new Wh);const qh=globalThis.__zod_globalRegistry;function Yh(t){return t.checks&&(t.checks=[...t.checks]),t}function Vh(t,e){return new Uo({check:"less_than",...ea(e),value:t,inclusive:!1})}function Jh(t,e){return new Uo({check:"less_than",...ea(e),value:t,inclusive:!0})}function Kh(t,e){return new Fo({check:"greater_than",...ea(e),value:t,inclusive:!1})}function Xh(t,e){return new Fo({check:"greater_than",...ea(e),value:t,inclusive:!0})}function Qh(t,e){return new No({check:"multiple_of",...ea(e),value:t})}function tl(t,e){return new Go({check:"max_length",...ea(e),maximum:t})}function el(t,e){return new Zo({check:"min_length",...ea(e),minimum:t})}function il(t,e){return new Ho({check:"length_equals",...ea(e),length:t})}function rl(t){return new ts({check:"overwrite",tx:t})}function nl(t,e){const i=function(t,e){const i=new Co({check:"custom",...ea(e)});return i._zod.check=t,i}((e=>(e.addIssue=t=>{if("string"==typeof t)e.issues.push(ba(t,e.value,i._zod.def));else{const r=t;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=e.value),r.inst??(r.inst=i),r.continue??(r.continue=!i._zod.def.abort),e.issues.push(ba(r))}},t(e.value,e))),e);return i}function al(t,...e){for(const i of e)for(const e of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,e)&&Nn(t,e,i[e]);return t}function ol(t){let e=t?.target??"draft-2020-12";return"draft-4"===e&&(e="draft-04"),"draft-7"===e&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??qh,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function sl(t,e,i,r,n){const a="function"==typeof e.unrepresentable?e.unrepresentable({zodSchema:t,path:r.path,message:n}):e.unrepresentable;if("any"===a)return!1;if(void 0===a||"throw"===a)throw new Error(n);return Object.assign(i,a),!0}function hl(t,e,i={path:[],schemaPath:[]}){var r;const n=t._zod.def,a=e.seen.get(t);if(a){a.count++;return i.schemaPath.includes(t)&&(a.cycle=i.path),a.schema}const o={schema:{},count:1,cycle:void 0,path:i.path};e.seen.set(t,o),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;const s=t._zod.toJSONSchema?.();if(s)o.schema=s;else{const r={...i,schemaPath:[...i.schemaPath,t],path:i.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,r);else{const i=o.schema,a=e.processors[n.type];if(!a)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);a(t,e,i,r)}const a=t._zod.parent;a&&(o.ref||(o.ref=a),hl(a,e,r),e.seen.get(a).isParent=!0)}const h=e.metadataRegistry.get(t);h&&al(o.schema,h),"input"===e.io&&bl(t)&&(delete o.schema.examples,delete o.schema.default),"input"===e.io&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault;return e.seen.get(t).schema}function ll(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ul(t,e){const i=t.seen.get(e);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;const r=new Map;for(const e of t.seen.entries()){const i=t.metadataRegistry.get(e[0])?.id;if(i){const t=r.get(i);if(t&&t!==e[0])throw new Error(`Duplicate schema id "${i}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(i,e[0])}}const n=e=>{if(e[1].schema.$ref)return;const r=e[1],{ref:n,defId:a}=(e=>{const r="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){const i=t.external.registry.get(e[0])?.id,n=t.external.uri??(t=>t);if(i)return{ref:n(i)};const a=e[1].defId??e[1].schema.id??"schema"+t.counter++;return e[1].defId=a,{defId:a,ref:`${n("__shared")}#/${r}/${ll(a)}`}}const n=`#/${r}/`;if(e[1]===i&&!e[1].schema.id)return{ref:"#"};const a=e[1].schema.id??"__schema"+t.counter++;return{defId:a,ref:n+ll(a)}})(e);r.def={...r.schema},a&&(r.defId=a);const o=r.schema;for(const t in o)delete o[t];o.$ref=n};if("throw"===t.cycles)for(const e of t.seen.entries()){const t=e[1];if(t.cycle)throw new Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of t.seen.entries()){const r=i[1];if(e===i[0]){n(i);continue}if(t.external){const r=t.external.registry.get(i[0])?.id;if(e!==i[0]&&r){n(i);continue}}const a=t.metadataRegistry.get(i[0])?.id;a?n(i):(r.cycle||r.count>1&&"ref"===t.reused)&&n(i)}t.external&&(t.sharedDefsExtractedFor=t.external)}function cl(t){const e=t.anyOf;if(!Array.isArray(e)||0===e.length||void 0!==t.type)return;const i=[];for(const t of e){if(!t||"object"!=typeof t)return;cl(t);const e=Object.keys(t);if(1!==e.length||"type"!==e[0])return;const r=t.type;for(const t of Array.isArray(r)?r:[r]){if("string"!=typeof t)return;i.includes(t)||i.push(t)}}delete t.anyOf,t.type=1===i.length?i[0]:i}const fl=new Set(["type","properties","required","additionalProperties"]),dl=["oneOf","anyOf"];function pl(t){const e=t.additionalProperties;return void 0===e||!1===e||"object"!=typeof e||null===e?null:Object.keys(e).length?e:null}function ml(t){const e=[];for(const i of t){if("object"!=typeof i||"object"!==i.type)return null;for(const t in i)if(!fl.has(t))return null;e.push(i)}const i={},r=new Set;for(const t of e){for(const r in t.properties){if(Object.prototype.hasOwnProperty.call(i,r))continue;const t=[];for(const i of e){const e=i.properties?.[r]??pl(i);null!=e&&(t.some((t=>JSON.stringify(t)===JSON.stringify(e)))||t.push(e))}Nn(i,r,1===t.length?t[0]:ml(t)??{allOf:t})}for(const e of t.required??[])r.add(e)}const n={type:"object",properties:i};if(r.size&&(n.required=[...r]),e.every((t=>!1===t.additionalProperties)))n.additionalProperties=!1;else{const t=[];for(const i of e){const e=pl(i);e&&!t.some((t=>JSON.stringify(t)===JSON.stringify(e)))&&t.push(e)}1===t.length?n.additionalProperties=t[0]:t.length>1&&(n.additionalProperties={allOf:t})}return n}function gl(t){const e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(const e of fl)if(e in t)return;const i=e.filter((t=>dl.some((e=>Array.isArray(t[e])))));let r=null;if(i.length){const t=i[0],n=dl.find((e=>Array.isArray(t[e])));if(1!==Object.keys(t).length)return;const a=e.filter((e=>e!==t)),o=t[n].map((t=>ml([...a,t])));if(o.some((t=>!t)))return;r={[n]:o}}else r=ml(e);r&&(delete t.allOf,al(t,r))}function _l(t,e){const i=t.seen.get(e);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=e=>{const i=t.seen.get(e);if(null===i.ref)return;const n=i.def??i.schema,a={...n},o=i.ref;if(i.ref=null,o){r(o);const i=t.seen.get(o),s=i.schema;!s.$ref||"draft-07"!==t.target&&"draft-04"!==t.target&&"openapi-3.0"!==t.target?al(n,s):(n.allOf=n.allOf??[],n.allOf.push(s)),al(n,a);if(e._zod.parent===o)for(const t in n)"$ref"!==t&&"allOf"!==t&&(t in a||delete n[t]);if(s.$ref&&i.def)for(const t in n)"$ref"!==t&&"allOf"!==t&&t in i.def&&JSON.stringify(n[t])===JSON.stringify(i.def[t])&&delete n[t]}const s=e._zod.parent;if(s&&s!==o){r(s);const e=t.seen.get(s);if(e?.schema.$ref&&(n.$ref=e.schema.$ref,e.def))for(const t in n)"$ref"!==t&&"allOf"!==t&&t in e.def&&JSON.stringify(n[t])===JSON.stringify(e.def[t])&&delete n[t]}t.override({zodSchema:e,jsonSchema:n,path:i.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(const e of[...t.seen.entries()].reverse())r(e[0]);if("openapi-3.0"!==t.target)for(const e of t.seen.entries())cl(e[1].def??e[1].schema);for(const e of t.deferred)e();if(t.intersections.length){const e=new Map;for(const i of t.seen.values())for(const t of[i.schema,i.def]){const i=t?.allOf;if(!Array.isArray(i))continue;const r=e.get(i);r?r.push(t):e.set(i,[t])}for(const i of t.intersections)for(const t of e.get(i)??[])gl(t)}}const n={};if("draft-2020-12"===t.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const i=t.external.registry.get(e)?.id;if(!i)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(i)}al(n,i.defId?i.schema:i.def??i.schema);const a=t.metadataRegistry.get(e)?.id;void 0!==a&&n.id===a&&delete n.id;const o=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(const e of t.seen.entries()){const t=e[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,Nn(o,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(o).length>0&&("draft-2020-12"===t.target?n.$defs=o:n.definitions=o);try{const i=JSON.parse(JSON.stringify(n));return Object.defineProperty(i,"~standard",{value:{...e["~standard"],jsonSchema:{input:yl(e,"input",t.processors),output:yl(e,"output",t.processors)}},enumerable:!1,writable:!1}),i}catch(t){throw new Error("Error converting schema to JSON.")}}function bl(t,e){const i=e??{seen:new Set};if(i.seen.has(t))return!1;i.seen.add(t);const r=t._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return bl(r.element,i);if("set"===r.type)return bl(r.valueType,i);if("lazy"===r.type)return bl(r.getter(),i);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type||"catch"===r.type)return bl(r.innerType,i);if("intersection"===r.type)return bl(r.left,i)||bl(r.right,i);if("record"===r.type||"map"===r.type)return bl(r.keyType,i)||bl(r.valueType,i);if("pipe"===r.type)return!!t._zod.traits.has("$ZodCodec")||(bl(r.in,i)||bl(r.out,i));if("object"===r.type){for(const t in r.shape)if(bl(r.shape[t],i))return!0;return!1}if("union"===r.type){for(const t of r.options)if(bl(t,i))return!0;return!1}if("tuple"===r.type){for(const t of r.items)if(bl(t,i))return!0;return!(!r.rest||!bl(r.rest,i))}return!1}const yl=(t,e,i={})=>r=>{const{libraryOptions:n,target:a}=r??{},o=ol({...n??{},target:a,io:e,processors:i});return hl(t,o),ul(o,t),_l(o,t)},wl=(t,e,i)=>{(void 0===t[e]||i>t[e])&&(t[e]=i)},vl=(t,e,i)=>{(void 0===t[e]||i<t[e])&&(t[e]=i)},xl=(t,e)=>{wl(t,"minimum",e),vl(t,"maximum",e)},kl=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},El=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},Sl=(t,e)=>{t.mime=t.mime?t.mime.filter((t=>e.includes(t))):[...e]},Ml=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Al=(t,e)=>wl(t,"minimum",e.minimum),Il=(t,e)=>vl(t,"maximum",e.maximum),zl=t=>(e,i)=>{Ml(e,i.format);const[r,n]=t[i.format];wl(e,"minimum",r),vl(e,"maximum",n)},Pl={greater_than:(t,e)=>wl(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>vl(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>kl(t,e.value),number_format:zl(ra),bigint_format:zl(na),min_length:Al,max_length:Il,length_equals:(t,e)=>xl(t,e.length),min_size:Al,max_size:Il,size_equals:(t,e)=>xl(t,e.size),string_format:(t,e)=>{Ml(t,e.format),e.pattern&&El(t,e.pattern),"base64"!==e.format&&"base64url"!==e.format||(t.contentEncoding=e.format),(e.local||-1===e.precision)&&(t.laxFormat=!0)},mime_type:(t,e)=>Sl(t,e.mime)};function Tl(t){const e={},i=t._zod.def,r=t._zod.traits.has("$ZodCheck")?[t,...i.checks??[]]:i.checks??[];for(const t of r)Pl[t._zod.def.check]?.(e,t._zod.def);const n=t._zod.bag;void 0!==n.minimum&&wl(e,"minimum",n.minimum),void 0!==n.exclusiveMinimum&&wl(e,"exclusiveMinimum",n.exclusiveMinimum),void 0!==n.maximum&&vl(e,"maximum",n.maximum),void 0!==n.exclusiveMaximum&&vl(e,"exclusiveMaximum",n.exclusiveMaximum),void 0!==n.multipleOf&&kl(e,n.multipleOf),void 0!==n.format&&(e.format??(e.format=n.format),n.format.includes("int")&&(e.isInt=!0)),n.mime&&Sl(e,n.mime);for(const t of n.patterns??[])El(e,t);return e}const Rl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ol=new Map([[Ls,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[Us,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),Bl=t=>Ol.get(t)??t;function Cl(t){const e=t._zod.def;return"pipe"===e.type&&e.in._zod.traits.has("$ZodTransform")?Cl(e.out):"catch"===e.type?Cl(e.innerType):t._zod.optin}const Ll=Symbol();function Dl(t,e,i,r,n){let a=!1;const o=JSON.stringify(t,((t,e)=>"bigint"!=typeof e?e:(a=!0,null)));return a?(sl(e,i,r,n,"BigInt defaults cannot be represented in JSON Schema"),Ll):JSON.parse(o)}const Ul=(t,e,i,r)=>{const n=t._zod.def;hl(n.innerType,e,r);e.seen.get(t).ref=n.innerType},Fl=new WeakSet([Object.prototype,Error.prototype]);function Nl(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){const t=i(this);return Object.defineProperty(this,e,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,e,{value:t,configurable:!0,writable:!0})}})}const jl=(t,e)=>{Ga.init(t,e),t.name="ZodError";const i=Object.getPrototypeOf(t);Fl.has(i)||(Fl.add(i),Nl(i,"format",(t=>e=>function(t,e=(t=>t.message)){const i={_errors:[]},r=(t,n=[])=>{for(const a of t.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map((t=>r({issues:t},[...n,...a.path])));else if("invalid_key"===a.code)r({issues:a.issues},[...n,...a.path]);else if("invalid_element"===a.code)r({issues:a.issues},[...n,...a.path]);else{const t=[...n,...a.path];if(0===t.length)i._errors.push(e(a));else{let r=i,n=0;for(;n<t.length;){const i=t[n],o=n===t.length-1;if("_errors"===i){o&&r._errors.push(e(a)),n++;continue}Object.prototype.hasOwnProperty.call(r,i)||Object.defineProperty(r,i,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const s=r[i];o&&s._errors.push(e(a)),r=s,n++}}}};return r(t),i}(t,e))),Nl(i,"flatten",(t=>e=>function(t,e=(t=>t.message)){const i={},r=[];for(const s of t.issues)s.path.length>0?(n=i,a=s.path[0],o=()=>[],Object.prototype.hasOwnProperty.call(n,a)||("__proto__"===a?Object.defineProperty(n,a,{value:o(),writable:!0,enumerable:!0,configurable:!0}):n[a]=o()),n[a]).push(e(s)):r.push(e(s));var n,a,o;return{formErrors:r,fieldErrors:i}}(t,e))),Nl(i,"addIssue",(t=>e=>{t.issues.push(e),t.message=JSON.stringify(t.issues,Ln,2)})),Nl(i,"addIssues",(t=>e=>{t.issues.push(...e),t.message=JSON.stringify(t.issues,Ln,2)})),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},Gl=Oa("ZodError",jl,void 0,{Parent:Error}),Zl=$a(Gl),Hl=qa(Gl),$l=Va(Gl),Wl=Ka(Gl),ql=eo(Gl),Yl=io(Gl),Vl=ro(Gl),Jl=no(Gl),Kl=ao(Gl),Xl=oo(Gl),Ql=so(Gl),tu=ho(Gl);function eu(){La.localeError||Da({localeError:Hh()})}function iu(){La.memoizer||Da({memoizer:Zh})}const ru=Oa("ZodType",((t,e)=>(eu(),rs.init(t,e),t.def=e,t.type=e.type,t)),{check(...t){const e=this.def;return this.clone(Wn(e,{checks:[...e.checks??[],...t.map((t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t))]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return ta(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(function(t,e={}){return function(t,e,i){return new t({type:"custom",check:"custom",fn:e,...ea(i)})}(pc,t,e)}(t,e))},superRefine(t,e){return this.check(function(t,e){return nl(t,e)}(t,e))},overwrite(t){return this.check(rl(t))},optional(){return ic(this)},exactOptional(){return new rc({type:"optional",innerType:this})},nullable(){return ac(this)},nullish(){return ic(ac(this))},nonoptional(t){return function(t,e){return new hc({type:"nonoptional",innerType:t,...ea(e)})}(this,t)},array(){return Gu(this)},or(t){return Wu([this,t])},and(t){return new qu({type:"intersection",left:this,right:t})},transform(t){return cc(this,new tc({type:"transform",transform:t}))},default(t){return e=t,new oc({type:"default",innerType:this,get defaultValue(){return"function"==typeof e?e():Kn(e)}});var e},prefault(t){return e=t,new sc({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof e?e():Kn(e)}});var e},catch(t){return new lc({type:"catch",innerType:this,catchValue:"function"==typeof(e=t)?e:za(e)});var e},pipe(t){return cc(this,t)},readonly(){return new fc({type:"readonly",innerType:this})},describe(t){const e=this.clone();return qh.add(e,{description:t}),e},meta(...t){if(0===t.length)return qh.get(this);const e=this.clone();return qh.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return 0===e.length?t(this):t(this,...e)},get"~standard"(){return wa(this,"~standard",{...as(this),jsonSchema:{input:yl(this,"input"),output:yl(this,"output")}})},set"~standard"(t){ya(this,"~standard",t)},parse:function t(e,i){return Zl(this,e,i,{callee:t})},parseAsync:async function t(e,i){return await Hl(this,e,i,{callee:t})},safeParse(t,e){return $l(this,t,e)},async safeParseAsync(t,e){return Wl(this,t,e)},get spa(){return this?.safeParseAsync},set spa(t){ya(this,"spa",t)},validate(t,e){return to(this,t,e)},validateAsync(t,e){return(async(t,e,i)=>{const r=i?{...i,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let n=t._zod.run({value:e,issues:[]},r);return n instanceof Promise&&(n=await n),0===n.issues.length})(this,t,e)},encode:function t(e,i){return ql(this,e,i,{callee:t})},decode:function t(e,i){return Yl(this,e,i,{callee:t})},encodeAsync:async function t(e,i){return await Vl(this,e,i,{callee:t})},decodeAsync:async function t(e,i){return await Jl(this,e,i,{callee:t})},safeEncode(t,e){return Kl(this,t,e)},safeDecode(t,e){return Xl(this,t,e)},async safeEncodeAsync(t,e){return Ql(this,t,e)},async safeDecodeAsync(t,e){return tu(this,t,e)},toJSONSchema(t){return((t,e={})=>i=>{const r=ol({...i,processors:e});return hl(t,r),ul(r,t),_l(r,t)})(this,{})(t)},get description(){return qh.get(this)?.description},get _def(){return this._zod.def}}),nu=Oa("_ZodString",((t,e)=>{os.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=i;n.type="string";const{minimum:a,maximum:o,format:s,patterns:h,contentEncoding:l,laxFormat:u}=Tl(t);if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),s&&(n.format=Rl[s]??s,""===n.format&&delete n.format,("time"===s||u)&&delete n.format),l&&(n.contentEncoding=l),h&&h.size>0){const t=[...h].map(Bl);1===t.length?n.pattern=t[0].source:t.length>1&&(n.allOf=[...t.map((t=>({..."draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target?{type:"string"}:{},pattern:t.source})))])}})(t,e,i)}),va({format:t=>Tl(t).format??null,minLength:t=>Tl(t).minimum??null,maxLength:t=>Tl(t).maximum??null},{regex(...t){return this.check(function(t,e){return new Wo({check:"string_format",format:"regex",...ea(e),pattern:t})}(...t))},includes(...t){return this.check(function(t,e){return new Vo({check:"string_format",format:"includes",...ea(e),includes:t})}(...t))},startsWith(...t){return this.check(function(t,e){return new Jo({check:"string_format",format:"starts_with",...ea(e),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,e){return new Ko({check:"string_format",format:"ends_with",...ea(e),suffix:t})}(...t))},min(...t){return this.check(el(...t))},max(...t){return this.check(tl(...t))},length(...t){return this.check(il(...t))},nonempty(...t){return this.check(el(1,...t))},lowercase(t){return this.check(function(t){return new qo({check:"string_format",format:"lowercase",...ea(t)})}(t))},uppercase(t){return this.check(function(t){return new Yo({check:"string_format",format:"uppercase",...ea(t)})}(t))},trim(){return this.check(rl((t=>t.trim())))},normalize(...t){return this.check(function(t){return rl((e=>e.normalize(t)))}(...t))},toLowerCase(){return this.check(rl((t=>t.toLowerCase())))},toUpperCase(){return this.check(rl((t=>t.toUpperCase())))},slugify(){return this.check(rl((t=>function(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(t))))}})),au=Oa("ZodString",((t,e)=>{os.init(t,e),nu.init(t,e)}),{email(t){return this.check(function(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ea(e)})}(fu,t))},url(t){return this.check(function(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ea(e)})}(mu,t))},jwt(t){return this.check(function(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ea(e)})}(Pu,t))},emoji(t){return this.check(function(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ea(e)})}(gu,t))},guid(t){return this.check(function(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ea(e)})}(du,t))},uuid(t){return this.check(function(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ea(e)})}(pu,t))},uuidv4(t){return this.check(function(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ea(e)})}(pu,t))},uuidv6(t){return this.check(function(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ea(e)})}(pu,t))},uuidv7(t){return this.check(function(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ea(e)})}(pu,t))},nanoid(t){return this.check(function(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ea(e)})}(_u,t))},cuid(t){return this.check(function(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ea(e)})}(bu,t))},cuid2(t){return this.check(function(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ea(e)})}(yu,t))},ulid(t){return this.check(function(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ea(e)})}(wu,t))},base64(t){return this.check(function(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ea(e)})}(Au,t))},base64url(t){return this.check(function(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ea(e)})}(Iu,t))},xid(t){return this.check(function(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ea(e)})}(vu,t))},ksuid(t){return this.check(function(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ea(e)})}(xu,t))},ipv4(t){return this.check(function(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ea(e)})}(ku,t))},ipv6(t){return this.check(function(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ea(e)})}(Eu,t))},cidrv4(t){return this.check(function(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ea(e)})}(Su,t))},cidrv6(t){return this.check(function(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ea(e)})}(Mu,t))},e164(t){return this.check(function(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ea(e)})}(zu,t))},datetime(t){return this.check(function(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ea(e)})}(hu,t))},date(t){return this.check(function(t,e){return new t({type:"string",format:"date",check:"string_format",...ea(e)})}(lu,t))},time(t){return this.check(function(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ea(e)})}(uu,t))},duration(t){return this.check(function(t,e){return new t({type:"string",format:"duration",check:"string_format",...ea(e)})}(cu,t))}});function ou(t){return function(t,e){return new t(Yh({type:"string",...ea(e)}))}(au,t)}const su=Oa("ZodStringFormat",((t,e)=>{ss.init(t,e),nu.init(t,e)})),hu=Oa("ZodISODateTime",((t,e)=>{Ss.init(t,e),su.init(t,e)})),lu=Oa("ZodISODate",((t,e)=>{Ms.init(t,e),su.init(t,e)})),uu=Oa("ZodISOTime",((t,e)=>{As.init(t,e),su.init(t,e)})),cu=Oa("ZodISODuration",((t,e)=>{Is.init(t,e),su.init(t,e)})),fu=Oa("ZodEmail",((t,e)=>{us.init(t,e),su.init(t,e)})),du=Oa("ZodGUID",((t,e)=>{hs.init(t,e),su.init(t,e)})),pu=Oa("ZodUUID",((t,e)=>{ls.init(t,e),su.init(t,e)})),mu=Oa("ZodURL",((t,e)=>{_s.init(t,e),su.init(t,e)})),gu=Oa("ZodEmoji",((t,e)=>{bs.init(t,e),su.init(t,e)})),_u=Oa("ZodNanoID",((t,e)=>{ys.init(t,e),su.init(t,e)})),bu=Oa("ZodCUID",((t,e)=>{ws.init(t,e),su.init(t,e)})),yu=Oa("ZodCUID2",((t,e)=>{vs.init(t,e),su.init(t,e)})),wu=Oa("ZodULID",((t,e)=>{xs.init(t,e),su.init(t,e)})),vu=Oa("ZodXID",((t,e)=>{ks.init(t,e),su.init(t,e)})),xu=Oa("ZodKSUID",((t,e)=>{Es.init(t,e),su.init(t,e)})),ku=Oa("ZodIPv4",((t,e)=>{zs.init(t,e),su.init(t,e)})),Eu=Oa("ZodIPv6",((t,e)=>{Rs.init(t,e),su.init(t,e)})),Su=Oa("ZodCIDRv4",((t,e)=>{Os.init(t,e),su.init(t,e)})),Mu=Oa("ZodCIDRv6",((t,e)=>{Bs.init(t,e),su.init(t,e)})),Au=Oa("ZodBase64",((t,e)=>{Ds.init(t,e),su.init(t,e)})),Iu=Oa("ZodBase64URL",((t,e)=>{Fs.init(t,e),su.init(t,e)})),zu=Oa("ZodE164",((t,e)=>{Ns.init(t,e),su.init(t,e)})),Pu=Oa("ZodJWT",((t,e)=>{js.init(t,e),su.init(t,e)})),Tu=Oa("ZodNumber",((t,e)=>{Gs.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=i,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:h,exclusiveMinimum:l,isInt:u}=Tl(t);n.type=u?"integer":"number";const c="number"==typeof l&&l>=(a??Number.NEGATIVE_INFINITY),f="number"==typeof h&&h<=(o??Number.POSITIVE_INFINITY),d="draft-04"===e.target||"openapi-3.0"===e.target;if(c?d?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:"number"==typeof a&&(n.minimum=a),f?d?(n.maximum=h,n.exclusiveMaximum=!0):n.exclusiveMaximum=h:"number"==typeof o&&(n.maximum=o),s){const i=new Set;for(const a of s)Number.isFinite(a)&&0!==a?i.add(Math.abs(a)):sl(t,e,n,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);const[a,...o]=i;void 0!==a&&(n.multipleOf=a),o.length&&(n.allOf=[...n.allOf??[],...o.map((t=>({multipleOf:t})))])}})(t,e,i,r),t.isFinite=!0}),va({minValue:t=>{const{minimum:e,exclusiveMinimum:i}=Tl(t);return Math.max(e??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:t=>{const{maximum:e,exclusiveMaximum:i}=Tl(t);return Math.min(e??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:t=>{const{isInt:e,multipleOf:i}=Tl(t);return!!e||!!i?.some(Number.isSafeInteger)},format:t=>Tl(t).format??null},{gt(t,e){return this.check(Kh(t,e))},gte(t,e){return this.check(Xh(t,e))},min(t,e){return this.check(Xh(t,e))},lt(t,e){return this.check(Vh(t,e))},lte(t,e){return this.check(Jh(t,e))},max(t,e){return this.check(Jh(t,e))},int(t){return this.check(Bu(t))},safe(t){return this.check(Bu(t))},positive(t){return this.check(Kh(0,t))},nonnegative(t){return this.check(Xh(0,t))},negative(t){return this.check(Vh(0,t))},nonpositive(t){return this.check(Jh(0,t))},multipleOf(t,e){return this.check(Qh(t,e))},step(t,e){return this.check(Qh(t,e))},finite(){return this}}));function Ru(t){return function(t,e){return new t(Yh({type:"number",checks:[],...ea(e)}))}(Tu,t)}const Ou=Oa("ZodNumberFormat",((t,e)=>{Zs.init(t,e),Tu.init(t,e)}));function Bu(t){return function(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ea(e)})}(Ou,t)}const Cu=Oa("ZodBoolean",((t,e)=>{Hs.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(t,e,i)=>((t,e,i,r)=>{i.type="boolean"})(0,0,e)}));function Lu(t){return function(t,e){return new t({type:"boolean",...ea(e)})}(Cu,t)}const Du=Oa("ZodUnknown",((t,e)=>{$s.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(t,e,i)=>{}}));function Uu(){return new Du({type:"unknown"})}const Fu=Oa("ZodNever",((t,e)=>{Ws.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(t,e,i)=>((t,e,i,r)=>{i.not={}})(0,0,e)}));function Nu(t){return function(t,e){return new t({type:"never",...ea(e)})}(Fu,t)}const ju=Oa("ZodArray",((t,e)=>{iu(),Vs.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=i,a=t._zod.def,{minimum:o,maximum:s}=Tl(t);"number"==typeof o&&(n.minItems=o),"number"==typeof s&&(n.maxItems=s),n.type="array",n.items=hl(a.element,e,{...r,path:[...r.path,"items"]})})(t,e,i,r),t.element=e.element}),{min(t,e){return this.check(el(t,e))},nonempty(t){return this.check(el(1,t))},max(t,e){return this.check(tl(t,e))},length(t,e){return this.check(il(t,e))},unwrap(){return this.element}});function Gu(t,e){return function(t,e,i){return new t({type:"array",element:e,...ea(i)})}(ju,t,e)}const Zu=Oa("ZodObject",((t,e)=>{iu(),eh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=i,a=t._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&sl(t,e,n,r,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(const t in o)Nn(n.properties,t,hl(o[t],e,{...r,path:[...r.path,"properties",t]}));const s=[];for(const t of Object.keys(o)){const i=a.shape[t];("input"===e.io?void 0===Cl(i):void 0===i._zod.optout)&&s.push(t)}s.length>0&&(n.required=s),"never"===a.catchall?._zod.def.type?n.additionalProperties=!1:a.catchall?a.catchall&&(n.additionalProperties=hl(a.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):"output"===e.io&&(n.additionalProperties=!1)})(t,e,i,r),Aa(t,"shape",(t=>t._zod.def.shape),!1)}),{keyof(){return function(t,e){const i=Array.isArray(t)?Object.fromEntries(t.map((t=>[t,t]))):t;return new Ju({type:"enum",entries:i,...ea(e)})}(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(Wn(this._zod.def,{catchall:t}))},passthrough(){return this.clone(Wn(this._zod.def,{catchall:Uu()}))},loose(){return this.clone(Wn(this._zod.def,{catchall:Uu()}))},strict(){return this.clone(Wn(this._zod.def,{catchall:Nu()}))},strip(){return this.clone(Wn(this._zod.def,{catchall:void 0}))},extend(t){return function(t,e){if(!Jn(e))throw new Error("Invalid input to extend: expected a plain object");const i=t._zod.def.checks;if(i&&i.length>0){const i=Gn(t);for(const t of Reflect.ownKeys(e))if(void 0!==Object.getOwnPropertyDescriptor(i,t))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ta(t,Wn(t._zod.def,{shape:oa(t,e)}))}(this,t)},safeExtend(t){return function(t,e){if(!Jn(e))throw new Error("Invalid input to safeExtend: expected a plain object");return ta(t,Wn(t._zod.def,{shape:oa(t,e)}))}(this,t)},merge(t){return function(t,e){if(!e?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i={};return $n(i,t,Reflect.ownKeys(Gn(t))),$n(i,e,Reflect.ownKeys(Gn(e))),ta(t,Wn(t._zod.def,{shape:i,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]}))}(this,t)},pick(t){return function(t,e){const i=t._zod.def,r=i.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const n={};return $n(n,t,aa(t,e)),ta(t,Wn(i,{shape:n,checks:[]}))}(this,t)},omit(t){return function(t,e){const i=t._zod.def,r=i.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const n=new Set(aa(t,e)),a={};return $n(a,t,Reflect.ownKeys(Gn(t)).filter((t=>!n.has(t)))),ta(t,Wn(i,{shape:a,checks:[]}))}(this,t)},partial(...t){return sa(ec,this,t[0])},exactPartial(...t){return sa(rc,this,t[0],"exactPartial")},required(...t){return function(t,e,i){const r=i?new Set(aa(e,i)):void 0,n={};return $n(n,e,Reflect.ownKeys(Gn(e)),((e,i)=>r&&!r.has(i)?e:new t({type:"nonoptional",innerType:e}))),ta(e,Wn(e._zod.def,{shape:n}))}(hc,this,t[0])}});function Hu(t,e){const i={type:"object",shape:t??{},...ea(e)};return new Zu(i)}const $u=Oa("ZodUnion",((t,e)=>{rh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def,a=!1===n.inclusive,o=n.options.map(((t,i)=>hl(t,e,{...r,path:[...r.path,a?"oneOf":"anyOf",i]})));a?i.oneOf=o:i.anyOf=o})(t,e,i,r),t.options=e.options}));function Wu(t,e){return new $u({type:"union",options:t,...ea(e)})}const qu=Oa("ZodIntersection",((t,e)=>{nh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def,a=hl(n.left,e,{...r,path:[...r.path,"allOf",0]}),o=hl(n.right,e,{...r,path:[...r.path,"allOf",1]}),s=t=>"allOf"in t&&1===Object.keys(t).length,h=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];i.allOf=h,e.intersections.push(h)})(t,e,i,r)}));const Yu=Oa("ZodTuple",((t,e)=>{iu(),sh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=i,a=t._zod.def;n.type="array";const o="draft-2020-12"===e.target?"prefixItems":"items",s="draft-2020-12"===e.target||"openapi-3.0"===e.target?"items":"additionalItems",h=a.items.map(((t,i)=>hl(t,e,{...r,path:[...r.path,o,i]}))),l=a.rest?hl(a.rest,e,{...r,path:[...r.path,s,..."openapi-3.0"===e.target?[a.items.length]:[]]}):null;let u=a.items.length;for(;u>0;){const t=a.items[u-1];if(!("input"===e.io?void 0!==Cl(t):"optional"===t._zod.optout))break;u--}const c=a.items.length,f=!a.rest;"draft-2020-12"===e.target?(n.prefixItems=h,f?n.items=!1:l&&(n.items=l),u>0&&(n.minItems=u),f&&(n.maxItems=c)):"openapi-3.0"===e.target?(n.items={anyOf:h},l&&n.items.anyOf.push(l),u>0&&(n.minItems=u),f&&(n.maxItems=c)):(n.items=h,f?n.additionalItems=!1:l&&(n.additionalItems=l),u>0&&(n.minItems=u),f&&(n.maxItems=c));const{minimum:d,maximum:p}=Tl(t);"number"==typeof d&&(n.minItems=d),"number"==typeof p&&(n.maxItems=p)})(t,e,i,r)}),{rest(t){return this.clone({...this._zod.def,rest:t})},partial(){const t=this._zod.def;if(t.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...t,items:t.items.map((t=>new ec({type:"optional",innerType:t})))})}});function Vu(t,e,i){const r=e instanceof rs;return new Yu({type:"tuple",items:t,rest:r?e:null,...ea(r?i:e)})}const Ju=Oa("ZodEnum",((t,e)=>{ch.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=Bn(t._zod.def.entries);0!==n.length?(n.every((t=>"number"==typeof t))&&(i.type="number"),n.every((t=>"string"==typeof t))&&(i.type="string"),i.enum=n):i.not={}})(t,0,i),t.enum=e.entries,t.options=[...t._zod.values];const i=new Set(Object.keys(e.entries));t.extract=(t,r)=>{const n={};for(const r of t){if(!i.has(r))throw new Error(`Key ${r} not found in enum`);n[r]=e.entries[r]}return new Ju({...e,checks:[],...ea(r),entries:n})},t.exclude=(t,r)=>{const n={...e.entries};for(const e of t){if(!i.has(e))throw new Error(`Key ${e} not found in enum`);delete n[e]}return new Ju({...e,checks:[],...ea(r),entries:n})}}));function Ku(t,e){return new Ju({type:"enum",entries:t,...ea(e)})}const Xu=Oa("ZodLiteral",((t,e)=>{fh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def;if(0===n.values.length)return void(i.not={});const a=[];for(const o of n.values)if(void 0===o){if(sl(t,e,i,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof o){if(sl(t,e,i,r,"BigInt literals cannot be represented in JSON Schema"))return;a.push(Number(o))}else a.push(o);if(0===a.length);else if(1===a.length){const t=a[0];i.type=null===t?"null":typeof t,"draft-04"===e.target||"openapi-3.0"===e.target?i.enum=[t]:i.const=t}else a.every((t=>"number"==typeof t))&&(i.type="number"),a.every((t=>"string"==typeof t))&&(i.type="string"),a.every((t=>"boolean"==typeof t))&&(i.type="boolean"),a.every((t=>null===t))&&(i.type="null"),i.enum=a})(t,e,i,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})}));function Qu(t,e){return new Xu({type:"literal",values:Array.isArray(t)?t:[t],...ea(e)})}const tc=Oa("ZodTransform",((t,e)=>{iu(),dh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{sl(t,e,i,r,"Transforms cannot be represented in JSON Schema")})(t,e,i,r),t._zod.parse=(i,r)=>{if("backward"===r.direction)throw new Ca(t.constructor.name);i.addIssue=r=>{if("string"==typeof r)i.issues.push(ba(r,i.value,e));else{const e=r;e.fatal&&(e.continue=!1),e.code??(e.code="custom"),"input"in e||(e.input=i.value),e.inst??(e.inst=t),i.issues.push(ba(e))}};const n=e.transform(i.value,i);return n instanceof Promise?n.then((t=>(i.value=t,i))):(i.value=n,i)}}));const ec=Oa("ZodOptional",((t,e)=>{mh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>Ul(t,e,0,r),t.unwrap=()=>t._zod.def.innerType}));function ic(t){return new ec({type:"optional",innerType:t})}const rc=Oa("ZodExactOptional",((t,e)=>{gh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>Ul(t,e,0,r),t.unwrap=()=>t._zod.def.innerType}));const nc=Oa("ZodNullable",((t,e)=>{_h.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def,a=hl(n.innerType,e,r),o=e.seen.get(t);"openapi-3.0"===e.target?(o.ref=n.innerType,i.nullable=!0):i.anyOf=[a,{type:"null"}]})(t,e,i,r),t.unwrap=()=>t._zod.def.innerType}));function ac(t){return new nc({type:"nullable",innerType:t})}const oc=Oa("ZodDefault",((t,e)=>{bh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def;hl(n.innerType,e,r),e.seen.get(t).ref=n.innerType;const a=Dl(n.defaultValue,t,e,i,r);a!==Ll&&(i.default=a)})(t,e,i,r),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}));const sc=Oa("ZodPrefault",((t,e)=>{wh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def;if(hl(n.innerType,e,r),e.seen.get(t).ref=n.innerType,"input"!==e.io)return;const a=Dl(n.defaultValue,t,e,i,r);a!==Ll&&(i._prefault=a)})(t,e,i,r),t.unwrap=()=>t._zod.def.innerType}));const hc=Oa("ZodNonOptional",((t,e)=>{vh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def;hl(n.innerType,e,r),e.seen.get(t).ref=n.innerType})(t,e,0,r),t.unwrap=()=>t._zod.def.innerType}));const lc=Oa("ZodCatch",((t,e)=>{Eh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def;let a;hl(n.innerType,e,r),e.seen.get(t).ref=n.innerType;try{a=n.catchValue(void 0)}catch{return void sl(t,e,i,r,"Dynamic catch values are not supported in JSON Schema")}i.default=a})(t,e,i,r),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}));const uc=Oa("ZodPipe",((t,e)=>{Sh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def,a=n.in._zod.traits.has("$ZodTransform"),o="input"===e.io?a?n.out:n.in:n.out;hl(o,e,r),e.seen.get(t).ref=o})(t,e,0,r),t.in=e.in,t.out=e.out}));function cc(t,e){return new uc({type:"pipe",in:t,out:e})}const fc=Oa("ZodReadonly",((t,e)=>{Ah.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{const n=t._zod.def;hl(n.innerType,e,r),e.seen.get(t).ref=n.innerType,i.readOnly=!0})(t,e,i,r),t.unwrap=()=>t._zod.def.innerType}));const dc=Oa("ZodFunction",((t,e)=>{zh.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{sl(t,e,i,r,"Function types cannot be represented in JSON Schema")})(t,e,i,r)}));const pc=Oa("ZodCustom",((t,e)=>{Ph.init(t,e),ru.init(t,e),t._zod.processJSONSchema=(e,i,r)=>((t,e,i,r)=>{sl(t,e,i,r,"Custom types cannot be represented in JSON Schema")})(t,e,i,r)}));const mc=Oa("ZodInstanceOf",((t,e)=>{pc.init(t,e)}),{properties(t,e){return this.check(function(t,e){return new Qo({check:"properties",shape:t,...ea(e)})}(t,e))}});function gc(t,e={}){const i=new mc({type:"custom",check:"custom",fn:e=>e instanceof t,abort:!0,...ea(e)});return i._zod.bag.Class=t,i._zod.check=e=>{e.value instanceof t||e.issues.push({code:"invalid_type",expected:t.name,input:e.value,inst:i,path:[...i._zod.def.path??[]]})},i}var _c,bc;(bc=_c||(_c={}))[bc.EXTEND=1]="EXTEND",bc[bc.WRAP=2]="WRAP",bc[bc.CROP=3]="CROP";const yc=Hu({bitmap:Hu({data:Wu([gc(_),gc(Uint8Array)]),width:Ru(),height:Ru()})}),wc=Wu([yc,Hu({src:yc,x:Ru().optional(),y:Ru().optional(),srcX:Ru().optional(),srcY:Ru().optional(),srcW:Ru().optional(),srcH:Ru().optional()})]),vc={blit(t,e){const i=wc.parse(e);let{src:r,x:n=0,y:a=0,srcX:o=0,srcY:s=0,srcW:h=r.bitmap.width,srcH:l=r.bitmap.height}="bitmap"in i?{src:i}:i;if(!("bitmap"in r))throw new Error("The source must be a Jimp image");if("number"!=typeof n||"number"!=typeof a)throw new Error("x and y must be numbers");n=Math.round(n),a=Math.round(a),o=Math.round(o),s=Math.round(s),h=Math.round(h),l=Math.round(l);const u=t.bitmap.width,c=t.bitmap.height;return Ht(r,o,s,h,l,(function(e,i,h){const l=n+e-o,f=a+i-s;if(l>=0&&f>=0&&u-l>0&&c-f>0){const e=t.getPixelIndex(l,f),i={r:r.bitmap.data[h]||0,g:r.bitmap.data[h+1]||0,b:r.bitmap.data[h+2]||0,a:r.bitmap.data[h+3]||0},n={r:t.bitmap.data[e]||0,g:t.bitmap.data[e+1]||0,b:t.bitmap.data[e+2]||0,a:t.bitmap.data[e+3]||0};t.bitmap.data[e]=(i.a*(i.r-n.r)-n.r+255>>8)+n.r,t.bitmap.data[e+1]=(i.a*(i.g-n.g)-n.g+255>>8)+n.g,t.bitmap.data[e+2]=(i.a*(i.b-n.b)-n.b+255>>8)+n.b,t.bitmap.data[e+3]=Yt(n.a+i.a)}})),t}},xc=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],kc=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18],Ec={blur(t,e){if("number"!=typeof e)throw new Error("r must be a number");if(e<1)throw new Error("r must be greater than 0");let i,r,n,a,o,s,h,l,u,c,f,d,p;const m=t.bitmap.width-1,g=t.bitmap.height-1,_=e+1,b=xc[e],y=kc[e],w=[],v=[],x=[],k=[],E=[],S=[];let M=2;for(;M-- >0;){for(d=0,p=0,s=0;s<t.bitmap.height;s++){for(i=t.bitmap.data[p]*_,r=t.bitmap.data[p+1]*_,n=t.bitmap.data[p+2]*_,a=t.bitmap.data[p+3]*_,h=1;h<=e;h++)l=p+((h>m?m:h)<<2),i+=t.bitmap.data[l++],r+=t.bitmap.data[l++],n+=t.bitmap.data[l++],a+=t.bitmap.data[l];for(o=0;o<t.bitmap.width;o++)w[d]=i,v[d]=r,x[d]=n,k[d]=a,0===s&&(E[o]=((l=o+_)<m?l:m)<<2,S[o]=(l=o-e)>0?l<<2:0),u=p+E[o],c=p+S[o],i+=t.bitmap.data[u++]-t.bitmap.data[c++],r+=t.bitmap.data[u++]-t.bitmap.data[c++],n+=t.bitmap.data[u++]-t.bitmap.data[c++],a+=t.bitmap.data[u]-t.bitmap.data[c++],d++;p+=t.bitmap.width<<2}for(o=0;o<t.bitmap.width;o++){for(f=o,i=w[f]*_,r=v[f]*_,n=x[f]*_,a=k[f]*_,h=1;h<=e;h++)f+=h>g?0:t.bitmap.width,i+=w[f],r+=v[f],n+=x[f],a+=k[f];for(d=o<<2,s=0;s<t.bitmap.height;s++)t.bitmap.data[d]=Yt(i*b>>>y),t.bitmap.data[d+1]=Yt(r*b>>>y),t.bitmap.data[d+2]=Yt(n*b>>>y),t.bitmap.data[d+3]=Yt(a*b>>>y),0===o&&(E[s]=((l=s+_)<g?l:g)*t.bitmap.width,S[s]=(l=s-e)>0?l*t.bitmap.width:0),u=o+E[s],c=o+S[s],i+=w[u]-w[c],r+=v[u]-v[c],n+=x[u]-x[c],a+=k[u]-k[c],d+=t.bitmap.width<<2}}return t},gaussian(t,e){if("number"!=typeof e)throw new Error("r must be a number");if(e<1)throw new Error("r must be greater than 0");const i=Math.ceil(2.57*e),r=2*i+1,n=e*e*2,a=n*Math.PI,o=[];for(let t=0;t<r;t++){const e=[];for(let o=0;o<r;o++){const r=(o-i)**2+(t-i)**2;e[o]=Math.exp(-r/n)/a}o.push(e)}for(let e=0;e<t.bitmap.height;e++)for(let n=0;n<t.bitmap.width;n++){let a=0,s=0,h=0,l=0,u=0;for(let c=0;c<r;c++){for(let f=0;f<r;f++){const r=Math.min(t.bitmap.width-1,Math.max(0,f+n-i)),d=Math.min(t.bitmap.height-1,Math.max(0,c+e-i)),p=o[c][f],m=d*t.bitmap.width+r<<2;a+=t.bitmap.data[m]*p,s+=t.bitmap.data[m+1]*p,h+=t.bitmap.data[m+2]*p,l+=t.bitmap.data[m+3]*p,u+=p}const f=e*t.bitmap.width+n<<2;t.bitmap.data[f]=Math.round(a/u),t.bitmap.data[f+1]=Math.round(s/u),t.bitmap.data[f+2]=Math.round(h/u),t.bitmap.data[f+3]=Math.round(l/u)}}return t}},Sc=Hu({x:Ru().optional(),y:Ru().optional(),radius:Ru().min(0).optional()}),Mc={circle(t,e={}){const i=Sc.parse(e),r=i.radius||(t.bitmap.width>t.bitmap.height?t.bitmap.height:t.bitmap.width)/2,n="number"==typeof i.x?i.x:t.bitmap.width/2,a="number"==typeof i.y?i.y:t.bitmap.height/2;return t.scan(((e,i,o)=>{const s=Math.sqrt(Math.pow(e-n,2)+Math.pow(i-a,2));r-s<=0?t.bitmap.data[o+3]=0:r-s<1&&(t.bitmap.data[o+3]=255*(r-s))})),t}},Ac=Gu(Ru()).min(1).array(),Ic=Wu([Ac,Hu({kernel:Ac,edgeHandling:Ku(_c).optional()})]),zc=Wu([Ac,Hu({kernel:Ac,x:Ru().optional(),y:Ru().optional(),w:Ru().optional(),h:Ru().optional()})]),Pc=Ru().min(1).max(1/0),Tc=Wu([Pc,Hu({size:Pc,x:Ru().optional(),y:Ru().optional(),w:Ru().optional(),h:Ru().optional()})]);function Rc(t,e,i,r){const n=[0,0,0,0],a=(e.length-1)/2;for(let o=0;o<e.length;o+=1)for(let s=0;s<e[o].length;s+=1){const h=t.getPixelIndex(i+o-a,r+s-a);n[0]+=t.bitmap.data[h]*e[o][s],n[1]+=t.bitmap.data[h+1]*e[o][s],n[2]+=t.bitmap.data[h+2]*e[o][s],n[3]+=t.bitmap.data[h+3]*e[o][s]}return n}function Oc(t,e,i=50){return{r:(e.r-t.r)*(i/100)+t.r,g:(e.g-t.g)*(i/100)+t.g,b:(e.b-t.b)*(i/100)+t.b}}const Bc=Hu({apply:Qu("hue"),params:Vu([Ru().min(-360).max(360)])}),Cc=Hu({apply:Qu("spin"),params:Vu([Ru().min(-360).max(360)])}),Lc=Hu({apply:Qu("lighten"),params:Vu([Ru().min(0).max(100)]).optional()}),Dc=Hu({r:Ru().min(0).max(255),g:Ru().min(0).max(255),b:Ru().min(0).max(255)}),Uc=Hu({apply:Qu("mix"),params:Wu([Vu([Dc]),Vu([Dc,Ru().min(0).max(100)])])}),Fc=Wu([Bc,Cc,Lc,Uc,Hu({apply:Qu("tint"),params:Vu([Ru().min(0).max(100)]).optional()}),Hu({apply:Qu("shade"),params:Vu([Ru().min(0).max(100)]).optional()}),Hu({apply:Qu("xor"),params:Vu([Dc])}),Hu({apply:Qu("red"),params:Vu([Ru().min(-255).max(255)])}),Hu({apply:Qu("green"),params:Vu([Ru().min(-255).max(255)])}),Hu({apply:Qu("blue"),params:Vu([Ru().min(-255).max(255)])}),Hu({apply:Qu("brighten"),params:Vu([Ru().min(0).max(100)]).optional()}),Hu({apply:Qu("darken"),params:Vu([Ru().min(0).max(100)]).optional()}),Hu({apply:Qu("desaturate"),params:Vu([Ru().min(0).max(100)]).optional()}),Hu({apply:Qu("saturate"),params:Vu([Ru().min(0).max(100)]).optional()}),Hu({apply:Qu("greyscale"),params:Vu([]).optional()})]);const Nc=function(t,e,i){return 255*(t-e)/(i-e)},jc=function(t){return[t.findIndex((t=>t>0)),255-t.slice().reverse().findIndex((t=>t>0))]},Gc={normalize(t){const e=function(t){const e={r:new Array(256).fill(0),g:new Array(256).fill(0),b:new Array(256).fill(0)};return t.scan(((i,r,n)=>{e.r[t.bitmap.data[n+0]]++,e.g[t.bitmap.data[n+1]]++,e.b[t.bitmap.data[n+2]]++})),e}(t),i={r:jc(e.r),g:jc(e.g),b:jc(e.b)};return t.scan(((e,r,n)=>{const a=t.bitmap.data[n+0],o=t.bitmap.data[n+1],s=t.bitmap.data[n+2];t.bitmap.data[n+0]=Nc(a,i.r[0],i.r[1]),t.bitmap.data[n+1]=Nc(o,i.g[0],i.g[1]),t.bitmap.data[n+2]=Nc(s,i.b[0],i.b[1])})),t},invert:t=>(t.scan(((e,i,r)=>{t.bitmap.data[r]=255-t.bitmap.data[r],t.bitmap.data[r+1]=255-t.bitmap.data[r+1],t.bitmap.data[r+2]=255-t.bitmap.data[r+2]})),t),brightness(t,e){if("number"!=typeof e)throw new Error("val must be numbers");return t.scan(((i,r,n)=>{t.bitmap.data[n]=Yt(t.bitmap.data[n]*e),t.bitmap.data[n+1]=Yt(t.bitmap.data[n+1]*e),t.bitmap.data[n+2]=Yt(t.bitmap.data[n+2]*e)})),t},contrast(t,e){if("number"!=typeof e)throw new Error("val must be numbers");if(e<-1||e>1)throw new Error("val must be a number between -1 and +1");const i=(e+1)/(1-e);function r(t){return(t=Math.floor(i*(t-127)+127))<0?0:t>255?255:t}return t.scan(((e,i,n)=>{t.bitmap.data[n]=r(t.bitmap.data[n]),t.bitmap.data[n+1]=r(t.bitmap.data[n+1]),t.bitmap.data[n+2]=r(t.bitmap.data[n+2])})),t},posterize(t,e){if("number"!=typeof e)throw new Error("n must be numbers");return e<2&&(e=2),t.scan(((i,r,n)=>{const a=t.bitmap.data[n],o=t.bitmap.data[n+1],s=t.bitmap.data[n+2];t.bitmap.data[n]=Math.floor(a/255*(e-1))/(e-1)*255,t.bitmap.data[n+1]=Math.floor(o/255*(e-1))/(e-1)*255,t.bitmap.data[n+2]=Math.floor(s/255*(e-1))/(e-1)*255})),t},greyscale:t=>(t.scan(((e,i,r)=>{const n=.2126*t.bitmap.data[r]+.7152*t.bitmap.data[r+1]+.0722*t.bitmap.data[r+2];t.bitmap.data[r]=n,t.bitmap.data[r+1]=n,t.bitmap.data[r+2]=n})),t),opacity(t,e){if("number"!=typeof e)throw new Error("f must be a number");if(e<0||e>1)throw new Error("f must be a number from 0 to 1");return t.scan(((i,r,n)=>{const a=t.bitmap.data[n+3]*e;t.bitmap.data[n+3]=a})),t},sepia:t=>(t.scan(((e,i,r)=>{let n=t.bitmap.data[r],a=t.bitmap.data[r+1],o=t.bitmap.data[r+2];n=.393*n+.769*a+.189*o,a=.349*n+.686*a+.168*o,o=.272*n+.534*a+.131*o,t.bitmap.data[r]=n<255?n:255,t.bitmap.data[r+1]=a<255?a:255,t.bitmap.data[r+2]=o<255?o:255})),t),fade(t,e){if("number"!=typeof e)throw new Error("f must be a number");if(e<0||e>1)throw new Error("f must be a number from 0 to 1");return this.opacity(t,1-e)},convolution(t,e){const i=Ic.parse(e),{kernel:r,edgeHandling:n=_c.EXTEND}="kernel"in i?i:{kernel:i,edgeHandling:void 0};if(!r[0])throw new Error("kernel must be a matrix");const a=_.from(t.bitmap.data),o=r.length,s=r[0].length,h=Math.floor(o/2),l=Math.floor(s/2),u=-h,c=-l;let f,d,p,m,g,b,y,w,v,x;return t.scan(((e,i,o)=>{m=0,p=0,d=0;for(let a=u;a<=h;a++)for(let o=c;o<=l;o++)w=e+o,v=i+a,f=r[a+h][o+l],x=t.getPixelIndex(w,v,n),-1===x?(y=0,b=0,g=0):(g=t.bitmap.data[x+0],b=t.bitmap.data[x+1],y=t.bitmap.data[x+2]),d+=f*g,p+=f*b,m+=f*y;d<0&&(d=0),p<0&&(p=0),m<0&&(m=0),d>255&&(d=255),p>255&&(p=255),m>255&&(m=255),a[o+0]=d,a[o+1]=p,a[o+2]=m})),t.bitmap.data=a,t},opaque:t=>(t.scan(((e,i,r)=>{t.bitmap.data[r+3]=255})),t),pixelate(t,e){const i=Tc.parse(e),{size:r,x:n=0,y:a=0,w:o=t.bitmap.width-n,h:s=t.bitmap.height-a}="number"==typeof i?{size:i}:i,h=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]],l=Zt(t);return Ht(l,n,a,o,s,((e,i,n)=>{e=r*Math.floor(e/r),i=r*Math.floor(i/r);const a=Rc(l,h,e,i);t.bitmap.data[n]=a[0],t.bitmap.data[n+1]=a[1],t.bitmap.data[n+2]=a[2],t.bitmap.data[n+3]=a[3]})),t},convolute(t,e){const i=zc.parse(e),{kernel:r,x:n=0,y:a=0,w:o=t.bitmap.width-n,h:s=t.bitmap.height-a}="kernel"in i?i:{kernel:i},h=Zt(t);return Ht(h,n,a,o,s,((e,i,n)=>{const a=Rc(h,r,e,i);t.bitmap.data[n]=Yt(a[0]),t.bitmap.data[n+1]=Yt(a[1]),t.bitmap.data[n+2]=Yt(a[2]),t.bitmap.data[n+3]=Yt(a[3])})),t},color(t,e){if(!e||!Array.isArray(e))throw new Error("actions must be an array");return e.forEach((t=>Fc.parse(t))),e=e.map((t=>("xor"!==t.apply&&"mix"!==t.apply||(t.params[0]=ct(t.params[0]).toRgb()),t))),t.scan(((i,r,n)=>{let a={r:t.bitmap.data[n],g:t.bitmap.data[n+1],b:t.bitmap.data[n+2]};const o=(t,e)=>Yt(a[t]+e);e.forEach((t=>{if("mix"===t.apply)a=Oc(a,t.params[0],t.params[1]);else if("tint"===t.apply)a=Oc(a,{r:255,g:255,b:255},t.params?.[0]);else if("shade"===t.apply)a=Oc(a,{r:0,g:0,b:0},t.params?.[0]);else if("xor"===t.apply)a={r:a.r^t.params[0].r,g:a.g^t.params[0].g,b:a.b^t.params[0].b};else if("red"===t.apply)a.r=o("r",t.params[0]);else if("green"===t.apply)a.g=o("g",t.params[0]);else if("blue"===t.apply)a.b=o("b",t.params[0]);else{"hue"===t.apply&&(t.apply="spin");const e=ct(a),i=e[t.apply].bind(e);if(!i)throw new Error("action "+t.apply+" not supported");a=i(...t.params||[]).toRgb()}})),t.bitmap.data[n]=a.r,t.bitmap.data[n+1]=a.g,t.bitmap.data[n+2]=a.b})),t}};function Zc(t,e){return t.then((function(t){return[null,t]})).catch((function(t){return[t,void 0]}))}function Hc(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t<arguments.length;t++)this.define(arguments[t]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}Hc.prototype.define=function(t,e){for(let i in t){let r=t[i].map((function(t){return t.toLowerCase()}));i=i.toLowerCase();for(let t=0;t<r.length;t++){const n=r[t];if("*"!==n[0]){if(!e&&n in this._types)throw new Error('Attempt to change mapping for "'+n+'" extension from "'+this._types[n]+'" to "'+i+'". Pass `force=true` to allow this, otherwise remove "'+n+'" from the list of extensions for "'+i+'".');this._types[n]=i}}if(e||!this._extensions[i]){const t=r[0];this._extensions[i]="*"!==t[0]?t:t.substr(1)}}},Hc.prototype.getType=function(t){let e=(t=String(t)).replace(/^.*[/\\]/,"").toLowerCase(),i=e.replace(/^.*\./,"").toLowerCase(),r=e.length<t.length;return(i.length<e.length-1||!r)&&this._types[i]||null},Hc.prototype.getExtension=function(t){return(t=/^\s*([^;\s]*)/.test(t)&&RegExp.$1)&&this._extensions[t.toLowerCase()]||null};var $c,Wc,qc,Yc,Vc,Jc,Kc=e(new Hc({"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}));function Xc(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a;return{r:(t.r*t.a+e.r*e.a*(1-t.a))/r,g:(t.g*t.a+e.g*e.a*(1-t.a))/r,b:(t.b*t.a+e.b*e.a*(1-t.a))/r,a:r}}function Qc(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a;return{r:(e.r*e.a+t.r*t.a*(1-e.a))/r,g:(e.g*e.a+t.g*t.a*(1-e.a))/r,b:(e.b*e.a+t.b*t.a*(1-e.a))/r,a:r}}function tf(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n*s+n*(1-e.a)+s*(1-t.a))/r,g:(a*h+a*(1-e.a)+h*(1-t.a))/r,b:(o*l+o*(1-e.a)+l*(1-t.a))/r,a:r}}function ef(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a;return{r:(n+e.r*e.a)/r,g:(a+e.g*e.a)/r,b:(o+e.b*e.a)/r,a:r}}function rf(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n*e.a+s*t.a-n*s+n*(1-e.a)+s*(1-t.a))/r,g:(a*e.a+h*t.a-a*h+a*(1-e.a)+h*(1-t.a))/r,b:(o*e.a+l*t.a-o*l+o*(1-e.a)+l*(1-t.a))/r,a:r}}function nf(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(2*s<=e.a?2*n*s+n*(1-e.a)+s*(1-t.a):n*(1+e.a)+s*(1+t.a)-2*s*n-e.a*t.a)/r,g:(2*h<=e.a?2*a*h+a*(1-e.a)+h*(1-t.a):a*(1+e.a)+h*(1+t.a)-2*h*a-e.a*t.a)/r,b:(2*l<=e.a?2*o*l+o*(1-e.a)+l*(1-t.a):o*(1+e.a)+l*(1+t.a)-2*l*o-e.a*t.a)/r,a:r}}function af(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(Math.min(n*e.a,s*t.a)+n*(1-e.a)+s*(1-t.a))/r,g:(Math.min(a*e.a,h*t.a)+a*(1-e.a)+h*(1-t.a))/r,b:(Math.min(o*e.a,l*t.a)+o*(1-e.a)+l*(1-t.a))/r,a:r}}function of(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(Math.max(n*e.a,s*t.a)+n*(1-e.a)+s*(1-t.a))/r,g:(Math.max(a*e.a,h*t.a)+a*(1-e.a)+h*(1-t.a))/r,b:(Math.max(o*e.a,l*t.a)+o*(1-e.a)+l*(1-t.a))/r,a:r}}function sf(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(2*n<=t.a?2*n*s+n*(1-e.a)+s*(1-t.a):n*(1+e.a)+s*(1+t.a)-2*s*n-e.a*t.a)/r,g:(2*a<=t.a?2*a*h+a*(1-e.a)+h*(1-t.a):a*(1+e.a)+h*(1+t.a)-2*h*a-e.a*t.a)/r,b:(2*o<=t.a?2*o*l+o*(1-e.a)+l*(1-t.a):o*(1+e.a)+l*(1+t.a)-2*l*o-e.a*t.a)/r,a:r}}function hf(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n+s-2*Math.min(n*e.a,s*t.a))/r,g:(a+h-2*Math.min(a*e.a,h*t.a))/r,b:(o+l-2*Math.min(o*e.a,l*t.a))/r,a:r}}function lf(t,e,i=1){t.a*=i;const r=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n*e.a+s*t.a-2*n*s+n*(1-e.a)+s*(1-t.a))/r,g:(a*e.a+h*t.a-2*a*h+a*(1-e.a)+h*(1-t.a))/r,b:(o*e.a+l*t.a-2*o*l+o*(1-e.a)+l*(1-t.a))/r,a:r}}(Wc=$c||($c={}))[Wc.LEFT=1]="LEFT",Wc[Wc.CENTER=2]="CENTER",Wc[Wc.RIGHT=4]="RIGHT",(Yc=qc||(qc={}))[Yc.TOP=8]="TOP",Yc[Yc.MIDDLE=16]="MIDDLE",Yc[Yc.BOTTOM=32]="BOTTOM",(Jc=Vc||(Vc={})).SRC_OVER="srcOver",Jc.DST_OVER="dstOver",Jc.MULTIPLY="multiply",Jc.ADD="add",Jc.SCREEN="screen",Jc.OVERLAY="overlay",Jc.DARKEN="darken",Jc.LIGHTEN="lighten",Jc.HARD_LIGHT="hardLight",Jc.DIFFERENCE="difference",Jc.EXCLUSION="exclusion";const uf=[Xc,Qc,tf,ef,rf,nf,af,of,sf,hf,lf];var cf=Object.freeze({__proto__:null,add:ef,darken:af,difference:hf,dstOver:Qc,exclusion:lf,hardLight:sf,lighten:of,multiply:tf,names:uf,overlay:nf,screen:rf,srcOver:Xc});function ff(t,e,i=0,r=0,n={}){if(!(e instanceof t.constructor))throw new Error("The source must be a Jimp image");if("number"!=typeof i||"number"!=typeof r)throw new Error("x and y must be numbers");const{mode:a=Vc.SRC_OVER}=n;let{opacitySource:o=1,opacityDest:s=1}=n;("number"!=typeof o||o<0||o>1)&&(o=1),("number"!=typeof s||s<0||s>1)&&(s=1);const h=cf[a];return i=Math.round(i),r=Math.round(r),1!==s&&t.scan(((e,i,r)=>{const n=t.bitmap.data[r+3]*s;t.bitmap.data[r+3]=n})),e.scan(((n,a,s)=>{const l=t.getPixelIndex(i+n,r+a,_c.CROP);if(-1===l)return;const u=h({r:e.bitmap.data[s+0]/255,g:e.bitmap.data[s+1]/255,b:e.bitmap.data[s+2]/255,a:e.bitmap.data[s+3]/255},{r:t.bitmap.data[l+0]/255,g:t.bitmap.data[l+1]/255,b:t.bitmap.data[l+2]/255,a:t.bitmap.data[l+3]/255},o);t.bitmap.data[l+0]=Yt(255*u.r),t.bitmap.data[l+1]=Yt(255*u.g),t.bitmap.data[l+2]=Yt(255*u.b),t.bitmap.data[l+3]=Yt(255*u.a)})),t}function df(t,e){switch(t){case 1:return e.nextUInt8();case 3:case 8:return e.nextUInt16();case 4:case 9:return e.nextUInt32();case 5:return[e.nextUInt32(),e.nextUInt32()];case 6:return e.nextInt8();case 10:return[e.nextInt32(),e.nextInt32()];case 11:return e.nextFloat();case 12:return e.nextDouble();default:throw new Error("Invalid format while decoding: "+t)}}function pf(t,e){var i,r,n=e.nextUInt16(),a=e.nextUInt16(),o=function(t){switch(t){case 1:case 2:case 6:case 7:return 1;case 3:case 8:return 2;case 4:case 9:case 11:return 4;case 5:case 10:case 12:return 8;default:return 0}}(a),s=e.nextUInt32(),h=o*s;if(h>4&&(e=t.openWithOffset(e.nextUInt32())),2===a){var l=(i=e.nextString(s)).indexOf("\0");-1!==l&&(i=i.substr(0,l))}else if(7===a)i=e.nextBuffer(s);else if(0!==a)for(i=[],r=0;r<s;++r)i.push(df(a,e));return h<4&&e.skip(4-h),[n,i,a]}function mf(t,e,i){var r,n,a=e.nextUInt16();for(n=0;n<a;++n)i((r=pf(t,e))[0],r[1],r[2])}var gf={IFD0:1,IFD1:2,GPSIFD:3,SubIFD:4,InteropIFD:5,parseTags:function(t,e){var i,r,n,a;try{i=function(t){if("Exif\0\0"!==t.nextString(6))throw new Error("Invalid EXIF header");var e=t.mark(),i=t.nextUInt16();if(18761===i)t.setBigEndian(!1);else{if(19789!==i)throw new Error("Invalid TIFF header");t.setBigEndian(!0)}if(42!==t.nextUInt16())throw new Error("Invalid TIFF data");return e}(t)}catch(t){return!1}var o=i.openWithOffset(t.nextUInt32()),s=this.IFD0;mf(i,o,(function(t,i,a){switch(t){case 34853:n=i[0];break;case 34665:r=i[0];break;default:e(s,t,i,a)}}));var h=o.nextUInt32();if(0!==h){var l=i.openWithOffset(h);mf(i,l,e.bind(null,this.IFD1))}if(n){var u=i.openWithOffset(n);mf(i,u,e.bind(null,this.GPSIFD))}if(r){var c=i.openWithOffset(r),f=this.InteropIFD;mf(i,c,(function(t,i,r){40965===t?a=i[0]:e(f,t,i,r)}))}if(a){var d=i.openWithOffset(a);mf(i,d,e.bind(null,this.InteropIFD))}return!0}};function _f(t){return parseInt(t,10)}var bf=3600,yf=60;function wf(t,e){t=t.map(_f),e=e.map(_f);var i=t[0],r=t[1]-1,n=t[2],a=e[0],o=e[1],s=e[2];return Date.UTC(i,r,n,a,o,s,0)/1e3}function vf(t){var e=t.substr(0,10).split("-"),i=t.substr(11,8).split(":"),r=t.substr(19,6).split(":").map(_f),n=r[0]*bf+r[1]*yf,a=wf(e,i);if("number"==typeof(a-=n)&&!isNaN(a))return a}function xf(t){var e=t.split(" "),i=wf(e[0].split(":"),e[1].split(":"));if("number"==typeof i&&!isNaN(i))return i}var kf,Ef,Sf={parseDateWithSpecFormat:xf,parseDateWithTimezoneFormat:vf,parseExifDate:function(t){var e=19===t.length&&":"===t.charAt(4);return 25===t.length&&"T"===t.charAt(10)?vf(t):e?xf(t):void 0}},Mf=[{section:gf.GPSIFD,type:2,name:"GPSLatitude",refType:1,refName:"GPSLatitudeRef",posVal:"N"},{section:gf.GPSIFD,type:4,name:"GPSLongitude",refType:3,refName:"GPSLongitudeRef",posVal:"E"}],Af=[{section:gf.SubIFD,type:306,name:"ModifyDate"},{section:gf.SubIFD,type:36867,name:"DateTimeOriginal"},{section:gf.SubIFD,type:36868,name:"CreateDate"},{section:gf.SubIFD,type:306,name:"ModifyDate"}],If={castDegreeValues:function(t,e){Mf.forEach((function(i){var r=t(i);if(r){var n=t({section:i.section,type:i.refType,name:i.refName})===i.posVal?1:-1,a=(r[0]+r[1]/60+r[2]/3600)*n;e(i,a)}}))},castDateValues:function(t,e){Af.forEach((function(i){var r=t(i);if(r){var n=Sf.parseExifDate(r);void 0!==n&&e(i,n)}}))},simplifyValue:function(t,e){return Array.isArray(t)&&1===(t=t.map((function(t){return 10===e||5===e?t[0]/t[1]:t}))).length&&(t=t[0]),t}};var zf,Pf,Tf,Rf,Of={parseSections:function(t,e){var i,r;for(t.setBigEndian(!0);t.remainingLength()>0&&218!==r;){if(255!==t.nextUInt8())throw new Error("Invalid JPEG section offset");i=(r=t.nextUInt8())>=208&&r<=217||218===r?0:t.nextUInt16()-2,e(r,t.branch(0,i)),t.skip(i)}},getSizeFromSOFSection:function(t){return t.skip(1),{height:t.nextUInt16(),width:t.nextUInt16()}},getSectionName:function(t){var e,i;switch(t){case 216:e="SOI";break;case 196:e="DHT";break;case 219:e="DQT";break;case 221:e="DRI";break;case 218:e="SOS";break;case 254:e="COM";break;case 217:e="EOI";break;default:t>=224&&t<=239?(e="APP",i=t-224):t>=192&&t<=207&&196!==t&&200!==t&&204!==t?(e="SOF",i=t-192):t>=208&&t<=215&&(e="RST",i=t-208)}var r={name:e};return"number"==typeof i&&(r.index=i),r}},Bf=gf,Cf=If;function Lf(t,e,i,r,n,a,o){this.startMarker=t,this.tags=e,this.imageSize=i,this.thumbnailOffset=r,this.thumbnailLength=n,this.thumbnailType=a,this.app1Offset=o}function Df(t){this.stream=t,this.flags={readBinaryTags:!1,resolveTagNames:!0,simplifyValues:!0,imageSize:!0,hidePointers:!0,returnTags:!0}}Lf.prototype={hasThumbnail:function(t){return!(!this.thumbnailOffset||!this.thumbnailLength)&&("string"!=typeof t||("image/jpeg"===t.toLowerCase().trim()?6===this.thumbnailType:"image/tiff"===t.toLowerCase().trim()&&1===this.thumbnailType))},getThumbnailOffset:function(){return this.app1Offset+6+this.thumbnailOffset},getThumbnailLength:function(){return this.thumbnailLength},getThumbnailBuffer:function(){return this._getThumbnailStream().nextBuffer(this.thumbnailLength)},_getThumbnailStream:function(){return this.startMarker.openWithOffset(this.getThumbnailOffset())},getImageSize:function(){return this.imageSize},getThumbnailSize:function(){var t,e=this._getThumbnailStream();return Of.parseSections(e,(function(e,i){"SOF"===Of.getSectionName(e).name&&(t=Of.getSizeFromSOFSection(i))})),t}},Df.prototype={enableBinaryFields:function(t){return this.flags.readBinaryTags=!!t,this},enablePointers:function(t){return this.flags.hidePointers=!t,this},enableTagNames:function(t){return this.flags.resolveTagNames=!!t,this},enableImageSize:function(t){return this.flags.imageSize=!!t,this},enableReturnTags:function(t){return this.flags.returnTags=!!t,this},enableSimpleValues:function(t){return this.flags.simplifyValues=!!t,this},parse:function(){var t,e,i,r,n,a,o,s,h,l=this.stream.mark(),u=l.openWithOffset(0),c=this.flags;return c.resolveTagNames&&(o=Ef?kf:(Ef=1,kf={exif:{1:"InteropIndex",2:"InteropVersion",11:"ProcessingSoftware",254:"SubfileType",255:"OldSubfileType",256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",263:"Thresholding",264:"CellWidth",265:"CellLength",266:"FillOrder",269:"DocumentName",270:"ImageDescription",271:"Make",272:"Model",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",280:"MinSampleValue",281:"MaxSampleValue",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",285:"PageName",286:"XPosition",287:"YPosition",288:"FreeOffsets",289:"FreeByteCounts",290:"GrayResponseUnit",291:"GrayResponseCurve",292:"T4Options",293:"T6Options",296:"ResolutionUnit",297:"PageNumber",300:"ColorResponseUnit",301:"TransferFunction",305:"Software",306:"ModifyDate",315:"Artist",316:"HostComputer",317:"Predictor",318:"WhitePoint",319:"PrimaryChromaticities",320:"ColorMap",321:"HalftoneHints",322:"TileWidth",323:"TileLength",324:"TileOffsets",325:"TileByteCounts",326:"BadFaxLines",327:"CleanFaxData",328:"ConsecutiveBadFaxLines",330:"SubIFD",332:"InkSet",333:"InkNames",334:"NumberofInks",336:"DotRange",337:"TargetPrinter",338:"ExtraSamples",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",342:"TransferRange",343:"ClipPath",344:"XClipPathUnits",345:"YClipPathUnits",346:"Indexed",347:"JPEGTables",351:"OPIProxy",400:"GlobalParametersIFD",401:"ProfileType",402:"FaxProfile",403:"CodingMethods",404:"VersionYear",405:"ModeNumber",433:"Decode",434:"DefaultImageColor",435:"T82Options",437:"JPEGTables",512:"JPEGProc",513:"ThumbnailOffset",514:"ThumbnailLength",515:"JPEGRestartInterval",517:"JPEGLosslessPredictors",518:"JPEGPointTransforms",519:"JPEGQTables",520:"JPEGDCTables",521:"JPEGACTables",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite",559:"StripRowCounts",700:"ApplicationNotes",999:"USPTOMiscellaneous",4096:"RelatedImageFileFormat",4097:"RelatedImageWidth",4098:"RelatedImageHeight",18246:"Rating",18247:"XP_DIP_XML",18248:"StitchInfo",18249:"RatingPercent",32781:"ImageID",32931:"WangTag1",32932:"WangAnnotation",32933:"WangTag3",32934:"WangTag4",32995:"Matteing",32996:"DataType",32997:"ImageDepth",32998:"TileDepth",33405:"Model2",33421:"CFARepeatPatternDim",33422:"CFAPattern2",33423:"BatteryLevel",33424:"KodakIFD",33432:"Copyright",33434:"ExposureTime",33437:"FNumber",33445:"MDFileTag",33446:"MDScalePixel",33447:"MDColorTable",33448:"MDLabName",33449:"MDSampleInfo",33450:"MDPrepDate",33451:"MDPrepTime",33452:"MDFileUnits",33550:"PixelScale",33589:"AdventScale",33590:"AdventRevision",33628:"UIC1Tag",33629:"UIC2Tag",33630:"UIC3Tag",33631:"UIC4Tag",33723:"IPTC-NAA",33918:"IntergraphPacketData",33919:"IntergraphFlagRegisters",33920:"IntergraphMatrix",33921:"INGRReserved",33922:"ModelTiePoint",34016:"Site",34017:"ColorSequence",34018:"IT8Header",34019:"RasterPadding",34020:"BitsPerRunLength",34021:"BitsPerExtendedRunLength",34022:"ColorTable",34023:"ImageColorIndicator",34024:"BackgroundColorIndicator",34025:"ImageColorValue",34026:"BackgroundColorValue",34027:"PixelIntensityRange",34028:"TransparencyIndicator",34029:"ColorCharacterization",34030:"HCUsage",34031:"TrapIndicator",34032:"CMYKEquivalent",34118:"SEMInfo",34152:"AFCP_IPTC",34232:"PixelMagicJBIGOptions",34264:"ModelTransform",34306:"WB_GRGBLevels",34310:"LeafData",34377:"PhotoshopSettings",34665:"ExifOffset",34675:"ICC_Profile",34687:"TIFF_FXExtensions",34688:"MultiProfiles",34689:"SharedData",34690:"T88Options",34732:"ImageLayer",34735:"GeoTiffDirectory",34736:"GeoTiffDoubleParams",34737:"GeoTiffAsciiParams",34850:"ExposureProgram",34852:"SpectralSensitivity",34853:"GPSInfo",34855:"ISO",34856:"Opto-ElectricConvFactor",34857:"Interlace",34858:"TimeZoneOffset",34859:"SelfTimerMode",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",34908:"FaxRecvParams",34909:"FaxSubAddress",34910:"FaxRecvTime",34954:"LeafSubIFD",36864:"ExifVersion",36867:"DateTimeOriginal",36868:"CreateDate",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureCompensation",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",37387:"FlashEnergy",37388:"SpatialFrequencyResponse",37389:"Noise",37390:"FocalPlaneXResolution",37391:"FocalPlaneYResolution",37392:"FocalPlaneResolutionUnit",37393:"ImageNumber",37394:"SecurityClassification",37395:"ImageHistory",37396:"SubjectArea",37397:"ExposureIndex",37398:"TIFF-EPStandardID",37399:"SensingMethod",37434:"CIP3DataFile",37435:"CIP3Sheet",37436:"CIP3Side",37439:"StoNits",37500:"MakerNote",37510:"UserComment",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",37679:"MSDocumentText",37680:"MSPropertySetStorage",37681:"MSDocumentTextPosition",37724:"ImageSourceData",40091:"XPTitle",40092:"XPComment",40093:"XPAuthor",40094:"XPKeywords",40095:"XPSubject",40960:"FlashpixVersion",40961:"ColorSpace",40962:"ExifImageWidth",40963:"ExifImageHeight",40964:"RelatedSoundFile",40965:"InteropOffset",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41485:"Noise",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41489:"ImageNumber",41490:"SecurityClassification",41491:"ImageHistory",41492:"SubjectLocation",41493:"ExposureIndex",41494:"TIFF-EPStandardID",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFormat",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"OwnerName",42033:"SerialNumber",42034:"LensInfo",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",42112:"GDALMetadata",42113:"GDALNoData",42240:"Gamma",44992:"ExpandSoftware",44993:"ExpandLens",44994:"ExpandFilm",44995:"ExpandFilterLens",44996:"ExpandScanner",44997:"ExpandFlashLamp",48129:"PixelFormat",48130:"Transformation",48131:"Uncompressed",48132:"ImageType",48256:"ImageWidth",48257:"ImageHeight",48258:"WidthResolution",48259:"HeightResolution",48320:"ImageOffset",48321:"ImageByteCount",48322:"AlphaOffset",48323:"AlphaByteCount",48324:"ImageDataDiscard",48325:"AlphaDataDiscard",50215:"OceScanjobDesc",50216:"OceApplicationSelector",50217:"OceIDNumber",50218:"OceImageLogic",50255:"Annotations",50341:"PrintIM",50560:"USPTOOriginalContentType",50706:"DNGVersion",50707:"DNGBackwardVersion",50708:"UniqueCameraModel",50709:"LocalizedCameraModel",50710:"CFAPlaneColor",50711:"CFALayout",50712:"LinearizationTable",50713:"BlackLevelRepeatDim",50714:"BlackLevel",50715:"BlackLevelDeltaH",50716:"BlackLevelDeltaV",50717:"WhiteLevel",50718:"DefaultScale",50719:"DefaultCropOrigin",50720:"DefaultCropSize",50721:"ColorMatrix1",50722:"ColorMatrix2",50723:"CameraCalibration1",50724:"CameraCalibration2",50725:"ReductionMatrix1",50726:"ReductionMatrix2",50727:"AnalogBalance",50728:"AsShotNeutral",50729:"AsShotWhiteXY",50730:"BaselineExposure",50731:"BaselineNoise",50732:"BaselineSharpness",50733:"BayerGreenSplit",50734:"LinearResponseLimit",50735:"CameraSerialNumber",50736:"DNGLensInfo",50737:"ChromaBlurRadius",50738:"AntiAliasStrength",50739:"ShadowScale",50740:"DNGPrivateData",50741:"MakerNoteSafety",50752:"RawImageSegmentation",50778:"CalibrationIlluminant1",50779:"CalibrationIlluminant2",50780:"BestQualityScale",50781:"RawDataUniqueID",50784:"AliasLayerMetadata",50827:"OriginalRawFileName",50828:"OriginalRawFileData",50829:"ActiveArea",50830:"MaskedAreas",50831:"AsShotICCProfile",50832:"AsShotPreProfileMatrix",50833:"CurrentICCProfile",50834:"CurrentPreProfileMatrix",50879:"ColorimetricReference",50898:"PanasonicTitle",50899:"PanasonicTitle2",50931:"CameraCalibrationSig",50932:"ProfileCalibrationSig",50933:"ProfileIFD",50934:"AsShotProfileName",50935:"NoiseReductionApplied",50936:"ProfileName",50937:"ProfileHueSatMapDims",50938:"ProfileHueSatMapData1",50939:"ProfileHueSatMapData2",50940:"ProfileToneCurve",50941:"ProfileEmbedPolicy",50942:"ProfileCopyright",50964:"ForwardMatrix1",50965:"ForwardMatrix2",50966:"PreviewApplicationName",50967:"PreviewApplicationVersion",50968:"PreviewSettingsName",50969:"PreviewSettingsDigest",50970:"PreviewColorSpace",50971:"PreviewDateTime",50972:"RawImageDigest",50973:"OriginalRawFileDigest",50974:"SubTileBlockSize",50975:"RowInterleaveFactor",50981:"ProfileLookTableDims",50982:"ProfileLookTableData",51008:"OpcodeList1",51009:"OpcodeList2",51022:"OpcodeList3",51041:"NoiseProfile",51043:"TimeCodes",51044:"FrameRate",51058:"TStop",51081:"ReelName",51089:"OriginalDefaultFinalSize",51090:"OriginalBestQualitySize",51091:"OriginalDefaultCropSize",51105:"CameraLabel",51107:"ProfileHueSatMapEncoding",51108:"ProfileLookTableEncoding",51109:"BaselineExposureOffset",51110:"DefaultBlackRender",51111:"NewRawImageDigest",51112:"RawToPreviewGain",51125:"DefaultUserCrop",59932:"Padding",59933:"OffsetSchema",65e3:"OwnerName",65001:"SerialNumber",65002:"Lens",65024:"KDC_IFD",65100:"RawFile",65101:"Converter",65102:"WhiteBalance",65105:"Exposure",65106:"Shadows",65107:"Brightness",65108:"Contrast",65109:"Saturation",65110:"Sharpness",65111:"Smoothness",65112:"MoireFilter"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"}})),c.resolveTagNames?(t={},s=function(e){return t[e.name]},h=function(e,i){t[e.name]=i}):(t=[],s=function(e){var i;for(i=0;i<t.length;++i)if(t[i].type===e.type&&t[i].section===e.section)return t.value},h=function(e,i){var r;for(r=0;r<t.length;++r)if(t[r].type===e.type&&t[r].section===e.section)return void(t.value=i)}),Of.parseSections(u,(function(s,h){var u=h.offsetFrom(l);225===s?Bf.parseTags(h,(function(e,a,s,h){if(c.readBinaryTags||7!==h){if(513===a){if(i=s[0],c.hidePointers)return}else if(514===a){if(r=s[0],c.hidePointers)return}else if(259===a&&(n=s[0],c.hidePointers))return;if(c.returnTags)if(c.simplifyValues&&(s=Cf.simplifyValue(s,h)),c.resolveTagNames){var l=(e===Bf.GPSIFD?o.gps:o.exif)[a];l||(l=o.exif[a]),t.hasOwnProperty(l)||(t[l]=s)}else t.push({section:e,type:a,value:s})}}))&&(a=u):c.imageSize&&"SOF"===Of.getSectionName(s).name&&(e=Of.getSizeFromSOFSection(h))})),c.simplifyValues&&(Cf.castDegreeValues(s,h),Cf.castDateValues(s,h)),new Lf(l,t,e,i,r,n,a)}};var Uf=Df;var Ff=e({create:function(t,e){if(t instanceof(e=e||(0,eval)("this")).ArrayBuffer){var i=function(){if(Pf)return zf;function t(t,e,i,r,n,a){this.global=n,e=e||0,i=i||t.byteLength-e,this.arrayBuffer=t.slice(e,e+i),this.view=new n.DataView(this.arrayBuffer,0,this.arrayBuffer.byteLength),this.setBigEndian(r),this.offset=0,this.parentOffset=(a||0)+e}return Pf=1,t.prototype={setBigEndian:function(t){this.littleEndian=!t},nextUInt8:function(){var t=this.view.getUint8(this.offset);return this.offset+=1,t},nextInt8:function(){var t=this.view.getInt8(this.offset);return this.offset+=1,t},nextUInt16:function(){var t=this.view.getUint16(this.offset,this.littleEndian);return this.offset+=2,t},nextUInt32:function(){var t=this.view.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},nextInt16:function(){var t=this.view.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},nextInt32:function(){var t=this.view.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},nextFloat:function(){var t=this.view.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},nextDouble:function(){var t=this.view.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},nextBuffer:function(t){var e=this.arrayBuffer.slice(this.offset,this.offset+t);return this.offset+=t,e},remainingLength:function(){return this.arrayBuffer.byteLength-this.offset},nextString:function(t){var e=this.arrayBuffer.slice(this.offset,this.offset+t);return e=String.fromCharCode.apply(null,new this.global.Uint8Array(e)),this.offset+=t,e},mark:function(){var e=this;return{openWithOffset:function(i){return i=(i||0)+this.offset,new t(e.arrayBuffer,i,e.arrayBuffer.byteLength-i,!e.littleEndian,e.global,e.parentOffset)},offset:this.offset,getParentOffset:function(){return e.parentOffset}}},offsetFrom:function(t){return this.parentOffset+this.offset-(t.offset+t.getParentOffset())},skip:function(t){this.offset+=t},branch:function(e,i){return i="number"==typeof i?i:this.arrayBuffer.byteLength-(this.offset+e),new t(this.arrayBuffer,this.offset+e,i,!this.littleEndian,this.global,this.parentOffset)}},zf=t}();return new Uf(new i(t,0,t.byteLength,!0,e))}var r=function(){if(Rf)return Tf;function t(t,e,i,r){this.buffer=t,this.offset=e||0,i="number"==typeof i?i:t.length,this.endPosition=this.offset+i,this.setBigEndian(r)}return Rf=1,t.prototype={setBigEndian:function(t){this.bigEndian=!!t},nextUInt8:function(){var t=this.buffer.readUInt8(this.offset);return this.offset+=1,t},nextInt8:function(){var t=this.buffer.readInt8(this.offset);return this.offset+=1,t},nextUInt16:function(){var t=this.bigEndian?this.buffer.readUInt16BE(this.offset):this.buffer.readUInt16LE(this.offset);return this.offset+=2,t},nextUInt32:function(){var t=this.bigEndian?this.buffer.readUInt32BE(this.offset):this.buffer.readUInt32LE(this.offset);return this.offset+=4,t},nextInt16:function(){var t=this.bigEndian?this.buffer.readInt16BE(this.offset):this.buffer.readInt16LE(this.offset);return this.offset+=2,t},nextInt32:function(){var t=this.bigEndian?this.buffer.readInt32BE(this.offset):this.buffer.readInt32LE(this.offset);return this.offset+=4,t},nextFloat:function(){var t=this.bigEndian?this.buffer.readFloatBE(this.offset):this.buffer.readFloatLE(this.offset);return this.offset+=4,t},nextDouble:function(){var t=this.bigEndian?this.buffer.readDoubleBE(this.offset):this.buffer.readDoubleLE(this.offset);return this.offset+=8,t},nextBuffer:function(t){var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},remainingLength:function(){return this.endPosition-this.offset},nextString:function(t){var e=this.buffer.toString("utf8",this.offset,this.offset+t);return this.offset+=t,e},mark:function(){var e=this;return{openWithOffset:function(i){return i=(i||0)+this.offset,new t(e.buffer,i,e.endPosition-i,e.bigEndian)},offset:this.offset}},offsetFrom:function(t){return this.offset-t.offset},skip:function(t){this.offset+=t},branch:function(e,i){return i="number"==typeof i?i:this.endPosition-(this.offset+e),new t(this.buffer,this.offset+e,i,this.bigEndian)}},Tf=t}();return new Uf(new r(t,0,t.length,!0))}});function Nf(t){const e=t._exif;return e&&e.tags&&e.tags.Orientation||1}function jf(t){if(Nf(t)<2)return;const e=function(t){const e=t.bitmap.width,i=t.bitmap.height;switch(Nf(t)){case 1:default:return null;case 2:return function(t,i){return[e-t-1,i]};case 3:return function(t,r){return[e-t-1,i-r-1]};case 4:return function(t,e){return[t,i-e-1]};case 5:return function(t,e){return[e,t]};case 6:return function(t,e){return[e,i-t-1]};case 7:return function(t,r){return[e-r-1,i-t-1]};case 8:return function(t,i){return[e-i-1,t]}}}(t),i=Nf(t)>4,r=i?t.bitmap.height:t.bitmap.width,n=i?t.bitmap.width:t.bitmap.height;e&&function(t,e,i,r){const n=t.bitmap.data,a=t.bitmap.width,o=_.alloc(n.length);for(let t=0;t<e;t++)for(let s=0;s<i;s++){const[i,h]=r(t,s),l=e*s+t<<2,u=a*h+i<<2,c=n.readUInt32BE(u);o.writeUInt32BE(c,l)}t.bitmap.data=o,t.bitmap.width=e,t.bitmap.height=i,t._exif.tags.Orientation=1}(t,r,n,e)}var Gf=Object.defineProperty,Zf=(t,e,i)=>((t,e,i)=>e in t?Gf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);const Hf={data:_.alloc(0),width:0,height:0};function $f(t){const e=_.alloc(t.byteLength),i=new Uint8Array(t);for(let t=0;t<e.length;++t)e[t]=i[t];return e}function Wf({plugins:t,formats:e}={}){const i=t||[],r=(e||[]).map((t=>t())),n=class{constructor(t=Hf){if(Zf(this,"bitmap",Hf),Zf(this,"background",0),Zf(this,"formats",[]),Zf(this,"mime"),this.formats=r,"data"in t)this.bitmap=t;else if(this.bitmap={data:_.alloc(t.width*t.height*4),width:t.width,height:t.height},t.color){this.background="string"==typeof t.color?Vt(t.color):t.color;for(let t=0;t<this.bitmap.data.length;t+=4)this.bitmap.data.writeUInt32BE(this.background,t)}for(const t of i)for(const e in t)this[e]=(...i)=>{const r=t[e]?.(this,...i);return"object"==typeof r&&"bitmap"in r?(this.bitmap=r.bitmap,this):r}}static async read(t,e){if(_.isBuffer(t)||t instanceof ArrayBuffer)return this.fromBuffer(t);const[i,r]=await Zc(fetch(t));if(i)throw new Error(`Could not load Buffer from URL: ${t}`);if(!r.ok)throw new Error(`HTTP Status ${r.status} for url ${t}`);const[n,a]=await Zc(r.arrayBuffer());if(n)throw new Error(`Could not load Buffer from ${t}`);const o=$f(a);return this.fromBuffer(o,e)}static fromBitmap(t){let e;if(t.data instanceof _&&(e=_.from(t.data)),(t.data instanceof Uint8Array||t.data instanceof Uint8ClampedArray)&&(e=_.from(t.data.buffer)),Array.isArray(t.data)&&(e=_.concat(t.data.map((t=>_.from(t.toString(16).padStart(8,"0"),"hex"))))),!e)throw new Error("data must be a Buffer");if("number"!=typeof t.height||"number"!=typeof t.width)throw new Error("bitmap must have width and height");return new n({height:t.height,width:t.width,data:e})}static async fromBuffer(t,e){const i=t instanceof ArrayBuffer?$f(t):t,a=await async function(t){const{fileTypeFromBuffer:e}=await Promise.resolve().then((function(){return Db}));return e(t instanceof ArrayBuffer?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}(i);if(!a||!a.mime)throw new Error("Could not find MIME for Buffer");const o=r.find((t=>t.mime===a.mime));if(!o||!o.decode)throw new Error(`Mime type ${a.mime} does not support decoding`);const s=new n(await o.decode(i,e?.[o.mime]));return s.mime=a.mime,async function(t,e){try{t._exif=Ff.create(e).parse(),jf(t)}catch{}}(s,i),s}inspect(){return"<Jimp "+(this.bitmap===Hf?"pending...":this.bitmap.width+"x"+this.bitmap.height)+">"}toString(){return"[object Jimp]"}get width(){return this.bitmap.width}get height(){return this.bitmap.height}async getBuffer(t,e){const i=this.formats.find((e=>e.mime===t));if(!i||!i.encode)throw new Error(`Unsupported MIME type: ${t}`);let r;return i.hasAlpha?r=this:(r=new n({width:this.bitmap.width,height:this.bitmap.height,color:this.background}),ff(r,this)),i.encode(r.bitmap,e)}async getBase64(t,e){return"data:"+t+";base64,"+(await this.getBuffer(t,e)).toString("base64")}async write(t,e){const i=Kc.getType(t);await(async()=>{throw new Error("Not supported")})(await this.getBuffer(i,e))}clone(){return new n({...this.bitmap,data:_.from(this.bitmap.data)})}getPixelIndex(t,e,i){let r,n;if(i||(i=_c.EXTEND),"number"!=typeof t||"number"!=typeof e)throw new Error("x and y must be numbers");r=t=Math.round(t),n=e=Math.round(e),i===_c.EXTEND&&(t<0&&(r=0),t>=this.bitmap.width&&(r=this.bitmap.width-1),e<0&&(n=0),e>=this.bitmap.height&&(n=this.bitmap.height-1)),i===_c.WRAP&&(t<0&&(r=this.bitmap.width+t),t>=this.bitmap.width&&(r=t%this.bitmap.width),e<0&&(n=this.bitmap.height+e),e>=this.bitmap.height&&(n=e%this.bitmap.height));let a=this.bitmap.width*n+r<<2;return(r<0||r>=this.bitmap.width)&&(a=-1),(n<0||n>=this.bitmap.height)&&(a=-1),a}getPixelColor(t,e){if("number"!=typeof t||"number"!=typeof e)throw new Error("x and y must be numbers");const i=this.getPixelIndex(t,e);return this.bitmap.data.readUInt32BE(i)}setPixelColor(t,e,i){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof i)throw new Error("hex, x and y must be numbers");const r=this.getPixelIndex(e,i);return this.bitmap.data.writeUInt32BE(t,r),this}hasAlpha(){const{width:t,height:e,data:i}=this.bitmap,r=t*e<<2;for(let t=3;t<r;t+=4)if(255!==i[t])return!0;return!1}composite(t,e=0,i=0,r={}){return ff(this,t,e,i,r)}scan(t,e,i,r,n){return Ht(this,t,e,i,r,n)}scanIterator(t=0,e=0,i=this.bitmap.width,r=this.bitmap.height){if("number"!=typeof t||"number"!=typeof e)throw new Error("x and y must be numbers");if("number"!=typeof i||"number"!=typeof r)throw new Error("w and h must be numbers");return function*(t,e,i,r,n){e=Math.round(e),i=Math.round(i),r=Math.round(r),n=Math.round(n);for(let a=i;a<i+n;a++)for(let i=e;i<e+r;i++){const e=t.bitmap.width*a+i<<2;yield{x:i,y:a,idx:e,image:t}}}(this,t,e,i,r)}};return n}var qf,Yf;function Vf(t,e,i,r,n,a,o){this.widthOriginal=Math.abs(Math.floor(t)||0),this.heightOriginal=Math.abs(Math.floor(e)||0),this.targetWidth=Math.abs(Math.floor(i)||0),this.targetHeight=Math.abs(Math.floor(r)||0),this.colorChannels=n?4:3,this.interpolationPass=Boolean(a),this.resizeCallback="function"==typeof o?o:function(){},this.targetWidthMultipliedByChannels=this.targetWidth*this.colorChannels,this.originalWidthMultipliedByChannels=this.widthOriginal*this.colorChannels,this.originalHeightMultipliedByChannels=this.heightOriginal*this.colorChannels,this.widthPassResultSize=this.targetWidthMultipliedByChannels*this.heightOriginal,this.finalResultSize=this.targetWidthMultipliedByChannels*this.targetHeight,this.initialize()}(Yf=qf||(qf={})).NEAREST_NEIGHBOR="nearestNeighbor",Yf.BILINEAR="bilinearInterpolation",Yf.BICUBIC="bicubicInterpolation",Yf.HERMITE="hermiteInterpolation",Yf.BEZIER="bezierInterpolation",Vf.prototype.initialize=function(){if(!(this.widthOriginal>0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw console.log(this),new Error("Invalid settings specified for the resizer.");this.configurePasses()},Vf.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=4===this.colorChannels?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=4===this.colorChannels?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=4===this.colorChannels?this.resizeHeightRGBA:this.resizeHeightRGB))},Vf.prototype._resizeWidthInterpolatedRGBChannels=function(t,e){const i=e?4:3,r=this.ratioWeightWidthPass,n=this.widthBuffer;let a,o,s=0,h=0,l=0,u=0,c=0;for(a=0;s<1/3;a+=i,s+=r)for(h=a,l=0;h<this.widthPassResultSize;l+=this.originalWidthMultipliedByChannels,h+=this.targetWidthMultipliedByChannels)n[h]=t[l],n[h+1]=t[l+1],n[h+2]=t[l+2],e&&(n[h+3]=t[l+3]);for(s-=1/3,o=this.widthOriginal-1;s<o;a+=i,s+=r)for(c=s%1,u=1-c,h=a,l=Math.floor(s)*i;h<this.widthPassResultSize;l+=this.originalWidthMultipliedByChannels,h+=this.targetWidthMultipliedByChannels)n[h+0]=t[l+0]*u+t[l+i+0]*c,n[h+1]=t[l+1]*u+t[l+i+1]*c,n[h+2]=t[l+2]*u+t[l+i+2]*c,e&&(n[h+3]=t[l+3]*u+t[l+i+3]*c);for(o=this.originalWidthMultipliedByChannels-i;a<this.targetWidthMultipliedByChannels;a+=i)for(h=a,l=o;h<this.widthPassResultSize;l+=this.originalWidthMultipliedByChannels,h+=this.targetWidthMultipliedByChannels)n[h]=t[l],n[h+1]=t[l+1],n[h+2]=t[l+2],e&&(n[h+3]=t[l+3]);return n},Vf.prototype._resizeWidthRGBChannels=function(t,e){const i=e?4:3,r=this.ratioWeightWidthPass,n=1/r,a=this.originalWidthMultipliedByChannels-i+1,o=this.targetWidthMultipliedByChannels-i+1,s=this.outputWidthWorkBench,h=this.widthBuffer,l=this.outputWidthWorkBenchOpaquePixelsCount;let u=0,c=0,f=0,d=0,p=0,m=0,g=0,_=1,b=0,y=0,w=0,v=0;do{for(p=0;p<this.originalHeightMultipliedByChannels;)s[p++]=0,s[p++]=0,s[p++]=0,e&&(s[p++]=0,l[p/i-1]=0);u=r;do{for(c=1+f-d,_=Math.min(u,c),p=0,m=f;p<this.originalHeightMultipliedByChannels;m+=a)b=t[m],y=t[++m],w=t[++m],v=e?t[++m]:255,s[p++]+=(v?b:0)*_,s[p++]+=(v?y:0)*_,s[p++]+=(v?w:0)*_,e&&(s[p++]+=v*_,l[p/i-1]+=v?_:0);if(!(u>=c)){d+=u;break}f+=i,d=f,u-=c}while(u>0&&f<this.originalWidthMultipliedByChannels);for(p=0,m=g;p<this.originalHeightMultipliedByChannels;m+=o)u=e?l[p/i]:1,_=e?u?1/u:0:n,h[m]=s[p++]*_,h[++m]=s[p++]*_,h[++m]=s[p++]*_,e&&(h[++m]=s[p++]*n);g+=i}while(g<this.targetWidthMultipliedByChannels);return h},Vf.prototype._resizeHeightRGBChannels=function(t,e){const i=this.ratioWeightHeightPass,r=1/i,n=this.outputHeightWorkBench,a=this.heightBuffer,o=this.outputHeightWorkBenchOpaquePixelsCount;let s=0,h=0,l=0,u=0,c=0,f=0,d=0,p=1,m=0,g=0,_=0,b=0;do{for(c=0;c<this.targetWidthMultipliedByChannels;)n[c++]=0,n[c++]=0,n[c++]=0,e&&(n[c++]=0,o[c/4-1]=0);s=i;do{for(h=1+l-u,p=Math.min(s,h),d=l,c=0;c<this.targetWidthMultipliedByChannels;)m=t[d++],g=t[d++],_=t[d++],b=e?t[d++]:255,n[c++]+=(b?m:0)*p,n[c++]+=(b?g:0)*p,n[c++]+=(b?_:0)*p,e&&(n[c++]+=b*p,o[c/4-1]+=b?p:0);if(!(s>=h)){u+=s;break}l=d,u=l,s-=h}while(s>0&&l<this.widthPassResultSize);for(c=0;c<this.targetWidthMultipliedByChannels;)s=e?o[c/4]:1,p=e?s?1/s:0:r,a[f++]=Math.round(n[c++]*p),a[f++]=Math.round(n[c++]*p),a[f++]=Math.round(n[c++]*p),e&&(a[f++]=Math.round(n[c++]*r))}while(f<this.finalResultSize);return a},Vf.prototype.resizeWidthInterpolatedRGB=function(t){return this._resizeWidthInterpolatedRGBChannels(t,!1)},Vf.prototype.resizeWidthInterpolatedRGBA=function(t){return this._resizeWidthInterpolatedRGBChannels(t,!0)},Vf.prototype.resizeWidthRGB=function(t){return this._resizeWidthRGBChannels(t,!1)},Vf.prototype.resizeWidthRGBA=function(t){return this._resizeWidthRGBChannels(t,!0)},Vf.prototype.resizeHeightInterpolated=function(t){const e=this.ratioWeightHeightPass,i=this.heightBuffer;let r,n=0,a=0,o=0,s=0,h=0,l=0,u=0;for(;n<1/3;n+=e)for(o=0;o<this.targetWidthMultipliedByChannels;)i[a++]=Math.round(t[o++]);for(n-=1/3,r=this.heightOriginal-1;n<r;n+=e)for(u=n%1,l=1-u,s=Math.floor(n)*this.targetWidthMultipliedByChannels,h=s+this.targetWidthMultipliedByChannels,o=0;o<this.targetWidthMultipliedByChannels;++o)i[a++]=Math.round(t[s++]*l+t[h++]*u);for(;a<this.finalResultSize;)for(o=0,s=r*this.targetWidthMultipliedByChannels;o<this.targetWidthMultipliedByChannels;++o)i[a++]=Math.round(t[s++]);return i},Vf.prototype.resizeHeightRGB=function(t){return this._resizeHeightRGBChannels(t,!1)},Vf.prototype.resizeHeightRGBA=function(t){return this._resizeHeightRGBChannels(t,!0)},Vf.prototype.resize=function(t){this.resizeCallback(this.resizeHeight(this.resizeWidth(t)))},Vf.prototype.bypassResizer=function(t){return t},Vf.prototype.initializeFirstPassBuffers=function(t){this.widthBuffer=this.generateFloatBuffer(this.widthPassResultSize),t||(this.outputWidthWorkBench=this.generateFloatBuffer(this.originalHeightMultipliedByChannels),this.colorChannels>3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},Vf.prototype.initializeSecondPassBuffers=function(t){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),t||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},Vf.prototype.generateFloatBuffer=function(t){try{return new Float32Array(t)}catch(t){return console.error(t),[]}},Vf.prototype.generateFloat64Buffer=function(t){try{return new Float64Array(t)}catch(t){return console.error(t),[]}},Vf.prototype.generateUint8Buffer=function(t){try{return new Uint8Array(t)}catch(t){return console.error(t),[]}};const Jf={nearestNeighbor(t,e){const i=t.width,r=t.height,n=e.width,a=e.height,o=t.data,s=e.data;for(let t=0;t<a;t++)for(let e=0;e<n;e++){let h=4*(t*n+e);let l=4*(Math.floor(t*r/a)*i+Math.floor(e*i/n));s[h++]=o[l++],s[h++]=o[l++],s[h++]=o[l++],s[h++]=o[l++]}},bilinearInterpolation(t,e){const i=t.width,r=t.height,n=e.width,a=e.height,o=t.data,s=e.data,h=function(t,e,i,r,n){return e===r?i:Math.round((t-e)*n+(r-t)*i)},l=function(t,e,r,n,a,l,u,c){let f=4*(u*i+n)+e,d=4*(u*i+a)+e;const p=h(r,n,o[f],a,o[d]);if(c===u)s[t+e]=p;else{f=4*(c*i+n)+e,d=4*(c*i+a)+e;const m=h(r,n,o[f],a,o[d]);s[t+e]=h(l,u,p,c,m)}};for(let t=0;t<a;t++)for(let e=0;e<n;e++){const o=4*(t*n+e),s=e*i/n,h=Math.floor(s),u=Math.min(Math.ceil(s),i-1),c=t*r/a,f=Math.floor(c),d=Math.min(Math.ceil(c),r-1);l(o,0,s,h,u,c,f,d),l(o,1,s,h,u,c,f,d),l(o,2,s,h,u,c,f,d),l(o,3,s,h,u,c,f,d)}},_interpolate2D(t,e,i,r){const n=t.data,a=e.data,o=t.width,s=t.height,h=e.width,l=e.height,u=Math.max(1,Math.floor(o/h)),c=h*u,f=Math.max(1,Math.floor(s/l)),d=l*f,p=_.alloc(c*s*4);for(let t=0;t<s;t++)for(let e=0;e<c;e++){const i=e*(o-1)/c,a=Math.floor(i),s=i-a,h=4*(t*o+a),l=4*(t*c+e);for(let t=0;t<4;t++){const e=h+t,i=a>0?n[e-4]:2*n[e]-n[e+4],u=n[e],c=n[e+4],f=a<o-2?n[e+8]:2*n[e+4]-n[e];p[l+t]=r(i,u,c,f,s)}}const m=_.alloc(c*d*4);for(let t=0;t<d;t++)for(let e=0;e<c;e++){const i=t*(s-1)/d,n=Math.floor(i),a=i-n,o=4*(n*c+e),h=4*(t*c+e);for(let t=0;t<4;t++){const e=o+t,i=n>0?p[e-4*c]:2*p[e]-p[e+4*c],l=p[e],u=p[e+4*c],f=n<s-2?p[e+8*c]:2*p[e+4*c]-p[e];m[h+t]=r(i,l,u,f,a)}}const g=u*f;if(g>1)for(let t=0;t<l;t++)for(let e=0;e<h;e++){let i=0,r=0,n=0,o=0,s=0;for(let a=0;a<f;a++){const h=t*f+a;for(let t=0;t<u;t++){const a=4*(h*c+(e*u+t)),l=m[a+3];l&&(i+=m[a],r+=m[a+1],n+=m[a+2],s++),o+=l}}const l=4*(t*h+e);a[l]=s?Math.round(i/s):0,a[l+1]=s?Math.round(r/s):0,a[l+2]=s?Math.round(n/s):0,a[l+3]=Math.round(o/g)}else e.data=m},bicubicInterpolation(t,e,i){return this._interpolate2D(t,e,i,(function(t,e,i,r,n){const a=r-i-t+e,o=t-e-a,s=i-t,h=e;return Math.max(0,Math.min(255,a*(n*n*n)+o*(n*n)+s*n+h))}))},hermiteInterpolation(t,e,i){return this._interpolate2D(t,e,i,(function(t,e,i,r,n){const a=e,o=.5*(i-t),s=t-2.5*e+2*i-.5*r,h=.5*(r-t)+1.5*(e-i);return Math.max(0,Math.min(255,Math.round(((h*n+s)*n+o)*n+a)))}))},bezierInterpolation(t,e,i){return this._interpolate2D(t,e,i,(function(t,e,i,r,n){const a=1-n,o=e*a*a*a,s=3*(e+(i-t)/4)*a*a*n,h=3*(i-(r-e)/4)*a*n*n,l=i*n*n*n;return Math.max(0,Math.min(255,Math.round(o+s+h+l)))}))}},Kf=Wu([Hu({w:Ru().min(0),h:Ru().min(0).optional(),mode:Ku(qf).optional()}),Hu({w:Ru().min(0).optional(),h:Ru().min(0),mode:Ku(qf).optional()})]),Xf=Hu({w:Ru().min(0),h:Ru().min(0),mode:Ku(qf).optional()}),Qf=Hu({f:Ru().min(0),mode:Ku(qf).optional()}),td={resize(t,e){const{mode:i}=Kf.parse(e);let r,n;if("number"==typeof e.w)r=e.w,n=e.h??t.bitmap.height*(r/t.bitmap.width);else{if("number"!=typeof e.h)throw new Error("w must be a number");n=e.h,r=e.w??t.bitmap.width*(n/t.bitmap.height)}if(r=Math.round(r)||1,n=Math.round(n)||1,i&&"function"==typeof Jf[i]){const e={data:_.alloc(r*n*4),width:r,height:n};Jf[i](t.bitmap,e),t.bitmap=e}else{new Vf(t.bitmap.width,t.bitmap.height,r,n,!0,!0,(e=>{t.bitmap.data=_.from(e),t.bitmap.width=r,t.bitmap.height=n})).resize(t.bitmap.data)}return t},scale(t,e){const{f:i,mode:r}="number"==typeof e?{f:e}:Qf.parse(e),n=t.bitmap.width*i,a=t.bitmap.height*i;return this.resize(t,{w:n,h:a,mode:r})},scaleToFit(t,e){const{h:i,w:r,mode:n}=Xf.parse(e),a=r/i>t.bitmap.width/t.bitmap.height?i/t.bitmap.height:r/t.bitmap.width;return this.scale(t,{f:a,mode:n})}},ed=Hu({w:Ru(),h:Ru(),align:Ru().optional(),mode:Ku(qf).optional()}),id={contain(t,e){const{w:i,h:r,align:n=$c.CENTER|qc.MIDDLE,mode:a}=ed.parse(e),o=7&n,s=n>>3;if((0===o||o&o-1)&&(0===s||s&s-1))throw new Error("only use one flag per alignment direction");const h=o>>1,l=s>>1,u=i/r>t.bitmap.width/t.bitmap.height?r/t.bitmap.height:i/t.bitmap.width,c=td.scale(Zt(t),{f:u,mode:a});return(t=td.resize(t,{w:i,h:r,mode:a})).scan(((e,i,r)=>{t.bitmap.data.writeUInt32BE(t.background,r)})),t=vc.blit(t,{src:c,x:(t.bitmap.width-c.bitmap.width)/2*h,y:(t.bitmap.height-c.bitmap.height)/2*l})}},rd=Hu({x:Ru(),y:Ru(),w:Ru(),h:Ru()}),nd=Hu({tolerance:Ru().min(0).max(1).optional(),cropOnlyFrames:Lu().optional(),cropSymmetric:Lu().optional(),leaveBorder:Ru().optional(),ignoreSides:Hu({north:Lu().optional(),south:Lu().optional(),east:Lu().optional(),west:Lu().optional()}).optional()}),ad={crop(t,e){let{x:i,y:r,w:n,h:a}=rd.parse(e);if(i=Math.round(i),r=Math.round(r),n=Math.round(n),a=Math.round(a),0===i&&n===t.bitmap.width){const e=n*r+i<<2,o=e+(a*n<<2);t.bitmap.data=t.bitmap.data.slice(e,o)}else{const e=_.allocUnsafe(n*a*4);let o=0;Ht(t,i,r,n,a,(function(i,r,n){const a=t.bitmap.data.readUInt32BE(n);e.writeUInt32BE(a,o),o+=4})),t.bitmap.data=e}return t.bitmap.width=n,t.bitmap.height=a,t},autocrop(t,e={}){const{tolerance:i=2e-4,cropOnlyFrames:r=!0,cropSymmetric:n=!1,leaveBorder:a=0,ignoreSides:o}="number"==typeof e?{tolerance:e}:nd.parse(e),s=t.bitmap.width,h=t.bitmap.height,l={north:!1,south:!1,east:!1,west:!1,...o};let u=t.getPixelColor(0,0);const c=$t(u);let f=0,d=0,p=0,m=0;if(u=t.getPixelColor(0,0),!l.north)t:for(let e=0;e<h-1;e++){for(let r=0;r<s;r++){if(qt(c,$t(t.getPixelColor(r,e)))>i)break t}f++}if(u=t.getPixelColor(s,0),!l.west)t:for(let e=0;e<s-1;e++){for(let r=0+f;r<h;r++){if(qt(c,$t(t.getPixelColor(e,r)))>i)break t}m++}if(u=t.getPixelColor(0,h),!l.south)t:for(let e=h-1;e>=f+1;e--){for(let r=s-d-1;r>=0;r--){if(qt(c,$t(t.getPixelColor(r,e)))>i)break t}p++}if(u=t.getPixelColor(s,h),!l.east)t:for(let e=s-1;e>=0+m+1;e--){for(let r=h-1;r>=0+f;r--){if(qt(c,$t(t.getPixelColor(e,r)))>i)break t}d++}let g=!1;if(m-=a,d-=a,f-=a,p-=a,n){const t=Math.min(d,m),e=Math.min(f,p);m=t,d=t,f=e,p=e}m=m>=0?m:0,d=d>=0?d:0,f=f>=0?f:0,p=p>=0?p:0;const _=s-(m+d),b=h-(p+f);return g=r?0!==d&&0!==f&&0!==m&&0!==p:0!==d||0!==f||0!==m||0!==p,g&&this.crop(t,{x:m,y:f,w:_,h:b}),t}},od=Hu({w:Ru(),h:Ru(),align:Ru().optional(),mode:Ku(qf).optional()}),sd={cover(t,e){const{w:i,h:r,align:n=$c.CENTER|qc.MIDDLE,mode:a}=od.parse(e),o=7&n,s=n>>3;if((0===o||o&o-1)&&(0===s||s&s-1))throw new Error("only use one flag per alignment direction");const h=o>>1,l=s>>1,u=i/r>t.bitmap.width/t.bitmap.height?i/t.bitmap.width:r/t.bitmap.height;return t=td.scale(t,{f:u,mode:a}),t=ad.crop(t,{x:(t.bitmap.width-i)/2*h,y:(t.bitmap.height-r)/2*l,w:i,h:r})}},hd=Hu({map:yc,offset:Ru()}),ld={displace(t,e){const{map:i,offset:r}=hd.parse(e),n=Zt(t);return t.scan(((e,a,o)=>{let s=i.bitmap.data[o]/256*r;s=Math.round(s);const h=t.getPixelIndex(e+s,a);t.bitmap.data[h]=n.bitmap.data[o],t.bitmap.data[h+1]=n.bitmap.data[o+1],t.bitmap.data[h+2]=n.bitmap.data[o+2]})),t}},ud={dither(t){const e=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return t.scan(((i,r,n)=>{const a=e[((3&r)<<2)+i%4];t.bitmap.data[n]=Math.min(t.bitmap.data[n]+a,255),t.bitmap.data[n+1]=Math.min(t.bitmap.data[n+1]+a,255),t.bitmap.data[n+2]=Math.min(t.bitmap.data[n+2]+a,255)})),t}},cd=Hu({radius:Ru().min(0).optional()}),fd={fisheye(t,e={}){const{radius:i=2.5}=cd.parse(e),r=Zt(t),{width:n,height:a}=r.bitmap;return r.scan(((e,o)=>{const s=e/n,h=o/a,l=Math.sqrt(Math.pow(s-.5,2)+Math.pow(h-.5,2)),u=2*Math.pow(l,i),c=(s-.5)/l,f=(h-.5)/l,d=Math.round((u*c+.5)*n),p=Math.round((u*f+.5)*a),m=r.getPixelColor(d,p);t.setPixelColor(m,e,o)})),t.setPixelColor(r.getPixelColor(n/2,a/2),n/2,a/2),t}},dd=Hu({horizontal:Lu().optional(),vertical:Lu().optional()}),pd={flip(t,e){const{horizontal:i,vertical:r}=dd.parse(e),n=_.alloc(t.bitmap.data.length);return t.scan(((e,a,o)=>{const s=i?t.bitmap.width-1-e:e,h=r?t.bitmap.height-1-a:a,l=t.bitmap.width*h+s<<2,u=t.bitmap.data.readUInt32BE(o);n.writeUInt32BE(u,l)})),t.bitmap.data=_.from(n),t}};function md(t,e){if(!(t&&e&&t.length&&e.length))throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}md.prototype.convert=function(t){var e,i,r,n={},a=this.srcAlphabet.length,o=this.dstAlphabet.length,s=t.length,h="string"==typeof t?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e<s;e++)n[e]=this.srcAlphabet.indexOf(t[e]);do{for(i=0,r=0,e=0;e<s;e++)(i=i*a+n[e])>=o?(n[r++]=parseInt(i/o,10),i%=o):r>0&&(n[r++]=0);s=r,h=this.dstAlphabet.slice(i,i+1).concat(h)}while(0!==r);return h},md.prototype.isValid=function(t){for(var e=0;e<t.length;++e)if(-1===this.srcAlphabet.indexOf(t[e]))return!1;return!0};var gd=md;function _d(t,e){var i=new gd(t,e);return function(t){return i.convert(t)}}_d.BIN="01",_d.OCT="01234567",_d.DEC="0123456789",_d.HEX="0123456789abcdef";var bd=e(_d),yd=Object.defineProperty,wd=(t,e,i)=>((t,e,i)=>e in t?yd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class vd{constructor(t,e){wd(this,"size"),wd(this,"smallerSize"),this.size=t||32,this.smallerSize=e||8,function(t){for(let e=1;e<t;e++)kd[e]=1;kd[0]=1/Math.sqrt(2)}(this.size)}distance(t,e){let i=0;for(let r=0;r<t.length;r++)t[r]!==e[r]&&i++;return i/t.length}getHash(t){t=td.resize(Zt(t),{w:this.size,h:this.size}),t=Gc.greyscale(t);const e=[];for(let i=0;i<t.bitmap.width;i++){const r=[];for(let e=0;e<t.bitmap.height;e++)r[e]=xd(t.getPixelColor(i,e)).b;e[i]=r}const i=function(t,e){const i=e,r=[];for(let e=0;e<i;e++){const n=[];for(let a=0;a<i;a++){let o=0;for(let r=0;r<i;r++)for(let n=0;n<i;n++)o+=Math.cos((2*r+1)/(2*i)*e*Math.PI)*Math.cos((2*n+1)/(2*i)*a*Math.PI)*t[r][n];o*=kd[e]*kd[a]/4,n[a]=o,r[e]=n}}return r}(e,this.size);let r=0;for(let t=0;t<this.smallerSize;t++)for(let e=0;e<this.smallerSize;e++)r+=i[t][e];const n=r/(this.smallerSize*this.smallerSize);let a="";for(let t=0;t<this.smallerSize;t++)for(let e=0;e<this.smallerSize;e++)a+=i[t][e]>n?"1":"0";return a}}function xd(t){const e=255&t,i=255&(t>>>=8),r=255&(t>>>=8);return{r:255&(t>>>=8),g:r,b:i,a:e}}const kd=[];const Ed="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",Sd=[NaN,NaN];for(let t=2;t<65;t++){const e=bd(bd.BIN,Ed.slice(0,t))(new Array(65).join("1"));Sd.push(e.length)}const Md={pHash:t=>(new vd).getHash(t),hash(t,e=64){if(e<2||e>64)throw new Error("base must be a number between 2 and 64");const i=Ed.slice(0,e),r=this.pHash(t),n=Sd[e];return bd(bd.BIN,i)(r).padStart(n,"0")},distanceFromHash(t,e){const i=new vd,r=i.getHash(t);return i.distance(r,e)}};function Ad(t,e){const i=new vd,r=i.getHash(t),n=i.getHash(e);return i.distance(r,n)}function Id(t,e){return(new vd).distance(t,e)}const zd=Wu([yc,Hu({src:yc,x:Ru().optional(),y:Ru().optional()})]),Pd={mask(t,e){let i,r,n;zd.parse(e),"bitmap"in e?(i=e,r=0,n=0):(i=e.src,r=e.x??0,n=e.y??0),r=Math.round(r),n=Math.round(n);const a=t.bitmap.width,o=t.bitmap.height;return i.scan((function(e,s,h){const l=r+e,u=n+s;if(l>=0&&u>=0&&l<a&&u<o){const e=t.getPixelIndex(l,u),{data:r}=i.bitmap,n=(r[h+0]+r[h+1]+r[h+2])/3;t.bitmap.data[e+3]*=n/255}})),t}};function Td(t,e){let i=0;for(let r=0;r<e.length;r++){const n=e[r],a=t.chars[n];if(a){const o=t.kernings[n],s=e[r+1],h=o&&s&&o[s]&&o[s]||0;i+=(a.xadvance||0)+h}}return i}function Rd(t,e,i){const r=e.replace(/[\r\n]+/g," \n").split(" "),n=[];let a=[],o=0;return r.forEach((e=>{if(Td(t,e+(r.length>1?" ":""))>i){const r=e[Symbol.iterator]();let o="";for(const e of r){const r=[...a,o+e].join(" "),s=Td(t,r);s<i?o+=e:s>i?(n.push([...a,o]),a=[],o=e):(n.push([...a,o+e]),a=[],o="")}return}const s=[...a,e].join(" "),h=Td(t,s);h<=i&&!e.includes("\n")?(h>o&&(o=h),a.push(e)):(n.push(a),a=[e.replace("\n","")])})),n.push(a),{lines:n,longestLine:o}}function Od(t,e,i){const{lines:r}=Rd(t,e,i);return r.length*t.common.lineHeight}const Bd=Hu({x:Ru(),y:Ru(),text:Wu([Wu([ou(),Ru()]),Hu({text:Wu([ou(),Ru()]),alignmentX:Ku($c).optional(),alignmentY:Ku(qc).optional()})]),maxWidth:Ru().optional(),maxHeight:Ru().optional(),cb:(Cd={input:Vu([Hu({x:Ru(),y:Ru()})])},new dc({type:"function",input:Array.isArray(Cd?.input)?Vu(Cd?.input):Cd?.input??Gu(Uu()),output:Cd?.output??Uu()})).optional()});var Cd;function Ld(t,e,i,r,n){if(n.width>0&&n.height>0){const a=e.pages[n.page];a&&(t=vc.blit(t,{src:a,x:i+n.xoffset,y:r+n.yoffset,srcX:n.x,srcY:n.y,srcW:n.width,srcH:n.height}))}return t}const Dd={print(t,{font:e,...i}){let r,n,{x:a,y:o,text:s,maxWidth:h=1/0,maxHeight:l=1/0,cb:u=(()=>{})}=Bd.parse(i);"object"==typeof s&&null!==s.text&&void 0!==s.text?(r=s.alignmentX||$c.LEFT,n=s.alignmentY||qc.TOP,({text:s}=s)):(r=$c.LEFT,n=qc.TOP,s=s.toString()),"number"==typeof s&&(s=s.toString()),l!==1/0&&n===qc.BOTTOM?o+=l-Od(e,s,h):l!==1/0&&n===qc.MIDDLE&&(o+=l/2-Od(e,s,h)/2);const c=Object.entries(e.chars).find((t=>t[1].xadvance))?.[1].xadvance;if("number"!=typeof c)throw new Error("Could not find default character width");const{lines:f,longestLine:d}=Rd(e,s,h);return f.forEach((i=>{const n=i.join(" "),s=function(t,e,i,r){return r===$c.LEFT?0:r===$c.CENTER?(i-Td(t,e))/2:i-Td(t,e)}(e,n,h,r);!function(t,e,i,r,n,a){for(let o=0;o<n.length;o++){const s=n[o];let h;h=e.chars[s]?s:/\s/.test(s)?"":"?";const l=e.chars[h]||{xadvance:void 0},u=e.kernings[h];l&&Ld(t,e,i,r,l);const c=n[o+1];i+=(u&&c&&u[c]&&u[c]||0)+(l.xadvance||a)}}(t,e,a+s,o,n,c),o+=e.common.lineHeight})),u.bind(t)({x:a+d,y:o}),t}},Ud=Wu([Ru(),Hu({deg:Ru(),mode:Wu([Lu(),Ku(qf)]).optional()})]);function Fd(t){return function(e,i){return i*t+e<<2}}function Nd(t,e){return function(i,r){return{x:i+t,y:r+e}}}const jd={rotate(t,e){const i=Ud.parse(e),r="number"==typeof i?{deg:i}:i,{mode:n=!0}=r;let{deg:a}=r;if(a%=360,a%360==0)return t;return a%90==0&&(n||t.bitmap.width===t.bitmap.height||a%180==0)?function(t,e){if(Math.abs(e)%90!=0)throw new Error("Unsupported matrix rotation degree");const i=t.bitmap.width,r=t.bitmap.height;let n;switch(e){case 90:case-270:n=90;break;case 180:case-180:n=180;break;case 270:case-90:n=-90;break;default:throw new Error("Unsupported matrix rotation degree")}const a=180===n?i:r,o=180===n?r:i,s=_.alloc(t.bitmap.data.length),h=Fd(i),l=Fd(a);for(let e=0;e<i;e++)for(let a=0;a<r;a++){const o=h(e,a),u=t.bitmap.data.readUInt32BE(o);let c;switch(n){case 90:c=l(a,i-e-1);break;case-90:c=l(r-a-1,e);break;case 180:c=l(i-e-1,r-a-1);break;default:throw new Error("Unsupported matrix rotation angle")}s.writeUInt32BE(u,c)}t.bitmap.data=s,t.bitmap.width=a,t.bitmap.height=o}(t,a):function(t,e,i){const r=e*Math.PI/180,n=Math.cos(r),a=Math.sin(r);let o=t.bitmap.width,s=t.bitmap.height;if(!0===i||"string"==typeof i){o=Math.ceil(Math.abs(t.bitmap.width*n)+Math.abs(t.bitmap.height*a))+1,s=Math.ceil(Math.abs(t.bitmap.width*a)+Math.abs(t.bitmap.height*n))+1,o%2!=0&&o++,s%2!=0&&s++;const e=Zt(t);t.scan(((e,i,r)=>{t.bitmap.data.writeUInt32BE(t.background,r)}));const r=Math.max(o,s,t.bitmap.width,t.bitmap.height);t=ff(t=td.resize(t,{h:r,w:r,mode:!0===i?void 0:i}),e,t.bitmap.width/2-e.bitmap.width/2,t.bitmap.height/2-e.bitmap.height/2)}const h=t.bitmap.width,l=t.bitmap.height,u=_.alloc(t.bitmap.data.length),c=Nd(-h/2,-l/2),f=Nd(h/2+.5,l/2+.5);for(let e=1;e<=l;e++)for(let i=1;i<=h;i++){const r=c(i,e),o=f(n*r.x-a*r.y,n*r.y+a*r.x),s=h*(e-1)+i-1<<2;if(o.x>=0&&o.x<h&&o.y>=0&&o.y<l){const e=h*(0|o.y)+o.x<<2,i=t.bitmap.data.readUInt32BE(e);u.writeUInt32BE(i,s)}else u.writeUInt32BE(t.background,s)}if(t.bitmap.data=u,!0===i||"string"==typeof i){const e=Math.max(h/2-o/2,0),i=Math.max(l/2-s/2,0);t=ad.crop(t,{x:e,y:i,w:o,h:s})}}(t,a,n),t}},Gd=Hu({max:Ru().min(0).max(255),replace:Ru().min(0).max(255).optional(),autoGreyscale:Lu().optional()}),Zd={threshold(t,e){let{max:i,replace:r=255,autoGreyscale:n=!0}=Gd.parse(e);return i=Yt(i),r=Yt(r),n&&Gc.greyscale(t),t.scan(((e,n,a)=>{const o=t.bitmap.data[a]<i?t.bitmap.data[a]:r;t.bitmap.data[a]=o,t.bitmap.data[a+1]=o,t.bitmap.data[a+2]=o})),t}};var Hd=Object.defineProperty,$d=(t,e)=>{for(var i in e)Hd(t,i,{get:e[i],enumerable:!0})},Wd=(t,e,i)=>(((t,e,i)=>{e in t?Hd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,"symbol"!=typeof e?e+"":e,i),i);$d({},{bt709:()=>qd});var qd={};$d(qd,{Y:()=>Yd,x:()=>Vd,y:()=>Jd});var Yd=(t=>(t[t.RED=.2126]="RED",t[t.GREEN=.7152]="GREEN",t[t.BLUE=.0722]="BLUE",t[t.WHITE=1]="WHITE",t))(Yd||{}),Vd=(t=>(t[t.RED=.64]="RED",t[t.GREEN=.3]="GREEN",t[t.BLUE=.15]="BLUE",t[t.WHITE=.3127]="WHITE",t))(Vd||{}),Jd=(t=>(t[t.RED=.33]="RED",t[t.GREEN=.6]="GREEN",t[t.BLUE=.06]="BLUE",t[t.WHITE=.329]="WHITE",t))(Jd||{});function Kd(t){return t>.04045?((t+.055)/1.055)**2.4:t/12.92}function Xd(t,e,i){return{x:.4124*(t=Kd(t/255))+.3576*(e=Kd(e/255))+.1805*(i=Kd(i/255)),y:.2126*t+.7152*e+.0722*i,z:.0193*t+.1192*e+.9505*i}}$d({},{lab2rgb:()=>vp,lab2xyz:()=>bp,rgb2hsl:()=>sp,rgb2lab:()=>dp,rgb2xyz:()=>Xd,xyz2lab:()=>fp,xyz2rgb:()=>wp});var Qd={};function tp(t){return t*(Math.PI/180)}function ep(t,e,i){let r=t;return r<e&&(r=e),r<i&&(r=i),r}function ip(t,e,i){let r=t;return r>e&&(r=e),r>i&&(r=i),r}function rp(t,e,i){return t>i&&(t=i),t<e&&(t=e),0|t}function np(t){return(t=Math.round(t))>255?t=255:t<0&&(t=0),t}function ap(t){return t>255?t=255:t<0&&(t=0),t}function op(t,e){const i=typeof t[0];let r;if("number"===i||"string"===i){const i=Object.create(null);for(let e=0,r=t.length;e<r;e++){const r=t[e];i[r]||0===i[r]||(i[r]=e)}r=t.sort(((t,r)=>e(t,r)||i[t]-i[r]))}else{const i=t.slice(0);r=t.sort(((t,r)=>e(t,r)||i.indexOf(t)-i.indexOf(r)))}return r}function sp(t,e,i){const r=ip(t,e,i),n=ep(t,e,i),a=n-r,o=(r+n)/510;let s=0;o>0&&o<1&&(s=a/(o<.5?n+r:510-n-r));let h=0;return a>0&&(h=n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a,h*=60,h<0&&(h+=360)),{h:h,s:s,l:o}}$d(Qd,{degrees2radians:()=>tp,inRange0to255:()=>ap,inRange0to255Rounded:()=>np,intInRange:()=>rp,max3:()=>ep,min3:()=>ip,stableSort:()=>op});var hp=.95047,lp=1,up=1.08883;function cp(t){return t>.008856?t**(1/3):7.787*t+16/116}function fp(t,e,i){if(t=cp(t/hp),e=cp(e/lp),i=cp(i/up),116*e-16<0)throw new Error("xxx");return{L:Math.max(0,116*e-16),a:500*(t-e),b:200*(e-i)}}function dp(t,e,i){const r=Xd(t,e,i);return fp(r.x,r.y,r.z)}var pp=.95047,mp=1,gp=1.08883;function _p(t){return t>.206893034?t**3:(t-16/116)/7.787}function bp(t,e,i){const r=(t+16)/116,n=r-i/200;return{x:pp*_p(e/500+r),y:mp*_p(r),z:gp*_p(n)}}function yp(t){return t>.0031308?1.055*t**(1/2.4)-.055:12.92*t}function wp(t,e,i){const r=yp(3.2406*t+-1.5372*e+-.4986*i),n=yp(-.9689*t+1.8758*e+.0415*i),a=yp(.0557*t+-.204*e+1.057*i);return{r:np(255*r),g:np(255*n),b:np(255*a)}}function vp(t,e,i){const r=bp(t,e,i);return wp(r.x,r.y,r.z)}$d({},{AbstractDistanceCalculator:()=>xp,AbstractEuclidean:()=>zp,AbstractManhattan:()=>Op,CIE94GraphicArts:()=>Sp,CIE94Textiles:()=>Ep,CIEDE2000:()=>Ap,CMetric:()=>Ip,Euclidean:()=>Pp,EuclideanBT709:()=>Tp,EuclideanBT709NoAlpha:()=>Rp,Manhattan:()=>Bp,ManhattanBT709:()=>Lp,ManhattanNommyde:()=>Cp,PNGQuant:()=>Dp});var xp=class{constructor(){Wd(this,"_maxDistance"),Wd(this,"_whitePoint"),this._setDefaults(),this.setWhitePoint(255,255,255,255)}setWhitePoint(t,e,i,r){this._whitePoint={r:t>0?255/t:0,g:e>0?255/e:0,b:i>0?255/i:0,a:r>0?255/r:0},this._maxDistance=this.calculateRaw(t,e,i,r,0,0,0,0)}calculateNormalized(t,e){return this.calculateRaw(t.r,t.g,t.b,t.a,e.r,e.g,e.b,e.a)/this._maxDistance}},kp=class extends xp{calculateRaw(t,e,i,r,n,a,o,s){const h=dp(ap(t*this._whitePoint.r),ap(e*this._whitePoint.g),ap(i*this._whitePoint.b)),l=dp(ap(n*this._whitePoint.r),ap(a*this._whitePoint.g),ap(o*this._whitePoint.b)),u=h.L-l.L,c=h.a-l.a,f=h.b-l.b,d=Math.sqrt(h.a*h.a+h.b*h.b),p=d-Math.sqrt(l.a*l.a+l.b*l.b);let m=c*c+f*f-p*p;m=m<0?0:Math.sqrt(m);const g=(s-r)*this._whitePoint.a*this._kA;return Math.sqrt((u/this._Kl)**2+(p/(1+this._K1*d))**2+(m/(1+this._K2*d))**2+g**2)}},Ep=class extends kp{_setDefaults(){this._Kl=2,this._K1=.048,this._K2=.014,this._kA=12.5/255}},Sp=class extends kp{_setDefaults(){this._Kl=1,this._K1=.045,this._K2=.015,this._kA=25/255}},Mp=class extends xp{_setDefaults(){}static _calculatehp(t,e){const i=Math.atan2(t,e);return i>=0?i:i+Mp._deg360InRad}static _calculateRT(t,e){const i=e**7,r=2*Math.sqrt(i/(i+Mp._pow25to7)),n=Mp._deg30InRad*Math.exp(-(((t-Mp._deg275InRad)/Mp._deg25InRad)**2));return-Math.sin(2*n)*r}static _calculateT(t){return 1-.17*Math.cos(t-Mp._deg30InRad)+.24*Math.cos(2*t)+.32*Math.cos(3*t+Mp._deg6InRad)-.2*Math.cos(4*t-Mp._deg63InRad)}static _calculate_ahp(t,e,i,r){const n=i+r;return 0===t?n:e<=Mp._deg180InRad?n/2:n<Mp._deg360InRad?(n+Mp._deg360InRad)/2:(n-Mp._deg360InRad)/2}static _calculate_dHp(t,e,i,r){let n;return n=0===t?0:e<=Mp._deg180InRad?i-r:i<=r?i-r+Mp._deg360InRad:i-r-Mp._deg360InRad,2*Math.sqrt(t)*Math.sin(n/2)}calculateRaw(t,e,i,r,n,a,o,s){const h=dp(ap(t*this._whitePoint.r),ap(e*this._whitePoint.g),ap(i*this._whitePoint.b)),l=dp(ap(n*this._whitePoint.r),ap(a*this._whitePoint.g),ap(o*this._whitePoint.b)),u=(s-r)*this._whitePoint.a*Mp._kA,c=this.calculateRawInLab(h,l);return Math.sqrt(c+u*u)}calculateRawInLab(t,e){const i=t.L,r=t.a,n=t.b,a=e.L,o=e.a,s=e.b,h=((Math.sqrt(r*r+n*n)+Math.sqrt(o*o+s*s))/2)**7,l=.5*(1-Math.sqrt(h/(h+Mp._pow25to7))),u=(1+l)*r,c=(1+l)*o,f=Math.sqrt(u*u+n*n),d=Math.sqrt(c*c+s*s),p=f*d,m=Mp._calculatehp(n,u),g=Mp._calculatehp(s,c),_=Math.abs(m-g),b=a-i,y=d-f,w=Mp._calculate_dHp(p,_,g,m),v=Mp._calculate_ahp(p,_,m,g),x=(f+d)/2,k=((i+a)/2-50)**2,E=y/(1+.045*x),S=w/(1+.015*Mp._calculateT(v)*x);return(b/(1+.015*k/Math.sqrt(20+k)))**2+E**2+S**2+Mp._calculateRT(v,x)*E*S}},Ap=Mp;Wd(Ap,"_kA",25/255),Wd(Ap,"_pow25to7",25**7),Wd(Ap,"_deg360InRad",tp(360)),Wd(Ap,"_deg180InRad",tp(180)),Wd(Ap,"_deg30InRad",tp(30)),Wd(Ap,"_deg6InRad",tp(6)),Wd(Ap,"_deg63InRad",tp(63)),Wd(Ap,"_deg275InRad",tp(275)),Wd(Ap,"_deg25InRad",tp(25));var Ip=class extends xp{calculateRaw(t,e,i,r,n,a,o,s){const h=(t+n)/2*this._whitePoint.r,l=(t-n)*this._whitePoint.r,u=(e-a)*this._whitePoint.g,c=(i-o)*this._whitePoint.b,f=((512+h)*l*l>>8)+4*u*u+((767-h)*c*c>>8),d=(s-r)*this._whitePoint.a;return Math.sqrt(f+d*d)}_setDefaults(){}},zp=class extends xp{calculateRaw(t,e,i,r,n,a,o,s){const h=n-t,l=a-e,u=o-i,c=s-r;return Math.sqrt(this._kR*h*h+this._kG*l*l+this._kB*u*u+this._kA*c*c)}},Pp=class extends zp{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},Tp=class extends zp{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},Rp=class extends zp{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=0}},Op=class extends xp{calculateRaw(t,e,i,r,n,a,o,s){let h=n-t,l=a-e,u=o-i,c=s-r;return h<0&&(h=0-h),l<0&&(l=0-l),u<0&&(u=0-u),c<0&&(c=0-c),this._kR*h+this._kG*l+this._kB*u+this._kA*c}},Bp=class extends Op{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},Cp=class extends Op{_setDefaults(){this._kR=.4984,this._kG=.8625,this._kB=.2979,this._kA=1}},Lp=class extends Op{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},Dp=class extends xp{calculateRaw(t,e,i,r,n,a,o,s){const h=(s-r)*this._whitePoint.a;return this._colordifferenceCh(t*this._whitePoint.r,n*this._whitePoint.r,h)+this._colordifferenceCh(e*this._whitePoint.g,a*this._whitePoint.g,h)+this._colordifferenceCh(i*this._whitePoint.b,o*this._whitePoint.b,h)}_colordifferenceCh(t,e,i){const r=t-e,n=r+i;return r*r+n*n}_setDefaults(){}};$d({},{AbstractPaletteQuantizer:()=>Up,ColorHistogram:()=>em,NeuQuant:()=>Jp,NeuQuantFloat:()=>Qp,RGBQuant:()=>rm,WuColorCube:()=>lm,WuQuant:()=>cm});var Up=class{quantizeSync(){for(const t of this.quantize())if(t.palette)return t.palette;throw new Error("unreachable")}},Fp=class{constructor(){Wd(this,"r"),Wd(this,"g"),Wd(this,"b"),Wd(this,"a"),Wd(this,"uint32"),Wd(this,"rgba"),this.uint32=-1>>>0,this.r=this.g=this.b=this.a=0,this.rgba=new Array(4),this.rgba[0]=0,this.rgba[1]=0,this.rgba[2]=0,this.rgba[3]=0}static createByQuadruplet(t){const e=new Fp;return e.r=0|t[0],e.g=0|t[1],e.b=0|t[2],e.a=0|t[3],e._loadUINT32(),e._loadQuadruplet(),e}static createByRGBA(t,e,i,r){const n=new Fp;return n.r=0|t,n.g=0|e,n.b=0|i,n.a=0|r,n._loadUINT32(),n._loadQuadruplet(),n}static createByUint32(t){const e=new Fp;return e.uint32=t>>>0,e._loadRGBA(),e._loadQuadruplet(),e}from(t){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this.uint32=t.uint32,this.rgba[0]=t.r,this.rgba[1]=t.g,this.rgba[2]=t.b,this.rgba[3]=t.a}getLuminosity(t){let e=this.r,i=this.g,r=this.b;return t&&(e=Math.min(255,255-this.a+this.a*e/255),i=Math.min(255,255-this.a+this.a*i/255),r=Math.min(255,255-this.a+this.a*r/255)),.2126*e+.7152*i+.0722*r}_loadUINT32(){this.uint32=(this.a<<24|this.b<<16|this.g<<8|this.r)>>>0}_loadRGBA(){this.r=255&this.uint32,this.g=this.uint32>>>8&255,this.b=this.uint32>>>16&255,this.a=this.uint32>>>24&255}_loadQuadruplet(){this.rgba[0]=this.r,this.rgba[1]=this.g,this.rgba[2]=this.b,this.rgba[3]=this.a}},Np=class{constructor(){Wd(this,"_pointArray"),Wd(this,"_width"),Wd(this,"_height"),this._width=0,this._height=0,this._pointArray=[]}getWidth(){return this._width}getHeight(){return this._height}setWidth(t){this._width=t}setHeight(t){this._height=t}getPointArray(){return this._pointArray}clone(){const t=new Np;t._width=this._width,t._height=this._height;for(let e=0,i=this._pointArray.length;e<i;e++)t._pointArray[e]=Fp.createByUint32(0|this._pointArray[e].uint32);return t}toUint32Array(){const t=this._pointArray.length,e=new Uint32Array(t);for(let i=0;i<t;i++)e[i]=this._pointArray[i].uint32;return e}toUint8Array(){return new Uint8Array(this.toUint32Array().buffer)}static fromHTMLImageElement(t){const e=t.naturalWidth,i=t.naturalHeight,r=document.createElement("canvas");r.width=e,r.height=i;return r.getContext("2d").drawImage(t,0,0,e,i,0,0,e,i),Np.fromHTMLCanvasElement(r)}static fromHTMLCanvasElement(t){const e=t.width,i=t.height,r=t.getContext("2d").getImageData(0,0,e,i);return Np.fromImageData(r)}static fromImageData(t){const e=t.width,i=t.height;return Np.fromUint8Array(t.data,e,i)}static fromUint8Array(t,e,i){switch(Object.prototype.toString.call(t)){case"[object Uint8ClampedArray]":case"[object Uint8Array]":break;default:t=new Uint8Array(t)}const r=new Uint32Array(t.buffer);return Np.fromUint32Array(r,e,i)}static fromUint32Array(t,e,i){const r=new Np;r._width=e,r._height=i;for(let e=0,i=t.length;e<i;e++)r._pointArray[e]=Fp.createByUint32(0|t[e]);return r}static fromBuffer(t,e,i){const r=new Uint32Array(t.buffer,t.byteOffset,t.byteLength/Uint32Array.BYTES_PER_ELEMENT);return Np.fromUint32Array(r,e,i)}};function jp(t,e){const i=360/e;for(let r=1,n=i-i/2;r<e;r++,n+=i)if(t>=n&&t<n+i)return r;return 0}var Gp=class{constructor(){Wd(this,"_pointContainer"),Wd(this,"_pointArray",[]),Wd(this,"_i32idx",{}),this._pointContainer=new Np,this._pointContainer.setHeight(1),this._pointArray=this._pointContainer.getPointArray()}add(t){this._pointArray.push(t),this._pointContainer.setWidth(this._pointArray.length)}has(t){for(let e=this._pointArray.length-1;e>=0;e--)if(t.uint32===this._pointArray[e].uint32)return!0;return!1}getNearestColor(t,e){return this._pointArray[0|this._getNearestIndex(t,e)]}getPointContainer(){return this._pointContainer}_nearestPointFromCache(t){return"number"==typeof this._i32idx[t]?this._i32idx[t]:-1}_getNearestIndex(t,e){let i=this._nearestPointFromCache(""+e.uint32);if(i>=0)return i;let r=Number.MAX_VALUE;i=0;for(let n=0,a=this._pointArray.length;n<a;n++){const a=this._pointArray[n],o=t.calculateRaw(e.r,e.g,e.b,e.a,a.r,a.g,a.b,a.a);o<r&&(r=o,i=n)}return this._i32idx[e.uint32]=i,i}sort(){this._i32idx={},this._pointArray.sort(((t,e)=>{const i=sp(t.r,t.g,t.b),r=sp(e.r,e.g,e.b),n=t.r===t.g&&t.g===t.b?0:1+jp(i.h,10),a=(e.r===e.g&&e.g===e.b?0:1+jp(r.h,10))-n;if(a)return-a;const o=t.getLuminosity(!0),s=e.getLuminosity(!0);if(s-o!=0)return s-o;const h=(100*r.s|0)-(100*i.s|0);return h?-h:0}))}},Zp={};$d(Zp,{HueStatistics:()=>$p,Palette:()=>Gp,Point:()=>Fp,PointContainer:()=>Np,ProgressTracker:()=>qp,arithmetic:()=>Qd});var Hp=class{constructor(){Wd(this,"num",0),Wd(this,"cols",[])}},$p=class{constructor(t,e){Wd(this,"_numGroups"),Wd(this,"_minCols"),Wd(this,"_stats"),Wd(this,"_groupsFull"),this._numGroups=t,this._minCols=e,this._stats=[];for(let e=0;e<=t;e++)this._stats[e]=new Hp;this._groupsFull=0}check(t){this._groupsFull===this._numGroups+1&&(this.check=()=>{});const e=255&t,i=t>>>8&255,r=t>>>16&255,n=e===i&&i===r?0:1+jp(sp(e,i,r).h,this._numGroups),a=this._stats[n],o=this._minCols;a.num++,a.num>o||(a.num===o&&this._groupsFull++,a.num<=o&&this._stats[n].cols.push(t))}injectIntoDictionary(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{t[e]?t[e]++:t[e]=1}))}injectIntoArray(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{-1===t.indexOf(e)&&t.push(e)}))}},Wp=class{constructor(t,e){Wd(this,"progress"),Wd(this,"_step"),Wd(this,"_range"),Wd(this,"_last"),Wd(this,"_progressRange"),this._range=t,this._progressRange=e,this._step=Math.max(1,this._range/(Wp.steps+1)|0),this._last=-this._step,this.progress=0}shouldNotify(t){return t-this._last>=this._step&&(this._last=t,this.progress=Math.min(this._progressRange*this._last/this._range,this._progressRange),!0)}},qp=Wp;Wd(qp,"steps",100);var Yp=class{constructor(t){Wd(this,"r"),Wd(this,"g"),Wd(this,"b"),Wd(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return Fp.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,i,r){this.r-=0|t,this.g-=0|e,this.b-=0|i,this.a-=0|r}},Vp=class extends Up{constructor(t,e=256){super(),Wd(this,"_pointArray"),Wd(this,"_networkSize"),Wd(this,"_network"),Wd(this,"_sampleFactor"),Wd(this,"_radPower"),Wd(this,"_freq"),Wd(this,"_bias"),Wd(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t<this._networkSize;t++)this._network[t]=new Yp((t<<11)/this._networkSize|0),this._freq[t]=Vp._initialBias/this._networkSize|0,this._bias[t]=0}*_learn(){let t=this._sampleFactor;const e=this._pointArray.length;e<Vp._minpicturebytes&&(t=1);const i=30+(t-1)/3|0,r=e/t|0;let n,a=r/Vp._nCycles|0,o=Vp._initAlpha,s=(this._networkSize>>3)*Vp._radiusBias,h=s>>Vp._radiusBiasShift;h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*Vp._radBias/(h*h))>>>0;n=e<Vp._minpicturebytes?1:e%Vp._prime1!=0?Vp._prime1:e%Vp._prime2!=0?Vp._prime2:e%Vp._prime3!=0?Vp._prime3:Vp._prime4;const l=new qp(r,99);for(let t=0,u=0;t<r;){l.shouldNotify(t)&&(yield{progress:l.progress});const r=this._pointArray[u],c=r.b<<3,f=r.g<<3,d=r.r<<3,p=r.a<<3,m=this._contest(c,f,d,p);if(this._alterSingle(o,m,c,f,d,p),0!==h&&this._alterNeighbour(h,m,c,f,d,p),u+=n,u>=e&&(u-=e),t++,0===a&&(a=1),t%a==0){o-=o/i|0,s-=s/Vp._radiusDecrease|0,h=s>>Vp._radiusBiasShift,h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*Vp._radBias/(h*h))>>>0}}}_buildPalette(){const t=new Gp;return this._network.forEach((e=>{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,i,r,n,a){let o=e-t;o<-1&&(o=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let h=e+1,l=e-1,u=1;for(;h<s||l>o;){const t=this._radPower[u++]/Vp._alphaRadBias;if(h<s){const e=this._network[h++];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}if(l>o){const e=this._network[l--];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}}}_alterSingle(t,e,i,r,n,a){t/=Vp._initAlpha;const o=this._network[e];o.subtract(t*(o.r-n),t*(o.g-r),t*(o.b-i),t*(o.a-a))}_contest(t,e,i,r){let n=~(1<<31),a=n,o=-1,s=o;for(let h=0;h<this._networkSize;h++){const l=this._network[h],u=8160*this._distance.calculateNormalized(l,{r:i,g:e,b:t,a:r})|0;u<n&&(n=u,o=h);const c=u-(this._bias[h]>>Vp._initialBiasShift-3);c<a&&(a=c,s=h);const f=this._freq[h]>>Vp._betaShift;this._freq[h]-=f,this._bias[h]+=f<<Vp._gammaShift}return this._freq[o]+=Vp._beta,this._bias[o]-=Vp._betaGamma,s}},Jp=Vp;Wd(Jp,"_prime1",499),Wd(Jp,"_prime2",491),Wd(Jp,"_prime3",487),Wd(Jp,"_prime4",503),Wd(Jp,"_minpicturebytes",Vp._prime4),Wd(Jp,"_nCycles",100),Wd(Jp,"_initialBiasShift",16),Wd(Jp,"_initialBias",1<<Vp._initialBiasShift),Wd(Jp,"_gammaShift",10),Wd(Jp,"_betaShift",10),Wd(Jp,"_beta",Vp._initialBias>>Vp._betaShift),Wd(Jp,"_betaGamma",Vp._initialBias<<Vp._gammaShift-Vp._betaShift),Wd(Jp,"_radiusBiasShift",6),Wd(Jp,"_radiusBias",1<<Vp._radiusBiasShift),Wd(Jp,"_radiusDecrease",30),Wd(Jp,"_alphaBiasShift",10),Wd(Jp,"_initAlpha",1<<Vp._alphaBiasShift),Wd(Jp,"_radBiasShift",8),Wd(Jp,"_radBias",1<<Vp._radBiasShift),Wd(Jp,"_alphaRadBiasShift",Vp._alphaBiasShift+Vp._radBiasShift),Wd(Jp,"_alphaRadBias",1<<Vp._alphaRadBiasShift);var Kp=class{constructor(t){Wd(this,"r"),Wd(this,"g"),Wd(this,"b"),Wd(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return Fp.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,i,r){this.r-=t,this.g-=e,this.b-=i,this.a-=r}},Xp=class extends Up{constructor(t,e=256){super(),Wd(this,"_pointArray"),Wd(this,"_networkSize"),Wd(this,"_network"),Wd(this,"_sampleFactor"),Wd(this,"_radPower"),Wd(this,"_freq"),Wd(this,"_bias"),Wd(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t<this._networkSize;t++)this._network[t]=new Kp((t<<11)/this._networkSize),this._freq[t]=Xp._initialBias/this._networkSize,this._bias[t]=0}*_learn(){let t=this._sampleFactor;const e=this._pointArray.length;e<Xp._minpicturebytes&&(t=1);const i=30+(t-1)/3,r=e/t;let n,a=r/Xp._nCycles|0,o=Xp._initAlpha,s=(this._networkSize>>3)*Xp._radiusBias,h=s>>Xp._radiusBiasShift;h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*Xp._radBias/(h*h));n=e<Xp._minpicturebytes?1:e%Xp._prime1!=0?Xp._prime1:e%Xp._prime2!=0?Xp._prime2:e%Xp._prime3!=0?Xp._prime3:Xp._prime4;const l=new qp(r,99);for(let t=0,u=0;t<r;){l.shouldNotify(t)&&(yield{progress:l.progress});const r=this._pointArray[u],c=r.b<<3,f=r.g<<3,d=r.r<<3,p=r.a<<3,m=this._contest(c,f,d,p);if(this._alterSingle(o,m,c,f,d,p),0!==h&&this._alterNeighbour(h,m,c,f,d,p),u+=n,u>=e&&(u-=e),t++,0===a&&(a=1),t%a==0){o-=o/i,s-=s/Xp._radiusDecrease,h=s>>Xp._radiusBiasShift,h<=1&&(h=0);for(let t=0;t<h;t++)this._radPower[t]=o*((h*h-t*t)*Xp._radBias/(h*h))}}}_buildPalette(){const t=new Gp;return this._network.forEach((e=>{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,i,r,n,a){let o=e-t;o<-1&&(o=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let h=e+1,l=e-1,u=1;for(;h<s||l>o;){const t=this._radPower[u++]/Xp._alphaRadBias;if(h<s){const e=this._network[h++];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}if(l>o){const e=this._network[l--];e.subtract(t*(e.r-n),t*(e.g-r),t*(e.b-i),t*(e.a-a))}}}_alterSingle(t,e,i,r,n,a){t/=Xp._initAlpha;const o=this._network[e];o.subtract(t*(o.r-n),t*(o.g-r),t*(o.b-i),t*(o.a-a))}_contest(t,e,i,r){let n=~(1<<31),a=n,o=-1,s=o;for(let h=0;h<this._networkSize;h++){const l=this._network[h],u=8160*this._distance.calculateNormalized(l,{r:i,g:e,b:t,a:r});u<n&&(n=u,o=h);const c=u-(this._bias[h]>>Xp._initialBiasShift-3);c<a&&(a=c,s=h);const f=this._freq[h]>>Xp._betaShift;this._freq[h]-=f,this._bias[h]+=f<<Xp._gammaShift}return this._freq[o]+=Xp._beta,this._bias[o]-=Xp._betaGamma,s}},Qp=Xp;Wd(Qp,"_prime1",499),Wd(Qp,"_prime2",491),Wd(Qp,"_prime3",487),Wd(Qp,"_prime4",503),Wd(Qp,"_minpicturebytes",Xp._prime4),Wd(Qp,"_nCycles",100),Wd(Qp,"_initialBiasShift",16),Wd(Qp,"_initialBias",1<<Xp._initialBiasShift),Wd(Qp,"_gammaShift",10),Wd(Qp,"_betaShift",10),Wd(Qp,"_beta",Xp._initialBias>>Xp._betaShift),Wd(Qp,"_betaGamma",Xp._initialBias<<Xp._gammaShift-Xp._betaShift),Wd(Qp,"_radiusBiasShift",6),Wd(Qp,"_radiusBias",1<<Xp._radiusBiasShift),Wd(Qp,"_radiusDecrease",30),Wd(Qp,"_alphaBiasShift",10),Wd(Qp,"_initAlpha",1<<Xp._alphaBiasShift),Wd(Qp,"_radBiasShift",8),Wd(Qp,"_radBias",1<<Xp._radBiasShift),Wd(Qp,"_alphaRadBiasShift",Xp._alphaBiasShift+Xp._radBiasShift),Wd(Qp,"_alphaRadBias",1<<Xp._alphaRadBiasShift);var tm=class{constructor(t,e){Wd(this,"_method"),Wd(this,"_hueStats"),Wd(this,"_histogram"),Wd(this,"_initColors"),Wd(this,"_minHueCols"),this._method=t,this._minHueCols=e<<2,this._initColors=e<<2,this._hueStats=new $p(tm._hueGroups,this._minHueCols),this._histogram=Object.create(null)}sample(t){switch(this._method){case 1:this._colorStats1D(t);break;case 2:this._colorStats2D(t)}}getImportanceSortedColorsIDXI32(){const t=op(Object.keys(this._histogram),((t,e)=>this._histogram[e]-this._histogram[t]));if(0===t.length)return[];let e;switch(this._method){case 1:const i=Math.min(t.length,this._initColors),r=t[i-1],n=this._histogram[r];e=t.slice(0,i);let a=i;const o=t.length;for(;a<o&&this._histogram[t[a]]===n;)e.push(t[a++]);this._hueStats.injectIntoArray(e);break;case 2:e=t;break;default:throw new Error("Incorrect method")}return e.map((t=>+t))}_colorStats1D(t){const e=this._histogram,i=t.getPointArray(),r=i.length;for(let t=0;t<r;t++){const r=i[t].uint32;this._hueStats.check(r),r in e?e[r]++:e[r]=1}}_colorStats2D(t){const e=t.getWidth(),i=t.getHeight(),r=t.getPointArray(),n=tm._boxSize[0],a=tm._boxSize[1],o=n*a,s=this._makeBoxes(e,i,n,a),h=this._histogram;s.forEach((t=>{let i=Math.round(t.w*t.h/o)*tm._boxPixels;i<2&&(i=2);const n={};this._iterateBox(t,e,(t=>{const e=r[t].uint32;this._hueStats.check(e),e in h?h[e]++:e in n?++n[e]>=i&&(h[e]=n[e]):n[e]=1}))})),this._hueStats.injectIntoDictionary(h)}_iterateBox(t,e,i){const r=t,n=r.y*e+r.x,a=(r.y+r.h-1)*e+(r.x+r.w-1),o=e-r.w+1;let s=0,h=n;do{i.call(this,h),h+=++s%r.w==0?o:1}while(h<=a)}_makeBoxes(t,e,i,r){const n=t%i,a=e%r,o=t-n,s=e-a,h=[];for(let l=0;l<e;l+=r)for(let e=0;e<t;e+=i)h.push({x:e,y:l,w:e===o?n:i,h:l===s?a:r});return h}},em=tm;Wd(em,"_boxSize",[64,64]),Wd(em,"_boxPixels",2),Wd(em,"_hueGroups",10);var im=class{constructor(t,e,i){Wd(this,"index"),Wd(this,"color"),Wd(this,"distance"),this.index=t,this.color=e,this.distance=i}},rm=class extends Up{constructor(t,e=256,i=2){super(),Wd(this,"_colors"),Wd(this,"_initialDistance"),Wd(this,"_distanceIncrement"),Wd(this,"_histogram"),Wd(this,"_distance"),this._distance=t,this._colors=e,this._histogram=new em(i,e),this._initialDistance=.01,this._distanceIncrement=.005}sample(t){this._histogram.sample(t)}*quantize(){const t=this._histogram.getImportanceSortedColorsIDXI32();if(0===t.length)throw new Error("No colors in image");yield*this._buildPalette(t)}*_buildPalette(t){const e=new Gp,i=e.getPointContainer().getPointArray(),r=new Array(t.length);for(let e=0;e<t.length;e++)i.push(Fp.createByUint32(t[e])),r[e]=1;const n=i.length,a=[];let o=n,s=this._initialDistance;const h=new qp(o-this._colors,99);for(;o>this._colors;){a.length=0;for(let t=0;t<n;t++){if(h.shouldNotify(n-o)&&(yield{progress:h.progress}),0===r[t])continue;const e=i[t];for(let h=t+1;h<n;h++){if(0===r[h])continue;const t=i[h],n=this._distance.calculateNormalized(e,t);n<s&&(a.push(new im(h,t,n)),r[h]=0,o--)}}s+=o>3*this._colors?this._initialDistance:this._distanceIncrement}if(o<this._colors){op(a,((t,e)=>e.distance-t.distance));let t=0;for(;o<this._colors&&t<a.length;){r[a[t].index]=1,o++,t++}}let l=i.length;for(let t=l-1;t>=0;t--)0===r[t]&&(t!==l-1&&(i[t]=i[l-1]),--l);i.length=l,e.sort(),yield{palette:e,progress:100}}};function nm(t){const e=[];for(let i=0;i<t;i++)e[i]=0;return e}function am(t,e,i,r){const n=new Array(t);for(let a=0;a<t;a++){n[a]=new Array(e);for(let t=0;t<e;t++){n[a][t]=new Array(i);for(let e=0;e<i;e++){n[a][t][e]=new Array(r);for(let i=0;i<r;i++)n[a][t][e][i]=0}}}return n}function om(t,e,i){const r=new Array(t);for(let n=0;n<t;n++){r[n]=new Array(e);for(let t=0;t<e;t++){r[n][t]=new Array(i);for(let e=0;e<i;e++)r[n][t][e]=0}}return r}function sm(t,e,i,r,n){for(let a=0;a<e;a++){t[a]=[];for(let e=0;e<i;e++){t[a][e]=[];for(let i=0;i<r;i++)t[a][e][i]=n}}}function hm(t,e,i){for(let r=0;r<e;r++)t[r]=i}var lm=class{constructor(){Wd(this,"redMinimum"),Wd(this,"redMaximum"),Wd(this,"greenMinimum"),Wd(this,"greenMaximum"),Wd(this,"blueMinimum"),Wd(this,"blueMaximum"),Wd(this,"volume"),Wd(this,"alphaMinimum"),Wd(this,"alphaMaximum")}},um=class extends Up{constructor(t,e=256,i=5){super(),Wd(this,"_reds"),Wd(this,"_greens"),Wd(this,"_blues"),Wd(this,"_alphas"),Wd(this,"_sums"),Wd(this,"_weights"),Wd(this,"_momentsRed"),Wd(this,"_momentsGreen"),Wd(this,"_momentsBlue"),Wd(this,"_momentsAlpha"),Wd(this,"_moments"),Wd(this,"_table"),Wd(this,"_pixels"),Wd(this,"_cubes"),Wd(this,"_colors"),Wd(this,"_significantBitsPerChannel"),Wd(this,"_maxSideIndex"),Wd(this,"_alphaMaxSideIndex"),Wd(this,"_sideSize"),Wd(this,"_alphaSideSize"),Wd(this,"_distance"),this._distance=t,this._setQuality(i),this._initialize(e)}sample(t){const e=t.getPointArray();for(let t=0,i=e.length;t<i;t++)this._addColor(e[t]);this._pixels=this._pixels.concat(e)}*quantize(){yield*this._preparePalette();const t=new Gp;for(let e=0;e<this._colors;e++)if(this._sums[e]>0){const i=this._sums[e],r=this._reds[e]/i,n=this._greens[e]/i,a=this._blues[e]/i,o=this._alphas[e]/i,s=Fp.createByRGBA(0|r,0|n,0|a,0|o);t.add(s)}t.sort(),yield{palette:t,progress:100}}*_preparePalette(){yield*this._calculateMoments();let t=0;const e=nm(this._colors);for(let i=1;i<this._colors;++i){this._cut(this._cubes[t],this._cubes[i])?(e[t]=this._cubes[t].volume>1?this._calculateVariance(this._cubes[t]):0,e[i]=this._cubes[i].volume>1?this._calculateVariance(this._cubes[i]):0):(e[t]=0,i--),t=0;let r=e[0];for(let n=1;n<=i;++n)e[n]>r&&(r=e[n],t=n);if(r<=0){this._colors=i+1;break}}const i=[],r=[],n=[],a=[];for(let t=0;t<this._colors;++t){const e=um._volume(this._cubes[t],this._weights);e>0?(i[t]=um._volume(this._cubes[t],this._momentsRed)/e|0,r[t]=um._volume(this._cubes[t],this._momentsGreen)/e|0,n[t]=um._volume(this._cubes[t],this._momentsBlue)/e|0,a[t]=um._volume(this._cubes[t],this._momentsAlpha)/e|0):(i[t]=0,r[t]=0,n[t]=0,a[t]=0)}this._reds=nm(this._colors+1),this._greens=nm(this._colors+1),this._blues=nm(this._colors+1),this._alphas=nm(this._colors+1),this._sums=nm(this._colors+1);for(let t=0,e=this._pixels.length;t<e;t++){const e=this._pixels[t];let o=-1,s=Number.MAX_VALUE;for(let t=0;t<this._colors;t++){const h=i[t],l=r[t],u=n[t],c=a[t],f=this._distance.calculateRaw(h,l,u,c,e.r,e.g,e.b,e.a);f<s&&(s=f,o=t)}this._reds[o]+=e.r,this._greens[o]+=e.g,this._blues[o]+=e.b,this._alphas[o]+=e.a,this._sums[o]++}}_addColor(t){const e=8-this._significantBitsPerChannel,i=1+(t.r>>e),r=1+(t.g>>e),n=1+(t.b>>e),a=1+(t.a>>e);this._weights[a][i][r][n]++,this._momentsRed[a][i][r][n]+=t.r,this._momentsGreen[a][i][r][n]+=t.g,this._momentsBlue[a][i][r][n]+=t.b,this._momentsAlpha[a][i][r][n]+=t.a,this._moments[a][i][r][n]+=this._table[t.r]+this._table[t.g]+this._table[t.b]+this._table[t.a]}*_calculateMoments(){const t=[],e=[],i=[],r=[],n=[],a=[],o=om(this._sideSize,this._sideSize,this._sideSize),s=om(this._sideSize,this._sideSize,this._sideSize),h=om(this._sideSize,this._sideSize,this._sideSize),l=om(this._sideSize,this._sideSize,this._sideSize),u=om(this._sideSize,this._sideSize,this._sideSize),c=om(this._sideSize,this._sideSize,this._sideSize);let f=0;const d=new qp(this._alphaMaxSideIndex*this._maxSideIndex,99);for(let p=1;p<=this._alphaMaxSideIndex;++p){sm(o,this._sideSize,this._sideSize,this._sideSize,0),sm(s,this._sideSize,this._sideSize,this._sideSize,0),sm(h,this._sideSize,this._sideSize,this._sideSize,0),sm(l,this._sideSize,this._sideSize,this._sideSize,0),sm(u,this._sideSize,this._sideSize,this._sideSize,0),sm(c,this._sideSize,this._sideSize,this._sideSize,0);for(let m=1;m<=this._maxSideIndex;++m,++f){d.shouldNotify(f)&&(yield{progress:d.progress}),hm(t,this._sideSize,0),hm(e,this._sideSize,0),hm(i,this._sideSize,0),hm(r,this._sideSize,0),hm(n,this._sideSize,0),hm(a,this._sideSize,0);for(let f=1;f<=this._maxSideIndex;++f){let d=0,g=0,_=0,b=0,y=0,w=0;for(let v=1;v<=this._maxSideIndex;++v)d+=this._weights[p][m][f][v],g+=this._momentsRed[p][m][f][v],_+=this._momentsGreen[p][m][f][v],b+=this._momentsBlue[p][m][f][v],y+=this._momentsAlpha[p][m][f][v],w+=this._moments[p][m][f][v],t[v]+=d,e[v]+=g,i[v]+=_,r[v]+=b,n[v]+=y,a[v]+=w,o[m][f][v]=o[m-1][f][v]+t[v],s[m][f][v]=s[m-1][f][v]+e[v],h[m][f][v]=h[m-1][f][v]+i[v],l[m][f][v]=l[m-1][f][v]+r[v],u[m][f][v]=u[m-1][f][v]+n[v],c[m][f][v]=c[m-1][f][v]+a[v],this._weights[p][m][f][v]=this._weights[p-1][m][f][v]+o[m][f][v],this._momentsRed[p][m][f][v]=this._momentsRed[p-1][m][f][v]+s[m][f][v],this._momentsGreen[p][m][f][v]=this._momentsGreen[p-1][m][f][v]+h[m][f][v],this._momentsBlue[p][m][f][v]=this._momentsBlue[p-1][m][f][v]+l[m][f][v],this._momentsAlpha[p][m][f][v]=this._momentsAlpha[p-1][m][f][v]+u[m][f][v],this._moments[p][m][f][v]=this._moments[p-1][m][f][v]+c[m][f][v]}}}}static _volumeFloat(t,e){return e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMaximum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum])}static _volume(t,e){return 0|um._volumeFloat(t,e)}static _top(t,e,i,r){let n;switch(e){case um._alpha:n=r[i][t.redMaximum][t.greenMaximum][t.blueMaximum]-r[i][t.redMaximum][t.greenMinimum][t.blueMaximum]-r[i][t.redMinimum][t.greenMaximum][t.blueMaximum]+r[i][t.redMinimum][t.greenMinimum][t.blueMaximum]-(r[i][t.redMaximum][t.greenMaximum][t.blueMinimum]-r[i][t.redMaximum][t.greenMinimum][t.blueMinimum]-r[i][t.redMinimum][t.greenMaximum][t.blueMinimum]+r[i][t.redMinimum][t.greenMinimum][t.blueMinimum]);break;case um._red:n=r[t.alphaMaximum][i][t.greenMaximum][t.blueMaximum]-r[t.alphaMaximum][i][t.greenMinimum][t.blueMaximum]-r[t.alphaMinimum][i][t.greenMaximum][t.blueMaximum]+r[t.alphaMinimum][i][t.greenMinimum][t.blueMaximum]-(r[t.alphaMaximum][i][t.greenMaximum][t.blueMinimum]-r[t.alphaMaximum][i][t.greenMinimum][t.blueMinimum]-r[t.alphaMinimum][i][t.greenMaximum][t.blueMinimum]+r[t.alphaMinimum][i][t.greenMinimum][t.blueMinimum]);break;case um._green:n=r[t.alphaMaximum][t.redMaximum][i][t.blueMaximum]-r[t.alphaMaximum][t.redMinimum][i][t.blueMaximum]-r[t.alphaMinimum][t.redMaximum][i][t.blueMaximum]+r[t.alphaMinimum][t.redMinimum][i][t.blueMaximum]-(r[t.alphaMaximum][t.redMaximum][i][t.blueMinimum]-r[t.alphaMaximum][t.redMinimum][i][t.blueMinimum]-r[t.alphaMinimum][t.redMaximum][i][t.blueMinimum]+r[t.alphaMinimum][t.redMinimum][i][t.blueMinimum]);break;case um._blue:n=r[t.alphaMaximum][t.redMaximum][t.greenMaximum][i]-r[t.alphaMaximum][t.redMaximum][t.greenMinimum][i]-r[t.alphaMaximum][t.redMinimum][t.greenMaximum][i]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][i]-(r[t.alphaMinimum][t.redMaximum][t.greenMaximum][i]-r[t.alphaMinimum][t.redMaximum][t.greenMinimum][i]-r[t.alphaMinimum][t.redMinimum][t.greenMaximum][i]+r[t.alphaMinimum][t.redMinimum][t.greenMinimum][i]);break;default:throw new Error("impossible")}return 0|n}static _bottom(t,e,i){switch(e){case um._alpha:return-i[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-i[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case um._red:return-i[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-i[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case um._green:return-i[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-i[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case um._blue:return-i[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]+i[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-(-i[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+i[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-i[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);default:return 0}}_calculateVariance(t){const e=um._volume(t,this._momentsRed),i=um._volume(t,this._momentsGreen),r=um._volume(t,this._momentsBlue),n=um._volume(t,this._momentsAlpha);return um._volumeFloat(t,this._moments)-(e*e+i*i+r*r+n*n)/um._volume(t,this._weights)}_maximize(t,e,i,r,n,a,o,s,h){const l=0|um._bottom(t,e,this._momentsRed),u=0|um._bottom(t,e,this._momentsGreen),c=0|um._bottom(t,e,this._momentsBlue),f=0|um._bottom(t,e,this._momentsAlpha),d=0|um._bottom(t,e,this._weights);let p=0,m=-1;for(let g=i;g<r;++g){let i=l+um._top(t,e,g,this._momentsRed),r=u+um._top(t,e,g,this._momentsGreen),_=c+um._top(t,e,g,this._momentsBlue),b=f+um._top(t,e,g,this._momentsAlpha),y=d+um._top(t,e,g,this._weights);if(0!==y){let t=i*i+r*r+_*_+b*b,e=t/y;i=n-i,r=a-r,_=o-_,b=s-b,y=h-y,0!==y&&(t=i*i+r*r+_*_+b*b,e+=t/y,e>p&&(p=e,m=g))}}return{max:p,position:m}}_cut(t,e){let i;const r=um._volume(t,this._momentsRed),n=um._volume(t,this._momentsGreen),a=um._volume(t,this._momentsBlue),o=um._volume(t,this._momentsAlpha),s=um._volume(t,this._weights),h=this._maximize(t,um._red,t.redMinimum+1,t.redMaximum,r,n,a,o,s),l=this._maximize(t,um._green,t.greenMinimum+1,t.greenMaximum,r,n,a,o,s),u=this._maximize(t,um._blue,t.blueMinimum+1,t.blueMaximum,r,n,a,o,s),c=this._maximize(t,um._alpha,t.alphaMinimum+1,t.alphaMaximum,r,n,a,o,s);if(c.max>=h.max&&c.max>=l.max&&c.max>=u.max){if(i=um._alpha,c.position<0)return!1}else i=h.max>=c.max&&h.max>=l.max&&h.max>=u.max?um._red:l.max>=c.max&&l.max>=h.max&&l.max>=u.max?um._green:um._blue;switch(e.redMaximum=t.redMaximum,e.greenMaximum=t.greenMaximum,e.blueMaximum=t.blueMaximum,e.alphaMaximum=t.alphaMaximum,i){case um._red:e.redMinimum=t.redMaximum=h.position,e.greenMinimum=t.greenMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case um._green:e.greenMinimum=t.greenMaximum=l.position,e.redMinimum=t.redMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case um._blue:e.blueMinimum=t.blueMaximum=u.position,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum,e.alphaMinimum=t.alphaMinimum;break;case um._alpha:e.alphaMinimum=t.alphaMaximum=c.position,e.blueMinimum=t.blueMinimum,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum}return t.volume=(t.redMaximum-t.redMinimum)*(t.greenMaximum-t.greenMinimum)*(t.blueMaximum-t.blueMinimum)*(t.alphaMaximum-t.alphaMinimum),e.volume=(e.redMaximum-e.redMinimum)*(e.greenMaximum-e.greenMinimum)*(e.blueMaximum-e.blueMinimum)*(e.alphaMaximum-e.alphaMinimum),!0}_initialize(t){this._colors=t,this._cubes=[];for(let e=0;e<t;e++)this._cubes[e]=new lm;this._cubes[0].redMinimum=0,this._cubes[0].greenMinimum=0,this._cubes[0].blueMinimum=0,this._cubes[0].alphaMinimum=0,this._cubes[0].redMaximum=this._maxSideIndex,this._cubes[0].greenMaximum=this._maxSideIndex,this._cubes[0].blueMaximum=this._maxSideIndex,this._cubes[0].alphaMaximum=this._alphaMaxSideIndex,this._weights=am(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsRed=am(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsGreen=am(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsBlue=am(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._momentsAlpha=am(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._moments=am(this._alphaSideSize,this._sideSize,this._sideSize,this._sideSize),this._table=[];for(let t=0;t<256;++t)this._table[t]=t*t;this._pixels=[]}_setQuality(t=5){this._significantBitsPerChannel=t,this._maxSideIndex=1<<this._significantBitsPerChannel,this._alphaMaxSideIndex=this._maxSideIndex,this._sideSize=this._maxSideIndex+1,this._alphaSideSize=this._alphaMaxSideIndex+1}},cm=um;Wd(cm,"_alpha",3),Wd(cm,"_red",2),Wd(cm,"_green",1),Wd(cm,"_blue",0);$d({},{AbstractImageQuantizer:()=>fm,ErrorDiffusionArray:()=>mm,ErrorDiffusionArrayKernel:()=>pm,ErrorDiffusionRiemersma:()=>ym,NearestColor:()=>dm});var fm=class{quantizeSync(t,e){for(const i of this.quantize(t,e))if(i.pointContainer)return i.pointContainer;throw new Error("unreachable")}},dm=class extends fm{constructor(t){super(),Wd(this,"_distance"),this._distance=t}*quantize(t,e){const i=t.getPointArray(),r=t.getWidth(),n=t.getHeight(),a=new qp(n,99);for(let t=0;t<n;t++){a.shouldNotify(t)&&(yield{progress:a.progress});for(let n=0,a=t*r;n<r;n++,a++){const t=i[a];t.from(e.getNearestColor(this._distance,t))}}yield{pointContainer:t,progress:100}}},pm=(t=>(t[t.FloydSteinberg=0]="FloydSteinberg",t[t.FalseFloydSteinberg=1]="FalseFloydSteinberg",t[t.Stucki=2]="Stucki",t[t.Atkinson=3]="Atkinson",t[t.Jarvis=4]="Jarvis",t[t.Burkes=5]="Burkes",t[t.Sierra=6]="Sierra",t[t.TwoSierra=7]="TwoSierra",t[t.SierraLite=8]="SierraLite",t))(pm||{}),mm=class extends fm{constructor(t,e,i=!0,r=0,n=!1){super(),Wd(this,"_minColorDistance"),Wd(this,"_serpentine"),Wd(this,"_kernel"),Wd(this,"_calculateErrorLikeGIMP"),Wd(this,"_distance"),this._setKernel(e),this._distance=t,this._minColorDistance=r,this._serpentine=i,this._calculateErrorLikeGIMP=n}*quantize(t,e){const i=t.getPointArray(),r=new Fp,n=t.getWidth(),a=t.getHeight(),o=[];let s=1,h=1;for(const t of this._kernel){const e=t[2]+1;h<e&&(h=e)}for(let t=0;t<h;t++)this._fillErrorLine(o[t]=[],n);const l=new qp(a,99);for(let t=0;t<a;t++){l.shouldNotify(t)&&(yield{progress:l.progress}),this._serpentine&&(s*=-1);const h=t*n,u=1===s?0:n-1,c=1===s?n:-1;this._fillErrorLine(o[0],n),o.push(o.shift());const f=o[0];for(let l=u,d=h+u;l!==c;l+=s,d+=s){const h=i[d],u=f[l];r.from(h);const c=Fp.createByRGBA(np(h.r+u[0]),np(h.g+u[1]),np(h.b+u[2]),np(h.a+u[3])),p=e.getNearestColor(this._distance,c);if(h.from(p),this._minColorDistance){if(this._distance.calculateNormalized(r,p)<this._minColorDistance)continue}let m,g,_,b;this._calculateErrorLikeGIMP?(m=c.r-p.r,g=c.g-p.g,_=c.b-p.b,b=c.a-p.a):(m=r.r-p.r,g=r.g-p.g,_=r.b-p.b,b=r.a-p.a);const y=1===s?0:this._kernel.length-1,w=1===s?this._kernel.length:-1;for(let e=y;e!==w;e+=s){const i=this._kernel[e][1]*s,r=this._kernel[e][2];if(i+l>=0&&i+l<n&&r+t>=0&&r+t<a){const t=this._kernel[e][0],n=o[r][i+l];n[0]+=m*t,n[1]+=g*t,n[2]+=_*t,n[3]+=b*t}}}}yield{pointContainer:t,progress:100}}_fillErrorLine(t,e){t.length>e&&(t.length=e);const i=t.length;for(let e=0;e<i;e++){const i=t[e];i[0]=i[1]=i[2]=i[3]=0}for(let r=i;r<e;r++)t[r]=[0,0,0,0]}_setKernel(t){switch(t){case 0:this._kernel=[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]];break;case 1:this._kernel=[[3/8,1,0],[3/8,0,1],[2/8,1,1]];break;case 2:this._kernel=[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]];break;case 3:this._kernel=[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]];break;case 4:this._kernel=[[7/48,1,0],[5/48,2,0],[3/48,-2,1],[5/48,-1,1],[7/48,0,1],[5/48,1,1],[3/48,2,1],[1/48,-2,2],[3/48,-1,2],[5/48,0,2],[3/48,1,2],[1/48,2,2]];break;case 5:this._kernel=[[.25,1,0],[4/32,2,0],[2/32,-2,1],[4/32,-1,1],[.25,0,1],[4/32,1,1],[2/32,2,1]];break;case 6:this._kernel=[[5/32,1,0],[3/32,2,0],[2/32,-2,1],[4/32,-1,1],[5/32,0,1],[4/32,1,1],[2/32,2,1],[2/32,-1,2],[3/32,0,2],[2/32,1,2]];break;case 7:this._kernel=[[.25,1,0],[3/16,2,0],[1/16,-2,1],[2/16,-1,1],[3/16,0,1],[2/16,1,1],[1/16,2,1]];break;case 8:this._kernel=[[.5,1,0],[1/4,-1,1],[1/4,0,1]];break;default:throw new Error(`ErrorDiffusionArray: unknown kernel = ${t}`)}}};function*gm(t,e,i){const r=Math.max(t,e),n={width:t,height:e,level:Math.floor(Math.log(r)/Math.log(2)+1),callback:i,tracker:new qp(t*e,99),index:0,x:0,y:0};yield*_m(n,1),bm(n,0)}function*_m(t,e){if(!(t.level<1)){switch(t.tracker.shouldNotify(t.index)&&(yield{progress:t.tracker.progress}),t.level--,e){case 2:yield*_m(t,1),bm(t,3),yield*_m(t,2),bm(t,4),yield*_m(t,2),bm(t,2),yield*_m(t,4);break;case 3:yield*_m(t,4),bm(t,2),yield*_m(t,3),bm(t,1),yield*_m(t,3),bm(t,3),yield*_m(t,1);break;case 1:yield*_m(t,2),bm(t,4),yield*_m(t,1),bm(t,3),yield*_m(t,1),bm(t,1),yield*_m(t,3);break;case 4:yield*_m(t,3),bm(t,1),yield*_m(t,4),bm(t,2),yield*_m(t,4),bm(t,4),yield*_m(t,2)}t.level++}}function bm(t,e){switch(t.x>=0&&t.x<t.width&&t.y>=0&&t.y<t.height&&(t.callback(t.x,t.y),t.index++),e){case 2:t.x--;break;case 3:t.x++;break;case 1:t.y--;break;case 4:t.y++}}var ym=class extends fm{constructor(t,e=16,i=1){super(),Wd(this,"_distance"),Wd(this,"_weights"),Wd(this,"_errorQueueSize"),this._distance=t,this._errorQueueSize=e,this._weights=ym._createWeights(i,e)}*quantize(t,e){const i=t.getPointArray(),r=t.getWidth(),n=t.getHeight(),a=[];let o=0;for(let t=0;t<this._errorQueueSize;t++)a[t]={r:0,g:0,b:0,a:0};yield*gm(r,n,((t,n)=>{const s=i[t+n*r];let{r:h,g:l,b:u,a:c}=s;for(let t=0;t<this._errorQueueSize;t++){const e=this._weights[t],i=a[(t+o)%this._errorQueueSize];h+=i.r*e,l+=i.g*e,u+=i.b*e,c+=i.a*e}const f=Fp.createByRGBA(np(h),np(l),np(u),np(c)),d=e.getNearestColor(this._distance,f);o=(o+1)%this._errorQueueSize;const p=(o+this._errorQueueSize-1)%this._errorQueueSize;a[p].r=s.r-d.r,a[p].g=s.g-d.g,a[p].b=s.b-d.b,a[p].a=s.a-d.a,s.from(d)})),yield{pointContainer:t,progress:100}}static _createWeights(t,e){const i=[],r=Math.exp(Math.log(e)/(e-1));for(let n=0,a=1;n<e;n++)i[n]=(a+.5|0)/e*t,a*=r;return i}};$d({},{ssim:()=>xm});var wm=.01,vm=.03;function xm(t,e){if(t.getHeight()!==e.getHeight()||t.getWidth()!==e.getWidth())throw new Error("Images have different sizes!");const i=(255*wm)**2,r=(255*vm)**2;let n=0,a=0;return function(t,e,i){const r=8,n=t.getWidth(),a=t.getHeight();for(let o=0;o<a;o+=r)for(let s=0;s<n;s+=r){const h=Math.min(r,n-s),l=Math.min(r,a-o),u=km(t,s,o,h,l),c=km(e,s,o,h,l);i(u,c,Em(u),Em(c))}}(t,e,((t,e,o,s)=>{let h=0,l=0,u=0;for(let i=0;i<t.length;i++)l+=(t[i]-o)**2,u+=(e[i]-s)**2,h+=(t[i]-o)*(e[i]-s);const c=t.length-1;l/=c,u/=c,h/=c;a+=(2*o*s+i)*(2*h+r)/((o**2+s**2+i)*(l+u+r)),n++})),a/n}function km(t,e,i,r,n){const a=t.getPointArray(),o=[];let s=0;for(let h=i;h<i+n;h++){const i=h*t.getWidth();for(let t=e;t<e+r;t++){const e=a[i+t];o[s]=.2126*e.r+.7152*e.g+.0722*e.b,s++}}return o}function Em(t){let e=0;for(const i of t)e+=i;return e/t.length}function Sm(t,{colorDistanceFormula:e,paletteQuantization:i,colors:r}={}){const n=function(t,e="wuquant",i=256){switch(e){case"neuquant":return new Jp(t,i);case"rgbquant":return new rm(t,i);case"wuquant":return new cm(t,i);case"neuquant-float":return new Qp(t,i);default:throw new Error(`Unknown paletteQuantization ${e}`)}}
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * cie94.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * ciede2000.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * cmetric.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * common.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * constants.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * ditherErrorDiffusionArray.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * euclidean.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * helper.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * hueStatistics.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * iq.ts - Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * lab2rgb.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * lab2xyz.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * manhattanNeuQuant.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * nearestColor.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * palette.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * pngQuant.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * point.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * pointContainer.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * rgb2hsl.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * rgb2lab.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * rgb2xyz.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * ssim.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * wuQuant.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * xyz2lab.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * xyz2rgb.ts - part of Image Quantization Library
 */
/**
 * @preserve
 * MIT License
 *
 * Copyright 2015-2018 Igor Bezkrovnyi
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 *
 * riemersma.ts - part of Image Quantization Library
 */
/**
 * @preserve TypeScript port:
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * colorHistogram.ts - part of Image Quantization Library
 */
/**
 * @preserve TypeScript port:
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * neuquant.ts - part of Image Quantization Library
 */
/**
 * @preserve TypeScript port:
 * Copyright 2015-2018 Igor Bezkrovnyi
 * All rights reserved. (MIT Licensed)
 *
 * rgbquant.ts - part of Image Quantization Library
 */(Am(e),i,r);return t.forEach((t=>n.sample(t))),n.quantizeSync()}function Mm(t,e,{colorDistanceFormula:i,imageQuantization:r}={}){const n=function(t,e="floyd-steinberg"){switch(e){case"nearest":return new dm(t);case"riemersma":return new ym(t);case"floyd-steinberg":return new mm(t,0);case"false-floyd-steinberg":return new mm(t,1);case"stucki":return new mm(t,2);case"atkinson":return new mm(t,3);case"jarvis":return new mm(t,4);case"burkes":return new mm(t,5);case"sierra":return new mm(t,6);case"two-sierra":return new mm(t,7);case"sierra-lite":return new mm(t,8);default:throw new Error(`Unknown imageQuantization ${e}`)}}(Am(i),r);return n.quantizeSync(t,e)}function Am(t="euclidean-bt709"){switch(t){case"cie94-graphic-arts":return new Sp;case"cie94-textiles":return new Ep;case"ciede2000":return new Ap;case"color-metric":return new Ip;case"euclidean":return new Pp;case"euclidean-bt709":return new Tp;case"euclidean-bt709-noalpha":return new Rp;case"manhattan":return new Bp;case"manhattan-bt709":return new Lp;case"manhattan-nommyde":return new Cp;case"pngquant":return new Dp;default:throw new Error(`Unknown colorDistanceFormula ${t}`)}}"function"==typeof setImmediate?setImmediate:"undefined"!=typeof process&&(null==process||process.nextTick);const Im=Hu({colors:Ru().optional(),colorDistanceFormula:Wu([Qu("cie94-textiles"),Qu("cie94-graphic-arts"),Qu("ciede2000"),Qu("color-metric"),Qu("euclidean"),Qu("euclidean-bt709-noalpha"),Qu("euclidean-bt709"),Qu("manhattan"),Qu("manhattan-bt709"),Qu("manhattan-nommyde"),Qu("pngquant")]).optional(),paletteQuantization:Wu([Qu("neuquant"),Qu("neuquant-float"),Qu("rgbquant"),Qu("wuquant")]).optional(),imageQuantization:Wu([Qu("nearest"),Qu("riemersma"),Qu("floyd-steinberg"),Qu("false-floyd-steinberg"),Qu("stucki"),Qu("atkinson"),Qu("jarvis"),Qu("burkes"),Qu("sierra"),Qu("two-sierra"),Qu("sierra-lite")]).optional()}),zm={quantize(t,e){const{colors:i,colorDistanceFormula:r,paletteQuantization:n,imageQuantization:a}=Im.parse(e),o=Zp.PointContainer.fromUint8Array(new Uint8Array(t.bitmap.data.buffer),t.bitmap.width,t.bitmap.height),s=Mm(o,Sm([o],{colors:i,colorDistanceFormula:r,paletteQuantization:n}),{colorDistanceFormula:r,imageQuantization:a});return t.bitmap.data=_.from(s.toUint8Array()),t}};var Pm=function(t){if(!t)throw new Error("no data provided");var e={pages:[],chars:[],kernings:[]},i=(t=t.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var n=Tm(i[r],r);if(n)if("page"===n.key){if("number"!=typeof n.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof n.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');e.pages[n.data.id]=n.data.file}else"chars"===n.key||"kernings"===n.key||("char"===n.key?e.chars.push(n.data):"kerning"===n.key?e.kernings.push(n.data):e[n.key]=n.data)}return e};function Tm(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var i=t.indexOf(" ");if(-1===i)throw new Error("no named row at line "+e);var r=t.substring(0,i);t=(t=(t=(t=t.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var n=[],a=0;a<t.length;a++){var o=t[a];0===a?n.push({key:o[0],data:""}):a===t.length-1?n[n.length-1].data=Rm(o[0]):(n[n.length-1].data=Rm(o[0]),n.push({key:o[1],data:""}))}var s={key:r,data:{}};return n.forEach((function(t){s.data[t.key]=t.data})),s}function Rm(t){return t&&0!==t.length?0===t.indexOf('"')||0===t.indexOf("'")?t.substring(1,t.length-1):-1!==t.indexOf(",")?function(t){return t.split(",").map((function(t){return parseInt(t,10)}))}(t):parseInt(t,10):""}var Om=e(Pm),Bm="chasrset";var Cm=void 0!==self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e},Lm=function(t){for(var e in t=Object.assign({},t),Bm in t&&(t.charset=t[Bm],delete t[Bm]),t)"face"!==e&&"charset"!==e&&(t[e]="padding"===e||"spacing"===e?t[e].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[e],10));return t},Dm=Cm,Um={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"},Fm=function(t){t=t.toString();var e=Dm(t),i={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(t){var r=e.getElementsByTagName(t)[0];r&&(i[t]=Lm(Nm(r)))}));var r=e.getElementsByTagName("pages")[0];if(!r)throw new Error("malformed file -- no <pages> element");for(var n=r.getElementsByTagName("page"),a=0;a<n.length;a++){var o=n[a],s=parseInt(o.getAttribute("id"),10),h=o.getAttribute("file");if(isNaN(s))throw new Error('malformed file -- page "id" attribute is NaN');if(!h)throw new Error('malformed file -- needs page "file" attribute');i.pages[parseInt(s,10)]=h}return["chars","kernings"].forEach((function(t){var r=e.getElementsByTagName(t)[0];if(r)for(var n=t.substring(0,t.length-1),a=r.getElementsByTagName(n),o=0;o<a.length;o++){var s=a[o];i[t].push(Lm(Nm(s)))}})),i};function Nm(t){var e=function(t){for(var e=[],i=0;i<t.attributes.length;i++)e.push(t.attributes[i]);return e}(t);return e.reduce((function(t,e){var i;return t[(i=e.nodeName,Um[i.toLowerCase()]||i)]=e.nodeValue,t}),{})}var jm=e(Fm),Gm=[66,77,70],Zm=function(t){if(t.length<6)throw new Error("invalid buffer length for BMFont");var e=Gm.every((function(e,i){return t.readUInt8(i)===e}));if(!e)throw new Error("BMFont missing BMF byte header");var i=3;if(t.readUInt8(i++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var r={kernings:[],chars:[]},n=0;n<5;n++)i+=Hm(r,t,i);return r};function Hm(t,e,i){if(i>e.length-1)return 0;var r=e.readUInt8(i++),n=e.readInt32LE(i);switch(i+=4,r){case 1:t.info=function(t,e){var i={};i.size=t.readInt16LE(e);var r=t.readUInt8(e+2);i.smooth=r>>7&1,i.unicode=r>>6&1,i.italic=r>>5&1,i.bold=r>>4&1,r>>3&1&&(i.fixedHeight=1);return i.charset=t.readUInt8(e+3)||"",i.stretchH=t.readUInt16LE(e+4),i.aa=t.readUInt8(e+6),i.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],i.spacing=[t.readInt8(e+11),t.readInt8(e+12)],i.outline=t.readUInt8(e+13),i.face=function(t,e){return $m(t,e).toString("utf8")}(t,e+14),i}(e,i);break;case 2:t.common=function(t,e){var i={};return i.lineHeight=t.readUInt16LE(e),i.base=t.readUInt16LE(e+2),i.scaleW=t.readUInt16LE(e+4),i.scaleH=t.readUInt16LE(e+6),i.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),i.packed=0,i.alphaChnl=t.readUInt8(e+11),i.redChnl=t.readUInt8(e+12),i.greenChnl=t.readUInt8(e+13),i.blueChnl=t.readUInt8(e+14),i}(e,i);break;case 3:t.pages=function(t,e,i){for(var r=[],n=$m(t,e),a=n.length+1,o=i/a,s=0;s<o;s++)r[s]=t.slice(e,e+n.length).toString("utf8"),e+=a;return r}(e,i,n);break;case 4:t.chars=function(t,e,i){for(var r=[],n=i/20,a=0;a<n;a++){var o={},s=20*a;o.id=t.readUInt32LE(e+0+s),o.x=t.readUInt16LE(e+4+s),o.y=t.readUInt16LE(e+6+s),o.width=t.readUInt16LE(e+8+s),o.height=t.readUInt16LE(e+10+s),o.xoffset=t.readInt16LE(e+12+s),o.yoffset=t.readInt16LE(e+14+s),o.xadvance=t.readInt16LE(e+16+s),o.page=t.readUInt8(e+18+s),o.chnl=t.readUInt8(e+19+s),r[a]=o}return r}(e,i,n);break;case 5:t.kernings=function(t,e,i){for(var r=[],n=i/10,a=0;a<n;a++){var o={},s=10*a;o.first=t.readUInt32LE(e+0+s),o.second=t.readUInt32LE(e+4+s),o.amount=t.readInt16LE(e+8+s),r[a]=o}return r}(e,i,n)}return 5+n}function $m(t,e){for(var i=e;i<t.length&&0!==t[i];i++);return t.slice(e,i)}var Wm=e(Zm);function qm(t,e){for(var i=0,r=t.length-1;r>=0;r--){var n=t[r];"."===n?t.splice(r,1):".."===n?(t.splice(r,1),i++):i&&(t.splice(r,1),i--)}if(e)for(;i--;i)t.unshift("..");return t}var Ym=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,Vm=function(t){return Ym.exec(t).slice(1)};function Jm(){for(var t="",e=!1,i=arguments.length-1;i>=-1&&!e;i--){var r=i>=0?arguments[i]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return t=qm(tg(t.split("/"),(function(t){return!!t})),!e).join("/"),(e?"/":"")+t||"."}function Km(t){var e=Xm(t),i="/"===eg(t,-1);return t=qm(tg(t.split("/"),(function(t){return!!t})),!e).join("/"),t||e||(t="."),t&&i&&(t+="/"),(e?"/":"")+t}function Xm(t){return"/"===t.charAt(0)}var Qm={extname:function(t){return Vm(t)[3]},basename:function(t,e){var i=Vm(t)[2];return e&&i.substr(-1*e.length)===e&&(i=i.substr(0,i.length-e.length)),i},dirname:function(t){var e=Vm(t),i=e[0],r=e[1];return i||r?(r&&(r=r.substr(0,r.length-1)),i+r):"."},sep:"/",delimiter:":",relative:function(t,e){function i(t){for(var e=0;e<t.length&&""===t[e];e++);for(var i=t.length-1;i>=0&&""===t[i];i--);return e>i?[]:t.slice(e,i-e+1)}t=Jm(t).substr(1),e=Jm(e).substr(1);for(var r=i(t.split("/")),n=i(e.split("/")),a=Math.min(r.length,n.length),o=a,s=0;s<a;s++)if(r[s]!==n[s]){o=s;break}var h=[];for(s=o;s<r.length;s++)h.push("..");return(h=h.concat(n.slice(o))).join("/")},join:function(){return Km(tg(Array.prototype.slice.call(arguments,0),(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},isAbsolute:Xm,normalize:Km,resolve:Jm};function tg(t,e){if(t.filter)return t.filter(e);for(var i=[],r=0;r<t.length;r++)e(t[r],r,t)&&i.push(t[r]);return i}var eg="b"==="ab".substr(-1)?function(t,e,i){return t.substr(e,i)}:function(t,e,i){return e<0&&(e=t.length+e),t.substr(e,i)};const ig=t=>{if(!t)return null;const e={};switch(t.type){case"ELEMENT":{let i={};const r=ag(t.value.attributes),n=ig(t.value.children);if(r&&(i=Object.assign(i,r)),n){const e=rg(t.value.children);i=Object.assign(i,e)}e[t.value.type]=i;break}case"ATTRIBUTE":{const i=t.value;e[i.name]=i.value;break}case"CONTENT":return{content:t.value}}return e},rg=t=>t&&Array.isArray(t)&&0!==t.length?ng(t)?{content:t[0].value}:{children:t.map(ig)}:null,ng=t=>t&&Array.isArray(t)&&1===t.length&&"CONTENT"===t[0].type,ag=t=>t&&Array.isArray(t)?t.map(ig).reduce(((t,e)=>Object.assign(t,e)),{}):null;var og={convert:t=>ig(t.value.children[0])},sg={Token:(t,e)=>({type:t,value:e}),TOKEN_TYPE:{OPEN_BRACKET:"OPEN_BRACKET",ELEMENT_TYPE:"ELEMENT_TYPE",CLOSE_ELEMENT:"CLOSE_ELEMENT",ATTRIB_NAME:"ATTRIB_NAME",ATTRIB_VALUE:"ATTRIB_VALUE",ASSIGN:"ASSIGN",CLOSE_BRACKET:"CLOSE_BRACKET",CONTENT:"CONTENT",EOF:"EOF"}};const{Token:hg,TOKEN_TYPE:lg}=sg,ug=hg("EOF"),cg=t=>" "===t||"\n"===t||"\r"===t||"\t"===t,fg=t=>t.replace(/'/g,'"');var dg={createLexer:function(t){let e=null,i=(t=>{let e=0;for(;e<t.length&&cg(t[e]);)e++;return((t,e)=>{if(t.startsWith("<?xml",e)){const i=t.length;for(;e<i;)if("?"!==t[e])e++;else{if(">"===t[e+1])return e+2;e++}}return e})(t,e)})(t),r=[];const n=()=>t[i],a=()=>e!==ug&&i<t.length,o=t=>'"'===t||"'"===t,s=()=>{for(;a()&&cg(t[i]);)i++},h=e=>{if(a()){if("<"===t[i]){let e="<";return i++,a()&&"/"===t[i]?(i++,e="</"):a()&&"!"===t[i]&&"-"===t[i+1]&&"-"===t[i+2]&&(i++,i++,i++,e="\x3c!--"),e}if("/"===n()){let t="/";return i++,a()&&">"===n()&&(i++,t="/>"),t}if("="===t[i]||">"===t[i]){const e=t[i];return i++,e}}return l(!!e)},l=e=>{const r=e?/[^>=<]/u:/[a-zA-Z0-9_:-]/;let n=i;for(;a()&&t[i].match(r);)i++;return fg(t.substring(n,i))},u=()=>{const c=i;s();const f=i-c;if(a())if(e&&e.type===lg.OPEN_BRACKET){s();const t=h(!1);e=hg(lg.ELEMENT_TYPE,t),r.push(t)}else if(e&&e.type===lg.ASSIGN){a()&&o(n())&&i++;let r=i;for(;a()&&!o(n());)i++;const s=fg(t.substring(r,i));i++,e=hg(lg.ATTRIB_VALUE,s)}else{s();let o=h(!0);switch(o){case"=":e=e.type===lg.ATTRIB_NAME?hg(lg.ASSIGN):hg(lg.CONTENT,o);break;case"</":{const n=i;for(;">"!==t[i];)i++;e=hg(lg.CLOSE_ELEMENT,t.substring(n,i)),i++,r.pop();break}case"/>":{const t=r.pop();e=hg(lg.CLOSE_ELEMENT,t);break}case"\x3c!--":{const e=["!","-","-"];for(;a()&&(">"!==e[2]||"-"!==e[1]||"-"!==e[0]);)e.shift(),e.push(t[i]),i++;return u()}case">":e=hg(lg.CLOSE_BRACKET);break;case"<":e=hg(lg.OPEN_BRACKET);break;default:if(o&&o.length>0){if(e.type===lg.CLOSE_BRACKET){let t="";"<"!==n()&&(t=l(!0)),e=hg(lg.CONTENT,o+t)}else if(e.type!==lg.ATTRIB_NAME&&e.type!==lg.CONTENT)e.type===lg.CLOSE_ELEMENT?(o=" ".repeat(f)+o,e=hg(lg.CONTENT,o)):e=hg(lg.ATTRIB_NAME,o);else{const t=" ".repeat(f)+o;e=hg(lg.CONTENT,t)}break}{const e='Unknown Syntax : "'+t[i]+'"';throw new Error(e)}}}else e=ug;return e};return{peek:n,next:u,hasNext:a}}};const{createLexer:pg}=dg,{Token:mg,TOKEN_TYPE:gg}=sg,[_g,bg,yg,wg]=["ROOT","ELEMENT","ATTRIBUTE","CONTENT"],vg=(t,e)=>({type:t,value:e}),xg=t=>vg(wg,t),kg=(t,e,i)=>vg(bg,{type:t,attributes:e,children:i}),Eg=(t,e)=>vg(yg,{name:t,value:e}),Sg=(t,e)=>{const i=[];for(;t.hasNext();){const r=t.next();switch(r.type){case gg.OPEN_BRACKET:{const e=t.next(),[r,n]=Mg(t);let a=[];n.type!==gg.CLOSE_ELEMENT&&(a=Sg(t,e)),a&&a.length>0&&a[0].type===gg.CONTENT&&(a=Ag(a)),i.push(kg(e.value,r,a));break}case gg.CLOSE_ELEMENT:if(r.value===e.value)return i;break;case gg.CONTENT:i.push(xg(r.value));break;case gg.EOF:return i;default:throw new Error(`Unknown Lexem type: ${r.type} "${r.value}, scoping element: ${e.value}"`)}}return i},Mg=t=>{const e=[];let i=t.peek();if(!t.hasNext()||i&&i.type===gg.CLOSE_BRACKET||i&&i.type===gg.CLOSE_ELEMENT)return[e,i];for(i=t.next();t.hasNext()&&i&&i.type!==gg.CLOSE_BRACKET&&i.type!==gg.CLOSE_ELEMENT;){const r=i;t.next();const n=t.next(),a=Eg(r.value,n.value);e.push(a),i=t.next()}return[e,i]};function Ag(t){let e=[],i="";return t.forEach((t=>{t.type===gg.CONTENT?i+=t.value:(i.length&&(e.push(xg(i)),i=""),e.push(t))})),i.length&&e.push(xg(i)),e}var Ig={transpile:function(t,e){const i=(t=>vg(_g,{children:Sg(t,mg(_g,"ROOT"))}))(pg(t));return e?e.convert(i):i},Node:vg,ElementNode:kg,AttribNode:Eg};const zg=og,{transpile:Pg}=Ig;var Tg=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}({convertXML:function(t,e){return Pg(t,e||zg)},createAST:function(t){return Pg(t)}}),Rg=e(Tg);const{convertXML:Og}=Rg,Bg="undefined"!=typeof self&&void 0===self.document,Cg=Wf({formats:[Ur]}),Lg=_.from([66,77,70,3]);function Dg(t,e){return function(t){if("string"==typeof t)return"BMF"===t.substring(0,3);const e=t.slice(0,4);return t.length>4&&e[0]===Lg[0]&&e[1]===Lg[1]&&e[2]===Lg[2]}(e)?("string"==typeof e&&(e=_.from(e,"binary")),Wm(e)):(e=e.toString().trim(),/.json$/.test(t)||"{"===e.charAt(0)?JSON.parse(e):/.xml$/.test(t)||"<"===e.charAt(0)?jm(e):Om(e))}function Ug(t){for(const e in t){try{t[e]=parseInt(t[e],10)}catch{}"object"==typeof t[e]&&Ug(t[e])}return t}async function Fg(t){let e=t;if("undefined"==typeof window&&!Bg){const{existsSync:i,promises:r}=await Promise.resolve().then((function(){return se}));i(t)&&(e=await r.readFile(t))}const i=await async function(t){if(Bg&&"string"==typeof t){const e=await fetch(t),i=await e.text(),r=Og(i).font.children.reduce(((t,e)=>({...t,...e})),{}),n=[],a=[],o=[];for(let t=0;t<r.pages.children.length;t++){const e=r.pages.children[t].page;n[parseInt(e.id,10)]=Ug(e.file)}for(let t=0;t<r.chars.children.length;t++)a.push(Ug(r.chars.children[t].char));for(let t=0;t<r.kernings.children.length;t++)o.push(Ug(r.kernings.children[t].kerning));return{info:r.info,common:r.common,pages:n,chars:a,kernings:o}}if("string"==typeof t){const e=await fetch(t);return Dg(t,await e.text())}return Dg("",t)}(e);return async function(t,e){const i={},r={};for(let t=0;t<e.chars.length;t++){const r=e.chars[t];i[String.fromCharCode(r.id)]=r}for(let t=0;t<e.kernings.length;t++){const i=String.fromCharCode(e.kernings[t].first);r[i]=r[i]||{},r[i][String.fromCharCode(e.kernings[t].second)]=e.kernings[t].amount}return{...e,chars:i,kernings:r,pages:await Promise.all(e.pages.map((async e=>Cg.read(Qm.join(Qm.dirname(t),e)))))}}(t,i)}var Ng=function(t,e,i,r,n,a){if(!Gg(t)||!Gg(e)||i&&!Gg(i))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==e.length||i&&i.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==r*n*4)throw new Error("Image data size does not match width/height.");a=Object.assign({},jg,a);const o=r*n,s=new Uint32Array(t.buffer,t.byteOffset,o),h=new Uint32Array(e.buffer,e.byteOffset,o);let l=!0;for(let t=0;t<o;t++)if(s[t]!==h[t]){l=!1;break}if(l){if(i&&!a.diffMask)for(let e=0;e<o;e++)Kg(t,4*e,a.alpha,i);return 0}const u=35215*a.threshold*a.threshold;let c=0;for(let o=0;o<n;o++)for(let s=0;s<r;s++){const h=4*(o*r+s),l=$g(t,e,h,h);Math.abs(l)>u?a.includeAA||!Zg(t,s,o,r,n,e)&&!Zg(e,s,o,r,n,t)?(i&&Jg(i,h,...l<0&&a.diffColorAlt||a.diffColor),c++):i&&!a.diffMask&&Jg(i,h,...a.aaColor):i&&(a.diffMask||Kg(t,h,a.alpha,i))}return c};const jg={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function Gg(t){return ArrayBuffer.isView(t)&&1===t.constructor.BYTES_PER_ELEMENT}function Zg(t,e,i,r,n,a){const o=Math.max(e-1,0),s=Math.max(i-1,0),h=Math.min(e+1,r-1),l=Math.min(i+1,n-1),u=4*(i*r+e);let c,f,d,p,m=e===o||e===h||i===s||i===l?1:0,g=0,_=0;for(let n=o;n<=h;n++)for(let a=s;a<=l;a++){if(n===e&&a===i)continue;const o=$g(t,t,u,4*(a*r+n),!0);if(0===o){if(m++,m>2)return!1}else o<g?(g=o,c=n,f=a):o>_&&(_=o,d=n,p=a)}return 0!==g&&0!==_&&(Hg(t,c,f,r,n)&&Hg(a,c,f,r,n)||Hg(t,d,p,r,n)&&Hg(a,d,p,r,n))}function Hg(t,e,i,r,n){const a=Math.max(e-1,0),o=Math.max(i-1,0),s=Math.min(e+1,r-1),h=Math.min(i+1,n-1),l=4*(i*r+e);let u=e===a||e===s||i===o||i===h?1:0;for(let n=a;n<=s;n++)for(let a=o;a<=h;a++){if(n===e&&a===i)continue;const o=4*(a*r+n);if(t[l]===t[o]&&t[l+1]===t[o+1]&&t[l+2]===t[o+2]&&t[l+3]===t[o+3]&&u++,u>2)return!0}return!1}function $g(t,e,i,r,n){let a=t[i+0],o=t[i+1],s=t[i+2],h=t[i+3],l=e[r+0],u=e[r+1],c=e[r+2],f=e[r+3];if(h===f&&a===l&&o===u&&s===c)return 0;h<255&&(h/=255,a=Vg(a,h),o=Vg(o,h),s=Vg(s,h)),f<255&&(f/=255,l=Vg(l,f),u=Vg(u,f),c=Vg(c,f));const d=Wg(a,o,s),p=Wg(l,u,c),m=d-p;if(n)return m;const g=qg(a,o,s)-qg(l,u,c),_=Yg(a,o,s)-Yg(l,u,c),b=.5053*m*m+.299*g*g+.1957*_*_;return d>p?-b:b}function Wg(t,e,i){return.29889531*t+.58662247*e+.11448223*i}function qg(t,e,i){return.59597799*t-.2741761*e-.32180189*i}function Yg(t,e,i){return.21147017*t-.52261711*e+.31114694*i}function Vg(t,e){return 255+(t-255)*e}function Jg(t,e,i,r,n){t[e+0]=i,t[e+1]=r,t[e+2]=n,t[e+3]=255}function Kg(t,e,i,r){const n=Vg(Wg(t[e+0],t[e+1],t[e+2]),i*t[e+3]/255);Jg(r,e,n,n,n)}var Xg=e(Ng);function Qg(t,e,i=.1){let r=t.bitmap,n=e.bitmap;if(r.width===n.width&&r.height===n.height||(r.width*r.height>n.width*n.height?r=td.resize(Zt(t),{w:n.width,h:n.height}).bitmap:n=td.resize(Zt(e),{w:r.width,h:r.height}).bitmap),"number"!=typeof i||i<0||i>1)throw new Error("threshold must be a number between 0 and 1");const a=new t.constructor({width:r.width,height:r.height,color:4294967295});return{percent:Xg(r.data,n.data,a.bitmap.data,a.bitmap.width,a.bitmap.height,{threshold:i})/(a.bitmap.width*a.bitmap.height),image:a}}const t_=[vc,Ec,Mc,Gc,id,sd,ad,ld,ud,fd,pd,Md,Pd,Dd,td,jd,Zd,zm],e_=[Xt,function(){return{mime:"image/x-ms-bmp",encode:Jt,decode:Kt}},kr,Pr,Ur,On],i_={bmp:Xt().mime,gif:kr().mime,jpeg:Pr().mime,png:Ur().mime,tiff:On().mime},r_=Wf({formats:e_,plugins:t_}),n_={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[t,e]of Object.entries(n_));let a_;const o_=32768,s_=65533;function h_(t,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":{const e=function(){if(void 0!==globalThis.TextDecoder)return null!=a_?a_:a_=new globalThis.TextDecoder("utf-8")}();return e?e.decode(t):function(t){const e=[],i=[];let r=0;t.length>=3&&239===t[0]&&187===t[1]&&191===t[2]&&(r=3);for(;r<t.length;){const n=t[r];if(n<=127){u_(e,i,n),r++;continue}if(n<194||n>244){u_(e,i,s_),r++;continue}if(n<=223){if(r+1>=t.length){u_(e,i,s_),r++;continue}const a=t[r+1];if(128!=(192&a)){u_(e,i,s_),r++;continue}u_(e,i,(31&n)<<6|63&a),r+=2;continue}if(n<=239){if(r+2>=t.length){u_(e,i,s_),r++;continue}const a=t[r+1],o=t[r+2];if(!!(128!=(192&a)||128!=(192&o)||224===n&&a<160||237===n&&a>=160)){u_(e,i,s_),r++;continue}u_(e,i,(15&n)<<12|(63&a)<<6|63&o),r+=3;continue}if(r+3>=t.length){u_(e,i,s_),r++;continue}const a=t[r+1],o=t[r+2],s=t[r+3];if(!!(128!=(192&a)||128!=(192&o)||128!=(192&s)||240===n&&a<144||244===n&&a>143)){u_(e,i,s_),r++;continue}c_(e,i,(7&n)<<18|(63&a)<<12|(63&o)<<6|63&s),r+=4}return l_(e,i),e.join("")}(t)}case"utf-16le":return function(t){const e=[],i=[],r=t.length;let n=0;for(;n+1<r;){const a=t[n]|t[n+1]<<8;if(n+=2,a>=55296&&a<=56319)if(n+1<r){const r=t[n]|t[n+1]<<8;r>=56320&&r<=57343?(u_(e,i,a),u_(e,i,r),n+=2):u_(e,i,s_)}else u_(e,i,s_);else u_(e,i,a>=56320&&a<=57343?s_:a)}n<r&&u_(e,i,s_);return l_(e,i),e.join("")}(t);case"us-ascii":case"ascii":return function(t){const e=[];for(let i=0;i<t.length;i+=o_){const r=Math.min(t.length,i+o_),n=new Array(r-i);for(let e=i,a=0;e<r;e++,a++)n[a]=127&t[e];e.push(String.fromCharCode.apply(null,n))}return e.join("")}(t);case"latin1":case"iso-8859-1":return function(t){const e=[];for(let i=0;i<t.length;i+=o_){const r=Math.min(t.length,i+o_),n=new Array(r-i);for(let e=i,a=0;e<r;e++,a++)n[a]=t[e];e.push(String.fromCharCode.apply(null,n))}return e.join("")}(t);case"windows-1252":return function(t){const e=[];let i="";for(let r=0;r<t.length;r++){const n=t[r],a=n>=128&&n<=159?n_[n]:void 0;i+=null!=a?a:String.fromCharCode(n),i.length>=o_&&(e.push(i),i="")}i&&e.push(i);return e.join("")}(t);default:throw new RangeError(`Encoding '${e}' not supported`)}}function l_(t,e){0!==e.length&&(t.push(String.fromCharCode.apply(null,e)),e.length=0)}function u_(t,e,i){e.push(i),e.length>=o_&&l_(t,e)}function c_(t,e,i){i<=65535?u_(t,e,i):(u_(t,e,55296+((i-=65536)>>10)),u_(t,e,56320+(1023&i)))}function f_(t){return new DataView(t.buffer,t.byteOffset)}const d_={len:1,get:(t,e)=>f_(t).getUint8(e),put:(t,e,i)=>(f_(t).setUint8(e,i),e+1)},p_={len:2,get:(t,e)=>f_(t).getUint16(e,!0),put:(t,e,i)=>(f_(t).setUint16(e,i,!0),e+2)},m_={len:2,get:(t,e)=>f_(t).getUint16(e),put:(t,e,i)=>(f_(t).setUint16(e,i),e+2)},g_={len:4,get:(t,e)=>f_(t).getUint32(e,!0),put:(t,e,i)=>(f_(t).setUint32(e,i,!0),e+4)},__={len:4,get:(t,e)=>f_(t).getUint32(e),put:(t,e,i)=>(f_(t).setUint32(e,i),e+4)},b_={len:4,get:(t,e)=>f_(t).getInt32(e),put:(t,e,i)=>(f_(t).setInt32(e,i),e+4)},y_={len:8,get:(t,e)=>f_(t).getBigUint64(e,!0),put:(t,e,i)=>(f_(t).setBigUint64(e,i,!0),e+8)};class w_{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){return h_(t.subarray(e,e+this.len),this.encoding)}}class v_ extends Error{constructor(){super("End-Of-Stream"),this.name="EndOfStreamError"}}class x_ extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class k_{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,e=!1){const i=await this.read(t,e);return this.peekQueue.push(t.subarray(0,i)),i}async read(t,e=!1){if(0===t.length)return 0;let i=this.readFromPeekBuffer(t);if(this.endOfStream||(i+=await this.readRemainderFromStream(t.subarray(i),e)),0===i&&!e)throw new v_;return i}readFromPeekBuffer(t){let e=t.length,i=0;for(;this.peekQueue.length>0&&e>0;){const r=this.peekQueue.pop();if(!r)throw new Error("peekData should be defined");const n=Math.min(r.length,e);t.set(r.subarray(0,n),i),i+=n,e-=n,n<r.length&&this.peekQueue.push(r.subarray(n))}return i}async readRemainderFromStream(t,e){let i=0;for(;i<t.length&&!this.endOfStream;){if(this.interrupted)throw new x_;const r=await this.readFromStream(t.subarray(i),e);if(0===r)break;i+=r}if(!e&&i<t.length)throw new v_;return i}}class E_ extends k_{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class S_ extends E_{async readFromStream(t,e){if(0===t.length)return 0;const i=await this.reader.read(new Uint8Array(t.length),{min:e?void 0:t.length});return i.done&&(this.endOfStream=i.done),i.value?(t.set(i.value),i.value.length):0}}class M_ extends k_{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,e){const i=Math.min(e.length,t.length);return t.set(e.subarray(0,i)),i<e.length?this.buffer=e.subarray(i):this.buffer=null,i}async readFromStream(t,e){if(0===t.length)return 0;let i=0;for(this.buffer&&(i+=this.writeChunk(t,this.buffer));i<t.length&&!this.endOfStream;){const e=await this.reader.read();if(e.done){this.endOfStream=!0;break}e.value&&(i+=this.writeChunk(t.subarray(i),e.value))}if(!e&&0===i&&this.endOfStream)throw new v_;return i}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}class A_{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",(()=>{this.abort()}))}async readToken(t,e=this.position){const i=new Uint8Array(t.len);if(await this.readBuffer(i,{position:e})<t.len)throw new v_;return t.get(i,0)}async peekToken(t,e=this.position){const i=new Uint8Array(t.len);if(await this.peekBuffer(i,{position:e})<t.len)throw new v_;return t.get(i,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new v_;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new v_;return t.get(this.numBuffer,0)}async ignore(t){if(void 0!==this.fileInfo.size){const e=this.fileInfo.size-this.position;if(t>e)return this.position+=e,e}return this.position+=t,t}async close(){await this.abort(),await(this.onClose?.())}normalizeOptions(t,e){if(!this.supportsRandomAccess()&&e&&void 0!==e.position&&e.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...e}}abort(){return Promise.resolve()}}class I_ extends A_{constructor(t,e){super(e),this.streamReader=t,this.fileInfo=e?.fileInfo??{}}async readBuffer(t,e){const i=this.normalizeOptions(t,e),r=i.position-this.position;if(r>0)return await this.ignore(r),this.readBuffer(t,e);if(r<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===i.length)return 0;const n=await this.streamReader.read(t.subarray(0,i.length),i.mayBeLess);if(this.position+=n,(!e||!e.mayBeLess)&&n<i.length)throw new v_;return n}async peekBuffer(t,e){const i=this.normalizeOptions(t,e);let r=0;if(i.position){const e=i.position-this.position;if(e>0){const n=new Uint8Array(i.length+e);return r=await this.peekBuffer(n,{mayBeLess:i.mayBeLess}),t.set(n.subarray(e)),r-e}if(e<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{r=await this.streamReader.peek(t.subarray(0,i.length),i.mayBeLess)}catch(t){if(e?.mayBeLess&&t instanceof v_)return 0;throw t}if(!i.mayBeLess&&r<i.length)throw new v_}return r}async ignore(t){const e=Math.min(256e3,t),i=new Uint8Array(e);let r=0;for(;r<t;){const n=t-r,a=await this.readBuffer(i,{length:Math.min(e,n)});if(a<0)return a;r+=a}return r}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class z_ extends A_{constructor(t,e){super(e),this.uint8Array=t,this.fileInfo={...e?.fileInfo??{},size:t.length}}async readBuffer(t,e){e?.position&&(this.position=e.position);const i=await this.peekBuffer(t,e);return this.position+=i,i}async peekBuffer(t,e){const i=this.normalizeOptions(t,e),r=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&r<i.length)throw new v_;return t.set(this.uint8Array.subarray(i.position,i.position+r)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}class P_ extends A_{constructor(t,e){super(e),this.blob=t,this.fileInfo={...e?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,e){e?.position&&(this.position=e.position);const i=await this.peekBuffer(t,e);return this.position+=i,i}async peekBuffer(t,e){const i=this.normalizeOptions(t,e),r=Math.min(this.blob.size-i.position,i.length);if(!i.mayBeLess&&r<i.length)throw new v_;const n=await this.blob.slice(i.position,i.position+r).arrayBuffer();return t.set(new Uint8Array(n)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}function T_(t,e){const i=function(t){try{const e=t.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new M_(e):new S_(e)}catch(e){if(e instanceof TypeError)return new M_(t.getReader());throw e}}(t),r=e??{},n=r.onClose;return r.onClose=async()=>{if(await i.close(),n)return n()},new I_(i,r)}var R_,O_,B_={exports:{}};function C_(){if(O_)return R_;O_=1;var t=1e3,e=60*t,i=60*e,r=24*i,n=7*r,a=365.25*r;function o(t,e,i,r){var n=e>=1.5*i;return Math.round(t/i)+" "+r+(n?"s":"")}return R_=function(s,h){h=h||{};var l=typeof s;if("string"===l&&s.length>0)return function(o){if((o=String(o)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!s)return;var h=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return h*a;case"weeks":case"week":case"w":return h*n;case"days":case"day":case"d":return h*r;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}(s);if("number"===l&&isFinite(s))return h.long?function(n){var a=Math.abs(n);if(a>=r)return o(n,a,r,"day");if(a>=i)return o(n,a,i,"hour");if(a>=e)return o(n,a,e,"minute");if(a>=t)return o(n,a,t,"second");return n+" ms"}(s):function(n){var a=Math.abs(n);if(a>=r)return Math.round(n/r)+"d";if(a>=i)return Math.round(n/i)+"h";if(a>=e)return Math.round(n/e)+"m";if(a>=t)return Math.round(n/t)+"s";return n+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},R_}var L_=function(t){function e(t){let r,n,a,o=null;function s(...t){if(!s.enabled)return;const i=s,n=Number(new Date),a=n-(r||n);i.diff=a,i.prev=r,i.curr=n,r=n,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";o++;const a=e.formatters[n];if("function"==typeof a){const e=t[o];r=a.call(i,e),t.splice(o,1),o--}return r})),e.formatArgs.call(i,t);(i.log||e.log).apply(i,t)}return s.namespace=t,s.useColors=e.useColors(),s.color=e.selectColor(t),s.extend=i,s.destroy=e.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==e.namespaces&&(n=e.namespaces,a=e.enabled(t)),a),set:t=>{o=t}}),"function"==typeof e.init&&e.init(s),s}function i(t,i){const r=e(this.namespace+(void 0===i?":":i)+t);return r.log=this.log,r}function r(t,e){let i=0,r=0,n=-1,a=0;for(;i<t.length;)if(r<e.length&&(e[r]===t[i]||"*"===e[r]))"*"===e[r]?(n=r,a=i,r++):(i++,r++);else{if(-1===n)return!1;r=n+1,a++,i=a}for(;r<e.length&&"*"===e[r];)r++;return r===e.length}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names,...e.skips.map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const i=("string"==typeof t?t:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const t of i)"-"===t[0]?e.skips.push(t.slice(1)):e.names.push(t)},e.enabled=function(t){for(const i of e.skips)if(r(t,i))return!1;for(const i of e.names)if(r(t,i))return!0;return!1},e.humanize=C_(),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((i=>{e[i]=t[i]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let i=0;for(let e=0;e<t.length;e++)i=(i<<5)-i+t.charCodeAt(e),i|=0;return e.colors[Math.abs(i)%e.colors.length]},e.enable(e.load()),e};!function(t,e){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;e.splice(1,0,i,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(r++,"%c"===t&&(n=r))})),e.splice(n,0,i)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=L_(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(B_,B_.exports);var D_=e(B_.exports);const U_=67324752,F_=134695760,N_=33639248,j_=101010256,G_={get:t=>({signature:g_.get(t,0),compressedSize:g_.get(t,8),uncompressedSize:g_.get(t,12)}),len:16},Z_={get(t){const e=p_.get(t,6);return{signature:g_.get(t,0),minVersion:p_.get(t,4),dataDescriptor:!!(8&e),compressedMethod:p_.get(t,8),compressedSize:g_.get(t,18),uncompressedSize:g_.get(t,22),filenameLength:p_.get(t,26),extraFieldLength:p_.get(t,28),filename:null}},len:30},H_={get:t=>({signature:g_.get(t,0),nrOfThisDisk:p_.get(t,4),nrOfThisDiskWithTheStart:p_.get(t,6),nrOfEntriesOnThisDisk:p_.get(t,8),nrOfEntriesOfSize:p_.get(t,10),sizeOfCd:g_.get(t,12),offsetOfStartOfCd:g_.get(t,16),zipFileCommentLength:p_.get(t,20)}),len:22},$_={get(t){const e=p_.get(t,8);return{signature:g_.get(t,0),minVersion:p_.get(t,6),dataDescriptor:!!(8&e),compressedMethod:p_.get(t,10),compressedSize:g_.get(t,20),uncompressedSize:g_.get(t,24),filenameLength:p_.get(t,28),extraFieldLength:p_.get(t,30),fileCommentLength:p_.get(t,32),relativeOffsetOfLocalHeader:g_.get(t,42),filename:null}},len:46};function W_(t){const e=new Uint8Array(g_.len);return g_.put(e,0,t),e}const q_=D_("tokenizer:inflate"),Y_=262144,V_=W_(F_),J_=W_(j_);class K_{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Y_)}async isZip(){return await this.peekSignature()===U_}peekSignature(){return this.tokenizer.peekToken(g_)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,e=Math.min(16384,t.fileInfo.size),i=this.syncBuffer.subarray(0,e);await this.tokenizer.readBuffer(i,{position:t.fileInfo.size-e});for(let r=i.length-4;r>=0;r--)if(i[r]===J_[0]&&i[r+1]===J_[1]&&i[r+2]===J_[2]&&i[r+3]===J_[3])return t.fileInfo.size-e+r;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess())return void q_("Cannot reading central-directory without random-read support");q_("Reading central-directory...");const t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){q_("Central-directory 32-bit signature found");const i=await this.tokenizer.readToken(H_,e),r=[];this.tokenizer.setPosition(i.offsetOfStartOfCd);for(let t=0;t<i.nrOfEntriesOfSize;++t){const e=await this.tokenizer.readToken($_);if(e.signature!==N_)throw new Error("Expected Central-File-Header signature");e.filename=await this.tokenizer.readToken(new w_(e.filenameLength,"utf-8")),await this.tokenizer.ignore(e.extraFieldLength),await this.tokenizer.ignore(e.fileCommentLength),r.push(e),q_(`Add central-directory file-entry: n=${t+1}/${r.length}: filename=${r[t].filename}`)}return this.tokenizer.setPosition(t),r}this.tokenizer.setPosition(t)}async unzip(t){const e=await this.readCentralDirectory();if(e)return this.iterateOverCentralDirectory(e,t);let i=!1;do{const e=await this.readLocalFileHeader();if(!e)break;const r=t(e);let n;if(i=!!r.stop,await this.tokenizer.ignore(e.extraFieldLength),e.dataDescriptor&&0===e.compressedSize){const t=[];let i=Y_;q_("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let n=-1;for(;n<0&&i===Y_;){i=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),n=X_(this.syncBuffer.subarray(0,i),V_);const e=n>=0?n:i;if(r.handler){const i=new Uint8Array(e);await this.tokenizer.readBuffer(i),t.push(i)}else await this.tokenizer.ignore(e)}q_(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),r.handler&&await this.inflate(e,Q_(t),r.handler)}else r.handler?(q_(`Reading compressed-file-data: ${e.compressedSize} bytes`),n=new Uint8Array(e.compressedSize),await this.tokenizer.readBuffer(n),await this.inflate(e,n,r.handler)):(q_(`Ignoring compressed-file-data: ${e.compressedSize} bytes`),await this.tokenizer.ignore(e.compressedSize));if(q_(`Reading data-descriptor at pos=${this.tokenizer.position}`),e.dataDescriptor){if(134695760!==(await this.tokenizer.readToken(G_)).signature)throw new Error("Expected data-descriptor-signature at position "+(this.tokenizer.position-G_.len))}}while(!i)}async iterateOverCentralDirectory(t,e){for(const i of t){const t=e(i);if(t.handler){this.tokenizer.setPosition(i.relativeOffsetOfLocalHeader);const e=await this.readLocalFileHeader();if(e){await this.tokenizer.ignore(e.extraFieldLength);const r=new Uint8Array(i.compressedSize);await this.tokenizer.readBuffer(r),await this.inflate(e,r,t.handler)}}if(t.stop)break}}async inflate(t,e,i){if(0===t.compressedMethod)return i(e);if(8!==t.compressedMethod)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);q_(`Decompress filename=${t.filename}, compressed-size=${e.length}`);return i(await K_.decompressDeflateRaw(e))}static async decompressDeflateRaw(t){const e=new ReadableStream({start(e){e.enqueue(t),e.close()}}),i=new DecompressionStream("deflate-raw"),r=e.pipeThrough(i);try{const t=new Response(r),e=await t.arrayBuffer();return new Uint8Array(e)}catch(t){const e=t instanceof Error?`Failed to deflate ZIP entry: ${t.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(e)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(g_);if(t===U_){const t=await this.tokenizer.readToken(Z_);return t.filename=await this.tokenizer.readToken(new w_(t.filenameLength,"utf-8")),t}if(t===N_)return!1;if(3759263696===t)throw new Error("Encrypted ZIP");throw new Error("Unexpected signature")}}function X_(t,e){const i=t.length,r=e.length;if(r>i)return-1;for(let n=0;n<=i-r;n++){let i=!0;for(let a=0;a<r;a++)if(t[n+a]!==e[a]){i=!1;break}if(i)return n}return-1}function Q_(t){const e=t.reduce(((t,e)=>t+e.length),0),i=new Uint8Array(e);let r=0;for(const e of t)i.set(e,r),r+=e.length;return i}class tb{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(e){const i=new Uint8Array(1024),r=await t.readBuffer(i,{mayBeLess:!0});0!==r?e.enqueue(i.subarray(0,r)):e.close()}}).pipeThrough(new DecompressionStream("gzip"))}}function eb(t){const{byteLength:e}=t;return 6===e?t.getUint16(0)*2**32+t.getUint32(2):5===e?t.getUint8(0)*2**32+t.getUint32(1):4===e?t.getUint32(0):3===e?65536*t.getUint8(0)+t.getUint16(1):2===e?t.getUint16(0):1===e?t.getUint8(0):void 0}new globalThis.TextDecoder("utf8"),new globalThis.TextEncoder,Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));const ib={get:(t,e)=>127&t[e+3]|t[e+2]<<7|t[e+1]<<14|t[e]<<21,len:4},rb=4100,nb=1048576,ab=2**31-1,ob=16777216,sb=nb,hb=ob,lb=ob,ub=nb,cb=ob,fb=nb,db=nb,pb=nb,mb=ob,gb=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),_b=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds "],bb=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class yb extends Error{}function wb(t,e,i){if(!Number.isFinite(t)||t<0||t>e)throw new yb(`${i} has invalid size ${t} (maximum ${e} bytes)`);return t}async function vb(t,e,{maximumLength:i=ob,reason:r="skip"}={}){const n=wb(e,i,r);await t.ignore(n)}async function xb(t,e,i,{maximumLength:r=e.length,reason:n="read"}={}){const a=wb(e.length,r,n);return t.readBuffer(e,{...i,length:a})}const kb=134695760,Eb=16,Sb=Eb-1;function Mb(t,e){if(t.length<Eb)return-1;const i=t.length-Eb;for(let r=0;r<=i;r++)if(g_.get(t,r)===kb&&g_.get(t,r+8)===e+r)return r;return-1}async function Ab(t,{shouldBuffer:e,maximumLength:i=nb}={}){const{syncBuffer:r}=t,{length:n}=r,a=[];let o=0;for(;;){const s=await t.tokenizer.peekBuffer(r,{mayBeLess:!0}),h=Mb(r.subarray(0,s),o),l=h>=0?0:s===n?Math.min(Sb,s-1):0,u=h>=0?h:s-l;if(0===u)break;if(o+=u,o>i)throw new Error(`ZIP entry compressed data exceeds ${i} bytes`);if(e){const e=new Uint8Array(u);await t.tokenizer.readBuffer(e),a.push(e)}else await t.tokenizer.ignore(u);if(h>=0)break}if(Rb(t.tokenizer)||(t.knownSizeDescriptorScannedBytes+=o),e)return function(t,e){const i=new Uint8Array(e);let r=0;for(const e of t)i.set(e,r),r+=e.length;return i}(a,o)}async function Ib(t,e,{shouldBuffer:i,maximumDescriptorLength:r=nb}={}){if(e.dataDescriptor&&0===e.compressedSize)return Ab(t,{shouldBuffer:i,maximumLength:r});if(!i)return void await vb(t.tokenizer,e.compressedSize,{maximumLength:Rb(t.tokenizer)?nb:t.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});const n=function(t){const e=t.fileInfo.size,i=Number.isFinite(e)?Math.max(0,e-t.position):Number.MAX_SAFE_INTEGER;return Math.min(i,ab)}(t.tokenizer);if(!Number.isFinite(e.compressedSize)||e.compressedSize<0||e.compressedSize>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);const a=new Uint8Array(e.compressedSize);return await t.tokenizer.readBuffer(a),a}function zb(t){switch(t=t.toLowerCase()){case"application/epub+zip":return{ext:"epub",mime:t};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:t};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:t};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:t};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:t};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:t};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:t};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:t};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:t};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:t};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:t};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:t};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:t};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:t};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:t};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:t};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function Pb(t,e,i){i={offset:0,...i};for(const[r,n]of e.entries())if(i.mask){if(n!==(i.mask[r]&t[r+i.offset]))return!1}else if(n!==t[r+i.offset])return!1;return!0}function Tb(t){return Number.isFinite(t)?Math.max(1,Math.trunc(t)):rb}function Rb(t){const e=t.fileInfo.size;return!Number.isFinite(e)||e===Number.MAX_SAFE_INTEGER}function Ob(t,e,i){return Rb(t)&&t.position-e>i}function Bb(t,e=nb){const i=[t.compressedSize,t.uncompressedSize];for(const t of i)if(!Number.isFinite(t)||t<0||t>e)return!1;return!0}function Cb(t){if(t.hasContentTypesEntry&&!t.hasUnparseableContentTypes&&!t.isParsingContentTypes&&!t.hasParsedContentTypesEntry)return t.hasWordDirectory?{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:t.hasPresentationDirectory?{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:t.hasSpreadsheetDirectory?{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}:t.hasThreeDimensionalModelEntry?{ext:"3mf",mime:"model/3mf"}:void 0}K_.prototype.inflate=async function(t,e,i){if(0===t.compressedMethod)return i(e);if(8!==t.compressedMethod)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);return i(await async function(t,{maximumLength:e=nb}={}){const i=new ReadableStream({start(e){e.enqueue(t),e.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),r=[];let n=0;try{for(;;){const{done:t,value:a}=await i.read();if(t)break;if(n+=a.length,n>e)throw await i.cancel(),new Error(`ZIP entry decompressed data exceeds ${e} bytes`);r.push(a)}}finally{i.releaseLock()}const a=new Uint8Array(n);let o=0;for(const t of r)a.set(t,o),o+=t.length;return a}(e,{maximumLength:nb}))},K_.prototype.unzip=async function(t){let e=!1,i=0;const r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Ob(this.tokenizer,r,ob))throw new yb(`ZIP stream probing exceeds ${ob} bytes`);const o=await this.readLocalFileHeader();if(!o)break;if(i++,i>1024)throw new Error("ZIP entry count exceeds 1024");const s=t(o);e=Boolean(s.stop),await this.tokenizer.ignore(o.extraFieldLength);const h=await Ib(this,o,{shouldBuffer:Boolean(s.handler),maximumDescriptorLength:Math.min(nb,(n=this,a=r,Rb(n.tokenizer)?Math.max(0,ob-(n.tokenizer.position-a)):Math.max(0,nb-n.knownSizeDescriptorScannedBytes)))});if(s.handler&&await this.inflate(o,h,s.handler),o.dataDescriptor){const t=new Uint8Array(Eb);if(await this.tokenizer.readBuffer(t),g_.get(t,0)!==kb)throw new Error("Expected data-descriptor-signature at position "+(this.tokenizer.position-t.length))}if(Ob(this.tokenizer,r,ob))throw new yb(`ZIP stream probing exceeds ${ob} bytes`)}while(!e);var n,a};class Lb{constructor(t){const e=(i=t?.mpegOffsetTolerance,Number.isFinite(i)?Math.max(0,Math.min(4098,Math.trunc(i))):0);var i;this.options={...t,mpegOffsetTolerance:e},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}async fromTokenizer(t,e=0){this.detectionReentryCount=e;const i=t.position;for(const e of this.detectors){let r;try{r=await e.detect(t)}catch(t){if(t instanceof v_)return;if(t instanceof yb)return;throw t}if(r)return r;if(i!==t.position)return}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const e=t instanceof Uint8Array?t:new Uint8Array(t);var i,r;if(e?.length>1)return this.fromTokenizer((i=e,r=this.getTokenizerOptions(),new z_(i,r)))}async fromBlob(t){const e=function(t,e){return new P_(t,e)}(t,this.getTokenizerOptions());try{return await this.fromTokenizer(e)}finally{await e.close()}}async fromStream(t){const e=T_(t,this.getTokenizerOptions());try{return await this.fromTokenizer(e)}finally{await e.close()}}async toDetectionStream(t,e){const i=Tb(e?.sampleSize??rb);let r,n;const a=t.getReader({mode:"byob"});try{const{value:t,done:e}=await a.read(new Uint8Array(i));if(n=t,!e&&t)try{r=await this.fromBuffer(t.subarray(0,i))}catch(t){if(!(t instanceof v_))throw t;r=void 0}n=t}finally{a.releaseLock()}const o=new TransformStream({async start(t){t.enqueue(n)},transform(t,e){e.enqueue(t)}}),s=t.pipeThrough(o);return s.fileType=r,s}check(t,e){return Pb(this.buffer,t,e)}checkString(t,e){return this.check(function(t,e){if("utf-16le"===e){const e=[];for(let i=0;i<t.length;i++){const r=t.charCodeAt(i);e.push(255&r,r>>8&255)}return e}if("utf-16be"===e){const e=[];for(let i=0;i<t.length;i++){const r=t.charCodeAt(i);e.push(r>>8&255,255&r)}return e}return[...t].map((t=>t.charCodeAt(0)))}(t,e?.encoding),e)}detectConfident=async t=>{if(this.buffer=new Uint8Array(rb),void 0===t.fileInfo.size&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191])){if(this.detectionReentryCount>=256)return;return this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t)}if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8])){if(this.gzipProbeDepth>=1)return{ext:"gz",mime:"application/gzip"};const e=function(t,e){const i=t.getReader();let r=0,n=!1,a=!1;const o=async t=>{n||a||(a=!0,await i.cancel(t))};return new ReadableStream({async pull(t){if(r>=e)return t.close(),void await o();const{done:a,value:s}=await i.read();if(a||!s)return n=!0,void t.close();const h=e-r;if(s.length>h)return t.enqueue(s.subarray(0,h)),r+=h,t.close(),void await o();t.enqueue(s),r+=s.length},async cancel(t){await o(t)}})}(new tb(t).inflate(),hb);let i;try{this.gzipProbeDepth++,i=await this.fromStream(e)}catch(r){if("AbortError"===r?.name)throw r}finally{this.gzipProbeDepth--}return"tar"===i?.ext?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await vb(t,6,{maximumLength:6,reason:"ID3 header prefix"});const n=await t.readToken(ib),a=Rb(t);if(!Number.isFinite(n)||n<0||a&&(n>lb||t.position+n>lb))return;if(t.position+n>t.fileInfo.size){if(a)return;return{ext:"mp3",mime:"audio/mpeg"}}try{await vb(t,n,{maximumLength:a?lb:t.fileInfo.size,reason:"ID3 payload"})}catch(o){if(o instanceof v_)return;throw o}if(this.detectionReentryCount>=256)return;return this.detectionReentryCount++,this.fromTokenizer(t,this.detectionReentryCount)}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let s;const h={hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1};try{await new K_(t).unzip((t=>{!function(t,e){e.startsWith("word/")&&(t.hasWordDirectory=!0),e.startsWith("ppt/")&&(t.hasPresentationDirectory=!0),e.startsWith("xl/")&&(t.hasSpreadsheetDirectory=!0),e.startsWith("3D/")&&e.endsWith(".model")&&(t.hasThreeDimensionalModelEntry=!0)}(h,t.filename);const e="[Content_Types].xml"===t.filename,i=Cb(h);if(!e&&i)return s=i,{stop:!0};switch(t.filename){case"META-INF/mozilla.rsa":return s={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return s={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Bb(t,sb)?{async handler(t){const e=new TextDecoder("utf-8").decode(t).trim();s=zb(e)},stop:!0}:{};case"[Content_Types].xml":return h.hasContentTypesEntry=!0,Bb(t,sb)?(h.isParsingContentTypes=!0,{async handler(t){const e=function(t){const e=t.indexOf('.main+xml"');if(-1===e){const e="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return t.includes(`ContentType="${e}"`)?e:void 0}const i=t.slice(0,e),r=i.lastIndexOf('"');return i.slice(r+1)}(new TextDecoder("utf-8").decode(t));e&&(s=zb(e)),h.hasParsedContentTypesEntry=!0,h.isParsingContentTypes=!1},stop:!0}):(h.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(t.filename)?(s={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}))}catch(l){if(!function(t){if(t instanceof v_)return!0;if(t instanceof yb)return!0;if(!(t instanceof Error))return!1;if(gb.has(t.message))return!0;if(bb.has(t.code))return!0;for(const e of _b)if(t.message.startsWith(e))return!0;return!1}(l))throw l;h.isParsingContentTypes&&(h.isParsingContentTypes=!1,h.hasUnparseableContentTypes=!0)}return s??Cb(h)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);const u=new Uint8Array(8);return await t.readBuffer(u),Pb(u,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Pb(u,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Pb(u,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Pb(u,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Pb(u,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Pb(u,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const c=await this.readTiffHeader(!1);if(c)return c}if(this.check([77,77])){const f=await this.readTiffHeader(!0);if(f)return f}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function d(){const e=await t.peekNumber(d_);let i=128,r=0;for(;!(e&i)&&0!==i;)++r,i>>=1;const n=new Uint8Array(r+1);return await xb(t,n,void 0,{maximumLength:n.length,reason:"EBML field"}),n}async function p(){const t=await d(),e=await d();e[0]^=128>>e.length-1;const i=Math.min(6,e.length),r=new DataView(t.buffer),n=new DataView(e.buffer,e.length-i,i);return{id:eb(r),len:eb(n)}}async function m(e){let i=0;for(;e>0;){if(i++,i>256)return;if(Ob(t,_,ob))return;const r=t.position,n=await p();if(17026===n.id){if(n.len>64)return;const e=wb(n.len,64,"EBML DocType");return(await t.readToken(new w_(e))).replaceAll(/\00.*$/g,"")}if(Rb(t)&&(!Number.isFinite(n.len)||n.len<0||n.len>ub))return;if(await vb(t,n.len,{maximumLength:Rb(t)?ub:t.fileInfo.size,reason:"EBML payload"}),--e,t.position<=r)return}}const g=await p(),_=t.position;switch(await m(g.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const b=__.get(this.buffer,4),y=m_.get(this.buffer,6);if(b>0&&b<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(y>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const w=new w_(4,"latin1").get(this.buffer,2);if(w.match("^d*")&&w>=1e3&&w<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){await t.ignore(8);return"debian-binary"===await t.readToken(new w_(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("WEBVTT")&&["\n","\r","\t"," ","\0"].some((t=>this.checkString(t,{offset:6}))))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const v={ext:"png",mime:"image/png"},x={ext:"apng",mime:"image/apng"};async function k(){return{length:await t.readToken(b_),type:await t.readToken(new w_(4,"latin1"))}}await t.ignore(8);const E=Rb(t),S=t.position;let M=0,A=!1;do{if(M++,M>512)break;if(Ob(t,S,cb))break;const I=t.position,z=await k();if(z.length<0)return;if("IHDR"===z.type){if(13!==z.length)return;A=!0}switch(z.type){case"IDAT":return v;case"acTL":return x;default:if(!A&&"CgBI"!==z.type)return;if(E&&z.length>fb)return A&&32&z.type.codePointAt(0)?v:void 0;try{await vb(t,z.length+4,{maximumLength:E?fb+4:t.fileInfo.size,reason:"PNG chunk payload"})}catch(P){if(!E&&(P instanceof yb||P instanceof v_))return v;throw P}}if(t.position<=I)break}while(t.position+8<t.fileInfo.size);return v}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const T=new w_(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(T){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return T.startsWith("3g")?T.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("REGEDIT4\r\n"))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let R=!1;try{async function O(){const e=new Uint8Array(16);return await xb(t,e,void 0,{maximumLength:e.length,reason:"ASF header GUID"}),{id:e,size:Number(await t.readToken(y_))}}await vb(t,30,{maximumLength:30,reason:"ASF header prelude"});const B=Rb(t),C=t.position;let L=0;for(;t.position+24<t.fileInfo.size&&(L++,!(L>512))&&!Ob(t,C,ob);){const D=t.position,U=await O();let F=U.size-24;if(!Number.isFinite(F)||F<0){R=!0;break}if(Pb(U.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const N=new Uint8Array(16);if(F-=await xb(t,N,void 0,{maximumLength:N.length,reason:"ASF stream type GUID"}),Pb(N,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Pb(N,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(B&&F>db){R=!0;break}if(await vb(t,F,{maximumLength:B?db:t.fileInfo.size,reason:"ASF header payload"}),t.position<=D){R=!0;break}}}catch(j){if(!(j instanceof v_||j instanceof yb))throw j;Rb(t)&&(R=!0)}if(R)return;return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10])){await t.ignore(20);switch(await t.readToken(new w_(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const G=new DataView(this.buffer.buffer).getUint32(12,!0);if(G>12&&this.buffer.length>=G+16)try{const Z=(new TextDecoder).decode(this.buffer.subarray(16,G+16));if(JSON.parse(Z).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary  \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&function(t,e=0){const i=Number.parseInt(new w_(6).get(t,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(i))return!1;let r=256;for(let i=e;i<e+148;i++)r+=t[i];for(let i=e+156;i<e+512;i++)r+=t[i];return i===r}(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const H="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:H})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:H})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString("Windows Registry Editor Version 5.00\r\n",{offset:2,encoding:H})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}return this.checkString("-----BEGIN PGP MESSAGE-----")?{ext:"pgp",mime:"application/pgp-encrypted"}:void 0};detectImprecise=async t=>{this.buffer=new Uint8Array(rb);const e=function(t){return Number.isFinite(t)?Math.max(0,t):Number.MAX_SAFE_INTEGER}(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,e),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let t=0;t<=this.options.mpegOffsetTolerance;++t){const e=this.scanMpeg(t);if(e)return e}};async readTiffTag(t){const e=await this.tokenizer.readToken(t?m_:p_);switch(await this.tokenizer.ignore(10),e){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const e=await this.tokenizer.readToken(t?m_:p_);if(!(e>512||Rb(this.tokenizer)&&2+12*e>mb))for(let i=0;i<e;++i){const e=await this.readTiffTag(t);if(e)return e}}async readTiffHeader(t){const e={ext:"tif",mime:"image/tiff"},i=(t?m_:p_).get(this.buffer,2),r=(t?__:g_).get(this.buffer,4);if(42===i){if(r>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r>=8){const e=(t?m_:p_).get(this.buffer,8),i=(t?m_:p_).get(this.buffer,10);if(28===e&&254===i||31===e&&11===i)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Rb(this.tokenizer)&&r>pb)return e;const i=Rb(this.tokenizer)?mb:this.tokenizer.fileInfo.size;try{await vb(this.tokenizer,r,{maximumLength:i,reason:"TIFF IFD offset"})}catch(t){if(t instanceof v_)return;throw t}let n;try{n=await this.readTiffIFD(t)}catch(t){if(t instanceof v_)return;throw t}return n??e}if(43===i)return e}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"]);var Db=Object.freeze({__proto__:null,FileTypeParser:Lb,fileTypeFromBuffer:async function(t,e){return new Lb(e).fromBuffer(t)},normalizeSampleSize:Tb,reasonableDetectionSizeInBytes:rb});export{Vc as BlendMode,it as BmpCompression,$c as HorizontalAlign,r_ as Jimp,i_ as JimpMime,Cr as PNGColorType,Or as PNGFilterType,qf as ResizeStrategy,qc as VerticalAlign,qt as colorDiff,Id as compareHashes,Vt as cssColorToHex,e_ as defaultFormats,t_ as defaultPlugins,Qg as diff,Ad as distance,$t as intToRGBA,Yt as limit255,Fg as loadFont,Td as measureText,Od as measureTextHeight,Wt as rgbaToInt};
//# sourceMappingURL=index.js.map